From nobody Sun Feb 8 21:48:12 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+98824+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 1674061287303687.7705099745822; Wed, 18 Jan 2023 09:01:27 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id YMh6YY1788612x5nvwdYifXx; Wed, 18 Jan 2023 09:01:26 -0800 X-Received: from NAM12-MW2-obe.outbound.protection.outlook.com (NAM12-MW2-obe.outbound.protection.outlook.com [40.107.244.43]) by mx.groups.io with SMTP id smtpd.web11.21501.1674061285303029666 for ; Wed, 18 Jan 2023 09:01:25 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=N5UcpQ0xqJRrI2p8jMM0tIszaiC1uUydmCGIE+o0OP23i7nbsG6rq+87Oq8g8gMPV4fEFXK20zPXvIjIQ9t0ih6IqUvjlgzxuZ3baZZ24nf7qysSs6j43EBA2w2MH9M6VjhCQlYhLHsdRzOuCh0qLPayMnv/b8VUOSL886wf+RHRz3uLtjreQFuJcRL/93Ik62HSvJpxSFvGK9XY+7MJfWFKv9jzGYgVplJV78/KCHTuIkAeSop21+ECBrdg7/2mmOJk0LbLDZh9OD5sB7IbZxns908L3KgsPtuwp7f5J7I+jLKOKAfQE5NoIE9rH0wbWIVzGXj0bKnWfy/ze5iLFA== 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=cx55L41snM0N//AtPuiPJFYOmkaXfEE78dcjtc/xqUM=; b=I81J8Lg0qnQzUP8Bet9q4oGRgl62KWzaa/Hja4+GgMnexnKSbP7vq24U/dJX4KKj871LTBdo7SxuWNEtUZZwG4+4m55/2PUVucnOydHyP9qYTUUETmmQsaeJXfIQZIU3QS33h08koiitYZEKh/76/ZbAr1JoW5xjesCG5QqSSIj6e6itbJy/SXTZr5pvqOkUhESjYbhm77pUmdOXgkA4II59N8Rh6V9B3UEmsLjJyUp3Nsmfnd/H+okA7oli9tM5dNeuKFepSLEAwS8h2PLEW2ORCOAxtjc13BfQK4YBWLN6j1eAucR8lUEBEvHwJJS/ogSY1OC48XuJ9YqISUv3Vg== 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 BN9PR03CA0536.namprd03.prod.outlook.com (2603:10b6:408:131::31) by SJ0PR12MB6808.namprd12.prod.outlook.com (2603:10b6:a03:47a::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.23; Wed, 18 Jan 2023 17:01:23 +0000 X-Received: from BL02EPF00010209.namprd05.prod.outlook.com (2603:10b6:408:131:cafe::45) by BN9PR03CA0536.outlook.office365.com (2603:10b6:408:131::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.19 via Frontend Transport; Wed, 18 Jan 2023 17:01:22 +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+98824+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 BL02EPF00010209.mail.protection.outlook.com (10.167.241.198) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6002.11 via Frontend Transport; Wed, 18 Jan 2023 17:01:22 +0000 X-Received: from SATLEXMB08.amd.com (10.181.40.132) 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; Wed, 18 Jan 2023 11:01:20 -0600 X-Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB08.amd.com (10.181.40.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 18 Jan 2023 09:01:20 -0800 X-Received: from BLR-LAB-SFW01.amd.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Wed, 18 Jan 2023 11:01:17 -0600 From: "Abdul Lateef Attar via groups.io" To: CC: Abdul Lateef Attar , Paul Grimes , Garrett Kirkendall , Abner Chang , Eric Dong , Ray Ni , Rahul Kumar , Gerd Hoffmann Subject: [edk2-devel] [PATCH v3 2/6] UefiCpuPkg: Adds SmmSmramSaveStateLib library class Date: Wed, 18 Jan 2023 22:31:04 +0530 Message-ID: <3496af23f5bdc7847148150cd7b97fb5d2b54702.1674060385.git.abdattar@amd.com> In-Reply-To: References: MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00010209:EE_|SJ0PR12MB6808:EE_ X-MS-Office365-Filtering-Correlation-Id: 7cb9ccf6-cd75-4802-363f-08daf975a0b9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: uX3qsJcUaZqikPGrgh5ah0IIzbb9v44cTP/QiVBtdQDeE6qKbD8O8mHrhxJGWjbP9FHjJpIHPSfhWlTiG68/lgIGWW74rMpWbHLO7GCxGXI46dPXXxxAc5uUEsRFE93idwohoncROpDaSYwHb0ywFKpqeGzpDHLOgoUCzn2iGAhhXsR79y7WOagveJ4yiCOzYUKNN9uc4Mfi7B/bdbqije7ANCGVF/MYuCjmVZGjZb/G4nwspF2xSB06Q/OAaaCJEIr2f5g/wVBm0t3Y2B6haYfgp/DyuTguBCC7E0Juz82MIPJOOfgDaOxseStsnsb+eUu5tFQWOPahPdwWo/6ohdp80+MsaxqyxBZNyF3sTSLT7X45Soz6KH8AQ2x9udBvr2rkRift3D0fxOEagKZ7rLJArxwUwjSHgd8hC1jsewG99v9lBS9BXVNO8LNEiZwTKPey3AIJzNO+5xew4XmLs1owKlZrkCPCeRgItU3oju9HOLuPKOnKtW9nwpK7lDklXx8yppS9pH8FGZEN+lNeEL8cEuysfT0qjUOAt9KWwjVT9eBx2CPYlMTjfMFxoZxTwsMouSpoRAusNybb6qPcdR7FO/Fx8/M/YISBHdWOIbNAP46bna8uc/3BKvHe0Rj/2wK6UuwmWOOjTfiTWNoP1wiXNnwB+qbLFEdc74+qeXmw4qv/5d7VgiQ5cvpLf5go/5yk4mO+p7IsMo7BbdZKWfDeoc1uEudIQqzPjcaWlQdQA+4HUdb/SQTtjhtgg2MkckYZh1wjCy2TY6UaIxUu1MG4uiPHqCkq3y87GzCXbfU= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jan 2023 17:01:22.9016 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7cb9ccf6-cd75-4802-363f-08daf975a0b9 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: BL02EPF00010209.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB6808 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: 7ojxPGKiSJ5kWSfDLrh4EDb9x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1674061286; bh=yaT9HblwIrRIix6MgYWDEbuJrzfzIHwU5fz3R3FHATE=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=sLolrNJR2nca84DOebgQqE90J3mp2xpfEGscD6j3wyuiyWMmJ19BmF3fU2M7z+etm2Y dD9sxk8g3wyBaIc4ITbnJaTwyEP2zyOdz2QW/5RcOj/nTxOWFMrq0GcNI+v/1NHCJ5GI4 9/h70qT4z8giO4oMS4PftSmbKQeQ1cc2FJg= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1674061291554100007 Content-Type: text/plain; charset="utf-8" BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4182 Adds SmmSmramSaveStateLib Library class in UefiCpuPkg.dec. Adds function declaration header file. Cc: Paul Grimes Cc: Garrett Kirkendall 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 ++ .../Include/Library/SmmSmramSaveStateLib.h | 70 +++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 UefiCpuPkg/Include/Library/SmmSmramSaveStateLib.h diff --git a/UefiCpuPkg/UefiCpuPkg.dec b/UefiCpuPkg/UefiCpuPkg.dec index cff239d5283e..1de90b677828 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 - 2022, Intel Corporation. All rights reserved.
+# Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.
# # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -65,6 +66,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. + SmmSmramSaveSateLib|Include/Library/SmmSmramSaveStateLib.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/SmmSmramSaveStateLib.h b/UefiCpuPkg= /Include/Library/SmmSmramSaveStateLib.h new file mode 100644 index 000000000000..46bc6381bcde --- /dev/null +++ b/UefiCpuPkg/Include/Library/SmmSmramSaveStateLib.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 SMM_SMRAM_SAVE_STATE_LIB_H_ +#define SMM_SMRAM_SAVE_STATE_LIB_H_ + +#include +#include + +/** + Read an SMM Save State register on the target processor. If this functi= on + returns EFI_UNSUPPORTED, then the caller is responsible for reading the + SMM Save Sate register. + + @param[in] CpuIndex The index of the CPU to read the SMM Save State. = The + value must be between 0 and the NumberOfCpus field= in + the System Management System Table (SMST). + @param[in] Register The SMM 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 +SmramSaveStateReadRegister ( + IN UINTN CpuIndex, + IN EFI_SMM_SAVE_STATE_REGISTER Register, + IN UINTN Width, + OUT VOID *Buffer + ); + +/** + Writes an SMM Save State register on the target processor. If this func= tion + returns EFI_UNSUPPORTED, then the caller is responsible for writing the + SMM Save Sate register. + + @param[in] CpuIndex The index of the CPU to write the SMM Save State. = The + value must be between 0 and the NumberOfCpus field = in + the System Management System Table (SMST). + @param[in] Register The SMM 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 +SmramSaveStateWriteRegister ( + IN UINTN CpuIndex, + IN EFI_SMM_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 (#98824): https://edk2.groups.io/g/devel/message/98824 Mute This Topic: https://groups.io/mt/96358348/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-