]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EdkModulePkg/Universal/PCD/Dxe/Service.c
Make sure the PCD dxe service driver can handle the case where no PEIM is using any...
[mirror_edk2.git] / EdkModulePkg / Universal / PCD / Dxe / Service.c
index e1aded74f99cbed9993d58152675f07fc07f062b..bccd0a600add0835167fa97e99b252cde748d060 100644 (file)
@@ -282,13 +282,24 @@ BuildPcdDxeDataBase (
   ASSERT (mPcdDatabase != NULL);\r
 \r
   GuidHob = GetFirstGuidHob (&gPcdDataBaseHobGuid);\r
-  ASSERT (GuidHob != NULL);\r
 \r
-  PeiDatabase = (PEI_PCD_DATABASE *) GET_GUID_HOB_DATA (GuidHob);\r
-  //\r
-  // Copy PCD Entries refereneced in PEI phase to PCD DATABASE\r
-  //\r
-  CopyMem (&mPcdDatabase->PeiDb, PeiDatabase, sizeof (PEI_PCD_DATABASE));\r
+  if (GuidHob != NULL) {\r
+\r
+    //\r
+    // We will copy over the PEI phase's PCD Database.\r
+    // \r
+    // If no PEIMs use dynamic Pcd Entry, the Pcd Service PEIM\r
+    // should not be included at all. So the GuidHob could\r
+    // be NULL. If it is NULL, we just copy over the DXE Default\r
+    // Value to PCD Database.\r
+    //\r
+    \r
+    PeiDatabase = (PEI_PCD_DATABASE *) GET_GUID_HOB_DATA (GuidHob);\r
+    //\r
+    // Copy PCD Entries refereneced in PEI phase to PCD DATABASE\r
+    //\r
+    CopyMem (&mPcdDatabase->PeiDb, PeiDatabase, sizeof (PEI_PCD_DATABASE));\r
+  }\r
 \r
   //\r
   // Copy PCD Entries with default value to PCD DATABASE\r