From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (NAM04-DM6-obe.outbound.protection.outlook.com [40.107.102.42]) by mx.groups.io with SMTP id smtpd.web10.17364.1673417823822766109 for ; Tue, 10 Jan 2023 22:17:03 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@amd.com header.s=selector1 header.b=Zp6j3JlY; 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.102.42, mailfrom: abdullateef.attar@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WQ8YLwC/857uDSJiuAfvbgcf27QJw4wXIlQj/tLjdcAlIDtJlchxs1aoCeWmmQjNLCfgf9BjypqbEiS/44uT9YO5Mp4F6z6UqzICNxjRoxtaL51sFFC3tbXnz+EgSAtodrnWzfaDpuGab9/ZyXk66lwivGULABidVLmv7GKDFuUv67hcvmsLammwfyHb1Eu/oIQ3w6vZxmoJfS3YkcKC3kYWo3ErJIPWeDGvHJoLl9AaJ+PscHoP70eoqy19BfCjktQuo9aONlZz+U0T7F/8OW6yrSi+ylpl7hlmiXOBlSG/xOvaZMQPJ37LnXXbX3UTm+7lX8L68u6yeqik12badA== 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=BjkXKgCLFbBNtotpD7/l0I1LfGNY534zWML7mP9SjpM=; b=LLR6gSZsQL2GDo5faA88xj0FvALOFaCn0XBVPk6UgTBgDFPFHVAyXuT7BL2x7vF8TrxfgL6xtTNaeLOvGahKzMOCTAVyvYJveT+q41U+vQMrDVwEXGoDuKTN9i6aLXS1AOXCIcEC0CfYnLACvR8CbtlecidbQ1/rcWBa/6lUOLdNLQpJpslbmaDWOtEH8oXyT3ZA7s3ZaVFVwLQB5AaI+/BySf5uLNZdlx/dZaHmEUEAymNV0+WdkZj//vjuZj0Lk3WWSom1pRB44+gzJqvMVQpmZookJSO5GngUKSotz54iPa7yXg+Pt1rC1IGldGGIu828HU6MoqMzBHIHu+w1kA== 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=BjkXKgCLFbBNtotpD7/l0I1LfGNY534zWML7mP9SjpM=; b=Zp6j3JlY03FmVo7QRoOBTvmTgWr7eSmQSIVDyMXIYRajUACsQtLWGHw6/6U/p69cGz/8wkt9Zlq6VeO+DNHDzUNMAq+mTFKivQMaRZoUeD8PenfEs6TifvlhNg4eVQ74032u34MHDV3Qes5Hh7oFO7uqHa0Xtqsvp2R62aZ1qDk= Received: from DM6PR06CA0086.namprd06.prod.outlook.com (2603:10b6:5:336::19) by SA1PR12MB6702.namprd12.prod.outlook.com (2603:10b6:806:252::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.18; Wed, 11 Jan 2023 06:17:01 +0000 Received: from DS1PEPF0000E648.namprd02.prod.outlook.com (2603:10b6:5:336:cafe::9f) by DM6PR06CA0086.outlook.office365.com (2603:10b6:5:336::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.18 via Frontend Transport; Wed, 11 Jan 2023 06:17:01 +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=SATLEXMB03.amd.com; pr=C Received: from SATLEXMB03.amd.com (165.204.84.17) by DS1PEPF0000E648.mail.protection.outlook.com (10.167.18.38) 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, 11 Jan 2023 06:17:01 +0000 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, 11 Jan 2023 00:17:01 -0600 Received: from SATLEXMB04.amd.com (10.181.40.145) 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; Tue, 10 Jan 2023 22:17:01 -0800 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; Wed, 11 Jan 2023 00:16:56 -0600 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 v2 3/6] UefiCpuPkg: Adds SmmSmramSaveStateLib library class Date: Wed, 11 Jan 2023 11:45:41 +0530 Message-ID: <754ac0bb0fb5bd75a2343d0030a18204672d7769.1673417268.git.abdattar@amd.com> 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: DS1PEPF0000E648:EE_|SA1PR12MB6702:EE_ X-MS-Office365-Filtering-Correlation-Id: 9e9a8b8c-62ce-4256-0fe5-08daf39b73fd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kpDg24nS1i/hPJCg2B4K93/ZtD9uAErAxuK/1oPduS8fF1ihS4DwS8IDp+0YueZMwOlpCGe5XihuwnpTOmJ7uqp7qQi1QBlyePHh0GEvUU8wQ7939LyDbjsszQSo7pqeY9OpTfdKPRMhwb+JxlqauugWs6iQS7RK8GSfJdgxvVsK5jlF2UcPZJVPx9uV7/1pE2yZX1+0o/aSKCNfQj0/Mf3fLPfH6X7RW9vu4CLDfZsX4+Fgfx7sYbM/+gHxUKmscM8S5MW6OiBghvc/RyrWpVpUWG8VgPE662XD+IGr/y1KJ0YaCcnz2JWAr55e9NY0pj5XjYEsqWmBwegBmipYRgOmUh0vC011rWg6EIlsLAFdYl6uvNTMJ3Qi+B0WOzO9u1MH3pKy7fXkfoh9sg9aPbIm8yQ5uhbGWOAN3s7bLKGaR3lCOD921Hu85pnB6zoeDxjhaDj30MYhsSHi9T5fSNQZ38zL4kwYDjxTHYeiR+j/XlNmXwIaBsampezZbqZqh3xWBAAqxxIFx6Y2EOoeVaFv9GeQrFtblxET6qnedSkGc11VM/I3ca5tddRwIb4tGpQn7TiYaNFj9aQ9iwTMYp/N8XPm/h8oFv+pobRnQEy2p8N+1hT4frwfAHd9/2tRcX6pFLjJPpvErD9H4OqJAMUpeCLRmOL0zd9Cz+ijP9RDhJo3c2Jckc2dvP644XAOR7YTnOEr/2n85mbxOT17YRZn/JQz0VqTQqhUTe9FYwKsqNwR8LhoN7ouUqaXx8yqab1HNtsm4oeed3F2FN4j+ewbK7FFYdnnC8xi2mygF2U= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB03.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230022)(4636009)(39860400002)(136003)(396003)(376002)(346002)(451199015)(36840700001)(40470700004)(46966006)(40480700001)(316002)(5660300002)(26005)(7696005)(186003)(966005)(478600001)(2616005)(41300700001)(426003)(40460700003)(47076005)(6916009)(70586007)(54906003)(70206006)(4326008)(336012)(8676002)(82310400005)(8936002)(36756003)(6666004)(36860700001)(82740400003)(356005)(2906002)(81166007)(213903007)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jan 2023 06:17:01.7010 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9e9a8b8c-62ce-4256-0fe5-08daf39b73fd 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: DS1PEPF0000E648.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB6702 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 --- UefiCpuPkg/UefiCpuPkg.dec | 4 ++ .../Include/Library/SmmSmramSaveStateLib.h | 69 +++++++++++++++++++ 2 files changed, 73 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.=0D #=0D # Copyright (c) 2007 - 2022, Intel Corporation. All rights reserved.
=0D +# Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.
= =0D #=0D # SPDX-License-Identifier: BSD-2-Clause-Patent=0D #=0D @@ -65,6 +66,9 @@ [LibraryClasses.IA32, LibraryClasses.X64] ## @libraryclass Provides function for manipulating x86 paging structu= res.=0D CpuPageTableLib|Include/Library/CpuPageTableLib.h=0D =0D + ## @libraryclass Provides functions for manipulating Smram savestate r= egisters.=0D + SmmSmramSaveSateLib|Include/Library/SmmSmramSaveStateLib.h=0D +=0D [Guids]=0D gUefiCpuPkgTokenSpaceGuid =3D { 0xac05bf33, 0x995a, 0x4ed4, { 0xaa,= 0xb8, 0xef, 0x7a, 0xe8, 0xf, 0x5c, 0xb0 }}=0D gMsegSmramGuid =3D { 0x5802bce4, 0xeeee, 0x4e33, { 0xa1,= 0x30, 0xeb, 0xad, 0x27, 0xf0, 0xe4, 0x39 }}=0D diff --git a/UefiCpuPkg/Include/Library/SmmSmramSaveStateLib.h b/UefiCpuPkg= /Include/Library/SmmSmramSaveStateLib.h new file mode 100644 index 000000000000..d10eb064ceac --- /dev/null +++ b/UefiCpuPkg/Include/Library/SmmSmramSaveStateLib.h @@ -0,0 +1,69 @@ +/** @file=0D +Library that provides service to read/write CPU specific smram save state = registers.=0D +=0D +Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.
=0D +Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.
=0D +=0D +SPDX-License-Identifier: BSD-2-Clause-Patent=0D +=0D +**/=0D +=0D +#ifndef SMM_SMRAM_SAVE_STATE_LIB_H_=0D +#define SMM_SMRAM_SAVE_STATE_LIB_H_=0D +=0D +#include =0D +#include =0D +=0D +/**=0D + Read an SMM Save State register on the target processor. If this functi= on=0D + returns EFI_UNSUPPORTED, then the caller is responsible for reading the= =0D + SMM Save Sate register.=0D +=0D + @param[in] CpuIndex The index of the CPU to read the SMM Save State. = The=0D + value must be between 0 and the NumberOfCpus field= in=0D + the System Management System Table (SMST).=0D + @param[in] Register The SMM Save State register to read.=0D + @param[in] Width The number of bytes to read from the CPU save stat= e.=0D + @param[out] Buffer Upon return, this holds the CPU register value rea= d=0D + from the save state.=0D +=0D + @retval EFI_SUCCESS The register was read from Save State.=0D + @retval EFI_INVALID_PARAMTER Buffer is NULL.=0D + @retval EFI_UNSUPPORTED This function does not support reading Reg= ister.=0D +=0D +**/=0D +EFI_STATUS=0D +EFIAPI=0D +SmramSaveStateReadRegister (=0D + IN UINTN CpuIndex,=0D + IN EFI_SMM_SAVE_STATE_REGISTER Register,=0D + IN UINTN Width,=0D + OUT VOID *Buffer=0D + );=0D +=0D +/**=0D + Writes an SMM Save State register on the target processor. If this func= tion=0D + returns EFI_UNSUPPORTED, then the caller is responsible for writing the= =0D + SMM Save Sate register.=0D +=0D + @param[in] CpuIndex The index of the CPU to write the SMM Save State. = The=0D + value must be between 0 and the NumberOfCpus field = in=0D + the System Management System Table (SMST).=0D + @param[in] Register The SMM Save State register to write.=0D + @param[in] Width The number of bytes to write to the CPU save state.= =0D + @param[in] Buffer Upon entry, this holds the new CPU register value.= =0D +=0D + @retval EFI_SUCCESS The register was written to Save State.=0D + @retval EFI_INVALID_PARAMTER Buffer is NULL.=0D + @retval EFI_UNSUPPORTED This function does not support writing Reg= ister.=0D +**/=0D +EFI_STATUS=0D +EFIAPI=0D +SmramSaveStateWriteRegister (=0D + IN UINTN CpuIndex,=0D + IN EFI_SMM_SAVE_STATE_REGISTER Register,=0D + IN UINTN Width,=0D + IN CONST VOID *Buffer=0D + );=0D +=0D +#endif=0D --=20 2.25.1