]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/EsrtFmpDxe: Support multiple devices with 0 HardwareInstance
authordevel@edk2.groups.io <devel@edk2.groups.io>
Mon, 12 Dec 2022 19:27:26 +0000 (11:27 -0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Wed, 15 Feb 2023 01:52:59 +0000 (01:52 +0000)
Skip error check if HardwareInstance is 0 as this either means that
FmpVersion < 3 and not supported or,
"A zero means the FMP provider is not able to determine a
unique hardware instance number or a hardware instance number
is not needed." per UEFI specification.

As the FmpInstances are merged and HardwareInstance is not used
remove error check in this case.

Signed-off-by: Jeff Brasen <jbrasen@nvidia.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
MdeModulePkg/Universal/EsrtFmpDxe/EsrtFmp.c

index 4f47c55cce99cd5444af0d7b518549c2bd1d0af1..5bc627461dfcd421269481eaec92802cc75a623e 100644 (file)
@@ -153,16 +153,20 @@ CreateEsrtEntry (
 \r
   //\r
   // Check to see of FmpImageInfoBuf GUID/HardwareInstance is unique\r
+  // Skip if HardwareInstance is 0 as this is the case if FmpVersion < 3\r
+  // or the device can not create a unique ID per UEFI specification\r
   //\r
-  for (Index = 0; Index < *NumberOfDescriptors; Index++) {\r
-    if (CompareGuid (&HardwareInstances[Index].ImageTypeGuid, &FmpImageInfoBuf->ImageTypeId)) {\r
-      if (HardwareInstances[Index].HardwareInstance == FmpHardwareInstance) {\r
-        DEBUG ((DEBUG_ERROR, "EsrtFmpDxe: Duplicate firmware image descriptor with GUID %g HardwareInstance:0x%x\n", &FmpImageInfoBuf->ImageTypeId, FmpHardwareInstance));\r
-        ASSERT (\r
-          !CompareGuid (&HardwareInstances[Index].ImageTypeGuid, &FmpImageInfoBuf->ImageTypeId) ||\r
-          HardwareInstances[Index].HardwareInstance != FmpHardwareInstance\r
-          );\r
-        return EFI_UNSUPPORTED;\r
+  if (FmpHardwareInstance != 0) {\r
+    for (Index = 0; Index < *NumberOfDescriptors; Index++) {\r
+      if (CompareGuid (&HardwareInstances[Index].ImageTypeGuid, &FmpImageInfoBuf->ImageTypeId)) {\r
+        if (HardwareInstances[Index].HardwareInstance == FmpHardwareInstance) {\r
+          DEBUG ((DEBUG_ERROR, "EsrtFmpDxe: Duplicate firmware image descriptor with GUID %g HardwareInstance:0x%x\n", &FmpImageInfoBuf->ImageTypeId, FmpHardwareInstance));\r
+          ASSERT (\r
+            !CompareGuid (&HardwareInstances[Index].ImageTypeGuid, &FmpImageInfoBuf->ImageTypeId) ||\r
+            HardwareInstances[Index].HardwareInstance != FmpHardwareInstance\r
+            );\r
+          return EFI_UNSUPPORTED;\r
+        }\r
       }\r
     }\r
   }\r