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 418C07803CF for ; Thu, 7 Mar 2024 10:37:24 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=5nktbJCHXlsur61F2N6woPpSoVi+hjcBbkiXY0kqb7I=; c=relaxed/simple; d=groups.io; h=Message-ID:Date:MIME-Version:User-Agent:From:Subject:To:Cc:References:In-Reply-To:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20240206; t=1709807842; v=1; b=MzOOekQ3MOOd+/k5UCym/+NfaIMEStXBNi2xBXKfO4lyiDFCkXXInpV1+odO7oXvbrZbojs+ 70QSlxavqIy1MprfggFdYDhAnyWpusY6Sy7W7m79x2oT+6Daew9p1lPi2+FbRk5ApGVhzYdbson Q7Yjg+qvIpXAJryO1OWDRRYrt8QOjKABiICbfESKeXgxkxhN9E66x9g6f3U1n7ySUQu7xGKt1DK kWKt0QOcE8ddBWg1i8FmDM/I68xr4KZloTMaqCZI9F3NP8zWzVDZWq5vbMiECFTTQhUsiEi4ejD 16ReCaRwTjx81Ggmpdc2KgBNPR6QVLK4YYSdI+v/4w2pQ== X-Received: by 127.0.0.2 with SMTP id QSXFYY7687511xDMnIzxQJtr; Thu, 07 Mar 2024 02:37:22 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web11.20314.1709807842023682300 for ; Thu, 07 Mar 2024 02:37:22 -0800 X-Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A716C1FB; Thu, 7 Mar 2024 02:37:58 -0800 (PST) X-Received: from [10.34.100.133] (e126645.nice.arm.com [10.34.100.133]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E0D343F762; Thu, 7 Mar 2024 02:37:20 -0800 (PST) Message-ID: <4a45c309-9e4d-49ff-a872-50f9cd8d41b0@arm.com> Date: Thu, 07 Mar 2024 02:37:22 -0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: "PierreGondois" Subject: Re: [edk2-devel] [PATCH v1 2/2] ShellPkg/Acpiview: Adds ACPI WSMT Table parser To: Abdul Lateef Attar , devel@edk2.groups.io Cc: Abdul Lateef Attar , Zhichao Gao References: <27a2681b8001b7b917fa27618a32882e09d041e5.1709636501.git.AbdulLateef.Attar@amd.com> In-Reply-To: <27a2681b8001b7b917fa27618a32882e09d041e5.1709636501.git.AbdulLateef.Attar@amd.com> 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,pierre.gondois@arm.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: GF3OTZXvzAFutM2vHlpD24Fax7686176AA= Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b=MzOOekQ3; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=arm.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io Hello Abdul, I just have one comment, with that: Reviewed-by: Pierre Gondois On 3/5/24 12:12, Abdul Lateef Attar wrote: > From: Abdul Lateef Attar >=20 > Adds WSMT parse to the UefiShellAcpiViewCommandLib library. >=20 > 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= /Wsmt/WsmtParser.c >=20 > diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h b/= ShellPkg/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/Ws= mtParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Wsmt/Wsmt= Parser.c > new file mode 100644 > index 0000000000..eb2668c059 > --- /dev/null > +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Wsmt/WsmtParse= r.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, N= ULL, NULL }, > + { L"COMM_BUFFER_NESTED_PTR_PROTECTION ", 1, 1, L"0x%x", NULL, NULL, N= ULL, NULL }, > + { L"SYSTEM_RESOURCE_PROTECTION ", 1, 2, L"0x%x", NULL, NULL, N= ULL, NULL }, > + { L"Reserved ", 29, 3, L"0x%x", NULL, NULL, N= ULL, 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, N= ULL, NULL, NULL } Maybe a validate function could be added, similar to: ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c::Val= idateFlags() just to check that FIXED_COMM_BUFFERS is set if COMM_BUFFER_NESTED_PTR_PRO= TECTION is set, and use IncrementErrorCount() + Print() if > +}; > + > +/** > + 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/UefiShellAcpiVi= ewCommandLib.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpi= ViewCommandLib.c > index 9e15979ea2..0bdf068fe0 100644 > --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewComma= ndLib.c > +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewComma= ndLib.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/UefiShellAcpiVi= ewCommandLib.inf b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAc= piViewCommandLib.inf > index 3338e04379..e62366116c 100644 > --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewComma= ndLib.inf > +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewComma= ndLib.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 -=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 (#116481): https://edk2.groups.io/g/devel/message/116481 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-