]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/UefiLib/UefiNotTiano.c
Code Scrub for MdePkg.
[mirror_edk2.git] / MdePkg / Library / UefiLib / UefiNotTiano.c
index 33a14522a9edc933cc1b073ab3367240447fae2c..522367993cec4660b288e712c481e0bbb67746ea 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Library functions that abstract areas of conflict between Tiano an UEFI 2.0.\r
 \r
-  Help Port Framework/Tinao code that has conflicts with UEFI 2.0 by hiding the\r
+  Help Port Framework/Tiano code that has conflicts with UEFI 2.0 by hiding the\r
   oldconflicts with library functions and supporting implementations of the old\r
   (EDK/EFI 1.10) and new (EDK II/UEFI 2.0) way. This module is a DXE driver as\r
   it contains DXE enum extensions for EFI event services.\r
@@ -18,14 +18,22 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 **/\r
 \r
 \r
+//\r
+// Include common header file for this module.\r
+//\r
+#include "UefiLibInternal.h"\r
+\r
 /**\r
   An empty function to pass error checking of CreateEventEx ().\r
 \r
   This empty function ensures that EFI_EVENT_NOTIFY_SIGNAL_ALL is error\r
   checked correctly since it is now mapped into CreateEventEx() in UEFI 2.0.\r
\r
+  @param  Event                 Event whose notification function is being invoked.\r
+  @param  Context               Pointer to the notification function's context,\r
+                                which is implementation-dependent.\r
 \r
 **/\r
