mirror of https://github.com/acidanthera/audk.git
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
This commit is contained in:
parent
f66d00cabc
commit
8d3b5aff68
|
@ -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
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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.
|
||||
//
|
||||
|
|
|
@ -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);
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue