/**\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
{\r
EFI_STATUS Status;\r
EFI_GUID *FmpDeviceLibGuid;\r
+ UINTN ImageTypeIdGuidSize;\r
\r
FmpDeviceLibGuid = NULL;\r
Status = FmpDeviceGetImageTypeIdGuidPtr (&FmpDeviceLibGuid);\r
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