From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (NAM10-MW2-obe.outbound.protection.outlook.com [40.107.94.71]) by mx.groups.io with SMTP id smtpd.web11.149.1667577903916677635 for ; Fri, 04 Nov 2022 09:05:04 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@nvidia.com header.s=selector2 header.b=fhwPLCIe; spf=permerror, err=parse error for token &{10 18 %{i}._ip.%{h}._ehlo.%{d}._spf.vali.email}: invalid domain name (domain: nvidia.com, ip: 40.107.94.71, mailfrom: jbrasen@nvidia.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jHUaJM9UoSzHPZBldekmtnhwoMH0riNGuj5O/ZQmfBkrADj1+MD4y6HsMQCN74nAvj92n883f97Mjb1WteP36jJvrWSGxVKfj17mwwBJ5iT9gpc0DL1UB2PaoBbFKkx6sQKdmfZt2ICEcXnXwh9I6nYugIWJK5BE6MusgNS6cE7Tax1ZPFSm56+VlLPTmC9MB0qMknjfnw+zkklCBq6bIeNhFh34gpuVdwDo+qDRnH5hqyJGpz8WbETMH97C9qy6gx3QNZBX2sm4C3uNlhr8DCnylberOPlEyKDyVS1IScV+D8suHZQiTD6AM9psdTJNAHto+xwj3141PpWfJf+rLQ== 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=1NNOnL9AoXi0BKKXbR3FKKqFmo5ilASUN5FfxJBdBb4=; b=d2lgq+Sed/PbarAka6S6WNfn2HwTa0ZGlzZ4hckqBCqqvgaXu2gEn6lL6mgj1GSAJG/kAkfNterq8na/Ir46uM2QpjOEcTLfQx2QVp2b770SAjIinopZz3qCGaAobUyGKjQ74exdHJUheH/Oy4XC1v2uzbtdzgtJQJSuSP9VJ6+cxl/TvVwtZSgzKzkiKGCrkgmq5QR5mC1eLVcBwdvNBDhBGX3UwAL+CepSgTRTMWGymRIezyPM+M0AzjDbRypVlX/5sy5emS/2CQlQaPr+1JBPy7FZ7jWXcB5cny5yq4w8ZOfZJmz3weKAv4z/ysPxUZ25STttXRxZKLvkMTWKGw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=edk2.groups.io smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1NNOnL9AoXi0BKKXbR3FKKqFmo5ilASUN5FfxJBdBb4=; b=fhwPLCIeoyGoBiEe6JoZCM4FMQ1xvMQFnteTdH+WDcZJQlToVIPcQKKPqS6dSdDF1uATFYyfWwdcnqrAREmywOA1ggGpBFmFszeZ0TkCEESwgyx48HfH+KrcZb7SLR+dyGvo3s0gcZnRX2EBLN1YwPAbBg8QbXiZvSnjF6dNgLpFlSgrEmkwR3M4I3UK4tbnh3OpFH45YMjRQVtckA5TfAmCQKVPVUpJf73l1/VbWeAbXxR49Fhp3AubGKlzLKgtC5JqEd7eLYT1nuLxaS4jvJFZua4YyobKOGFnSEBDU7CP6oISpFTngCMLXo6UtBPQ/LnvtQje3MbwJeZ03kBGRA== Received: from DS7PR03CA0282.namprd03.prod.outlook.com (2603:10b6:5:3ad::17) by MW4PR12MB6923.namprd12.prod.outlook.com (2603:10b6:303:208::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5769.16; Fri, 4 Nov 2022 16:05:00 +0000 Received: from DM6NAM11FT035.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3ad:cafe::98) by DS7PR03CA0282.outlook.office365.com (2603:10b6:5:3ad::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.22 via Frontend Transport; Fri, 4 Nov 2022 16:05:00 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by DM6NAM11FT035.mail.protection.outlook.com (10.13.172.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.20 via Frontend Transport; Fri, 4 Nov 2022 16:05:00 +0000 Received: from rnnvmail205.nvidia.com (10.129.68.10) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.26; Fri, 4 Nov 2022 09:04:51 -0700 Received: from rnnvmail201.nvidia.com (10.129.68.8) by rnnvmail205.nvidia.com (10.129.68.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.29; Fri, 4 Nov 2022 09:04:51 -0700 Received: from f9050a1d9579.nvidia.com (10.127.8.13) by mail.nvidia.com (10.129.68.8) with Microsoft SMTP Server id 15.2.986.29 via Frontend Transport; Fri, 4 Nov 2022 09:04:50 -0700 From: "Jeff Brasen" To: CC: , , , , , , , Jeff Brasen Subject: [PATCH v2 2/2] ShellPkg/AcpiView: APMT Parser Date: Fri, 4 Nov 2022 10:04:48 -0600 Message-ID: <83aca131985fd3f88a3df723d05d16535689539b.1667577844.git.jbrasen@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-NVConfidentiality: public Return-Path: jbrasen@nvidia.com X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT035:EE_|MW4PR12MB6923:EE_ X-MS-Office365-Filtering-Correlation-Id: ac12b25d-49cf-4663-4a6d-08dabe7e53d2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: llaK3Kv0t/pumXOOkiVnIKVAD1gVeniIweH3yAMEiJWkqdo/K2vPdtRsbl5X4Ig+rG6FaGd+R95jjmqJD5M8cmKgKFIXupg2jnrX9edlTA6l1hlATwPGnS2/TDR0ejsP4EJAYl9/nmiuqGq0DLaDacFBonK30bP4xOGhYZ43tvxdgml/71zqkln557Ve5+5Qe+XSA9+SJMdAj1zhA8gCgBFzBBUZfnvmSLDGDbdGlCGOOnUUxv8tZa+IaCUloIXQf/8yaBCtEqpa7vZL1kDm0b04xHLLLHmeqImhs2DxbAyTtaWPJ+UmTsoZQfhsdIqtwFdO6T6dLi0GckCEHfoFs9pzvoor1IF63CCS7fFZL4TregDXIl+h/hiGn3Lt+VuCo4Kz7cgJGZpCat9A1izmrOJCvvu/YsgmKhIMGJdgzHNDjhsXXZt5bXPwjnB5ijkQFCpT+sLGho54uFQUnnZlOMGkaruUx/Kd9GXo0qxcVQKk5jDjTX7m9MJkwiM22uvjaYE72K8ravBqAuu7mruYiiSv6Hyh52uiCKabiioUwOXFb7GEeMssx6tP2fqIzLORYBEF5R/oxVg/LIMdKyfqFUbWJU7drIzEGBl0W9RDl8WElC1PUjZcNmqiCkiLKTi1Mpo/Dy8FIsWaqwF8A4MkaIEkQYukxzd0klJHZT+xdE3R0NLws1YdAsaFMFJlhK4Cl3qAjVIpDtNwiQh54LOh6VHpTNp992qFmYUovG7s14nfFl8MCto9uMcTB4XANDSFcjm6OJn1mDQoBqOWqhr82g== X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230022)(4636009)(39860400002)(396003)(376002)(346002)(136003)(451199015)(46966006)(40470700004)(36840700001)(4326008)(41300700001)(8676002)(7636003)(86362001)(70206006)(70586007)(5660300002)(316002)(8936002)(19627235002)(54906003)(6916009)(36756003)(36860700001)(82740400003)(356005)(40480700001)(40460700003)(83380400001)(478600001)(26005)(7696005)(107886003)(2906002)(82310400005)(186003)(336012)(47076005)(2616005)(426003);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2022 16:05:00.6231 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ac12b25d-49cf-4663-4a6d-08dabe7e53d2 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT035.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB6923 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain Add a new parser for the Arm Performance Monitoring Unit Table.=0D The APMT table describes the properties of PMU support=0D implemented by components in an Arm-based system.=0D =0D Signed-off-by: Jeff Brasen =0D ---=0D .../UefiShellAcpiViewCommandLib/AcpiParser.h | 21 ++++=0D .../Parsers/Apmt/ApmtParser.c | 106 ++++++++++++++++++=0D .../UefiShellAcpiViewCommandLib.c | 1 +=0D .../UefiShellAcpiViewCommandLib.inf | 1 +=0D .../UefiShellAcpiViewCommandLib.uni | 1 +=0D 5 files changed, 130 insertions(+)=0D create mode 100644 ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Ap= mt/ApmtParser.c=0D =0D diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h b/Sh= ellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h=0D index db8c88f6df..6a1de4e12b 100644=0D --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h=0D +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h=0D @@ -531,6 +531,27 @@ ParseAcpiAest (=0D IN UINT8 AcpiTableRevision=0D );=0D =0D +/**=0D + This function parses the ACPI APMT table.=0D + When trace is enabled this function parses the APMT table and=0D + traces the ACPI table fields.=0D +=0D + This function also performs validation of the ACPI table fields.=0D +=0D + @param [in] Trace If TRUE, trace the ACPI fields.=0D + @param [in] Ptr Pointer to the start of the buffer.=0D + @param [in] AcpiTableLength Length of the ACPI table.=0D + @param [in] AcpiTableRevision Revision of the ACPI table.=0D +**/=0D +VOID=0D +EFIAPI=0D +ParseAcpiApmt (=0D + IN BOOLEAN Trace,=0D + IN UINT8 *Ptr,=0D + IN UINT32 AcpiTableLength,=0D + IN UINT8 AcpiTableRevision=0D + );=0D +=0D /**=0D This function parses the ACPI BGRT table.=0D When trace is enabled this function parses the BGRT table and=0D diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Apmt/Apmt= Parser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Apmt/ApmtPa= rser.c=0D new file mode 100644=0D index 0000000000..ad64adbb0a=0D --- /dev/null=0D +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Apmt/ApmtParser.= c=0D @@ -0,0 +1,106 @@=0D +/** @file=0D + APMT table parser=0D +=0D + Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.=0D + Copyright (c) 2017 - 2018, ARM Limited. All rights reserved.=0D + SPDX-License-Identifier: BSD-2-Clause-Patent=0D +=0D + @par Reference(s):=0D + - ACPI 6.2 Specification - Errata A, September 2017=0D +**/=0D +=0D +#include =0D +#include =0D +#include =0D +#include "AcpiParser.h"=0D +#include "AcpiTableParser.h"=0D +=0D +// Local variables=0D +STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;=0D +STATIC CONST UINT16 *NodeLength;=0D +=0D +/**=0D + An ACPI_PARSER array describing the ACPI APMT Table.=0D +**/=0D +STATIC CONST ACPI_PARSER ApmtParser[] =3D {=0D + PARSE_ACPI_HEADER (&AcpiHdrInfo)=0D +};=0D +=0D +/**=0D + An ACPI_PARSER array describing the ACPI Arm PMU Node.=0D +**/=0D +STATIC CONST ACPI_PARSER ArmPmuNodeParser[] =3D {=0D + { L"Length", 2, 0, L"0x%x", NULL, (VOID **)&NodeLeng= th, NULL, NULL },=0D + { L"Node flags", 1, 2, L"0x%x", NULL, NULL, = NULL, NULL },=0D + { L"Node type", 1, 3, L"0x%x", NULL, NULL, = NULL, NULL },=0D + { L"Identifier", 4, 4, L"0x%x", NULL, NULL, = NULL, NULL },=0D + { L"Node Instance primary", 8, 8, L"0x%lx", NULL, NULL, = NULL, NULL },=0D + { L"Node Instance secondary", 4, 16, L"0x%x", NULL, NULL, = NULL, NULL },=0D + { L"Base address 0", 8, 20, L"0x%lx", NULL, NULL, = NULL, NULL },=0D + { L"Base address 1", 8, 28, L"0x%lx", NULL, NULL, = NULL, NULL },=0D + { L"Overflow interrupt", 4, 36, L"0x%x", NULL, NULL, = NULL, NULL },=0D + { L"Reserved1", 4, 40, L"0x%x", NULL, NULL, = NULL, NULL },=0D + { L"Overflow interrupt flags", 4, 44, L"0x%x", NULL, NULL, = NULL, NULL },=0D + { L"Processor affinity", 4, 48, L"0x%x", NULL, NULL, = NULL, NULL },=0D + { L"Implementation ID", 4, 52, L"0x%x", NULL, NULL, = NULL, NULL }=0D +};=0D +=0D +/**=0D + This function parses the ACPI APMT table.=0D + When trace is enabled this function parses the APMT table and=0D + traces the ACPI table fields.=0D +=0D + This function also performs validation of the ACPI table fields.=0D +=0D + @param [in] Trace If TRUE, trace the ACPI fields.=0D + @param [in] Ptr Pointer to the start of the buffer.=0D + @param [in] AcpiTableLength Length of the ACPI table.=0D + @param [in] AcpiTableRevision Revision of the ACPI table.=0D +**/=0D +VOID=0D +EFIAPI=0D +ParseAcpiApmt (=0D + IN BOOLEAN Trace,=0D + IN UINT8 *Ptr,=0D + IN UINT32 AcpiTableLength,=0D + IN UINT8 AcpiTableRevision=0D + )=0D +{=0D + UINT32 Offset;=0D +=0D + if (!Trace) {=0D + return;=0D + }=0D +=0D + ParseAcpi (=0D + Trace,=0D + 0,=0D + "APMT",=0D + Ptr,=0D + AcpiTableLength,=0D + PARSER_PARAMS (ApmtParser)=0D + );=0D + Offset =3D sizeof (EFI_ACPI_DESCRIPTION_HEADER);=0D +=0D + while (Offset < AcpiTableLength) {=0D + ParseAcpi (=0D + Trace,=0D + 2,=0D + "Arm PMU node",=0D + Ptr + Offset,=0D + (AcpiTableLength - Offset),=0D + PARSER_PARAMS (ArmPmuNodeParser)=0D + );=0D + if (NodeLength =3D=3D NULL) {=0D + Print (=0D + L"ERROR: Insufficient remaining table buffer length to read the " = \=0D + L"Node structure. Length =3D %d.\n",=0D + (AcpiTableLength - Offset)=0D + );=0D + IncrementErrorCount ();=0D + break;=0D + }=0D +=0D + Offset +=3D *NodeLength;=0D + }=0D +}=0D diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiView= CommandLib.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiVi= ewCommandLib.c=0D index 09bdddb56e..53f06fc757 100644=0D --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommand= Lib.c=0D +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommand= Lib.c=0D @@ -48,6 +48,7 @@ STATIC=0D CONST=0D ACPI_TABLE_PARSER ParserList[] =3D {=0D { EFI_ACPI_6_3_ARM_ERROR_SOURCE_TABLE_SIGNATURE, = ParseAcpiAest },=0D + { EFI_ACPI_6_4_ARM_PERFORMANCE_MONITORING_UNIT_TABLE_SIGNATURE, = ParseAcpiApmt },=0D { EFI_ACPI_6_2_BOOT_GRAPHICS_RESOURCE_TABLE_SIGNATURE, = ParseAcpiBgrt },=0D { EFI_ACPI_6_2_DEBUG_PORT_2_TABLE_SIGNATURE, = ParseAcpiDbg2 },=0D { EFI_ACPI_6_2_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE,=0D diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiView= CommandLib.inf b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpi= ViewCommandLib.inf=0D index 63fc5a1281..b03ec1a31b 100644=0D --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommand= Lib.inf=0D +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommand= Lib.inf=0D @@ -28,6 +28,7 @@=0D AcpiViewConfig.c=0D AcpiViewConfig.h=0D Parsers/Aest/AestParser.c=0D + Parsers/Apmt/ApmtParser.c=0D Parsers/Bgrt/BgrtParser.c=0D Parsers/Dbg2/Dbg2Parser.c=0D Parsers/Dsdt/DsdtParser.c=0D diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiView= CommandLib.uni b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpi= ViewCommandLib.uni=0D index 393110e0ee..e4a9dd5b40 100644=0D --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommand= Lib.uni=0D +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommand= Lib.uni=0D @@ -80,6 +80,7 @@=0D " Extra A. Particular types:\r\n"=0D " AEST - Arm Error Source Table\r\n"=0D " APIC - Multiple APIC Description Table (MADT)\r\n"=0D +" APMT - Arm Performance Monitoring Unit Table\r\n"=0D " BGRT - Boot Graphics Resource Table\r\n"=0D " DBG2 - Debug Port Table 2\r\n"=0D " DSDT - Differentiated System Description Table\r\n"=0D -- =0D 2.25.1=0D =0D