\r
\r
#include "DxeMain.h"\r
-\r
-//\r
-// Internal prototypes\r
-//\r
-/**\r
- Returns the current system time.\r
-\r
- @return The current system time\r
-\r
-**/\r
-UINT64\r
-CoreCurrentSystemTime (\r
- VOID\r
- );\r
-\r
-/**\r
- Checks the sorted timer list against the current system time.\r
- Signals any expired event timer.\r
-\r
- @param CheckEvent Not used\r
- @param Context Not used\r
-\r
-**/\r
-VOID\r
-EFIAPI\r
-CoreCheckTimers (\r
- IN EFI_EVENT CheckEvent,\r
- IN VOID *Context\r
- );\r
-\r
-/**\r
- Inserts the timer event.\r
-\r
- @param Event Points to the internal structure of timer event\r
- to be installed\r
-\r
-**/\r
-VOID\r
-CoreInsertEventTimer (\r
- IN IEVENT *Event\r
- );\r
+#include "Event.h"\r
\r
//\r
// Internal data\r
// Timer functions\r
//\r
/**\r
- Initializes timer support.\r
+ Inserts the timer event.\r
+\r
+ @param Event Points to the internal structure of timer event\r
+ to be installed\r
\r
**/\r
VOID\r
-CoreInitializeTimer (\r
- VOID\r
+CoreInsertEventTimer (\r
+ IN IEVENT *Event\r
)\r
{\r
- EFI_STATUS Status;\r
+ UINT64 TriggerTime;\r
+ LIST_ENTRY *Link;\r
+ IEVENT *Event2;\r
\r
- Status = CoreCreateEvent (\r
- EVT_NOTIFY_SIGNAL,\r
- TPL_HIGH_LEVEL - 1,\r
- CoreCheckTimers,\r
- NULL,\r
- &mEfiCheckTimerEvent\r
- );\r
- ASSERT_EFI_ERROR (Status);\r
-}\r
+ ASSERT_LOCKED (&mEfiTimerLock);\r
+\r
+ //\r
+ // Get the timer's trigger time\r
+ //\r
+ TriggerTime = Event->u.Timer.TriggerTime;\r
+\r
+ //\r
+ // Insert the timer into the timer database in assending sorted order\r
+ //\r
+ for (Link = mEfiTimerList.ForwardLink; Link != &mEfiTimerList; Link = Link->ForwardLink) {\r
+ Event2 = CR (Link, IEVENT, u.Timer.Link, EVENT_SIGNATURE);\r
\r
+ if (Event2->u.Timer.TriggerTime > TriggerTime) {\r
+ break;\r
+ }\r
+ }\r
+\r
+ InsertTailList (Link, &Event->u.Timer.Link);\r
+}\r
\r
/**\r
Returns the current system time.\r
return SystemTime;\r
}\r
\r
-\r
-/**\r
- Called by the platform code to process a tick.\r
-\r
- @param Duration The number of 100ns elasped since the last call\r
- to TimerTick\r
-\r
-**/\r
-VOID\r
-EFIAPI\r
-CoreTimerTick (\r
- IN UINT64 Duration\r
- )\r
-{\r
- IEVENT *Event;\r
-\r
- //\r
- // Check runtiem flag in case there are ticks while exiting boot services\r
- //\r
- CoreAcquireLock (&mEfiSystemTimeLock);\r
-\r
- //\r
- // Update the system time\r
- //\r
- mEfiSystemTime += Duration;\r
-\r
- //\r
- // If the head of the list is expired, fire the timer event\r
- // to process it\r
- //\r
- if (!IsListEmpty (&mEfiTimerList)) {\r
- Event = CR (mEfiTimerList.ForwardLink, IEVENT, u.Timer.Link, EVENT_SIGNATURE);\r
-\r
- if (Event->u.Timer.TriggerTime <= mEfiSystemTime) {\r
- CoreSignalEvent (mEfiCheckTimerEvent);\r
- }\r
- }\r
-\r
- CoreReleaseLock (&mEfiSystemTimeLock);\r
-}\r
-\r
-\r
/**\r
Checks the sorted timer list against the current system time.\r
Signals any expired event timer.\r
\r
\r
/**\r
- Inserts the timer event.\r
+ Initializes timer support.\r
\r
- @param Event Points to the internal structure of timer event\r
- to be installed\r
+**/\r
+VOID\r
+CoreInitializeTimer (\r
+ VOID\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+\r
+ Status = CoreCreateEvent (\r
+ EVT_NOTIFY_SIGNAL,\r
+ TPL_HIGH_LEVEL - 1,\r
+ CoreCheckTimers,\r
+ NULL,\r
+ &mEfiCheckTimerEvent\r
+ );\r
+ ASSERT_EFI_ERROR (Status);\r
+}\r
+\r
+\r
+/**\r
+ Called by the platform code to process a tick.\r
+\r
+ @param Duration The number of 100ns elasped since the last call\r
+ to TimerTick\r
\r
**/\r
VOID\r
-CoreInsertEventTimer (\r
- IN IEVENT *Event\r
+EFIAPI\r
+CoreTimerTick (\r
+ IN UINT64 Duration\r
)\r
{\r
- UINT64 TriggerTime;\r
- LIST_ENTRY *Link;\r
- IEVENT *Event2;\r
+ IEVENT *Event;\r
\r
- ASSERT_LOCKED (&mEfiTimerLock);\r
+ //\r
+ // Check runtiem flag in case there are ticks while exiting boot services\r
+ //\r
+ CoreAcquireLock (&mEfiSystemTimeLock);\r
\r
//\r
- // Get the timer's trigger time\r
+ // Update the system time\r
//\r
- TriggerTime = Event->u.Timer.TriggerTime;\r
+ mEfiSystemTime += Duration;\r
\r
//\r
- // Insert the timer into the timer database in assending sorted order\r
+ // If the head of the list is expired, fire the timer event\r
+ // to process it\r
//\r
- for (Link = mEfiTimerList.ForwardLink; Link != &mEfiTimerList; Link = Link->ForwardLink) {\r
- Event2 = CR (Link, IEVENT, u.Timer.Link, EVENT_SIGNATURE);\r
+ if (!IsListEmpty (&mEfiTimerList)) {\r
+ Event = CR (mEfiTimerList.ForwardLink, IEVENT, u.Timer.Link, EVENT_SIGNATURE);\r
\r
- if (Event2->u.Timer.TriggerTime > TriggerTime) {\r
- break;\r
+ if (Event->u.Timer.TriggerTime <= mEfiSystemTime) {\r
+ CoreSignalEvent (mEfiCheckTimerEvent);\r
}\r
}\r
\r
- InsertTailList (Link, &Event->u.Timer.Link);\r
+ CoreReleaseLock (&mEfiSystemTimeLock);\r
}\r
\r
\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
- if (Type < 0 || Type > TimerRelative || !(Event->Type & EVT_TIMER)) {\r
+ if (Type < 0 || Type > TimerRelative || (Event->Type & EVT_TIMER) == 0) {\r
return EFI_INVALID_PARAMETER;\r
}\r
\r