From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mx.groups.io with SMTP id smtpd.web08.6732.1667526982776115192 for ; Thu, 03 Nov 2022 18:56:23 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=Q47+pU/O; spf=pass (domain: intel.com, ip: 134.134.136.126, mailfrom: ted.kuo@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1667526982; x=1699062982; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=cu6DEovbRO6UGXLQmZ5G5eXlHfx9oqd4XQxvL8CdaUQ=; b=Q47+pU/O+v8cOXUpvPnYgIZj5iJoBjtXIv5UXFFQ0DM7tcPM9HJa9Jo6 JAZRaMdUmHISgdGu2gqS7IC0Q+CuIAtBgDpHY/x7qYeBON6i7gAhoZO9W RQSaOgaSv62s12BizP7NCPsTi0QKNbjDya5PorSO7aO3nOslCn5GuG09y F0dBplUe+yXCZ2xUYWF0H+VDa50KagI+7n5L46tAhxUzX+DI7jgq9tqvN VvM3qCyS60P76uMI2mSM3+eGDVjOGhc1izwxDiualPSt2dUQIA5SzEaMF loqI+QJqqpeY/7tmQ9TxguHYbJO/WUmdLXvekPMtXbxzd0srXRyB2QBFv Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10520"; a="293177960" X-IronPort-AV: E=Sophos;i="5.96,135,1665471600"; d="scan'208";a="293177960" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Nov 2022 18:56:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10520"; a="809893848" X-IronPort-AV: E=Sophos;i="5.96,135,1665471600"; d="scan'208";a="809893848" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by orsmga005.jf.intel.com with ESMTP; 03 Nov 2022 18:56:22 -0700 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Thu, 3 Nov 2022 18:56:21 -0700 Received: from fmsmsx602.amr.corp.intel.com (10.18.126.82) by fmsmsx611.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Thu, 3 Nov 2022 18:56:21 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31 via Frontend Transport; Thu, 3 Nov 2022 18:56:21 -0700 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (104.47.57.176) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2375.31; Thu, 3 Nov 2022 18:56:20 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kUqL97IXMu70J+b13+rCB3xviddMnu/5U82Jv5ndicN0LUct5zqbTg9+edgxIp9zkvMjBt7FmGxqr3HWWEK+ulQ4V8p6DCIjvcbUAPIxOGFwDml3fH2j6wZjI8RyUS6P3ak2TpXxCGeL8tuy5Whv59mmKIfV4UkPVQvyJTLeji3k/FkCOlCqoQa0qbOWQeKZ1n7IbSqGXyVrudV4z1MCWrs/xn2m0cDTjC6fcBr+TQOBZNr3WSfSZA7GVT034fh0i6I65FHGia/+xLTxmc2Edi4pQbIFWo29AOE5WQBjWowqg7mLIkg6XdK3DdOxbT3ekvjJrnwdqhoJlU0gcKugUA== 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=Irho0gMLAfVnYSAuGrH0NimboNjljPRf8HprRZoIfQw=; b=QRT+tHeGGSsX01Y5GBn3u3umFI0FX2gCvpDkJ3Q3UeEMGXV6psDOFduGT2bZ4pFR7ymCW5juBDVI3ru1MqnyJC+OksMLJZky78EifFEkpsLLypUEbctFlJps5Ff7wJRmTzi/R0+ph7bzM8HCVt8LT3M6CzJefUJXrczaUmjxzqln9FICdfIyUpKcDtEnD0WBcN0tsRM8mkRwozzkZBhJU/WYodUtavsotanFXm/pcN3GeGQV0YJGG/kNWvLxFQVPmIdf5d8MmcbbYIxvX1aGHqL79DTqmajVPX+hIMtqcApsLtK1IGPnYR3X0bLq7Yzc80m2AbZKS9eo0ioK3DPbPw== 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 DM5PR11MB1929.namprd11.prod.outlook.com (2603:10b6:3:10a::22) by SA1PR11MB7016.namprd11.prod.outlook.com (2603:10b6:806:2b6::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.22; Fri, 4 Nov 2022 01:56:16 +0000 Received: from DM5PR11MB1929.namprd11.prod.outlook.com ([fe80::5923:4c0c:d7db:5c30]) by DM5PR11MB1929.namprd11.prod.outlook.com ([fe80::5923:4c0c:d7db:5c30%7]) with mapi id 15.20.5791.022; Fri, 4 Nov 2022 01:56:16 +0000 From: "Kuo, Ted" To: "Chiu, Chasel" , "devel@edk2.groups.io" CC: "Desimone, Nathaniel L" , "Zeng, Star" Subject: Re: [edk2-devel] [PATCH v2] IntelFsp2Pkg: FSP should support input UPD as NULL. Thread-Topic: [edk2-devel] [PATCH v2] IntelFsp2Pkg: FSP should support input UPD as NULL. Thread-Index: AQHY7n6bghSjqYeYUEaRoftaY9faBK4segGwgAD09gCAAJTIYA== Date: Fri, 4 Nov 2022 01:56:16 +0000 Message-ID: References: <20221102054627.1496-1-chasel.chiu@intel.com> 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.500.17 authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: DM5PR11MB1929:EE_|SA1PR11MB7016:EE_ x-ms-office365-filtering-correlation-id: e25e3fe4-2931-4b85-adf5-08dabe07c2af x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: EvrzJM2HaEy0afytzm7D39ecCXubaaSuOby9hY96F3faBiQRuauJ/Ik1obRifctVmYVHIV0nmxQUN5HR3GqcdGYX0elJkx1E3iQCCg6WETKdMIrfY3VeUE1HsktgKVB4ZtgrskK03vWSP+YZTMVgmqPOQQUkdM7hAc92GxOqdeHFc9MAHbKgxGhlstNfjRzkEA8VD4Z7gI1mqNMcdFZ0xd4X5g/fEm2TDbc0+O4fhS8hz6z35F6Bzdm4MfkWKdMpMV2ng93E40O0upLIKVzG/kGNkktrfUhQstD8SxXnApx+QsOfFTQg+9PqWvQ6tkAfaj6vGyhdY8A3WGFcnj/rjBcJZW62pEIH86d9SB7rUGYmuI9ipHD/mPCduXCLoSend75dqV3NLsPMk04ulKx3xphPS5hwLVS6IG7OihOr1uIDJNopDD4eG3IsBGagynGpbzX+Ac0aZjaIG7V0V4CBdIgyU2CdFHM7IEBXNdQjl6Uo0zYwEu4x3iQpkxVhl5+vS24vG1vnJc/84nH9q4KwXq9Frr1JkAiu+hdY8obM4yA4GLFsnaGmtW4E1o4ov4W/OuLhvBB9yvAu9yeZ4NLadsLnYQQX6dd6wsOLCE6uO5dJaPLlIqiyOQAaj7OT6kz3jrjc1JNCGhl0rNnlSxDVa9vvpcg4buzaC5bX3Ay00py1cegI+6UcY32vwPl3LZlb1d93a35AywurPtth8mUH5p+i3D2PVlkR82C5to0wDSs/K0L3Bn/9suJmQmmfls5wytpnwDL+Z9SoWtPAuhsIvx+2JUZkzvnO34UwbU0tNEZ+zbzy+vReIsxn1ITMPTRCv5wyp+cHKo27XnsdGVyPIKK3VVqQ2PXzVuoPpQdTQu0= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM5PR11MB1929.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(396003)(39860400002)(346002)(376002)(136003)(366004)(451199015)(33656002)(66899015)(82960400001)(30864003)(2906002)(38100700002)(122000001)(86362001)(83380400001)(38070700005)(186003)(9686003)(4326008)(26005)(76116006)(110136005)(53546011)(478600001)(6506007)(19627235002)(7696005)(54906003)(64756008)(316002)(71200400001)(66446008)(66946007)(66476007)(41300700001)(8936002)(966005)(66556008)(5660300002)(52536014)(55016003)(107886003)(8676002)(11716005);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?l4bHIfM3ttNYisY3yQAiG6ZMa00S9Z24hMNmvVYLmgPF2o+mD5zsiGlvFeGL?= =?us-ascii?Q?BMpw3mwjxBYOEkTEH/K9kUlTxIf20xD33iSBv1ZMVnJRoNjLq3j9fSn62SgW?= =?us-ascii?Q?C0ye0u7MomCZhc9mWq74eLePi5AB+05QvflCaCWHHG7Pg3y2oXHcn2oaN13k?= =?us-ascii?Q?Rr56mpbBlVcQkHLGVj5rRF+B26fZIrh6Y3Wk0C96i+BrNoFuRfqoU0Kr9eJC?= =?us-ascii?Q?9ixrSsGrXH+LgV7z2LkT5H5631jeGGqZX4p/uF04YhDaf1OCLQ9asIX+l5Ub?= =?us-ascii?Q?75dJCytgnX/dhDLFf39+TuFwxykFlbYegfr00UqUT4brRNWtr5U+OK+CXvPN?= =?us-ascii?Q?vOy25RK81QHuroi7cMQU4P4HXxRMJqUKsQJlipicktO6QoS4JNhITEK0uFQh?= =?us-ascii?Q?HnqSaZhdgzSazd6C5HEyl3dCp0qdDrFMC6QYUeYjo1ZAEw74iJRBi6FBHUeA?= =?us-ascii?Q?1uV1BwqBlZwOSdZGKcDNGs5GpID+wl2SS2Mte/4rQp/EKL/b9oLV+GlA5JUj?= =?us-ascii?Q?gmfrCD6/RulPjdEWVFEqABEIRAvoNgDmKZE1H1QZLhk3I7d6q5Qrvqrio9ep?= =?us-ascii?Q?Ky4ZHyNKwfBroLuxk+eHvB+Hq6acM8Pm+KOwSuHL+22Lw+bli6eEyTqcu/mU?= =?us-ascii?Q?13ZDan9jaShjAnMBsU4HtpQvzLUKrDjTOOkmgcSvEnQKUBfw+Ecv76YC5Mdy?= =?us-ascii?Q?cHThqOR0K9CI62Ms58Y047rV6JE3efJNIyFxKGyRSGZrfCbeChdEHcNutSK9?= =?us-ascii?Q?IKckJK7YEKPnyqtx0RzNmOsLZ01MJkjrKU+kFDCtTXN5P41cMRVCdSaaJP0S?= =?us-ascii?Q?GpNsOkqebpqdKNRMZR5GdBPYDYSiTg68c4/c+lIhnhdoo3mCvOy0M2qsSd5Z?= =?us-ascii?Q?k1a3N6CpUCYXvYyN16t53CmMJfToJ1UU0zzdbGJgBnS1fi3qT6Ud65OMJnLa?= =?us-ascii?Q?MbLjcJITKMhG7jWbbx68ZDUITHx/xjoSQ04kBY3p1+D7dHmLvU+QM/xPgOcs?= =?us-ascii?Q?lLf+56Si9Xr6EcBWC0slO4pO3BDqENoUc7FamH+4a9YmehuoANa4cT39x9Vu?= =?us-ascii?Q?fIk6RrTZCK9Iqn/MmcWmT4nfcyLDB4ZLTYhysAWv87TD6YEJZ6nQrXwv3jj0?= =?us-ascii?Q?0TDzVVRBPLNVPrb1Jg2Dv37a7vkpKeYeSfVqcKB4eBh87Dd+risex0Jt5Vv2?= =?us-ascii?Q?Pkg+NdJVwNyUZD4/dbPB9K267q6EQNfiaikQZnKxJCryhmjKaVNH6fF7Njl5?= =?us-ascii?Q?AqaabT7z5gQ78/zjXVQ/56Hg70yEroN2JIaKZ4bYrOuIcyhtBlROOiHcxTXu?= =?us-ascii?Q?xfSYw0Pi7LHP3/+w1wb4ppsDrRpRVDsVWHJ9uSDt/b6JdbtJaaMDjmrc78oz?= =?us-ascii?Q?5gyNHzH218EWOCpVnyExEOtAzWxsWjWJymSYiLth5v7gbZ1ReJD7tDjWHgp1?= =?us-ascii?Q?1hIM7vDAh9Yiu2+SBiTSbN8IPfrI4Kk+F8HVwSBHbQKIsJvKjWi+IJnFn7N2?= =?us-ascii?Q?rv5Ij31Y0FzE7MGRtZCRXdHSk+V9dVfrWi4QDWnxNc2RvZQ28/XUS5SgiSSU?= =?us-ascii?Q?fqp9h9ZAB7vWcEWdig0nRH7oTy8BOQDGfv+cuX1i?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM5PR11MB1929.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: e25e3fe4-2931-4b85-adf5-08dabe07c2af X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Nov 2022 01:56:16.6375 (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: eEREZ+ywhn60b3P81Qnfkn5zLg/dPing7H51v2Z7TWsbmxGtympMK8+EKuaNaf0uSuz1Izhe28mKQbly+SuAXA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR11MB7016 Return-Path: ted.kuo@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Ted Kuo -----Original Message----- From: Chiu, Chasel =20 Sent: Friday, November 4, 2022 1:02 AM To: Kuo, Ted ; devel@edk2.groups.io Cc: Desimone, Nathaniel L ; Zeng, Star Subject: RE: [edk2-devel] [PATCH v2] IntelFsp2Pkg: FSP should support input= UPD as NULL. Hi Ted, Please see my reply below inline. Thanks, Chasel > -----Original Message----- > From: Kuo, Ted > Sent: Wednesday, November 2, 2022 7:32 PM > To: devel@edk2.groups.io; Chiu, Chasel > Cc: Desimone, Nathaniel L ; Zeng, Star=20 > > Subject: RE: [edk2-devel] [PATCH v2] IntelFsp2Pkg: FSP should support=20 > input UPD as NULL. >=20 > Hi Chasel, >=20 > I have few comments. Please find [Ted] inline. >=20 > Thanks, > Ted >=20 > -----Original Message----- > From: devel@edk2.groups.io On Behalf Of Chiu,=20 > Chasel > Sent: Wednesday, November 2, 2022 1:46 PM > To: devel@edk2.groups.io > Cc: Chiu, Chasel ; Desimone, Nathaniel L=20 > ; Zeng, Star > Subject: [edk2-devel] [PATCH v2] IntelFsp2Pkg: FSP should support=20 > input UPD as NULL. >=20 > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4114 >=20 > FSP specification supports input UPD as NULL cases which FSP will use=20 > built- in UPD region instead. > FSP should not return INVALID_PARAMETER in such cases. >=20 > In FSP-T entry point case, the valid FSP-T UPD region pointer will be=20 > passed to platform FSP code to consume. > In FSP-M and FSP-S cases, valid UPD pointer will be decided when=20 > updating corresponding pointer field in FspGlobalData. >=20 > Cc: Nate DeSimone > Cc: Star Zeng > Signed-off-by: Chasel Chiu > --- > IntelFsp2Pkg/FspSecCore/SecFspApiChk.c | 12 ++++++++++-- > IntelFsp2Pkg/FspSecCore/Ia32/FspApiEntryT.nasm | 73 > +++++++++++++++++++++++++++++++++++++++++++++++++++++++------ > ------------ > IntelFsp2Pkg/FspSecCore/X64/FspApiEntryT.nasm | 40 > ++++++++++++++++++++++++++-------------- > 3 files changed, 91 insertions(+), 34 deletions(-) >=20 > diff --git a/IntelFsp2Pkg/FspSecCore/SecFspApiChk.c > b/IntelFsp2Pkg/FspSecCore/SecFspApiChk.c > index a44fbf2a50..5f59938518 100644 > --- a/IntelFsp2Pkg/FspSecCore/SecFspApiChk.c > +++ b/IntelFsp2Pkg/FspSecCore/SecFspApiChk.c > @@ -44,6 +44,8 @@ FspApiCallingCheck ( > // > if (((UINTN)FspData !=3D MAX_ADDRESS) && ((UINTN)FspData !=3D > MAX_UINT32)) { > Status =3D EFI_UNSUPPORTED; > + } else if (ApiParam =3D=3D NULL) { > + Status =3D EFI_SUCCESS; > } else if (EFI_ERROR (FspUpdSignatureCheck (ApiIdx, ApiParam))) { > Status =3D EFI_INVALID_PARAMETER; > } > @@ -67,9 +69,13 @@ FspApiCallingCheck ( > } else { > if (FspData->Signature !=3D FSP_GLOBAL_DATA_SIGNATURE) { > Status =3D EFI_UNSUPPORTED; > - } else if (EFI_ERROR (FspUpdSignatureCheck (FspSiliconInitApiIndex= , > ApiParam))) { > - Status =3D EFI_INVALID_PARAMETER; > } else if (ApiIdx =3D=3D FspSiliconInitApiIndex) { > + if (ApiParam =3D=3D NULL) { > + Status =3D EFI_SUCCESS; > + } else if (EFI_ERROR (FspUpdSignatureCheck=20 > + (FspSiliconInitApiIndex, > ApiParam))) { > + Status =3D EFI_INVALID_PARAMETER; > + } > + > // > // Reset MultiPhase NumberOfPhases to zero > // > @@ -89,6 +95,8 @@ FspApiCallingCheck ( > } else { > if (FspData->Signature !=3D FSP_GLOBAL_DATA_SIGNATURE) { > Status =3D EFI_UNSUPPORTED; > + } else if (ApiParam =3D=3D NULL) { > + Status =3D EFI_SUCCESS; > } else if (EFI_ERROR (FspUpdSignatureCheck (FspSmmInitApiIndex, > ApiParam))) { > Status =3D EFI_INVALID_PARAMETER; > } > diff --git a/IntelFsp2Pkg/FspSecCore/Ia32/FspApiEntryT.nasm > b/IntelFsp2Pkg/FspSecCore/Ia32/FspApiEntryT.nasm > index 61030a843b..73821ad22a 100644 > --- a/IntelFsp2Pkg/FspSecCore/Ia32/FspApiEntryT.nasm > +++ b/IntelFsp2Pkg/FspSecCore/Ia32/FspApiEntryT.nasm > @@ -21,7 +21,7 @@ extern ASM_PFX(PcdGet32 > (PcdFspReservedBufferSize)) > ; Following functions will be provided in PlatformSecLib ; extern > ASM_PFX(AsmGetFspBaseAddress) -extern > ASM_PFX(AsmGetFspInfoHeader) > +extern ASM_PFX(AsmGetFspInfoHeaderNoStack) > ;extern ASM_PFX(LoadMicrocode) ; @todo: needs a weak > implementation > extern ASM_PFX(SecPlatformInit) ; @todo: needs a weak implementation > extern ASM_PFX(SecCarInit) > @@ -160,6 +160,47 @@ endstruc > RET_ESI_EXT mm7 > %endmacro >=20 > +%macro CALL_EDI 1 > + > + mov edi, %%ReturnAddress > + jmp %1 > +%%ReturnAddress: > + > +%endmacro > + > +%macro CALL_EBP 1 > + mov ebp, %%ReturnAddress > + jmp %1 > +%%ReturnAddress: > +%endmacro > + > +%macro RET_EBP 0 > + jmp ebp ; restore EIP from EBP > +%endmacro > + > +; > +; Load UPD region pointer in ECX > +; > +global ASM_PFX(LoadUpdPointerToECX) > +ASM_PFX(LoadUpdPointerToECX): > + ; > + ; esp + 4 is input UPD parameter > + ; If esp + 4 is NULL the default UPD should be used > + ; ecx will be the UPD region that should be used > + ; > + mov ecx, dword [esp + 4] > + cmp ecx, 0 > + jnz ParamValid > + > + ; > + ; Fall back to default UPD region > + ; > + CALL_EDI ASM_PFX(AsmGetFspInfoHeaderNoStack) > + mov ecx, DWORD [eax + 01Ch] ; Read FsptImageBaseAddress > + add ecx, DWORD [eax + 024h] ; Get Cfg Region base address = =3D > FsptImageBaseAddress + CfgRegionOffset > +ParamValid: > + RET_EBP > + > ; > ; @todo: The strong/weak implementation does not work. > ; This needs to be reviewed later. > @@ -187,10 +228,9 @@ endstruc > global ASM_PFX(LoadMicrocodeDefault) > ASM_PFX(LoadMicrocodeDefault): > ; Inputs: > - ; esp -> LoadMicrocodeParams pointer > + ; ecx -> UPD region contains LoadMicrocodeParams pointer > ; Register Usage: > - ; esp Preserved > - ; All others destroyed > + ; All are destroyed > ; Assumptions: > ; No memory available, stack is hard-coded and used for return addr= ess > ; Executed by SBSP and NBSP > @@ -201,12 +241,9 @@ ASM_PFX(LoadMicrocodeDefault): > ; > movd ebp, mm7 >=20 > + mov esp, ecx ; ECX has been assigned to UPD region > cmp esp, 0 > [Ted]: do we still need to check esp here? Yes, typically ESP now should never be zero, but I keep it there because or= iginal code having this check and this check is nice to have in case unexpe= cted things happening (like FSP with wrong header info). > jz ParamError > - mov eax, dword [esp + 4] ; Parameter pointer > - cmp eax, 0 > - jz ParamError > - mov esp, eax >=20 > ; skip loading Microcode if the MicrocodeCodeSize is zero > ; and report error if size is less than 2k @@ -444,13 +481,15 @@ Done= : > Exit2: > jmp ebp >=20 > - > +; > +; EstablishStackFsp: EDI should be preserved cross this function ; > global ASM_PFX(EstablishStackFsp) > ASM_PFX(EstablishStackFsp): > ; > ; Save parameter pointer in edx > ; > - mov edx, dword [esp + 4] > + mov edx, ecx ; ECX has been assigned to UPD region >=20 > ; > ; Enable FSP STACK > @@ -555,39 +594,37 @@ ASM_PFX(TempRamInitApi): > SAVE_EAX > SAVE_EDX >=20 > - ; > - ; Check Parameter > - ; > - mov eax, dword [esp + 4] > - cmp eax, 0 > - mov eax, 80000002h > - jz TempRamInitExit > - > ; > ; Sec Platform Init > ; > + CALL_EBP ASM_PFX(LoadUpdPointerToECX) ; ECX for UPD param > CALL_MMX ASM_PFX(SecPlatformInit) > cmp eax, 0 > jnz TempRamInitExit >=20 > ; Load microcode > LOAD_ESP > [Ted]: Do we still need to restore ESP before calling function since=20 > we're using ecx to pass parameter? ECX and ESP may be corrupted by any sub-function so here we need to restore= both of them. > + CALL_EBP ASM_PFX(LoadUpdPointerToECX) ; ECX for UPD param > CALL_MMX ASM_PFX(LoadMicrocodeDefault) > SXMMN xmm6, 3, eax ;Save microcode return status in ECX= -SLOT > 3 in xmm6. > ;@note If return value eax is not 0, microcode did not load, but=20 > continue and attempt to boot. >=20 > ; Call Sec CAR Init > LOAD_ESP > [Ted]: Do we still need to restore ESP before calling function since=20 > we're ECX and ESP may be corrupted by any sub-function so here we need to restore= both of them. > using ecx to pass parameter? > + CALL_EBP ASM_PFX(LoadUpdPointerToECX) ; ECX for UPD param > CALL_MMX ASM_PFX(SecCarInit) > cmp eax, 0 > jnz TempRamInitExit >=20 > LOAD_ESP > [Ted]: Do we still need to restore ESP before calling function since=20 > we're ECX and ESP may be corrupted by any sub-function so here we need to restore= both of them. > using ecx to pass parameter? > + CALL_EBP ASM_PFX(LoadUpdPointerToECX) ; ECX for UPD param > + mov edi, ecx ; Save UPD param to EDI for lat= er code use > CALL_MMX ASM_PFX(EstablishStackFsp) > cmp eax, 0 > jnz TempRamInitExit >=20 > LXMMN xmm6, eax, 3 ;Restore microcode status if no CAR init error > from ECX-SLOT 3 in xmm6. > + SXMMN xmm6, 3, edi ;Save FSP-T UPD parameter pointer in ECX-SLOT > 3 in xmm6. >=20 > TempRamInitExit: > mov bl, al ; save al data in bl > diff --git a/IntelFsp2Pkg/FspSecCore/X64/FspApiEntryT.nasm > b/IntelFsp2Pkg/FspSecCore/X64/FspApiEntryT.nasm > index 7dd89c531a..cdebe90fab 100644 > --- a/IntelFsp2Pkg/FspSecCore/X64/FspApiEntryT.nasm > +++ b/IntelFsp2Pkg/FspSecCore/X64/FspApiEntryT.nasm > @@ -21,7 +21,7 @@ extern ASM_PFX(PcdGet32 > (PcdFspReservedBufferSize)) > ; Following functions will be provided in PlatformSecLib ; extern > ASM_PFX(AsmGetFspBaseAddress) -extern > ASM_PFX(AsmGetFspInfoHeader) > +extern ASM_PFX(AsmGetFspInfoHeaderNoStack) > ;extern ASM_PFX(LoadMicrocode) ; @todo: needs a weak > implementation > extern ASM_PFX(SecPlatformInit) ; @todo: needs a weak implementation > extern ASM_PFX(SecCarInit) > @@ -87,6 +87,14 @@ struc LoadMicrocodeParamsFsp24 > .size: > endstruc >=20 > +%macro CALL_RDI 1 > + > + mov rdi, %%ReturnAddress > + jmp %1 > +%%ReturnAddress: > + > +%endmacro > + > ; > ; @todo: The strong/weak implementation does not work. > ; This needs to be reviewed later. > @@ -116,8 +124,7 @@ ASM_PFX(LoadMicrocodeDefault): > ; Inputs: > ; rcx -> LoadMicrocodeParams pointer > ; Register Usage: > - ; rsp Preserved > - ; All others destroyed > + ; All are destroyed > ; Assumptions: > ; No memory available, stack is hard-coded and used for return addr= ess > ; Executed by SBSP and NBSP > @@ -420,10 +427,6 @@ ASM_PFX(TempRamInitApi): > ENABLE_SSE > ENABLE_AVX > ; > - ; Save Input Parameter in YMM10 > - ; > - SAVE_RCX > - ; > ; Save RBP, RBX, RSI, RDI and RSP in YMM7, YMM8 and YMM6 > ; > SAVE_REGS > @@ -433,6 +436,22 @@ ASM_PFX(TempRamInitApi): > ; > SAVE_BFV rbp >=20 > + ; > + ; Save Input Parameter in YMM10 > + ; > + cmp rcx, 0 > + jnz ParamValid > + > + ; > + ; Fall back to default UPD > + ; > + CALL_RDI ASM_PFX(AsmGetFspInfoHeaderNoStack) > + xor rcx, rcx > + mov ecx, DWORD [rax + 01Ch] ; Read FsptImageBaseAddress > + add ecx, DWORD [rax + 024h] ; Get Cfg Region base address = =3D > FsptImageBaseAddress + CfgRegionOffset > +ParamValid: > + SAVE_RCX > + > ; > ; Save timestamp into YMM6 > ; > @@ -441,13 +460,6 @@ ASM_PFX(TempRamInitApi): > or rax, rdx > SAVE_TS rax >=20 > - ; > - ; Check Parameter > - ; > - cmp rcx, 0 > - mov rcx, 08000000000000002h > - jz TempRamInitExit > - > ; > ; Sec Platform Init > ; > -- > 2.35.0.windows.1 >=20 >=20 > -=3D-=3D-=3D-=3D-=3D-=3D > Groups.io Links: You receive all messages sent to this group. > View/Reply Online (#95854): > https://edk2.groups.io/g/devel/message/95854 > Mute This Topic: https://groups.io/mt/94728678/1862468 > Group Owner: devel+owner@edk2.groups.io > Unsubscribe: https://edk2.groups.io/g/devel/unsub [ted.kuo@intel.com]=20 > - =3D-=3D-=3D-=3D-=3D-=3D >=20