]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFsp2Pkg/Library/BaseFspCommonLib/FspCommonLib.c
IntelFsp2Pkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / IntelFsp2Pkg / Library / BaseFspCommonLib / FspCommonLib.c
index a9c8da657dd6402066a9ea687469bf64463c9355..0a5bc76aa72d0697116b42597e71a1dc427142b0 100644 (file)
@@ -1,13 +1,7 @@
 /** @file\r
 \r
-  Copyright (c) 2014 - 2016, Intel Corporation. All rights reserved.<BR>\r
-  This program and the accompanying materials\r
-  are licensed and made available under the terms and conditions of the BSD License\r
-  which accompanies this distribution.  The full text of the license may be found at\r
-  http://opensource.org/licenses/bsd-license.php.\r
-\r
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+  Copyright (c) 2014 - 2019, Intel Corporation. All rights reserved.<BR>\r
+  SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
 \r
@@ -17,7 +11,6 @@
 #include <Library/PcdLib.h>\r
 #include <FspGlobalData.h>\r
 #include <FspEas.h>\r
-#include <FspDataTable.h>\r
 #include <Library/FspSwitchStackLib.h>\r
 \r
 #pragma pack(1)\r
@@ -88,9 +81,9 @@ GetFspGlobalDataPointer (
 }\r
 \r
 /**\r
-  This function gets back the FSP API first parameter passed by the bootlaoder.\r
+  This function gets back the FSP API first parameter passed by the bootloader.\r
 \r
-  @retval ApiParameter FSP API first parameter passed by the bootlaoder.\r
+  @retval ApiParameter FSP API first parameter passed by the bootloader.\r
 **/\r
 UINT32\r
 EFIAPI\r
@@ -105,9 +98,26 @@ GetFspApiParameter (
 }\r
 \r
 /**\r
-  This function gets back the FSP API second parameter passed by the bootlaoder.\r
+  This function returns the FSP entry stack pointer from address of the first API parameter.\r
 \r
-  @retval ApiParameter FSP API second parameter passed by the bootlaoder.\r
+  @retval FSP entry stack pointer.\r
+**/\r
+VOID*\r
+EFIAPI\r
+GetFspEntryStack (\r
+  VOID\r
+  )\r
+{\r
+  FSP_GLOBAL_DATA  *FspData;\r
+\r
+  FspData  = GetFspGlobalDataPointer ();\r
+  return (VOID*)(FspData->CoreStack + CONTEXT_STACK_OFFSET(ApiParam[0]));\r
+}\r
+\r
+/**\r
+  This function gets back the FSP API second parameter passed by the bootloader.\r
+\r
+  @retval ApiParameter FSP API second parameter passed by the bootloader.\r
 **/\r
 UINT32\r
 EFIAPI\r
@@ -517,17 +527,19 @@ FspApiReturnStatusReset (
   )\r
 {\r
   volatile BOOLEAN  LoopUntilReset;\r
-  \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 honor the reset request from FSP\n"));\r
-  } while (LoopUntilReset);\r
+  if (GetFspGlobalDataPointer ()->FspMode == FSP_IN_API_MODE) {\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 honor the reset request from FSP\n"));\r
+    } while (LoopUntilReset);\r
+  }\r
 }\r