As per FSP 2.0 spec, FSP shall not trigger system reset and instead it
shall return from the FSP API to the BL/Wrapper with the required reset
type. The changes are to handle the ResetRequired return code from FSP
APIs and provide lib interface for platform to trigger the actual reset.
Cc: Giri P Mudusuru <giri.p.mudusuru@intel.com>
Cc: Amy Chan <amy.chan@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Satya Yarlagadda <satya.p.yarlagadda@intel.com>
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Giri P Mudusuru <giri.p.mudusuru@intel.com>
#include <Library/BaseMemoryLib.h>\r
#include <Library/UefiLib.h>\r
#include <Library/FspWrapperApiLib.h>\r
#include <Library/BaseMemoryLib.h>\r
#include <Library/UefiLib.h>\r
#include <Library/FspWrapperApiLib.h>\r
+#include <Library/FspWrapperPlatformLib.h>\r
#include <Library/PerformanceLib.h>\r
#include <Library/HobLib.h>\r
\r
#include <Library/PerformanceLib.h>\r
#include <Library/HobLib.h>\r
\r
PERF_START_EX(&gFspApiPerformanceGuid, "EventRec", NULL, 0, 0x6000);\r
Status = CallFspNotifyPhase (&NotifyPhaseParams);\r
PERF_END_EX(&gFspApiPerformanceGuid, "EventRec", NULL, 0, 0x607F);\r
PERF_START_EX(&gFspApiPerformanceGuid, "EventRec", NULL, 0, 0x6000);\r
Status = CallFspNotifyPhase (&NotifyPhaseParams);\r
PERF_END_EX(&gFspApiPerformanceGuid, "EventRec", NULL, 0, 0x607F);\r
+\r
+ //\r
+ // Reset the system if FSP API returned FSP_STATUS_RESET_REQUIRED status\r
+ //\r
+ if ((Status >= FSP_STATUS_RESET_REQUIRED_COLD) && (Status <= FSP_STATUS_RESET_REQUIRED_8)) {\r
+ DEBUG((DEBUG_INFO, "FSP NotifyPhase AfterPciEnumeration requested reset 0x%x\n", Status));\r
+ CallFspWrapperResetSystem ((UINT32)Status);\r
+ }\r
+\r
if (Status != EFI_SUCCESS) {\r
DEBUG((DEBUG_ERROR, "FSP NotifyPhase AfterPciEnumeration failed, status: 0x%x\n", Status));\r
} else {\r
if (Status != EFI_SUCCESS) {\r
DEBUG((DEBUG_ERROR, "FSP NotifyPhase AfterPciEnumeration failed, status: 0x%x\n", Status));\r
} else {\r
PERF_START_EX(&gFspApiPerformanceGuid, "EventRec", NULL, 0, 0x4000);\r
Status = CallFspNotifyPhase (&NotifyPhaseParams);\r
PERF_END_EX(&gFspApiPerformanceGuid, "EventRec", NULL, 0, 0x407F);\r
PERF_START_EX(&gFspApiPerformanceGuid, "EventRec", NULL, 0, 0x4000);\r
Status = CallFspNotifyPhase (&NotifyPhaseParams);\r
PERF_END_EX(&gFspApiPerformanceGuid, "EventRec", NULL, 0, 0x407F);\r
+\r
+ //\r
+ // Reset the system if FSP API returned FSP_STATUS_RESET_REQUIRED status\r
+ //\r
+ if ((Status >= FSP_STATUS_RESET_REQUIRED_COLD) && (Status <= FSP_STATUS_RESET_REQUIRED_8)) {\r
+ DEBUG((DEBUG_INFO, "FSP NotifyPhase ReadyToBoot requested reset 0x%x\n", Status));\r
+ CallFspWrapperResetSystem ((UINT32)Status);\r
+ }\r
+\r
if (Status != EFI_SUCCESS) {\r
DEBUG((DEBUG_ERROR, "FSP NotifyPhase ReadyToBoot failed, status: 0x%x\n", Status));\r
} else {\r
if (Status != EFI_SUCCESS) {\r
DEBUG((DEBUG_ERROR, "FSP NotifyPhase ReadyToBoot failed, status: 0x%x\n", Status));\r
} else {\r
PERF_START_EX(&gFspApiPerformanceGuid, "EventRec", NULL, 0, 0x2000);\r
Status = CallFspNotifyPhase (&NotifyPhaseParams);\r
PERF_END_EX(&gFspApiPerformanceGuid, "EventRec", NULL, 0, 0x207F);\r
PERF_START_EX(&gFspApiPerformanceGuid, "EventRec", NULL, 0, 0x2000);\r
Status = CallFspNotifyPhase (&NotifyPhaseParams);\r
PERF_END_EX(&gFspApiPerformanceGuid, "EventRec", NULL, 0, 0x207F);\r
+\r
+ //\r
+ // Reset the system if FSP API returned FSP_STATUS_RESET_REQUIRED status\r
+ //\r
+ if ((Status >= FSP_STATUS_RESET_REQUIRED_COLD) && (Status <= FSP_STATUS_RESET_REQUIRED_8)) {\r
+ DEBUG((DEBUG_INFO, "FSP NotifyPhase EndOfFirmware requested reset 0x%x\n", Status));\r
+ CallFspWrapperResetSystem ((UINT32)Status);\r
+ }\r
+\r
if (Status != EFI_SUCCESS) {\r
DEBUG((DEBUG_ERROR, "FSP NotifyPhase EndOfFirmware failed, status: 0x%x\n", Status));\r
} else {\r
if (Status != EFI_SUCCESS) {\r
DEBUG((DEBUG_ERROR, "FSP NotifyPhase EndOfFirmware failed, status: 0x%x\n", Status));\r
} else {\r
DxeServicesLib\r
PerformanceLib\r
HobLib\r
DxeServicesLib\r
PerformanceLib\r
HobLib\r
+ FspWrapperPlatformLib\r
\r
[Protocols]\r
gEfiPciEnumerationCompleteProtocolGuid ## CONSUMES\r
\r
[Protocols]\r
gEfiPciEnumerationCompleteProtocolGuid ## CONSUMES\r
PERF_START_EX(&gFspApiPerformanceGuid, "EventRec", NULL, TimeStampCounterStart, 0xD000);\r
PERF_END_EX(&gFspApiPerformanceGuid, "EventRec", NULL, 0, 0xD07F);\r
DEBUG ((DEBUG_INFO, "Total time spent executing FspMemoryInitApi: %d millisecond\n", DivU64x32 (GetTimeInNanoSecond (AsmReadTsc () - TimeStampCounterStart), 1000000)));\r
PERF_START_EX(&gFspApiPerformanceGuid, "EventRec", NULL, TimeStampCounterStart, 0xD000);\r
PERF_END_EX(&gFspApiPerformanceGuid, "EventRec", NULL, 0, 0xD07F);\r
DEBUG ((DEBUG_INFO, "Total time spent executing FspMemoryInitApi: %d millisecond\n", DivU64x32 (GetTimeInNanoSecond (AsmReadTsc () - TimeStampCounterStart), 1000000)));\r
+\r
+ //\r
+ // Reset the system if FSP API returned FSP_STATUS_RESET_REQUIRED status\r
+ //\r
+ if ((Status >= FSP_STATUS_RESET_REQUIRED_COLD) && (Status <= FSP_STATUS_RESET_REQUIRED_8)) {\r
+ DEBUG((DEBUG_INFO, "FspMemoryInitApi requested reset 0x%x\n", Status));\r
+ CallFspWrapperResetSystem ((UINT32)Status);\r
+ }\r
+\r
if (EFI_ERROR(Status)) {\r
DEBUG ((DEBUG_ERROR, "ERROR - Failed to execute FspMemoryInitApi(), Status = %r\n", Status));\r
}\r
if (EFI_ERROR(Status)) {\r
DEBUG ((DEBUG_ERROR, "ERROR - Failed to execute FspMemoryInitApi(), Status = %r\n", Status));\r
}\r
Status = CallFspNotifyPhase (&NotifyPhaseParams);\r
DEBUG((DEBUG_INFO, "FSP S3NotifyPhase AfterPciEnumeration status: 0x%x\n", Status));\r
\r
Status = CallFspNotifyPhase (&NotifyPhaseParams);\r
DEBUG((DEBUG_INFO, "FSP S3NotifyPhase AfterPciEnumeration status: 0x%x\n", Status));\r
\r
+ //\r
+ // Reset the system if FSP API returned FSP_STATUS_RESET_REQUIRED status\r
+ //\r
+ if ((Status >= FSP_STATUS_RESET_REQUIRED_COLD) && (Status <= FSP_STATUS_RESET_REQUIRED_8)) {\r
+ DEBUG((DEBUG_INFO, "FSP S3NotifyPhase AfterPciEnumeration requested reset 0x%x\n", Status));\r
+ CallFspWrapperResetSystem ((UINT32)Status);\r
+ }\r
+\r
NotifyPhaseParams.Phase = EnumInitPhaseReadyToBoot;\r
Status = CallFspNotifyPhase (&NotifyPhaseParams);\r
DEBUG((DEBUG_INFO, "FSP S3NotifyPhase ReadyToBoot status: 0x%x\n", Status));\r
\r
NotifyPhaseParams.Phase = EnumInitPhaseReadyToBoot;\r
Status = CallFspNotifyPhase (&NotifyPhaseParams);\r
DEBUG((DEBUG_INFO, "FSP S3NotifyPhase ReadyToBoot status: 0x%x\n", Status));\r
\r
+ //\r
+ // Reset the system if FSP API returned FSP_STATUS_RESET_REQUIRED status\r
+ //\r
+ if ((Status >= FSP_STATUS_RESET_REQUIRED_COLD) && (Status <= FSP_STATUS_RESET_REQUIRED_8)) {\r
+ DEBUG((DEBUG_INFO, "FSP S3NotifyPhase ReadyToBoot requested reset 0x%x\n", Status));\r
+ CallFspWrapperResetSystem ((UINT32)Status);\r
+ }\r
+\r
NotifyPhaseParams.Phase = EnumInitPhaseEndOfFirmware;\r
Status = CallFspNotifyPhase (&NotifyPhaseParams);\r
DEBUG((DEBUG_INFO, "FSP S3NotifyPhase EndOfFirmware status: 0x%x\n", Status));\r
\r
NotifyPhaseParams.Phase = EnumInitPhaseEndOfFirmware;\r
Status = CallFspNotifyPhase (&NotifyPhaseParams);\r
DEBUG((DEBUG_INFO, "FSP S3NotifyPhase EndOfFirmware status: 0x%x\n", Status));\r
\r
+ //\r
+ // Reset the system if FSP API returned FSP_STATUS_RESET_REQUIRED status\r
+ //\r
+ if ((Status >= FSP_STATUS_RESET_REQUIRED_COLD) && (Status <= FSP_STATUS_RESET_REQUIRED_8)) {\r
+ DEBUG((DEBUG_INFO, "FSP S3NotifyPhase EndOfFirmware requested reset 0x%x\n", Status));\r
+ CallFspWrapperResetSystem ((UINT32)Status);\r
+ }\r
+\r
return EFI_SUCCESS;\r
}\r
\r
return EFI_SUCCESS;\r
}\r
\r
Status = CallFspSiliconInit ((VOID *)FspsUpdDataPtr);\r
PERF_END_EX(&gFspApiPerformanceGuid, "EventRec", NULL, 0, 0x907F);\r
DEBUG ((DEBUG_INFO, "Total time spent executing FspSiliconInitApi: %d millisecond\n", DivU64x32 (GetTimeInNanoSecond (AsmReadTsc () - TimeStampCounterStart), 1000000)));\r
Status = CallFspSiliconInit ((VOID *)FspsUpdDataPtr);\r
PERF_END_EX(&gFspApiPerformanceGuid, "EventRec", NULL, 0, 0x907F);\r
DEBUG ((DEBUG_INFO, "Total time spent executing FspSiliconInitApi: %d millisecond\n", DivU64x32 (GetTimeInNanoSecond (AsmReadTsc () - TimeStampCounterStart), 1000000)));\r
+\r
+ //\r
+ // Reset the system if FSP API returned FSP_STATUS_RESET_REQUIRED status\r
+ //\r
+ if ((Status >= FSP_STATUS_RESET_REQUIRED_COLD) && (Status <= FSP_STATUS_RESET_REQUIRED_8)) {\r
+ DEBUG((DEBUG_INFO, "FspSiliconInitApi requested reset 0x%x\n", Status));\r
+ CallFspWrapperResetSystem ((UINT32)Status);\r
+ }\r
+\r
if (EFI_ERROR(Status)) {\r
DEBUG ((DEBUG_ERROR, "ERROR - Failed to execute FspSiliconInitApi(), Status = %r\n", Status));\r
}\r
if (EFI_ERROR(Status)) {\r
DEBUG ((DEBUG_ERROR, "ERROR - Failed to execute FspSiliconInitApi(), Status = %r\n", Status));\r
}\r
OUT EFI_PHYSICAL_ADDRESS *S3PeiMemBase\r
);\r
\r
OUT EFI_PHYSICAL_ADDRESS *S3PeiMemBase\r
);\r
\r
+/**\r
+ Perform platform related reset in FSP wrapper.\r
+\r
+ This function will reset the system with requested ResetType.\r
+\r
+ @param[in] FspStatusResetType The type of reset the platform has to perform.\r
+**/\r
+VOID\r
+EFIAPI\r
+CallFspWrapperResetSystem (\r
+ IN UINT32 FspStatusResetType\r
+ );\r
+\r
)\r
{\r
return EFI_UNSUPPORTED;\r
)\r
{\r
return EFI_UNSUPPORTED;\r
-}
\ No newline at end of file
+}\r
+\r
+/**\r
+ Perform platform related reset in FSP wrapper.\r
+\r
+ This function will reset the system with requested ResetType.\r
+\r
+ @param[in] FspStatusResetType The type of reset the platform has to perform.\r
+**/\r
+VOID\r
+EFIAPI\r
+CallFspWrapperResetSystem (\r
+ IN UINT32 FspStatusResetType\r
+ )\r
+{\r
+ //\r
+ // Perform reset according to the type.\r
+ //\r
+\r
+ CpuDeadLoop();\r
+}\r