public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH 0/2] FmpDevicePkg/FmpDxe: Change the default Image Type ID
@ 2019-03-22  2:22 Zhichao Gao
  2019-03-22  2:22 ` [PATCH 1/2] FmpDevicePkg/FmpDevucePkg.dec: Add a pcd Zhichao Gao
  2019-03-22  2:22 ` [PATCH 2/2] FmpDevicePkg/FmpDxe: Change the default Image Type ID Zhichao Gao
  0 siblings, 2 replies; 3+ messages in thread
From: Zhichao Gao @ 2019-03-22  2:22 UTC (permalink / raw)
  To: edk2-devel; +Cc: Liming Gao, Michael D Kinney

Add a pcd to provide a default image type ID for FmpDxe
driver instead of gEfiCallerIdGuid. If the pcd is not
initialized as a GUID type, then it will assert and
fall back to gEfiCallerIdGuid in function GetImageTypeIdGuid.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhichao Gao <zhichao.gao@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>

Zhichao Gao (2):
  FmpDevicePkg/FmpDevucePkg.dec: Add a pcd
  FmpDevicePkg/FmpDxe: Change the default Image Type ID

 FmpDevicePkg/FmpDevicePkg.dec     |  8 +++++++-
 FmpDevicePkg/FmpDxe/FmpDxe.c      | 26 ++++++++++++++++++--------
 FmpDevicePkg/FmpDxe/FmpDxe.inf    |  3 ++-
 FmpDevicePkg/FmpDxe/FmpDxeLib.inf |  3 ++-
 4 files changed, 29 insertions(+), 11 deletions(-)

-- 
2.16.2.windows.1



^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] FmpDevicePkg/FmpDevucePkg.dec: Add a pcd
  2019-03-22  2:22 [PATCH 0/2] FmpDevicePkg/FmpDxe: Change the default Image Type ID Zhichao Gao
@ 2019-03-22  2:22 ` Zhichao Gao
  2019-03-22  2:22 ` [PATCH 2/2] FmpDevicePkg/FmpDxe: Change the default Image Type ID Zhichao Gao
  1 sibling, 0 replies; 3+ messages in thread
From: Zhichao Gao @ 2019-03-22  2:22 UTC (permalink / raw)
  To: edk2-devel; +Cc: Liming Gao, Michael D Kinney

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

Add a pcd named PcdFmpDeviceImageDefaultTypeIdGuid. This is used
to provide a default Image Type Id for FmpDxe driver instead of
the gEfiCallerIdGuid.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhichao Gao <zhichao.gao@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
---
 FmpDevicePkg/FmpDevicePkg.dec | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/FmpDevicePkg/FmpDevicePkg.dec b/FmpDevicePkg/FmpDevicePkg.dec
index ad0730a532..e9261b7e7f 100644
--- a/FmpDevicePkg/FmpDevicePkg.dec
+++ b/FmpDevicePkg/FmpDevicePkg.dec
@@ -7,7 +7,7 @@
 # customized using libraries and PCDs.
 #
 # Copyright (c) 2016, Microsoft Corporation. All rights reserved.<BR>
-# Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
 #
 # Redistribution and use in source and binary forms, with or without
 # modification, are permitted provided that the following conditions are met:
@@ -121,5 +121,11 @@
   # @Prompt Firmware Device Lock Event GUID.
   gFmpDevicePkgTokenSpaceGuid.PcdFmpDeviceLockEventGuid|{0}|VOID*|0x4000000F
 
+  ## The default Image Type ID to use if none is specified by the FmpDeviceLib.
+  #  If this PCD is not a valid GUID value, the the FmpDxe driver will ASSERT
+  #  and fall back to the gEfiCallerIdGuid (FILE_GUID for the specific driver).
+  # @Prompt Firmware Device Default Image Type ID
+  gFmpDevicePkgTokenSpaceGuid.PcdFmpDeviceImageDefaultTypeIdGuid|{0}|VOID*|0x40000010
+
 [UserExtensions.TianoCore."ExtraFiles"]
   FmpDevicePkgExtra.uni
-- 
2.16.2.windows.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] FmpDevicePkg/FmpDxe: Change the default Image Type ID
  2019-03-22  2:22 [PATCH 0/2] FmpDevicePkg/FmpDxe: Change the default Image Type ID Zhichao Gao
  2019-03-22  2:22 ` [PATCH 1/2] FmpDevicePkg/FmpDevucePkg.dec: Add a pcd Zhichao Gao
@ 2019-03-22  2:22 ` Zhichao Gao
  1 sibling, 0 replies; 3+ messages in thread
From: Zhichao Gao @ 2019-03-22  2:22 UTC (permalink / raw)
  To: edk2-devel; +Cc: Liming Gao, Michael D Kinney

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

Change the default Image Type id from gEfiCallerIdGuid to
PcdFmpDeviceImageDefaultTypeIdGuid. If the pcd is not
initialized as a valid GUID value, the driver will ASSERT
and fall back to gEfiCallerIdGuid.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhichao Gao <zhichao.gao@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
---
 FmpDevicePkg/FmpDxe/FmpDxe.c      | 26 ++++++++++++++++++--------
 FmpDevicePkg/FmpDxe/FmpDxe.inf    |  3 ++-
 FmpDevicePkg/FmpDxe/FmpDxeLib.inf |  3 ++-
 3 files changed, 22 insertions(+), 10 deletions(-)

diff --git a/FmpDevicePkg/FmpDxe/FmpDxe.c b/FmpDevicePkg/FmpDxe/FmpDxe.c
index 57eac5ac14..5dee59e378 100644
--- a/FmpDevicePkg/FmpDxe/FmpDxe.c
+++ b/FmpDevicePkg/FmpDxe/FmpDxe.c
@@ -4,7 +4,7 @@
   information provided through PCDs and libraries.
 
   Copyright (c) 2016, Microsoft Corporation. All rights reserved.<BR>
