- 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