]> git.proxmox.com Git - mirror_edk2.git/commitdiff
IntelFsp2Pkg: FSPI_UPD is not mandatory.
authorChasel Chiu <chasel.chiu@intel.com>
Mon, 25 Jul 2022 19:03:51 +0000 (12:03 -0700)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Thu, 28 Jul 2022 16:41:41 +0000 (16:41 +0000)
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3993
FSPI_UPD is required only When platforms implemented FSP_I component.
Updated the scripts to allow FSPI_UPD not present scenario.
Also fixed FSP_GLOBAL_DATA structure alignment issue and unnecessary
non-backward compatibility change in previous FSP_I patch.

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: Star Zeng <star.zeng@intel.com>
IntelFsp2Pkg/Include/FspGlobalData.h
IntelFsp2Pkg/Tools/GenCfgOpt.py

index cf94f7b6a549d2710ecbfb61de13366e5d56be5a..32c6d460e472aebf1c465e23010a3d93fa704517 100644 (file)
@@ -42,58 +42,57 @@ typedef struct  {
 #define FSP_PERFORMANCE_DATA_TIMER_MASK  0xFFFFFFFFFFFFFF\r
 \r
 typedef struct  {\r
-  UINT32    Signature;\r
-  UINT8     Version;\r
-  UINT8     Reserved1[3];\r
+  UINT32             Signature;\r
+  UINT8              Version;\r
+  UINT8              Reserved1[3];\r
   ///\r
   /// Offset 0x08\r
   ///\r
-  UINTN     CoreStack;\r
-  UINTN     Reserved2;\r
+  UINTN              CoreStack;\r
+  VOID               *SmmInitUpdPtr;\r
   ///\r
   /// IA32: Offset 0x10; X64: Offset 0x18\r
   ///\r
-  UINT32    StatusCode;\r
-  UINT8     ApiIdx;\r
+  UINT32             StatusCode;\r
+  UINT8              ApiIdx;\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
-  UINT32    Reserved4[8];\r
+  UINT8              FspMode;\r
+  UINT8              OnSeparateStack;\r
+  UINT8              Reserved2;\r
+  UINT32             NumberOfPhases;\r
+  UINT32             PhasesExecuted;\r
+  UINT32             Reserved3[8];\r
   ///\r
   /// IA32: Offset 0x40; X64: Offset 0x48\r
   /// Start of UINTN and pointer section\r
-  /// All UINTN and pointer members must be put in this section\r
-  /// except CoreStack and Reserved2. In addition, the number of\r
-  /// UINTN and pointer members must be even for natural alignment\r
-  /// in both IA32 and X64.\r
+  /// All UINTN and pointer members are put in this section\r
+  /// for maintaining natural alignment for both IA32 and X64 builds.\r
   ///\r
   FSP_PLAT_DATA      PlatformData;\r
   VOID               *TempRamInitUpdPtr;\r
   VOID               *MemoryInitUpdPtr;\r
   VOID               *SiliconInitUpdPtr;\r
-  VOID               *SmmInitUpdPtr;\r
   ///\r
-  /// IA32: Offset 0x68; X64: Offset 0x98\r
+  /// IA32: Offset 0x64; X64: Offset 0x90\r
   /// To store function parameters pointer\r
   /// so it can be retrieved after stack switched.\r
   ///\r
   VOID               *FunctionParameterPtr;\r
   FSP_INFO_HEADER    *FspInfoHeader;\r
   VOID               *UpdDataPtr;\r
-  UINTN              Reserved5;\r
   ///\r
   /// End of UINTN and pointer section\r
+  /// At this point, next field offset must be either *0h or *8h to\r
+  /// meet natural alignment requirement.\r
   ///\r
-  UINT8              Reserved6[16];\r
+  UINT8              Reserved4[16];\r
   UINT32             PerfSig;\r
   UINT16             PerfLen;\r
-  UINT16             Reserved7;\r
+  UINT16             Reserved5;\r
   UINT32             PerfIdx;\r
+  UINT32             Reserved6;\r
   UINT64             PerfData[32];\r
 } FSP_GLOBAL_DATA;\r
 \r
index 128b8965926caf390c8a0aca8297c6e65a42773e..71c48f10e0c23da29605658af8404774bbd0dcc4 100644 (file)
@@ -959,8 +959,13 @@ EndList
             UpdTxtFile = ''\r
             FvDir = self._FvDir\r
             if GuidList[Index] not in self._MacroDict:\r
-                self.Error = "%s definition is missing in DSC file" % (GuidList[Index])\r
-                return 1\r
+                NoFSPI = False\r
+                if GuidList[Index] == 'FSP_I_UPD_TOOL_GUID':\r
+                    NoFSPI = True\r
+                    continue\r
+                else:\r
+                    self.Error = "%s definition is missing in DSC file" % (GuidList[Index])\r
+                    return 1\r
 \r
             if UpdTxtFile == '':\r
                 UpdTxtFile = os.path.join(FvDir, self._MacroDict[GuidList[Index]] + '.txt')\r
@@ -1296,7 +1301,8 @@ EndList
                elif '_S' in SignatureStr[6:6+2]:\r
                    TxtBody.append("#define FSPS_UPD_SIGNATURE               %s        /* '%s' */\n\n" % (Item['value'], SignatureStr))\r
                elif '_I' in SignatureStr[6:6+2]:\r
-                   TxtBody.append("#define FSPI_UPD_SIGNATURE               %s        /* '%s' */\n\n" % (Item['value'], SignatureStr))\r
+                   if NoFSPI == True:\r
+                       TxtBody.append("#define FSPI_UPD_SIGNATURE               %s        /* '%s' */\n\n" % (Item['value'], SignatureStr))\r
         TxtBody.append("\n")\r
 \r
         for Region in ['UPD']:\r
@@ -1702,7 +1708,7 @@ EndList
 \r
 \r
 def Usage():\r
-    print ("GenCfgOpt Version 0.58")\r
+    print ("GenCfgOpt Version 0.59")\r
     print ("Usage:")\r
     print ("    GenCfgOpt  UPDTXT  PlatformDscFile BuildFvDir                 [-D Macros]")\r
     print ("    GenCfgOpt  HEADER  PlatformDscFile BuildFvDir  InputHFile     [-D Macros]")\r