public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Chiu, Chasel" <chasel.chiu@intel.com>
To: devel@edk2.groups.io
Cc: Maurice Ma <maurice.ma@intel.com>,
	Nate DeSimone <nathaniel.l.desimone@intel.com>,
	Star Zeng <star.zeng@intel.com>
Subject: [PATCH] IntelFsp2Pkg: Add FunctionParametePtr to FspGlobalData.
Date: Wed, 20 May 2020 11:33:56 +0800	[thread overview]
Message-ID: <20200520033356.5708-1-chasel.chiu@intel.com> (raw)

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>
---
 IntelFsp2Pkg/Include/FspGlobalData.h             | 12 ++++++++++--
 IntelFsp2Pkg/Include/Library/FspSwitchStackLib.h | 18 +++++++++++++++++-
 2 files changed, 27 insertions(+), 3 deletions(-)

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


             reply	other threads:[~2020-05-20  3:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-20  3:33 Chiu, Chasel [this message]
2020-05-20  4:12 ` [PATCH] IntelFsp2Pkg: Add FunctionParametePtr to FspGlobalData Nate DeSimone
2020-05-20  4:20   ` Zeng, Star
2020-05-20  4:25     ` Chiu, Chasel
2020-05-20  4:33       ` Zeng, Star
2020-05-20  7:03         ` Chiu, Chasel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200520033356.5708-1-chasel.chiu@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox