From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (NAM11-BN8-obe.outbound.protection.outlook.com [40.107.236.41]) by mx.groups.io with SMTP id smtpd.web11.41308.1681125055633562696 for ; Mon, 10 Apr 2023 04:10:55 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@amd.com header.s=selector1 header.b=d5rOJaS4; 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.236.41, mailfrom: abdullateef.attar@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=G/NKFbU00q1SkPhG+28godPlGUWbJBk3XZzC6QpAhyCrY6ZVDcZycb2U10pq/pkMp1fipMG8vzlAJW10pTLctMwF3JlSCfyUvlIkvFEOOO9rEO3rVhiCRkqnPMrpEAQQSU/5oysFtBRzh+RgAxYZwbixek37otWP0spbCfIsNpWnUpN6Qjsu/yduohPopKe3VMfZI5u6ynkbpndmL8xo2e+eKl/uhtfkVW2Hb+Nte2B2sXpkASwGw1lL7Nefq8Tj7wg92HTDsmUtGkaPbee/jOniFGJdPpbznPMfCZh8o6pVN6lTWkH8a6+7tr4Vj6XZzMz4Rc3iVloUsCkUtTmc9g== 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=+mZvzW5oawn0/6Umyy3XYNgAFQMYP4kgn8SiXipoK60=; b=FC0RNOnWD5ePkjIRgpt9R8VgQFOaV7EYEq7lLqCefNHMWBZvHsKcVSlvusfUE3B7z1OSOeuKjCAhWx8S8ZzEhaLh6i61JWthoZDIFV+MRG9EtPzrpd3ToCYDGY9iHT6BzmXIFPtj1njZzZg+RfoUsOCXVMD8HxWe4KR/vKJKsjX3TxNgRfKOFx6FLcEeV8SZBKEtvfsJG1oImDUVlxKl7b8XOgmq+aE5wokMlcXUvrCYxD3Z3CY91yeKmrIPZ8dKguRh7s1G0dF6CSPuakTcaq0zAckvBJLdXVlvqkoBTWTqJAgS40SUntUSdSmh8t6wNwTx14WMD+xqa229PT1Xhg== 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 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=+mZvzW5oawn0/6Umyy3XYNgAFQMYP4kgn8SiXipoK60=; b=d5rOJaS48PZjkFlDd41ebtyG0PDMEOkafbFmRx/0v6jMMrwsFz3GkqUvErN8l72CpoUXIi+txSYihoyf/y0MYS7TfXRLvoiEwUg7eCP/I1qZ+fi4VexX7XX8XazNAG84ENhd1YOvPu3N7GYft9ha733vgnSkKLFS6FGAHzLneps= Received: from BN9PR03CA0123.namprd03.prod.outlook.com (2603:10b6:408:fe::8) by MW4PR12MB7440.namprd12.prod.outlook.com (2603:10b6:303:223::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.31; Mon, 10 Apr 2023 11:10:52 +0000 Received: from BN8NAM11FT055.eop-nam11.prod.protection.outlook.com (2603:10b6:408:fe:cafe::99) by BN9PR03CA0123.outlook.office365.com (2603:10b6:408:fe::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.39 via Frontend Transport; Mon, 10 Apr 2023 11:10:52 +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 (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=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT055.mail.protection.outlook.com (10.13.177.62) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6298.26 via Frontend Transport; Mon, 10 Apr 2023 11:10:52 +0000 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Mon, 10 Apr 2023 06:10:02 -0500 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; Mon, 10 Apr 2023 06:09:59 -0500 From: "Abdul Lateef Attar" To: CC: Abdul Lateef Attar , Paul Grimes , Garrett Kirkendall , Abner Chang , Eric Dong , Ray Ni , Rahul Kumar , Gerd Hoffmann Subject: [PATCH v8 2/9] UefiCpuPkg: Adds SmmSmramSaveStateLib library class Date: Mon, 10 Apr 2023 16:39:41 +0530 Message-ID: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Return-Path: AbdulLateef.Attar@amd.com X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT055:EE_|MW4PR12MB7440:EE_ X-MS-Office365-Filtering-Correlation-Id: a3a61b99-7a7a-498f-9778-08db39b43f4c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: A35u5OpmyrEWY0w+dzsjdDjiogTQe1/qT1d5hfD22VYkXgn4oolD0H3q0l6ow1q5nf+jYyUBddsuKrJUDcbOfMruz7FiIe4L4KjHZwgf57S8oqrNp+S6qL+N0sr9LmsmP5TPqTUebx5bYSu1XwE8HaRwZlS0KEeaDVYKnn8cO07f5mtfkVcDU+aoQAUvzDVnI+QJQ6nFwVMh0QM279EmRruNPqahyArFKK4iJr3usFa/b5dlFzwDXXZ/Sa8Ovh2MoHpvrOB+LPDtxqUtkAiy2lvt+5o5t6jNEZkE4k1LjlDvAedyJ/QDAS/RKLiqONkdei7X4U4wKXqjwymx1vT/KY29zp3tsFvZdUbhr8GagPm4pWeBSAErLlirPepNUOmO+56sRmHC1V2bnb4uzB+qqoXQ08R9Xlio9dB8E1ZRCpfG7jiDrl3A3Sxi6eFfy3KuGky4jOyFiytkXN2HC75a2U0ZcVp9l05pysoscn3SzOv9Re7IMr3iFeODxeQN+zcyMPlKL9VXfBZcHTwQDnI02/atme3Bx6Q+GMMwJq3Ga9/S8PFT68fBBqu/Z+azMGP4SjT75tpe6e4Us2I0jHjv2MMLygj6wdjcT1Y0BGth0QPkWA0rW1ius7Nc3qDE1R2uptYghmDO8IkJaOTF6rP2P4Txaa2eDorgapHJU0cT0j4kpEgxIk6xH2c00rCKr6DjaCV1nFabCvAwQQnMwxHDw17uaYPjt8kqQLnZnxNgCgvBTQu8ejPQdgSOQIGSuDsA X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(39860400002)(346002)(376002)(136003)(396003)(451199021)(46966006)(36840700001)(40470700004)(478600001)(54906003)(47076005)(2616005)(40480700001)(26005)(426003)(336012)(6666004)(186003)(81166007)(82740400003)(356005)(82310400005)(36756003)(7696005)(36860700001)(966005)(40460700003)(70206006)(41300700001)(4326008)(70586007)(8676002)(8936002)(6916009)(5660300002)(316002)(2906002)(213903007)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Apr 2023 11:10:52.1469 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a3a61b99-7a7a-498f-9778-08db39b43f4c 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=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT055.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB7440 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain 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 2115aa4387a2..8284237511cc 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 # @@ -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 rea= d + 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