//\r
// If the boot option point to Internal FV shell, make sure it is valid\r
//\r
- Status = BdsLibUpdateFvFileDevicePath (&DevicePath, &gEfiShellFileGuid);\r
+ Status = BdsLibUpdateFvFileDevicePath (&DevicePath, PcdGetPtr(PcdShellFile));\r
if (!EFI_ERROR(Status)) {\r
if (Option->DevicePath != NULL) {\r
FreePool(Option->DevicePath);\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
@retval EFI_SUCCESS Finished all the boot device enumerate and create\r
the boot option base on that boot device\r
\r
+ @retval EFI_OUT_OF_RESOURCES Failed to enumerate the boot device and create the boot option list\r
**/\r
EFI_STATUS\r
EFIAPI\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
// device from the boot order variable\r
//\r
if (mEnumBootDevice) {\r
- BdsLibBuildOptionFromVar (BdsBootOptionList, L"BootOrder");\r
- return EFI_SUCCESS;\r
+ Status = BdsLibBuildOptionFromVar (BdsBootOptionList, L"BootOrder");\r
+ return Status;\r
}\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
Status = Fv->ReadFile (\r
Fv,\r
- &gEfiShellFileGuid,\r
+ PcdGetPtr(PcdShellFile),\r
NULL,\r
&Size,\r
&Type,\r
// Make sure every boot only have one time\r
// boot device enumerate\r
//\r
- BdsLibBuildOptionFromVar (BdsBootOptionList, L"BootOrder");\r
+ Status = BdsLibBuildOptionFromVar (BdsBootOptionList, L"BootOrder");\r
mEnumBootDevice = TRUE;\r
\r
- return EFI_SUCCESS;\r
+ return Status;\r
}\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
// Build the shell device path\r
//\r
- EfiInitializeFwVolDevicepathNode (&ShellNode, &gEfiShellFileGuid);\r
+ EfiInitializeFwVolDevicepathNode (&ShellNode, PcdGetPtr(PcdShellFile));\r
\r
DevicePath = AppendDevicePathNode (DevicePath, (EFI_DEVICE_PATH_PROTOCOL *) &ShellNode);\r
\r
Second, check whether the device path point to a device which support SimpleFileSystemProtocol,\r
Third, detect the the default boot file in the Media, and return the removable Media handle.\r
\r
- @param DevicePath Device Path to a bootable device\r
+ @param DevicePath Device Path to a bootable device\r
\r
- @retval NULL The media on the DevicePath is not bootable\r
+ @return The bootable media handle. If the media on the DevicePath is not bootable, NULL will return.\r
\r
**/\r
EFI_HANDLE\r
\r
@param DevicePath The bootable device Path to check\r
\r
- @retval BDS_EFI_MEDIA_HD_BOOT If the device path contains any media device path node, it is media boot type\r
- For the floppy node, handle it as media node\r
- @retval BDS_EFI_MEDIA_CDROM_BOOT If the device path contains any media device path node, it is media boot type\r
- For the floppy node, handle it as media node\r
- @retval BDS_EFI_ACPI_FLOPPY_BOOT If the device path contains any media device path node, it is media boot type\r
- For the floppy node, handle it as media node\r
- @retval BDS_EFI_MESSAGE_ATAPI_BOOT If the device path not contains any media device path node, and\r
- its last device path node point to a message device path node, it is\r
- \r
- @retval BDS_EFI_MESSAGE_SCSI_BOOT If the device path not contains any media device path node, and\r
- its last device path node point to a message device path node, it is\r
- @retval BDS_EFI_MESSAGE_USB_DEVICE_BOOT If the device path not contains any media device path node, and\r
- its last device path node point to a message device path node, it is\r
+ @retval BDS_EFI_MEDIA_HD_BOOT If given device path contains MEDIA_DEVICE_PATH type device path node \r
+ which subtype is MEDIA_HARDDRIVE_DP\r
+ @retval BDS_EFI_MEDIA_CDROM_BOOT If given device path contains MEDIA_DEVICE_PATH type device path node\r
+ which subtype is MEDIA_CDROM_DP\r
+ @retval BDS_EFI_ACPI_FLOPPY_BOOT If given device path contains ACPI_DEVICE_PATH type device path node\r
+ which HID is floppy device.\r
+ @retval BDS_EFI_MESSAGE_ATAPI_BOOT If given device path contains MESSAGING_DEVICE_PATH type device path node\r
+ and its last device path node's subtype is MSG_ATAPI_DP.\r
+ @retval BDS_EFI_MESSAGE_SCSI_BOOT If given device path contains MESSAGING_DEVICE_PATH type device path node\r
+ and its last device path node's subtype is MSG_SCSI_DP.\r
+ @retval BDS_EFI_MESSAGE_USB_DEVICE_BOOT If given device path contains MESSAGING_DEVICE_PATH type device path node\r
+ and its last device path node's subtype is MSG_USB_DP.\r
@retval BDS_EFI_MESSAGE_MISC_BOOT If the device path not contains any media device path node, and\r
- its last device path node point to a message device path node, it is\r
- @retval BDS_LEGACY_BBS_BOOT Legacy boot type\r
+ its last device path node point to a message device path node.\r
+ @retval BDS_LEGACY_BBS_BOOT If given device path contains BBS_DEVICE_PATH type device path node.\r
@retval BDS_EFI_UNSUPPORT An EFI Removable BlockIO device path not point to a media and message device, \r
\r
**/\r
// If the boot option point to Internal FV shell, make sure it is valid\r
//\r
TempDevicePath = DevPath; \r
- Status = BdsLibUpdateFvFileDevicePath (&TempDevicePath, &gEfiShellFileGuid);\r
+ Status = BdsLibUpdateFvFileDevicePath (&TempDevicePath, PcdGetPtr(PcdShellFile));\r
if (Status == EFI_ALREADY_STARTED) {\r
return TRUE;\r
} else {\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