From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (NAM12-MW2-obe.outbound.protection.outlook.com [40.107.244.48]) by mx.groups.io with SMTP id smtpd.web11.7264.1666881666893978280 for ; Thu, 27 Oct 2022 07:41:07 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@nvidia.com header.s=selector2 header.b=Q232hpNS; 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.244.48, mailfrom: jbrasen@nvidia.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CiMlkAmcxm5qGir6+NGm0SbOJ+dNzO8RQ4J83qWAnzY1f1va+6NAl2Wi/LE4xJZAlKiyF/B2wnQNJbMsFiEdbSP0OKl1Cnvx5MTJfkxT0Q/VG/V1vxbCKl+ByOjzwUhXFzsqYpC6gw98iZkqZF3JVySh7y83iUYV/R4649fMGHUkL6fRcwnngDKuolcc8G8gvyfJ1RgFiSqWGQ/Yxo2vRK6a2KqiLR6Suodmp1ZnIzmyEGluk2wJ1Gf+6oziu8s0wl/sqA20Qi5srqkDiKpjdiKDelmjetslajD7ig2pepOpKe0Mp5oMBowIzgoKQSQIq7G3E+ieKhyiIbACmksBiA== 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=435Vs0VJiYF2/J7H64qICdkTCvmyOWtB9Gx9I6HjFoM=; b=S7B52LV0TGDDN/n5lyuOm5GuqbEefMFPQjiZ7I/jw1w0VKyiBVwcCuHH8Yv0BwRy/IC6lGfsYDFSYC+AKSO5GwIyhbGx7Qgfgi8JYU2J2jgxd+h56NscjgOTuzPf+0m31nzNddblrENCod9j6/ilrHeIC7XViUi/PU+kG+2LGAwqKIb0IniWhGNZa4BZS89xlg/bgRpX3nk9qv60yAKTvTuIUK12H0ijt1fpvKjqMCaKdOOtCMGOCpIV00MDSfEjYR9HrQr2ZOn14WAW9AoLhjVXuiKWbQoTughjfg03XGmlUwqekMPBgBi3dO9LsGl1DY2JgDSMux/hOLUUfwayng== 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=435Vs0VJiYF2/J7H64qICdkTCvmyOWtB9Gx9I6HjFoM=; b=Q232hpNSV2CIyuQ3vlu3ZIt9Yt+gC/jutD8D5gWqxqYkz010eHARGYJ8+OURgM7uXNQmEsIv8qCVRcKCoNOP4fKQhA2sHL8lQ3C1dwOoKBCd6eysQQED3E2BOYToITFqRqmzA/qoRdiFovWWkdVLusjpofbzKMOqbaEMjl1k84fuhwkd2nLUsnk2oH1KCUtvDKJrRDmVy6bynRGBWn4M3DUV7KQ/lVB85bxM4cADGEmt7dULpDf562BRtehgCEb/fa2lODIOdolEcPmrxt0d45Spae0eDkx5zGuMc0+hQi/oo0oJyhGrMoyql7mDwaKi7inK3Ar4Lmgjgxj2DNB/pg== Received: from DM6PR06CA0002.namprd06.prod.outlook.com (2603:10b6:5:120::15) by SN7PR12MB8026.namprd12.prod.outlook.com (2603:10b6:806:34b::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.28; Thu, 27 Oct 2022 14:41:05 +0000 Received: from DM6NAM11FT023.eop-nam11.prod.protection.outlook.com (2603:10b6:5:120:cafe::c7) by DM6PR06CA0002.outlook.office365.com (2603:10b6:5:120::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.28 via Frontend Transport; Thu, 27 Oct 2022 14:41:04 +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 DM6NAM11FT023.mail.protection.outlook.com (10.13.173.96) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.16 via Frontend Transport; Thu, 27 Oct 2022 14:41:04 +0000 Received: from rnnvmail204.nvidia.com (10.129.68.6) 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; Thu, 27 Oct 2022 07:40:55 -0700 Received: from rnnvmail201.nvidia.com (10.129.68.8) by rnnvmail204.nvidia.com (10.129.68.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.29; Thu, 27 Oct 2022 07:40:55 -0700 Received: from localhost.localdomain (10.127.8.9) by mail.nvidia.com (10.129.68.8) with Microsoft SMTP Server id 15.2.986.29 via Frontend Transport; Thu, 27 Oct 2022 07:40:54 -0700 From: "Jeff Brasen" To: CC: , , , , , "Jeff Brasen" Subject: [PATCH 2/2] ShellPkg/AcpiView: APMT Parser Date: Thu, 27 Oct 2022 08:40:58 -0600 Message-ID: <31328fbc79e80ba50d56f11e8e2870b4c41db0b8.1666881494.git.jbrasen@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <1dd062eed3bce95a7928fa41f8e3821897867b4c.1666881494.git.jbrasen@nvidia.com> References: <1dd062eed3bce95a7928fa41f8e3821897867b4c.1666881494.git.jbrasen@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public Return-Path: jbrasen@nvidia.com X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT023:EE_|SN7PR12MB8026:EE_ X-MS-Office365-Filtering-Correlation-Id: ffe4d749-baae-42e6-a7b5-08dab82946c9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FkTWCwW6L9iDtMmg5qsXOo5V3q3LHytSmMrF/ey57Jj3njtwdABj3zAnRWAR5cUMXtdDF8mDMRM9zE0/rBxDGNcIgodII59irrFButNRismYuLL5gj2PwuHkiTO8MlQN2xg9kyYu3oBO34fXGbIZNqI+bGIVWblYtyosa7suYFBx8H623KsxnkD2tTWKiXI/HdpToSgfm92aYMzeGnH0QNoqmHTIQSTv8WB49GqGf7vG0dyLhBaHzOQzLHlNhYMSo9crFxebmVGDxcjjG9Yd2ZU6KqrWAMeAvDUgY8RRd8ADhQpqvhbr/JiH3uckpV33JxfGoPa3riGWluHdPDKQEnJNxb9Cg27E8mgZLHxMUxCwYYsluGozgEIOWLuoqXLe5ktue4tnIFuA9ifkyEUBo1eXNQCjLz0RqejaIFXqZEadfqi5iaGpIz6+7KJu5xHgfSHVpqpQ1zZWE2pPDPMsOLUXYCa4qLl8ijYny6W9sy6m1P8T+qhNbHn+8CdIkxEOSLtOmAcRekXfTsjY/4rV5fm5WUhZH5glJHaBtgONvQq48ir0DB95W30c1+nnnj1JMpdacAoSMbHb1J4XXWdrw66t6SL1AuQq7nLt832+BlhpMRFEP5AlMjaajG3dg6o3KZvmQGMDlQ6lGhA/axogCMMOjiPGyVMSuAPpRmGQIc5LA0OhGWzcDEnML+EiOnov/xcLNhfPoOf6JlwiDjCcSLEH+c33sQVsNGeWS3whjMx8ZvrLZhzRfu+OGgI6x1W+Ap5WeLjR6LUCdyI3Z/ht4g== 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)(136003)(346002)(376002)(396003)(451199015)(46966006)(40470700004)(36840700001)(336012)(107886003)(186003)(83380400001)(36860700001)(426003)(47076005)(26005)(2616005)(2906002)(40460700003)(8936002)(40480700001)(316002)(6916009)(54906003)(4326008)(70586007)(8676002)(19627235002)(41300700001)(70206006)(478600001)(82310400005)(5660300002)(86362001)(36756003)(82740400003)(356005)(7636003);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Oct 2022 14:41:04.5731 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ffe4d749-baae-42e6-a7b5-08dab82946c9 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: DM6NAM11FT023.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB8026 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 | 105 ++++++++++++++++++=0D .../UefiShellAcpiViewCommandLib.c | 1 +=0D .../UefiShellAcpiViewCommandLib.inf | 1 +=0D 4 files changed, 128 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..b036cd12d3=0D --- /dev/null=0D +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Apmt/ApmtParser.= c=0D @@ -0,0 +1,105 @@=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 + 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 -- =0D 2.25.1=0D =0D