]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EdkModulePkg/Core/Dxe/Event/event.c
1. Removed #ifdef EDK_RELEASE_VERSION from all c files for all modules
[mirror_edk2.git] / EdkModulePkg / Core / Dxe / Event / event.c
index ae6b0a849d297c7270e5e46e6f0e742ced7f1a0d..8f2934e71118a487191e6036399b3125e03702f8 100644 (file)
@@ -1,13 +1,13 @@
 /*++\r
 \r
-Copyright (c) 2006, Intel Corporation                                                         \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
-http://opensource.org/licenses/bsd-license.php                                            \r
-                                                                                          \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+Copyright (c) 2006 - 2007, Intel Corporation\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
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
 Module Name:\r
 \r
@@ -16,7 +16,7 @@ Module Name:
 Abstract:\r
 \r
     EFI Event support\r
\r
+\r
 --*/\r
 \r
 \r
@@ -37,17 +37,17 @@ UINT32 mEventTable[] = {
   //\r
   EFI_EVENT_TIMER,\r
   //\r
-  // 0x00000100       Generic event with a notification function that \r
+  // 0x00000100       Generic event with a notification function that\r
   // can be waited on with CheckEvent() or WaitForEvent()\r
   //\r
   EFI_EVENT_NOTIFY_WAIT,\r
   //\r
-  // 0x00000200       Generic event with a notification function that \r
+  // 0x00000200       Generic event with a notification function that\r
   // is queue when the event is signaled with SignalEvent()\r
   //\r
   EFI_EVENT_NOTIFY_SIGNAL,\r
   //\r
-  // 0x00000201       ExitBootServicesEvent.  \r
+  // 0x00000201       ExitBootServicesEvent.\r
   //\r
   EFI_EVENT_SIGNAL_EXIT_BOOT_SERVICES,\r
   //\r
@@ -55,39 +55,20 @@ UINT32 mEventTable[] = {
   //\r
   EFI_EVENT_SIGNAL_VIRTUAL_ADDRESS_CHANGE,\r
 \r
-#if (EFI_SPECIFICATION_VERSION < 0x00020000)\r
-  //\r
-  // 0x00000203       ReadyToBootEvent.\r
-  //\r
-  EFI_EVENT_SIGNAL_READY_TO_BOOT,\r
-  //\r
-  // 0x00000204       LegacyBootEvent.\r
-  //\r
-  EFI_EVENT_SIGNAL_LEGACY_BOOT,\r
-  //\r
-  // 0x00000603       Signal all ReadyToBootEvents.\r
-  //\r
-  EFI_EVENT_NOTIFY_SIGNAL_ALL | EFI_EVENT_SIGNAL_READY_TO_BOOT,\r
-  //\r
-  // 0x00000604       Signal all LegacyBootEvents.\r
-  //\r
-  EFI_EVENT_NOTIFY_SIGNAL_ALL | EFI_EVENT_SIGNAL_LEGACY_BOOT,\r
-#endif\r
-\r
   //\r
-  // 0x00000000       Generic event without a notification function. \r
-  // It can be signaled with SignalEvent() and checked with CheckEvent() \r
+  // 0x00000000       Generic event without a notification function.\r
+  // It can be signaled with SignalEvent() and checked with CheckEvent()\r
   // or WaitForEvent().\r
   //\r
   0x00000000,\r
   //\r
-  // 0x80000100       Timer event with a notification function that can be \r
+  // 0x80000100       Timer event with a notification function that can be\r
   // waited on with CheckEvent() or WaitForEvent()\r
   //\r
   EFI_EVENT_TIMER | EFI_EVENT_NOTIFY_WAIT,\r
 };\r
 \r
-\r
+STATIC\r
 VOID\r
 CoreAcquireEventLock (\r
   VOID\r
@@ -111,7 +92,7 @@ Returns:
   CoreAcquireLock (&gEventQueueLock);\r
 }\r
 \r
-\r
+STATIC\r
 VOID\r
 CoreReleaseEventLock (\r
   VOID\r
@@ -149,7 +130,7 @@ Routine Description:
 Arguments:\r
 \r
   None\r
-    \r
+\r
 Returns:\r
 \r
   EFI_SUCCESS - Always return success\r
@@ -163,50 +144,6 @@ Returns:
   }\r
 \r
   CoreInitializeTimer ();\r
-  \r
-  return EFI_SUCCESS;\r
-}\r
-\r
-\r
-EFI_STATUS\r
-CoreShutdownEventServices (\r
-  VOID\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Register all runtime events to make sure they are still available after ExitBootService.\r
-\r
-Arguments:\r
-\r
-  None\r
-    \r
-Returns:\r
-\r
-  EFI_SUCCESS - Always return success.\r
-\r
---*/\r
-{\r
-  LIST_ENTRY        *Link;\r
-  IEVENT            *Event;\r
-\r
-  //\r
-  // The Runtime AP is required for the core to function!\r
-  //\r
-  ASSERT (gRuntime != NULL);\r
-\r
-  for (Link = mRuntimeEventList.ForwardLink; Link != &mRuntimeEventList; Link = Link->ForwardLink) {\r
-    Event = CR (Link, IEVENT, RuntimeLink, EVENT_SIGNATURE);\r
-    gRuntime->RegisterEvent (\r
-                gRuntime, \r
-                Event->Type, \r
-                Event->NotifyTpl, \r
-                Event->NotifyFunction, \r
-                Event->NotifyContext, \r
-                (VOID **)Event\r
-                );\r
-  }\r
 \r
   return EFI_SUCCESS;\r
 }\r
@@ -220,12 +157,12 @@ CoreDispatchEventNotifies (
 \r
 Routine Description:\r
 \r
-  Dispatches all pending events. \r
+  Dispatches all pending events.\r
 \r
 Arguments:\r
 \r
   Priority - The task priority level of event notifications to dispatch\r
-    \r
+\r
 Returns:\r
 \r
   None\r
@@ -234,7 +171,7 @@ Returns:
 {\r
   IEVENT          *Event;\r
   LIST_ENTRY      *Head;\r
-  \r
+\r
   CoreAcquireEventLock ();\r
   ASSERT (gEventQueueLock.OwnerTpl == Priority);\r
   Head = &gEventQueue[Priority];\r
@@ -243,7 +180,7 @@ Returns:
   // Dispatch all the pending notifications\r
   //\r
   while (!IsListEmpty (Head)) {\r
-      \r
+\r
     Event = CR (Head->ForwardLink, IEVENT, NotifyLink, EVENT_SIGNATURE);\r
     RemoveEntryList (&Event->NotifyLink);\r
 \r
@@ -258,7 +195,7 @@ Returns:
     }\r
 \r
     CoreReleaseEventLock ();\r
-      \r
+\r
     //\r
     // Notify this event\r
     //\r
@@ -276,8 +213,8 @@ Returns:
 }\r
 \r
 \r
-VOID\r
 STATIC\r
+VOID\r
 CoreNotifyEvent (\r
   IN  IEVENT      *Event\r
   )\r
@@ -290,7 +227,7 @@ Routine Description:
 Arguments:\r
 \r
   Event       - The Event to notify\r
-    \r
+\r
 Returns:\r
 \r
   None\r
@@ -312,7 +249,7 @@ Returns:
     Event->NotifyLink.ForwardLink = NULL;\r
   }\r
 \r
-  // \r
+  //\r
   // Queue the event to the pending notification list\r
   //\r
 \r
@@ -333,7 +270,7 @@ Routine Description:
 \r
 Arguments:\r
   EventGroup - The list to signal\r
-    \r
+\r
 Returns:\r
 \r
   None\r
@@ -357,33 +294,6 @@ Returns:
   CoreReleaseEventLock ();\r
 }\r
 \r
