FmpDevicePkg/FmpDxe: Add PcdFmpDeviceImageTypeIdGuid

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1525

Add PCD PcdFmpDeviceImageTypeIdGuid that contains an Image
Type ID GUID value that is used if one is not provided by
FmpDeviceLib. If this PCD is not a valid GUID value,  then
gEfiCallerIdGuid is used.

Update FmpDevicePkg DSC to use PcdFmpDeviceImageTypeIdGuid
as a PatchableInModule PCD.

This content is based on the following commit.

a2c7da88d3 (diff-025d4889f6d3a482b49638a25e432d6d)

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Michael Turner <Michael.Turner@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Eric Jin <eric.jin@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
Eric Jin
2019-07-26 15:40:37 +08:00
committed by Liming Gao
parent e0961677d1
commit 278c3d48a7
6 changed files with 52 additions and 6 deletions

View File

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

View File

@@ -68,6 +68,7 @@
gFmpDevicePkgTokenSpaceGuid.PcdFmpDeviceProgressColor ## CONSUMES
gFmpDevicePkgTokenSpaceGuid.PcdFmpDevicePkcs7CertBufferXdr ## CONSUMES
gFmpDevicePkgTokenSpaceGuid.PcdFmpDeviceTestKeySha256Digest ## CONSUMES
gFmpDevicePkgTokenSpaceGuid.PcdFmpDeviceImageTypeIdGuid ## CONSUMES
gEfiMdeModulePkgTokenSpaceGuid.PcdTestKeyUsed ## SOMETIMES_PRODUCES
[Depex]

View File

@@ -68,6 +68,7 @@
gFmpDevicePkgTokenSpaceGuid.PcdFmpDeviceProgressColor ## CONSUMES
gFmpDevicePkgTokenSpaceGuid.PcdFmpDevicePkcs7CertBufferXdr ## CONSUMES
gFmpDevicePkgTokenSpaceGuid.PcdFmpDeviceTestKeySha256Digest ## CONSUMES
gFmpDevicePkgTokenSpaceGuid.PcdFmpDeviceImageTypeIdGuid ## CONSUMES
gEfiMdeModulePkgTokenSpaceGuid.PcdTestKeyUsed ## SOMETIMES_PRODUCES
[Depex]