diff options
author | gikidy <gikidy@6f19259b-4bc3-4df7-8a09-765794883524> | 2009-06-25 04:44:45 +0000 |
---|---|---|
committer | gikidy <gikidy@6f19259b-4bc3-4df7-8a09-765794883524> | 2009-06-25 04:44:45 +0000 |
commit | 8d3b5aff68cef02a1fdb650d009b9aa6b83d6040 (patch) | |
tree | 7a1a5723efddda6c93c3002ef212579289786e4a /IntelFrameworkModulePkg | |
parent | f66d00cabc80475fe1b3a9be9bfd71b712657d02 (diff) | |
download | edk2-platforms-8d3b5aff68cef02a1fdb650d009b9aa6b83d6040.tar.xz |
Use UNI file string to display Boot Option for language localization.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8655 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'IntelFrameworkModulePkg')
-rw-r--r-- | IntelFrameworkModulePkg/Include/Library/GenericBdsLib.h | 38 | ||||
-rw-r--r-- | IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c | 63 | ||||
-rw-r--r-- | IntelFrameworkModulePkg/Library/GenericBdsLib/BdsMisc.c | 2 | ||||
-rw-r--r-- | IntelFrameworkModulePkg/Universal/BdsDxe/BootMngr/BootManager.c | 43 | ||||
-rw-r--r-- | IntelFrameworkModulePkg/Universal/BdsDxe/Strings.uni | bin | 7342 -> 9310 bytes |
5 files changed, 97 insertions, 49 deletions
diff --git a/IntelFrameworkModulePkg/Include/Library/GenericBdsLib.h b/IntelFrameworkModulePkg/Include/Library/GenericBdsLib.h index d0a5de46bc..a137b36d15 100644 --- a/IntelFrameworkModulePkg/Include/Library/GenericBdsLib.h +++ b/IntelFrameworkModulePkg/Include/Library/GenericBdsLib.h @@ -141,9 +141,41 @@ BdsLibBootViaBootOption ( /**
- This function will enumerate all possible boot device in the system,
- it will only excute once of every boot.
-
+ For EFI boot option, BDS separate them as six types:
+ 1. Network - The boot option points to the SimpleNetworkProtocol device.
+ Bds will try to automatically create this type boot option when enumerate.
+ 2. Shell - The boot option points to internal flash shell.
+ Bds will try to automatically create this type boot option when enumerate.
+ 3. Removable BlockIo - The boot option only points to the removable media
+ device, like USB flash disk, DVD, Floppy etc.
+ These device should contain a *removable* blockIo
+ protocol in their device handle.
+ Bds will try to automatically create this type boot option
+ when enumerate.
+ 4. Fixed BlockIo - The boot option only points to a Fixed blockIo device,
+ like HardDisk.
+ These device should contain a *fixed* blockIo
+ protocol in their device handle.
+ BDS will skip fixed blockIo devices, and NOT
+ automatically create boot option for them. But BDS
+ will help to delete those fixed blockIo boot option,
+ whose description rule conflict with other auto-created
+ boot options.
+ 5. Non-BlockIo Simplefile - The boot option points to a device whose handle
+ has SimpleFileSystem Protocol, but has no blockio
+ protocol. These devices do not offer blockIo
+ protocol, but BDS still can get the
+ \EFI\BOOT\boot{machinename}.EFI by SimpleFileSystem
+ Protocol.
+ 6. File - The boot option points to a file. These boot options are usually
+ created by user manually or OS loader. BDS will not delete or modify
+ these boot options.
+
+ This function will enumerate all possible boot device in the system, and
+ automatically create boot options for Network, Shell, Removable BlockIo,
+ and Non-BlockIo Simplefile devices.
+ It will only excute once of every boot.
+
@param BdsBootOptionList The header of the link list which indexed all
current boot options
diff --git a/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c b/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c index 45d36fe995..d0ce36e987 100644 --- a/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c +++ b/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c @@ -904,7 +904,7 @@ BdsDeleteAllInvalidEfiBootOption ( This function will enumerate all possible boot device in the system, and
automatically create boot options for Network, Shell, Removable BlockIo,
and Non-BlockIo Simplefile devices.
- It will only excute once of every boot.
+ It will only execute once of every boot.
@param BdsBootOptionList The header of the link list which indexed all
current boot options
@@ -924,6 +924,7 @@ BdsLibEnumerateAllBootOption ( UINT16 CdromNumber;
UINT16 UsbNumber;
UINT16 MiscNumber;
+ UINT16 ScsiNumber;
UINT16 NonBlockNumber;
UINTN NumberBlockIoHandles;
EFI_HANDLE *BlockIoHandles;
@@ -937,8 +938,8 @@ BdsLibEnumerateAllBootOption ( UINTN Size;
EFI_FV_FILE_ATTRIBUTES Attributes;
UINT32 AuthenticationStatus;
- EFI_FIRMWARE_VOLUME2_PROTOCOL *Fv;
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
+ EFI_FIRMWARE_VOLUME2_PROTOCOL *Fv;
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;
UINTN DevicePathType;
CHAR16 Buffer[40];
EFI_HANDLE *FileSystemHandles;
@@ -952,6 +953,7 @@ BdsLibEnumerateAllBootOption ( CdromNumber = 0;
UsbNumber = 0;
MiscNumber = 0;
+ ScsiNumber = 0;
ZeroMem (Buffer, sizeof (Buffer));
//
@@ -1005,11 +1007,7 @@ BdsLibEnumerateAllBootOption ( switch (DevicePathType) {
case BDS_EFI_ACPI_FLOPPY_BOOT:
- if (FloppyNumber == 0) {
- UnicodeSPrint (Buffer, sizeof (Buffer), DESCRIPTION_FLOPPY);
- } else {
- UnicodeSPrint (Buffer, sizeof (Buffer), DESCRIPTION_FLOPPY_NUM, FloppyNumber);
- }
+ UnicodeSPrint (Buffer, sizeof (Buffer), DESCRIPTION_FLOPPY_NUM, FloppyNumber);
BdsLibBuildOptionFromHandle (BlockIoHandles[Index], BdsBootOptionList, Buffer);
FloppyNumber++;
break;
@@ -1019,42 +1017,26 @@ BdsLibEnumerateAllBootOption ( //
case BDS_EFI_MESSAGE_ATAPI_BOOT:
case BDS_EFI_MESSAGE_SATA_BOOT:
- if (CdromNumber == 0) {
- UnicodeSPrint (Buffer, sizeof (Buffer), DESCRIPTION_DVD);
- } else {
- UnicodeSPrint (Buffer, sizeof (Buffer), DESCRIPTION_DVD_NUM, CdromNumber);
- }
+ UnicodeSPrint (Buffer, sizeof (Buffer), DESCRIPTION_DVD_NUM, CdromNumber);
BdsLibBuildOptionFromHandle (BlockIoHandles[Index], BdsBootOptionList, Buffer);
CdromNumber++;
break;
case BDS_EFI_MESSAGE_USB_DEVICE_BOOT:
- if (UsbNumber == 0) {
- UnicodeSPrint (Buffer, sizeof (Buffer), DESCRIPTION_USB);
- } else {
- UnicodeSPrint (Buffer, sizeof (Buffer), DESCRIPTION_USB_NUM, UsbNumber);
- }
+ UnicodeSPrint (Buffer, sizeof (Buffer), DESCRIPTION_USB_NUM, UsbNumber);
BdsLibBuildOptionFromHandle (BlockIoHandles[Index], BdsBootOptionList, Buffer);
UsbNumber++;
break;
case BDS_EFI_MESSAGE_SCSI_BOOT:
- if (UsbNumber == 0) {
- UnicodeSPrint (Buffer, sizeof (Buffer), DESCRIPTION_SCSI);
- } else {
- UnicodeSPrint (Buffer, sizeof (Buffer), DESCRIPTION_SCSI_NUM, UsbNumber);
- }
- BdsLibBuildOptionFromHandle (BlockIoHandles[Index], BdsBootOptionList, Buffer);
- UsbNumber++;
+ UnicodeSPrint (Buffer, sizeof (Buffer), DESCRIPTION_SCSI_NUM, ScsiNumber);
+ BdsLibBuildOptionFromHandle (BlockIoHandles[Index], BdsBootOptionList, Buffer);
+ ScsiNumber++;
break;
case BDS_EFI_MESSAGE_MISC_BOOT:
- if (MiscNumber == 0) {
- UnicodeSPrint (Buffer, sizeof (Buffer), DESCRIPTION_MISC);
- } else {
- UnicodeSPrint (Buffer, sizeof (Buffer), DESCRIPTION_MISC_NUM, MiscNumber);
- }
- BdsLibBuildOptionFromHandle (BlockIoHandles[Index], BdsBootOptionList, Buffer);
+ UnicodeSPrint (Buffer, sizeof (Buffer), DESCRIPTION_MISC_NUM, MiscNumber);
+ BdsLibBuildOptionFromHandle (BlockIoHandles[Index], BdsBootOptionList, Buffer);
MiscNumber++;
break;
@@ -1115,11 +1097,7 @@ BdsLibEnumerateAllBootOption ( //
BdsLibDeleteOptionFromHandle (FileSystemHandles[Index]);
} else {
- if (NonBlockNumber == 0) {
- UnicodeSPrint (Buffer, sizeof (Buffer), DESCRIPTION_NON_BLOCK);
- } else {
- UnicodeSPrint (Buffer, sizeof (Buffer), DESCRIPTION_NON_BLOCK_NUM, NonBlockNumber);
- }
+ UnicodeSPrint (Buffer, sizeof (Buffer), DESCRIPTION_NON_BLOCK_NUM, NonBlockNumber);
BdsLibBuildOptionFromHandle (FileSystemHandles[Index], BdsBootOptionList, Buffer);
NonBlockNumber++;
}
@@ -1139,12 +1117,9 @@ BdsLibEnumerateAllBootOption ( &NumberSimpleNetworkHandles,
&SimpleNetworkHandles
);
+
for (Index = 0; Index < NumberSimpleNetworkHandles; Index++) {
- if (Index == 0) {
- UnicodeSPrint (Buffer, sizeof (Buffer), DESCRIPTION_NETWORK);
- } else {
- UnicodeSPrint (Buffer, sizeof (Buffer), DESCRIPTION_NETWORK_NUM, Index);
- }
+ UnicodeSPrint (Buffer, sizeof (Buffer), DESCRIPTION_NETWORK_NUM, Index);
BdsLibBuildOptionFromHandle (SimpleNetworkHandles[Index], BdsBootOptionList, Buffer);
}
@@ -1223,7 +1198,7 @@ BdsLibBuildOptionFromHandle ( {
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- DevicePath = DevicePathFromHandle (Handle);
+ DevicePath = DevicePathFromHandle (Handle);
//
// Create and register new boot option
@@ -1804,8 +1779,8 @@ BdsLibIsValidEFIBootOptDevicePathExt ( //
// If the boot option point to a blockIO device:
- // if it is a removable blockIo device, it is valid.
- // if it is a fixed blockIo device, check its description confliction.
+ // if it is a removable blockIo device, it is valid.
+ // if it is a fixed blockIo device, check its description confliction.
//
TempDevicePath = DevPath;
Status = gBS->LocateDevicePath (&gEfiBlockIoProtocolGuid, &TempDevicePath, &Handle);
diff --git a/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsMisc.c b/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsMisc.c index 7b16d9816c..f937be27a6 100644 --- a/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsMisc.c +++ b/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsMisc.c @@ -811,7 +811,7 @@ BdsLibOutputStrings ( }
//
-// Following are BDS Lib functions which contain all the code about setup browser reset reminder feature.
+// Following are BDS Lib functions which contain all the code about setup browser reset reminder feature.
// Setup Browser reset reminder feature is that an reset reminder will be given before user leaves the setup browser if
// user change any option setting which needs a reset to be effective, and the reset will be applied according to the user selection.
//
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMngr/BootManager.c b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMngr/BootManager.c index 0fad88ed48..eda86fdcba 100644 --- a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMngr/BootManager.c +++ b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMngr/BootManager.c @@ -201,6 +201,7 @@ CallBootManager ( VOID *EndOpCodeHandle;
EFI_IFR_GUID_LABEL *StartLabel;
EFI_IFR_GUID_LABEL *EndLabel;
+ CHAR16 *BootStringNumber;
gOption = NULL;
InitializeListHead (&BdsBootOptionList);
@@ -262,7 +263,47 @@ CallBootManager ( if ((Option->Attribute & LOAD_OPTION_HIDDEN) != 0) {
continue;
}
-
+
+ //
+ // Replace description string with UNI file string.
+ //
+ BootStringNumber = AllocateZeroPool (StrSize (Option->Description));
+ ASSERT (BootStringNumber != NULL);
+
+ if (StrStr (Option->Description, DESCRIPTION_FLOPPY) != NULL) {
+ BootStringNumber = Option->Description + StrLen (DESCRIPTION_FLOPPY) + 1;
+ Option->Description = GetStringById (STRING_TOKEN (STR_DESCRIPTION_FLOPPY));
+
+ } else if (StrStr (Option->Description, DESCRIPTION_DVD) != NULL) {
+ BootStringNumber = Option->Description + StrLen (DESCRIPTION_DVD) + 1;
+ Option->Description = GetStringById (STRING_TOKEN (STR_DESCRIPTION_DVD));
+
+ } else if (StrStr (Option->Description, DESCRIPTION_USB) != NULL) {
+ BootStringNumber = Option->Description + StrLen (DESCRIPTION_USB) + 1;
+ Option->Description = GetStringById (STRING_TOKEN (STR_DESCRIPTION_USB));
+
+ } else if (StrStr (Option->Description, DESCRIPTION_SCSI) != NULL) {
+ BootStringNumber = Option->Description + StrLen (DESCRIPTION_SCSI) + 1;
+ Option->Description = GetStringById (STRING_TOKEN (STR_DESCRIPTION_SCSI));
+
+ } else if (StrStr (Option->Description, DESCRIPTION_MISC) != NULL) {
+ BootStringNumber = Option->Description + StrLen (DESCRIPTION_MISC) + 1;
+ Option->Description = GetStringById (STRING_TOKEN (STR_DESCRIPTION_MISC));
+
+ } else if (StrStr (Option->Description, DESCRIPTION_NETWORK) != NULL) {
+ BootStringNumber = Option->Description + StrLen (DESCRIPTION_NETWORK) + 1;
+ Option->Description = GetStringById (STRING_TOKEN (STR_DESCRIPTION_NETWORK));
+
+ } else if (StrStr (Option->Description, DESCRIPTION_NON_BLOCK) != NULL) {
+ BootStringNumber = Option->Description + StrLen (DESCRIPTION_NON_BLOCK) + 1;
+ Option->Description = GetStringById (STRING_TOKEN (STR_DESCRIPTION_NON_BLOCK));
+ }
+
+ if (StrnCmp (BootStringNumber, L"0", 1) != 0) {
+ StrCat (Option->Description, L" ");
+ StrCat (Option->Description, BootStringNumber);
+ }
+
Token = HiiSetString (HiiHandle, 0, Option->Description, NULL);
TempStr = DevicePathToStr (Option->DevicePath);
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/Strings.uni b/IntelFrameworkModulePkg/Universal/BdsDxe/Strings.uni Binary files differindex 0d4274a4a9..fac0a0a639 100644 --- a/IntelFrameworkModulePkg/Universal/BdsDxe/Strings.uni +++ b/IntelFrameworkModulePkg/Universal/BdsDxe/Strings.uni |