public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Kuo, Ted" <ted.kuo@intel.com>
To: devel@edk2.groups.io
Cc: Chasel Chiu <chasel.chiu@intel.com>,
	Nate DeSimone <nathaniel.l.desimone@intel.com>,
	Star Zeng <star.zeng@intel.com>,
	Ashraf Ali S <ashraf.ali.s@intel.com>
Subject: [edk2-devel][PATCH v3 3/8] IntelFsp2Pkg: Update FSP_GLOBAL_DATA and FSP_PLAT_DATA for X64
Date: Thu,  7 Apr 2022 01:02:34 +0800	[thread overview]
Message-ID: <9f8e6d30d79f5a3fbaa198eef91fdc70c151659e.1649264447.git.ted.kuo@intel.com> (raw)
In-Reply-To: <cover.1649264447.git.ted.kuo@intel.com>
In-Reply-To: <cover.1649264447.git.ted.kuo@intel.com>

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3893
Updated FSP_GLOBAL_DATA and FSP_PLAT_DATA structures to support
both IA32 and X64.

Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Ashraf Ali S <ashraf.ali.s@intel.com>
Signed-off-by: Ted Kuo <ted.kuo@intel.com>
---
 IntelFsp2Pkg/FspSecCore/SecFsp.c     |  2 +-
 IntelFsp2Pkg/Include/FspGlobalData.h | 51 +++++++++++++++++++++++++-----------
 2 files changed, 37 insertions(+), 16 deletions(-)

