]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/UefiLib/UefiNotTiano.c
Sync all bug fixes between EDK1.04 and EDK1.06 into EdkCompatibilityPkg.
[mirror_edk2.git] / EdkCompatibilityPkg / Foundation / Library / EdkIIGlueLib / Library / UefiLib / UefiNotTiano.c
index c995b92bc9d1cb928e535f50247ba442a27c4b5d..bccb35a44b68ad8219577cca4b3c139782c761a4 100644 (file)
@@ -1,6 +1,6 @@
 /*++\r
 \r
-Copyright (c) 2004 - 2007, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2004 - 2010, Intel Corporation. All rights reserved.<BR>\r
 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
@@ -67,7 +67,7 @@ GlueEfiCreateEventLegacyBoot (
 {\r
   return EfiCreateEventLegacyBootEx (\r
            EFI_TPL_CALLBACK,\r
-           InternalEmptyFuntion,\r
+           NULL,\r
            NULL,\r
            LegacyBootEvent\r
            );\r
@@ -101,29 +101,50 @@ EfiCreateEventLegacyBootEx (
   OUT EFI_EVENT         *LegacyBootEvent\r
   )\r
 {\r
-  EFI_STATUS    Status;\r
+  EFI_STATUS        Status;\r
+  UINT32            EventType;\r
+  EFI_EVENT_NOTIFY  WorkerNotifyFunction;\r
 \r
   ASSERT (LegacyBootEvent != NULL);\r
 \r
 #if (EFI_SPECIFICATION_VERSION < 0x00020000) \r
+\r
+  if (NotifyFunction == NULL) {\r
+    EventType = EFI_EVENT_SIGNAL_LEGACY_BOOT | EFI_EVENT_NOTIFY_SIGNAL_ALL;\r
+  } else {\r
+    EventType = EFI_EVENT_SIGNAL_LEGACY_BOOT;\r
+  }\r
+  WorkerNotifyFunction = NotifyFunction;\r
+\r
   //\r
   // prior to UEFI 2.0 use Tiano extension to EFI\r
   //\r
   Status = gBS->CreateEvent (\r
-                  EFI_EVENT_SIGNAL_LEGACY_BOOT | EFI_EVENT_NOTIFY_SIGNAL_ALL,\r
+                  EventType,\r
                   NotifyTpl,\r
-                  NotifyFunction,\r
+                  WorkerNotifyFunction,\r
                   NotifyContext,\r
                   LegacyBootEvent\r
                   );\r
 #else\r
+\r
+  EventType = EVENT_NOTIFY_SIGNAL;\r
+  if (NotifyFunction == NULL) {\r
+    //\r
+    // CreatEventEx will check NotifyFunction is NULL or not\r
+    //\r
+    WorkerNotifyFunction = InternalEmptyFuntion;\r
+  } else {\r
+    WorkerNotifyFunction = NotifyFunction;\r
+  }\r
+\r
   //\r
   // For UEFI 2.0 and the future use an Event Group\r
   //\r
   Status = gBS->CreateEventEx (\r
-                  EVENT_NOTIFY_SIGNAL,\r
+                  EventType,\r
                   NotifyTpl,\r
-                  NotifyFunction,\r
+                  WorkerNotifyFunction,\r
                   NotifyContext,\r
                   &gEfiEventLegacyBootGuid,\r
                   LegacyBootEvent\r
@@ -157,7 +178,7 @@ GlueEfiCreateEventReadyToBoot (
 {\r
   return EfiCreateEventReadyToBootEx (\r
            EFI_TPL_CALLBACK,\r
-           InternalEmptyFuntion,\r
+           NULL,\r
            NULL,\r
            ReadyToBootEvent\r
            );\r
@@ -191,29 +212,51 @@ EfiCreateEventReadyToBootEx (
   OUT EFI_EVENT         *ReadyToBootEvent\r
   )\r
 {\r
-  EFI_STATUS    Status;\r
+  EFI_STATUS        Status;\r
+  UINT32            EventType;\r
+  EFI_EVENT_NOTIFY     WorkerNotifyFunction;\r
 \r
   ASSERT (ReadyToBootEvent != NULL);\r
 \r
-#if (EFI_SPECIFICATION_VERSION < 0x00020000) \r
+#if (EFI_SPECIFICATION_VERSION < 0x00020000)\r
+  \r
+  if (NotifyFunction == NULL) {\r
+       EventType = EFI_EVENT_SIGNAL_READY_TO_BOOT | EFI_EVENT_NOTIFY_SIGNAL_ALL;\r
+  } else {\r
+       EventType = EFI_EVENT_SIGNAL_READY_TO_BOOT;\r
+  }\r
+  WorkerNotifyFunction = NotifyFunction;\r
+\r
   //\r
   // prior to UEFI 2.0 use Tiano extension to EFI\r
   //\r
   Status = gBS->CreateEvent (\r
-                  EFI_EVENT_SIGNAL_READY_TO_BOOT | EFI_EVENT_NOTIFY_SIGNAL_ALL,\r
+                  EventType,\r
                   NotifyTpl,\r
-                  NotifyFunction,\r
+                  WorkerNotifyFunction,\r
                   NotifyContext,\r
                   ReadyToBootEvent\r
                   );\r
 #else\r
+\r
+  EventType = EVENT_NOTIFY_SIGNAL;\r
+\r
+  if (NotifyFunction == NULL) {\r
+    //\r
+    // CreatEventEx will check NotifyFunction is NULL or not\r
+    //\r
+    WorkerNotifyFunction = InternalEmptyFuntion;\r
+  } else {\r
+    WorkerNotifyFunction = NotifyFunction;\r
+  }\r
+\r
   //\r
   // For UEFI 2.0 and the future use an Event Group\r
   //\r
   Status = gBS->CreateEventEx (\r
-                  EVENT_NOTIFY_SIGNAL,\r
+                  EventType,\r
                   NotifyTpl,\r
-                  NotifyFunction,\r
+                  WorkerNotifyFunction,\r
                   NotifyContext,\r
                   &gEfiEventReadyToBootGuid,\r
                   ReadyToBootEvent\r
@@ -274,15 +317,6 @@ EfiSignalEventLegacyBoot (
 /**\r
   Check to see if the Firmware Volume (FV) Media Device Path is valid \r
   \r
-  Tiano extended the EFI 1.10 device path nodes. Tiano does not own this enum\r
-  so as we move to UEFI 2.0 support we must use a mechanism that conforms with\r
-  the UEFI 2.0 specification to define the FV device path. An UEFI GUIDed \r
-  device path is defined for PIWG extensions of device path. If the code \r
-  is compiled to conform with the UEFI 2.0 specification use the new device path\r
-  else use the old form for backwards compatability. The return value to this\r
-  function points to a location in FvDevicePathNode and it does not allocate\r
-  new memory for the GUID pointer that is returned.\r
-\r
   @param  FvDevicePathNode  Pointer to FV device path to check.\r
 \r
   @retval NULL              FvDevicePathNode is not valid.\r
@@ -297,11 +331,6 @@ GlueEfiGetNameGuidFromFwVolDevicePathNode (
 {\r
   ASSERT (FvDevicePathNode != NULL);\r
 \r
-  //\r
-  // EFI Specification extension on Media Device Path. MEDIA_FW_VOL_FILEPATH_DEVICE_PATH is adopted by UEFI later and added in UEFI2.10. \r
-  // In EdkCompatibility Package, we only support MEDIA_FW_VOL_FILEPATH_DEVICE_PATH that complies with\r
-  // EFI 1.10 and UEFI 2.10.\r
-  //\r
   if (DevicePathType (&FvDevicePathNode->Header) == MEDIA_DEVICE_PATH &&\r
       DevicePathSubType (&FvDevicePathNode->Header) == MEDIA_FV_FILEPATH_DP) {\r
     return (EFI_GUID *) &FvDevicePathNode->NameGuid;\r
@@ -314,13 +343,6 @@ GlueEfiGetNameGuidFromFwVolDevicePathNode (
 /**\r
   Initialize a Firmware Volume (FV) Media Device Path node.\r
   \r
-  Tiano extended the EFI 1.10 device path nodes. Tiano does not own this enum\r
-  so as we move to UEFI 2.0 support we must use a mechanism that conforms with\r
-  the UEFI 2.0 specification to define the FV device path. An UEFI GUIDed \r
-  device path is defined for PIWG extensions of device path. If the code \r
-  is compiled to conform with the UEFI 2.0 specification use the new device path\r
-  else use the old form for backwards compatability.\r
-\r
   @param  FvDevicePathNode  Pointer to a FV device path node to initialize\r
   @param  NameGuid          FV file name to use in FvDevicePathNode\r
 \r
@@ -335,16 +357,10 @@ GlueEfiInitializeFwVolDevicepathNode (
   ASSERT (FvDevicePathNode  != NULL);\r
   ASSERT (NameGuid          != NULL);\r
 \r
-  //\r
-  // EFI Specification extension on Media Device Path. MEDIA_FW_VOL_FILEPATH_DEVICE_PATH is adopted by UEFI later and added in UEFI2.10. \r
-  // In EdkCompatibility Package, we only support MEDIA_FW_VOL_FILEPATH_DEVICE_PATH that complies with\r
-  // EFI 1.10 and UEFI 2.10.\r
-  //\r
   FvDevicePathNode->Header.Type     = MEDIA_DEVICE_PATH;\r
   FvDevicePathNode->Header.SubType  = MEDIA_FV_FILEPATH_DP;\r
   SetDevicePathNodeLength (&FvDevicePathNode->Header, sizeof (MEDIA_FW_VOL_FILEPATH_DEVICE_PATH));\r
-  \r
-  CopyGuid (&FvDevicePathNode->NameGuid, NameGuid);\r
 \r
+  CopyGuid (&FvDevicePathNode->NameGuid, NameGuid);\r
 }\r
 \r