From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id A3633D800FD for ; Tue, 30 Jan 2024 19:59:19 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=qOMoh4N5KRqp2TRs2LdMkEUaZMfGqEAzDQdbAft4Dvs=; c=relaxed/simple; d=groups.io; h=ARC-Seal:ARC-Message-Signature:ARC-Authentication-Results:From:To:CC:Subject:Thread-Topic:Thread-Index:Date:Message-ID:References:In-Reply-To:Accept-Language:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20140610; t=1706644758; v=1; b=aXxaVH+WtC+kDK0cgg7iMHMObJvEwJj36SnuNB0nbuoXyqiVQPC7KxHucaYAKr7ZUD8aMJPK ZRhV9LIEVOogyiydGqePtZzleuDCIflCIajfelGPjl04wUu9c9HWYtlr2z2ghvYwWMD+WI3w0Bg iBCNhMsI+jyTdg+IVwtGMO+s= X-Received: by 127.0.0.2 with SMTP id LQK8YY7687511x501gD4KjcX; Tue, 30 Jan 2024 11:59:18 -0800 X-Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) by mx.groups.io with SMTP id smtpd.web11.6475.1706644756975797485 for ; Tue, 30 Jan 2024 11:59:17 -0800 X-IronPort-AV: E=McAfee;i="6600,9927,10969"; a="16773907" X-IronPort-AV: E=Sophos;i="6.05,230,1701158400"; d="scan'208";a="16773907" X-Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jan 2024 11:59:13 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10969"; a="931571033" X-IronPort-AV: E=Sophos;i="6.05,230,1701158400"; d="scan'208";a="931571033" X-Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by fmsmga001.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 30 Jan 2024 11:59:11 -0800 X-Received: from orsmsx611.amr.corp.intel.com (10.22.229.24) by ORSMSX603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Tue, 30 Jan 2024 11:59:10 -0800 X-Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX611.amr.corp.intel.com (10.22.229.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Tue, 30 Jan 2024 11:59:10 -0800 X-Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35 via Frontend Transport; Tue, 30 Jan 2024 11:59:10 -0800 X-Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.101) 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.2507.35; Tue, 30 Jan 2024 11:59:09 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mC/UZTi64cI25HhABDcWRZT3P4LRUHwndk7kMLdoTcKgE5+yzwEQ5ZDa7H9sfiPH3yvK7q/91jZxp6knwN0m1SpCoV6hVhUPZRlFwMk9DOvLwL/6gRmRxE1gIRWqn9Cy1AJ5oK1Xt9dDitsSwqqEPQTyaA8T6iiuX0GYgBz+zSeazku0zy4EmBWzkiv2qJ+H7+hrVPUSGjvDCzJT7kO3ai/uTjBjrlLa6Lin8TLOoRyof7/eCFZID6I6RZVXPZXYyvPvw5gyweaicdcumLees6qTga2NHsAJLt333NSkMPZ1DYE1Sjm3l5a/+uRUalGR+0MV/M8dRVDOCeIerj0SpQ== 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=6InMCEZsNhqatI3e/+GgAEtKLju8A914ysuGmVGz7hI=; b=DLk3Ci1Mb4TOpvIVlyWi28xBp3HB9Jhof/lF4ngQaxPY5ElCrnVqRKHjHoPKGwVZk8gNLkCdWmwU0NDkJw2CRP8Q+AHM5JucDowsDCoAF7IOAbOjiachTtqY0psjUrTB1+UStzMDYISvZ+rDy7QNS7V1FlKyDTHA1yEqwlRO8D/OuLaFmz4rnQaRCfUPNmsYAbTL/KE02mjEyyAd8XzIqDVZgU9viUnnqt1rD5hEzBpnsejTR7VzcT95PXjLuKhImJjK/Yqnlw+mx4e2Bag+t8wQtQ/8dtHJR1vPty1PoyO13yWi07B/W2lVuagAx/mqrb0X4OFHFzUdAgpNqLoilQ== 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 X-Received: from MW4PR11MB5821.namprd11.prod.outlook.com (2603:10b6:303:184::5) by IA1PR11MB8175.namprd11.prod.outlook.com (2603:10b6:208:44f::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7228.32; Tue, 30 Jan 2024 19:59:06 +0000 X-Received: from MW4PR11MB5821.namprd11.prod.outlook.com ([fe80::7d4f:b2b0:e284:aeff]) by MW4PR11MB5821.namprd11.prod.outlook.com ([fe80::7d4f:b2b0:e284:aeff%5]) with mapi id 15.20.7228.029; Tue, 30 Jan 2024 19:59:06 +0000 From: "Nate DeSimone" To: "Kuo, Ted" , "devel@edk2.groups.io" CC: "Chaganty, Rangasai V" , "Chiu, Chasel" , "Dong, Eric" , "S, Ashraf Ali" , "Duggapu, Chinni B" , Liming Gao Subject: Re: [edk2-devel][edk2-platforms][PATCH v5] MinPlatformPkg: Support SecFspWrapperPlatformSecLib in X64 Thread-Topic: [edk2-devel][edk2-platforms][PATCH v5] MinPlatformPkg: Support SecFspWrapperPlatformSecLib in X64 Thread-Index: AQHaU1AhSVVQ/JPv8kKw51UaIUY9yLDywZ9w Date: Tue, 30 Jan 2024 19:59:05 +0000 Message-ID: References: <50ea862aaa52531b301c71ce52287f1073b384d6.1706600482.git.ted.kuo@intel.com> In-Reply-To: <50ea862aaa52531b301c71ce52287f1073b384d6.1706600482.git.ted.kuo@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MW4PR11MB5821:EE_|IA1PR11MB8175:EE_ x-ms-office365-filtering-correlation-id: 9786b108-09e9-43f2-800e-08dc21cdea2a x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam-message-info: 3HUkc6ybcTNlPQkaRbz4TNn8SrvO54EpO9P+xAtpH7TDoeV+wyJhpNckFfclMsENeUZU27+fHu7fuadsuhAfrZU2x6PdnJ+DVVekeEKw+79vVvYP7ej5UhFtuTwz+K7J2bPsxxReLVhS8onR4f9HsHIdYEAF4fI9XdbQhfwkD/pSLuIs8FowOHl7hm6QixnKTPxnDXftXcbt2yZHw6ip5v/snUs1cwDhf/kbgD1poAXzjh8kCrJ063tN4CMZG2G0ywknG6ZWNwKpxXHbsQg0vtdqPsTsn5nuW0FxpDx7nYE4D4Y98108yc3B+/0tZBnL6peyoMW0XgNOyg+o1hQT6Uv3Wjce9Qcv7Pvw6Gvw26Fr1bCvaq1hhP1iWqJBuYW21YL3aog5uPydnnXYh0lTMTfKDaB5MRPPvkBFoiNB62pWJ2chBU+WeILFAJzGEH31rvUrJdu6DalYnzOtFDdISLnO/zjsadMtuNqGlt8oaQ5Zf50XtWUYXuZ5nfwrNdkbwOyDYrNPeNvN5hF1g2DSHP3ng0vCiDuI+3TSxjemr1A67//PSnnBO8bea78QlhflggDBrY902mFhFtuLKAQSfyzxYK0gjm1WH+GCNbqDufehvi11/0/2I8Zw1u27IKLd6YOErvrJ3HzVaYeGtVQ+PSELPuv1ICYMKtq/xFL8L8cVnGQWnjh+eVuLnq6M6zNA5tku0sSCrZCrL0qqjJoBkw== x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?M2qCDSIR85mtraZNv3s/K65MavfPlbd6e/avja36Z2ZsV6wv6QLFqYARk2Ym?= =?us-ascii?Q?5LzqkBnJQB3ubwAX8dXAQmJbOp6OYsqx3eKsg67UuNprJGApxiA/MsDuZ0DV?= =?us-ascii?Q?PjVltpfZfAulLRSO49ymnp1Q9uzqvd+fIeUYqHjRV1tGHSeEWPRpfUVsFeNk?= =?us-ascii?Q?/7A0xH6+7uv3VYMgi7wPktr/Fi+miFM8FIA7zFAaVbEHByc1E9mIiI5kYNyg?= =?us-ascii?Q?b1daXUSkneiN4BWLYB4miqiAvxuJebkuymvr3iRFX3WKrMT/D2YVWJilCoOM?= =?us-ascii?Q?YEdqNN0Mo8UzPIvSV7gOCGpbPco+agCXXkQbxIH++r7SPvH/Ssm/w40bvSx5?= =?us-ascii?Q?//y6aQO/idzmrcyGEKFJmb6JXXcVWYAE78oh/l/yMOf54ngkecJxWJCr859L?= =?us-ascii?Q?4190ctuJJaKS4zPrITRrYftunxFzeUHTb9xWc3i/BaNQY4qzGPWjYYg1ZY7l?= =?us-ascii?Q?L4rHkqZZJDhdWADBTOPXQ7poT9qtxxUjJWQ04EWNqpbhjx+kdES1MOZoZJO2?= =?us-ascii?Q?Wl871JsqYQQTVo4NS/Nnqqxc/74aJ7JhQIwoC7xw/+zrwUGnTVAceTBFHcfj?= =?us-ascii?Q?gWBLKkS3q+FOB0YZQs6wpGdh1uEAa6TClZnI5/Al6z93GGrxwfAgnhr+rqKf?= =?us-ascii?Q?BSGldr1nHGgGNp1VtOgmszR1tbCyp6fVi4NRQK6iUejk9+rt+EBT7HJRzSPd?= =?us-ascii?Q?EbL8l0X4464Zqwg2TVdIsqUNBu4I/y0IwTEIVtEVNoIdcImSmUYoIVlTw/3U?= =?us-ascii?Q?BubY9P7dT7SzBPFY+qNpGouukv/jnEUS2SFlETvnze28cd+RbrdWj/4wDiji?= =?us-ascii?Q?pT2HuLZbd2k7m7V4CyZFBLpW6evEhmFTTra/+U1mSnijeGrX238hX9WWWJQq?= =?us-ascii?Q?VTAzCUiAQk5ODPWCkd6N3XmImgyq+bkFH/CBpGQMHcwbIIrVhJUE85+H6gAm?= =?us-ascii?Q?ARnBnm9YTunaJs26FjKplyW5HoiTHdmsfBQ4bRSvp5A9/4F46FMcScFWXnS2?= =?us-ascii?Q?sx3YyQ0xLp/IwhY4p/nvOUd1FbSQK4BuEiodfXz+JzBPCG/g8jgtiMqzNUFP?= =?us-ascii?Q?VRta5pjyckNOIuls4ajOJymTokdI9apLhhDr0AVBCv78OeQOGhBbLJ2gwHnV?= =?us-ascii?Q?PNoryvOApiLlbftHhslpstqIyg90BUIXsyO5UOEhRZJ/29tPzSiqgDNDmnrt?= =?us-ascii?Q?a9zEtA3NIz2YQ/oYM8dzZpQjseAfEpXNgd4aAz2C/Gd+t6wY7+Ly7OJemR8S?= =?us-ascii?Q?UM/SmyIV1nR3HZWwzPGVBjXQPhRpQF0kG4uh/NIey91y1L0TQNBp05rOW1wx?= =?us-ascii?Q?m7XYOl5rxT+FUyaVMMtRVpYNfkHaVnGCp3ANOyl+Fx0YOXOUofmmtT+D4zDj?= =?us-ascii?Q?yp2L2oj6Nb+XRXWZchRR/HeNRlHv1iYcET7YNWmsf2PeCrqPdooa1ydBb69p?= =?us-ascii?Q?ZuSowb2JbXiE5HxKS5G9XWSSdPUMkQEzL6U0zxa885akmHN3jThXOO1oHi0U?= =?us-ascii?Q?Xz3v0BlIWEExU7mKRgZXHdigyuJYoGbUSWrbN9Aony66FcSbNVXzzEKtBUJR?= =?us-ascii?Q?n0H6A4aBTpll/qJFrzVlaeMCxnvBMpdi6pKYHCkgqMmFvIgLJiPqbj0M7nG+?= =?us-ascii?Q?WQ=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: 9786b108-09e9-43f2-800e-08dc21cdea2a X-MS-Exchange-CrossTenant-originalarrivaltime: 30 Jan 2024 19:59:05.9835 (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: pK6VHtg6G+gpTbjLFwNg7C45agV+Bl2Z7u/9WtxWM3G3ORYxcbGza4Td47T9kUkaLSc3oITaFAzn+ZydfaesVJxDs3fYh/NuUkQFVcZRBRA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR11MB8175 X-OriginatorOrg: intel.com Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,nathaniel.l.desimone@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: ZO4LgIaE5DTyLx6ysAI6VP8ex7686176AA= Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=aXxaVH+W; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=intel.com (policy=none); arc=reject ("signature check failed: fail, {[1] = sig:microsoft.com:reject}") Hi Ted, Feedback inline. Here is the summary: 1. Please add: #if defined (MDE_CPU_IA32) && FixedPcdGetBool(PcdFspWrapperResetVectorInFsp= ) =3D=3D TRUE #error "PcdFspWrapperResetVectorInFsp =3D=3D TRUE only supported for X64 bu= ilds" #endif To SecRamInitData.c, so that any attempt to use the invalid configuration w= ill fail to compile. 2. Make the comments for PcdFspWrapperResetVectorInFsp clearer. Thanks, Nate > -----Original Message----- > From: Kuo, Ted > Sent: Monday, January 29, 2024 11:44 PM > To: devel@edk2.groups.io > Cc: Chaganty, Rangasai V ; Chiu, Chasel > ; Desimone, Nathaniel L > ; Dong, Eric ; S, > Ashraf Ali ; Duggapu, Chinni B > ; Liming Gao > Subject: [edk2-devel][edk2-platforms][PATCH v5] MinPlatformPkg: Support > SecFspWrapperPlatformSecLib in X64 >=20 > https://bugzilla.tianocore.org/show_bug.cgi?id=3D4623 > 1.Added PeiCoreEntry.nasm, SecEntry.nasm and Stack.nasm for X64. > 2.Made changes in common files to support both IA32 and X64. > 3.Added the PCDs below for FSP-T UPD revisions and reset vector in FSP. > - PcdFspWrapperResetVectorInFsp > - PcdFspWrapperBfvforResetVectorInFsp > - PcdFsptUpdHeaderRevision > - PcdFsptArchUpdRevision >=20 > Cc: Sai Chaganty > Cc: Chasel Chiu > Cc: Nate DeSimone > Cc: Eric Dong > Cc: Ashraf Ali S > Cc: Chinni B Duggapu > Cc: Liming Gao > Signed-off-by: Ted Kuo > --- > .../SecFspWrapperPlatformSecLib/FsptCoreUpd.h | 25 ++- > .../Ia32/SecEntry.nasm | 4 +- > .../SecFspWrapperPlatformSecLib.inf | 12 +- > .../SecGetPerformance.c | 11 +- > .../SecPlatformInformation.c | 8 +- > .../SecRamInitData.c | 73 ++++-- > .../X64/PeiCoreEntry.nasm | 207 ++++++++++++++++++ > .../X64/SecEntry.nasm | 199 +++++++++++++++++ > .../X64/Stack.nasm | 72 ++++++ > .../Ia32 =3D> Include}/Fsp.h | 6 +- > .../Intel/MinPlatformPkg/MinPlatformPkg.dec | 22 +- > 11 files changed, 607 insertions(+), 32 deletions(-) > create mode 100644 Platform/Intel/MinPlatformPkg/FspWrapper/Library/SecF= spWrapperPlatformSecLib/X64/PeiCoreEntry.nasm > create mode 100644 Platform/Intel/MinPlatformPkg/FspWrapper/Library/SecF= spWrapperPlatformSecLib/X64/SecEntry.nasm > create mode 100644 Platform/Intel/MinPlatformPkg/FspWrapper/Library/SecF= spWrapperPlatformSecLib/X64/Stack.nasm > rename Platform/Intel/MinPlatformPkg/{FspWrapper/Library/SecFspWrapperPl= atformSecLib/Ia32 =3D> Include}/Fsp.h (79%) >=20 > diff --git a/Platform/Intel/MinPlatformPkg/FspWrapper/Library/SecFspWrapp= erPlatformSecLib/FsptCoreUpd.h b/Platform/Intel/MinPlatformPkg/FspWrapper/L= ibrary/SecFspWrapperPlatformSecLib/FsptCoreUpd.h > index 7c0f605b92..24c18f25b8 100644 > --- a/Platform/Intel/MinPlatformPkg/FspWrapper/Library/SecFspWrapperPlatf= ormSecLib/FsptCoreUpd.h > +++ b/Platform/Intel/MinPlatformPkg/FspWrapper/Library/SecFspWrapperPlatf= ormSecLib/FsptCoreUpd.h > @@ -1,6 +1,6 @@ > /** @file > =20 > -Copyright (c) 2017, Intel Corporation. All rights reserved.
> +Copyright (c) 2017 - 2024, Intel Corporation. All rights reserved.
> SPDX-License-Identifier: BSD-2-Clause-Patent > =20 > **/ > @@ -10,6 +10,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent > =20 > #pragma pack(1) > =20 > +#if FixedPcdGet8 (PcdFsptArchUpdRevision) <=3D 1 > /** Fsp T Core UPD > **/ > typedef struct { > @@ -34,6 +35,28 @@ typedef struct { > **/ > UINT8 Reserved[16]; > } FSPT_CORE_UPD; > +#else > +/** Fsp T Core UPD > +**/ > +typedef struct { > + > +/** Offset 0x0040 > +**/ > + EFI_PHYSICAL_ADDRESS MicrocodeRegionBase; > + > +/** Offset 0x0048 > +**/ > + UINT64 MicrocodeRegionSize; > + > +/** Offset 0x0050 > +**/ > + EFI_PHYSICAL_ADDRESS CodeRegionBase; > + > +/** Offset 0x0058 > +**/ > + UINT64 CodeRegionSize; > +} FSPT_CORE_UPD; > +#endif > =20 > #pragma pack() > =20 > diff --git a/Platform/Intel/MinPlatformPkg/FspWrapper/Library/SecFspWrapp= erPlatformSecLib/Ia32/SecEntry.nasm b/Platform/Intel/MinPlatformPkg/FspWrap= per/Library/SecFspWrapperPlatformSecLib/Ia32/SecEntry.nasm > index 7f6d771e41..0b3f343991 100644 > --- a/Platform/Intel/MinPlatformPkg/FspWrapper/Library/SecFspWrapperPlatf= ormSecLib/Ia32/SecEntry.nasm > +++ b/Platform/Intel/MinPlatformPkg/FspWrapper/Library/SecFspWrapperPlatf= ormSecLib/Ia32/SecEntry.nasm > @@ -1,6 +1,6 @@ > ;-----------------------------------------------------------------------= ------- > ; > -; Copyright (c) 2019, Intel Corporation. All rights reserved.
> +; Copyright (c) 2019 - 2024, Intel Corporation. All rights reserved.
> ; SPDX-License-Identifier: BSD-2-Clause-Patent > ; Module Name: > ; > @@ -13,7 +13,7 @@ > ; > ;-----------------------------------------------------------------------= ------- > =20 > -#include "Fsp.h" > +#include > =20 > SECTION .text > =20 > diff --git a/Platform/Intel/MinPlatformPkg/FspWrapper/Library/SecFspWrapp= erPlatformSecLib/SecFspWrapperPlatformSecLib.inf b/Platform/Intel/MinPlatfo= rmPkg/FspWrapper/Library/SecFspWrapperPlatformSecLib/SecFspWrapperPlatformS= ecLib.inf > index 2e0d67eae4..e85243c6e3 100644 > --- a/Platform/Intel/MinPlatformPkg/FspWrapper/Library/SecFspWrapperPlatf= ormSecLib/SecFspWrapperPlatformSecLib.inf > +++ b/Platform/Intel/MinPlatformPkg/FspWrapper/Library/SecFspWrapperPlatf= ormSecLib/SecFspWrapperPlatformSecLib.inf > @@ -1,7 +1,7 @@ > ## @file > # Provide FSP wrapper platform sec related function. > # > -# Copyright (c) 2017 - 2021, Intel Corporation. All rights reserved. > +# Copyright (c) 2017 - 2024, Intel Corporation. All rights reserved. > # > # SPDX-License-Identifier: BSD-2-Clause-Patent > # > @@ -47,7 +47,11 @@ > Ia32/SecEntry.nasm > Ia32/PeiCoreEntry.nasm > Ia32/Stack.nasm > - Ia32/Fsp.h > + > +[Sources.X64] > + X64/SecEntry.nasm > + X64/PeiCoreEntry.nasm > + X64/Stack.nasm > =20 > ########################################################################= ######## > # > @@ -96,3 +100,7 @@ > gIntelFsp2WrapperTokenSpaceGuid.PcdFspmBaseAddress ##= CONSUMES > gIntelFsp2WrapperTokenSpaceGuid.PcdFspModeSelection ##= CONSUMES > gMinPlatformPkgTokenSpaceGuid.PcdFspDispatchModeUseFspPeiMain ##= CONSUMES > + gMinPlatformPkgTokenSpaceGuid.PcdFspWrapperResetVectorInFsp ##= CONSUMES > + gMinPlatformPkgTokenSpaceGuid.PcdFspWrapperBfvforResetVectorInFsp ##= CONSUMES > + gMinPlatformPkgTokenSpaceGuid.PcdFsptUpdHeaderRevision ##= CONSUMES > + gMinPlatformPkgTokenSpaceGuid.PcdFsptArchUpdRevision ##= CONSUMES > diff --git a/Platform/Intel/MinPlatformPkg/FspWrapper/Library/SecFspWrapp= erPlatformSecLib/SecGetPerformance.c b/Platform/Intel/MinPlatformPkg/FspWra= pper/Library/SecFspWrapperPlatformSecLib/SecGetPerformance.c > index ac2deeabec..1699bd9710 100644 > --- a/Platform/Intel/MinPlatformPkg/FspWrapper/Library/SecFspWrapperPlatf= ormSecLib/SecGetPerformance.c > +++ b/Platform/Intel/MinPlatformPkg/FspWrapper/Library/SecFspWrapperPlatf= ormSecLib/SecGetPerformance.c > @@ -1,7 +1,7 @@ > /** @file > Sample to provide SecGetPerformance function. > =20 > -Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.
> +Copyright (c) 2017 - 2024, Intel Corporation. All rights reserved.
> SPDX-License-Identifier: BSD-2-Clause-Patent > =20 > **/ > @@ -58,6 +58,7 @@ SecGetPerformance ( > if (EFI_ERROR (Status)) { > return EFI_NOT_FOUND; > } > + > // > // |--------------| <- TopOfTemporaryRam - BL > // | List Ptr | > @@ -77,12 +78,12 @@ SecGetPerformance ( > // | TSC[31:00] | > // |--------------| > // > - TopOfTemporaryRam =3D (UINTN) TopOfTemporaryRamPpi - sizeof (UINT32); > - TopOfTemporaryRam -=3D sizeof (UINT32) * 2; > - Count =3D *(UINT32 *)(TopOfTemporaryRam - sizeof (UINT32))= ; > + TopOfTemporaryRam =3D (UINTN) TopOfTemporaryRamPpi - sizeof (UINTN); > + TopOfTemporaryRam -=3D sizeof(UINTN) * 2; > + Count =3D *(UINT32 *) (UINTN) (TopOfTemporaryRam - sizeof = (UINT32)); > Size =3D Count * sizeof (UINT32); > =20 > - Ticker =3D *(UINT64 *) (TopOfTemporaryRam - sizeof (UINT32) - Size - s= izeof (UINT32) * 2); > + Ticker =3D *(UINT64 *) (UINTN) (TopOfTemporaryRam - sizeof (UINT32) - = Size - sizeof (UINT64)); > Performance->ResetEnd =3D GetTimeInNanoSecond (Ticker); > =20 > return EFI_SUCCESS; > diff --git a/Platform/Intel/MinPlatformPkg/FspWrapper/Library/SecFspWrapp= erPlatformSecLib/SecPlatformInformation.c b/Platform/Intel/MinPlatformPkg/F= spWrapper/Library/SecFspWrapperPlatformSecLib/SecPlatformInformation.c > index 24d55ed838..4cbde95c2d 100644 > --- a/Platform/Intel/MinPlatformPkg/FspWrapper/Library/SecFspWrapperPlatf= ormSecLib/SecPlatformInformation.c > +++ b/Platform/Intel/MinPlatformPkg/FspWrapper/Library/SecFspWrapperPlatf= ormSecLib/SecPlatformInformation.c > @@ -1,7 +1,7 @@ > /** @file > Provide SecPlatformInformation function. > =20 > -Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.
> +Copyright (c) 2017 - 2024, Intel Corporation. All rights reserved.
> SPDX-License-Identifier: BSD-2-Clause-Patent > =20 > **/ > @@ -59,9 +59,9 @@ SecPlatformInformation ( > // This routine copies the BIST information to the buffer pointed by > // PlatformInformationRecord for output. > // > - TopOfTemporaryRam =3D (UINTN) TopOfTemporaryRamPpi - sizeof (UINT32); > - TopOfTemporaryRam -=3D sizeof (UINT32) * 2; > - Count =3D *((UINT32 *)(TopOfTemporaryRam - sizeof (UINT32)= )); > + TopOfTemporaryRam =3D (UINTN) TopOfTemporaryRamPpi - sizeof (UINTN); > + TopOfTemporaryRam -=3D sizeof (UINTN) * 2; > + Count =3D *((UINT32 *)(UINTN) (TopOfTemporaryRam - sizeof = (UINT32))); > Size =3D Count * sizeof (IA32_HANDOFF_STATUS); > =20 > if ((*StructureSize) < (UINT64) Size) { > diff --git a/Platform/Intel/MinPlatformPkg/FspWrapper/Library/SecFspWrapp= erPlatformSecLib/SecRamInitData.c b/Platform/Intel/MinPlatformPkg/FspWrappe= r/Library/SecFspWrapperPlatformSecLib/SecRamInitData.c > index 355d1e6509..49d5302a7b 100644 > --- a/Platform/Intel/MinPlatformPkg/FspWrapper/Library/SecFspWrapperPlatf= ormSecLib/SecRamInitData.c > +++ b/Platform/Intel/MinPlatformPkg/FspWrapper/Library/SecFspWrapperPlatf= ormSecLib/SecRamInitData.c > @@ -1,7 +1,7 @@ > /** @file > Provide TempRamInitParams data. > =20 > -Copyright (c) 2017 - 2021, Intel Corporation. All rights reserved.
> +Copyright (c) 2017 - 2024, Intel Corporation. All rights reserved.
> SPDX-License-Identifier: BSD-2-Clause-Patent > =20 > **/ > @@ -12,25 +12,70 @@ SPDX-License-Identifier: BSD-2-Clause-Patent > Please add the following: #if defined (MDE_CPU_IA32) && FixedPcdGetBool(PcdFspWrapperResetVectorInFsp= ) =3D=3D TRUE #error "PcdFspWrapperResetVectorInFsp =3D=3D TRUE only supported for X64 bu= ilds" #endif So that any attempt to use the invalid configuration will fail to compile. > typedef struct { > FSP_UPD_HEADER FspUpdHeader; > +#if FixedPcdGet8 (PcdFsptArchUpdRevision) =3D=3D 1 > + FSPT_ARCH_UPD FsptArchUpd; > +#elif FixedPcdGet8 (PcdFsptArchUpdRevision) =3D=3D 2 > + FSPT_ARCH2_UPD FsptArchUpd; > +#endif > FSPT_CORE_UPD FsptCoreUpd; > -} FSPT_UPD_CORE_DATA; > + UINT16 UpdTerminator; > +} FSPT_UPD_DATA; > =20 > -GLOBAL_REMOVE_IF_UNREFERENCED CONST FSPT_UPD_CORE_DATA FsptUpdDataPtr = =3D { > +GLOBAL_REMOVE_IF_UNREFERENCED CONST FSPT_UPD_DATA FsptUpdDataPtr =3D { > { > - 0x4450555F54505346, > - 0x00, > - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 > + 0x4450555F54505346, // FSP= -T UPD Header Signature - FSPT_UPD > + FixedPcdGet8 (PcdFsptUpdHeaderRevision), // FSP= -T UPD Header Revision > + { // Res= erved[23] > + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > + 0x00, 0x00, 0x00 > } > }, > +#if FixedPcdGet8 (PcdFsptArchUpdRevision) =3D=3D 1 > { > - FixedPcdGet32 (PcdFlashFvMicrocodeBase) + FixedPcdGet32 (PcdMicrocod= eOffsetInFv), > - FixedPcdGet32 (PcdFlashFvMicrocodeSize) - FixedPcdGet32 (PcdMicrocod= eOffsetInFv), > - 0, // Set CodeRegionBase as 0, so that caching will be 4GB-= (CodeRegionSize > LLCSize ? LLCSize : CodeRegionSize) will be used. > - FixedPcdGet32 (PcdFlashCodeCacheSize), > - { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > + 0x01, // FSP= -T ARCH UPD Revision > + { // Res= erved[3] > + 0x00, 0x00, 0x00 > + }, > + 0x00000020, // Len= gth of FSP-T ARCH UPD > + 0, // Fsp= DebugHandler > + { // Res= erved1[20] > + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 > + } > + }, > +#elif FixedPcdGet8 (PcdFsptArchUpdRevision) =3D=3D 2 > + { > + 0x02, // FSP= -T ARCH2 UPD Revision > + { // Res= erved[3] > + 0x00, 0x00, 0x00 > + }, > + 0x00000020, // Len= gth of FSP-T ARCH2 UPD > + 0, // Fsp= DebugHandler > + { // Res= erved1[16] > + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 > } > - } > + }, > +#endif > +#if FixedPcdGet8 (PcdFsptArchUpdRevision) <=3D 1 > + { > + FixedPcdGet32 (PcdFlashFvMicrocodeBase) + FixedPcdGet32 (PcdMicrocod= eOffsetInFv), // MicrocodeRegionBase > + FixedPcdGet32 (PcdFlashFvMicrocodeSize) - FixedPcdGet32 (PcdMicrocod= eOffsetInFv), // MicrocodeRegionSize > + 0, // Set CodeRegionBase as 0, so that caching will be 4GB-(CodeRegi= onSize > LLCSize ? LLCSize : CodeRegionSize) will be used. > + FixedPcdGet32 (PcdFlashCodeCacheSize), = // CodeRegionSize > + { = // Reserved[16] > + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 > + } > + }, > +#else > + { > + FixedPcdGet32 (PcdFlashFvMicrocodeBase) + FixedPcdGet32 (PcdMicrocod= eOffsetInFv), // MicrocodeRegionBase > + FixedPcdGet32 (PcdFlashFvMicrocodeSize) - FixedPcdGet32 (PcdMicrocod= eOffsetInFv), // MicrocodeRegionSize > + 0, // Set CodeRegionBase as 0, so that caching will be 4GB-(CodeRegi= onSize > LLCSize ? LLCSize : CodeRegionSize) will be used. > + FixedPcdGet32 (PcdFlashCodeCacheSize) = // CodeRegionSize > + }, > +#endif > + 0x55AA > }; > - > diff --git a/Platform/Intel/MinPlatformPkg/FspWrapper/Library/SecFspWrapp= erPlatformSecLib/X64/PeiCoreEntry.nasm b/Platform/Intel/MinPlatformPkg/FspW= rapper/Library/SecFspWrapperPlatformSecLib/X64/PeiCoreEntry.nasm > new file mode 100644 > index 0000000000..6853100a01 > --- /dev/null > +++ b/Platform/Intel/MinPlatformPkg/FspWrapper/Library/SecFspWrapperPlatf= ormSecLib/X64/PeiCoreEntry.nasm > @@ -0,0 +1,207 @@ > +;-----------------------------------------------------------------------= ------- > +; > +; Copyright (c) 2024, Intel Corporation. All rights reserved.
> +; SPDX-License-Identifier: BSD-2-Clause-Patent > +; > +; Module Name: > +; > +; PeiCoreEntry.nasm > +; > +; Abstract: > +; > +; Find and call SecStartup > +; > +;-----------------------------------------------------------------------= ------- > + > +SECTION .text > + > +extern ASM_PFX(SecStartup) > +extern ASM_PFX(PlatformInit) > +extern ASM_PFX(PcdGet64 (PcdFspWrapperBfvforResetVectorInFsp)) > + > +;-----------------------------------------------------------------------= ------ > +; Macro: PUSHA_64 > +; > +; Description: Saves all registers on stack > +; > +; Input: None > +; > +; Output: None > +;-----------------------------------------------------------------------= ------ > +%macro PUSHA_64 0 > + push r8 > + push r9 > + push r10 > + push r11 > + push r12 > + push r13 > + push r14 > + push r15 > + push rax > + push rcx > + push rdx > + push rbx > + push rsp > + push rbp > + push rsi > + push rdi > +%endmacro > + > +;-----------------------------------------------------------------------= ------ > +; Macro: POPA_64 > +; > +; Description: Restores all registers from stack > +; > +; Input: None > +; > +; Output: None > +;-----------------------------------------------------------------------= ------ > +%macro POPA_64 0 > + pop rdi > + pop rsi > + pop rbp > + pop rsp > + pop rbx > + pop rdx > + pop rcx > + pop rax > + pop r15 > + pop r14 > + pop r13 > + pop r12 > + pop r11 > + pop r10 > + pop r9 > + pop r8 > +%endmacro > + > +global ASM_PFX(CallPeiCoreEntryPoint) > +ASM_PFX(CallPeiCoreEntryPoint): > + ; > + ; Per X64 calling convention, make sure RSP is 16-byte aligned. > + ; > + mov rax, rsp > + and rax, 0fh > + sub rsp, rax > + > + ; > + ; Platform init > + ; > + PUSHA_64 > + sub rsp, 20h > + call ASM_PFX(PlatformInit) > + add rsp, 20h > + POPA_64 > + > + ; > + ; Set stack top pointer > + ; > + mov rsp, r8 > + > + ; > + ; Push the hob list pointer > + ; > + push rcx > + > + ; > + ; RBP holds start of BFV passed from Vtf0. Save it to r10. > + ; > + mov r10, rbp > + > + ; > + ; Save the value > + ; RDX: start of range > + ; r8: end of range > + ; > + mov rbp, rsp > + push rdx > + push r8 > + mov r14, rdx > + mov r15, r8 > + > + ; > + ; Push processor count to stack first, then BIST status (AP then BSP) > + ; > + mov eax, 1 > + cpuid > + shr ebx, 16 > + and ebx, 0000000FFh > + cmp bl, 1 > + jae PushProcessorCount > + > + ; > + ; Some processors report 0 logical processors. Effectively 0 =3D 1. > + ; So we fix up the processor count > + ; > + inc ebx > + > +PushProcessorCount: > + sub rsp, 4 > + mov rdi, rsp > + mov DWORD [rdi], ebx > + > + ; > + ; We need to implement a long-term solution for BIST capture. For now= , we just copy BSP BIST > + ; for all processor threads > + ; > + xor ecx, ecx > + mov cl, bl > +PushBist: > + sub rsp, 4 > + mov rdi, rsp > + movd eax, mm0 > + mov DWORD [rdi], eax > + loop PushBist > + > + ; > + ; FSP saves the timestamp of the beginning of firmware execution in mm= 5. > + ; Get the timestamp from mm5 and then push to stack. > + ; > + movq rax, mm5 > + push rax > + > + ; > + ; Per X64 calling convention, make sure RSP is 16-byte aligned. > + ; > + mov rax, rsp > + and rax, 0fh > + sub rsp, rax > + > + ; > + ; Pass entry point of the PEI core > + ; > + mov rdi, 0FFFFFFE0h > + mov edi, DWORD [rdi] > + mov r9, rdi > + > + ; > + ; Pass BFV into the PEI Core > + ; > +#if FixedPcdGet8(PcdFspWrapperResetVectorInFsp) =3D=3D 1 > + ; > + ; Reset Vector and initial SEC core (to initialize Temp Ram) is part o= f FSP-O. > + ; Default UefiCpuPkg Reset Vector locates FSP-O as BFV. However the ac= tual > + ; SEC core that launches PEI is part of another FV. We need to pass th= at FV > + ; as BFV to PEI core. > + ; > + mov r8, ASM_PFX (PcdGet64 (PcdFspWrapperBfvforResetVectorInFsp)) > + mov rcx, QWORD[r8] > + mov r8, rcx > +#else > + mov r8, r10 > +#endif > + > + ; > + ; Pass stack size into the PEI Core > + ; > + mov rcx, r15 ; Start of TempRam > + mov rdx, r14 ; End of TempRam > + > + sub rcx, rdx ; Size of TempRam > + > + ; > + ; Pass Control into the PEI Core > + ; > + sub rsp, 20h > + call ASM_PFX(SecStartup) > + > diff --git a/Platform/Intel/MinPlatformPkg/FspWrapper/Library/SecFspWrapp= erPlatformSecLib/X64/SecEntry.nasm b/Platform/Intel/MinPlatformPkg/FspWrapp= er/Library/SecFspWrapperPlatformSecLib/X64/SecEntry.nasm > new file mode 100644 > index 0000000000..18a0adfec0 > --- /dev/null > +++ b/Platform/Intel/MinPlatformPkg/FspWrapper/Library/SecFspWrapperPlatf= ormSecLib/X64/SecEntry.nasm > @@ -0,0 +1,199 @@ > +;-----------------------------------------------------------------------= ------- > +; > +; Copyright (c) 2024, Intel Corporation. All rights reserved.
> +; SPDX-License-Identifier: BSD-2-Clause-Patent > +; Module Name: > +; > +; SecEntry.nasm > +; > +; Abstract: > +; > +; This is the code that passes control to PEI core. > +; > +;-----------------------------------------------------------------------= ------- > + > +#include > + > +SECTION .text > + > +extern ASM_PFX(CallPeiCoreEntryPoint) > +extern ASM_PFX(FsptUpdDataPtr) > +; Pcds > +extern ASM_PFX(PcdGet32 (PcdFspTemporaryRamSize)) > +extern ASM_PFX(PcdGet32 (PcdFsptBaseAddress)) > + > +;-----------------------------------------------------------------------= ----- > +; > +; Procedure: _ModuleEntryPoint > +; > +; Input: None > +; > +; Output: None > +; > +; Destroys: Assume all registers > +; > +; Description: > +; > +; Call TempRamInit API from FSP binary if reset vector in FSP is not su= pproted. > +; After TempRamInit done, pass control to PEI core. > +; > +; Return: None > +; > +; MMX Usage: > +; MM0 =3D BIST State > +; > +;-----------------------------------------------------------------------= ----- > + > +BITS 64 > +align 16 > +global ASM_PFX(_ModuleEntryPoint) > +ASM_PFX(_ModuleEntryPoint): > +#if FixedPcdGet8(PcdFspWrapperResetVectorInFsp) =3D=3D 1 > + push rax > + mov rax, ASM_PFX(FsptUpdDataPtr) ; This is dummy code to include = TempRamInitParams in SecCore for FSP-O. > + pop rax > +#else > + fninit ; clear any pending Floating poi= nt exceptions > + ; > + ; Store the BIST value in mm0 > + ; > + movd mm0, eax > + cli > + > + ; > + ; Trigger warm reset if PCIEBAR register is not in reset/default value= state > + ; > + mov eax, 80000060h ; PCIEX_BAR_REG B0:D0:F0:R60 > + mov dx, 0CF8h > + out dx, eax > + mov dx, 0CFCh > + in eax, dx > + cmp eax, 0 > + jz NotWarmStart > + > + ; > + ; @note Issue warm reset, since if CPU only reset is issued not all MS= Rs are restored to their defaults > + ; > + mov dx, 0CF9h > + mov al, 06h > + out dx, al > + jmp $ > + > +NotWarmStart: > + > + ; Find the fsp info header > + mov rax, ASM_PFX(PcdGet32 (PcdFsptBaseAddress)) > + mov edi, [eax] > + > + mov eax, dword [edi + FVH_SIGINATURE_OFFSET] > + cmp eax, FVH_SIGINATURE_VALID_VALUE > + jnz FspHeaderNotFound > + > + xor eax, eax > + mov ax, word [edi + FVH_EXTHEADER_OFFSET_OFFSET] > + cmp ax, 0 > + jnz FspFvExtHeaderExist > + > + xor eax, eax > + mov ax, word [edi + FVH_HEADER_LENGTH_OFFSET] ; Bypass Fv Head= er > + add edi, eax > + jmp FspCheckFfsHeader > + > +FspFvExtHeaderExist: > + add edi, eax > + mov eax, dword [edi + FVH_EXTHEADER_SIZE_OFFSET] ; Bypass Ext Fv = Header > + add edi, eax > + > + ; Round up to 8 byte alignment > + mov eax, edi > + and al, 07h > + jz FspCheckFfsHeader > + > + and edi, 0FFFFFFF8h > + add edi, 08h > + > +FspCheckFfsHeader: > + ; Check the ffs guid > + mov eax, dword [edi] > + cmp eax, FSP_HEADER_GUID_DWORD1 > + jnz FspHeaderNotFound > + > + mov eax, dword [edi + 4] > + cmp eax, FSP_HEADER_GUID_DWORD2 > + jnz FspHeaderNotFound > + > + mov eax, dword [edi + 8] > + cmp eax, FSP_HEADER_GUID_DWORD3 > + jnz FspHeaderNotFound > + > + mov eax, dword [edi + 0Ch] > + cmp eax, FSP_HEADER_GUID_DWORD4 > + jnz FspHeaderNotFound > + > + add edi, FFS_HEADER_SIZE_VALUE ; Bypass the ffs header > + > + ; Check the section type as raw section > + mov al, byte [edi + SECTION_HEADER_TYPE_OFFSET] > + cmp al, 019h > + jnz FspHeaderNotFound > + > + add edi, RAW_SECTION_HEADER_SIZE_VALUE ; Bypass the section header > + jmp FspHeaderFound > + > +FspHeaderNotFound: > + jmp $ > + > +FspHeaderFound: > + ; Get the fsp TempRamInit Api address > + mov eax, dword [edi + FSP_HEADER_IMAGEBASE_OFFSET] > + add eax, dword [edi + FSP_HEADER_TEMPRAMINIT_OFFSET] > + > + ; Setup the hardcode stack > + mov rsp, TempRamInitStack ; move return address to rsp > + mov rcx, ASM_PFX(FsptUpdDataPtr) ; TempRamInitParams > + > + ; Call the fsp TempRamInit Api > + jmp rax > + > +TempRamInitDone: > + mov rbx, 0800000000000000Eh > + cmp rax, rbx ; Check if EFI_NOT_FOUND returned. Err= or code for Microcode Update not found. > + je CallSecFspInit ; If microcode not found, don't hang, = but continue. > + > + test rax, rax ; Check if EFI_SUCCESS returned. > + jnz FspApiFailed > + > +CallSecFspInit: > +#endif > + > + ; RDX: start of range > + ; R8: end of range > +#if FixedPcdGet8(PcdFspModeSelection) =3D=3D 1 > + push rax > + mov rax, ASM_PFX(PcdGet32 (PcdFspTemporaryRamSize)) > + sub edx, dword [rax] ; TemporaryRam for FSP > + pop rax > +#endif > + > + mov r8, rdx > + mov rdx, rcx > + xor ecx, ecx ; zero - no Hob List Yet > + mov rsp, r8 > + > + ; > + ; Per X64 calling convention, make sure RSP is 16-byte aligned. > + ; > + mov rax, rsp > + and rax, 0fh > + sub rsp, rax > + > + call ASM_PFX(CallPeiCoreEntryPoint) > + > +FspApiFailed: > + jmp $ > + > +#if FixedPcdGet8(PcdFspWrapperResetVectorInFsp) =3D=3D 0 > +align 10h > +TempRamInitStack: > + DQ TempRamInitDone > +#endif > diff --git a/Platform/Intel/MinPlatformPkg/FspWrapper/Library/SecFspWrapp= erPlatformSecLib/X64/Stack.nasm b/Platform/Intel/MinPlatformPkg/FspWrapper/= Library/SecFspWrapperPlatformSecLib/X64/Stack.nasm > new file mode 100644 > index 0000000000..21010bf4ef > --- /dev/null > +++ b/Platform/Intel/MinPlatformPkg/FspWrapper/Library/SecFspWrapperPlatf= ormSecLib/X64/Stack.nasm > @@ -0,0 +1,72 @@ > +;-----------------------------------------------------------------------= ------- > +; > +; Copyright (c) 2024, Intel Corporation. All rights reserved.
> +; SPDX-License-Identifier: BSD-2-Clause-Patent > +; Abstract: > +; > +; Switch the stack from temporary memory to permanent memory. > +; > +;-----------------------------------------------------------------------= ------- > + > + SECTION .text > + > +;-----------------------------------------------------------------------= ------- > +; VOID > +; EFIAPI > +; SecSwitchStack ( > +; UINT32 TemporaryMemoryBase, > +; UINT32 PermanentMemoryBase > +; ); > +;-----------------------------------------------------------------------= ------- > +global ASM_PFX(SecSwitchStack) > +ASM_PFX(SecSwitchStack): > + ; > + ; Save four register: rax, rbx, rcx, rdx > + ; > + push rax > + push rbx > + push rcx > + push rdx > + > + ; > + ; !!CAUTION!! this function address's is pushed into stack after > + ; migration of whole temporary memory, so need save it to permanent > + ; memory at first! > + ; > + > + mov rbx, rcx ; Save the first parameter > + mov rcx, rdx ; Save the second parameter > + > + ; > + ; Save this function's return address into permanent memory at first= . > + ; Then, Fixup the esp point to permanent memory > + ; > + mov rax, rsp > + sub rax, rbx > + add rax, rcx > + mov rdx, qword [rsp] ; copy pushed register's value to per= manent memory > + mov qword [rax], rdx > + mov rdx, qword [rsp + 8] > + mov qword [rax + 8], rdx > + mov rdx, qword [rsp + 16] > + mov qword [rax + 16], rdx > + mov rdx, qword [rsp + 24] > + mov qword [rax + 24], rdx > + mov rdx, qword [rsp + 32] ; Update this function's return addre= ss into permanent memory > + mov qword [rax + 32], rdx > + mov rsp, rax ; From now, rsp is pointed to permane= nt memory > + > + ; > + ; Fixup the rbp point to permanent memory > + ; > + mov rax, rbp > + sub rax, rbx > + add rax, rcx > + mov rbp, rax ; From now, rbp is pointed to permane= nt memory > + > + pop rdx > + pop rcx > + pop rbx > + pop rax > + ret > + > diff --git a/Platform/Intel/MinPlatformPkg/FspWrapper/Library/SecFspWrapp= erPlatformSecLib/Ia32/Fsp.h b/Platform/Intel/MinPlatformPkg/Include/Fsp.h > similarity index 79% > rename from Platform/Intel/MinPlatformPkg/FspWrapper/Library/SecFspWrappe= rPlatformSecLib/Ia32/Fsp.h > rename to Platform/Intel/MinPlatformPkg/Include/Fsp.h > index 9f6cdcf476..319e1e3372 100644 > --- a/Platform/Intel/MinPlatformPkg/FspWrapper/Library/SecFspWrapperPlatf= ormSecLib/Ia32/Fsp.h > +++ b/Platform/Intel/MinPlatformPkg/Include/Fsp.h > @@ -1,7 +1,7 @@ > /** @file > Fsp related definitions > =20 > -Copyright (c) 2017, Intel Corporation. All rights reserved.
> +Copyright (c) 2017 - 2024, Intel Corporation. All rights reserved.
> SPDX-License-Identifier: BSD-2-Clause-Patent > =20 > **/ > @@ -36,7 +36,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent > // > // Fsp Header > // > -#define FSP_HEADER_IMAGEBASE_OFFSET 0x1C > -#define FSP_HEADER_TEMPRAMINIT_OFFSET 0x30 > +#define FSP_HEADER_IMAGEBASE_OFFSET 0x1C > +#define FSP_HEADER_TEMPRAMINIT_OFFSET 0x30 > =20 > #endif > diff --git a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec b/Platform/= Intel/MinPlatformPkg/MinPlatformPkg.dec > index a14c6b2db5..28fcdcec6c 100644 > --- a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec > +++ b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec > @@ -6,7 +6,7 @@ > # INF files to generate AutoGen.c and AutoGen.h files > # for the build infrastructure. > # > -# Copyright (c) 2017 - 2021, Intel Corporation. All rights reserved.
> +# Copyright (c) 2017 - 2024, Intel Corporation. All rights reserved.
> # Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved. > # > # SPDX-License-Identifier: BSD-2-Clause-Patent > @@ -393,6 +393,26 @@ > # > gMinPlatformPkgTokenSpaceGuid.PcdFspDispatchModeUseFspPeiMain|TRUE|BOO= LEAN|0xF00000A8 > =20 > + ## Reset Vector in FSP > + # The default of Reset Vector in FSP is FALSE. This feature is only su= pported in X64. > + # Please change this comment to: ## Reset Vector in FSP # FALSE: Reset Vector is in FSP Wrapper # TRUE: Reset Vector is in FSP - This is only supported in X64 # > + gMinPlatformPkgTokenSpaceGuid.PcdFspWrapperResetVectorInFsp|FALSE|BOOL= EAN|0xF00000A9 > + > + ## BFV Location for Reset Vector in FSP > + # The default of BFV Location for Reset Vector in FSP is 0x00000000FFF= F0000. > + # > + gMinPlatformPkgTokenSpaceGuid.PcdFspWrapperBfvforResetVectorInFsp|0x00= 000000FFFF0000|UINT64|0xF00000AA > + > + ## FSP-T UPD Header Revision > + # The default of FSP-T UPD Header Revision is 0. > + # > + gMinPlatformPkgTokenSpaceGuid.PcdFsptUpdHeaderRevision|0x0|UINT8|0xF00= 000AB > + > + ## FSP-T ARCH UPD Revision > + # The default of FSP-T ARCH UPD Revision is 0. > + # > + gMinPlatformPkgTokenSpaceGuid.PcdFsptArchUpdRevision|0x0|UINT8|0xF0000= 0AC > + > [PcdsFeatureFlag] > =20 > gMinPlatformPkgTokenSpaceGuid.PcdStopAfterDebugInit |FALSE|BOOLEAN= |0xF00000A1 > --=20 > 2.40.1.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#114827): https://edk2.groups.io/g/devel/message/114827 Mute This Topic: https://groups.io/mt/104049706/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-