-\r
-#if (EFI_SPECIFICATION_VERSION < 0x00020000)\r
-\r
-static\r
-VOID\r
-EFIAPI\r
-EventNofitySignalAllNullEvent (\r
-  IN EFI_EVENT                Event,\r
-  IN VOID                     *Context\r
-  )\r
-{\r
-  //\r
-  // This null event is a size efficent way to enusre that \r
-  // EFI_EVENT_NOTIFY_SIGNAL_ALL is error checked correctly.\r
-  // EFI_EVENT_NOTIFY_SIGNAL_ALL is now mapped into \r
-  // CreateEventEx() and this function is used to make the\r
-  // old error checking in CreateEvent() for Tiano extensions\r
-  // function.\r
-  //\r
-  return;\r
-}\r
-\r
-#endif\r
-\r
-\r
-\r
-\r
 EFI_STATUS\r
 EFIAPI\r
 CoreCreateEvent (\r
@@ -412,42 +322,22 @@ Returns:
   EFI_OUT_OF_RESOURCES  - The event could not be allocated\r
 \r
 --*/\r
-{ \r
+{\r
   EFI_GUID            *GuidPtr;\r
   EFI_EVENT_NOTIFY    Function;\r
-  \r
+\r
   GuidPtr = NULL;\r
   Function = NotifyFunction;\r
 \r
-#if (EFI_SPECIFICATION_VERSION < 0x00020000)\r
-  //\r
-  // Clear EFI_EVENT_NOFITY_SIGNAL_ALL (Tiano extension) as all events in the \r
-  //  EventGroup now have this property. So we need to filter it out.\r
-  //\r
-  if (Type & EFI_EVENT_NOTIFY_SIGNAL_ALL) {\r
-    Type &= ~EFI_EVENT_NOTIFY_SIGNAL_ALL;\r
-    Function = EventNofitySignalAllNullEvent;\r
-  }\r
-\r
-  //\r
-  // Map the Tiano extensions Events to CreateEventEx form\r
-  //\r
-  if (Type == EFI_EVENT_SIGNAL_READY_TO_BOOT) {\r
-    GuidPtr = &gEfiEventReadyToBootGuid;\r
-  } else if (Type == EFI_EVENT_SIGNAL_LEGACY_BOOT) {\r
-    GuidPtr = &gEfiEventLegacyBootGuid\r
-  }\r
-#endif\r
-\r
   //\r
   // Convert EFI 1.10 Events to thier UEFI 2.0 CreateEventEx mapping\r
-  // \r
+  //\r
   if (Type == EVENT_SIGNAL_EXIT_BOOT_SERVICES) {\r
     GuidPtr = &gEfiEventExitBootServicesGuid;\r
   } else if (Type == EVENT_SIGNAL_VIRTUAL_ADDRESS_CHANGE) {\r
     GuidPtr = &gEfiEventVirtualAddressChangeGuid;\r
   }\r
-  \r
+\r
   return CoreCreateEventEx (Type, NotifyTpl, Function, NotifyContext, GuidPtr, Event);\r
 }\r
 \r
@@ -513,8 +403,8 @@ Returns:
     //\r
     // Check for an invalid NotifyFunction or NotifyTpl\r
     //\r
-    if ((NotifyFunction == NULL) || \r
-        (NotifyTpl < EFI_TPL_APPLICATION) || \r
+    if ((NotifyFunction == NULL) ||\r
+        (NotifyTpl < EFI_TPL_APPLICATION) ||\r
        (NotifyTpl >= EFI_TPL_HIGH_LEVEL)) {\r
       return EFI_INVALID_PARAMETER;\r
     }\r
@@ -532,7 +422,7 @@ Returns:
   // Allcoate and initialize a new event structure.\r
   //\r
   Status = CoreAllocatePool (\r
-             (Type & EFI_EVENT_RUNTIME) ? EfiRuntimeServicesData: EfiBootServicesData, \r
+             (Type & EFI_EVENT_RUNTIME) ? EfiRuntimeServicesData: EfiBootServicesData,\r
              sizeof (IEVENT),\r
              (VOID **)&IEvent\r
              );\r
@@ -544,7 +434,7 @@ Returns:
 \r
   IEvent->Signature = EVENT_SIGNATURE;\r
   IEvent->Type = Type;\r
-  \r
+\r
   IEvent->NotifyTpl      = NotifyTpl;\r
   IEvent->NotifyFunction = NotifyFunction;\r
   IEvent->NotifyContext  = (VOID *)NotifyContext;\r
@@ -559,20 +449,25 @@ Returns:
     //\r
     // Keep a list of all RT events so we can tell the RT AP.\r
     //\r
-    InsertTailList (&mRuntimeEventList, &IEvent->RuntimeLink);\r
+    IEvent->RuntimeData.Type           = Type;\r
+    IEvent->RuntimeData.NotifyTpl      = NotifyTpl;\r
+    IEvent->RuntimeData.NotifyFunction = NotifyFunction;\r
+    IEvent->RuntimeData.NotifyContext  = (VOID *) NotifyContext;\r
+    IEvent->RuntimeData.Event          = (EFI_EVENT *) IEvent;\r
+    InsertTailList (&gRuntime->EventHead, &IEvent->RuntimeData.Link);\r
   }\r
 \r
   CoreAcquireEventLock ();\r
-  \r
+\r
   if ((Type & EFI_EVENT_NOTIFY_SIGNAL) != 0x00000000) {\r
     //\r
     // The Event's NotifyFunction must be queued whenever the event is signaled\r
     //\r
     InsertHeadList (&gEventSignalQueue, &IEvent->SignalLink);\r
   }\r
-  \r
+\r
   CoreReleaseEventLock ();\r
-  \r
+\r
   //\r
   // Done\r
   //\r
@@ -591,15 +486,15 @@ CoreSignalEvent (
 Routine Description:\r
 \r
   Signals the event.  Queues the event to be notified if needed\r
-    \r
+\r
 Arguments:\r
 \r
   UserEvent - The event to signal\r
-    \r
+\r
 Returns:\r
 \r
   EFI_INVALID_PARAMETER - Parameters are not valid.\r
-  \r
+\r
   EFI_SUCCESS - The event was signaled.\r
 \r
 --*/\r
@@ -631,8 +526,8 @@ Returns:
     if (Event->Type & EFI_EVENT_NOTIFY_SIGNAL) {\r
       if (Event->ExFlag) {\r
         //\r
-        // The CreateEventEx() style requires all members of the Event Group \r
-        //  to be signaled. \r
+        // The CreateEventEx() style requires all members of the Event Group\r
+        //  to be signaled.\r
         //\r
         CoreReleaseEventLock ();\r
         CoreNotifySignalList (&Event->EventGroup);\r
@@ -658,11 +553,11 @@ CoreCheckEvent (
 Routine Description:\r
 \r
   Check the status of an event\r
-    \r
+\r
 Arguments:\r
 \r
   UserEvent - The event to check\r
-    \r
+\r
 Returns:\r
 \r
   EFI_SUCCESS           - The event is in the signaled state\r
@@ -736,17 +631,17 @@ CoreWaitForEvent (
 Routine Description:\r
 \r
   Stops execution until an event is signaled.\r
-    \r
+\r
 Arguments:\r
 \r
   NumberOfEvents  - The number of events in the UserEvents array\r
   UserEvents      - An array of EFI_EVENT\r
   UserIndex       - Pointer to the index of the event which satisfied the wait condition\r
-    \r
+\r
 Returns:\r
 \r
   EFI_SUCCESS           - The event indicated by Index was signaled.\r
-  EFI_INVALID_PARAMETER - The event indicated by Index has a notification function or \r
+  EFI_INVALID_PARAMETER - The event indicated by Index has a notification function or\r
                           Event was not a valid type\r
   EFI_UNSUPPORTED       - The current TPL is not TPL_APPLICATION\r
 \r
@@ -764,7 +659,7 @@ Returns:
   }\r
 \r
   for(;;) {\r
-      \r
+\r
     for(Index = 0; Index < NumberOfEvents; Index++) {\r
 \r
       Status = CoreCheckEvent (UserEvents[Index]);\r
@@ -781,7 +676,7 @@ Returns:
     //\r
     // This was the location of the Idle loop callback in EFI 1.x reference\r
     // code. We don't have that concept in this base at this point.\r
-    // \r
+    //\r
   }\r
 }\r
 \r
@@ -796,15 +691,15 @@ CoreCloseEvent (
 Routine Description:\r
 \r
   Closes an event and frees the event structure.\r
-    \r
+\r
 Arguments:\r
 \r
   UserEvent - Event to close\r
-    \r
+\r
 Returns:\r
 \r
   EFI_INVALID_PARAMETER - Parameters are not valid.\r
-  \r
+\r
   EFI_SUCCESS - The event has been closed\r
 \r
 --*/\r
@@ -836,8 +731,8 @@ Returns:
   // If the event is queued somewhere, remove it\r
   //\r
 \r
-  if (Event->RuntimeLink.ForwardLink != NULL) {\r
-    RemoveEntryList (&Event->RuntimeLink);\r
+  if (Event->RuntimeData.Link.ForwardLink != NULL) {\r
+    RemoveEntryList (&Event->RuntimeData.Link);\r
   }\r
 \r
   if (Event->NotifyLink.ForwardLink != NULL) {\r