]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPlatformPkg/Bds: Reduce boot device entries
authorHarry Liebel <Harry.Liebel@arm.com>
Fri, 10 Oct 2014 10:39:36 +0000 (10:39 +0000)
committeroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 10 Oct 2014 10:39:36 +0000 (10:39 +0000)
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 <Harry.Liebel@arm.com>
Reviewed-By: Olivier Martin <olivier.martin@arm.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16203 6f19259b-4bc3-4df7-8a09-765794883524

ArmPlatformPkg/Bds/Bds.inf
ArmPlatformPkg/Bds/BootOptionSupport.c

index a3efb6f4ab9cff8a38dab48f3ef0d083291b74c1..5a2f86bf8c916ab4dcbaf218ae6b327c479899c7 100644 (file)
@@ -61,6 +61,8 @@
   gEfiPxeBaseCodeProtocolGuid\r
   gEfiSimpleNetworkProtocolGuid\r
   gEfiDevicePathToTextProtocolGuid\r
+  gEfiFirmwareVolumeBlockProtocolGuid\r
+  gEfiFirmwareVolumeBlock2ProtocolGuid\r
 \r
 [Pcd]\r
   gArmPlatformTokenSpaceGuid.PcdFirmwareVendor\r
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