]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFsp2WrapperPkg/FspWrapperNotifyDxe/FspWrapperNotifyDxe.c
IntelFsp2WrapperPkg: Add support to handle ResetRequired return Status from FSP.
[mirror_edk2.git] / IntelFsp2WrapperPkg / FspWrapperNotifyDxe / FspWrapperNotifyDxe.c
index 30c06b88bf16cf841f5538bbdc39159d0cb9267b..0797f44a6835d5031de5d931b7abc8667c3786bb 100644 (file)
@@ -22,6 +22,7 @@
 #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
@@ -93,6 +94,15 @@ OnPciEnumerationComplete (
   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
@@ -130,6 +140,15 @@ OnReadyToBoot (
   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
@@ -179,6 +198,15 @@ OnEndOfFirmware (
   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