From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (NAM11-DM6-obe.outbound.protection.outlook.com [40.107.223.67]) by mx.groups.io with SMTP id smtpd.web11.134041.1673756529437813781 for ; Sat, 14 Jan 2023 20:22:09 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@amd.com header.s=selector1 header.b=IkPqYGuO; 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.223.67, mailfrom: abner.chang@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BA20IIjukQxwr2lOyw+lHB7nL0YAeHsd2QfouVtWYakrFaOlCJ4fFZ/FCRKk4Qt51UPLvMqs4vtKJnWtuDtdQ4ffNGB56QVOTZkvcmgkx71U1i0h2lZM/3CQeQW1mEZ/6vMMdwnWd60UsYZXObgvLNbPlD2HquB+DjOm2tth2PC2dag9ilk9rpioXF4h5OgwGeGEH4+WUoNht43Zhe3KfWI0Yjc34zr4RK3/1m7P7lFAJVCrAwieCEm2pmZhodYZeiZJpW7gehZLjFUVOx3G5Uh/aBmtbkq1To96uNTGPEACz3CpYar5h8v+RXF91XgMxh0y7FEaihjvDsRfFN1r5Q== 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=5Ym+oAXVXQd8LEJPQHYhSal3XKM1mH/Il0iXf3Mxch8=; b=DM2BKuXDizH7/rUec63KjTTNmLeQkG5Djg0cI0kkzLUdl3LwiXD+mGw9zVym4OZGtPzWH1bEgbPbc3Ow/aHokcgukmCmvijg0ge6PEFGmSHJxo/l62uET4YJicmVze4ksGLRBbzBHr5WEEKEeoksdnI8gOU4y7fSxuPdztdcAVh8xDL9CPsJ0pfXakRlptFfoV51Br61Ur9Bqswo0EReTJVUj4wIURslc40qzwUh9h4vnhcA1NQDciJA2C2loKCerijRM0C4SXQRFtZjqMpypEiRoBi+x+HboZRi88Apwl4/jL41OkkHFiFCd2rs+8m61fts5bN3Ik0wNNdug72wbQ== 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=5Ym+oAXVXQd8LEJPQHYhSal3XKM1mH/Il0iXf3Mxch8=; b=IkPqYGuODGtG8MBcIFeopUa+ZVW3Nvyf5JsfwQqA2OP/NBrmZakvHZ1UBa34p4mo1Skvl6ElBy2oGGh2KtAVzz0316l4pE9dFtMCnuTWl1NZKQv206SV0eNJIUsWoJHkyUs4OrJpe224UiNvMPyminWB/vMbtbov2tNYhRFg21s= Received: from MN2PR12MB3966.namprd12.prod.outlook.com (2603:10b6:208:165::18) by CY5PR12MB6204.namprd12.prod.outlook.com (2603:10b6:930:23::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.13; Sun, 15 Jan 2023 04:22:06 +0000 Received: from MN2PR12MB3966.namprd12.prod.outlook.com ([fe80::cddb:3de9:cd1d:26e4]) by MN2PR12MB3966.namprd12.prod.outlook.com ([fe80::cddb:3de9:cd1d:26e4%5]) with mapi id 15.20.5986.022; Sun, 15 Jan 2023 04:22:06 +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 v2 1/6] UefiCpuPkg/SmmCpuFeaturesLib: Restructure arch-dependent code Thread-Topic: [edk2-devel] [PATCH v2 1/6] UefiCpuPkg/SmmCpuFeaturesLib: Restructure arch-dependent code Thread-Index: AQHZJYRFQsCnbFsX8U6Ho+qpawL8RK6e5soQ Date: Sun, 15 Jan 2023 04:22:06 +0000 Message-ID: References: In-Reply-To: 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-15T04:22:03Z; 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=88a00535-a8e6-46ab-8cbe-161d9c1430b6; 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_|CY5PR12MB6204:EE_ x-ms-office365-filtering-correlation-id: dbfa1d9a-8d3c-415c-c266-08daf6b00fc0 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: +EaoILzNDRmvMZOKoUx9o0X/VQKXOWED4o9pb3gUfY+srkzxC+Pn1ej69c++2flVgzUsSsCfPRfd5thZC23dvutHkTZizPpZoYMtR+LCeXNkZi7ZeqwF279cFJZVi7+aT8UP1bbnuujrT1Je6sL7B3UoiPvCITB5CrdeaJOM4lBk/6n6YDADLIWOO7sXTukupYBeH+b/YO1F6Q137IJTJZ2M8NucvB2cYE+lJ8muWjdnbfYTDtFchtIl0ypAO5N3TrdPgxD8283TzF8slhiURzDBtPeyOc+Vd1MxLrDqSqN/zBDocUGH0wCETAVoeGILXhUaxA/JuRFJ9OolMfWcr8+PsldEgdkMYpnKentNC8o6FBoYMNodkvCWbzF2u+SRfZYvKtBqmV1GGKTCpwCp8VXUxwqTLsglYiaDDpixYp/3lqiNpEcWYpuermrVmLet+nHzJePM66LeU7OFkzC9S+gltAwkHrVfHAMzihQ4BPXBvT5J+3P0uAqR0bW03u7ksRURpGm25mDfomxQRB4m32Ylt/cVe8L48b0bST0fREly1bP5XS7+oyKTXfkOgsvlDY5pR3iqA/GJ3AJh1qiZqN/MZoS5KvXqhVDRRACrkE7A9Kr/wzMdh6+DNyVY/BRmIZhaWhAEQDA79LQ9EKcI8IT3TTv/1bVgv6DanMk+OKplGPDEQipOfPXWwnXj9ndJ5sPe9UdzsM6QuQHzNKvw1Q== 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)(376002)(136003)(396003)(346002)(39860400002)(366004)(451199015)(66899015)(38070700005)(86362001)(8936002)(8676002)(4326008)(52536014)(66476007)(64756008)(76116006)(66946007)(66556008)(66446008)(55016003)(30864003)(2906002)(5660300002)(83380400001)(122000001)(33656002)(38100700002)(478600001)(19627235002)(966005)(7696005)(71200400001)(110136005)(54906003)(6636002)(45080400002)(316002)(41300700001)(53546011)(9686003)(26005)(186003)(6506007);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?7uUFlCbqTfcq6RDaWg8lEfNVxClnbclbWSkbaqFZ2BCsrfcXqPvWxYJF5rKY?= =?us-ascii?Q?hQc5zsnPoKDyau/Zchq9PtQ4Kr6rzDLSFsc/J0h4JVC0Jqwf0oN9rPDkLrG4?= =?us-ascii?Q?xCiE52LvUwxu/+YStlqjDABUGt5ysKzlXdQiX3qApyc2hGix31sJxy/3MvGS?= =?us-ascii?Q?xoUhMxeC9L3fDX1tQ4kkOKX524e0TaLUFCwjiC9pvZV4u/S3FAEICzJWj1V0?= =?us-ascii?Q?rs+LN7sJfpFMRk67TWTGYveiCEHoIETAZPC3/TOFIxEyD6B/9GLG5WnnawpE?= =?us-ascii?Q?WN+Q56UKBo1xbm1iPxACf4auxzRyv64wy3h2JJ79nQeDjcAJJsxuNTIytjdj?= =?us-ascii?Q?MbLx940CNVYkRsR5W4LfD1meKj+QzEgnKPD0xaTO5tYsUM3iuySZAwn7hv9J?= =?us-ascii?Q?dcSAS5WwYupaGfv4QjyrY55sYKpSBG0m4mQwGjP66wa0hnEl2V+FiqT0DWly?= =?us-ascii?Q?GP7Ke4ODIFSkRtGZkyLc52asKrW2bwTBT4UhKN/bsPXh2yXpjwP5qSnrYBK7?= =?us-ascii?Q?rKw927Q9io+1uHLuR6yG7kh/UuZqJCwTVqSOyhMhTnyB9G9+rnHi8XfHkuTE?= =?us-ascii?Q?1DEUvwvNOpB60WyMLKKWIsyVTyzwmw5t4QCledJ7K6Cj22xh3nAKCL54xCwe?= =?us-ascii?Q?biVcfhqxI5PuLbTA7hUWTZ4iT2tffXuTT+C+xrFFYvT1iVljlQbFn2hibnsv?= =?us-ascii?Q?4U2KtkfzWVz1Lvd/PXhf3+AizLFpRLa7IZzpXfULobtvUj5wWJtVLx5GgPn7?= =?us-ascii?Q?fUt1kkn4Jxt/+xcMO0xmV9HGVNL9uTq+lkfAoU+KeXWAK0Ww2Qq9ZY9MMe6T?= =?us-ascii?Q?sgerUE9GIoF0+KNBa7S2sKnpRF4oookxZP1fUO8NVXNBPbALOXGYA++2bpMg?= =?us-ascii?Q?uZIQ1ALXoRZfwu3fQgFzzHhLwTVt5GJcFznB68INn8OVcksPsRalFOR5d4aL?= =?us-ascii?Q?YGLzgc3upKm1hzDAWOhB+cQvkFlWsfWcBQZyBqgFRm5BPJXtAPHaoba3KpLK?= =?us-ascii?Q?S2dH+DnUJz4dGkeZ11muiPKe1AdpcWTxtwZOnKKwNjqHjlAT1NaOpM/3qFNG?= =?us-ascii?Q?/Nt8d2AwrGzeLghnTq4rKDkTiJ/ZO/3Ohm6NJu0jkTJszCa0eBxER4A6D7yr?= =?us-ascii?Q?NfYx6VGVtgdltqmcOFNS2SR1u3x8qd2ib8aQxUmlfQ5fMlLEZYOMkV3XGaD0?= =?us-ascii?Q?V/KvCGdCjOwsHjkPqla5IZoG/fOVtDGYCDlDzCVBO0ERebR6eoNMmfapWEJa?= =?us-ascii?Q?/NH5MW56+Onjbdznx+I4lUDUdeezPXdwcYAyYg7t+/vYdiepzBmLdRFX7pVs?= =?us-ascii?Q?al3n6jzff/mJjpB8rbGvAZADcP8aS1TR6SdhwiVZ7y5mJUs5m5X8v7N2bmsI?= =?us-ascii?Q?QuBtN7tjZ/8AKE3l+lnd84bFpuKJAhfybPf7LIKjUmBfYHKjNcgaEgXB8JBt?= =?us-ascii?Q?EaAiWBMi5ps/eKAIVOZEvEWCg8iJ95tYn8Ic8lkDFC4vrtfGx/ANfvPM+8gW?= =?us-ascii?Q?eR1RGrnl+4nti8Zp2erTiyWO6+uTgJ4Zec18+U1hW/Z082N3VHEupLZUYJN7?= =?us-ascii?Q?yxAtnow748F011EfJ6RG6I5MoQ8uGsiWke/4a7HB?= 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: dbfa1d9a-8d3c-415c-c266-08daf6b00fc0 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Jan 2023 04:22:06.5157 (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: ApxoWEyJZ6lwt0hrY1d87I0QjlK2cXTf7NyyYtnqz6Bz0UnwvzB0IplQpbffuIEqta8Pc/QxErZWSJMP5bgH4w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR12MB6204 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: Wednesday, January 11, 2023 2:16 PM > 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 v2 1/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://nam11.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Fbugz > illa.tianocore.org%2Fshow_bug.cgi%3Fid%3D4182&data=3D05%7C01%7Cabner. > chang%40amd.com%7C2a65c8492de34ffa909e08daf39b6685%7C3dd8961fe48 > 84e608e11a82d994e183d%7C0%7C0%7C638090146022518344%7CUnknown% > 7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haW > wiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=3Dw4DrN5NOlqrFN2IjJ3o4Qr > gIxSsuqz54g2HkLhyTE64%3D&reserved=3D0 >=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