From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (NAM10-BN7-obe.outbound.protection.outlook.com [40.107.92.65]) by mx.groups.io with SMTP id smtpd.web11.38259.1674101192834200690 for ; Wed, 18 Jan 2023 20:06:33 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@amd.com header.s=selector1 header.b=XByVj/px; spf=permerror, err=parse error for token &{10 18 %{i}._ip.%{h}._ehlo.%{d}._spf.vali.email}: invalid domain name (domain: amd.com, ip: 40.107.92.65, mailfrom: abner.chang@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=B11yV1KWr2ozhdalQqDXsHC9maZEdLYQU5tUZaTtXW7sCYkqdN1FvmN62IYgm7OnMadSEuA/BQkS2EQu7eRD0MWq0ZnD4WqwhYdbPfnxVy4lKFfiY0hkyAWE60TedahSv8pxLYiAlakN8YGjDrc60Dgg2dE9M8OIvnS9T+CEqMZH/gJMg719mLwWl4rlI1nI1/TF3mZyKHCRXrkz1X+UoUM4ESro4DDDRq4M5SjtlV2tAZ1Lo7MqTWmWnAtI23gitPRTyP6djnzvvhTSIxmyPuxssCPANOnvzpnwY68TdpRjJbX5s3bA7iT9ydWgsEFFpS72Er1QutbgUaqdPB1zBg== 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=168uBzfbTmJFIC+/PE8wYY1xDhA2gKSJ6iQNSz0yCXU=; b=GZDEmP3gDQcmL6fMiDO8ePw+Ex4JD9uNiiEDU2gcGMMCzzJJAV/fVfnLrg8VU6AmnOyIra48PamG1/bJuRw9t3d+rTPaFteXZTldhnCAtLozJYRvFp0l6FKyxjP54+0mhJKzByBUvajc1ybwFPHI5IpV803IKh5H1Mi1eKUrLoLUCLYYtTNA0HNuQcUb9upFq8uT7d+kZY5VPdnBa++JbzI3UqjUGIeKZETW3W2ROYgm1BD9zTbf9kc3OBFaolMUriUQgIGSZ4dvvRLbF4J10hKLntgU4Foy7U3AKjPhdehbUpcXKRBkLj31XmnyOFIumzXd7lL92d30kIB6yHQfyg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=168uBzfbTmJFIC+/PE8wYY1xDhA2gKSJ6iQNSz0yCXU=; b=XByVj/pxPwmoVGjGoy10Z0wX2Gi4jRpkzH/O8W/oLI7ca0ils2DG+YECDU3uY1amWLYY0JZNsYUoECvx/p0Y2Tf2uuQqhzO5+Y8b2+S8wysyCXSewwsGx2J6sjsYkxWmJhDCq7lJwKPlZYlL/R4aCu1ujNoRKj87io2lAEvlswU= Received: from MN2PR12MB3966.namprd12.prod.outlook.com (2603:10b6:208:165::18) by MW4PR12MB6899.namprd12.prod.outlook.com (2603:10b6:303:208::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.13; Thu, 19 Jan 2023 04:06:29 +0000 Received: from MN2PR12MB3966.namprd12.prod.outlook.com ([fe80::d606:ab63:cf3:5d36]) by MN2PR12MB3966.namprd12.prod.outlook.com ([fe80::d606:ab63:cf3:5d36%7]) with mapi id 15.20.6002.024; Thu, 19 Jan 2023 04:06:29 +0000 From: "Chang, Abner" To: "devel@edk2.groups.io" , "Attar, AbdulLateef (Abdul Lateef)" CC: "Kirkendall, Garrett" , "Grimes, Paul" , Eric Dong , Ray Ni , Rahul Kumar Subject: Re: [edk2-devel] [PATCH v3 4/6] UefiCpuPkg/SmmCpuFeaturesLib: Restructure arch-dependent code Thread-Topic: [edk2-devel] [PATCH v3 4/6] UefiCpuPkg/SmmCpuFeaturesLib: Restructure arch-dependent code Thread-Index: AQHZK16RFfM0cg9N/0icrqSlMyMeoq6lIA7w Date: Thu, 19 Jan 2023 04:06:29 +0000 Message-ID: References: <9ba1dc9ff9a63abab8d8dc9fabb67662c8fc20b6.1674060385.git.abdattar@amd.com> In-Reply-To: <9ba1dc9ff9a63abab8d8dc9fabb67662c8fc20b6.1674060385.git.abdattar@amd.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Enabled=true; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_SetDate=2023-01-19T04:06:27Z; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Method=Standard; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Name=General; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_SiteId=3dd8961f-e488-4e60-8e11-a82d994e183d; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_ActionId=e58bc871-110e-4f99-a50f-d1734d683144; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_ContentBits=1 authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MN2PR12MB3966:EE_|MW4PR12MB6899:EE_ x-ms-office365-filtering-correlation-id: 9f0d171d-e932-4274-dd92-08daf9d28b08 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: jhETs5MM7D7wFHAo4baNMYAJqt3T7Vy3t+qy4T7pyjPDHtvern4vEZzRWQMJnwAmlJ6tOa900fhai1/6mF4MkmAYosnTwMkh3jumGjFUbCs+UH5eTW4z/2HD5LhUr/eCpvdVW38ZwUuczA1OvUHzIrD6WszFgyLXTNUjVGNXjVugPxFkzoxPihpYhh6VFDyNfiA/Y+cfjzCeN5X4s7UGFBxXIyCaq6CUMPNip5veMG+gyGIYfYrZfnpvpRlymOxxpT2ChLjzOAI4ovu8tDVYgfNqsdeONPQO2PQ+2M5368ezxMsXiZT+5rzYQTjLSPk31crNJ6Qt69e04CRoVaG3Z9n2T1fW91UX0OiYSupLwLzCe/3Y8q4pHUNOgXDq+cAnow7vDa2NOIhkcfhV45VCkYA3tETVVhbJE7fyLB0enIYQx6+21KbQ5Xk9sXuDj8xiDZXW0rHMRvT6nZyIqA+X9rIDa6MkbTX2Mc/Jf0VA2Yt8T0huIpE5huSWI1+3T0hKUcYY6b3iiYL0byzQAjEE/vvuvEx7aWVGKPgE4vY5TE95OLzdkfdxl9OLgMoVNgeOBdOjbuhYSEpD9BZRwlQn9WsxJXaCjAbTcbYe3cDMX8GHMgecsuLkd3plteD/PVLOJcerYTgyqxmLboAiuQgOR6SANFwZipGF9vz93qPOo5aIBBL3duiBXrvfVGywmKmuX7CVEfREpFrRR7bTvYS9gQypQ4D5lau+fOpGpvK6r0i364INpy+GlbSCz3LZfzo0a86G5j6eT4IWB6knHbR9aQ== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN2PR12MB3966.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(396003)(136003)(376002)(39860400002)(346002)(366004)(451199015)(38100700002)(2906002)(122000001)(66899015)(55016003)(33656002)(86362001)(7696005)(110136005)(54906003)(19627235002)(6636002)(38070700005)(316002)(71200400001)(64756008)(66556008)(66946007)(4326008)(66446008)(76116006)(83380400001)(5660300002)(41300700001)(66476007)(8676002)(30864003)(6506007)(9686003)(53546011)(26005)(186003)(966005)(52536014)(8936002)(478600001);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?7Vpe8WwlZSXpKQYuRUBhR70nj8HZO9YEWfXQPzWhYQti0AGDPBA48oa/mMHq?= =?us-ascii?Q?i/U4pC6Wi65pDXCWxRoF1Ugl0kJ2IjUoqvpkUGwExgnPmMgMxCKEcvX7ShR/?= =?us-ascii?Q?7Z64+5LwpLp/Zecg3oLl8ti7dNG/ss3N9lqG8VBGc4lpSYzd5C328lDveZLI?= =?us-ascii?Q?iJvPuyGTwYUcoBpRPFjsuVcnFtx6Bv4uBZxOpfRheDRtEyD+qhUvH1ibOZGf?= =?us-ascii?Q?tPPKHJm0W2CkEo+HwVdqP/FL0N1Awg/u9aY5V1JKUrFccgTjDLb3R6bFoOMp?= =?us-ascii?Q?wG5Y9cVZegcSNKNE6odcOxZvn9efQ5/LTgLZP0et3qIyvaaX8zjjMxO2NJoC?= =?us-ascii?Q?Nl2P5GBe3wHbnYeBaM6jkJnB/KFXbpUlEtGMg6W0VokRlRiookcHXgsqxdxj?= =?us-ascii?Q?4jScEqk0JPbt4XcPDgWRMgotZm53Q+PHeCo4lnuBEegQdU63wQmO3Ce4jqQp?= =?us-ascii?Q?lZpodMaq0yZwT4sVYDeF8tT/2vXpMSRx15jR6JUa0G8NfgAQ6g3M7aTmlSzU?= =?us-ascii?Q?vqSsMTI8XIb4rjXv0toEzWWDgX0yngO7xHHgX8ISP0+i9Wxil4BPsl2EoHz1?= =?us-ascii?Q?NAyv+DcyAdglAAo5A7DDrkskWkizR7wWTp1OcSu4TV+d4OWgOBplYd5+2w5/?= =?us-ascii?Q?rAcOzOzfhgGk5srdBGRWNCd4L2EK8xp3xn8tMXz3S6Sjalrvmn6GdL7PfPZL?= =?us-ascii?Q?VouIbGKufG6Ez22zudAXG6AxCRo7C/JS0tssUinjG79rm80R+4bcEoBR7zUu?= =?us-ascii?Q?7KpEE8ZMjyPDtPn/1yGxp3COrHSUUeOWJCuRNa9jsc5TIzG2KtP30TSDFjwd?= =?us-ascii?Q?KsEbUJ9QcJD0J8/WhT8G1nT9wlQuE2LEZD5b9zHuimUBUzUpv52oxRsFlwtA?= =?us-ascii?Q?LthN4d5pe+ASQ000cXzm9yRjToFnLRlEVniQRxO6wn1Qbj+b/1pAWTKoRbgL?= =?us-ascii?Q?JvZswt3A1f+9oTABNSYB894UD7dTCHmJRnVyxUXUhHpvGvpeh/r5R3fdIFmc?= =?us-ascii?Q?+JzECbDXOHfDqlnx2J4V0+VrMzX2+pP47l2Z+tiH65fgyOvnfMlNSNxYmyM9?= =?us-ascii?Q?WPkEkZB2N7lYXPM0lwtx7oOKunV4erCbYu7kop4u6t3hUgKiYObW9cdSJAq+?= =?us-ascii?Q?k0GSU6gE2qScE6mIEIykoLZ/KKXZXiVBgwpKG1/66Htl4FdK1hqEfeEN5nU9?= =?us-ascii?Q?M0dTJj2hh5metwvCBKvChDHjjlamLXMzn0YfdQ65dVpuvXwmUMvbhpLIfJ5o?= =?us-ascii?Q?2QAGw5hdz2wjvQJZKfYMViQgdwq3Ekic3bp+AC1rAtt89exhsiqSQpfbid/C?= =?us-ascii?Q?38+6uUzpSXZAGYHt01J3Gz8Oe48XLPpcA9VZhjEXr+vzKGGcPJHpx0718OUq?= =?us-ascii?Q?bsKm3Ko2I3rBP4bCEDTqYiR5tQjOw2+4G7rn2QDWvFow5LbeVLSiysgrhoyN?= =?us-ascii?Q?vUXEs/K23WM1/JrRcfQ0RlMOnlO8oXvvnQDtUyI/oxCsgn6mnmWkQUOlCVNa?= =?us-ascii?Q?gVk4hRdRHCb5bkmcHq65hgMUnSwjBU0soelrF9ih7si/ohc+028fB6Q4Kq29?= =?us-ascii?Q?wwyDJnkrFtJRwQQC/RTwoibo6WCR/1kgIt/PjUW1?= MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MN2PR12MB3966.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9f0d171d-e932-4274-dd92-08daf9d28b08 X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Jan 2023 04:06:29.7252 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: acgQ4HLP2Bw+3ebjGtOCoVbABOVypGjwNNaHDYT43Ul6zyniPOuDimS1GTaaK7GjCM+H/uefMcB94CJLK2PEPg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB6899 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable [AMD Official Use Only - General] Reviewed-by: Abner Chang > -----Original Message----- > From: devel@edk2.groups.io On Behalf Of Abdul > Lateef Attar via groups.io > Sent: Thursday, January 19, 2023 1:01 AM > To: devel@edk2.groups.io > Cc: Attar, AbdulLateef (Abdul Lateef) ; Chang, > Abner ; Kirkendall, Garrett > ; Grimes, Paul ; Eric > Dong ; Ray Ni ; Rahul Kumar > > Subject: [edk2-devel] [PATCH v3 4/6] UefiCpuPkg/SmmCpuFeaturesLib: > Restructure arch-dependent code >=20 > Caution: This message originated from an External Source. Use proper > caution when opening attachments, clicking links, or responding. >=20 >=20 > From: Abdul Lateef Attar >=20 > BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4182 >=20 > moves Intel-specific code to the arch-dependent file. > Other processor families might have different implementation of these > functions. > Hence, moving out of the common file. >=20 > Cc: Abner Chang > Cc: Garrett Kirkendall > Cc: Paul Grimes > Cc: Eric Dong > Cc: Ray Ni > Cc: Rahul Kumar > Signed-off-by: Abdul Lateef Attar > --- > .../IntelSmmCpuFeaturesLib.c | 128 ++++++++++++++++++ > .../SmmCpuFeaturesLibCommon.c | 128 ------------------ > 2 files changed, 128 insertions(+), 128 deletions(-) >=20 > diff --git > a/UefiCpuPkg/Library/SmmCpuFeaturesLib/IntelSmmCpuFeaturesLib.c > b/UefiCpuPkg/Library/SmmCpuFeaturesLib/IntelSmmCpuFeaturesLib.c > index d5eaaa7a991e..33b1ddf8cfa9 100644 > --- a/UefiCpuPkg/Library/SmmCpuFeaturesLib/IntelSmmCpuFeaturesLib.c > +++ b/UefiCpuPkg/Library/SmmCpuFeaturesLib/IntelSmmCpuFeaturesLib.c > @@ -400,3 +400,131 @@ SmmCpuFeaturesSetSmmRegister ( > AsmWriteMsr64 (SMM_FEATURES_LIB_SMM_FEATURE_CONTROL, Value); >=20 > } >=20 > } >=20 > + >=20 > +/** >=20 > + This function updates the SMRAM save state on the currently executing > + CPU >=20 > + to resume execution at a specific address after an RSM instruction. > + This >=20 > + function must evaluate the SMRAM save state to determine the > + execution mode >=20 > + the RSM instruction resumes and update the resume execution address > + with >=20 > + either NewInstructionPointer32 or NewInstructionPoint. The auto HALT > + restart >=20 > + flag in the SMRAM save state must always be cleared. This function > + returns >=20 > + the value of the instruction pointer from the SMRAM save state that > + was >=20 > + replaced. If this function returns 0, then the SMRAM save state was > + not >=20 > + modified. >=20 > + >=20 > + This function is called during the very first SMI on each CPU after >=20 > + SmmCpuFeaturesInitializeProcessor() to set a flag in normal execution > + mode >=20 > + to signal that the SMBASE of each CPU has been updated before the > + default >=20 > + SMBASE address is used for the first SMI to the next CPU. >=20 > + >=20 > + @param[in] CpuIndex The index of the CPU to hook. The= value >=20 > + must be between 0 and the > + NumberOfCpus >=20 > + field in the System Management > + System Table >=20 > + (SMST). >=20 > + @param[in] CpuState Pointer to SMRAM Save State Map fo= r the >=20 > + currently executing CPU. >=20 > + @param[in] NewInstructionPointer32 Instruction pointer to use if > + resuming to >=20 > + 32-bit execution mode from 64-bit = SMM. >=20 > + @param[in] NewInstructionPointer Instruction pointer to use if resu= ming > to >=20 > + same execution mode as SMM. >=20 > + >=20 > + @retval 0 This function did modify the SMRAM save state. >=20 > + @retval > 0 The original instruction pointer value from the SMRAM > + save state >=20 > + before it was replaced. >=20 > +**/ >=20 > +UINT64 >=20 > +EFIAPI >=20 > +SmmCpuFeaturesHookReturnFromSmm ( >=20 > + IN UINTN CpuIndex, >=20 > + IN SMRAM_SAVE_STATE_MAP *CpuState, >=20 > + IN UINT64 NewInstructionPointer32, >=20 > + IN UINT64 NewInstructionPointer >=20 > + ) >=20 > +{ >=20 > + return 0; >=20 > +} >=20 > + >=20 > +/** >=20 > + Read an SMM Save State register on the target processor. If this > + function >=20 > + returns EFI_UNSUPPORTED, then the caller is responsible for reading > + the >=20 > + SMM Save Sate register. >=20 > + >=20 > + @param[in] CpuIndex The index of the CPU to read the SMM Save > + State. The >=20 > + value must be between 0 and the NumberOfCpus > + field in >=20 > + the System Management System Table (SMST). >=20 > + @param[in] Register The SMM Save State register to read. >=20 > + @param[in] Width The number of bytes to read from the CPU save > state. >=20 > + @param[out] Buffer Upon return, this holds the CPU register value r= ead >=20 > + from the save state. >=20 > + >=20 > + @retval EFI_SUCCESS The register was read from Save State. >=20 > + @retval EFI_INVALID_PARAMETER Buffer is NULL. >=20 > + @retval EFI_UNSUPPORTED This function does not support reading > Register. >=20 > + >=20 > +**/ >=20 > +EFI_STATUS >=20 > +EFIAPI >=20 > +SmmCpuFeaturesReadSaveStateRegister ( >=20 > + IN UINTN CpuIndex, >=20 > + IN EFI_SMM_SAVE_STATE_REGISTER Register, >=20 > + IN UINTN Width, >=20 > + OUT VOID *Buffer >=20 > + ) >=20 > +{ >=20 > + return EFI_UNSUPPORTED; >=20 > +} >=20 > + >=20 > +/** >=20 > + Writes an SMM Save State register on the target processor. If this > + function >=20 > + returns EFI_UNSUPPORTED, then the caller is responsible for writing > + the >=20 > + SMM Save Sate register. >=20 > + >=20 > + @param[in] CpuIndex The index of the CPU to write the SMM Save > + State. The >=20 > + value must be between 0 and the NumberOfCpus > + field in >=20 > + the System Management System Table (SMST). >=20 > + @param[in] Register The SMM Save State register to write. >=20 > + @param[in] Width The number of bytes to write to the CPU save stat= e. >=20 > + @param[in] Buffer Upon entry, this holds the new CPU register value= . >=20 > + >=20 > + @retval EFI_SUCCESS The register was written to Save State. >=20 > + @retval EFI_INVALID_PARAMETER Buffer is NULL. >=20 > + @retval EFI_UNSUPPORTED This function does not support writing > Register. >=20 > +**/ >=20 > +EFI_STATUS >=20 > +EFIAPI >=20 > +SmmCpuFeaturesWriteSaveStateRegister ( >=20 > + IN UINTN CpuIndex, >=20 > + IN EFI_SMM_SAVE_STATE_REGISTER Register, >=20 > + IN UINTN Width, >=20 > + IN CONST VOID *Buffer >=20 > + ) >=20 > +{ >=20 > + return EFI_UNSUPPORTED; >=20 > +} >=20 > + >=20 > +/** >=20 > + Check to see if an SMM register is supported by a specified CPU. >=20 > + >=20 > + @param[in] CpuIndex The index of the CPU to check for SMM register > support. >=20 > + The value must be between 0 and the NumberOfCpus > + field >=20 > + in the System Management System Table (SMST). >=20 > + @param[in] RegName Identifies the SMM register to check for support. >=20 > + >=20 > + @retval TRUE The SMM register specified by RegName is supported by > the CPU >=20 > + specified by CpuIndex. >=20 > + @retval FALSE The SMM register specified by RegName is not supported > + by the >=20 > + CPU specified by CpuIndex. >=20 > +**/ >=20 > +BOOLEAN >=20 > +EFIAPI >=20 > +SmmCpuFeaturesIsSmmRegisterSupported ( >=20 > + IN UINTN CpuIndex, >=20 > + IN SMM_REG_NAME RegName >=20 > + ) >=20 > +{ >=20 > + if (FeaturePcdGet (PcdSmmFeatureControlEnable) && (RegName =3D=3D > + SmmRegFeatureControl)) { >=20 > + return TRUE; >=20 > + } >=20 > + >=20 > + return FALSE; >=20 > +} >=20 > diff --git > a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibCommon.c > b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibCommon.c > index 5498fda38da4..cbf4b495185b 100644 > --- > a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibCommon.c > +++ > b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibCommon.c > @@ -17,49 +17,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent >=20 >=20 > #include "CpuFeaturesLib.h" >=20 >=20 >=20 > -/** >=20 > - This function updates the SMRAM save state on the currently executing > CPU >=20 > - to resume execution at a specific address after an RSM instruction. T= his >=20 > - function must evaluate the SMRAM save state to determine the execution > mode >=20 > - the RSM instruction resumes and update the resume execution address > with >=20 > - either NewInstructionPointer32 or NewInstructionPoint. The auto HALT > restart >=20 > - flag in the SMRAM save state must always be cleared. This function re= turns >=20 > - the value of the instruction pointer from the SMRAM save state that wa= s >=20 > - replaced. If this function returns 0, then the SMRAM save state was n= ot >=20 > - modified. >=20 > - >=20 > - This function is called during the very first SMI on each CPU after >=20 > - SmmCpuFeaturesInitializeProcessor() to set a flag in normal execution > mode >=20 > - to signal that the SMBASE of each CPU has been updated before the > default >=20 > - SMBASE address is used for the first SMI to the next CPU. >=20 > - >=20 > - @param[in] CpuIndex The index of the CPU to hook. The= value >=20 > - must be between 0 and the NumberOf= Cpus >=20 > - field in the System Management Sys= tem Table >=20 > - (SMST). >=20 > - @param[in] CpuState Pointer to SMRAM Save State Map fo= r the >=20 > - currently executing CPU. >=20 > - @param[in] NewInstructionPointer32 Instruction pointer to use if > resuming to >=20 > - 32-bit execution mode from 64-bit = SMM. >=20 > - @param[in] NewInstructionPointer Instruction pointer to use if resu= ming > to >=20 > - same execution mode as SMM. >=20 > - >=20 > - @retval 0 This function did modify the SMRAM save state. >=20 > - @retval > 0 The original instruction pointer value from the SMRAM sav= e > state >=20 > - before it was replaced. >=20 > -**/ >=20 > -UINT64 >=20 > -EFIAPI >=20 > -SmmCpuFeaturesHookReturnFromSmm ( >=20 > - IN UINTN CpuIndex, >=20 > - IN SMRAM_SAVE_STATE_MAP *CpuState, >=20 > - IN UINT64 NewInstructionPointer32, >=20 > - IN UINT64 NewInstructionPointer >=20 > - ) >=20 > -{ >=20 > - return 0; >=20 > -} >=20 > - >=20 > /** >=20 > Hook point in normal execution mode that allows the one CPU that was > elected >=20 > as monarch during System Management Mode initialization to perform > additional >=20 > @@ -90,91 +47,6 @@ SmmCpuFeaturesRendezvousExit ( { >=20 > } >=20 >=20 >=20 > -/** >=20 > - Check to see if an SMM register is supported by a specified CPU. >=20 > - >=20 > - @param[in] CpuIndex The index of the CPU to check for SMM register > support. >=20 > - The value must be between 0 and the NumberOfCpus = field >=20 > - in the System Management System Table (SMST). >=20 > - @param[in] RegName Identifies the SMM register to check for support. >=20 > - >=20 > - @retval TRUE The SMM register specified by RegName is supported by > the CPU >=20 > - specified by CpuIndex. >=20 > - @retval FALSE The SMM register specified by RegName is not supported > by the >=20 > - CPU specified by CpuIndex. >=20 > -**/ >=20 > -BOOLEAN >=20 > -EFIAPI >=20 > -SmmCpuFeaturesIsSmmRegisterSupported ( >=20 > - IN UINTN CpuIndex, >=20 > - IN SMM_REG_NAME RegName >=20 > - ) >=20 > -{ >=20 > - if (FeaturePcdGet (PcdSmmFeatureControlEnable) && (RegName =3D=3D > SmmRegFeatureControl)) { >=20 > - return TRUE; >=20 > - } >=20 > - >=20 > - return FALSE; >=20 > -} >=20 > - >=20 > -/** >=20 > - Read an SMM Save State register on the target processor. If this func= tion >=20 > - returns EFI_UNSUPPORTED, then the caller is responsible for reading th= e >=20 > - SMM Save Sate register. >=20 > - >=20 > - @param[in] CpuIndex The index of the CPU to read the SMM Save State. > The >=20 > - value must be between 0 and the NumberOfCpus fie= ld in >=20 > - the System Management System Table (SMST). >=20 > - @param[in] Register The SMM Save State register to read. >=20 > - @param[in] Width The number of bytes to read from the CPU save st= ate. >=20 > - @param[out] Buffer Upon return, this holds the CPU register value r= ead >=20 > - from the save state. >=20 > - >=20 > - @retval EFI_SUCCESS The register was read from Save State. >=20 > - @retval EFI_INVALID_PARAMETER Buffer is NULL. >=20 > - @retval EFI_UNSUPPORTED This function does not support reading > Register. >=20 > - >=20 > -**/ >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -SmmCpuFeaturesReadSaveStateRegister ( >=20 > - IN UINTN CpuIndex, >=20 > - IN EFI_SMM_SAVE_STATE_REGISTER Register, >=20 > - IN UINTN Width, >=20 > - OUT VOID *Buffer >=20 > - ) >=20 > -{ >=20 > - return EFI_UNSUPPORTED; >=20 > -} >=20 > - >=20 > -/** >=20 > - Writes an SMM Save State register on the target processor. If this fu= nction >=20 > - returns EFI_UNSUPPORTED, then the caller is responsible for writing th= e >=20 > - SMM Save Sate register. >=20 > - >=20 > - @param[in] CpuIndex The index of the CPU to write the SMM Save State. > The >=20 > - value must be between 0 and the NumberOfCpus fiel= d in >=20 > - the System Management System Table (SMST). >=20 > - @param[in] Register The SMM Save State register to write. >=20 > - @param[in] Width The number of bytes to write to the CPU save stat= e. >=20 > - @param[in] Buffer Upon entry, this holds the new CPU register value= . >=20 > - >=20 > - @retval EFI_SUCCESS The register was written to Save State. >=20 > - @retval EFI_INVALID_PARAMETER Buffer is NULL. >=20 > - @retval EFI_UNSUPPORTED This function does not support writing > Register. >=20 > -**/ >=20 > -EFI_STATUS >=20 > -EFIAPI >=20 > -SmmCpuFeaturesWriteSaveStateRegister ( >=20 > - IN UINTN CpuIndex, >=20 > - IN EFI_SMM_SAVE_STATE_REGISTER Register, >=20 > - IN UINTN Width, >=20 > - IN CONST VOID *Buffer >=20 > - ) >=20 > -{ >=20 > - return EFI_UNSUPPORTED; >=20 > -} >=20 > - >=20 > /** >=20 > This function is hook point called after the > gEfiSmmReadyToLockProtocolGuid >=20 > notification is completely processed. >=20 > -- > 2.25.1 >=20 >=20 >=20 >=20 >=20