public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Andrew Fish <afish@apple.com>
To: JUNWEN JIA <jiajunwen123@gmail.com>
Cc: "edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Subject: Re: EDK debug question
Date: Tue, 23 Jan 2018 22:55:30 -0800	[thread overview]
Message-ID: <6A3ED54F-6755-4C6E-B6AD-53F55219DC30@apple.com> (raw)
In-Reply-To: <5a68284f.ce336b0a.101b2.a31e@mx.google.com>

Yea don't do that. 
1st off EFI does not assume the PC hardware from 1984 exists in your system like the old PC BIOS. 

There are EFI services that abstract these hardware features. 

gRT->SetWakeupTime() 
gRT->ResetSystem()

You can lookup in the Services - Runtime Services chapter of the UEFI Spec for details. 

To use gRT you will need to  #include <Library/UefiRuntimeServicesTableLib.h> and list UefiRuntimeServicesTableLib in the [LibraryClasses] section of the .INF file to make the gRT global compile and link in your App. 

Also even though you should NOT do this you could write your RTC code using the IoLib via inb is IoRead8() and outb is IoWrite8() C API and you don't have to write it in assembler. 

Thanks,

Andrew Fish

> On Jan 23, 2018, at 10:31 PM, JUNWEN JIA <jiajunwen123@gmail.com> wrote:
> 
> Hi, Andrew:
>    Thanks for your reply. What I was trying is to restart my computer after 1 minute shutdown in shell. That is why I need to get .efi file through EDK.
> The following is the assembly language I wrote in Reboot.asm, and I put this file in BaseLib->Ia32,along with Reboot.asm, Reboot.c. 
> .code
> Reboot PROC
> mov al,0bh
> out 70h,al
> mov al,20h
> out 71h,al ;enable RTC interrupt
> mov al,01h
> out 70h,al
> mov al,00h
> out 71h,al 
> mov al,03h
> out 70h,al
> mov al,01h
> out 71h,al 
> mov al,05h
> out 70h,al
> mov al,12h 
> out 71h,al ;wirte cmos alarm
> mov al,00h
> out 70h,al
> mov al,00h
> out 71h,al 
> mov al,02h
> out 70h,al
> mov al,00h
> out 71h,al 
> mov al,04h
> out 70h,al
> mov al,12h 
> out 71h,al ;set cmos time
> ret 
> Reboot ENDP
> END
> 
> 
> Best regards!
> 
> 发送自 Windows 10 版邮件应用
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel



  reply	other threads:[~2018-01-24  6:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-24  6:31 EDK debug question JUNWEN JIA
2018-01-24  6:55 ` Andrew Fish [this message]
  -- strict thread matches above, loose matches on Subject: below --
2018-01-24  8:30 JUNWEN JIA
2018-01-24  2:23 JUNWEN JIA
2018-01-24  3:00 ` Andrew Fish

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6A3ED54F-6755-4C6E-B6AD-53F55219DC30@apple.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox