From nobody Mon Feb 9 12:29:26 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+104690+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1683805537319631.187677266808; Thu, 11 May 2023 04:45:37 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id dbYpYY1788612xBMyDfGgbLv; Thu, 11 May 2023 04:45:36 -0700 X-Received: from NAM04-DM6-obe.outbound.protection.outlook.com (NAM04-DM6-obe.outbound.protection.outlook.com [40.107.102.48]) by mx.groups.io with SMTP id smtpd.web10.56935.1683805536232231876 for ; Thu, 11 May 2023 04:45:36 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HcJhdQ1TC2lsVYvSmOqSWBMixaqHpBaFFR7qEUdEcjTE5wztxv2bvtumchQNTiPP8vw5ShDFAp31VnpKsIH2BLVEXshDHPMUta1aUIbFAqwmnTTsD+sdq+EeKylIpdGvdj8Q/YKGBcd2Spy7gF/dXJ1MsX1O6giK+U19s9W7yqZV48u9f4u0BsPgeLziuXaoNEUVd869Oq5va2i12mim3swDVjoKdJCHmpMzO6+e0T+ftyrxGtai98PP2hssxOIKVTuV2Yb3JPxx9cFjyLCkWwktHw4/9ef3rQKrFbhSb/JNfeicvp+hA2yl/QuL2v3jftfhkJSMgzpo1psXG0lcKA== 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=kzZQTYoSPxFNKHvgtfp/JejC1vNXkGS4a8/X7psFewA=; b=OUzLMfOf1WD1z4/SN7M3h1GZ+eRp/UF5QkeugfaGtIAgvU5MHHZ3tDbMJwlc+a7qB9pZV6mH3JzktjvJEQZUyeJPNFqeu6j4ESaOyK32I46JtbUefFq2OljaHGESgjG9/8JIR5FiXe9M24tAmHuGUWV4a6pNJJlyq52RNvakbQrDi+x+JgTMg25gH6RcKPnN3GcU/htyIVtdjRqqC7jvNL7JmyAXnSGWcP1zvtmEXWkCiK7rvnvyCx/CoqF2woMdaO70bV+jmm2OessGwZzrlhBNWgcX7ztXZsayiUh47JQy4FnI14Uvk+Va/kG8DKr/4/IQAzSTm1YqfI0G5cEwCQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=edk2.groups.io smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none X-Received: from MN2PR16CA0011.namprd16.prod.outlook.com (2603:10b6:208:134::24) by CH0PR12MB5170.namprd12.prod.outlook.com (2603:10b6:610:b9::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.20; Thu, 11 May 2023 11:45:21 +0000 X-Received: from BL02EPF000100D0.namprd05.prod.outlook.com (2603:10b6:208:134:cafe::ad) by MN2PR16CA0011.outlook.office365.com (2603:10b6:208:134::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.30 via Frontend Transport; Thu, 11 May 2023 11:45:21 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+104690+1787277+3901457@groups.io; helo=mail02.groups.io; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; pr=C X-Received: from SATLEXMB03.amd.com (165.204.84.17) by BL02EPF000100D0.mail.protection.outlook.com (10.167.241.204) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6387.20 via Frontend Transport; Thu, 11 May 2023 11:45:21 +0000 X-Received: from SATLEXMB07.amd.com (10.181.41.45) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 11 May 2023 06:45:21 -0500 X-Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB07.amd.com (10.181.41.45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 11 May 2023 04:45:20 -0700 X-Received: from BLR-LAB-SFW01.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Thu, 11 May 2023 06:45:18 -0500 From: "Abdul Lateef Attar via groups.io" To: CC: Abdul Lateef Attar , Paul Grimes , Abner Chang , Eric Dong , Ray Ni , Rahul Kumar , Gerd Hoffmann Subject: [edk2-devel] [PATCH v12 2/8] UefiCpuPkg: Adds MmSaveStateLib library class Date: Thu, 11 May 2023 17:15:00 +0530 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF000100D0:EE_|CH0PR12MB5170:EE_ X-MS-Office365-Filtering-Correlation-Id: d4ac232e-1c10-430e-af70-08db5215338a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: /X/lpAg8tjgNeDOF79/yVJNC89FTIlvawfqS3yjBDeqerEuYTuOE3oHRvAIBOi85tbYTFZP6EEF68qC9+EaDh0QsTjke1w3311kds7PLadShC2sDIehraUXKTeNCVkE6L0GEfvQrQCzR1gdU6xYSgVqUIx5NFfk9SXmcL+OmWiCfK8c8ViVkrQSqDEKHeDvafX6Bq+DyUXyO08ucDyXUV1PZNC4+bAkw9Y5JUXuueOS63vcEGphNhtt4ijyICiNMFiVkoIOUY9Ki0jR9GRz1suRLh3B+yrvb4tnC6yLAZFbAnbt8UdKQTkkvSTgL4yXAy+fQgTnlVQX2iYmShSza1PGnNdG6ipqGaY13USyklJG3UaQdVQ5v5ozdHT100Gh3FjD6XNp4AyDwyqY+UGw6qdQWW38Gkw/xj4VDZhM5+elqWvXpxfstEBlW2NViGWcr0Sw50hJNo+xTyIHnYBhicmcY/TwDpCFeD6uKhR07iwa+qki7fqIw1lX/EeBNcxEJExK9drzwoOVqm0DcCMJ9AUGnNJ8y4XJkaHZ6NJsGeOPzqlSiIj9E7QIJmLxl1uLlZohwQZfNo6TpRl0KfhaJIQ6HZWqMFneNwSrpwf2cE9eLLZCIKsCBq9dAgzMd9xKE+GHZUG2B4Jcox2ynsO7bo874gaKK55a8ZdnQ/SianlzDkVI5bpdgQpmmLDnh5DqVlwaYzy3fB7UyUbvIvTL7Wu/cIemYGOV3IImBofV+bgNbIpM9sZ/OgIkhfbyGq1G4 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2023 11:45:21.5106 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d4ac232e-1c10-430e-af70-08db5215338a X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF000100D0.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR12MB5170 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,abdattar@amd.com X-Gm-Message-State: VyuEU4n7TwCt8MxVCSDBkScqx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1683805536; bh=3ytRfbL6/vYQfYIGhpaVLm+wcWIGw/5yli+0DvxpF1g=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=jRkLHV9FrJWiDw+/diTfU4OkAU/msoNyYCGd7PreTIJQqbhDmC+GlM5x1xnPQgSV2U4 PBPX38gA+ZRauXLIahMhzyai09Vqf+P60A9ajck0NBJCj8Gv2Hg+uN1gkyAl9qTXvhGON LKWDmhhgoll8S/DrCLfIdJ7wta4EuloXDt4= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1683805539477100004 Content-Type: text/plain; charset="utf-8" BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4182 Adds MmSaveStateLib Library class in UefiCpuPkg.dec. Adds function declaration header file. Cc: Paul Grimes Cc: Abner Chang Cc: Eric Dong Cc: Ray Ni Cc: Rahul Kumar Cc: Gerd Hoffmann Signed-off-by: Abdul Lateef Attar Reviewed-by: Abner Chang --- UefiCpuPkg/UefiCpuPkg.dec | 4 ++ UefiCpuPkg/Include/Library/MmSaveStateLib.h | 70 +++++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 UefiCpuPkg/Include/Library/MmSaveStateLib.h diff --git a/UefiCpuPkg/UefiCpuPkg.dec b/UefiCpuPkg/UefiCpuPkg.dec index d31c3b127c0b..1f1b10e702bf 100644 --- a/UefiCpuPkg/UefiCpuPkg.dec +++ b/UefiCpuPkg/UefiCpuPkg.dec @@ -2,6 +2,7 @@ # This Package provides UEFI compatible CPU modules and libraries. # # Copyright (c) 2007 - 2023, Intel Corporation. All rights reserved.
+# Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.
# # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -60,6 +61,9 @@ [LibraryClasses.IA32, LibraryClasses.X64] ## @libraryclass Provides function for manipulating x86 paging structu= res. CpuPageTableLib|Include/Library/CpuPageTableLib.h =20 + ## @libraryclass Provides functions for manipulating smram savestate r= egisters. + MmSaveStateLib|Include/Library/MmSaveStateLib.h + [Guids] gUefiCpuPkgTokenSpaceGuid =3D { 0xac05bf33, 0x995a, 0x4ed4, { 0xaa,= 0xb8, 0xef, 0x7a, 0xe8, 0xf, 0x5c, 0xb0 }} gMsegSmramGuid =3D { 0x5802bce4, 0xeeee, 0x4e33, { 0xa1,= 0x30, 0xeb, 0xad, 0x27, 0xf0, 0xe4, 0x39 }} diff --git a/UefiCpuPkg/Include/Library/MmSaveStateLib.h b/UefiCpuPkg/Inclu= de/Library/MmSaveStateLib.h new file mode 100644 index 000000000000..6817fb3b9786 --- /dev/null +++ b/UefiCpuPkg/Include/Library/MmSaveStateLib.h @@ -0,0 +1,70 @@ +/** @file +Library that provides service to read/write CPU specific smram save state = registers. + +Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.
+Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.
+ +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef MM_SAVE_STATE_LIB_H_ +#define MM_SAVE_STATE_LIB_H_ + +#include +#include + +/** + Read a save state register on the target processor. If this function + returns EFI_UNSUPPORTED, then the caller is responsible for reading the + MM Save State register. + + @param[in] CpuIndex The index of the CPU to read the Save State regist= er. + The value must be between 0 and the NumberOfCpus f= ield in + the System Management System Table (SMST). + @param[in] Register The MM Save State register to read. + @param[in] Width The number of bytes to read from the CPU save stat= e. + @param[out] Buffer Upon return, this holds the CPU register value read + from the save state. + + @retval EFI_SUCCESS The register was read from Save State. + @retval EFI_INVALID_PARAMTER Buffer is NULL. + @retval EFI_UNSUPPORTED This function does not support reading Reg= ister. + @retval EFI_NOT_FOUND If desired Register not found. +**/ +EFI_STATUS +EFIAPI +MmSaveStateReadRegister ( + IN UINTN CpuIndex, + IN EFI_MM_SAVE_STATE_REGISTER Register, + IN UINTN Width, + OUT VOID *Buffer + ); + +/** + Writes a save state register on the target processor. If this function + returns EFI_UNSUPPORTED, then the caller is responsible for writing the + MM save state register. + + @param[in] CpuIndex The index of the CPU to write the MM Save State. T= he + value must be between 0 and the NumberOfCpus field = in + the System Management System Table (SMST). + @param[in] Register The MM Save State register to write. + @param[in] Width The number of bytes to write to the CPU save state. + @param[in] Buffer Upon entry, this holds the new CPU register value. + + @retval EFI_SUCCESS The register was written to Save State. + @retval EFI_INVALID_PARAMTER Buffer is NULL. + @retval EFI_UNSUPPORTED This function does not support writing Reg= ister. + @retval EFI_NOT_FOUND If desired Register not found. +**/ +EFI_STATUS +EFIAPI +MmSaveStateWriteRegister ( + IN UINTN CpuIndex, + IN EFI_MM_SAVE_STATE_REGISTER Register, + IN UINTN Width, + IN CONST VOID *Buffer + ); + +#endif --=20 2.25.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#104690): https://edk2.groups.io/g/devel/message/104690 Mute This Topic: https://groups.io/mt/98825550/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-