]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c
Use UNI file string to display Boot Option for language localization.
[mirror_edk2.git] / IntelFrameworkModulePkg / Library / GenericBdsLib / BdsBoot.c
index 45d36fe995c0dc38af1d9da5a152a8599d7715b0..d0ce36e9870a9c73fe601592498641fb60596a0f 100644 (file)
@@ -904,7 +904,7 @@ BdsDeleteAllInvalidEfiBootOption (
   This function will enumerate all possible boot device in the system, and\r
   automatically create boot options for Network, Shell, Removable BlockIo, \r
   and Non-BlockIo Simplefile devices.\r
-  It will only excute once of every boot.\r
+  It will only execute once of every boot.\r
   \r
   @param  BdsBootOptionList      The header of the link list which indexed all\r
                                  current boot options\r
@@ -924,6 +924,7 @@ BdsLibEnumerateAllBootOption (
   UINT16                        CdromNumber;\r
   UINT16                        UsbNumber;\r
   UINT16                        MiscNumber;\r
+  UINT16                        ScsiNumber;\r
   UINT16                        NonBlockNumber;\r
   UINTN                         NumberBlockIoHandles;\r
   EFI_HANDLE                    *BlockIoHandles;\r
@@ -937,8 +938,8 @@ BdsLibEnumerateAllBootOption (
   UINTN                         Size;\r
   EFI_FV_FILE_ATTRIBUTES        Attributes;\r
   UINT32                        AuthenticationStatus;\r
-  EFI_FIRMWARE_VOLUME2_PROTOCOL  *Fv;\r
-  EFI_DEVICE_PATH_PROTOCOL     *DevicePath;\r
+  EFI_FIRMWARE_VOLUME2_PROTOCOL *Fv;\r
+  EFI_DEVICE_PATH_PROTOCOL      *DevicePath;\r
   UINTN                         DevicePathType;\r
   CHAR16                        Buffer[40];\r
   EFI_HANDLE                    *FileSystemHandles;\r
@@ -952,6 +953,7 @@ BdsLibEnumerateAllBootOption (
   CdromNumber   = 0;\r
   UsbNumber     = 0;\r
   MiscNumber    = 0;\r
+  ScsiNumber    = 0;\r
   ZeroMem (Buffer, sizeof (Buffer));\r
   \r
   //\r
@@ -1005,11 +1007,7 @@ BdsLibEnumerateAllBootOption (
 \r
     switch (DevicePathType) {\r
     case BDS_EFI_ACPI_FLOPPY_BOOT:\r
-      if (FloppyNumber == 0) {\r
-        UnicodeSPrint (Buffer, sizeof (Buffer), DESCRIPTION_FLOPPY);\r
-      } else {\r
-        UnicodeSPrint (Buffer, sizeof (Buffer), DESCRIPTION_FLOPPY_NUM, FloppyNumber);\r
-      }\r
+      UnicodeSPrint (Buffer, sizeof (Buffer), DESCRIPTION_FLOPPY_NUM, FloppyNumber); \r
       BdsLibBuildOptionFromHandle (BlockIoHandles[Index], BdsBootOptionList, Buffer);\r
       FloppyNumber++;\r
       break;\r
@@ -1019,42 +1017,26 @@ BdsLibEnumerateAllBootOption (
     //\r
     case BDS_EFI_MESSAGE_ATAPI_BOOT:\r
     case BDS_EFI_MESSAGE_SATA_BOOT:\r
-      if (CdromNumber == 0) {\r
-        UnicodeSPrint (Buffer, sizeof (Buffer), DESCRIPTION_DVD);\r
-      } else {\r
-        UnicodeSPrint (Buffer, sizeof (Buffer), DESCRIPTION_DVD_NUM, CdromNumber);\r
-      }\r
+      UnicodeSPrint (Buffer, sizeof (Buffer), DESCRIPTION_DVD_NUM, CdromNumber);\r
       BdsLibBuildOptionFromHandle (BlockIoHandles[Index], BdsBootOptionList, Buffer);\r
       CdromNumber++;\r
       break;\r
 \r
     case BDS_EFI_MESSAGE_USB_DEVICE_BOOT:\r
-      if (UsbNumber == 0) {\r
-        UnicodeSPrint (Buffer, sizeof (Buffer), DESCRIPTION_USB);\r
-      } else {\r
-        UnicodeSPrint (Buffer, sizeof (Buffer), DESCRIPTION_USB_NUM, UsbNumber);\r
-      }\r
+      UnicodeSPrint (Buffer, sizeof (Buffer), DESCRIPTION_USB_NUM, UsbNumber);\r
       BdsLibBuildOptionFromHandle (BlockIoHandles[Index], BdsBootOptionList, Buffer);\r
       UsbNumber++;\r
       break;\r
 \r
     case BDS_EFI_MESSAGE_SCSI_BOOT:\r
-      if (UsbNumber == 0) {\r
-        UnicodeSPrint (Buffer, sizeof (Buffer), DESCRIPTION_SCSI);\r
-      } else {\r
-        UnicodeSPrint (Buffer, sizeof (Buffer), DESCRIPTION_SCSI_NUM, UsbNumber);\r
-      }\r
-      BdsLibBuildOptionFromHandle (BlockIoHandles[Index], BdsBootOptionList, Buffer);\r
-      UsbNumber++;\r
+      UnicodeSPrint (Buffer, sizeof (Buffer), DESCRIPTION_SCSI_NUM, ScsiNumber);\r
+      BdsLibBuildOptionFromHandle (BlockIoHandles[Index], BdsBootOptionList, Buffer);      \r
+      ScsiNumber++;\r
       break;\r
 \r
     case BDS_EFI_MESSAGE_MISC_BOOT:\r
-      if (MiscNumber == 0) {\r
-        UnicodeSPrint (Buffer, sizeof (Buffer), DESCRIPTION_MISC);\r
-      } else {\r
-        UnicodeSPrint (Buffer, sizeof (Buffer), DESCRIPTION_MISC_NUM, MiscNumber);\r
-      }\r
-      BdsLibBuildOptionFromHandle (BlockIoHandles[Index], BdsBootOptionList, Buffer);\r
+      UnicodeSPrint (Buffer, sizeof (Buffer), DESCRIPTION_MISC_NUM, MiscNumber);\r
+      BdsLibBuildOptionFromHandle (BlockIoHandles[Index], BdsBootOptionList, Buffer);      \r
       MiscNumber++;\r
       break;\r
 \r
@@ -1115,11 +1097,7 @@ BdsLibEnumerateAllBootOption (
       //\r
       BdsLibDeleteOptionFromHandle (FileSystemHandles[Index]);\r
     } else {\r
-      if (NonBlockNumber == 0) {\r
-        UnicodeSPrint (Buffer, sizeof (Buffer), DESCRIPTION_NON_BLOCK);\r
-      } else {\r
-        UnicodeSPrint (Buffer, sizeof (Buffer), DESCRIPTION_NON_BLOCK_NUM, NonBlockNumber);\r
-      }\r
+      UnicodeSPrint (Buffer, sizeof (Buffer), DESCRIPTION_NON_BLOCK_NUM, NonBlockNumber);\r
       BdsLibBuildOptionFromHandle (FileSystemHandles[Index], BdsBootOptionList, Buffer);\r
       NonBlockNumber++;\r
     }\r
@@ -1139,12 +1117,9 @@ BdsLibEnumerateAllBootOption (
         &NumberSimpleNetworkHandles,\r
         &SimpleNetworkHandles\r
         );\r
+\r
   for (Index = 0; Index < NumberSimpleNetworkHandles; Index++) {\r
-    if (Index == 0) {\r
-      UnicodeSPrint (Buffer, sizeof (Buffer), DESCRIPTION_NETWORK);\r
-    } else {\r
-      UnicodeSPrint (Buffer, sizeof (Buffer), DESCRIPTION_NETWORK_NUM, Index);\r
-    }\r
+    UnicodeSPrint (Buffer, sizeof (Buffer), DESCRIPTION_NETWORK_NUM, Index);\r
     BdsLibBuildOptionFromHandle (SimpleNetworkHandles[Index], BdsBootOptionList, Buffer);\r
   }\r
 \r
@@ -1223,7 +1198,7 @@ BdsLibBuildOptionFromHandle (
 {\r
   EFI_DEVICE_PATH_PROTOCOL  *DevicePath;\r
 \r
-  DevicePath  = DevicePathFromHandle (Handle);\r
+  DevicePath = DevicePathFromHandle (Handle);\r
 \r
   //\r
   // Create and register new boot option\r
@@ -1804,8 +1779,8 @@ BdsLibIsValidEFIBootOptDevicePathExt (
   \r
   //\r
   // If the boot option point to a blockIO device:\r
-  // if it is a removable blockIo device, it is valid.\r
-  // if it is a fixed blockIo device, check its description confliction. \r
+  //    if it is a removable blockIo device, it is valid.\r
+  //    if it is a fixed blockIo device, check its description confliction. \r
   //\r
   TempDevicePath = DevPath;\r
   Status = gBS->LocateDevicePath (&gEfiBlockIoProtocolGuid, &TempDevicePath, &Handle);\r