From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mx.groups.io with SMTP id smtpd.web08.10085.1649258165305148746 for ; Wed, 06 Apr 2022 08:16:05 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=hAoVbplf; spf=pass (domain: intel.com, ip: 134.134.136.24, 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=1649258165; x=1680794165; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=90t1KcWxosNGYnpkbf2Kmd1RlTCQH7XqTkk8vbtWjIw=; b=hAoVbplf1I6kb3F77o2+kyyi06r6TbXFMhW5gy1MpJX3lYQNuLwlVnRf Ojzu3vH1SxjL796qCWR42X2sM6sVmcfndBkcHU+gnzvoH23B/QRUpogyn 6TS3fGtiZyEjwHTL4g8k3kj0B4T8a3K3XSDXX7ajyD56zXQ5EJ0MDBBiV AH+qswoKUJLAW1QoRXIp43b5s8dAkmVplSMDHAkYdqRgZ91GcRh/dG4jW ALAQAOU4g1gF6tbqAj+d+Gjg9vBbc5e8V8V9eOIilHn5laWAwJYp/JCYl rbSxLnjCLqEH6dzT4l4pxfEVFGUgRlwTS+anlpYpS5+bGXhEEBfKNU1Hh w==; X-IronPort-AV: E=McAfee;i="6200,9189,10309"; a="260773668" X-IronPort-AV: E=Sophos;i="5.90,240,1643702400"; d="scan'208";a="260773668" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Apr 2022 08:15:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,240,1643702400"; d="scan'208";a="570593203" Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by orsmga008.jf.intel.com with ESMTP; 06 Apr 2022 08:15:44 -0700 Received: from orsmsx604.amr.corp.intel.com (10.22.229.17) by ORSMSX602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Wed, 6 Apr 2022 08:15:44 -0700 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx604.amr.corp.intel.com (10.22.229.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27 via Frontend Transport; Wed, 6 Apr 2022 08:15:43 -0700 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (104.47.51.40) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2308.27; Wed, 6 Apr 2022 08:15:42 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HF+Nm4taGnOY0FVUyCfzmcwQPir+5fdF7oDnZjynl2Q++GlFTTi7SfP1K21tTt6EQtcteBJuEP9OexHyQ2V8VLjZJ2Y2QxzTTqas6X0tU5zpwhBwm01XSFI+I2KT0hCLBA2CYusmGGyEUzjqi0OoRB6xYv1KH3nhOHxkmW40VCFcs/9yca99417Uu0lgnM1Cy7eQhvK6kpr7UgCXTgrfvItXz66yq5epj3lc4jIfYLZ/FHO6y8Gxin94RDVAjxH5EY/fBz3D1zW7HFaYP1LtFGGukJuuv7kGHGgfr749/VG+XvGAGt7eRyOCdZVktOjZrsJKuTAXseR3QC9zlSlnFw== 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=vELj9SIGTUE3ie+JFVUicLJRP7qZZtsl6XZ4tCotz0Y=; b=A9WqlBExiIuJuj2hTKP/m+eOC4JVPgp+rRuUuYOiildNqcZ3ZW1m2cO6jFYqLpVmJdTct83allrxccpCqbAlxs98izjuPuCVJ2Bxd6SGgbQF9T1dncqGh1X/5TKlL185eGDA/Codj1gDq4xWhsZD6tGfBQD8mLPfrqji6SC+Eg+e9EGotEkkSX/SAmLJ8phbQzYwjRPYYBlt5Cq2US6Nj5u4a/B9CvPUl766cYeGrXaJj/9G6GhGtzcvc3tvoHo81agsf/wg2f9DIEFtlqahi/zIywmcz+v/1o41Kp6l1g93yUbrOxzbRzgkUZ1sABt/JV0LycI+W06R+iiH5K60Jw== 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 BN9PR11MB5483.namprd11.prod.outlook.com (2603:10b6:408:104::10) by DM6PR11MB3676.namprd11.prod.outlook.com (2603:10b6:5:137::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5123.31; Wed, 6 Apr 2022 15:15:40 +0000 Received: from BN9PR11MB5483.namprd11.prod.outlook.com ([fe80::c076:6436:db8e:ee22]) by BN9PR11MB5483.namprd11.prod.outlook.com ([fe80::c076:6436:db8e:ee22%7]) with mapi id 15.20.5144.019; Wed, 6 Apr 2022 15:15:39 +0000 From: "Chiu, Chasel" To: "Kuo, Ted" , "devel@edk2.groups.io" CC: "Desimone, Nathaniel L" , "Zeng, Star" , "S, Ashraf Ali" Subject: Re: [edk2-devel][PATCH v2 8/8] IntelFsp2WrapperPkg: SecFspWrapperPlatformSecLibSample support for X64 Thread-Topic: [edk2-devel][PATCH v2 8/8] IntelFsp2WrapperPkg: SecFspWrapperPlatformSecLibSample support for X64 Thread-Index: AQHYR+yGfS3kkWazyEyezjhlex2oTazjAhEA Date: Wed, 6 Apr 2022 15:15:39 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.6.401.20 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: fa31ebfa-7a79-4479-6be2-08da17e04f77 x-ms-traffictypediagnostic: DM6PR11MB3676:EE_ x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: WKSey06ycoknYXzKAdjIw2T7uHjHergNzFUdcE+bxkiVptTauDHmPZZVuTo8U3B0l26FYJHkWSJDT2pwvXecfQCGpq2rQXJUT1/6hF/Aw6Tr0Qau6pCw6HmlzVQ6nzB7DLgG/zFYYMstltT1QF53JNEZe0YHkPXybOKgygua+yFUASNsx7fHyx0fTXMNbNIcFpikjOr/sOC0SxRpDX8HJl8o9HvIdsIeKqCU16AwnN6nWiTLA483eyBZZTtQL/8LR9WvYL0Ix+OM5fBSrMnzUaiBa63tUcqoYgHaEAdMp77ghSQSJ1ix9lVTTqOPlXYA5xjP0kR6lgZPubHXEPnH6IOEejYQKN1TaN4jX2igTY2ESmQFl+gVRnGOj3mCRhJ8c4HfcYhEdhqYuNjfWf4MT5ZkW2OZRN5AYb10pGobUnQQh1LpFOfQ3cOquRcJD4vlerES6IDDvF3tHFZx1DxESI8HpN+miW0NmQ8+M4v9tZN+x4s2rMfgZMR+bRIOvaSPcfTGtAegfK4A4XAHwY8v+rubnuHSypSSRHyRk8vEsIxrd7vFU3jPblgXy53K9SnwJOin2+1qhZrNogcWHt+6br7FeMHMd6D5ugxNJMJj5lfsd3TmjqjjEzkZhAjJVTH/IAlG4pfJJR8TUo+exN4MQKd/4LTLjkg7rcFkoI/NHkPmkrY/tyP2TSjSyIc9oywG7ySvma8otnN5IVyo50F2YpgBmSrGg2kv1kWxXry0xs1yqlvWeSjZxC9gOm6fH2u0xqFjXK3DmX/YQ86mHbsP5d7Eoj5zo1smPOKCPDkaksxBj1Np+9+C9JLCgu/V65MUxxhaqKwdzANiY1TI9QGzsaFemQeWhKsx0e6opVZMu0Zc0VZHSNNFAVFigKenbb2s x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN9PR11MB5483.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(366004)(33656002)(122000001)(2906002)(186003)(55016003)(7696005)(86362001)(38100700002)(26005)(6506007)(9686003)(53546011)(82960400001)(110136005)(8936002)(66446008)(30864003)(83380400001)(107886003)(76116006)(66946007)(64756008)(316002)(71200400001)(508600001)(66556008)(54906003)(66476007)(38070700005)(19627235002)(4326008)(5660300002)(8676002)(52536014)(11716005)(213903007)(309714004);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?bhh298r29HQ8li3dE6AyA+VQe5sXyVD5XaPpIrsD06+c4InBR7vkqgVCK5gE?= =?us-ascii?Q?f9AYGTSNxNfwoTLxtn3QX6wFzXdjY8izr73IL7x95ldjVx0LOQEjyKkUTHzN?= =?us-ascii?Q?b434vNxzP5AnfYXISN7Wk66OrxmEA/X2d3zev8Okx3KLAo6YueKrw1gVgrMo?= =?us-ascii?Q?+Ti4dX/LAEEtzFVJ4lcamRfMyXw2q+2Kce+6M3Zef+boPGmITHevTbmg+LkO?= =?us-ascii?Q?d9jV35c62JYzzNVSYyO34+45M7O0iufcuVMwfJyRBb5FMWPPo2Q+ayenXxN2?= =?us-ascii?Q?8HI7GjPAeNCCDHqu+QWYRmO5oYtMB639HuegSL9/2WHs2neNwc6JljUsLs43?= =?us-ascii?Q?ayFpvu/DduRpZlhH/KIVJ57ielbAaxYre+g++fMOkj5IAkTUSc+CJ4V1SPom?= =?us-ascii?Q?3pgg9eRNzy0MabHWWwS39tpqpkX0PfRjGMGkIS3FgdIqJbfvYL13cAnYvhib?= =?us-ascii?Q?J8OyFr2DQQMsAhdSn8AGts3+6f02g1pFOhwxhc72DUfsMcDFRjG1I3ohQfZt?= =?us-ascii?Q?/bg2y4xpuNJe3tDVAq5GnEllvui/X96CT1kiNQG6h8ACT3ObyOfEgeuVA4iX?= =?us-ascii?Q?sG+Nq3iLpW2T/4qgEZlIPl1gkTASYdJ34cq0You+72iFRgouaIuWJmzN+gkn?= =?us-ascii?Q?oI0FXRhDdWhMs126sqwzm4WRTDPDye9y3CgIwm5svW4sW4s9xiFnlLASzflA?= =?us-ascii?Q?qo2x5ILFthv59OP7DZphnXgMh5azd9POvAZkCXIxdU0DDNGiFavbF9gHSZHH?= =?us-ascii?Q?oat1SQvqstlPWo1y1D9jOn+pFh/D2X/7M62VSaVA6k6EjhauFsbfvyS1sjrN?= =?us-ascii?Q?oSIgVoUXnBMwLZrqMy4wdGjJ4CCA8gBvlsr5swAVuwLdLoU1hHH8+bb4k9S/?= =?us-ascii?Q?iPUtOJU/tTQFHoxmVX0TmwDEEYuhwvhdT82XVg0ZA2qs/pakdO7uI8bAusXz?= =?us-ascii?Q?EtiHuZgGdLFxmho849zfUedjywEai8mxulL4+RAW/Wxlr84bsh5I4ry2S3Mm?= =?us-ascii?Q?rRht+SNnthAdOiU3lX4D0TTjU0UxQdRXnWFVciTAP5pQC1ydY0XUm2htjI+/?= =?us-ascii?Q?+GogYnnXCuzs1oEI+1qCc0hAckJP8J4u5nxgSsANZuB1SMEZBsDD9/ObEenQ?= =?us-ascii?Q?lbukIZVOpg/Nv0b8zBwOrNmcYNBBbSg2dZwqPw+zPhPgyJgbFXQlYubsxXQ0?= =?us-ascii?Q?syW/gWV7XSAXPT2v2sMx9HFSJB6/eKDM4t5Pc18ZxMhfQo5oDOzG57av54P6?= =?us-ascii?Q?4N+tB1m55S08PObIQE7h46x3xgWjJZBB0WF+OxXGzBhJH6el7C8KGOf7/Sii?= =?us-ascii?Q?mUdWbZ1SJVwEZZpsIFhuNACkUslgpJwt+3ngWgUbWlv+X6EfGXY3tikj7mYF?= =?us-ascii?Q?rVrHPMUySpU8GOoC5u9NG2FU1iaTlgbQBrol2VH6Dbce3LYhFKUp0nJhVg3s?= =?us-ascii?Q?PA/4vy3k8ajbREBVOOx6D28IzTIbaNIb1fEDvs5vbB+f6c3GnWo2NVAl4GbJ?= =?us-ascii?Q?gfbSz6jXFMwvmohdZRgk0tDnM50kOuUhr6rsSMmq9pY6RUOPfzCgS+LQGG3C?= =?us-ascii?Q?fFvr33V09CuUVOl37Vkcp8RSDhZ5FTrKbtJb8uN7ztX1pxgBDEwzkaRGw6xE?= =?us-ascii?Q?huOaIs+c2Vxs+sdzfqLt6SGv6nqp498081v/Z4fR6QTOC6GyTuHMf9tt6l07?= =?us-ascii?Q?ike4m48019KWEUocYKS0rjcp7iQ0Dw4OUR0b3RmP3NHCT1HZPhKff8nRtIXL?= =?us-ascii?Q?z1kyh9R4cQ=3D=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BN9PR11MB5483.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: fa31ebfa-7a79-4479-6be2-08da17e04f77 X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Apr 2022 15:15:39.7811 (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: pMEMtVk/m1+aiQ+fvQ4kjwXDnQA/h2FA+HiOartg3JzNrzh6CCdJOrgYd1JFzS9ZGM4I4BjYvsSrx444DbAcuA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR11MB3676 Return-Path: chasel.chiu@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable HI Ted, Please see my comments below inline. Thanks, Chasel > -----Original Message----- > From: Kuo, Ted > Sent: Monday, April 4, 2022 2:23 PM > To: devel@edk2.groups.io > Cc: Chiu, Chasel ; Desimone, Nathaniel L > ; Zeng, Star ; S, > Ashraf Ali > Subject: [edk2-devel][PATCH v2 8/8] IntelFsp2WrapperPkg: > SecFspWrapperPlatformSecLibSample support for X64 >=20 > REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D3893 > 1.Added SecFspWrapperPlatformSecLibSample support for X64. > 2.Adopted FSPT_ARCH2_UPD in SecFspWrapperPlatformSecLibSample. > 3.Moved Fsp.h up one level to be shared across IA32 and X64. >=20 > Cc: Chasel Chiu > Cc: Nate DeSimone > Cc: Star Zeng > Cc: Ashraf Ali S > Signed-off-by: Ted Kuo > --- > .../{Ia32 =3D> }/Fsp.h | 0 > .../Ia32/Stack.nasm | 6 +- > .../SecFspWrapperPlatformSecLibSample.inf | 7 +- > .../SecRamInitData.c | 32 ++-- > .../X64/PeiCoreEntry.nasm | 149 +++++++++++++++= +++ > .../X64/SecEntry.nasm | 171 +++++++++++++++= ++++++ > .../X64/Stack.nasm | 73 +++++++++ > 7 files changed, 415 insertions(+), 23 deletions(-) rename > IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/{Ia32 > =3D> }/Fsp.h (100%) create mode 100644 > IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/X64/P > eiCoreEntry.nasm > create mode 100644 > IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/X64/S > ecEntry.nasm > create mode 100644 > IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/X64/S > tack.nasm >=20 > diff --git > a/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/Ia32 > /Fsp.h > b/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/Fsp. > h > similarity index 100% > rename from > IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/Ia32/F > sp.h > rename to > IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/Fsp.h > diff --git > a/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/Ia32 > /Stack.nasm > b/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/Ia32 > /Stack.nasm > index d7394cf286..65e9c2e895 100644 > --- > a/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/Ia32 > /Stack.nasm > +++ > b/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/Ia32 > +++ /Stack.nasm > @@ -22,7 +22,7 @@ > global ASM_PFX(SecSwitchStack) > ASM_PFX(SecSwitchStack): > ; > - ; Save three register: eax, ebx, ecx > + ; Save four register: eax, ebx, ecx, edx > ; > push eax > push ebx > @@ -55,7 +55,7 @@ ASM_PFX(SecSwitchStack): > mov dword [eax + 12], edx > mov edx, dword [esp + 16] ; Update this function's return addre= ss > into permanent memory > mov dword [eax + 16], edx > - mov esp, eax ; From now, esp is pointed to per= manent > memory > + mov esp, eax ; From now, esp is pointed to permane= nt > memory >=20 > ; > ; Fixup the ebp point to permanent memory @@ -63,7 +63,7 @@ > ASM_PFX(SecSwitchStack): > mov eax, ebp > sub eax, ebx > add eax, ecx > - mov ebp, eax ; From now, ebp is pointed to permanen= t > memory > + mov ebp, eax ; From now, ebp is pointed to permane= nt > memory >=20 > pop edx > pop ecx > diff --git > a/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/SecF > spWrapperPlatformSecLibSample.inf > b/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/SecF > spWrapperPlatformSecLibSample.inf > index 027b127724..7aa4297bcc 100644 > --- > a/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/SecF > spWrapperPlatformSecLibSample.inf > +++ > b/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/SecF > +++ spWrapperPlatformSecLibSample.inf > @@ -39,13 +39,18 @@ > SecGetPerformance.c > SecTempRamDone.c > PlatformInit.c > + Fsp.h >=20 > [Sources.IA32] > - Ia32/Fsp.h > Ia32/SecEntry.nasm > Ia32/PeiCoreEntry.nasm > Ia32/Stack.nasm >=20 > +[Sources.X64] > + X64/SecEntry.nasm > + X64/PeiCoreEntry.nasm > + X64/Stack.nasm > + >=20 > ########################################################## > ###################### > # > # Package Dependency Section - list of Package files that are required f= or > diff --git > a/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/SecR > amInitData.c > b/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/Sec > RamInitData.c > index 03616cb418..4464abaca0 100644 > --- > a/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/SecR > amInitData.c > +++ > b/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/Sec > R > +++ amInitData.c > @@ -9,20 +9,14 @@ > #include > #include >=20 > -typedef struct { > - UINT32 MicrocodeRegionBase; > - UINT32 MicrocodeRegionSize; > - UINT32 CodeRegionBase; > - UINT32 CodeRegionSize; > -} FSPT_CORE_UPD; Please add back CORE_UPD structure but the elements should be 64bits for ne= w version. > - > typedef struct { > FSP_UPD_HEADER FspUpdHeader; > // > - // If platform does not support FSP spec 2.2 remove FSPT_ARCH_UPD > structure. > + // If FSP spec version < 2.2, remove FSPT_ARCH_UPD structure. > + // Else If FSP spec version >=3D 2.2 and FSP spec version < 2.4, use > FSPT_ARCH_UPD structure. > + // Else, use FSPT_ARCH2_UPD structure. > // > - FSPT_ARCH_UPD FsptArchUpd; > - FSPT_CORE_UPD FsptCoreUpd; > + FSPT_ARCH2_UPD FsptArchUpd; > } FSPT_UPD_CORE_DATA; >=20 > GLOBAL_REMOVE_IF_UNREFERENCED CONST FSPT_UPD_CORE_DATA > FsptUpdDataPtr =3D { @@ -36,24 +30,24 @@ > GLOBAL_REMOVE_IF_UNREFERENCED CONST FSPT_UPD_CORE_DATA > FsptUpdDataPtr =3D { > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } > }, > // > - // If platform does not support FSP spec 2.2 remove FSPT_ARCH_UPD > structure. > + // If FSP spec version < 2.2, remove FSPT_ARCH_UPD structure. > + // Else If FSP spec version >=3D 2.2 and FSP spec version < 2.4, use > FSPT_ARCH_UPD structure. > + // Else, use FSPT_ARCH2_UPD structure. > // > { > - 0x01, > + 0x02, > { > 0x00, 0x00, 0x00 > }, > - 0x00000020, > + 0x00000040, > 0x00000000, > - { > - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 > - } > - }, > - { > FixedPcdGet32 (PcdCpuMicrocodePatchAddress), > FixedPcdGet32 (PcdCpuMicrocodePatchRegionSize), > FixedPcdGet32 (PcdFlashCodeCacheAddress), > FixedPcdGet32 (PcdFlashCodeCacheSize), > + { > + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 > + } > } > }; > diff --git > a/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/X64 > /PeiCoreEntry.nasm > b/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/X64 > /PeiCoreEntry.nasm > new file mode 100644 > index 0000000000..0c0766acb8 > --- /dev/null > +++ > b/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/X64 > / > +++ PeiCoreEntry.nasm > @@ -0,0 +1,149 @@ > +;---------------------------------------------------------------------- > +-------- > +; > +; Copyright (c) 2022, Intel Corporation. All rights reserved.
; > +SPDX-License-Identifier: BSD-2-Clause-Patent ; ; Module Name: > +; > +; PeiCoreEntry.nasm > +; > +; Abstract: > +; > +; Find and call SecStartup > +; > +;---------------------------------------------------------------------- > +-------- > + > +SECTION .text > + > +%include "PushPopRegsNasm.inc" > + > +extern ASM_PFX(SecStartup) > +extern ASM_PFX(PlatformInit) > + > +; > +; args 1:XMM, 2:REG, 3:IDX > +; > +%macro LXMMN 3 > + pextrq %2, %1, (%3 & 3) > + %endmacro > + > +; > +; args 1:YMM, 2:XMM, 3:IDX (0 - lower 128bits, 1 - upper 128bits) ; > +%macro LYMMN 3 > + vextractf128 %2, %1, %3 > + %endmacro > + > +%macro LOAD_TS 1 > + LYMMN ymm6, xmm5, 1 > + LXMMN xmm5, %1, 1 > + %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 > + > + ; Save Time-Stamp Counter > + LOAD_TS rax > + push rax > + > + ; > + ; Pass entry point of the PEI core > + ; > + mov rdi, 0FFFFFFE0h > + mov edi, DWORD [rdi] > + mov r9, rdi > + > + ; > + ; Pass BFV into the PEI Core > + ; > + mov r8, r10 > + > + ; > + ; 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/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/X64 > /SecEntry.nasm > b/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/X64 > /SecEntry.nasm > new file mode 100644 > index 0000000000..dbbf63336e > --- /dev/null > +++ > b/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/X64 > / > +++ SecEntry.nasm > @@ -0,0 +1,171 @@ > +;---------------------------------------------------------------------- > +-------- > +; > +; Copyright (c) 2022, Intel Corporation. All rights reserved.
; > +SPDX-License-Identifier: BSD-2-Clause-Patent ; ; Module Name: > +; > +; SecEntry.asm > +; > +; Abstract: > +; > +; This is the code that calls TempRamInit API from FSP binary and > +passes ; control into PEI core. > +; > +;---------------------------------------------------------------------- > +-------- > + > +#include "Fsp.h" > + > +IA32_CR4_OSFXSR equ 200h > +IA32_CR4_OSXMMEXCPT equ 400h > +IA32_CR0_MP equ 2h > + > +IA32_CPUID_SSE2 equ 02000000h > +IA32_CPUID_SSE2_B equ 26 > + > +SECTION .text > + > +extern ASM_PFX(CallPeiCoreEntryPoint) > +extern ASM_PFX(FsptUpdDataPtr) > + > +; Pcds > +extern ASM_PFX(PcdGet32 (PcdFsptBaseAddress)) > + > +;---------------------------------------------------------------------- > +------ > +; > +; Procedure: _ModuleEntryPoint > +; > +; Input: None > +; > +; Output: None > +; > +; Destroys: Assume all registers > +; > +; Description: > +; > +; Call TempRamInit API from FSP binary. After TempRamInit done, pass ; > +control into PEI core. > +; > +; Return: None > +; > +; MMX Usage: > +; MM0 =3D BIST State > +; > +;---------------------------------------------------------------------- > +------ > + > +BITS 64 > +align 16 > +global ASM_PFX(ModuleEntryPoint) > +ASM_PFX(ModuleEntryPoint): > + fninit ; clear any pending Floating poi= nt exceptions > + ; > + ; Store the BIST value in mm0 > + ; > + movd mm0, eax > + > + ; 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 > Header > + 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 > + > + ; Call the fsp TempRamInit Api > + jmp rax > + > +TempRamInitDone: > + cmp rax, 0800000000000000Eh ; Check if EFI_NOT_FOUND returned. > Error code for Microcode Update not found. > + je CallSecFspInit ; If microcode not found, don't hang, = but > continue. > + > + cmp rax, 0 ; Check if EFI_SUCCESS returned. > + jnz FspApiFailed > + > + ; RDX: start of range > + ; R8: end of range > +CallSecFspInit: > + > + 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 $ > + > +align 10h > +TempRamInitStack: > + DQ TempRamInitDone > + DQ ASM_PFX(FsptUpdDataPtr) ; TempRamInitParams > + > diff --git > a/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/X64 > /Stack.nasm > b/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/X64 > /Stack.nasm > new file mode 100644 > index 0000000000..64e46ce953 > --- /dev/null > +++ > b/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/X64 > / > +++ Stack.nasm > @@ -0,0 +1,73 @@ > +;---------------------------------------------------------------------- > +-------- > +; > +; Copyright (c) 2022, 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 > + > -- > 2.16.2.windows.1