summaryrefslogtreecommitdiffstats
path: root/FmpDevicePkg/FmpDxe/FmpDxe.c
diff options
context:
space:
mode:
authorEric Jin <eric.jin@intel.com>2019-07-26 15:40:37 +0800
committerLiming Gao <liming.gao@intel.com>2019-08-15 17:22:24 +0800
commit278c3d48a7535a2c4aee01f8381ee56b13258c51 (patch)
tree388b81199ac2edf30d2137ebf60ac313f005b34f /FmpDevicePkg/FmpDxe/FmpDxe.c
parente0961677d1b226c11fc39de4df2c2ecd0e7b9adc (diff)
downloadedk2-278c3d48a7535a2c4aee01f8381ee56b13258c51.tar.gz
edk2-278c3d48a7535a2c4aee01f8381ee56b13258c51.tar.bz2
edk2-278c3d48a7535a2c4aee01f8381ee56b13258c51.zip
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. https://github.com/microsoft/mu_tiano_plus/commit/a2c7da88d3a73dbe9b6b75952d6866179c905f28#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>
Diffstat (limited to 'FmpDevicePkg/FmpDxe/FmpDxe.c')
-rw-r--r--FmpDevicePkg/FmpDxe/FmpDxe.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/FmpDevicePkg/FmpDxe/FmpDxe.c b/FmpDevicePkg/FmpDxe/FmpDxe.c
index 3cda86f6c4..a53ded7380 100644
--- a/FmpDevicePkg/FmpDxe/FmpDxe.c
+++ b/FmpDevicePkg/FmpDxe/FmpDxe.c
@@ -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;
}