diff --git a/IntelFsp2Pkg/FspSecCore/SecFsp.c b/IntelFsp2Pkg/FspSecCore/SecFsp.c
index 85fbc7664c..1ead3c9ce6 100644
--- a/IntelFsp2Pkg/FspSecCore/SecFsp.c
+++ b/IntelFsp2Pkg/FspSecCore/SecFsp.c
@@ -130,7 +130,7 @@ FspGlobalDataInit (
   ZeroMem ((VOID *)PeiFspData, sizeof (FSP_GLOBAL_DATA));
 
   PeiFspData->Signature = FSP_GLOBAL_DATA_SIGNATURE;
-  PeiFspData->Version   = 0;
+  PeiFspData->Version   = FSP_GLOBAL_DATA_VERSION;
   PeiFspData->CoreStack = BootLoaderStack;
   PeiFspData->PerfIdx   = 2;
   PeiFspData->PerfSig   = FSP_PERFORMANCE_DATA_SIGNATURE;
diff --git a/IntelFsp2Pkg/Include/FspGlobalData.h b/IntelFsp2Pkg/Include/FspGlobalData.h
index 2b534075ae..dcfeed7501 100644
--- a/IntelFsp2Pkg/Include/FspGlobalData.h
+++ b/IntelFsp2Pkg/Include/FspGlobalData.h
@@ -10,8 +10,9 @@
 
 #include <FspEas.h>
 
-#define FSP_IN_API_MODE       0
-#define FSP_IN_DISPATCH_MODE  1
+#define FSP_IN_API_MODE         0
+#define FSP_IN_DISPATCH_MODE    1
+#define FSP_GLOBAL_DATA_VERSION 1
 
 #pragma pack(1)
 
@@ -28,10 +29,11 @@ typedef enum {
 
 typedef struct  {
   VOID      *DataPtr;
-  UINT32    MicrocodeRegionBase;
-  UINT32    MicrocodeRegionSize;
-  UINT32    CodeRegionBase;
-  UINT32    CodeRegionSize;
+  UINTN     MicrocodeRegionBase;
+  UINTN     MicrocodeRegionSize;
+  UINTN     CodeRegionBase;
+  UINTN     CodeRegionSize;
+  UINTN     Reserved;
 } FSP_PLAT_DATA;
 
 #define FSP_GLOBAL_DATA_SIGNATURE        SIGNATURE_32 ('F', 'S', 'P', 'D')
@@ -42,15 +44,15 @@ typedef struct  {
   UINT32             Signature;
   UINT8              Version;
   UINT8              Reserved1[3];
+  ///
+  /// Offset 0x08
+  ///
   UINTN              CoreStack;
+  UINTN              Reserved2;
+  ///
+  /// IA32: Offset 0x10; X64: Offset 0x18
+  ///
   UINT32             StatusCode;
-  UINT32             Reserved2[8];
-  FSP_PLAT_DATA      PlatformData;
-  FSP_INFO_HEADER    *FspInfoHeader;
-  VOID               *UpdDataPtr;
-  VOID               *TempRamInitUpdPtr;
-  VOID               *MemoryInitUpdPtr;
-  VOID               *SiliconInitUpdPtr;
   UINT8              ApiIdx;
   ///
   /// 0: FSP in API mode; 1: FSP in DISPATCH mode
@@ -60,15 +62,34 @@ typedef struct  {
   UINT8              Reserved3;
   UINT32             NumberOfPhases;
   UINT32             PhasesExecuted;
+  UINT32             Reserved4[8];
   ///
+  /// IA32: Offset 0x40; X64: Offset 0x48
+  /// Start of UINTN and pointer section
+  /// All UINTN and pointer members must be put in this section
+  /// except CoreStack and Reserved2. In addition, the number of
+  /// UINTN and pointer members must be even for natural alignment
+  /// in both IA32 and X64.
+  ///
+  FSP_PLAT_DATA      PlatformData;
+  VOID               *TempRamInitUpdPtr;
+  VOID               *MemoryInitUpdPtr;
+  VOID               *SiliconInitUpdPtr;
+  ///
+  /// IA32: Offset 0x64; X64: Offset 0x90
   /// To store function parameters pointer
   /// so it can be retrieved after stack switched.
   ///
   VOID               *FunctionParameterPtr;
-  UINT8              Reserved4[16];
+  FSP_INFO_HEADER    *FspInfoHeader;
+  VOID               *UpdDataPtr;
+  ///
+  /// End of UINTN and pointer section
+  ///
+  UINT8              Reserved5[16];
   UINT32             PerfSig;
   UINT16             PerfLen;
-  UINT16             Reserved5;
+  UINT16             Reserved6;
   UINT32             PerfIdx;
   UINT64             PerfData[32];
 } FSP_GLOBAL_DATA;
-- 
2.16.2.windows.1


  parent reply	other threads:[~2022-04-06 17:04 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-06 17:02 [edk2-devel][PATCH v3 0/8] Support PEI 64bit in IntelFsp2Pkg and IntelFsp2WrapperPkg Kuo, Ted
2022-04-06 17:02 ` [edk2-devel][PATCH v3 1/8] IntelFsp2Pkg: X64 compatible changes to support PEI in 64bit Kuo, Ted
2022-04-06 23:57   ` Ni, Ray
2022-04-07  0:05     ` Andrew Fish
2022-04-07  0:08       ` Ni, Ray
2022-04-07  1:25       ` Kuo, Ted
2022-04-07  1:10     ` Kuo, Ted
2022-04-06 17:02 ` [edk2-devel][PATCH v3 2/8] IntelFsp2Pkg: Add FSPx_ARCH2_UPD support for X64 Kuo, Ted
2022-04-06 17:02 ` Kuo, Ted [this message]
2022-04-06 17:02 ` [edk2-devel][PATCH v3 4/8] IntelFsp2Pkg: FspSecCore " Kuo, Ted
2022-04-06 17:02 ` [edk2-devel][PATCH v3 5/8] IntelFsp2Pkg: SecFspSecPlatformLibNull " Kuo, Ted
2022-04-06 17:02 ` [edk2-devel][PATCH v3 6/8] IntelFsp2WrapperPkg: Adopt FSPM_UPD_COMMON_FSP24 " Kuo, Ted
2022-04-06 17:02 ` [edk2-devel][PATCH v3 7/8] IntelFsp2WrapperPkg: BaseFspWrapperApiLib support " Kuo, Ted
2022-04-06 17:02 ` [edk2-devel][PATCH v3 8/8] IntelFsp2WrapperPkg: SecFspWrapperPlatformSecLibSample " Kuo, Ted

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=9f8e6d30d79f5a3fbaa198eef91fdc70c151659e.1649264447.git.ted.kuo@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