]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Core/Dxe/Event/Timer.c
Clean up DxeCore to remove duplicate memory allocation & device path utility services...
[mirror_edk2.git] / MdeModulePkg / Core / Dxe / Event / Timer.c
index 35ab5874a2a6396d2d43e37b56095f1dfe35acad..de5b169472e34bfbf2684c688b9c2dd59e595d48 100644 (file)
@@ -1,8 +1,7 @@
-/** @file \r
-\r
+/** @file\r
   Core Timer Services\r
 \r
-Copyright (c) 2006 - 2008, Intel Corporation\r
+Copyright (c) 2006 - 2008, Intel Corporation. <BR>\r
 All rights reserved. This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -14,7 +13,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 **/\r
 \r
 \r
-#include <DxeMain.h>\r
+#include "DxeMain.h"\r
 \r
 //\r
 // Internal prototypes\r
@@ -25,7 +24,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
   @return The current system time\r
 \r
 **/\r
-STATIC\r
 UINT64\r
 CoreCurrentSystemTime (\r
   VOID\r
@@ -35,47 +33,43 @@ CoreCurrentSystemTime (
   Checks the sorted timer list against the current system time.\r
   Signals any expired event timer.\r
 \r
-  @param  CheckEvent             Not used \r
+  @param  CheckEvent             Not used\r
   @param  Context                Not used\r
 \r
 **/\r
-STATIC\r
 VOID\r
 EFIAPI\r
 CoreCheckTimers (\r
-  IN EFI_EVENT    Event,\r
-  IN VOID         *Context\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
+  @param  Event                  Points to the internal structure of timer event\r
                                  to be installed\r
 \r
 **/\r
-STATIC\r
 VOID\r
 CoreInsertEventTimer (\r
-  IN IEVENT       *Event\r
+  IN IEVENT   *Event\r
   );\r
 \r
 //\r
 // Internal data\r
 //\r
 \r
-STATIC LIST_ENTRY       mEfiTimerList = INITIALIZE_LIST_HEAD_VARIABLE (mEfiTimerList);\r
-STATIC EFI_LOCK         mEfiTimerLock = EFI_INITIALIZE_LOCK_VARIABLE (TPL_HIGH_LEVEL - 1);\r
-STATIC EFI_EVENT        mEfiCheckTimerEvent;\r
+LIST_ENTRY       mEfiTimerList = INITIALIZE_LIST_HEAD_VARIABLE (mEfiTimerList);\r
+EFI_LOCK         mEfiTimerLock = EFI_INITIALIZE_LOCK_VARIABLE (TPL_HIGH_LEVEL - 1);\r
+EFI_EVENT        mEfiCheckTimerEvent = NULL;\r
 \r
-STATIC EFI_LOCK         mEfiSystemTimeLock = EFI_INITIALIZE_LOCK_VARIABLE (TPL_HIGH_LEVEL);\r
-STATIC UINT64           mEfiSystemTime = 0;\r
+EFI_LOCK         mEfiSystemTimeLock = EFI_INITIALIZE_LOCK_VARIABLE (TPL_HIGH_LEVEL);\r
+UINT64           mEfiSystemTime = 0;\r
 \r
 //\r
 // Timer functions\r
 //\r
-\r
-\r
 /**\r
   Initializes timer support.\r
 \r
@@ -88,12 +82,12 @@ CoreInitializeTimer (
   EFI_STATUS  Status;\r
 \r
   Status = CoreCreateEvent (\r
-              EVT_NOTIFY_SIGNAL,\r
-              TPL_HIGH_LEVEL - 1,\r
-              CoreCheckTimers,\r
-              NULL,\r
-              &mEfiCheckTimerEvent\r
-              );\r
+             EVT_NOTIFY_SIGNAL,\r
+             TPL_HIGH_LEVEL - 1,\r
+             CoreCheckTimers,\r
+             NULL,\r
+             &mEfiCheckTimerEvent\r
+             );\r
   ASSERT_EFI_ERROR (Status);\r
 }\r
 \r
@@ -104,7 +98,6 @@ CoreInitializeTimer (
   @return The current system time\r
 \r
 **/\r
-STATIC\r
 UINT64\r
 CoreCurrentSystemTime (\r
   VOID\r
@@ -115,6 +108,7 @@ CoreCurrentSystemTime (
   CoreAcquireLock (&mEfiSystemTimeLock);\r
   SystemTime = mEfiSystemTime;\r
   CoreReleaseLock (&mEfiSystemTimeLock);\r
+\r
   return SystemTime;\r
 }\r
 \r
@@ -122,7 +116,7 @@ CoreCurrentSystemTime (
 /**\r
   Called by the platform code to process a tick.\r
 \r
-  @param  Duration               The number of 100ns elasped since the last call \r
+  @param  Duration               The number of 100ns elasped since the last call\r
                                  to TimerTick\r
 \r
 **/\r
@@ -137,20 +131,17 @@ CoreTimerTick (
   //\r
   // Check runtiem flag in case there are ticks while exiting boot services\r
   //\r
-\r
   CoreAcquireLock (&mEfiSystemTimeLock);\r
 \r
   //\r
   // Update the system time\r
   //\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
-\r
   if (!IsListEmpty (&mEfiTimerList)) {\r
     Event = CR (mEfiTimerList.ForwardLink, IEVENT, u.Timer.Link, EVENT_SIGNATURE);\r
 \r
@@ -167,11 +158,10 @@ CoreTimerTick (
   Checks the sorted timer list against the current system time.\r
   Signals any expired event timer.\r
 \r
-  @param  CheckEvent             Not used \r
+  @param  CheckEvent             Not used\r
   @param  Context                Not used\r
 \r
 **/\r
-STATIC\r
 VOID\r
 EFIAPI\r
 CoreCheckTimers (\r
@@ -185,7 +175,6 @@ CoreCheckTimers (
   //\r
   // Check the timer database for expired timers\r
   //\r
-\r
   CoreAcquireLock (&mEfiTimerLock);\r
   SystemTime = CoreCurrentSystemTime ();\r
 \r
@@ -195,7 +184,6 @@ CoreCheckTimers (
     //\r
     // If this timer is not expired, then we're done\r
     //\r
-\r
     if (Event->u.Timer.TriggerTime > SystemTime) {\r
       break;\r
     }\r
@@ -216,11 +204,9 @@ CoreCheckTimers (
     // If this is a periodic timer, set it\r
     //\r
     if (Event->u.Timer.Period) {\r
-\r
       //\r
       // Compute the timers new trigger time\r
       //\r
-\r
       Event->u.Timer.TriggerTime = Event->u.Timer.TriggerTime + Event->u.Timer.Period;\r
 \r
       //\r
@@ -234,7 +220,6 @@ CoreCheckTimers (
       //\r
       // Add the timer\r
       //\r
-\r
       CoreInsertEventTimer (Event);\r
     }\r
   }\r
@@ -246,11 +231,10 @@ CoreCheckTimers (
 /**\r
   Inserts the timer event.\r
 \r
-  @param  Event                  Points to the internal structure of timer event \r
+  @param  Event                  Points to the internal structure of timer event\r
                                  to be installed\r
 \r
 **/\r
-STATIC\r
 VOID\r
 CoreInsertEventTimer (\r
   IN IEVENT   *Event\r
@@ -265,13 +249,11 @@ CoreInsertEventTimer (
   //\r
   // Get the timer's trigger time\r
   //\r
-\r
   TriggerTime = Event->u.Timer.TriggerTime;\r
 \r
   //\r
   // Insert the timer into the timer database in assending sorted order\r
   //\r
-\r
   for (Link = mEfiTimerList.ForwardLink; Link  != &mEfiTimerList; Link = Link->ForwardLink) {\r
     Event2 = CR (Link, IEVENT, u.Timer.Link, EVENT_SIGNATURE);\r
 \r
@@ -285,19 +267,18 @@ CoreInsertEventTimer (
 \r
 \r
 \r
-\r
 /**\r
   Sets the type of timer and the trigger time for a timer event.\r
 \r
-  @param  UserEvent              The timer event that is to be signaled at the \r
-                                 specified time \r
-  @param  Type                   The type of time that is specified in \r
-                                 TriggerTime \r
-  @param  TriggerTime            The number of 100ns units until the timer \r
-                                 expires \r
+  @param  UserEvent              The timer event that is to be signaled at the\r
+                                 specified time\r
+  @param  Type                   The type of time that is specified in\r
+                                 TriggerTime\r
+  @param  TriggerTime            The number of 100ns units until the timer\r
+                                 expires\r
 \r
-  @retval EFI_SUCCESS            The event has been set to be signaled at the \r
-                                 requested time \r
+  @retval EFI_SUCCESS            The event has been set to be signaled at the\r
+                                 requested time\r
   @retval EFI_INVALID_PARAMETER  Event or Type is not valid\r
 \r
 **/\r
@@ -330,7 +311,6 @@ CoreSetTimer (
   //\r
   // If the timer is queued to the timer database, remove it\r
   //\r
-\r
   if (Event->u.Timer.Link.ForwardLink != NULL) {\r
     RemoveEntryList (&Event->u.Timer.Link);\r
     Event->u.Timer.Link.ForwardLink = NULL;\r
@@ -354,5 +334,6 @@ CoreSetTimer (
   }\r
 \r
   CoreReleaseLock (&mEfiTimerLock);\r
+\r
   return EFI_SUCCESS;\r
 }\r