Add multiple USB boot device support (#614)
When multiple USB mass storage boot devices are connected, current SBL will only boot from the 1st one enumerated by the USB bus. This patch added support to boot from the remaining devices. This feature will be controlled by PcdMultiUsbBootDeviceEnabled. And it can be overridden by board using ENABLE_MULTI_USB_BOOT_DEV. When it is enabled for USB block IO interface, the hardware partition in boot option will be used to indicate the index of the USB mass storage devvice. Signed-off-by: Maurice Ma <maurice.ma@intel.com>
This commit is contained in:
parent
6e5dd24e0e
commit
211b6019f0
|
@ -265,5 +265,7 @@
|
|||
gPlatformCommonLibTokenSpaceGuid.PcdMiniShellEnabled | FALSE | BOOLEAN | 0x20000217
|
||||
# This PCD will enable DMA protection
|
||||
gPlatformCommonLibTokenSpaceGuid.PcdDmaProtectionEnabled | FALSE | BOOLEAN | 0x20000218
|
||||
# This PCD will enable multiple USB mass storage boot device support
|
||||
gPlatformCommonLibTokenSpaceGuid.PcdMultiUsbBootDeviceEnabled | FALSE | BOOLEAN | 0x20000219
|
||||
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#include <UsbBotPeim.h>
|
||||
#include <BlockDevice.h>
|
||||
|
||||
#define MAX_USB_BLOCK_DEVICE_NUMBER 1
|
||||
#define MAX_USB_BLOCK_DEVICE_NUMBER 8
|
||||
|
||||
UINTN mUsbBlkCount;
|
||||
EFI_PEI_RECOVERY_BLOCK_IO_PPI *mUsbBlkArray[MAX_USB_BLOCK_DEVICE_NUMBER];
|
||||
|
@ -90,12 +90,18 @@ InitializeUsb (
|
|||
|
||||
for (Index = 0; Index < UsbIoCount; Index++) {
|
||||
Status = UsbFindBlockDevice (UsbIoArray[Index], UsbBlkCallback);
|
||||
if (!EFI_ERROR (Status) && (mUsbBlkCount > 0)) {
|
||||
DEBUG ((DEBUG_INFO, "Found mass storage on device %d\n", Index));
|
||||
break;
|
||||
if (!FeaturePcdGet(PcdMultiUsbBootDeviceEnabled)) {
|
||||
if (!EFI_ERROR (Status) && (mUsbBlkCount > 0)) {
|
||||
DEBUG ((DEBUG_INFO, "Use the 1st mass storage device\n"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (mUsbBlkCount > 0) {
|
||||
DEBUG ((DEBUG_INFO, "Found %d mass storage devices\n", mUsbBlkCount));
|
||||
}
|
||||
|
||||
if (mUsbBlkCount > 0) {
|
||||
return EFI_SUCCESS;
|
||||
} else {
|
||||
|
@ -130,10 +136,10 @@ UsbGetMediaInfo (
|
|||
EFI_STATUS Status;
|
||||
EFI_PEI_BLOCK_IO_MEDIA MediaInfo;
|
||||
|
||||
if (mUsbBlkCount == 0) {
|
||||
if (DeviceIndex >= mUsbBlkCount) {
|
||||
Status = EFI_DEVICE_ERROR;
|
||||
} else {
|
||||
Status = mUsbBlkArray[0]->GetBlockDeviceMediaInfo (NULL, mUsbBlkArray[0], 0, &MediaInfo);
|
||||
Status = mUsbBlkArray[DeviceIndex]->GetBlockDeviceMediaInfo (NULL, mUsbBlkArray[DeviceIndex], 0, &MediaInfo);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
if (DevBlockInfo != NULL) {
|
||||
DevBlockInfo->BlockNum = MediaInfo.LastBlock + 1;
|
||||
|
@ -182,10 +188,10 @@ UsbReadBlocks (
|
|||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
if (mUsbBlkCount == 0) {
|
||||
if (DeviceIndex >= mUsbBlkCount) {
|
||||
Status = EFI_DEVICE_ERROR;
|
||||
} else {
|
||||
Status = mUsbBlkArray[0]->ReadBlocks (NULL, mUsbBlkArray[0], DeviceIndex, StartLBA, BufferSize, Buffer);
|
||||
Status = mUsbBlkArray[DeviceIndex]->ReadBlocks (NULL, mUsbBlkArray[DeviceIndex], DeviceIndex, StartLBA, BufferSize, Buffer);
|
||||
}
|
||||
return Status;
|
||||
}
|
||||
|
|
|
@ -47,5 +47,5 @@
|
|||
|
||||
[Pcd]
|
||||
gEfiMdePkgTokenSpaceGuid.PcdUsbTransferTimeoutValue ## CONSUMES
|
||||
|
||||
gPlatformCommonLibTokenSpaceGuid.PcdMultiUsbBootDeviceEnabled ## CONSUMES
|
||||
|
||||
|
|
|
@ -310,6 +310,7 @@
|
|||
gPlatformCommonLibTokenSpaceGuid.PcdEmmcHs400SupportEnabled | $(ENABLE_EMMC_HS400)
|
||||
gPlatformCommonLibTokenSpaceGuid.PcdPreOsCheckerEnabled | $(ENABLE_PRE_OS_CHECKER)
|
||||
gPlatformCommonLibTokenSpaceGuid.PcdDmaProtectionEnabled | $(ENABLE_DMA_PROTECTION)
|
||||
gPlatformCommonLibTokenSpaceGuid.PcdMultiUsbBootDeviceEnabled | $(ENABLE_MULTI_USB_BOOT_DEV)
|
||||
|
||||
!ifdef $(S3_DEBUG)
|
||||
gPlatformModuleTokenSpaceGuid.PcdS3DebugEnabled | $(S3_DEBUG)
|
||||
|
|
|
@ -186,6 +186,7 @@ class BaseBoard(object):
|
|||
self.ENABLE_CSME_UPDATE = 0
|
||||
self.ENABLE_EMMC_HS400 = 1
|
||||
self.ENABLE_DMA_PROTECTION = 0
|
||||
self.ENABLE_MULTI_USB_BOOT_DEV = 0
|
||||
|
||||
self.BUILD_CSME_UPDATE_DRIVER = 0
|
||||
|
||||
|
|
Loading…
Reference in New Issue