24extern EFI_GUID gFspPerformanceDataGuid;
27 (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
28 &gEfiPciEnumerationCompleteProtocolGuid,
33 (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
34 &gEfiEventReadyToBootGuid,
39 (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
40 &gFspEventEndOfFirmwareGuid,
44UINT32 mFspNotifySequence[] = {
62 IN UINT32 NotificationCode
69 switch (NotificationCode) {
74 DEBUG ((DEBUG_INFO | DEBUG_INIT,
"FSP Post PCI Enumeration ...\n"));
82 DEBUG ((DEBUG_INFO| DEBUG_INIT,
"FSP Ready To Boot ...\n"));
90 DEBUG ((DEBUG_INFO| DEBUG_INIT,
"FSP End of Firmware ...\n"));
95 Status = EFI_INVALID_PARAMETER;
122 case EFI_INVALID_PARAMETER:
123 case EFI_UNSUPPORTED:
124 case EFI_DEVICE_ERROR:
127 DEBUG ((DEBUG_INFO | DEBUG_INIT,
"FspSiliconInitApi() Invalid Error - [Status: 0x%08X]\n", Status));
128 Status = EFI_DEVICE_ERROR;
137 DEBUG ((DEBUG_INFO | DEBUG_INIT,
"FspSiliconInitApi() - [Status: 0x%08X] - End\n", Status));
138 PERF_END_EX (&gFspPerformanceDataGuid,
"EventRec",
NULL, 0, FSP_STATUS_CODE_SILICON_INIT | FSP_STATUS_CODE_COMMON_CODE | FSP_STATUS_CODE_API_EXIT);
145 DEBUG ((DEBUG_ERROR,
"!!!ERROR: FspSiliconInitApi() - [Status: 0x%08X] - Error encountered during previous API and cannot proceed further\n", Status));
161 IN OUT VOID **HobListPtr
172 if (HobListPtr ==
NULL) {
176 if (HobListPtr !=
NULL) {
185 case EFI_INVALID_PARAMETER:
186 case EFI_UNSUPPORTED:
187 case EFI_DEVICE_ERROR:
188 case EFI_OUT_OF_RESOURCES:
191 DEBUG ((DEBUG_INFO | DEBUG_INIT,
"FspMemoryInitApi() Invalid Error [Status: 0x%08X]\n", Status));
192 Status = EFI_DEVICE_ERROR;
200 DEBUG ((DEBUG_INFO | DEBUG_INIT,
"FspMemoryInitApi() - [Status: 0x%08X] - End\n", Status));
203 PERF_START_EX (&gFspPerformanceDataGuid,
"EventRec",
NULL, (FspData->PerfData[0] & FSP_PERFORMANCE_DATA_TIMER_MASK), FSP_STATUS_CODE_TEMP_RAM_INIT | FSP_STATUS_CODE_COMMON_CODE| FSP_STATUS_CODE_API_ENTRY);
204 PERF_END_EX (&gFspPerformanceDataGuid,
"EventRec",
NULL, (FspData->PerfData[1] & FSP_PERFORMANCE_DATA_TIMER_MASK), FSP_STATUS_CODE_TEMP_RAM_INIT | FSP_STATUS_CODE_COMMON_CODE | FSP_STATUS_CODE_API_EXIT);
205 PERF_START_EX (&gFspPerformanceDataGuid,
"EventRec",
NULL, (FspData->PerfData[2] & FSP_PERFORMANCE_DATA_TIMER_MASK), FSP_STATUS_CODE_MEMORY_INIT | FSP_STATUS_CODE_COMMON_CODE | FSP_STATUS_CODE_API_ENTRY);
206 PERF_END_EX (&gFspPerformanceDataGuid,
"EventRec",
NULL, 0, FSP_STATUS_CODE_MEMORY_INIT | FSP_STATUS_CODE_COMMON_CODE | FSP_STATUS_CODE_API_EXIT);
213 DEBUG ((DEBUG_ERROR,
"!!!ERROR: FspMemoryInitApi() - [Status: 0x%08X] - Error encountered during previous API and cannot proceed further\n", Status));
224 PERF_START_EX (&gFspPerformanceDataGuid,
"EventRec",
NULL, 0, FSP_STATUS_CODE_TEMP_RAM_EXIT | FSP_STATUS_CODE_COMMON_CODE | FSP_STATUS_CODE_API_ENTRY);
226 DEBUG ((DEBUG_INFO | DEBUG_INIT,
"TempRamExitApi() - Begin\n"));
230 PERF_START_EX (&gFspPerformanceDataGuid,
"EventRec",
NULL, 0, FSP_STATUS_CODE_SILICON_INIT | FSP_STATUS_CODE_COMMON_CODE | FSP_STATUS_CODE_API_ENTRY);
232 DEBUG ((DEBUG_INFO | DEBUG_INIT,
"FspSiliconInitApi() - Begin\n"));
256 case EFI_INVALID_PARAMETER:
257 case EFI_UNSUPPORTED:
258 case EFI_DEVICE_ERROR:
261 DEBUG ((DEBUG_INFO | DEBUG_INIT,
"TempRamExitApi() Invalid Error - [Status: 0x%08X]\n", Status));
262 Status = EFI_DEVICE_ERROR;
270 DEBUG ((DEBUG_INFO | DEBUG_INIT,
"TempRamExitApi() - [Status: 0x%08X] - End\n", Status));
272 PERF_END_EX (&gFspPerformanceDataGuid,
"EventRec",
NULL, 0, FSP_STATUS_CODE_TEMP_RAM_EXIT | FSP_STATUS_CODE_COMMON_CODE | FSP_STATUS_CODE_API_EXIT);
279 DEBUG ((DEBUG_ERROR,
"!!!ERROR: TempRamExitApi() - [Status: 0x%08X] - Error encountered during previous API and cannot proceed further\n", Status));
286 PERF_START_EX (&gFspPerformanceDataGuid,
"EventRec",
NULL, 0, FSP_STATUS_CODE_SILICON_INIT | FSP_STATUS_CODE_COMMON_CODE | FSP_STATUS_CODE_API_ENTRY);
288 DEBUG ((DEBUG_INFO | DEBUG_INIT,
"SiliconInitApi() - Begin\n"));
305 UINT32 NotificationValue;
306 UINT32 NotificationCount;
310 NotificationCount = 0;
311 while (NotificationCount <
sizeof (mFspNotifySequence) /
sizeof (UINT32)) {
312 Count = (UINT8)((NotificationCount << 1) & 0x07);
315 if (NotificationCount == 0) {
317 PERF_START_EX (&gFspPerformanceDataGuid,
"EventRec",
NULL, 0, FSP_STATUS_CODE_POST_PCIE_ENUM_NOTIFICATION | FSP_STATUS_CODE_COMMON_CODE | FSP_STATUS_CODE_API_ENTRY);
319 }
else if (NotificationCount == 1) {
321 PERF_START_EX (&gFspPerformanceDataGuid,
"EventRec",
NULL, 0, FSP_STATUS_CODE_READY_TO_BOOT_NOTIFICATION | FSP_STATUS_CODE_COMMON_CODE | FSP_STATUS_CODE_API_ENTRY);
323 }
else if (NotificationCount == 2) {
325 PERF_START_EX (&gFspPerformanceDataGuid,
"EventRec",
NULL, 0, FSP_STATUS_CODE_END_OF_FIRMWARE_NOTIFICATION | FSP_STATUS_CODE_COMMON_CODE | FSP_STATUS_CODE_API_ENTRY);
330 DEBUG ((DEBUG_INFO | DEBUG_INIT,
"NotifyPhaseApi() - Begin [Phase: %08X]\n", NotificationValue));
331 if (mFspNotifySequence[NotificationCount] != NotificationValue) {
335 DEBUG ((DEBUG_INFO,
"Unsupported FSP Notification Value\n"));
336 Status = EFI_UNSUPPORTED;
342 if (!EFI_ERROR (Status)) {
347 DEBUG ((DEBUG_INFO | DEBUG_INIT,
"NotifyPhaseApi() - End [Status: 0x%08X]\n", Status));
350 if ((NotificationCount - 1) == 0) {
351 PERF_END_EX (&gFspPerformanceDataGuid,
"EventRec",
NULL, 0, FSP_STATUS_CODE_POST_PCIE_ENUM_NOTIFICATION | FSP_STATUS_CODE_COMMON_CODE | FSP_STATUS_CODE_API_EXIT);
353 }
else if ((NotificationCount - 1) == 1) {
354 PERF_END_EX (&gFspPerformanceDataGuid,
"EventRec",
NULL, 0, FSP_STATUS_CODE_READY_TO_BOOT_NOTIFICATION | FSP_STATUS_CODE_COMMON_CODE | FSP_STATUS_CODE_API_EXIT);
356 }
else if ((NotificationCount - 1) == 2) {
357 PERF_END_EX (&gFspPerformanceDataGuid,
"EventRec",
NULL, 0, FSP_STATUS_CODE_END_OF_FIRMWARE_NOTIFICATION | FSP_STATUS_CODE_COMMON_CODE | FSP_STATUS_CODE_API_EXIT);
367 DEBUG ((DEBUG_ERROR,
"!!!ERROR: NotifyPhaseApi() [Phase: %08X] - Failed - [Status: 0x%08X]\n", NotificationValue, Status));
400 IN OUT VOID **HobListPtr
VOID *EFIAPI GetHobList(VOID)
EFI_STATUS EFIAPI PeiServicesInstallPpi(IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList)
@ EnumInitPhaseAfterPciEnumeration
@ EnumInitPhaseReadyToBoot
@ EnumInitPhaseEndOfFirmware
VOID EFIAPI SetFspApiReturnStatus(IN UINTN ReturnStatus)
FSP_GLOBAL_DATA *EFIAPI GetFspGlobalDataPointer(VOID)
UINT8 EFIAPI GetFspApiCallingIndex(VOID)
UINTN EFIAPI GetFspApiParameter2(VOID)
UINTN EFIAPI GetFspApiParameter(VOID)
UINT64 EFIAPI SetFspMeasurePoint(IN UINT8 Id)
VOID EFIAPI SetPhaseStatusCode(UINT32 StatusCode)
EFI_STATUS EFIAPI Pei2LoaderSwitchStack(VOID)
#define DEBUG(Expression)
#define REPORT_STATUS_CODE(Type, Value)
#define EFI_PROGRESS_CODE