+/**\r
+ Report Pei PCD database of all SKUs as Guid HOB so that DxePcd can access it.\r
+\r
+ @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation\r
+ @param NotifyDescriptor Address of the notification descriptor data structure.\r
+ @param Ppi Address of the PPI that was installed.\r
+\r
+ @retval EFI_SUCCESS Successfully update the Boot records.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+EndOfPeiSignalPpiNotifyCallback (\r
+ IN EFI_PEI_SERVICES **PeiServices,\r
+ IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,\r
+ IN VOID *Ppi\r
+ )\r
+{\r
+ PEI_PCD_DATABASE *Database;\r
+ EFI_BOOT_MODE BootMode;\r
+ EFI_STATUS Status;\r
+ UINTN Instance;\r
+ EFI_PEI_FV_HANDLE VolumeHandle;\r
+ EFI_PEI_FILE_HANDLE FileHandle;\r
+ VOID *PcdDb;\r
+ UINT32 Length;\r
+ PEI_PCD_DATABASE *PeiPcdDb;\r
+\r
+ Status = PeiServicesGetBootMode(&BootMode);\r
+ ASSERT_EFI_ERROR (Status);\r
+\r
+ //\r
+ // Don't need to report it on S3 boot.\r
+ //\r
+ if (BootMode == BOOT_ON_S3_RESUME) {\r
+ return EFI_SUCCESS;\r
+ }\r
+\r
+ PeiPcdDb = GetPcdDatabase();\r
+ if (PeiPcdDb->SystemSkuId != (SKU_ID) 0) {\r
+ //\r
+ // SkuId has been set. Don't need to report it to DXE phase.\r
+ //\r
+ return EFI_SUCCESS;\r
+ }\r
+\r
+ //\r
+ // Get full PCD database from PcdPeim FileHandle\r
+ //\r
+ Instance = 0;\r
+ FileHandle = NULL;\r
+ while (TRUE) {\r
+ //\r
+ // Traverse all firmware volume instances\r
+ //\r
+ Status = PeiServicesFfsFindNextVolume (Instance, &VolumeHandle);\r
+ //\r
+ // Error should not happen\r
+ //\r
+ ASSERT_EFI_ERROR (Status);\r
+\r
+ //\r
+ // Find PcdDb file from the beginning in this firmware volume.\r
+ //\r
+ FileHandle = NULL;\r
+ Status = PeiServicesFfsFindFileByName (&gEfiCallerIdGuid, VolumeHandle, &FileHandle);\r
+ if (!EFI_ERROR (Status)) {\r
+ //\r
+ // Find PcdPeim FileHandle in this volume\r
+ //\r
+ break;\r
+ }\r
+ //\r
+ // We cannot find PcdPeim in this firmware volume, then search the next volume.\r
+ //\r
+ Instance++;\r
+ }\r
+\r
+ //\r
+ // Find PEI PcdDb and Build second PcdDB GuidHob\r
+ //\r
+ Status = PeiServicesFfsFindSectionData (EFI_SECTION_RAW, FileHandle, &PcdDb);\r
+ ASSERT_EFI_ERROR (Status);\r
+ Length = PeiPcdDb->LengthForAllSkus;\r
+ Database = BuildGuidHob (&gPcdDataBaseHobGuid, Length);\r
+ CopyMem (Database, PcdDb, Length);\r
+\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+EFI_PEI_NOTIFY_DESCRIPTOR mEndOfPeiSignalPpiNotifyList[] = {\r
+ {\r
+ (EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),\r
+ &gEfiEndOfPeiSignalPpiGuid,\r
+ EndOfPeiSignalPpiNotifyCallback\r
+ }\r
+};\r
+\r