]> git.proxmox.com Git - mirror_edk2.git/commitdiff
IntelFsp2WrapperPkg: Add support to handle ResetRequired return Status from FSP.
authorJiewen Yao <jiewen.yao@intel.com>
Fri, 17 Jun 2016 02:38:09 +0000 (10:38 +0800)
committerJiewen Yao <jiewen.yao@intel.com>
Fri, 17 Jun 2016 23:17:04 +0000 (07:17 +0800)
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>
IntelFsp2WrapperPkg/FspWrapperNotifyDxe/FspWrapperNotifyDxe.c
IntelFsp2WrapperPkg/FspWrapperNotifyDxe/FspWrapperNotifyDxe.inf
IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c
IntelFsp2WrapperPkg/FspsWrapperPeim/FspsWrapperPeim.c
IntelFsp2WrapperPkg/Include/Library/FspWrapperPlatformLib.h
IntelFsp2WrapperPkg/Library/BaseFspWrapperPlatformLibSample/FspWrapperPlatformLibSample.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/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
@@ -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
   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
@@ -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
   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
@@ -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
   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
index d8af0aa50f73bc3a6ddc039f3af6344d06517283..f851f6881da0d76bd0364316132cd406490589a6 100644 (file)
@@ -49,6 +49,7 @@
   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
index 2eb36252f3b5b4c322dd5aa8a424ca85e7496003..6144ad7f41e6f3e54731fa8dae0dae8b58254dd9 100644 (file)
@@ -88,6 +88,15 @@ PeiFspMemoryInit (
   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
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
   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
@@ -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
   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
index 30dc8df5dab392cadc2ce8ac5abb0ea19db49705..25f4eca797f54c31172c149c312bc9b688d7ec16 100644 (file)
@@ -70,4 +70,17 @@ GetS3MemoryInfo (
   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
 #endif\r
 #endif\r
index 9c1a84f12cef1af98f335ae8ed4279665a60e06e..926ff58a2f3f0c0c1f53a05bff6cd387589c6abc 100644 (file)
@@ -80,4 +80,24 @@ GetS3MemoryInfo (
   )\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