-STATIC\r
 VOID\r
 EFIAPI\r
 InternalEmptyFuntion (\r
@@ -59,7 +67,7 @@ EfiCreateEventLegacyBoot (
   )\r
 {\r
   return EfiCreateEventLegacyBootEx (\r
-           EFI_TPL_CALLBACK,\r
+           TPL_CALLBACK,\r
            InternalEmptyFuntion,\r
            NULL,\r
            LegacyBootEvent\r
@@ -98,34 +106,23 @@ EfiCreateEventLegacyBootEx (
 \r
   ASSERT (LegacyBootEvent != NULL);\r
 \r
-  if (gST->Hdr.Revision < 0x00020000) {\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
-                    NotifyTpl,\r
-                    NotifyFunction,\r
-                    NotifyContext,\r
-                    LegacyBootEvent\r
-                    );\r
-  } else if (gST->Hdr.Revision >= 0x00020000 ) {\r
+  if (gST->Hdr.Revision < EFI_2_00_SYSTEM_TABLE_REVISION) {\r
+    DEBUG ((EFI_D_ERROR, "EFI1.1 can't support LegacyBootEvent!"));\r
+    ASSERT (FALSE);\r
+\r
+    return EFI_UNSUPPORTED;\r
+  } else {\r
     //\r
     // For UEFI 2.0 and the future use an Event Group\r
     //\r
     Status = gBS->CreateEventEx (\r
-                    EVENT_NOTIFY_SIGNAL,\r
+                    EVT_NOTIFY_SIGNAL,\r
                     NotifyTpl,\r
                     NotifyFunction,\r
                     NotifyContext,\r
                     &gEfiEventLegacyBootGuid,\r
                     LegacyBootEvent\r
                     );\r
-  } else {\r
-    //\r
-    // For EFI 1.10 with no Tiano extensions return unsupported\r
-    //\r
-    Status = EFI_UNSUPPORTED;\r
   }\r
 \r
   return Status;\r
@@ -141,7 +138,7 @@ EfiCreateEventLegacyBootEx (
   the EDK/EFI 1.10 form and EDK II/UEFI 2.0 form and allows common code to\r
   work both ways.\r
 \r
-  @param  LegacyBootEvent   Returns the EFI event returned from gBS->CreateEvent(Ex).\r
+  @param  ReadyToBootEvent  Returns the EFI event returned from gBS->CreateEvent(Ex).\r
 \r
   @retval EFI_SUCCESS       Event was created.\r
   @retval Other             Event was not created.\r
@@ -154,7 +151,7 @@ EfiCreateEventReadyToBoot (
   )\r
 {\r
   return EfiCreateEventReadyToBootEx (\r
-           EFI_TPL_CALLBACK,\r
+           TPL_CALLBACK,\r
            InternalEmptyFuntion,\r
            NULL,\r
            ReadyToBootEvent\r
@@ -174,7 +171,7 @@ EfiCreateEventReadyToBoot (
   @param  NotifyTpl         The task priority level of the event.\r
   @param  NotifyFunction    The notification function to call when the event is signaled.\r
   @param  NotifyContext     The content to pass to NotifyFunction when the event is signaled.\r
-  @param  LegacyBootEvent   Returns the EFI event returned from gBS->CreateEvent(Ex).\r
+  @param  ReadyToBootEvent  Returns the EFI event returned from gBS->CreateEvent(Ex).\r
 \r
   @retval EFI_SUCCESS       Event was created.\r
   @retval Other             Event was not created.\r
@@ -193,34 +190,23 @@ EfiCreateEventReadyToBootEx (
 \r
   ASSERT (ReadyToBootEvent != NULL);\r
 \r
-  if (gST->Hdr.Revision < 0x00020000) {\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
-                    NotifyTpl,\r
-                    NotifyFunction,\r
-                    NotifyContext,\r
-                    ReadyToBootEvent\r
-                    );\r
-  } else if (gST->Hdr.Revision >= 0x00020000) {\r
+  if (gST->Hdr.Revision < EFI_2_00_SYSTEM_TABLE_REVISION) {\r
+    DEBUG ((EFI_D_ERROR, "EFI1.1 can't support ReadyToBootEvent!"));\r
+    ASSERT (FALSE);\r
+\r
+    return EFI_UNSUPPORTED;\r
+  } else {\r
     //\r
     // For UEFI 2.0 and the future use an Event Group\r
     //\r
     Status = gBS->CreateEventEx (\r
-                    EVENT_NOTIFY_SIGNAL,\r
+                    EVT_NOTIFY_SIGNAL,\r
                     NotifyTpl,\r
                     NotifyFunction,\r
                     NotifyContext,\r
                     &gEfiEventReadyToBootGuid,\r
                     ReadyToBootEvent\r
                     );\r
-  } else {\r
-    //\r
-    // For EFI 1.10 with no Tiano extensions return unsupported\r
-    //\r
-    Status = EFI_UNSUPPORTED;\r
   }\r
 \r
   return Status;\r
@@ -286,30 +272,23 @@ EfiSignalEventLegacyBoot (
   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
+  @param  FvFileDevicePathNode  Pointer to FV device path to check.\r
 \r
   @retval NULL              FvDevicePathNode is not valid.\r
   @retval Other             FvDevicePathNode is valid and pointer to NameGuid was returned.\r
 \r
 **/\r
-EFI_GUID *\r
+EFI_GUID*\r
 EFIAPI\r
 EfiGetNameGuidFromFwVolDevicePathNode (\r
-  IN CONST MEDIA_FW_VOL_FILEPATH_DEVICE_PATH  *FvDevicePathNode\r
+  IN CONST MEDIA_FW_VOL_FILEPATH_DEVICE_PATH  *FvFileDevicePathNode\r
   )\r
 {\r
-  ASSERT (FvDevicePathNode != NULL);\r
+  ASSERT (FvFileDevicePathNode != NULL);\r
 \r
-  //\r
-  // Use the new Device path that does not conflict with the UEFI\r
-  //\r
-  if (FvDevicePathNode->Tiano.Header.Type == MEDIA_DEVICE_PATH ||\r
-      FvDevicePathNode->Tiano.Header.SubType == MEDIA_VENDOR_DP) {\r
-    if (CompareGuid (&gEfiFrameworkDevicePathGuid, &FvDevicePathNode->Tiano.TianoSpecificDevicePath)) {\r
-      if (FvDevicePathNode->Tiano.Type == TIANO_MEDIA_FW_VOL_FILEPATH_DEVICE_PATH_TYPE) {\r
-        return (EFI_GUID *) &FvDevicePathNode->NameGuid;\r
-      }\r
-    }\r
+  if (DevicePathType (&FvFileDevicePathNode->Header) == MEDIA_DEVICE_PATH &&\r
+      DevicePathSubType (&FvFileDevicePathNode->Header) == MEDIA_PIWG_FW_FILE_DP) {\r
+    return (EFI_GUID *) &FvFileDevicePathNode->FvFileName;\r
   }\r
 \r
   return NULL;\r
@@ -326,37 +305,27 @@ EfiGetNameGuidFromFwVolDevicePathNode (
   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  FvFileDevicePathNode  Pointer to a FV device path node to initialize\r
   @param  NameGuid          FV file name to use in FvDevicePathNode\r
 \r
 **/\r
 VOID\r
 EFIAPI\r
 EfiInitializeFwVolDevicepathNode (\r
-  IN OUT MEDIA_FW_VOL_FILEPATH_DEVICE_PATH  *FvDevicePathNode,\r
-  IN CONST EFI_GUID                         *NameGuid\r
+  IN OUT    MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvFileDevicePathNode,\r
+  IN CONST  EFI_GUID                          *NameGuid\r
   )\r
 {\r
-  ASSERT (FvDevicePathNode  != NULL);\r
+  ASSERT (FvFileDevicePathNode  != NULL);\r
   ASSERT (NameGuid          != NULL);\r
 \r
   //\r
   // Use the new Device path that does not conflict with the UEFI\r
   //\r
-  FvDevicePathNode->Tiano.Header.Type     = MEDIA_DEVICE_PATH;\r
-  FvDevicePathNode->Tiano.Header.SubType  = MEDIA_VENDOR_DP;\r
-  SetDevicePathNodeLength (&FvDevicePathNode->Tiano.Header, sizeof (MEDIA_FW_VOL_FILEPATH_DEVICE_PATH));\r
-\r
-  //\r
-  // Add the GUID for generic Tiano device paths\r
-  //\r
-  CopyGuid (&FvDevicePathNode->Tiano.TianoSpecificDevicePath, &gEfiFrameworkDevicePathGuid);\r
-\r
-  //\r
-  // Add in the FW Vol File Path Tiano defined information\r
-  //\r
-  FvDevicePathNode->Tiano.Type = TIANO_MEDIA_FW_VOL_FILEPATH_DEVICE_PATH_TYPE;\r
+  FvFileDevicePathNode->Header.Type     = MEDIA_DEVICE_PATH;\r
+  FvFileDevicePathNode->Header.SubType  = MEDIA_PIWG_FW_FILE_DP;\r
+  SetDevicePathNodeLength (&FvFileDevicePathNode->Header, sizeof (MEDIA_FW_VOL_FILEPATH_DEVICE_PATH));\r
 \r
-  CopyGuid (&FvDevicePathNode->NameGuid, NameGuid);\r
+  CopyGuid (&FvFileDevicePathNode->FvFileName, NameGuid);\r
 }\r
 \r