]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFsp2WrapperPkg/FspsWrapperPeim/FspsWrapperPeim.c
IntelFsp2WrapperPkg: Add support to handle ResetRequired return Status from FSP.
[mirror_edk2.git] / IntelFsp2WrapperPkg / FspsWrapperPeim / FspsWrapperPeim.c
index 9bc720fe2d406afa8ce4aab7a2c197b0e673ea64..7a65ad7f6138d1265615d3778663b9d808a2bad0 100644 (file)
@@ -94,14 +94,38 @@ S3EndOfPeiNotify(
   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
+  //\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
+  //\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
@@ -229,6 +253,15 @@ PeiMemoryDiscoveredNotify (
   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