]> git.proxmox.com Git - mirror_edk2.git/commitdiff
IntelFsp2Pkg: Add FunctionParametePtr to FspGlobalData.
authorChasel Chiu <chasel.chiu@intel.com>
Wed, 20 May 2020 03:23:13 +0000 (11:23 +0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Thu, 21 May 2020 01:25:26 +0000 (01:25 +0000)
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2726

When FSP switching stack and calling bootloader functions,
the function parameter in stack may not be accessible easily.
We can store the function parameter pointer to FspGlobalData
and retrieve it after stack switched.

Also need to add Loader2PeiSwitchStack () to header file
as public function for platform FSP code to consume.

Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Signed-off-by: Chasel Chiu <chasel.chiu@intel.com>
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
IntelFsp2Pkg/Include/FspGlobalData.h
IntelFsp2Pkg/Include/Library/FspSwitchStackLib.h

index 5bde3168939e0b97ed35bd468c48c8aaf4dd237f..dba9b48e1a0bba5179b4e6f8e6bc9f8b09c452f4 100644 (file)
@@ -52,12 +52,20 @@ typedef struct  {
    VOID               *MemoryInitUpdPtr;\r
    VOID               *SiliconInitUpdPtr;\r
    UINT8              ApiIdx;\r
-   UINT8              FspMode; // 0: FSP in API mode; 1: FSP in DISPATCH mode\r
+   ///\r
+   /// 0: FSP in API mode; 1: FSP in DISPATCH mode\r
+   ///\r
+   UINT8              FspMode;\r
    UINT8              OnSeparateStack;\r
    UINT8              Reserved3;\r
    UINT32             NumberOfPhases;\r
    UINT32             PhasesExecuted;\r
-   UINT8              Reserved4[20];\r
+   ///\r
+   /// To store function parameters pointer\r
+   /// so it can be retrieved after stack switched.\r
+   ///\r
+   VOID               *FunctionParameterPtr;\r
+   UINT8              Reserved4[16];\r
    UINT32             PerfSig;\r
    UINT16             PerfLen;\r
    UINT16             Reserved5;\r
index 0c76e9f0220fc0c7469ef84f879e3a7e39bd19db..f049361d7845d4575d38f710181f3af76feb9005 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 \r
-  Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2014 - 2020, Intel Corporation. All rights reserved.<BR>\r
   SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
@@ -36,4 +36,20 @@ Pei2LoaderSwitchStack (
   VOID\r
   );\r
 \r
+/**\r
+\r
+  This function is equivalent to Pei2LoaderSwitchStack () but just indicates\r
+  the stack after switched is FSP stack.\r
+\r
+  @return ReturnKey          After switching to the saved stack,\r
+                             this value will be saved in eax before returning.\r
+\r
+\r
+**/\r
+UINT32\r
+EFIAPI\r
+Loader2PeiSwitchStack (\r
+  VOID\r
+  );\r
+\r
 #endif\r