From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mx.groups.io with SMTP id smtpd.web09.33361.1658180447683339629 for ; Mon, 18 Jul 2022 14:40:47 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=mTD4T3ea; spf=pass (domain: intel.com, ip: 192.55.52.136, mailfrom: nathaniel.l.desimone@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1658180447; x=1689716447; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=dcl1ahY/vKWF2pKp08NJBc3Z0bONPIfw8JlGwdXzu5g=; b=mTD4T3ea4a65GEqz0ysNaM5QdiKAZIlYg2ht/psupp5pyIowPtzGqap7 HTYwotpkFrOqIEFb1k4El0ZIvK8jZ9+z421apoEl77pFuGdPAxdjfqZ9a 4ShjHi5Vbl0xqLAxI/giWEXH/nzmTrS2Dh3B384UnJAtbOC8YvH3NP6RL V89RafVR/rpLGbk3pcHMjFgdTy6wCcQeAAt9FbmuOeEKQCJCOdd7vuK+P Ntv5pxcl92wByR+YZ48akp9wtHTTXWkK17Y/S6HSW6tJwxJBSH/Vz3Ft8 QUtubl7Z1fZV5Kgl9fhfyffLfvo8xBrhYqFow63wOS3wKSrcSQ5OOZG/1 Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10412"; a="266107608" X-IronPort-AV: E=Sophos;i="5.92,282,1650956400"; d="scan'208";a="266107608" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Jul 2022 14:40:47 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,282,1650956400"; d="scan'208";a="739621797" Received: from orsmsx601.amr.corp.intel.com ([10.22.229.14]) by fmsmga001.fm.intel.com with ESMTP; 18 Jul 2022 14:40:46 -0700 Received: from orsmsx608.amr.corp.intel.com (10.22.229.21) by ORSMSX601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28; Mon, 18 Jul 2022 14:40:46 -0700 Received: from orsmsx606.amr.corp.intel.com (10.22.229.19) by ORSMSX608.amr.corp.intel.com (10.22.229.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Mon, 18 Jul 2022 14:40:45 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx606.amr.corp.intel.com (10.22.229.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27 via Frontend Transport; Mon, 18 Jul 2022 14:40:45 -0700 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (104.47.56.170) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2308.27; Mon, 18 Jul 2022 14:40:45 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=L8i+F4yUsZ46UGDQHJgiiE8sWWEpANxshMG2LoCJbRWTrEAYZSskcPFkE/BotdIKMMSjgk2WgktlpG9DCg+Yt1ajEx0BF6vC0zAAWDOvIBwD2RqGEXb+5zedu+Hk3sSfJ3gu1RQsU2ye+IFrQ8YPZbGxmoHGpTXrwm/YOA/xLegCB9IS7JQaMDtY5O7O06ReYgA87e2QIUz7PE/6nD+t5tVYDZWCPg0gJuQKRXuP3cUzw72Pph7ZTfNhAaYYslieq7VDR6TWX/LqEa8p1fV9NS42WsEhIp5bGCZ6uL+jXYHtlsYMBtH5QcgkSjFo9uVZEEZz5OqtwWftZctcadeTcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=5KZrzqZDH08rAfx+yUG7WdGjlBnV+K/hVciQFt4x5gk=; b=fz9ZdE+UZ70MLLUXLVIEqCFmSgAjQU9TGABOCpvwR9eBHx7BFZoxo+3ayuH5OGyJ8YPnTsWU2nXYM7dmX3z8Yv50hpniKOV4pAnxaXnpEUupp3MLKejSk3Q1TnuQ36TweARnQd80blTyt5J+43mPV1y+4AHbew1O+Yt3SFYNHaBsnc2w+nnw9ALWlQP/eip/LCW0H98xQqEl88KoYc+oeU7KEqWmMxQ8ysmQn6QYdqwra9cnncHfOglN357RdJwF/YqhPUrV4UfQRj2opYFv2BexoX2TLiLzEBs8oVFdhEmncaQsFaVOLZJOazCy6AyOZ+g5ns7AB/ZuDFyzP2RFSg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from MW4PR11MB5821.namprd11.prod.outlook.com (2603:10b6:303:184::5) by BN6PR11MB4081.namprd11.prod.outlook.com (2603:10b6:405:78::38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.14; Mon, 18 Jul 2022 21:40:42 +0000 Received: from MW4PR11MB5821.namprd11.prod.outlook.com ([fe80::f59c:6174:7737:9179]) by MW4PR11MB5821.namprd11.prod.outlook.com ([fe80::f59c:6174:7737:9179%4]) with mapi id 15.20.5438.017; Mon, 18 Jul 2022 21:40:42 +0000 From: "Nate DeSimone" To: "Chiu, Chasel" , "devel@edk2.groups.io" CC: "Zhang, Hongbin1" , "Zeng, Star" Subject: Re: [PATCH] IntelFsp2Pkg/FspSecCore: Add FSP-I API for SMM support. Thread-Topic: [PATCH] IntelFsp2Pkg/FspSecCore: Add FSP-I API for SMM support. Thread-Index: AQHYl7z7bPo9GG/d6EeRCId04kZT0a2Ep/tg Date: Mon, 18 Jul 2022 21:40:42 +0000 Message-ID: References: <20220714200428.1989-1-chasel.chiu@intel.com> In-Reply-To: <20220714200428.1989-1-chasel.chiu@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 264f224a-f48a-4c1c-43b1-08da690629f2 x-ms-traffictypediagnostic: BN6PR11MB4081:EE_ x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: XSfvrrP6ZOrmqwTpt56jLYR0T6nPE6twN8/QiyfuJCQVOktp13ju4yzlX9pyvfM3cDG3S9aTfWmfILR39DM9RqUXzw0odSGOHkcmHR+9BMsW4jj2gJEGSsFgkZsezU+iF4Nf3NdjyUzR/wNw4fXANOfWEOI0lg6dhFbJoTIP2hM53JZDhY1QcvMKxQ4U/kGImoSuIVYNXJ2DAaq/o/0qrqDrUbyVgl4zuDpszO1X1C4dgWmpLpYEEpmOQvRlB46VkLX5oUT0FyQctVITjatpwseOzyWTM12SX4AhxQlMhQXKQHiVhkQ8CFEXW//O4vertpbTWtA6rldK1Vr7o/vCQZlF770xqrEoGbAdSBtgGmPKeFHVS2rSn7R1L/e1mjQctxfA9r2WOhT0lToLVplpSRT7BtVSjg4kaXXydvbU07gChjaBIXMjlqK6UCGtcG7BAiiPWO82SYSJIsWxZF3WY7ALhiS0zZNWyFH/k2X3d9kJ2NVBGh9dUUuptzXXOJPq7Jn/FBgZD36RWeXYTfPxegpzLdPucz0ll/3W7NRplmphXcZDpy+eQIzfJc8u4S6DfhW5eNUQLTLoIqRkYRTiWo4yQtRbRdPO7t/uzxGVSgFohgmrBR9eplf/F5UuCVk0lWpQeSPqc9RrWJuzv/e2qsAmjqeWPaPeBxNowZoaxmIuJxAPwbfsjaeOOltRHkMjkVYGchFSeaHxnPukS8fCp/oeQVPtNeeRFc5TuFoYTgXl3C+gcpy1w5dov3eJMeWGBTGeqP7+ctS2z8vQRodRWgkC+BEcutWzKKH4XBYXuuWlCnL1jmMNwVAcQnjz5M03UgT9s6OM+Meh9L/eg7bDqociaK7XZ4vA2qJpzJLVSk9c8m55TJL7dlTMQqW9h2zI x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MW4PR11MB5821.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(346002)(396003)(376002)(136003)(366004)(39860400002)(8936002)(5660300002)(52536014)(2906002)(86362001)(4326008)(33656002)(30864003)(66946007)(54906003)(8676002)(19627235002)(110136005)(66446008)(76116006)(66476007)(316002)(64756008)(66556008)(55016003)(26005)(53546011)(7696005)(6506007)(82960400001)(122000001)(966005)(478600001)(71200400001)(186003)(107886003)(41300700001)(9686003)(38070700005)(38100700002)(83380400001)(579004)(559001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?+HVPYlbXT3/h5LQxLhcMYzcraff+Bfc20xuL3rVbP7v0nq6SzMyG4WTQjIm7?= =?us-ascii?Q?I4CkwXGR/M3LhsiqCTXs8T1YhW7hN47a/la7GkXwhfyy3nVC4XE7EnmVw93q?= =?us-ascii?Q?RsorCVklcCG14VFnFNB9iuP1lKRH9OkFfbry34PKItWwTy0VtvKp6UI9GgK6?= =?us-ascii?Q?xRENQIeRHXKmLTspnNIsf5xMjlUigGfoOtU92jsjwXps1+j5gTgwIEmTBZdq?= =?us-ascii?Q?4UiomNU0oOvWO0HHmPFx4Sxr2lj0hfEfkoxED5O/pX/ldfGn605unQ3hQcuo?= =?us-ascii?Q?VnCzrJuCn/g9z4vrVDMXv1SyBpOT1vUod1kFdML7LqUdFAz3ZLNxowPBSCsz?= =?us-ascii?Q?qyQayS6Qbhmw5eJpH/ACY5Kx+PJIricdj46TkbmKYONaYLiYwuxs1m4SBxu8?= =?us-ascii?Q?MGPQ9pnkcoMNAl2YQ/ub/qgX/UxejekhRS2BBEtNnZD2BP4bqtfW/7KsfTIo?= =?us-ascii?Q?4EVhfKedywxnKcPVuhMsgn0sGrU95N5xQ3sRUxe/2A2L5TZIw5eJxSc2PI51?= =?us-ascii?Q?gsVVGlfzE332u5kbHf2pKgDvirtCPWQL7YqCVasvyVQauKNeiWTdS4yeF/Hs?= =?us-ascii?Q?E4d4ukN9LY9R6imgWGnx9TDS5+QYQCeIkkyDTyA9TNrAEBnleC2i9SnvIf8c?= =?us-ascii?Q?IFq0wpAnuipHxZ1fa/zOeP1MLdb67LDVBf4240TkYbJTRvdRbTNnrx16eDw2?= =?us-ascii?Q?RMQM4I6NGaFzjLu/ai/az50gsfMgL/FX5Hj3KK2A/0tv/945evHoR+4d6syU?= =?us-ascii?Q?+dNqOye61WU99DQLuMs/Q84vkVId4vuJOH/X0hFz2AAOf+va/VhpnxaOF4E/?= =?us-ascii?Q?Lq9pzacoJnN62FfIjxYX9Rd4CulJWo91eveHjZOCYWDpecALUHynJ+a9YOYJ?= =?us-ascii?Q?QIn0/JrFKVKCIPja7KkClCCPFON2ZAfbn4Yz0mUxvJS8vmoYYp0IgEi9q/h7?= =?us-ascii?Q?b4GuvsAkH410gkRgIR8GU9vJxJa32nBaHbqO7Hg5MBnqx1IzKO0tCm1Mt9vQ?= =?us-ascii?Q?TbQ2X40sFquFZ1ySBiwptvyWuKC5W+fGeWiWQrXX0O+I9zAreNS4GIT0L/Wm?= =?us-ascii?Q?BMcrPyQ7l7+yUmczxhx9yUXXnuolAaeeN4gla+CZqoZVQZywVIuZTc6Voy0e?= =?us-ascii?Q?zGWGn4DzjiCUUQRyPCgKHtgt5s/fZP3GfGSgqsbaF5fNKzK0qqBhgmODd1/J?= =?us-ascii?Q?U5e3FNsL9QV/X/acTUGzc+CcP4X87qFfwer/uLdGtutMUoGSNENzDvGNl60L?= =?us-ascii?Q?vrGktuVP+jEZquBSAKmgTtfpNOmfK5JxQhc0O31rATBTlysCDtYZmAF9d94j?= =?us-ascii?Q?VM1i+FFn38AHGR8KQLoT9g+oETMvBTYEVofdnP+cnnZnl0FCjycusO2ZLH44?= =?us-ascii?Q?zavzxsAYgmlCLkDBrFEzao5dd0qXnWOrHKFmCMPfiKkat3Jlvd4topVxT8mw?= =?us-ascii?Q?ThckPR5JpHVzFTAB4UY8Sh7MK624MDmja6l1DEslHkh440xp29PeA8Z0tZYc?= =?us-ascii?Q?hWZt7Rzk7jUrtotcjDvMjkA5SA6N6ixBQJ84O+YpYZwAh5IX4cNTSWNO5izH?= =?us-ascii?Q?qLB54dUdZm5V5ExHX91yYDxT9OQDMtEl1IO7dUBpQetmZGyjbm21CI8ZxCEl?= =?us-ascii?Q?7g=3D=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MW4PR11MB5821.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 264f224a-f48a-4c1c-43b1-08da690629f2 X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Jul 2022 21:40:42.0184 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: U6mQ74nzgZ9pglMKoLG3weu+PHGPl46npeq4L+M73vnMnpXUCC8lOyMLNe3uKWgAFVX5f/sB+GQR6NjmCvAwf7L4hfThBUyNKBlcOhNlhew= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR11MB4081 Return-Path: nathaniel.l.desimone@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Chasel, Please see comments inline. Here is a summary of my feedback: #1) IntelFsp2Pkg/FspSecCore/X64/FspApiEntryI.nasm - line 34 - Bug: eax shou= ld be rax #2) IntelFsp2Pkg/Include/FspEas/FspApi.h - Various unnecessary whitespace c= hanges that make the file look worse than before. #3) IntelFsp2Pkg/Include/Guid/FspHeaderFile.h - Why indent the #pragma line= s? Thanks, Nate > -----Original Message----- > From: Chiu, Chasel > Sent: Thursday, July 14, 2022 1:04 PM > To: devel@edk2.groups.io > Cc: Zhang, Hongbin1 ; Desimone, Nathaniel L > ; Zeng, Star ; Chiu, > Chasel > Subject: [PATCH] IntelFsp2Pkg/FspSecCore: Add FSP-I API for SMM support. >=20 > From: Hongbin1 Zhang >=20 > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3993 > Add FSP-I API entry point for SMM support. >=20 > Cc: Nate DeSimone > Cc: Star Zeng > Signed-off-by: Chasel Chiu > Signed-off-by: Hongbin1 Zhang > --- > IntelFsp2Pkg/FspSecCore/SecFspApiChk.c | 13 +++++++++++++ > IntelFsp2Pkg/FspSecCore/FspSecCoreI.inf | 54 ++++++++++++++++++++= ++++++++++++++++++++++++++++++++++ > IntelFsp2Pkg/FspSecCore/Ia32/FspApiEntryI.nasm | 44 ++++++++++++++++++++= ++++++++++++++++++++++++ > IntelFsp2Pkg/FspSecCore/X64/FspApiEntryI.nasm | 44 ++++++++++++++++++++= ++++++++++++++++++++++++ > IntelFsp2Pkg/Include/FspEas/FspApi.h | 57 ++++++++++++++++++++= ++++++++++++++++++------------------- > IntelFsp2Pkg/Include/FspGlobalData.h | 53 ++++++++++++++++++++= ++++++++------------------------- > IntelFsp2Pkg/Include/Guid/FspHeaderFile.h | 22 +++++++++++++++-----= -- > IntelFsp2Pkg/IntelFsp2Pkg.dsc | 1 + > IntelFsp2Pkg/Tools/GenCfgOpt.py | 26 ++++++++++++++++----= ------ > IntelFsp2Pkg/Tools/SplitFspBin.py | 6 +++--- > 10 files changed, 256 insertions(+), 64 deletions(-) >=20 > diff --git a/IntelFsp2Pkg/FspSecCore/SecFspApiChk.c b/IntelFsp2Pkg/FspSec= Core/SecFspApiChk.c > index e22a88cc84..35d223a404 100644 > --- a/IntelFsp2Pkg/FspSecCore/SecFspApiChk.c > +++ b/IntelFsp2Pkg/FspSecCore/SecFspApiChk.c > @@ -71,6 +71,19 @@ FspApiCallingCheck ( > Status =3D EFI_INVALID_PARAMETER; > } > } > + } else if (ApiIdx =3D=3D FspSmmInitApiIndex) { > + // > + // FspSmmInitApiIndex check > + // > + if ((FspData =3D=3D NULL) || ((UINTN)FspData =3D=3D MAX_ADDRESS) || = ((UINTN)FspData =3D=3D MAX_UINT32)) { > + Status =3D EFI_UNSUPPORTED; > + } else { > + if (FspData->Signature !=3D FSP_GLOBAL_DATA_SIGNATURE) { > + Status =3D EFI_UNSUPPORTED; > + } else if (EFI_ERROR (FspUpdSignatureCheck (FspSmmInitApiIndex, Ap= iParam))) { > + Status =3D EFI_INVALID_PARAMETER; > + } > + } > } else { > Status =3D EFI_UNSUPPORTED; > } > diff --git a/IntelFsp2Pkg/FspSecCore/FspSecCoreI.inf b/IntelFsp2Pkg/FspSe= cCore/FspSecCoreI.inf > new file mode 100644 > index 0000000000..d31576c00b > --- /dev/null > +++ b/IntelFsp2Pkg/FspSecCore/FspSecCoreI.inf > @@ -0,0 +1,54 @@ > +## @file > +# Sec Core for FSP > +# > +# Copyright (c) 2022, Intel Corporation. All rights reserved.
> +# > +# SPDX-License-Identifier: BSD-2-Clause-Patent > +# > +## > + > +[Defines] > + INF_VERSION =3D 0x00010005 > + BASE_NAME =3D FspSecCoreI > + FILE_GUID =3D 558782b5-782d-415e-ab9e-0ceb79dc342= 5 > + MODULE_TYPE =3D SEC > + VERSION_STRING =3D 1.0 > + > +# > +# The following information is for reference only and not required by th= e build tools. > +# > +# VALID_ARCHITECTURES =3D IA32 X64 > +# > + > +[Sources] > + SecFspApiChk.c > + SecFsp.h > + > +[Sources.X64] > + X64/FspApiEntryI.nasm > + X64/FspApiEntryCommon.nasm > + X64/FspHelper.nasm > + > +[Sources.IA32] > + Ia32/FspApiEntryI.nasm > + Ia32/FspApiEntryCommon.nasm > + Ia32/FspHelper.nasm > + > +[Binaries.Ia32] > + RAW|Vtf0/Bin/ResetVec.ia32.raw |GCC > + > +[Packages] > + MdePkg/MdePkg.dec > + IntelFsp2Pkg/IntelFsp2Pkg.dec > + > +[LibraryClasses] > + BaseMemoryLib > + DebugLib > + BaseLib > + PciCf8Lib > + SerialPortLib > + FspSwitchStackLib > + FspCommonLib > + FspSecPlatformLib > + > + > diff --git a/IntelFsp2Pkg/FspSecCore/Ia32/FspApiEntryI.nasm b/IntelFsp2Pk= g/FspSecCore/Ia32/FspApiEntryI.nasm > new file mode 100644 > index 0000000000..e9365d6832 > --- /dev/null > +++ b/IntelFsp2Pkg/FspSecCore/Ia32/FspApiEntryI.nasm > @@ -0,0 +1,44 @@ > +;; @file > +; Provide FSP API entry points. > +; > +; Copyright (c) 2022, Intel Corporation. All rights reserved.
> +; SPDX-License-Identifier: BSD-2-Clause-Patent > +;; > + > + SECTION .text > + > +; > +; Following functions will be provided in C > +; > +extern ASM_PFX(FspApiCommon) > + > +;-----------------------------------------------------------------------= ----- > +; FspApiCommonContinue API > +; > +; This is the FSP API common entry point to resume the FSP execution > +; > +;-----------------------------------------------------------------------= ----- > +global ASM_PFX(FspApiCommonContinue) > +ASM_PFX(FspApiCommonContinue): > + jmp $ > + > +;-----------------------------------------------------------------------= ----- > +; FspSmmInit API > +; > +; This FSP API will notify the FSP about the different phases in the boo= t > +; process > +; > +;-----------------------------------------------------------------------= ----- > +global ASM_PFX(FspSmmInitApi) > +ASM_PFX(FspSmmInitApi): > + mov eax, 7 ; FSP_API_INDEX.FspSmmInitApiIndex > + jmp ASM_PFX(FspApiCommon) > + > +;-----------------------------------------------------------------------= ----- > +; Module Entrypoint API > +;-----------------------------------------------------------------------= ----- > +global ASM_PFX(_ModuleEntryPoint) > +ASM_PFX(_ModuleEntryPoint): > + jmp $ > + ; Add reference to APIs so that it will not be optimized by compiler > + jmp ASM_PFX(FspSmmInitApi) > diff --git a/IntelFsp2Pkg/FspSecCore/X64/FspApiEntryI.nasm b/IntelFsp2Pkg= /FspSecCore/X64/FspApiEntryI.nasm > new file mode 100644 > index 0000000000..e9365d6832 > --- /dev/null > +++ b/IntelFsp2Pkg/FspSecCore/X64/FspApiEntryI.nasm > @@ -0,0 +1,44 @@ > +;; @file > +; Provide FSP API entry points. > +; > +; Copyright (c) 2022, Intel Corporation. All rights reserved.
> +; SPDX-License-Identifier: BSD-2-Clause-Patent > +;; > + > + SECTION .text > + > +; > +; Following functions will be provided in C > +; > +extern ASM_PFX(FspApiCommon) > + > +;-----------------------------------------------------------------------= ----- > +; FspApiCommonContinue API > +; > +; This is the FSP API common entry point to resume the FSP execution > +; > +;-----------------------------------------------------------------------= ----- > +global ASM_PFX(FspApiCommonContinue) > +ASM_PFX(FspApiCommonContinue): > + jmp $ > + > +;-----------------------------------------------------------------------= ----- > +; FspSmmInit API > +; > +; This FSP API will notify the FSP about the different phases in the boo= t > +; process > +; > +;-----------------------------------------------------------------------= ----- > +global ASM_PFX(FspSmmInitApi) > +ASM_PFX(FspSmmInitApi): > + mov eax, 7 ; FSP_API_INDEX.FspSmmInitApiIndex This is a bug. It should be: mov rax, 7 ; FSP_API_INDEX.FspSmmInitApiIndex Note that IntelFsp2Pkg/FspSecCore/X64/FspApiEntryCommon.nasm compares ApiIn= dex numbers using rax, so it is important to make sure that the upper 32-bi= ts are zero: https://github.com/tianocore/edk2/blob/c966204049f3d5dae6d5e587ddc298c68414= 2c5c/IntelFsp2Pkg/FspSecCore/X64/FspApiEntryCommon.nasm#L65 > + jmp ASM_PFX(FspApiCommon) > + > +;-----------------------------------------------------------------------= ----- > +; Module Entrypoint API > +;-----------------------------------------------------------------------= ----- > +global ASM_PFX(_ModuleEntryPoint) > +ASM_PFX(_ModuleEntryPoint): > + jmp $ > + ; Add reference to APIs so that it will not be optimized by compiler > + jmp ASM_PFX(FspSmmInitApi) > diff --git a/IntelFsp2Pkg/Include/FspEas/FspApi.h b/IntelFsp2Pkg/Include/= FspEas/FspApi.h > index b36bc2b9ae..1d6c2fb63d 100644 > --- a/IntelFsp2Pkg/Include/FspEas/FspApi.h > +++ b/IntelFsp2Pkg/Include/FspEas/FspApi.h > @@ -135,18 +135,18 @@ typedef struct { > /// > /// Revision of the structure is 2 for this version of the specificati= on. > /// > - UINT8 Revision; > - UINT8 Reserved[3]; > + UINT8 Revision; > + UINT8 Reserved[3]; Any reason for these whitespace changes? It looks worse than before. > /// > /// Length of the structure in bytes. The current value for this field= is 32. > /// > - UINT32 Length; > + UINT32 Length; Any reason for this whitespace change? It looks worse than before. > /// > /// FspDebugHandler Optional debug handler for the bootloader to recei= ve debug messages > /// occurring during FSP execution. > /// > - EFI_PHYSICAL_ADDRESS FspDebugHandler; > - UINT8 Reserved1[16]; > + EFI_PHYSICAL_ADDRESS FspDebugHandler; > + UINT8 Reserved1[16]; Any reason for these whitespace changes? It looks worse than before. > } FSPT_ARCH2_UPD; > =20 > /// > @@ -197,37 +197,37 @@ typedef struct { > /// > /// Revision of the structure is 3 for this version of the specificati= on. > /// > - UINT8 Revision; > - UINT8 Reserved[3]; > + UINT8 Revision; > + UINT8 Reserved[3]; Any reason for these whitespace changes? It looks worse than before. > /// > /// Length of the structure in bytes. The current value for this field= is 64. > /// > - UINT32 Length; > + UINT32 Length; Any reason for this whitespace change? It looks worse than before. > /// > /// Pointer to the temporary stack base address to be > /// consumed inside FspMemoryInit() API. > /// > - EFI_PHYSICAL_ADDRESS StackBase; > + EFI_PHYSICAL_ADDRESS StackBase; Any reason for this whitespace change? It looks worse than before. > /// > /// Temporary stack size to be consumed inside > /// FspMemoryInit() API. > /// > - UINT64 StackSize; > + UINT64 StackSize; Any reason for this whitespace change? It looks worse than before. > /// > /// Size of memory to be reserved by FSP below "top > /// of low usable memory" for bootloader usage. > /// > - UINT32 BootLoaderTolumSize; > + UINT32 BootLoaderTolumSize; Any reason for this whitespace change? It looks worse than before. > /// > /// Current boot mode. > /// > - UINT32 BootMode; > + UINT32 BootMode; Any reason for this whitespace change? It looks worse than before. > /// > /// Optional event handler for the bootloader to be informed of events= occurring during FSP execution. > /// This value is only valid if Revision is >=3D 2. > /// > - EFI_PHYSICAL_ADDRESS FspEventHandler; > - UINT8 Reserved1[24]; > + EFI_PHYSICAL_ADDRESS FspEventHandler; > + UINT8 Reserved1[24]; Any reason for these whitespace changes? It looks worse than before. > } FSPM_ARCH2_UPD; > =20 > /// > @@ -266,18 +266,18 @@ typedef struct { > /// > /// Revision of the structure is 2 for this version of the specificati= on. > /// > - UINT8 Revision; > - UINT8 Reserved[3]; > + UINT8 Revision; > + UINT8 Reserved[3]; Any reason for these whitespace changes? It looks worse than before. > /// > /// Length of the structure in bytes. The current value for this field= is 32. > /// > - UINT32 Length; > + UINT32 Length; Any reason for this whitespace change? It looks worse than before. > /// > /// FspEventHandler Optional event handler for the bootloader to be in= formed of events > /// occurring during FSP execution. > /// > - EFI_PHYSICAL_ADDRESS FspEventHandler; > - UINT8 Reserved1[16]; > + EFI_PHYSICAL_ADDRESS FspEventHandler; > + UINT8 Reserved1[16]; Any reason for these whitespace changes? It looks worse than before. > } FSPS_ARCH2_UPD; > =20 > /// > @@ -609,4 +609,23 @@ EFI_STATUS > IN FSP_MULTI_PHASE_PARAMS *MultiPhaseSiInitParamPtr > ); > =20 > +/** > + This FSP API initializes SMM and provide any OS runtime silicon servic= es, > + including Reliability, Availability, and Serviceability (RAS) features= implemented by the CPU. > + > + @param[in] FspiUpdDataPtr Pointer to the FSPI_UPD data structure. > + If NULL, FSP will use the default parame= ters. > + > + @retval EFI_SUCCESS FSP execution environment was init= ialized successfully. > + @retval EFI_INVALID_PARAMETER Input parameters are invalid. > + @retval EFI_UNSUPPORTED The FSP calling conditions were no= t met. > + @retval EFI_DEVICE_ERROR FSP initialization failed. > + @retval FSP_STATUS_RESET_REQUIREDx A reset is required. These status = codes will not be returned during S3. > +**/ > +typedef > +EFI_STATUS > +(EFIAPI *FSP_SMM_INIT)( > + IN VOID *FspiUpdDataPtr > + ); > + > #endif > diff --git a/IntelFsp2Pkg/Include/FspGlobalData.h b/IntelFsp2Pkg/Include/= FspGlobalData.h > index 445540abfa..697b20ed4c 100644 > --- a/IntelFsp2Pkg/Include/FspGlobalData.h > +++ b/IntelFsp2Pkg/Include/FspGlobalData.h > @@ -10,9 +10,9 @@ > =20 > #include > =20 > -#define FSP_IN_API_MODE 0 > -#define FSP_IN_DISPATCH_MODE 1 > -#define FSP_GLOBAL_DATA_VERSION 1 > +#define FSP_IN_API_MODE 0 > +#define FSP_IN_DISPATCH_MODE 1 > +#define FSP_GLOBAL_DATA_VERSION 1 > =20 > #pragma pack(1) > =20 > @@ -24,16 +24,17 @@ typedef enum { > TempRamExitApiIndex, > FspSiliconInitApiIndex, > FspMultiPhaseSiInitApiIndex, > + FspSmmInitApiIndex, > FspApiIndexMax > } FSP_API_INDEX; > =20 > typedef struct { > - VOID *DataPtr; > - UINTN MicrocodeRegionBase; > - UINTN MicrocodeRegionSize; > - UINTN CodeRegionBase; > - UINTN CodeRegionSize; > - UINTN Reserved; > + VOID *DataPtr; > + UINTN MicrocodeRegionBase; > + UINTN MicrocodeRegionSize; > + UINTN CodeRegionBase; > + UINTN CodeRegionSize; > + UINTN Reserved; > } FSP_PLAT_DATA; > =20 > #define FSP_GLOBAL_DATA_SIGNATURE SIGNATURE_32 ('F', 'S', 'P', 'D= ') > @@ -41,28 +42,28 @@ typedef struct { > #define FSP_PERFORMANCE_DATA_TIMER_MASK 0xFFFFFFFFFFFFFF > =20 > typedef struct { > - UINT32 Signature; > - UINT8 Version; > - UINT8 Reserved1[3]; > + UINT32 Signature; > + UINT8 Version; > + UINT8 Reserved1[3]; > /// > /// Offset 0x08 > /// > - UINTN CoreStack; > - UINTN Reserved2; > + UINTN CoreStack; > + UINTN Reserved2; > /// > /// IA32: Offset 0x10; X64: Offset 0x18 > /// > - UINT32 StatusCode; > - UINT8 ApiIdx; > + UINT32 StatusCode; > + UINT8 ApiIdx; > /// > /// 0: FSP in API mode; 1: FSP in DISPATCH mode > /// > - UINT8 FspMode; > - UINT8 OnSeparateStack; > - UINT8 Reserved3; > - UINT32 NumberOfPhases; > - UINT32 PhasesExecuted; > - UINT32 Reserved4[8]; > + UINT8 FspMode; > + UINT8 OnSeparateStack; > + UINT8 Reserved3; > + UINT32 NumberOfPhases; > + UINT32 PhasesExecuted; > + UINT32 Reserved4[8]; > /// > /// IA32: Offset 0x40; X64: Offset 0x48 > /// Start of UINTN and pointer section > @@ -75,21 +76,23 @@ typedef struct { > VOID *TempRamInitUpdPtr; > VOID *MemoryInitUpdPtr; > VOID *SiliconInitUpdPtr; > + VOID *SmmInitUpdPtr; > /// > - /// IA32: Offset 0x64; X64: Offset 0x90 > + /// IA32: Offset 0x68; X64: Offset 0x98 > /// To store function parameters pointer > /// so it can be retrieved after stack switched. > /// > VOID *FunctionParameterPtr; > FSP_INFO_HEADER *FspInfoHeader; > VOID *UpdDataPtr; > + UINTN Reserved5; > /// > /// End of UINTN and pointer section > /// > - UINT8 Reserved5[16]; > + UINT8 Reserved6[16]; > UINT32 PerfSig; > UINT16 PerfLen; > - UINT16 Reserved6; > + UINT16 Reserved7; > UINT32 PerfIdx; > UINT64 PerfData[32]; > } FSP_GLOBAL_DATA; > diff --git a/IntelFsp2Pkg/Include/Guid/FspHeaderFile.h b/IntelFsp2Pkg/Inc= lude/Guid/FspHeaderFile.h > index c660defac3..c7fb63168f 100644 > --- a/IntelFsp2Pkg/Include/Guid/FspHeaderFile.h > +++ b/IntelFsp2Pkg/Include/Guid/FspHeaderFile.h > @@ -26,13 +26,13 @@ > =20 > #define FSP_INFO_HEADER_SIGNATURE SIGNATURE_32 ('F', 'S', 'P', 'H') > =20 > -#define IMAGE_ATTRIBUTE_GRAPHICS_SUPPORT BIT0 > -#define IMAGE_ATTRIBUTE_DISPATCH_MODE_SUPPORT BIT1 > -#define IMAGE_ATTRIBUTE_64BIT_MODE_SUPPORT BIT2 > -#define FSP_IA32 0 > -#define FSP_X64 1 > +#define IMAGE_ATTRIBUTE_GRAPHICS_SUPPORT BIT0 > +#define IMAGE_ATTRIBUTE_DISPATCH_MODE_SUPPORT BIT1 > +#define IMAGE_ATTRIBUTE_64BIT_MODE_SUPPORT BIT2 > +#define FSP_IA32 0 > +#define FSP_X64 1 > =20 > -#pragma pack(1) > + #pragma pack(1) Why add an indent to the #pragma line? I'm pretty sure that edk2 coding sty= le guidelines don't require that and it certainly looks worse than before. > =20 > /// > /// FSP Information Header as described in FSP v2.0 Spec section 5.1.1. > @@ -159,6 +159,14 @@ typedef struct { > /// Byte 0x4E: Reserved4. > /// > UINT16 Reserved4; > + /// > + /// Byte 0x50: Offset for the API for the Multi-Phase memory initializ= ation. > + /// > + UINT32 FspMultiPhaseMemInitEntryOffset; > + /// > + /// Byte 0x54: Offset for the API to initialize SMM. > + /// > + UINT32 FspSmmInitEntryOffset; > } FSP_INFO_HEADER; > =20 > /// > @@ -240,7 +248,7 @@ typedef struct { > // UINT32 PatchData[]; > } FSP_PATCH_TABLE; > =20 > -#pragma pack() > + #pragma pack() Why add an indent to the #pragma line? I'm pretty sure that edk2 coding sty= le guidelines don't require that and it certainly looks worse than before. > =20 > extern EFI_GUID gFspHeaderFileGuid; > =20 > diff --git a/IntelFsp2Pkg/IntelFsp2Pkg.dsc b/IntelFsp2Pkg/IntelFsp2Pkg.ds= c > index 7cf7e88245..b2d7867880 100644 > --- a/IntelFsp2Pkg/IntelFsp2Pkg.dsc > +++ b/IntelFsp2Pkg/IntelFsp2Pkg.dsc > @@ -68,6 +68,7 @@ > IntelFsp2Pkg/FspSecCore/FspSecCoreT.inf > IntelFsp2Pkg/FspSecCore/FspSecCoreM.inf > IntelFsp2Pkg/FspSecCore/FspSecCoreS.inf > + IntelFsp2Pkg/FspSecCore/FspSecCoreI.inf > IntelFsp2Pkg/FspSecCore/Fsp22SecCoreS.inf > IntelFsp2Pkg/FspNotifyPhase/FspNotifyPhasePeim.inf > =20 > diff --git a/IntelFsp2Pkg/Tools/GenCfgOpt.py b/IntelFsp2Pkg/Tools/GenCfgO= pt.py > index c4fb1f1bb2..128b896592 100644 > --- a/IntelFsp2Pkg/Tools/GenCfgOpt.py > +++ b/IntelFsp2Pkg/Tools/GenCfgOpt.py > @@ -953,8 +953,8 @@ EndList > return NoFileChange > =20 > def CreateSplitUpdTxt (self, UpdTxtFile): > - GuidList =3D ['FSP_T_UPD_TOOL_GUID','FSP_M_UPD_TOOL_GUID','FSP_S= _UPD_TOOL_GUID'] > - SignatureList =3D ['0x545F', '0x4D5F','0x535F'] # _T, _M= , and _S signature for FSPT, FSPM, FSPS > + GuidList =3D ['FSP_T_UPD_TOOL_GUID','FSP_M_UPD_TOOL_GUID','FSP_S= _UPD_TOOL_GUID','FSP_I_UPD_TOOL_GUID'] > + SignatureList =3D ['0x545F', '0x4D5F','0x535F','0x495F'] = # _T, _M, _S and _I signature for FSPT, FSPM, FSPS, FSPI > for Index in range(len(GuidList)): > UpdTxtFile =3D '' > FvDir =3D self._FvDir > @@ -1288,19 +1288,21 @@ EndList > Chars.append(chr(Value & 0xFF)) > Value =3D Value >> 8 > SignatureStr =3D ''.join(Chars) > - # Signature will be _T / _M / _S for FSPT / FSPM / FSPS a= ccordingly > + # Signature will be _T / _M / _S / _I for FSPT / FSPM / F= SPS /FSPI accordingly > if '_T' in SignatureStr[6:6+2]: > TxtBody.append("#define FSPT_UPD_SIGNATURE = %s /* '%s' */\n\n" % (Item['value'], SignatureStr)) > elif '_M' in SignatureStr[6:6+2]: > TxtBody.append("#define FSPM_UPD_SIGNATURE = %s /* '%s' */\n\n" % (Item['value'], SignatureStr)) > elif '_S' in SignatureStr[6:6+2]: > TxtBody.append("#define FSPS_UPD_SIGNATURE = %s /* '%s' */\n\n" % (Item['value'], SignatureStr)) > + elif '_I' in SignatureStr[6:6+2]: > + TxtBody.append("#define FSPI_UPD_SIGNATURE = %s /* '%s' */\n\n" % (Item['value'], SignatureStr)) > TxtBody.append("\n") > =20 > for Region in ['UPD']: > UpdOffsetTable =3D [] > - UpdSignature =3D ['0x545F', '0x4D5F', '0x535F'] #['_T', '_= M', '_S'] signature for FSPT, FSPM, FSPS > - UpdStructure =3D ['FSPT_UPD', 'FSPM_UPD', 'FSPS_UPD'] > + UpdSignature =3D ['0x545F', '0x4D5F', '0x535F', '0x495F'] = #['_T', '_M', '_S', '_I'] signature for FSPT, FSPM, FSPS, FSPI > + UpdStructure =3D ['FSPT_UPD', 'FSPM_UPD', 'FSPS_UPD', 'FSPI_= UPD'] > for Item in self._CfgItemList: > if Item["cname"] =3D=3D 'Signature' and Item["value"][0:= 6] in UpdSignature: > Item["offset"] =3D 0 # re-initialize offset to 0 whe= n new UPD structure starting > @@ -1393,11 +1395,12 @@ EndList > HeaderTFileName =3D 'FsptUpd.h' > HeaderMFileName =3D 'FspmUpd.h' > HeaderSFileName =3D 'FspsUpd.h' > + HeaderIFileName =3D 'FspiUpd.h' > =20 > - UpdRegionCheck =3D ['FSPT', 'FSPM', 'FSPS'] # FSPX_UPD_REGIO= N > - UpdConfigCheck =3D ['FSP_T', 'FSP_M', 'FSP_S'] # FSP_X_CONFIG, = FSP_X_TEST_CONFIG, FSP_X_RESTRICTED_CONFIG > - UpdSignatureCheck =3D ['FSPT_UPD_SIGNATURE', 'FSPM_UPD_SIGNATURE= ', 'FSPS_UPD_SIGNATURE'] > - ExcludedSpecificUpd =3D ['FSPT_ARCH_UPD', 'FSPM_ARCH_UPD', 'FSPS= _ARCH_UPD'] > + UpdRegionCheck =3D ['FSPT', 'FSPM', 'FSPS', 'FSPI'] # FSPX_U= PD_REGION > + UpdConfigCheck =3D ['FSP_T', 'FSP_M', 'FSP_S', 'FSP_I'] # FSP_X= _CONFIG, FSP_X_TEST_CONFIG, FSP_X_RESTRICTED_CONFIG > + UpdSignatureCheck =3D ['FSPT_UPD_SIGNATURE', 'FSPM_UPD_SIGNATURE= ', 'FSPS_UPD_SIGNATURE', 'FSPI_UPD_SIGNATURE'] > + ExcludedSpecificUpd =3D ['FSPT_ARCH_UPD', 'FSPM_ARCH_UPD', 'FSPS= _ARCH_UPD', 'FSPI_ARCH_UPD'] > ExcludedSpecificUpd1 =3D ['FSPT_ARCH2_UPD', 'FSPM_ARCH2_UPD', 'F= SPS_ARCH2_UPD'] > =20 > IncLines =3D [] > @@ -1420,6 +1423,9 @@ EndList > elif UpdRegionCheck[item] =3D=3D 'FSPS': > HeaderFd =3D open(os.path.join(FvDir, HeaderSFileName), = "w") > FileBase =3D os.path.basename(os.path.join(FvDir, Header= SFileName)) > + elif UpdRegionCheck[item] =3D=3D 'FSPI': > + HeaderFd =3D open(os.path.join(FvDir, HeaderIFileName), = "w") > + FileBase =3D os.path.basename(os.path.join(FvDir, Header= IFileName)) > FileName =3D FileBase.replace(".", "_").upper() > HeaderFd.write("%s\n" % (__copyright_h__ % date.today().ye= ar)) > HeaderFd.write("#ifndef __%s__\n" % FileName) > @@ -1696,7 +1702,7 @@ EndList > =20 > =20 > def Usage(): > - print ("GenCfgOpt Version 0.57") > + print ("GenCfgOpt Version 0.58") > print ("Usage:") > print (" GenCfgOpt UPDTXT PlatformDscFile BuildFvDir = [-D Macros]") > print (" GenCfgOpt HEADER PlatformDscFile BuildFvDir InputHFil= e [-D Macros]") > diff --git a/IntelFsp2Pkg/Tools/SplitFspBin.py b/IntelFsp2Pkg/Tools/Split= FspBin.py > index f9151b5afd..317d9c1fa0 100644 > --- a/IntelFsp2Pkg/Tools/SplitFspBin.py > +++ b/IntelFsp2Pkg/Tools/SplitFspBin.py > @@ -1,6 +1,6 @@ > ## @ SplitFspBin.py > # > -# Copyright (c) 2015 - 2021, Intel Corporation. All rights reserved.
> +# Copyright (c) 2015 - 2022, Intel Corporation. All rights reserved.
> # SPDX-License-Identifier: BSD-2-Clause-Patent > # > ## > @@ -492,7 +492,7 @@ class FspImage: > self.FihOffset =3D fihoff > self.Offset =3D offset > self.FvIdxList =3D [] > - self.Type =3D "XTMSXXXXOXXXXXXX"[(fih.ComponentAttribute >>= 12) & 0x0F] > + self.Type =3D "XTMSIXXXXOXXXXXXX"[(fih.ComponentAttribute >= > 12) & 0x0F] > self.PatchList =3D patch > self.PatchList.append(fihoff + 0x1C) > =20 > @@ -869,7 +869,7 @@ def main (): > parser_rebase =3D subparsers.add_parser('rebase', help=3D'rebase a= FSP into a new base address') > parser_rebase.set_defaults(which=3D'rebase') > parser_rebase.add_argument('-f', '--fspbin' , dest=3D'FspBinary', = type=3Dstr, help=3D'FSP binary file path', required =3D True) > - parser_rebase.add_argument('-c', '--fspcomp', choices=3D['t','m','s= ','o'], nargs=3D'+', dest=3D'FspComponent', type=3Dstr, help=3D'FSP compon= ent to rebase', default =3D "['t']", required =3D True) > + parser_rebase.add_argument('-c', '--fspcomp', choices=3D['t','m','s= ','o','i'], nargs=3D'+', dest=3D'FspComponent', type=3Dstr, help=3D'FSP co= mponent to rebase', default =3D "['t']", required =3D True) > parser_rebase.add_argument('-b', '--newbase', dest=3D'FspBase', nar= gs=3D'+', type=3Dstr, help=3D'Rebased FSP binary file name', default =3D ''= , required =3D True) > parser_rebase.add_argument('-o', '--outdir' , dest=3D'OutputDir', = type=3Dstr, help=3D'Output directory path', default =3D '.') > parser_rebase.add_argument('-n', '--outfile', dest=3D'OutputFile', = type=3Dstr, help=3D'Rebased FSP binary file name', default =3D '') > --=20 > 2.35.0.windows.1