+ Do FSP initialization in Dispatch mode.\r
+\r
+ @retval FSP initialization status.\r
+**/\r
+EFI_STATUS\r
+FspsWrapperInitDispatchMode (\r
+ VOID\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+ EFI_PEI_FIRMWARE_VOLUME_INFO_MEASUREMENT_EXCLUDED_PPI *MeasurementExcludedFvPpi;\r
+ EFI_PEI_PPI_DESCRIPTOR *MeasurementExcludedPpiList;\r
+\r
+ MeasurementExcludedFvPpi = AllocatePool (sizeof (*MeasurementExcludedFvPpi));\r
+ ASSERT (MeasurementExcludedFvPpi != NULL);\r
+ MeasurementExcludedFvPpi->Count = 1;\r
+ MeasurementExcludedFvPpi->Fv[0].FvBase = PcdGet32 (PcdFspsBaseAddress);\r
+ MeasurementExcludedFvPpi->Fv[0].FvLength = ((EFI_FIRMWARE_VOLUME_HEADER *)(UINTN)PcdGet32 (PcdFspsBaseAddress))->FvLength;\r
+\r
+ MeasurementExcludedPpiList = AllocatePool (sizeof (*MeasurementExcludedPpiList));\r
+ ASSERT (MeasurementExcludedPpiList != NULL);\r
+ MeasurementExcludedPpiList->Flags = EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST;\r
+ MeasurementExcludedPpiList->Guid = &gEfiPeiFirmwareVolumeInfoMeasurementExcludedPpiGuid;\r
+ MeasurementExcludedPpiList->Ppi = MeasurementExcludedFvPpi;\r
+\r
+ Status = PeiServicesInstallPpi (MeasurementExcludedPpiList);\r
+ ASSERT_EFI_ERROR (Status);\r
+\r
+ //\r
+ // FSP-S Wrapper running in Dispatch mode and reports FSP-S FV to PEI dispatcher.\r
+ //\r
+ PeiServicesInstallFvInfoPpi (\r
+ NULL,\r
+ (VOID *)(UINTN)PcdGet32 (PcdFspsBaseAddress),\r
+ (UINT32)((EFI_FIRMWARE_VOLUME_HEADER *)(UINTN)PcdGet32 (PcdFspsBaseAddress))->FvLength,\r
+ NULL,\r
+ NULL\r
+ );\r
+ //\r
+ // Register EndOfPei Nofity to run post FSP-S process.\r
+ //\r
+ Status = PeiServicesNotifyPpi (&mFspsWrapperEndOfPeiNotifyDesc);\r
+ ASSERT_EFI_ERROR (Status);\r
+ return Status;\r
+}\r
+\r
+/**\r
+ This function is called after TCG installed PPI.\r
+\r
+ @param[in] PeiServices Pointer to PEI Services Table.\r
+ @param[in] NotifyDesc Pointer to the descriptor for the Notification event that\r
+ caused this function to execute.\r
+ @param[in] Ppi Pointer to the PPI data associated with this function.\r
+\r
+ @retval EFI_STATUS Always return EFI_SUCCESS\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+TcgPpiNotify (\r
+ IN EFI_PEI_SERVICES **PeiServices,\r
+ IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDesc,\r
+ IN VOID *Ppi\r
+ );\r
+\r
+EFI_PEI_NOTIFY_DESCRIPTOR mTcgPpiNotifyDesc = {\r
+ (EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),\r
+ &gEdkiiTcgPpiGuid,\r
+ TcgPpiNotify\r
+};\r
+\r
+/**\r
+ This function is called after TCG installed PPI.\r
+\r
+ @param[in] PeiServices Pointer to PEI Services Table.\r
+ @param[in] NotifyDesc Pointer to the descriptor for the Notification event that\r
+ caused this function to execute.\r
+ @param[in] Ppi Pointer to the PPI data associated with this function.\r
+\r
+ @retval EFI_STATUS Always return EFI_SUCCESS\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+TcgPpiNotify (\r
+ IN EFI_PEI_SERVICES **PeiServices,\r
+ IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDesc,\r
+ IN VOID *Ppi\r
+ )\r
+{\r
+ UINT32 FspMeasureMask;\r
+\r
+ DEBUG ((DEBUG_INFO, "TcgPpiNotify FSPS\n"));\r
+\r
+ FspMeasureMask = PcdGet32 (PcdFspMeasurementConfig);\r
+\r
+ if ((FspMeasureMask & FSP_MEASURE_FSPS) != 0) {\r
+ MeasureFspFirmwareBlob (\r
+ 0,\r
+ "FSPS",\r
+ PcdGet32 (PcdFspsBaseAddress),\r
+ (UINT32)((EFI_FIRMWARE_VOLUME_HEADER *)(UINTN)PcdGet32 (PcdFspsBaseAddress))->FvLength\r
+ );\r
+ }\r
+\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+/**\r
+ This is the entrypoint of PEIM.\r