\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
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
UINT16 CdromNumber;\r
UINT16 UsbNumber;\r
UINT16 MiscNumber;\r
+ UINT16 ScsiNumber;\r
UINT16 NonBlockNumber;\r
UINTN NumberBlockIoHandles;\r
EFI_HANDLE *BlockIoHandles;\r
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
CdromNumber = 0;\r
UsbNumber = 0;\r
MiscNumber = 0;\r
+ ScsiNumber = 0;\r
ZeroMem (Buffer, sizeof (Buffer));\r
\r
//\r
\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
//\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
//\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
&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
{\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
\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
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
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