]> git.proxmox.com Git - mirror_edk2.git/commitdiff
IntelFsp2Pkg: Add function to get bootloader stack pointer
authorChasel, Chiu <chasel.chiu@intel.com>
Wed, 23 Jan 2019 04:07:45 +0000 (12:07 +0800)
committerChasel, Chiu <chasel.chiu@intel.com>
Mon, 28 Jan 2019 07:25:53 +0000 (15:25 +0800)
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1391

FSP on-going enhancement for stack utilization required
to know bootloader stack pointer and this pointer can be
retrieved by first input parameter address when FSP-M
entry API invoked by bootloader.

Test: Verified on internal platform and booting successfully

Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Chasel Chiu <chasel.chiu@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
IntelFsp2Pkg/Include/Library/FspCommonLib.h
IntelFsp2Pkg/Library/BaseFspCommonLib/FspCommonLib.c

index 1c99be3b1f7248bd03e62fb3b4f5c899c913c787..8708d3ec385d2aed3c22e8e60201ffcea3442634 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 \r
-  Copyright (c) 2014 - 2018, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2014 - 2019, 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
@@ -40,9 +40,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
@@ -51,9 +51,9 @@ GetFspApiParameter (
   );\r
 \r
 /**\r
-  This function gets back the FSP API second parameter passed by the bootlaoder.\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 bootlaoder.\r
+  @retval ApiParameter FSP API second parameter passed by the bootloader.\r
 **/\r
 UINT32\r
 EFIAPI\r
@@ -61,6 +61,17 @@ GetFspApiParameter2 (
   VOID\r
   );\r
 \r
+/**\r
+  This function returns the FSP entry stack pointer from address of the first API parameter.\r
+\r
+  @retval FSP entry stack pointer.\r
+**/\r
+VOID*\r
+EFIAPI\r
+GetFspEntryStack (\r
+  VOID\r
+  );\r
+\r
 /**\r
   This function sets the FSP API parameter in the stack.\r
 \r
index 64ffba1d16789f8a5f1fe62f2a2e24fc6e4bf170..5bec4f9f97648b1281ddef35b64eb6a5713dbf91 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 \r
-  Copyright (c) 2014 - 2018, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2014 - 2019, 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
@@ -87,9 +87,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
@@ -104,9 +104,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