From 3a0e4800a328f5d7893e080f65edcc6bd0bc07e5 Mon Sep 17 00:00:00 2001 From: Harry Liebel Date: Fri, 10 Oct 2014 10:39:36 +0000 Subject: ArmPlatformPkg/Bds: Reduce boot device entries If a storage device is used for Variable storage or access is provided by the Simple Filesystem Protocol do not list it again for RAW memory map access in the 'Add Boot device' menu. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Harry Liebel Reviewed-By: Olivier Martin git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16203 6f19259b-4bc3-4df7-8a09-765794883524 --- ArmPlatformPkg/Bds/BootOptionSupport.c | 55 ++++++++++++++++++++++++++-------- 1 file changed, 43 insertions(+), 12 deletions(-) (limited to 'ArmPlatformPkg/Bds/BootOptionSupport.c') diff --git a/ArmPlatformPkg/Bds/BootOptionSupport.c b/ArmPlatformPkg/Bds/BootOptionSupport.c index 6dc2ed6536..ee4281855e 100644 --- a/ArmPlatformPkg/Bds/BootOptionSupport.c +++ b/ArmPlatformPkg/Bds/BootOptionSupport.c @@ -18,6 +18,7 @@ #include #include +#include #include #include #include @@ -530,17 +531,19 @@ BdsLoadOptionMemMapList ( IN OUT LIST_ENTRY* BdsLoadOptionList ) { - EFI_STATUS Status; - UINTN HandleCount; - EFI_HANDLE *HandleBuffer; - UINTN DevicePathHandleCount; - EFI_HANDLE *DevicePathHandleBuffer; - BOOLEAN IsParent; - UINTN Index; - UINTN Index2; - BDS_SUPPORTED_DEVICE *SupportedDevice; - EFI_DEVICE_PATH_PROTOCOL* DevicePathProtocol; - EFI_DEVICE_PATH* DevicePath; + EFI_STATUS Status; + UINTN HandleCount; + EFI_HANDLE *HandleBuffer; + UINTN DevicePathHandleCount; + EFI_HANDLE *DevicePathHandleBuffer; + BOOLEAN IsParent; + UINTN Index; + UINTN Index2; + BDS_SUPPORTED_DEVICE *SupportedDevice; + EFI_DEVICE_PATH_PROTOCOL* DevicePathProtocol; + EFI_DEVICE_PATH* DevicePath; + EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *FileProtocol; + EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *FvbProtocol; // List all the BlockIo Protocols Status = gBS->LocateHandleBuffer (ByProtocol, &gEfiBlockIoProtocolGuid, NULL, &HandleCount, &HandleBuffer); @@ -549,7 +552,35 @@ BdsLoadOptionMemMapList ( } for (Index = 0; Index < HandleCount; Index++) { - // We only select the handle WITH a Device Path AND not part of Media (to avoid duplication with HardDisk, CDROM, etc) + // We only select handles WITH a Device Path AND not part of Media (to + // avoid duplication with HardDisk, CDROM, etc). Skip handles used by + // Simple Filesystem or used for Variable Storage. + + + Status = gBS->HandleProtocol (HandleBuffer[Index], + &gEfiSimpleFileSystemProtocolGuid, + (VOID *)&FileProtocol); + if (!EFI_ERROR(Status)) { + // SimpleFilesystem supported on this handle, skip + continue; + } + + Status = gBS->HandleProtocol (HandleBuffer[Index], + &gEfiFirmwareVolumeBlockProtocolGuid, + (VOID *)&FvbProtocol); + if (!EFI_ERROR(Status)) { + // Firmware Volme Block / Variable storage supported on this handle, skip + continue; + } + + Status = gBS->HandleProtocol (HandleBuffer[Index], + &gEfiFirmwareVolumeBlock2ProtocolGuid, + (VOID *)&FvbProtocol); + if (!EFI_ERROR(Status)) { + // Firmware Volme Block / Variable storage supported on this handle, skip + continue; + } + Status = gBS->HandleProtocol (HandleBuffer[Index], &gEfiDevicePathProtocolGuid, (VOID **)&DevicePathProtocol); if (!EFI_ERROR(Status)) { // BlockIo is not part of Media Device Path -- cgit v1.2.3