]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Retire description string macro for boot device type which are not defined in UEFI...
authorklu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 13 Jul 2009 10:20:09 +0000 (10:20 +0000)
committerklu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 13 Jul 2009 10:20:09 +0000 (10:20 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8926 6f19259b-4bc3-4df7-8a09-765794883524

IntelFrameworkModulePkg/Include/Library/GenericBdsLib.h
IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c
IntelFrameworkModulePkg/Library/GenericBdsLib/InternalBdsLib.h
IntelFrameworkModulePkg/Universal/BdsDxe/BootMngr/BootManager.c

index f17f4344b039bb71214a46c1e96ad4bb97e3b90f..e2142db1902a003d46271864b2536dc7a12b89bd 100644 (file)
@@ -786,24 +786,6 @@ SetupResetReminder (
   );\r
 \r
 \r
-///\r
-/// Define the boot option default description \r
-///\r
-#define DESCRIPTION_FLOPPY        L"EFI Floppy"\r
-#define DESCRIPTION_FLOPPY_NUM    L"EFI Floppy %d"\r
-#define DESCRIPTION_DVD           L"EFI DVD/CDROM"\r
-#define DESCRIPTION_DVD_NUM       L"EFI DVD/CDROM %d"\r
-#define DESCRIPTION_USB           L"EFI USB Device"\r
-#define DESCRIPTION_USB_NUM       L"EFI USB Device %d"\r
-#define DESCRIPTION_SCSI          L"EFI SCSI Device"\r
-#define DESCRIPTION_SCSI_NUM      L"EFI SCSI Device %d"\r
-#define DESCRIPTION_MISC          L"EFI Misc Device"\r
-#define DESCRIPTION_MISC_NUM      L"EFI Misc Device %d"\r
-#define DESCRIPTION_NETWORK       L"EFI Network"\r
-#define DESCRIPTION_NETWORK_NUM   L"EFI Network %d"       \r
-#define DESCRIPTION_NON_BLOCK     L"EFI Non-Block Boot Device"\r
-#define DESCRIPTION_NON_BLOCK_NUM L"EFI Non-Block Boot Device %d"\r
-\r
 ///\r
 /// Define the boot type which to classify the boot option type\r
 /// Different boot option type could have different boot behavior\r
@@ -822,8 +804,10 @@ SetupResetReminder (
 #define  BDS_EFI_MESSAGE_ATAPI_BOOT       0x0301 // Type 03; Sub-Type 01\r
 #define  BDS_EFI_MESSAGE_SCSI_BOOT        0x0302 // Type 03; Sub-Type 02\r
 #define  BDS_EFI_MESSAGE_USB_DEVICE_BOOT  0x0305 // Type 03; Sub-Type 05\r
-#define  BDS_EFI_MESSAGE_SATA_BOOT        0x0318 // Type 03; Sub-Type 18\r
+#define  BDS_EFI_MESSAGE_SATA_BOOT        0x0312 // Type 03; Sub-Type 18\r
+#define  BDS_EFI_MESSAGE_MAC_BOOT         0x030b // Type 03; Sub-Type 11\r
 #define  BDS_EFI_MESSAGE_MISC_BOOT        0x03FF\r
+\r
 ///\r
 /// Media boot type\r
 /// If a device path of boot option contain a media node, the boot option is media boot type\r
index f5e7a153cc5995dfebfc604e9072d70af1064245..188986a7c9e3e7ba30786041b982c50877d1ffe5 100644 (file)
@@ -1008,7 +1008,7 @@ BdsLibEnumerateAllBootOption (
 \r
     switch (DevicePathType) {\r
     case BDS_EFI_ACPI_FLOPPY_BOOT:\r
-      UnicodeSPrint (Buffer, sizeof (Buffer), DESCRIPTION_FLOPPY_NUM, FloppyNumber); \r
+      UnicodeSPrint (Buffer, sizeof (Buffer), L"%d", FloppyNumber); \r
       BdsLibBuildOptionFromHandle (BlockIoHandles[Index], BdsBootOptionList, Buffer);\r
       FloppyNumber++;\r
       break;\r
@@ -1018,25 +1018,25 @@ BdsLibEnumerateAllBootOption (
     //\r
     case BDS_EFI_MESSAGE_ATAPI_BOOT:\r
     case BDS_EFI_MESSAGE_SATA_BOOT:\r
-      UnicodeSPrint (Buffer, sizeof (Buffer), DESCRIPTION_DVD_NUM, CdromNumber);\r
+      UnicodeSPrint (Buffer, sizeof (Buffer), L"%d", CdromNumber);\r
       BdsLibBuildOptionFromHandle (BlockIoHandles[Index], BdsBootOptionList, Buffer);\r
       CdromNumber++;\r
       break;\r
 \r
     case BDS_EFI_MESSAGE_USB_DEVICE_BOOT:\r
-      UnicodeSPrint (Buffer, sizeof (Buffer), DESCRIPTION_USB_NUM, UsbNumber);\r
+      UnicodeSPrint (Buffer, sizeof (Buffer), L"%d", UsbNumber);\r
       BdsLibBuildOptionFromHandle (BlockIoHandles[Index], BdsBootOptionList, Buffer);\r
       UsbNumber++;\r
       break;\r
 \r
     case BDS_EFI_MESSAGE_SCSI_BOOT:\r
-      UnicodeSPrint (Buffer, sizeof (Buffer), DESCRIPTION_SCSI_NUM, ScsiNumber);\r
+      UnicodeSPrint (Buffer, sizeof (Buffer), L"%d", ScsiNumber);\r
       BdsLibBuildOptionFromHandle (BlockIoHandles[Index], BdsBootOptionList, Buffer);      \r
       ScsiNumber++;\r
       break;\r
 \r
     case BDS_EFI_MESSAGE_MISC_BOOT:\r
-      UnicodeSPrint (Buffer, sizeof (Buffer), DESCRIPTION_MISC_NUM, MiscNumber);\r
+      UnicodeSPrint (Buffer, sizeof (Buffer), L"%d", MiscNumber);\r
       BdsLibBuildOptionFromHandle (BlockIoHandles[Index], BdsBootOptionList, Buffer);      \r
       MiscNumber++;\r
       break;\r
@@ -1098,7 +1098,7 @@ BdsLibEnumerateAllBootOption (
       //\r
       BdsLibDeleteOptionFromHandle (FileSystemHandles[Index]);\r
     } else {\r
-      UnicodeSPrint (Buffer, sizeof (Buffer), DESCRIPTION_NON_BLOCK_NUM, NonBlockNumber);\r
+      UnicodeSPrint (Buffer, sizeof (Buffer), L"EFI Non-Block Boot Device %d", NonBlockNumber);\r
       BdsLibBuildOptionFromHandle (FileSystemHandles[Index], BdsBootOptionList, Buffer);\r
       NonBlockNumber++;\r
     }\r
@@ -1120,7 +1120,7 @@ BdsLibEnumerateAllBootOption (
         );\r
 \r
   for (Index = 0; Index < NumberSimpleNetworkHandles; Index++) {\r
-    UnicodeSPrint (Buffer, sizeof (Buffer), DESCRIPTION_NETWORK_NUM, Index);\r
+    UnicodeSPrint (Buffer, sizeof (Buffer), L"%d", Index);\r
     BdsLibBuildOptionFromHandle (SimpleNetworkHandles[Index], BdsBootOptionList, Buffer);\r
   }\r
 \r
@@ -1198,7 +1198,7 @@ BdsLibBuildOptionFromHandle (
   )\r
 {\r
   EFI_DEVICE_PATH_PROTOCOL  *DevicePath;\r
-\r
+  \r
   DevicePath = DevicePathFromHandle (Handle);\r
 \r
   //\r
@@ -1575,7 +1575,7 @@ BdsGetBootTypeFromDevicePath (
           return BDS_EFI_MEDIA_HD_BOOT;\r
         } else if (DevicePathSubType (TempDevicePath) == MEDIA_CDROM_DP) {\r
           return BDS_EFI_MEDIA_CDROM_BOOT;\r
-        }\r
+        } \r
         break;\r
       case ACPI_DEVICE_PATH:\r
         Acpi = (ACPI_HID_DEVICE_PATH *) TempDevicePath;\r
@@ -1610,6 +1610,8 @@ BdsGetBootTypeFromDevicePath (
           return BDS_EFI_MESSAGE_SCSI_BOOT;\r
         } else if (DevicePathSubType(TempDevicePath) == MSG_SATA_DP) {\r
           return BDS_EFI_MESSAGE_SATA_BOOT;\r
+        } else if (DevicePathSubType(TempDevicePath) == MSG_MAC_ADDR_DP) {\r
+          return BDS_EFI_MESSAGE_MAC_BOOT;\r
         }\r
         return BDS_EFI_MESSAGE_MISC_BOOT;\r
       default:\r
@@ -1621,41 +1623,6 @@ BdsGetBootTypeFromDevicePath (
   return BDS_EFI_UNSUPPORT;\r
 }\r
 \r
-\r
-/** \r
-  Check whether the descriptionis is conflict with the description reserved for\r
-  auto-created boot options.\r
-\r
-  @param  Description  The Description in a boot option\r
-  \r
-  @retval TRUE    The description is conflict with the description reserved for\r
-                  auto-created boot options.\r
-  @retval FALSE   The description is not conflict with the description reserved.\r
-  \r
-**/\r
-BOOLEAN\r
-EFIAPI\r
-CheckDescritptionConflict (\r
-  IN CHAR16                       *Description\r
-  )\r
-{\r
-  if (Description == NULL) {\r
-    return FALSE;  \r
-  }\r
-  if ((CompareMem (Description, DESCRIPTION_FLOPPY, StrLen (DESCRIPTION_FLOPPY) * sizeof (CHAR16)) == 0)  ||\r
-      (CompareMem (Description, DESCRIPTION_DVD, StrLen (DESCRIPTION_DVD) * sizeof (CHAR16)) == 0)        ||\r
-      (CompareMem (Description, DESCRIPTION_USB, StrLen (DESCRIPTION_USB) * sizeof (CHAR16)) == 0)        ||\r
-      (CompareMem (Description, DESCRIPTION_SCSI, StrLen (DESCRIPTION_SCSI) * sizeof (CHAR16)) == 0)      ||\r
-      (CompareMem (Description, DESCRIPTION_MISC, StrLen (DESCRIPTION_MISC) * sizeof (CHAR16)) == 0)      ||\r
-      (CompareMem (Description, DESCRIPTION_NETWORK, StrLen (DESCRIPTION_NETWORK) * sizeof (CHAR16)) == 0)||\r
-      (CompareMem (Description, DESCRIPTION_NON_BLOCK, StrLen (DESCRIPTION_NON_BLOCK) * sizeof (CHAR16)) == 0)) { \r
-     return TRUE;\r
-  }\r
-\r
-  return FALSE;\r
-}\r
-\r
-\r
 /**\r
   Check whether the Device path in a boot option point to a valid bootable device,\r
   And if CheckMedia is true, check the device is ready to boot now.\r
@@ -1801,20 +1768,6 @@ BdsLibIsValidEFIBootOptDevicePathExt (
   if (!EFI_ERROR (Status)) {\r
     Status = gBS->HandleProtocol (Handle, &gEfiBlockIoProtocolGuid, (VOID **)&BlockIo);\r
     if (!EFI_ERROR (Status)) {\r
-      if (!BlockIo->Media->RemovableMedia) {\r
-        //\r
-        // For the Fixed block devices, check its description whether conflict\r
-        // with other auto-created boot options. BDS permit a boot option point to \r
-        // Fixed block device, but not permit it use the description reserved for\r
-        // auto-created boot options.\r
-        // The check is to cover the bug, that replace a removable BlockIo device\r
-        // with a fixed BlockIo device at the same port, but the removable device's\r
-        // boot option can not be automatically deleted.\r
-        //\r
-        if (CheckDescritptionConflict (Description)) {\r
-           return FALSE; \r
-        }\r
-      }      \r
       if (CheckMedia) {\r
         //\r
         // Test if it is ready to boot now\r
index c2cdcb1ab8c537e25c11ba92cac6cca7bdfe4506..5193ec2d1f162a0e30a9b526393a4e7ee74790e6 100644 (file)
@@ -111,21 +111,4 @@ BdsLibGetImageHeader (
   OUT EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION   Hdr\r
   );\r
 \r
-/** \r
-  Check whether the descriptionis is conflict with the description reserved for\r
-  auto-created boot options.\r
-\r
-  @param  Description  The Description in a boot option\r
-  \r
-  @retval TRUE    The description is conflict with the description reserved for\r
-                  auto-created boot options.\r
-  @retval FALSE   The description is not conflict with the description reserved.\r
-  \r
-**/\r
-BOOLEAN\r
-EFIAPI\r
-CheckDescritptionConflict (\r
-  IN CHAR16                       *Description\r
-  );\r
-\r
 #endif // _BDS_LIB_H_\r
index 80af8e18033f61a84a3c7b0bdfe5dd72154ce89a..af54de6926f4ca81c02f69e8cc449b7a4f998441 100644 (file)
@@ -202,6 +202,7 @@ CallBootManager (
   EFI_IFR_GUID_LABEL          *StartLabel;\r
   EFI_IFR_GUID_LABEL          *EndLabel;\r
   CHAR16                      *BootStringNumber;\r
+  UINTN                       DevicePathType;\r
 \r
   gOption = NULL;\r
   InitializeListHead (&BdsBootOptionList);\r
@@ -267,43 +268,51 @@ CallBootManager (
     //\r
     // Replace description string with UNI file string.\r
     //\r
-    BootStringNumber = AllocateZeroPool (StrSize (Option->Description));\r
-    ASSERT (BootStringNumber != NULL);\r
+    BootStringNumber = NULL;\r
     \r
-    if (StrStr (Option->Description, DESCRIPTION_FLOPPY) != NULL) {\r
-      BootStringNumber = Option->Description + StrLen (DESCRIPTION_FLOPPY) + 1;\r
+    DevicePathType = BdsGetBootTypeFromDevicePath (Option->DevicePath);\r
+    \r
+    //\r
+    // store number string of boot option temporary.\r
+    //\r
+    \r
+    switch (DevicePathType) {\r
+    case BDS_EFI_ACPI_FLOPPY_BOOT:\r
+      BootStringNumber = Option->Description;\r
       Option->Description = GetStringById (STRING_TOKEN (STR_DESCRIPTION_FLOPPY));\r
-    } else if (StrStr (Option->Description, DESCRIPTION_DVD) != NULL) {\r
-      BootStringNumber = Option->Description + StrLen (DESCRIPTION_DVD) + 1;\r
+      break;\r
+    case BDS_EFI_MEDIA_CDROM_BOOT:\r
+      BootStringNumber = Option->Description;\r
       Option->Description = GetStringById (STRING_TOKEN (STR_DESCRIPTION_DVD));\r
-      \r
-    } else if (StrStr (Option->Description, DESCRIPTION_USB) != NULL) {\r
-      BootStringNumber = Option->Description + StrLen (DESCRIPTION_USB) + 1;\r
+      break;\r
+    case BDS_EFI_MESSAGE_USB_DEVICE_BOOT:\r
+      BootStringNumber = Option->Description;\r
       Option->Description = GetStringById (STRING_TOKEN (STR_DESCRIPTION_USB));\r
-      \r
-    } else if (StrStr (Option->Description, DESCRIPTION_SCSI) != NULL) {\r
-       BootStringNumber = Option->Description + StrLen (DESCRIPTION_SCSI) + 1;\r
+      break;\r
+    case BDS_EFI_MESSAGE_SCSI_BOOT:\r
+      BootStringNumber = Option->Description;\r
       Option->Description = GetStringById (STRING_TOKEN (STR_DESCRIPTION_SCSI));\r
-      \r
-    } else if (StrStr (Option->Description, DESCRIPTION_MISC) != NULL) {\r
-      BootStringNumber = Option->Description + StrLen (DESCRIPTION_MISC) + 1;\r
+      break;\r
+    case BDS_EFI_MESSAGE_MISC_BOOT:\r
+      BootStringNumber = Option->Description;\r
       Option->Description = GetStringById (STRING_TOKEN (STR_DESCRIPTION_MISC));\r
-      \r
-    } else if (StrStr (Option->Description, DESCRIPTION_NETWORK) != NULL) {\r
-      BootStringNumber = Option->Description + StrLen (DESCRIPTION_NETWORK) + 1;\r
+      break;\r
+    case BDS_EFI_MESSAGE_MAC_BOOT:\r
+      BootStringNumber = Option->Description;\r
       Option->Description = GetStringById (STRING_TOKEN (STR_DESCRIPTION_NETWORK));\r
-      \r
-    } else if (StrStr (Option->Description, DESCRIPTION_NON_BLOCK) != NULL) {\r
-      BootStringNumber = Option->Description + StrLen (DESCRIPTION_NON_BLOCK) + 1;\r
-      Option->Description = GetStringById (STRING_TOKEN (STR_DESCRIPTION_NON_BLOCK));\r
+      break;\r
     }\r
     \r
     ASSERT (Option->Description != NULL);\r
-    if (StrnCmp (BootStringNumber, L"0", 1) != 0) {\r
-      StrCat (Option->Description, L" ");\r
-      StrCat (Option->Description, BootStringNumber);\r
+    if (BootStringNumber != NULL) {\r
+      if (StrnCmp (BootStringNumber, L"0", 1) != 0) {\r
+        StrCat (Option->Description, L" ");\r
+        StrCat (Option->Description, BootStringNumber);\r
+      }\r
+      \r
+      FreePool (BootStringNumber);\r
     }\r
-  \r
+    \r
     Token = HiiSetString (HiiHandle, 0, Option->Description, NULL);\r
 \r
     TempStr = DevicePathToStr (Option->DevicePath);\r