]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ArmPlatformPkg/Bds/BootOptionSupport.c
ArmPlatformPkg/Bds: Reduce boot device entries
[mirror_edk2.git] / ArmPlatformPkg / Bds / BootOptionSupport.c
index 6dc2ed6536f20999cbf3b9c8029205c5fe8cccfe..ee4281855e79a9208ae60d574c921917ab8bfbfa 100644 (file)
@@ -18,6 +18,7 @@
 \r
 #include <Protocol/BlockIo.h>\r
 #include <Protocol/DevicePathToText.h>\r
+#include <Protocol/FirmwareVolumeBlock.h>\r
 #include <Protocol/PxeBaseCode.h>\r
 #include <Protocol/SimpleFileSystem.h>\r
 #include <Protocol/SimpleNetwork.h>\r
@@ -530,17 +531,19 @@ BdsLoadOptionMemMapList (
   IN OUT LIST_ENTRY* BdsLoadOptionList\r
   )\r
 {\r
-  EFI_STATUS                        Status;\r
-  UINTN                             HandleCount;\r
-  EFI_HANDLE                        *HandleBuffer;\r
-  UINTN                             DevicePathHandleCount;\r
-  EFI_HANDLE                        *DevicePathHandleBuffer;\r
-  BOOLEAN                           IsParent;\r
-  UINTN                             Index;\r
-  UINTN                             Index2;\r
-  BDS_SUPPORTED_DEVICE              *SupportedDevice;\r
-  EFI_DEVICE_PATH_PROTOCOL*         DevicePathProtocol;\r
-  EFI_DEVICE_PATH*                  DevicePath;\r
+  EFI_STATUS                          Status;\r
+  UINTN                               HandleCount;\r
+  EFI_HANDLE                         *HandleBuffer;\r
+  UINTN                               DevicePathHandleCount;\r
+  EFI_HANDLE                         *DevicePathHandleBuffer;\r
+  BOOLEAN                             IsParent;\r
+  UINTN                               Index;\r
+  UINTN                               Index2;\r
+  BDS_SUPPORTED_DEVICE               *SupportedDevice;\r
+  EFI_DEVICE_PATH_PROTOCOL*           DevicePathProtocol;\r
+  EFI_DEVICE_PATH*                    DevicePath;\r
+  EFI_SIMPLE_FILE_SYSTEM_PROTOCOL    *FileProtocol;\r
+  EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *FvbProtocol;\r
 \r
   // List all the BlockIo Protocols\r
   Status = gBS->LocateHandleBuffer (ByProtocol, &gEfiBlockIoProtocolGuid, NULL, &HandleCount, &HandleBuffer);\r
@@ -549,7 +552,35 @@ BdsLoadOptionMemMapList (
   }\r
 \r
   for (Index = 0; Index < HandleCount; Index++) {\r
-    // We only select the handle WITH a Device Path AND not part of Media (to avoid duplication with HardDisk, CDROM, etc)\r
+    // We only select handles WITH a Device Path AND not part of Media (to\r
+    // avoid duplication with HardDisk, CDROM, etc). Skip handles used by\r
+    // Simple Filesystem or used for Variable Storage.\r
+\r
+\r
+    Status = gBS->HandleProtocol (HandleBuffer[Index],\r
+                                  &gEfiSimpleFileSystemProtocolGuid,\r
+                                  (VOID *)&FileProtocol);\r
+    if (!EFI_ERROR(Status)) {\r
+      // SimpleFilesystem supported on this handle, skip\r
+      continue;\r
+    }\r
+\r
+    Status = gBS->HandleProtocol (HandleBuffer[Index],\r
+                                  &gEfiFirmwareVolumeBlockProtocolGuid,\r
+                                  (VOID *)&FvbProtocol);\r
+    if (!EFI_ERROR(Status)) {\r
+      // Firmware Volme Block / Variable storage supported on this handle, skip\r
+      continue;\r
+    }\r
+\r
+    Status = gBS->HandleProtocol (HandleBuffer[Index],\r
+                                  &gEfiFirmwareVolumeBlock2ProtocolGuid,\r
+                                  (VOID *)&FvbProtocol);\r
+    if (!EFI_ERROR(Status)) {\r
+      // Firmware Volme Block / Variable storage supported on this handle, skip\r
+      continue;\r
+    }\r
+\r
     Status = gBS->HandleProtocol (HandleBuffer[Index], &gEfiDevicePathProtocolGuid, (VOID **)&DevicePathProtocol);\r
     if (!EFI_ERROR(Status)) {\r
       // BlockIo is not part of Media Device Path\r