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.16379.1679722739598078141 for ; Fri, 24 Mar 2023 22:38:59 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@amd.com header.s=selector1 header.b=2xl5hrMO; 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=fkKhaiIeXSVJNce93hwoNQnv76LZsHpdN1RxjtQZNEbbkL//B+R1r1Y+n3U2uYt/1kYt5aXsrCuAVfyVgW2iqcGfeRK3IP78J5fWquZbdugzVTr4h8dipWUaWHJCXHBkbdXFxObjGi+vxQwaRyXc7iniDrdxhaJLkJ3H70X4n0u/PDP3G+IoykMAoij8pYmxJL7U8y7GKn7W/Z0IIdE+xvOLfUg2vEy/llFb7G+ab379hl5/40IG+nlWbFwtWGT+TUFR2YSB36nZRD0FDDaHvcOLdfOCG5rdM+MMmPb5TZ6HHuvUWHLLPsz0iNfxF1YwTokqob20jIt4JlMjsxAC3Q== 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=ddqkkciRDnUaprF2u+22k7Z3MjZoEDj7gp8LwdInvOHJwprJDjQiEZWgbfB645dMijwl5mAE3wQ4u069cMN8fCjvRfTzDUhDMImVdFgPcUg4Hd0GY3bmunoRPYFSWZNO6NqnP5S3jMc5fVrcHtUOxJCoxTnQMoATB4KnpaUB3sUhCVDLfG9lT3C3CWU8OT2cv9bJ2chYPVJw1BWGeX+UMvv95wENRu7oXMv50Jihnh65OuZxTM9fGdsqpmAr5ygi5xTcjfp7s3Au4AA4vzmzDBNZDM0FfK1YEWPCFUqXlnXol+dJNaxwFPtbe8ch5jFlPr52/pzVZVUWtiA4rCbx1A== 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=2xl5hrMOX/X9GwmhnCBu97nKOr31JmFzPG4tTut2yRygefGneAXNjtqaAM15CEOGi73QV3hjsxNISCyfw6w6kb0V8+aRjzx7fl0Qxz8HlL5jPNZGKneVzIkyyXUQ+Ac5PnHAVscji6/UoZV7HPwWAOBtJ2dFhT4cV63PfrE8Fuk= Received: from DS7PR03CA0115.namprd03.prod.outlook.com (2603:10b6:5:3b7::30) by SJ0PR12MB6965.namprd12.prod.outlook.com (2603:10b6:a03:448::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.39; Sat, 25 Mar 2023 05:38:57 +0000 Received: from DS1PEPF0000E637.namprd02.prod.outlook.com (2603:10b6:5:3b7:cafe::f5) by DS7PR03CA0115.outlook.office365.com (2603:10b6:5:3b7::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.38 via Frontend Transport; Sat, 25 Mar 2023 05:38:57 +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 DS1PEPF0000E637.mail.protection.outlook.com (10.167.17.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6178.30 via Frontend Transport; Sat, 25 Mar 2023 05:38:57 +0000 Received: from SATLEXMB07.amd.com (10.181.41.45) 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; Sat, 25 Mar 2023 00:38:56 -0500 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; Fri, 24 Mar 2023 22:38:56 -0700 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; Sat, 25 Mar 2023 00:38:54 -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 v6 2/6] UefiCpuPkg: Adds SmmSmramSaveStateLib library class Date: Sat, 25 Mar 2023 11:08: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: DS1PEPF0000E637:EE_|SJ0PR12MB6965:EE_ X-MS-Office365-Filtering-Correlation-Id: ba6dad7a-d231-42f8-2bed-08db2cf33a6d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PpFwKeL4OYoTXwZhG66x+QcFdxBNyEJN4qZ87QFyUpm4caAKH8Ixl7wt2JKbYQ+1eViFcxMEC3rbcMMyF3mSAPguCHhyAsDFjlrcXq/VWwSzymbyS8DtXmGeLLXTCDiB96RHpcO1Xpt89oL5mimlNPHFV3D5gui2VdHTesxASDkx+m/MUs5pefacoBo2IUjmlfqsEmRni+xF0p1irNzLykEL1+gtJCzbWJLSlPbGZ7Je4vIuACm7Ujyni4bhH+dGRdxWBfKGscQD1q0TbzTei1jj4CEuk6SUKaELxHCPu9O14PbSUprRHFVdtarPobFH2S4F239eQXPtyGrhG393vZbcItDr5Z3kxHimmlljzDroNeR9ksCu582FPGR0c9NiPHhKvyr59PdekLXIFq41p0VPkmg4IfziXzRXanYRovxM8+5qj5eFUyHkhvGu1t+IcXOI/XVuoAubJEMrcoynRqf11r8wtCqZ0cGquCTva0oSIOg+sTGO8cFfiLUN1kNaGNWTF6xPTdMr0amZP9sqnEmo0mfJxFE0Eti5SmleAj7PaxdF9ciTzOYN4M5ocnUg2AAJ/xkp8XXnEUmvpsow+n4alCAJG08TZU/Tx9x1yJREh4i3/MRjU2hSIS1tkYdYfIOjY/evjTohKUhBT4c0gYG5nvbu5uNsHOK1xuoOejAdSqe3FZRRTu1yAyNS8p6Ikl8SRWslN5BWQYN9yYyqVodrxKWEOKeMsuVSQXJPXhW1I2omI5uFeXvpdSBKcWbr 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)(376002)(346002)(136003)(396003)(451199021)(40470700004)(46966006)(36840700001)(478600001)(41300700001)(40480700001)(70206006)(54906003)(4326008)(6916009)(356005)(316002)(36860700001)(70586007)(6666004)(82740400003)(81166007)(8676002)(5660300002)(7696005)(47076005)(8936002)(186003)(40460700003)(82310400005)(2906002)(2616005)(36756003)(26005)(966005)(426003)(336012)(213903007)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Mar 2023 05:38:57.1184 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ba6dad7a-d231-42f8-2bed-08db2cf33a6d 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: DS1PEPF0000E637.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB6965 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