]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Use UNI file string to display Boot Option for language localization.
authorgikidy <gikidy@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 25 Jun 2009 04:44:45 +0000 (04:44 +0000)
committergikidy <gikidy@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 25 Jun 2009 04:44:45 +0000 (04:44 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8655 6f19259b-4bc3-4df7-8a09-765794883524

IntelFrameworkModulePkg/Include/Library/GenericBdsLib.h
IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c
IntelFrameworkModulePkg/Library/GenericBdsLib/BdsMisc.c
IntelFrameworkModulePkg/Universal/BdsDxe/BootMngr/BootManager.c
IntelFrameworkModulePkg/Universal/BdsDxe/Strings.uni

index d0a5de46bc3c3e4192cab7c975a6763eed9abe0a..a137b36d1583a0f502a8d9bfff57b920b29be2b8 100644 (file)
@@ -141,9 +141,41 @@ BdsLibBootViaBootOption (
 \r
 \r
 /**\r
-  This function will enumerate all possible boot device in the system,\r
-  it will only excute once of every boot.\r
-\r
+  For EFI boot option, BDS separate them as six types:\r
+  1. Network - The boot option points to the SimpleNetworkProtocol device. \r
+               Bds will try to automatically create this type boot option when enumerate.\r
+  2. Shell   - The boot option points to internal flash shell. \r
+               Bds will try to automatically create this type boot option when enumerate.\r
+  3. Removable BlockIo      - The boot option only points to the removable media\r
+                              device, like USB flash disk, DVD, Floppy etc.\r
+                              These device should contain a *removable* blockIo\r
+                              protocol in their device handle.\r
+                              Bds will try to automatically create this type boot option \r
+                              when enumerate.\r
+  4. Fixed BlockIo          - The boot option only points to a Fixed blockIo device, \r
+                              like HardDisk.\r
+                              These device should contain a *fixed* blockIo\r
+                              protocol in their device handle.\r
+                              BDS will skip fixed blockIo devices, and NOT\r
+                              automatically create boot option for them. But BDS \r
+                              will help to delete those fixed blockIo boot option, \r
+                              whose description rule conflict with other auto-created\r
+                              boot options.\r
+  5. Non-BlockIo Simplefile - The boot option points to a device whose handle \r
+                              has SimpleFileSystem Protocol, but has no blockio\r
+                              protocol. These devices do not offer blockIo\r
+                              protocol, but BDS still can get the \r
+                              \EFI\BOOT\boot{machinename}.EFI by SimpleFileSystem\r
+                              Protocol.\r
+  6. File    - The boot option points to a file. These boot options are usually \r
+               created by user manually or OS loader. BDS will not delete or modify\r
+               these boot options.        \r
+    \r
+  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
+  \r
   @param  BdsBootOptionList      The header of the link list which indexed all\r
                                  current boot options\r
 \r
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
index 7b16d9816c1d1313fe2309a28ca3cc8fa80ab919..f937be27a618d81a8accffe787379d326f7badf2 100644 (file)
@@ -811,7 +811,7 @@ BdsLibOutputStrings (
 }\r
 \r
 //\r
-//  Following are BDS Lib functions which  contain all the code about setup browser reset reminder feature.\r
+//  Following are BDS Lib functions which contain all the code about setup browser reset reminder feature.\r
 //  Setup Browser reset reminder feature is that an reset reminder will be given before user leaves the setup browser  if\r
 //  user change any option setting which needs a reset to be effective, and  the reset will be applied according to  the user selection.\r
 //\r
index 0fad88ed482d6f539393f454e5308bd0d080a51e..eda86fdcbac855898717ff4986ff32e0ecdf93a3 100644 (file)
@@ -201,6 +201,7 @@ CallBootManager (
   VOID                        *EndOpCodeHandle;\r
   EFI_IFR_GUID_LABEL          *StartLabel;\r
   EFI_IFR_GUID_LABEL          *EndLabel;\r
+  CHAR16                      *BootStringNumber;\r
 \r
   gOption = NULL;\r
   InitializeListHead (&BdsBootOptionList);\r
@@ -262,7 +263,47 @@ CallBootManager (
     if ((Option->Attribute & LOAD_OPTION_HIDDEN) != 0) {\r
       continue;\r
     }\r
-\r
+    \r
+    //\r
+    // Replace description string with UNI file string.\r
+    //\r
+    BootStringNumber = AllocateZeroPool (StrSize (Option->Description));\r
+    ASSERT (BootStringNumber != NULL);\r
+    \r
+    if (StrStr (Option->Description, DESCRIPTION_FLOPPY) != NULL) {\r
+      BootStringNumber = Option->Description + StrLen (DESCRIPTION_FLOPPY) + 1;\r
+      Option->Description = GetStringById (STRING_TOKEN (STR_DESCRIPTION_FLOPPY));\r
+      \r
+    } else if (StrStr (Option->Description, DESCRIPTION_DVD) != NULL) {\r
+      BootStringNumber = Option->Description + StrLen (DESCRIPTION_DVD) + 1;\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
+      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
+      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
+      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
+      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
+    }\r
+    \r
+    if (StrnCmp (BootStringNumber, L"0", 1) != 0) {\r
+      StrCat (Option->Description, L" ");\r
+      StrCat (Option->Description, BootStringNumber);\r
+    }\r
+  \r
     Token = HiiSetString (HiiHandle, 0, Option->Description, NULL);\r
 \r
     TempStr = DevicePathToStr (Option->DevicePath);\r
index 0d4274a4a99990890e0f71dc6f4c4b4d393eb5ee..fac0a0a639a2db8fdec5bf1602128eb988495ac9 100644 (file)
Binary files a/IntelFrameworkModulePkg/Universal/BdsDxe/Strings.uni and b/IntelFrameworkModulePkg/Universal/BdsDxe/Strings.uni differ