From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mx.groups.io with SMTP id smtpd.web09.29313.1658985337455974859 for ; Wed, 27 Jul 2022 22:15:37 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=bFLw7UVQ; spf=pass (domain: intel.com, ip: 192.55.52.93, mailfrom: chasel.chiu@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1658985337; x=1690521337; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=izp5H66F6nqa+m/0eQb6eUKk/wxtpE8F5q8AJjZx5OY=; b=bFLw7UVQt2ijicWyZpRokEG/zWw3S71Mf1H09ZuV7/Z07nlnD89YMBrE sJ15BArYbm71idliEzffYQn4cf2allDmg+E/F3FEWqGPhNB1uiw1WVCoy ahA0qbSzKWvJJZeLXA0GBQWze7rZXrSBOV1E/4DLcqwBIPYvRONQTinvK AICNZm2aFVc+adHYyzG2cVqWqnllUxIG1xJUWQtIrWvT5Mdq7CDz95q+0 ZXh+7qKnUPgOU/b6rhwlFQYG/ieKe57CFc8yAgxWzctZjGnOq978Wysir HSc1gVuEdVaq/oCaMxmqKNAgxSCgYAUEz/xee9PC4nJUY/L0yWju/K0/z w==; X-IronPort-AV: E=McAfee;i="6400,9594,10421"; a="285970725" X-IronPort-AV: E=Sophos;i="5.93,196,1654585200"; d="scan'208";a="285970725" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jul 2022 22:15:37 -0700 X-IronPort-AV: E=Sophos;i="5.93,196,1654585200"; d="scan'208";a="551141117" Received: from cchiu4-mobl.gar.corp.intel.com ([10.209.89.36]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jul 2022 22:15:34 -0700 From: "Chiu, Chasel" To: devel@edk2.groups.io Cc: Chasel Chiu , Nate DeSimone , Star Zeng Subject: [PATCH v2] IntelFsp2Pkg: FSPI_UPD is not mandatory. Date: Wed, 27 Jul 2022 22:15:22 -0700 Message-Id: <20220728051522.601-1-chasel.chiu@intel.com> X-Mailer: git-send-email 2.35.0.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3993 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 Cc: Star Zeng Signed-off-by: Chasel Chiu --- IntelFsp2Pkg/Include/FspGlobalData.h | 43 +++++++++++++++++++++-----------= ----------- IntelFsp2Pkg/Tools/GenCfgOpt.py | 14 ++++++++++---- 2 files changed, 31 insertions(+), 26 deletions(-) diff --git a/IntelFsp2Pkg/Include/FspGlobalData.h b/IntelFsp2Pkg/Include/Fs= pGlobalData.h index cf94f7b6a5..32c6d460e4 100644 --- a/IntelFsp2Pkg/Include/FspGlobalData.h +++ b/IntelFsp2Pkg/Include/FspGlobalData.h @@ -42,58 +42,57 @@ typedef struct { #define FSP_PERFORMANCE_DATA_TIMER_MASK 0xFFFFFFFFFFFFFF=0D =0D typedef struct {=0D - UINT32 Signature;=0D - UINT8 Version;=0D - UINT8 Reserved1[3];=0D + UINT32 Signature;=0D + UINT8 Version;=0D + UINT8 Reserved1[3];=0D ///=0D /// Offset 0x08=0D ///=0D - UINTN CoreStack;=0D - UINTN Reserved2;=0D + UINTN CoreStack;=0D + VOID *SmmInitUpdPtr;=0D ///=0D /// IA32: Offset 0x10; X64: Offset 0x18=0D ///=0D - UINT32 StatusCode;=0D - UINT8 ApiIdx;=0D + UINT32 StatusCode;=0D + UINT8 ApiIdx;=0D ///=0D /// 0: FSP in API mode; 1: FSP in DISPATCH mode=0D ///=0D - UINT8 FspMode;=0D - UINT8 OnSeparateStack;=0D - UINT8 Reserved3;=0D - UINT32 NumberOfPhases;=0D - UINT32 PhasesExecuted;=0D - UINT32 Reserved4[8];=0D + UINT8 FspMode;=0D + UINT8 OnSeparateStack;=0D + UINT8 Reserved2;=0D + UINT32 NumberOfPhases;=0D + UINT32 PhasesExecuted;=0D + UINT32 Reserved3[8];=0D ///=0D /// IA32: Offset 0x40; X64: Offset 0x48=0D /// Start of UINTN and pointer section=0D - /// All UINTN and pointer members must be put in this section=0D - /// except CoreStack and Reserved2. In addition, the number of=0D - /// UINTN and pointer members must be even for natural alignment=0D - /// in both IA32 and X64.=0D + /// All UINTN and pointer members are put in this section=0D + /// for maintaining natural alignment for both IA32 and X64 builds.=0D ///=0D FSP_PLAT_DATA PlatformData;=0D VOID *TempRamInitUpdPtr;=0D VOID *MemoryInitUpdPtr;=0D VOID *SiliconInitUpdPtr;=0D - VOID *SmmInitUpdPtr;=0D ///=0D - /// IA32: Offset 0x68; X64: Offset 0x98=0D + /// IA32: Offset 0x64; X64: Offset 0x90=0D /// To store function parameters pointer=0D /// so it can be retrieved after stack switched.=0D ///=0D VOID *FunctionParameterPtr;=0D FSP_INFO_HEADER *FspInfoHeader;=0D VOID *UpdDataPtr;=0D - UINTN Reserved5;=0D ///=0D /// End of UINTN and pointer section=0D + /// At this point, next field offset must be either *0h or *8h to=0D + /// meet natural alignment requirement.=0D ///=0D - UINT8 Reserved6[16];=0D + UINT8 Reserved4[16];=0D UINT32 PerfSig;=0D UINT16 PerfLen;=0D - UINT16 Reserved7;=0D + UINT16 Reserved5;=0D UINT32 PerfIdx;=0D + UINT32 Reserved6;=0D UINT64 PerfData[32];=0D } FSP_GLOBAL_DATA;=0D =0D diff --git a/IntelFsp2Pkg/Tools/GenCfgOpt.py b/IntelFsp2Pkg/Tools/GenCfgOpt= .py index 128b896592..71c48f10e0 100644 --- a/IntelFsp2Pkg/Tools/GenCfgOpt.py +++ b/IntelFsp2Pkg/Tools/GenCfgOpt.py @@ -959,8 +959,13 @@ EndList UpdTxtFile =3D ''=0D FvDir =3D self._FvDir=0D if GuidList[Index] not in self._MacroDict:=0D - self.Error =3D "%s definition is missing in DSC file" % (G= uidList[Index])=0D - return 1=0D + NoFSPI =3D False=0D + if GuidList[Index] =3D=3D 'FSP_I_UPD_TOOL_GUID':=0D + NoFSPI =3D True=0D + continue=0D + else:=0D + self.Error =3D "%s definition is missing in DSC file" = % (GuidList[Index])=0D + return 1=0D =0D if UpdTxtFile =3D=3D '':=0D UpdTxtFile =3D os.path.join(FvDir, self._MacroDict[GuidLis= t[Index]] + '.txt')=0D @@ -1296,7 +1301,8 @@ EndList elif '_S' in SignatureStr[6:6+2]:=0D TxtBody.append("#define FSPS_UPD_SIGNATURE = %s /* '%s' */\n\n" % (Item['value'], SignatureStr))=0D elif '_I' in SignatureStr[6:6+2]:=0D - TxtBody.append("#define FSPI_UPD_SIGNATURE = %s /* '%s' */\n\n" % (Item['value'], SignatureStr))=0D + if NoFSPI =3D=3D True:=0D + TxtBody.append("#define FSPI_UPD_SIGNATURE = %s /* '%s' */\n\n" % (Item['value'], SignatureStr))=0D TxtBody.append("\n")=0D =0D for Region in ['UPD']:=0D @@ -1702,7 +1708,7 @@ EndList =0D =0D def Usage():=0D - print ("GenCfgOpt Version 0.58")=0D + print ("GenCfgOpt Version 0.59")=0D print ("Usage:")=0D print (" GenCfgOpt UPDTXT PlatformDscFile BuildFvDir = [-D Macros]")=0D print (" GenCfgOpt HEADER PlatformDscFile BuildFvDir InputHFile = [-D Macros]")=0D --=20 2.35.0.windows.1