REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1245
In current implementation and according to the description in MdeModulePkg.dec, PcdSetNvStoreDefaultId should be set in PEI phase to take effect. This patch ASSERTs PcdSetNvStoreDefaultId set in PcdDxe to alert the invalid operation. Cc: Liming Gao <liming....@intel.com> Cc: Jiewen Yao <jiewen....@intel.com> Cc: Jian J Wang <jian.j.w...@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Star Zeng <star.z...@intel.com> --- MdeModulePkg/Universal/PCD/Dxe/Pcd.c | 5 +++++ MdeModulePkg/Universal/PCD/Dxe/Pcd.inf | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/MdeModulePkg/Universal/PCD/Dxe/Pcd.c b/MdeModulePkg/Universal/PCD/Dxe/Pcd.c index bc308af1c5d8..f977c7f18e19 100644 --- a/MdeModulePkg/Universal/PCD/Dxe/Pcd.c +++ b/MdeModulePkg/Universal/PCD/Dxe/Pcd.c @@ -890,6 +890,11 @@ DxePcdSet16Ex ( IN UINT16 Value ) { + // + // PcdSetNvStoreDefaultId should be set in PEI phase to take effect. + // + ASSERT (!(CompareGuid (Guid, &gEfiMdeModulePkgTokenSpaceGuid) && + (ExTokenNumber == PcdToken(PcdSetNvStoreDefaultId)))); return ExSetValueWorker (ExTokenNumber, Guid, &Value, sizeof (Value)); } diff --git a/MdeModulePkg/Universal/PCD/Dxe/Pcd.inf b/MdeModulePkg/Universal/PCD/Dxe/Pcd.inf index 066b86aaa5f3..1f41a316bd89 100644 --- a/MdeModulePkg/Universal/PCD/Dxe/Pcd.inf +++ b/MdeModulePkg/Universal/PCD/Dxe/Pcd.inf @@ -331,6 +331,7 @@ [LibraryClasses] [Guids] gPcdDataBaseHobGuid ## SOMETIMES_CONSUMES ## HOB gPcdDataBaseSignatureGuid ## CONSUMES ## GUID # PCD database signature GUID. + gEfiMdeModulePkgTokenSpaceGuid ## SOMETIMES_CONSUMES ## GUID [Protocols] gPcdProtocolGuid ## PRODUCES @@ -342,7 +343,8 @@ [Protocols] gEdkiiVariableLockProtocolGuid [Pcd] - gEfiMdeModulePkgTokenSpaceGuid.PcdVpdBaseAddress ## SOMETIMES_CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdVpdBaseAddress ## SOMETIMES_CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdSetNvStoreDefaultId ## SOMETIMES_CONSUMES [Depex] TRUE -- 2.7.0.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel