]> git.proxmox.com Git - mirror_edk2.git/blobdiff - FmpDevicePkg/FmpDxe/FmpDxe.c
FmpDevicePkg/FmpDxe: Add PcdFmpDeviceImageTypeIdGuid
[mirror_edk2.git] / FmpDevicePkg / FmpDxe / FmpDxe.c
index 3cda86f6c46cca73b49b9d4e4f605437f94749a3..a53ded73807277cd5a4887125b8968bddcececba 100644 (file)
@@ -147,7 +147,9 @@ FmpDxeProgress (
 /**\r
   Returns a pointer to the ImageTypeId GUID value.  An attempt is made to get\r
   the GUID value from the FmpDeviceLib. If the FmpDeviceLib does not provide\r
-  a GUID value, then gEfiCallerIdGuid is returned.\r
+  a GUID value, then PcdFmpDeviceImageTypeIdGuid is used.  If the size of\r
+  PcdFmpDeviceImageTypeIdGuid is not the size of EFI_GUID, then gEfiCallerIdGuid\r
+  is returned.\r
 \r
   @retval  The ImageTypeId GUID\r
 \r
@@ -159,6 +161,7 @@ GetImageTypeIdGuid (
 {\r
   EFI_STATUS  Status;\r
   EFI_GUID    *FmpDeviceLibGuid;\r
+  UINTN       ImageTypeIdGuidSize;\r
 \r
   FmpDeviceLibGuid = NULL;\r
   Status = FmpDeviceGetImageTypeIdGuidPtr (&FmpDeviceLibGuid);\r
@@ -166,11 +169,18 @@ GetImageTypeIdGuid (
     if (Status != EFI_UNSUPPORTED) {\r
       DEBUG ((DEBUG_ERROR, "FmpDxe(%s): FmpDeviceLib GetImageTypeIdGuidPtr() returned invalid error %r\n", mImageIdName, Status));\r
     }\r
-    return &gEfiCallerIdGuid;\r
-  }\r
-  if (FmpDeviceLibGuid == NULL) {\r
+  } else if (FmpDeviceLibGuid == NULL) {\r
     DEBUG ((DEBUG_ERROR, "FmpDxe(%s): FmpDeviceLib GetImageTypeIdGuidPtr() returned invalid GUID\n", mImageIdName));\r
-    return &gEfiCallerIdGuid;\r
+    Status = EFI_NOT_FOUND;\r
+  }\r
+  if (EFI_ERROR (Status)) {\r
+    ImageTypeIdGuidSize = PcdGetSize (PcdFmpDeviceImageTypeIdGuid);\r
+    if (ImageTypeIdGuidSize == sizeof (EFI_GUID)) {\r
+      FmpDeviceLibGuid = (EFI_GUID *)PcdGetPtr (PcdFmpDeviceImageTypeIdGuid);\r
+    } else {\r
+      DEBUG ((DEBUG_INFO, "FmpDxe(%s): Fall back to ImageTypeIdGuid of gEfiCallerIdGuid\n", mImageIdName));\r
+      FmpDeviceLibGuid = &gEfiCallerIdGuid;\r
+    }\r
   }\r
   return FmpDeviceLibGuid;\r
 }\r