]> git.proxmox.com Git - mirror_edk2.git/commitdiff
IntelFsp2Pkg-BaseFspCommonLib: Add funtion to return the reset required status
authorYarlagadda, Satya P <satya.p.yarlagadda@intel.com>
Fri, 24 Jun 2016 02:38:02 +0000 (10:38 +0800)
committerJiewen Yao <jiewen.yao@intel.com>
Mon, 27 Jun 2016 03:47:48 +0000 (11:47 +0800)
Added new funtion in FSPCommonLib to update the FSP API return status with
the requested return status and return the control to the boot loader.

Cc: Giri P Mudusuru <giri.p.mudusuru@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Satya Yarlagadda <satya.p.yarlagadda@intel.com>
Reviewed-by: Giri P Mudusuru <giri.p.mudusuru@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
IntelFsp2Pkg/Include/Library/FspCommonLib.h
IntelFsp2Pkg/Library/BaseFspCommonLib/BaseFspCommonLib.inf
IntelFsp2Pkg/Library/BaseFspCommonLib/FspCommonLib.c

index e13d0c33467bb104c46ec06d6ddde76f507d5215..231f1e44b3b715f10b86be750be41e23eb04b876 100644 (file)
@@ -309,4 +309,15 @@ GetFspCarSize (
   VOID\r
   );\r
 \r
+/**\r
+  This function updates the return status of the FSP API with requested reset type and returns to Boot Loader.\r
+\r
+  @param[in] FspResetType     Reset type that needs to returned as API return status\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+FspApiReturnStatusReset (\r
+  IN UINT32   FspResetType\r
+  );\r
 #endif\r
index 0b0741b1c6db3540354e166528d8beb42754096f..df8803a036b13eca7a0e560e6d0dab45bd4b1b62 100644 (file)
@@ -28,6 +28,7 @@
 \r
 [LibraryClasses]\r
   BaseMemoryLib\r
+  FspSwitchStackLib\r
 \r
 [Pcd]\r
   gIntelFsp2PkgTokenSpaceGuid.PcdGlobalDataPointerAddress      ## CONSUMES\r
index 151b1893433d726316586dd91ddae38a4c8e2899..0c5f0b306ea4a187ea86b60abf6d843216ce595f 100644 (file)
@@ -18,6 +18,7 @@
 #include <FspGlobalData.h>\r
 #include <FspEas.h>\r
 #include <FspDataTable.h>\r
+#include <Library/FspSwitchStackLib.h>\r
 \r
 #pragma pack(1)\r
 \r
@@ -544,3 +545,31 @@ GetFspCarSize (
   }\r
   return CarSize;\r
 }\r
+\r
+/**\r
+  This function updates the return status of the FSP API with requested reset type and returns to Boot Loader.\r
+\r
+  @param[in] FspResetType     Reset type that needs to returned as API return status\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+FspApiReturnStatusReset (\r
+  IN UINT32   FspResetType\r
+  )\r
+{\r
+  volatile BOOLEAN  LoopUntilReset;\r
+  \r
+  LoopUntilReset = TRUE;\r
+  DEBUG ((DEBUG_INFO, "FSP returning control to Bootloader with reset required return status %x\n",FspResetType));\r
+  ///\r
+  /// Below code is not an infinite loop.The control will go back to API calling function in BootLoader each time BootLoader\r
+  /// calls the FSP API without honoring the reset request by FSP\r
+  ///\r
+  do {\r
+    SetFspApiReturnStatus ((EFI_STATUS)FspResetType);\r
+    Pei2LoaderSwitchStack ();\r
+    DEBUG ((DEBUG_ERROR, "!!!ERROR: FSP has requested BootLoader for reset. But BootLoader has not honored the reset\n"));\r
+    DEBUG ((DEBUG_ERROR, "!!!ERROR: Please add support in BootLoader to honour the reset request from FSP\n"));\r
+  } while (LoopUntilReset);\r
+}\r