From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mx.groups.io with SMTP id smtpd.web09.15157.1667442744805184924 for ; Wed, 02 Nov 2022 19:32:25 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=PvlHOswI; spf=pass (domain: intel.com, ip: 192.55.52.120, 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=1667442744; x=1698978744; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=ZTHIaWuP2s+veGfMshVOtWf+vO20KvJN/PxLqch3+Dw=; b=PvlHOswIkay9lBNvEigRg95A5l9OQm3JhmNneqyfRfsUlPB+0ZBoSwOA OTXLzxEw2Mz1+hc3TlfKfgNMnkNtnPj4LfyP8ZVCADp2lNUCNpmcbQZxg s4VEXBbwHWXuYxRrRBRfXhgCCMRvt4T7jLc6sHpfv6r50zz/jZzIxGfCL Flgd18xnzTI7+08lgLbOpIpzhonob58slCr/azuR6oUIdqP1qf05A3FoR fZmk8/wuaK7xTnx9hgyY607ID1QVBAJr8rLvayFsMUwORlQcMLbCUDwC+ 4wn4TgV/fdvr79YFtcHogNUP8pRBRZYneXLFIhO4VqbMyc2ubXT7XPGmV Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10519"; a="308287828" X-IronPort-AV: E=Sophos;i="5.95,235,1661842800"; d="scan'208";a="308287828" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Nov 2022 19:32:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10519"; a="963763975" X-IronPort-AV: E=Sophos;i="5.95,235,1661842800"; d="scan'208";a="963763975" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by fmsmga005.fm.intel.com with ESMTP; 02 Nov 2022 19:32:16 -0700 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) 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; Wed, 2 Nov 2022 19:32:16 -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; Wed, 2 Nov 2022 19:32:15 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) 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; Wed, 2 Nov 2022 19:32:15 -0700 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (104.47.57.171) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2375.31; Wed, 2 Nov 2022 19:32:15 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Yagjz0BA2UDJ/omRwPT8pkZwAY150Iyv57KAHZT5MD4vVSocwwIlFghApgpmMK2huiaNVoLYLyUwhoBJGhRqN3sHu2kto/Zr4kLc/xkbldUjXVrs7SCwaACTfGcLybsXgGdp50DoJP6ar6mtjYShgwi+cnhGDfnEe++c8N64sW6rk+qpQsq4Hq20hoEdFsYI9LI3M6Aj3niYdsJu2uu06XEkDiojDEqxiiZNY1HDJCzBlI9Dqrp2NYqel6qC7Zc8TGNneqPoCpcTzTphi7P+eVKiRnec3c8FhhddxAb+JvOPoAGjWDnylswZXezqtJrHxFDJZ7mJyB/+NrsqsH7jIw== 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=bygEXOlhN/nRyQXPsGpMcvDOnss6Kcs6myK4UMhR0Ck=; b=mTeG1SkF7Hpa16drjc83lKmZZo65dcL0Ov6ifqrHtqzRFDTkkqsnkqM7qENM2mBwu9YPQWEuz/itNsW14AQWsFKAms2cMdUcCMr+YCpxq4VfxehGqBZfOiV2gWAKA9kqzdoy28+Whsql5FFjU3DRmG7GOMxNt23x9LS8iZ2s6CIoJTYceUju1xjnu2CeYmUXQWlpmYl0EuQ2DEnxEWJUablcRbQke9lB8QSdze2rBjxiW2KqQ4iZk0gapjT3JJIYGNRM4D4nCHWmShI0SjSDVCX3TvvQuLEBVBgslN1b2isClPVEcLVYFy8orqiIIhm9+ykK4ApWj8zI4916Uht0Hw== 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 CY8PR11MB7107.namprd11.prod.outlook.com (2603:10b6:930:51::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.20; Thu, 3 Nov 2022 02:32:14 +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.5769.021; Thu, 3 Nov 2022 02:32:13 +0000 From: "Kuo, Ted" To: "devel@edk2.groups.io" , "Chiu, Chasel" 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: AQHY7n6bghSjqYeYUEaRoftaY9faBK4segGw Date: Thu, 3 Nov 2022 02:32:13 +0000 Message-ID: References: <20221102054627.1496-1-chasel.chiu@intel.com> In-Reply-To: <20221102054627.1496-1-chasel.chiu@intel.com> 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_|CY8PR11MB7107:EE_ x-ms-office365-filtering-correlation-id: c4517a1e-9a18-44bf-1ac6-08dabd439e01 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: zjlB8onJ5f+7ccBNqU/MXFmtR4iyLXKAqRYCH9IO3g316inbp2VkpQpCQKjUB72wmTxsL+mgMSizo8ae7vbrB2olAYDn+fN9zv6MsrWwf/eYX1MWlxhe0FAr3sJxBw50DGoux09SwygumktSZFKl7m6ksgpQy340pnqEJI4LEMl78kw4zdWNk3ukkeK5MpAgshXoLZLAX7J5KFpMDAaOrzQPK+Fer/bNZIJyK9w5/0XrlY0UIKspuhoVDV+r7iKZ8TYs9DaS5FLQX0EtJb5nRtzOBjHINkXeIA/wmM9gREfXbcKtX+jP/Hf7JAiKW0z+BfisFrWSF/HG7yssdqU1PR6CGzpnUAosT4uGJqNEB5buLk2PEQ1RvQJbXa/9ESclxW1tQcfR/TuauCXQ/6FN/T4v4BeccrpG54aIm6MprlqYZW8yZyzaMnuvTTWsTBxVT7PLyAPoWGC8rs6DjbHvtkGakeb7etygCfMH5Hf5V8xSqpHbmd/g9JwWy/7S/qO/vqr7fVDp9FynugpTSceqxRiVaT9B828Da+tythv4jKOjp4nwhuG2DlfjgPOLAz4v4wB3zpEr2vAo+2SFVUfWeIZUayxVWDJygtDuhjrA7vMG/F11+GMxktHOCsIdV24m1kSznft6qvpsdP+RmjmSaWJO1GkJH4vHd9EeKhiedcFLY5R7ErWf3xGD2Xs/i8CogV6awtc66ecYCxC4cH4lQWtOgEw+BNBorh1tbQw2n2a1//vNe0EEzo3MT94Ms6CeqC484Q1cuSPz+B5IdzsP+gnxr9UCVA7LlPAOiahShNKuDaKD0nREWbUQOuUSk+OD62fRERarr5UdUWwGBjU1e1IF+UeKiHATTqFirrKdg8k= 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)(136003)(346002)(366004)(376002)(39860400002)(396003)(451199015)(83380400001)(66899015)(64756008)(86362001)(55016003)(122000001)(107886003)(6506007)(2906002)(7696005)(966005)(71200400001)(82960400001)(38070700005)(38100700002)(33656002)(53546011)(186003)(26005)(19627235002)(9686003)(478600001)(66446008)(66476007)(316002)(8676002)(66556008)(41300700001)(8936002)(54906003)(5660300002)(66946007)(4326008)(52536014)(76116006)(110136005)(6636002)(11716005);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?v6hsloQU08J68Ga4g3GdUclLAm04n36SX78JVwRtk/+kCcxWs5Btas/o2HHZ?= =?us-ascii?Q?JYDFMvmzTnF6dWjg9L1zfvL8WNb/Nr4Pe+d7Bl6SmO+x0UfwtY6hYGk8VW2e?= =?us-ascii?Q?XcTp9q47kqPAuRN3zpvXAjX1qm+p9yo/MkePf7xoQS1m42OmrSvNwuNs0EY9?= =?us-ascii?Q?CcP8EWTLi/ghChwcCAFs7R0Amsl6alfdzEmE3SwjJM1Fe0slgElp8OUZMAu7?= =?us-ascii?Q?ZKGx6SxoBJRvLkuYJBlrTHbbpOfWXiXFwEdNHv+4Wg6pya8jdy/U4R44TVDd?= =?us-ascii?Q?cQ3cAG1QN7FAXM/gMlnE1F93zhz9p5vY9q0N0baMPXXGqa9VOVnb0QgaJ4Zz?= =?us-ascii?Q?n8RK5esb21melABqL1UfN06NbJXCeX0HmkuEiVAML9vrpgUygXCUwQcJ9YMU?= =?us-ascii?Q?shioao/2CmxVfiIUHbYgT8MyQaT4aSGLT466gnrUO/AHZm+udnGdLmdDQZdT?= =?us-ascii?Q?O3O2eIhLl+S04cAwdTwPjLLpEyfK2yPapWpJ7VGX2oIKvcxkVzlIK5l3Indk?= =?us-ascii?Q?tB0pMDtTDC5IhIyp47VDqFm8bk6awJXcMZmECzeyN4IYneoVLriEIvC+bTTx?= =?us-ascii?Q?y7jTExdQUJc9jyHSMfhZeX36DFcyc4rdmjqT0fSeIcYGK4pEipjskcXqmWZD?= =?us-ascii?Q?/eEDMDJc2zXwDPN2pXTAi6VXLGD6luZGyHrSRXsG5sH99p9oTJSNWTcJRPPf?= =?us-ascii?Q?cxDJOJ9qljqtFHDf1h2qkglWL2pgVR69b33/a2UZ1zqGmsN9TWSNDDK9TTAI?= =?us-ascii?Q?rYQULzGCwGSdDVYfHpf+zwgPefLDJRB7fMi+nWQPOPQ7eCZkFYfvcGJzsyjc?= =?us-ascii?Q?rkC4m7ms6n8y0RdHRRTWmFDpAZwepbkyqi3V1J0hVAclTJrw6TbsbaN1/oao?= =?us-ascii?Q?3aLVgRGRwytr5X8UbcWU9YEpT16Xl3/5NNHtnuacgxhp/J++Sc3NKWu3nu+D?= =?us-ascii?Q?8MYKUBqR1zyZF/tpJ9FwH88nYM90abMmvo2XPx9Ota6W5fDhLV/DKUNRBz4p?= =?us-ascii?Q?O0FdhAj8GCg+MlT+oNz9A/s2g20qFPlAAT8VrEs26ZrCAqoSB8O/skfU+x6M?= =?us-ascii?Q?Cdd5zXjbD0w/K0K/MNCDFyextp91AWRzXLw7Q0LUhVRuVkQdhCHoPO/JX+4O?= =?us-ascii?Q?HkQcQf2ct7ZkuxXbxOUS9hAwQ2CbeCh+9EiT8Zvx8UwVpwMT6pej+3BWVo9C?= =?us-ascii?Q?GPoruXlp/UtQxr2zJ+fOI3IpwW6xaXgdQ2LBKCK4JMTg3DdThSmqlDQKXl8G?= =?us-ascii?Q?hxySGs/4GEUvxNVKOG+2UBGmcEXOr5AejiGnC1xFRKfBJZvrfp6rAzYZdJ9P?= =?us-ascii?Q?QH6LtNBY8PznKhWKkcPlDeevGqUF3V0WfnRvhqCBSsyWhckKrj4s61F7F29O?= =?us-ascii?Q?60mC1DoWbWS/7tYmoXQksw4fVA6hsQNpz5OwfrYSnOcB5yNr6t+A9AVYjeIq?= =?us-ascii?Q?LrKfdQy1xAFBWQsuzt1MJPQ1s85yn+yUkdqULfMV9jSebX0FovcVPL+gAenD?= =?us-ascii?Q?2hCraA6syBOXl/EBNh7VpdazckCaWWnnRTQLon7OIpsV54WOPqx6MiLIuKws?= =?us-ascii?Q?q1ubceSaClNDGXktNUzUXcZKRkjbmz9Rz7jgduAv?= 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: c4517a1e-9a18-44bf-1ac6-08dabd439e01 X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Nov 2022 02:32:13.7208 (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: vK0xw/TsVm0l6DHGzO0WiY5JP5HMDwg0skn0UgJ4IXiwOj+DXIhnH+jFVfMiPOQWXz9rExOdxkeo6TrBiL13mw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR11MB7107 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 Hi Chasel, I have few comments. Please find [Ted] inline. Thanks, Ted -----Original Message----- From: devel@edk2.groups.io On Behalf Of Chiu, Chasel Sent: Wednesday, November 2, 2022 1:46 PM To: devel@edk2.groups.io Cc: Chiu, Chasel ; Desimone, Nathaniel L ; Zeng, Star Subject: [edk2-devel] [PATCH v2] IntelFsp2Pkg: FSP should support input UPD= as NULL. REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4114 FSP specification supports input UPD as NULL cases which FSP will use built-in UPD region instead. FSP should not return INVALID_PARAMETER in such cases. In FSP-T entry point case, the valid FSP-T UPD region pointer will be passed to platform FSP code to consume. In FSP-M and FSP-S cases, valid UPD pointer will be decided when updating corresponding pointer field in FspGlobalData. 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(-) diff --git a/IntelFsp2Pkg/FspSecCore/SecFspApiChk.c b/IntelFsp2Pkg/FspSecCo= re/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_UINT= 32)) { 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 (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, ApiP= aram))) { 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 addres= s ; 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? 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 we're = using ecx to pass parameter? + CALL_EBP ASM_PFX(LoadUpdPointerToECX) ; ECX for UPD param CALL_MMX ASM_PFX(LoadMicrocodeDefault) SXMMN xmm6, 3, eax ;Save microcode return status in ECX-S= LOT 3 in xmm6. ;@note If return value eax is not 0, microcode did not load, but continu= e and attempt to boot. =20 ; Call Sec CAR Init LOAD_ESP [Ted]: Do we still need to restore ESP before calling function since we're = 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 we're = using ecx to pass parameter? + CALL_EBP ASM_PFX(LoadUpdPointerToECX) ; ECX for UPD param + mov edi, ecx ; Save UPD param to EDI for later= 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 f= rom 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/F= spSecCore/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 addres= s ; 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 ; --=20 2.35.0.windows.1 -=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] -=3D-= =3D-=3D-=3D-=3D-=3D