-  Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
 
   Redistribution and use in source and binary forms, with or without
   modification, are permitted provided that the following conditions are met:
@@ -152,7 +152,10 @@ 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 PcdFmpDeviceImageDefaultTypeIdGuid is returned.
+
+  If the PcdFmpDeviceImageDefaultTypeIdGuid is not initialize as a EFI_GUID,
+  then ASSERT().
 
   @return  The ImageTypeId GUID
 
@@ -167,16 +170,23 @@ GetImageTypeIdGuid (
 
   FmpDeviceLibGuid = NULL;
   Status = FmpDeviceGetImageTypeIdGuidPtr (&FmpDeviceLibGuid);
-  if (EFI_ERROR (Status)) {
+
+  if (EFI_ERROR(Status) || FmpDeviceLibGuid == NULL) {
     if (Status != EFI_UNSUPPORTED) {
       DEBUG ((DEBUG_ERROR, "FmpDxe: FmpDeviceLib GetImageTypeIdGuidPtr() returned invalid error %r\n", Status));
     }
-    return &gEfiCallerIdGuid;
-  }
-  if (FmpDeviceLibGuid == NULL) {
-    DEBUG ((DEBUG_ERROR, "FmpDxe: FmpDeviceLib GetImageTypeIdGuidPtr() returned invalid GUID\n"));
-    return &gEfiCallerIdGuid;
+    if (FmpDeviceLibGuid == NULL) {
+      DEBUG ((DEBUG_ERROR, "FmpDxe: FmpDeviceLib GetImageTypeIdGuidPtr() returned invalid GUID\n"));
+    }
+    if (PcdGetSize (PcdFmpDeviceImageDefaultTypeIdGuid) == sizeof (EFI_GUID)) {
+      FmpDeviceLibGuid = (EFI_GUID *)PcdGetPtr (PcdFmpDeviceImageDefaultTypeIdGuid);
+    } else {
+      DEBUG ((DEBUG_ERROR, "FmpDxe %s: FmpDeviceLib did not return a GUID and PcdFmpDeviceImageDefaultTypeIdGuid is undefined\n", mImageIdName));
+      ASSERT (FALSE);
+      FmpDeviceLibGuid = &gEfiCallerIdGuid;
+    }
   }
+
   return FmpDeviceLibGuid;
 }
 
diff --git a/FmpDevicePkg/FmpDxe/FmpDxe.inf b/FmpDevicePkg/FmpDxe/FmpDxe.inf
index 228e53658a..52807ca2cb 100644
--- a/FmpDevicePkg/FmpDxe/FmpDxe.inf
+++ b/FmpDevicePkg/FmpDxe/FmpDxe.inf
@@ -4,7 +4,7 @@
 #  information provided through PCDs and libraries.
 #
 #  Copyright (c) 2016, Microsoft Corporation. All rights reserved.<BR>
-#  Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
 #
 #  Redistribution and use in source and binary forms, with or without
 #  modification, are permitted provided that the following conditions are met:
@@ -84,6 +84,7 @@
   gFmpDevicePkgTokenSpaceGuid.PcdFmpDevicePkcs7CertBufferXdr               ## CONSUMES
   gFmpDevicePkgTokenSpaceGuid.PcdFmpDeviceTestKeySha256Digest              ## CONSUMES
   gEfiMdeModulePkgTokenSpaceGuid.PcdTestKeyUsed                            ## SOMETIMES_PRODUCES
+  gFmpDevicePkgTokenSpaceGuid.PcdFmpDeviceImageDefaultTypeIdGuid           ## SOMETIMES_CONSUMES
 
 [Depex]
   gEfiVariableWriteArchProtocolGuid AND gEdkiiVariableLockProtocolGuid
diff --git a/FmpDevicePkg/FmpDxe/FmpDxeLib.inf b/FmpDevicePkg/FmpDxe/FmpDxeLib.inf
index 5484531155..57189a77d1 100644
--- a/FmpDevicePkg/FmpDxe/FmpDxeLib.inf
+++ b/FmpDevicePkg/FmpDxe/FmpDxeLib.inf
@@ -4,7 +4,7 @@
 #  information provided through PCDs and libraries.
 #
 #  Copyright (c) 2016, Microsoft Corporation. All rights reserved.<BR>
-#  Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
 #
 #  Redistribution and use in source and binary forms, with or without
 #  modification, are permitted provided that the following conditions are met:
@@ -84,6 +84,7 @@
   gFmpDevicePkgTokenSpaceGuid.PcdFmpDevicePkcs7CertBufferXdr               ## CONSUMES
   gFmpDevicePkgTokenSpaceGuid.PcdFmpDeviceTestKeySha256Digest              ## CONSUMES
   gEfiMdeModulePkgTokenSpaceGuid.PcdTestKeyUsed                            ## SOMETIMES_PRODUCES
+  gFmpDevicePkgTokenSpaceGuid.PcdFmpDeviceImageDefaultTypeIdGuid           ## SOMETIMES_CONSUMES
 
 [Depex]
   gEfiVariableWriteArchProtocolGuid AND gEdkiiVariableLockProtocolGuid
-- 
2.16.2.windows.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-03-22  2:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-22  2:22 [PATCH 0/2] FmpDevicePkg/FmpDxe: Change the default Image Type ID Zhichao Gao
2019-03-22  2:22 ` [PATCH 1/2] FmpDevicePkg/FmpDevucePkg.dec: Add a pcd Zhichao Gao
2019-03-22  2:22 ` [PATCH 2/2] FmpDevicePkg/FmpDxe: Change the default Image Type ID Zhichao Gao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox