From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 30CC8D811B2 for ; Tue, 5 Mar 2024 11:12:46 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=Xw/5Stcfs6S+YT9VXGSrHFgxiUpzMWhT/bk+ez+qWXc=; c=relaxed/simple; d=groups.io; h=ARC-Seal:ARC-Message-Signature:ARC-Authentication-Results:Received-SPF:From:To:CC:Subject:Date:Message-ID:In-Reply-To:References:MIME-Version:Received-SPF:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding:Content-Type; s=20140610; t=1709637164; v=1; b=aEPAXgb0xvM8xLiu4eAorz83bV/sfo6P2/PyBzKeeA5JE3Ug3WMCGhF2jRl+wVq7vsGwYxFb +bXA/ixGqkUTSpnQmLT9gQivJw3MRhvr9KsIwOzzzk6qPjaoC6K9b+8//BGx4Otocs3lh7aRukY v1HzbYivNkEUKFn3A8cSoWUI= X-Received: by 127.0.0.2 with SMTP id J5oYYY7687511xBNh0acTKFS; Tue, 05 Mar 2024 03:12:44 -0800 X-Received: from NAM02-DM3-obe.outbound.protection.outlook.com (NAM02-DM3-obe.outbound.protection.outlook.com [40.107.95.64]) by mx.groups.io with SMTP id smtpd.web11.20300.1709637164240114157 for ; Tue, 05 Mar 2024 03:12:44 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NRl2LjvDZgdeJLEiOh6k0hEYjB9oT/zdxg0bz+24J6639KR0SiXN1m1fFxwsUG6ge69puCcBmv3jqACs2QX6pDdVyi2SWrIJph1bZErXXtE/sNj5BoEHhncPCUSue++eCc7KQEx2s4xoYKZLnaR+LOVMu24DJI7SNPRkRiauz5ilJTOLvmyAz22vOYUlWtnlOBoKF+AXljzs1tFAJKXiLugCL38hh+TktwcPN6+2bCavzCdrxwVQakkUZ18w1RM8QFjhiyFxFPxm0zw0lTand4wiTn0yLbLLE92U07ZWTvC+6QBoiY9a8fjGT9g1NkZMZfXoUON3md7F3q6Zuvy7lA== 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=aW6aWHxAPcQEAKB0pec0klXil0o5icQJV15jODQ6RrA=; b=SVWkGGheMT8KoODsDLcjw3fXSPRvX2VFnQk4sV0hV6LdzlhUc+P3Qqo5gtC4sB+DlzHaKenY0Iuxr3ZePmIps01Bs6dDRPo30dwYgWQNNkLAfjkGgqL4LRV/XVP0flXvo3IAtzPTKLfZSsmCk4asvZaV+BRm9PIQVbPPdacrCsMVPZNqZWSwQAwdqcj5JPMzPOlDo+WHom4Q/JH95KRi1uUSRwDwGl9XWgmdvsgiwva1Mmj1b6cC7DCs38WpRMPH8hL9zLBwbuY5qbXbXul2D45mps8XimQVAB6NDuQADcIlE5aiRFhIIWtkO+s+3xwrcOA0ihoyB/vvRplyGw9e9w== 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 (0) X-Received: from BN0PR04CA0159.namprd04.prod.outlook.com (2603:10b6:408:eb::14) by DM4PR12MB7598.namprd12.prod.outlook.com (2603:10b6:8:10a::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7339.39; Tue, 5 Mar 2024 11:12:42 +0000 X-Received: from BN3PEPF0000B073.namprd04.prod.outlook.com (2603:10b6:408:eb:cafe::ab) by BN0PR04CA0159.outlook.office365.com (2603:10b6:408:eb::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7339.38 via Frontend Transport; Tue, 5 Mar 2024 11:12:42 +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 X-Received: from SATLEXMB04.amd.com (165.204.84.17) by BN3PEPF0000B073.mail.protection.outlook.com (10.167.243.118) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7362.11 via Frontend Transport; Tue, 5 Mar 2024 11:12:42 +0000 X-Received: from SATLEXMB03.amd.com (10.181.40.144) 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.2507.35; Tue, 5 Mar 2024 05:12:37 -0600 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.2507.35 via Frontend Transport; Tue, 5 Mar 2024 05:12:35 -0600 From: "Abdul Lateef Attar via groups.io" To: CC: Abdul Lateef Attar , Zhichao Gao , Pierre Gondois Subject: [edk2-devel] [PATCH v1 2/2] ShellPkg/Acpiview: Adds ACPI WSMT Table parser Date: Tue, 5 Mar 2024 16:42:28 +0530 Message-ID: <27a2681b8001b7b917fa27618a32882e09d041e5.1709636501.git.AbdulLateef.Attar@amd.com> In-Reply-To: References: MIME-Version: 1.0 Received-SPF: None (SATLEXMB04.amd.com: abdattar@amd.com does not designate permitted sender hosts) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN3PEPF0000B073:EE_|DM4PR12MB7598:EE_ X-MS-Office365-Filtering-Correlation-Id: 9b052b1b-2bb9-487c-9042-08dc3d052d19 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: mzZovTG1oWzip/M+YFllQdwPlFdROFwu/fSXzXCoKknAmFUPCUcK9wpueVCkQySmefj0pvbZVy39l/0bao3lc/oKLKxdPQgAm8xDsgUYz+u1+P4HGuDzDM9BTBVKcactrr49fwma3cxQy07Cv6CRzIZHwqSVRKnFJ8GoF7IQ4qRO39a/b2LFuwOQTBq+8Rvr1PZXBmPXKAY6Y4a1738B5F8EHDSkT0rUSoDHyfIa1zWdnKbjpzgny2yngJTY72YUKcwNJqH8JGV6JxhIgQzXqHOQCwr1yM9DXgmW31ND96ap5E5yFAsWqFbxqTs5C+aleedDN8841XulId4gxoxznXsGS3dW+CGZw7A5AKBy4UQmHpeYykXwqR7GqKq15AkFYgAPMk3TTBcWZMizgLmkDpnOHL0wPsbbu2nG7Bc61SoVRezpb0bi8nA8N7sPQOj0zDAAeUVNdrFTnRoGOkOSE25Iki0PO0iWKh9ZwOYD1R4C2gJhjhhT68leTM4nrafOJt56uFwNPwYE9/JVlMtjNNrcIXtHphYzWIbuZhMNEa/JmMceceIQh4UvsSfMl9xPMhm59+ncexde4SU09LgxduxY3oYdCoa+tIlUMFDgr7YLQLF7VIvW9FKGGLDI5mMU0j8UZ+o/R38C4F3MiCa/vXy/k+W2Uwi5vvs2Phhzm6mXTFrTmaTcSsIVBAtUHttiCLuvjJN3aTG22053Cgf97CPrk5N0sIbLKonCMlbz0PxstigX+qmn3XKz1yiINoGp X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Mar 2024 11:12:42.0236 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9b052b1b-2bb9-487c-9042-08dc3d052d19 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: BN3PEPF0000B073.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB7598 Precedence: Bulk 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,AbdulLateef.Attar@amd.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: ePAnTWtrnuA2V565QBYJEKRWx7686176AA= Content-Transfer-Encoding: quoted-printable Content-Type: text/plain X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=aEPAXgb0; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io; dmarc=pass (policy=none) header.from=groups.io; arc=reject ("signature check failed: fail, {[1] = sig:microsoft.com:reject}") From: Abdul Lateef Attar Adds WSMT parse to the UefiShellAcpiViewCommandLib library. Cc: Zhichao Gao Cc: Pierre Gondois Signed-off-by: Abdul Lateef Attar --- .../UefiShellAcpiViewCommandLib/AcpiParser.h | 17 ++++ .../Parsers/Wsmt/WsmtParser.c | 89 +++++++++++++++++++ .../UefiShellAcpiViewCommandLib.c | 1 + .../UefiShellAcpiViewCommandLib.inf | 1 + 4 files changed, 108 insertions(+) create mode 100644 ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Ws= mt/WsmtParser.c diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h b/Sh= ellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h index ba3364f2c2..6468fe5d8c 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h @@ -985,6 +985,23 @@ ParseAcpiSsdt ( IN UINT8 AcpiTableRevision ); =20 +/** + This function parses the ACPI WSMT table. + + @param [in] Trace If TRUE, trace the ACPI fields. + @param [in] Ptr Pointer to the start of the buffer. + @param [in] AcpiTableLength Length of the ACPI table. + @param [in] AcpiTableRevision Revision of the ACPI table. +**/ +VOID +EFIAPI +ParseAcpiWsmt ( + IN BOOLEAN Trace, + IN UINT8 *Ptr, + IN UINT32 AcpiTableLength, + IN UINT8 AcpiTableRevision + ); + /** This function parses the ACPI XSDT table and optionally traces the ACPI table fields. diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Wsmt/Wsmt= Parser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Wsmt/WsmtPa= rser.c new file mode 100644 index 0000000000..eb2668c059 --- /dev/null +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Wsmt/WsmtParser.= c @@ -0,0 +1,89 @@ +/** @file + WSMT table parser + + Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved. + SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Reference(s): + - Windows SMM Security Mitigation Table spec, version 1.0 +**/ + +#include +#include "AcpiParser.h" + +STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; + +/** + An ACPI_PARSER array describing the WSMT Protection flag . +**/ +STATIC CONST ACPI_PARSER WsmtProtectionFlagParser[] =3D { + { L"FIXED_COMM_BUFFERS ", 1, 0, L"0x%x", NULL, NULL, NUL= L, NULL }, + { L"COMM_BUFFER_NESTED_PTR_PROTECTION ", 1, 1, L"0x%x", NULL, NULL, NUL= L, NULL }, + { L"SYSTEM_RESOURCE_PROTECTION ", 1, 2, L"0x%x", NULL, NULL, NUL= L, NULL }, + { L"Reserved ", 29, 3, L"0x%x", NULL, NULL, NUL= L, NULL }, +}; + +/** + This function prints WSMT Protection flag. + If no format string is specified the Format must be NULL. + + @param [in] Format Optional format string for tracing the data. + @param [in] Ptr Pointer to the start of the buffer. +**/ +VOID +EFIAPI +DumpWsmtProtectionFlag ( + IN CONST CHAR16 *Format OPTIONAL, + IN UINT8 *Ptr + ) +{ + if (Format !=3D NULL) { + Print (Format, *(UINT32 *)Ptr); + return; + } + + Print (L"0x%X\n", *(UINT32 *)Ptr); + ParseAcpiBitFields ( + TRUE, + 2, + NULL, + Ptr, + 4, + PARSER_PARAMS (WsmtProtectionFlagParser) + ); +} + +/** + An ACPI_PARSER array describing the ACPI WSMT Table. +**/ +STATIC CONST ACPI_PARSER WsmtParser[] =3D { + PARSE_ACPI_HEADER (&AcpiHdrInfo), + { L"Protection Flag", 4,36, NULL, DumpWsmtProtectionFlag, NUL= L, NULL, NULL } +}; + +/** + This function parses the ACPI WSMT table. + + @param [in] Trace If TRUE, trace the ACPI fields. + @param [in] Ptr Pointer to the start of the buffer. + @param [in] AcpiTableLength Length of the ACPI table. + @param [in] AcpiTableRevision Revision of the ACPI table. +**/ +VOID +EFIAPI +ParseAcpiWsmt ( + IN BOOLEAN Trace, + IN UINT8 *Ptr, + IN UINT32 AcpiTableLength, + IN UINT8 AcpiTableRevision + ) +{ + ParseAcpi ( + Trace, + 0, + "WSMT", + Ptr, + AcpiTableLength, + PARSER_PARAMS (WsmtParser) + ); +} diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiView= CommandLib.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiVi= ewCommandLib.c index 9e15979ea2..0bdf068fe0 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommand= Lib.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommand= Lib.c @@ -73,6 +73,7 @@ ACPI_TABLE_PARSER ParserList[] =3D { { EFI_ACPI_6_2_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_SIGNATURE, = ParseAcpiSpcr }, { EFI_ACPI_6_2_SYSTEM_RESOURCE_AFFINITY_TABLE_SIGNATURE, = ParseAcpiSrat }, { EFI_ACPI_6_2_SECONDARY_SYSTEM_DESCRIPTION_TABLE_SIGNATURE, = ParseAcpiSsdt }, + { EFI_ACPI_6_5_WINDOWS_SMM_SECURITY_MITIGATION_TABLE_SIGNATURE, = ParseAcpiWsmt }, { EFI_ACPI_6_2_EXTENDED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE, = ParseAcpiXsdt } }; =20 diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiView= CommandLib.inf b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpi= ViewCommandLib.inf index 3338e04379..e62366116c 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommand= Lib.inf +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommand= Lib.inf @@ -52,6 +52,7 @@ Parsers/Spcr/SpcrParser.c Parsers/Srat/SratParser.c Parsers/Ssdt/SsdtParser.c + Parsers/Wsmt/WsmtParser.c Parsers/Xsdt/XsdtParser.c UefiShellAcpiViewCommandLib.c UefiShellAcpiViewCommandLib.uni --=20 2.34.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 (#116364): https://edk2.groups.io/g/devel/message/116364 Mute This Topic: https://groups.io/mt/104742258/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-