Hi Andrew, Thanks for answering this question. I was curious about interrupts as well. If I understand you correctly, a timer exists and it is only used when a driver or a program requests it.
So, when we come up in a basic UEFI Shell the system is essentially tickless? Thanks, Stephen Andrew Fish wrote: > > On May 16, 2013, at 7:16 AM, "zzhh.happy" <zzhh.ha...@163.com > <mailto:zzhh.ha...@163.com>> wrote: > >> Hi all, >> >> I'm fresh man for studying UEFI,and there are some questions ,is there >> anyone can help,thanks! >> as we know there is only on interrupt that is the timer,it works as >> the heartbeat timer.but in X86 platform i can't find the >> timer interrupt handle function. except bellow >> service *CoreTimerTick,*but there is a input >> parameter *Duration,*never heard that interrupt service have input >> parameter,if yes, who pass it in? >> and there are my question: >> > UEFI does not define how the timer works, just that it exists. The UEFI > Platform Initialization Specification 1.2.1 > <http://www.uefi.org/specs/platform_agreement> (also called PI spec) > defines how the timer works in the edk2 http://www.uefi.org/specs/. > > The PI defines a set of Architectural Protocol that produce the hardware > services needed to produce the EFI services. If you look > in > https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2/MdeModulePkg/Core/Dxe/DxeMain/DxeProtocolNotify.c > > you will see the mArchProtocols array that contains a list of these > architectural protocols, and some globals that filled in when the > protocols are registered. > > So basically the CPU AP, gEfiCpuArchProtocolGuid, abstracts interrupt > handling in a processor agnostic way (Same DXE Core source works for > Itainum, IA32, X64, and ARM). The Timer AP, gEfiTimerArchProtocolGuid, > depends on the CPU AP and produces the timer tick for the platform. >> 1.in x86 platform what is the heartbeat,is it the leagcy 8254? > It can be any timer. It is what ever Timer AP driver gets included in > the firmware. Search for drivers installing gEfiTimerArchProtocolGuid. >> 2.what is the interrupt vector number? > There is not a standard. It is platform specific and set by the driver. > Some drivers may offer a PCD config setting to change the vector. >> 3.where is the IDT table exist in memery after the timer start ticking > The CPU AP driver sets up the IDT. For X64/IA32 the IDT is not at a > fixed address. Search for a driver installing gEfiCpuArchProtocolGuid. > Note: There is an assemble instruction that lets you know the address, > but it is probably a very bad idea to patch anything into the table > directly as debuggers need to cooperate with the CPU AP to hook vectors, > so you may break the debugger or the CPU AP. You can use > gEfiCpuArchProtocolGuid services to hook an interrupt vector if that is > what you need to do. > There are C functions that implement common assembly instruction in the > BaseLib. So AsmReadIdtr(). >> 4.what is the heartbeat service handle,and how it registered to the >> cpu's interrupt verctor table. > https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2/MdeModulePkg/Core/Dxe/DxeMain/DxeProtocolNotify.c > > When the Timer AP service is registered the DXE Core does: > > gTimer->RegisterHandler (gTimer, CoreTimerTick); > > Which registers the DXE Cores timer callback. > > This is an example gEfiCpuArchProtocolGuid driver: > https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2/UefiCpuPkg/CpuDxe/ > This is not the driver you would find on a real platform as there is a > large amount of processor specific initialization that is required, but > it shows the general concepts. > > Thanks, > > Andrew Fish >> >> thanks very much. >> >> >> VOID >> EFIAPI >> *CoreTimerTick* ( >> IN UINT64 Duration >> ) >> /*++ >> Routine Description: >> Called by the platform code to process a tick. >> Arguments: Duration - The number of 100ns elasped since the last >> call to TimerTick >> Returns: None >> --*/ >> { >> IEVENT *Event; >> // Check runtiem flag in case there are ticks while exiting boot >> services >> CoreAcquireLock (&mEfiSystemTimeLock); >> // Update the system time >> mEfiSystemTime += Duration; >> // If the head of the list is expired, fire the timer event >> // to process it >> if (!IsListEmpty (&mEfiTimerList)) { >> Event = CR (mEfiTimerList.ForwardLink, IEVENT, u.Timer.Link, >> EVENT_SIGNATURE); >> if (Event->u.Timer.TriggerTime <= mEfiSystemTime) { >> CoreSignalEvent (mEfiCheckTimerEvent); >> } >> } >> CoreReleaseLock (&mEfiSystemTimeLock); >> } >> 2013-05-16 >> ------------------------------------------------------------------------ >> zzhh.happy >> ------------------------------------------------------------------------------ >> AlienVault Unified Security Management (USM) platform delivers complete >> security visibility with the essential security capabilities. Easily and >> efficiently configure, manage, and operate all of your security controls >> from a single console and one unified framework. Download a free trial. >> http://p.sf.net/sfu/alienvault_d2d_______________________________________________ >> edk2-devel mailing list >> edk2-devel@lists.sourceforge.net <mailto:edk2-devel@lists.sourceforge.net> >> https://lists.sourceforge.net/lists/listinfo/edk2-devel > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------------ > AlienVault Unified Security Management (USM) platform delivers complete > security visibility with the essential security capabilities. Easily and > efficiently configure, manage, and operate all of your security controls > from a single console and one unified framework. Download a free trial. > http://p.sf.net/sfu/alienvault_d2d > > > ------------------------------------------------------------------------ > > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/edk2-devel ------------------------------------------------------------------------------ AlienVault Unified Security Management (USM) platform delivers complete security visibility with the essential security capabilities. Easily and efficiently configure, manage, and operate all of your security controls from a single console and one unified framework. Download a free trial. http://p.sf.net/sfu/alienvault_d2d _______________________________________________ edk2-devel mailing list edk2-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/edk2-devel