From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (EUR04-DB3-obe.outbound.protection.outlook.com [40.107.6.62]) by mx.groups.io with SMTP id smtpd.web12.5226.1667302940173843869 for ; Tue, 01 Nov 2022 04:42:21 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=h+S9nirh; spf=pass (domain: arm.com, ip: 40.107.6.62, mailfrom: sami.mujawar@arm.com) ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=m5ymUChVgYtMo6BLgJuloOB6EIPORi/zfr/HgcaZt0affXi8jJoNAjU5XwN2UPMr0216Jhd4ZUsDdhdgQ6uac6cIx2UALm7+neM2A/rhtppKVBR4fTlm4jidnxQXuNEJJxVU3T/ITey/voVce75P6lmrSSRhh8Z7pIbkEPe5srcaXuIqWQs41nBDKAx91EUjx1XnH+e7snBAhV5MVES5RZ7bo4DckxTfT+a/c6GUiADQDlwYXgZGqFuV7luRrQ8ayfDu3xSnKstvFxvy6NxyPeTJtbL+yJN/7jzJACjftVojx+fJ7MgABb+wwgvy6NlZa7tU77RoL1Qn9pLRdU+MSQ== ARC-Message-Signature: i=2; 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=6JcVG7Fikpw5sAcFoKD6Ta9kxwe2jg4BB/JzTgjzHmM=; b=UhmwZmB9Xc5MyF0GJPvl1sd8kfAiU1lCZg7/1WY8bkEsHiWoKWS480Oun1Eu/YtqvViNivY+rhGogB6qHSiwxgE7idTQD3ob0SnzK3w3+fy5x7H3rJeNEcTx3pkc4k9eYfnnm5RnZFDpToAiVgfJENbFQiiQJ6h2CUxz8inhlcBcgaGEvJ930tkvWqnkDOPegEBuwFoJu/i9VV/wppIi3wO3Cp7eZ/FZyjRyg4I5TLTvDnZNoCO7sdOCtUQ9Ix+m2XRfgwUzSIsM3swOCbn+Y9U1PTcXkve+zonBbMLMW+6IYNL1ynCT0UuZUKmdVKWQVruweA3PV9JoIx4LT+icFQ== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=edk2.groups.io smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com]) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6JcVG7Fikpw5sAcFoKD6Ta9kxwe2jg4BB/JzTgjzHmM=; b=h+S9nirhBYxj6ZHKHFg+P3gMO3wjFMBrGtEd5UvmZ0AOWcTlmcQqIpd2xh8dNLacaE5s1K1wjgax3NqQNJMbXkJQRcFQZxCakOyMx7DHIQKlHelWqnJNG4CDMfeB44H1oRPNaDN4eQ2S1pQBgEpQV7Ms6TqA2oYolDK+DYKslQ0= Received: from AM6P195CA0052.EURP195.PROD.OUTLOOK.COM (2603:10a6:209:87::29) by AM8PR08MB6419.eurprd08.prod.outlook.com (2603:10a6:20b:316::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5769.21; Tue, 1 Nov 2022 11:42:16 +0000 Received: from AM7EUR03FT037.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:87:cafe::3c) by AM6P195CA0052.outlook.office365.com (2603:10a6:209:87::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5769.21 via Frontend Transport; Tue, 1 Nov 2022 11:42:16 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM7EUR03FT037.mail.protection.outlook.com (100.127.140.225) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5769.14 via Frontend Transport; Tue, 1 Nov 2022 11:42:16 +0000 Received: ("Tessian outbound 58faf9791229:v130"); Tue, 01 Nov 2022 11:42:16 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 1612c76475b5672b X-CR-MTA-TID: 64aa7808 Received: from c1376c08ac23.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 28A4C5B2-96AD-4576-B874-462E85A16C12.1; Tue, 01 Nov 2022 11:42:08 +0000 Received: from EUR02-AM0-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id c1376c08ac23.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 01 Nov 2022 11:42:08 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BFNTwsRPh/1R8se8+M69tC1tw4SeIYt1NzWJn5Xz9obiGLfFta+VKY/Ecweki/sAU+spgqDs7wUhXARfqgZ5RoSeZISKKKIlnUWuMLX4VMEr8bx06raaP06DJ4DWDEKyR+BmLSFl8c1U9xOzim6QJ4d2TLAOWm29XcwkVLye2ppLRQ1mPoUwgW1CZ+ku1o+CQFoD0/OwYXxZDAh9JyBnBACk/U0Id3uQ0RtxypWfz2aQZx1WEv0w0nkgP/cEg6nj4BMjZJga+B1CpzcLpHDwCkMGWUiOoMLtewcmqyZK6w3j8tnuQLE7FlHYikgMj+uLIcgkq4Co6ZtpZttwFvgjQw== 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=6JcVG7Fikpw5sAcFoKD6Ta9kxwe2jg4BB/JzTgjzHmM=; b=HzMrU+xgSuYm12rqcZXbocyzy7Lp8/OsqrL6GL3pSnOA2VoUDFCtxVpyYTJGIfRadqnX5nkeyuj517FnigbrSwC5FGc3iE6Q0diM6KROoJS44uVaJl3dv0VNzASKHb7iy+49X8lY6QS/UImvfSAH+b71j339E8sWR4k4JKceBkCMUs1+SQg9mZ7jSDKBFO3BszNHOxrMTI1B4pWQzPeOSDV8LZ5vihn24dkW4Sl2CcVb5PlxzB7KwZ42vtciiTYESnHWhnDPx0f7mFLVAIsaGnlWsTUcfB8SgHvd+zMIyX/9o/o50T9tsHjr8XxrWIolq353Pwhq1/EbaslBqn84GQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6JcVG7Fikpw5sAcFoKD6Ta9kxwe2jg4BB/JzTgjzHmM=; b=h+S9nirhBYxj6ZHKHFg+P3gMO3wjFMBrGtEd5UvmZ0AOWcTlmcQqIpd2xh8dNLacaE5s1K1wjgax3NqQNJMbXkJQRcFQZxCakOyMx7DHIQKlHelWqnJNG4CDMfeB44H1oRPNaDN4eQ2S1pQBgEpQV7Ms6TqA2oYolDK+DYKslQ0= Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; Received: from AS8PR08MB6806.eurprd08.prod.outlook.com (2603:10a6:20b:39b::12) by PA4PR08MB6237.eurprd08.prod.outlook.com (2603:10a6:102:f3::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5769.19; Tue, 1 Nov 2022 11:42:07 +0000 Received: from AS8PR08MB6806.eurprd08.prod.outlook.com ([fe80::283c:fe2e:699d:2bf]) by AS8PR08MB6806.eurprd08.prod.outlook.com ([fe80::283c:fe2e:699d:2bf%4]) with mapi id 15.20.5769.019; Tue, 1 Nov 2022 11:42:07 +0000 Message-ID: <675af89c-d213-2cd4-985d-505528c10eac@arm.com> Date: Tue, 1 Nov 2022 11:41:48 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.4.1 Subject: Re: [edk2-devel] [PATCH 2/2] ShellPkg/AcpiView: APMT Parser To: devel@edk2.groups.io, jbrasen@nvidia.com Cc: michael.d.kinney@intel.com, gaoliming@byosoft.com.cn, zhiguang.liu@intel.com, zhichao.gao@intel.com, ray.ni@intel.com, "nd@arm.com" References: <1dd062eed3bce95a7928fa41f8e3821897867b4c.1666881494.git.jbrasen@nvidia.com> <31328fbc79e80ba50d56f11e8e2870b4c41db0b8.1666881494.git.jbrasen@nvidia.com> From: "Sami Mujawar" In-Reply-To: <31328fbc79e80ba50d56f11e8e2870b4c41db0b8.1666881494.git.jbrasen@nvidia.com> X-ClientProxiedBy: LO4P123CA0602.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:295::16) To AS8PR08MB6806.eurprd08.prod.outlook.com (2603:10a6:20b:39b::12) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: AS8PR08MB6806:EE_|PA4PR08MB6237:EE_|AM7EUR03FT037:EE_|AM8PR08MB6419:EE_ X-MS-Office365-Filtering-Correlation-Id: c922c20f-c6e7-439e-7808-08dabbfe2062 X-LD-Processed: f34e5979-57d9-4aaa-ad4d-b122a662184d,ExtAddr x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: QVDXUy0CmMmfZ86WHVgADu18vQs09jVBYekQd+FEbK4bxptSvmjYI6ThiTUoNeq/sbvGSfZNEUTR3iljUHx20zKWm0kByWiBeV/aiEd5UllPEwvv/eZ8cV/IZ/aH3GkE2zEDUznXFhpAUtDowrari90A7yDwJawQlSpT+qwfABP1s3BgxoDKjl6YkZmprjJmQI8ljtQGA4iIKZ5k5uhtYFghHDynpkGEnCE9Cf0w5NHPI4nkFnbVktANeETMb1JM0F0ObyWDCffeoaol4iqIgQzap92MgJqtfFXHZWXh8ZNE8ayAt/mS6N9t18+Afxmy6ba3M/qetSKmwdd3rmxSrB2PMKzbtlzYosJNpvhUsb/YMpObqQDkOgFqnl46A5dDheUBrHC9Oj2VEbhQK7nb+rQJxzyPTPYXoYpH6jujTK5yQsUDfCSdbNRnuMLGctEqVd/rQBF4tc2M5Gn7nhHT7nEmEdrrK/fA+c+O4GfOUd0qd7RbC/1zgWfBVctLgB/VSusYbF7rBZSzkiRPt53TYXE3l3UgeGtBUDvRSlHvljNU/K+bxVsDdXxEF2ZfBfFL0fDCLICbz6KJj63ROKNdpA/1fLV+Y133VHD71bR5+gVXVCixw6CyS4JRGcv4JPHCBwUCK4RZyfTvFVzI2tLBA06aMq0TAN3x++vfrs4YVwxNysgEGzTJMZpaQtVDRhclRaDeAiKk/2ie2mERRWQXWa+O6ecxj5qR0JYVW15a5dI6TrDOVFg75Gv1vW1A4+tUq4VLME+/Iqj1R9dGHsHUEOTMKYMeQIV9cRztOZLh1MY= X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AS8PR08MB6806.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(396003)(136003)(366004)(376002)(39860400002)(346002)(451199015)(33964004)(2616005)(44832011)(186003)(8676002)(4326008)(66946007)(66556008)(66476007)(6512007)(6506007)(36756003)(5660300002)(6666004)(26005)(8936002)(19627235002)(316002)(86362001)(53546011)(41300700001)(30864003)(31696002)(6486002)(83380400001)(478600001)(38100700002)(2906002)(31686004)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB6237 Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; Return-Path: Sami.Mujawar@arm.com X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM7EUR03FT037.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: ba8e4dc0-375a-4993-e06b-08dabbfe1a7e X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nSJhJEK6n5E5LTHoGTMODm0HHlNcXt3KivhFvKlrvTtBkQD0U5agRNVge9id+/FNRtM+ZEpewOQ87qoLgy2sJDNyJTKTTbi4PJJC7o2lsDUJawQ7be1C3iBr8G2OD+GG8NNAm03nFonkIPhtjOLvF/tGXQFp6pfTkErCoPoIzJS7Qm2tYNxF3IZ/LjP8dCut5NOQW98zBLQuwMzP5H8b8lL0F5Q82+FFgdrPqwZscx3XZcloN9WxD8Qil4kMoScraHbJIeTvypJnfPldFjs/YiEKIOEQfcH2mKh7tr6i/K1UziJQbOBrKdkayCjOzTTN0BevIqDIJwCBBGxkqUS+Ryby0hHDteYk90TOsuWo1Tvtqdb131PiavHre8HzVRoidLVE1YTfXDWXQOkou6mV66oX9a9NEtddJuaq4EEHQKurOsmxJ2xmrV65EEQHLjQfyn79TbF1m71Hs+sodXV/X7Y4IjNcdu+KNX7ZxYuGjnAWIiIxIxJ+avnK9hbIAAzBBFeGoCfj87qHtGeDvyPtO/dZkdtIpsPwByj9CbmAzokIYGxyL1Nel01vtewWk4KU7onYpEEhQoZfdyTJ2rDVEOplJ4a0PoTnl1b49BlruqODgRWbSHEQyCyZy9p+17HtWT9Ijy7vl3vvYqveDIbKm7HKNAiFDURxTa6xWdaatb+CV2M7RiKIbX+0t/PeJoDVhiiLxYMvWu93x9O0bCtNplwtQa4BRompC2TEGZuU9Xinf/R1PAVEv9I4NqtnPUbrOJ4lpjxzwPzQMZEEk4QGpqz7J0Aonv4umkEtWIU2wkDyfJPccedRUcP6NlcuScTq X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(13230022)(4636009)(136003)(376002)(396003)(39860400002)(346002)(451199015)(36840700001)(40470700004)(46966006)(5660300002)(82740400003)(8936002)(6512007)(41300700001)(26005)(356005)(81166007)(36756003)(2906002)(186003)(40480700001)(83380400001)(47076005)(336012)(2616005)(44832011)(478600001)(30864003)(6486002)(36860700001)(316002)(31686004)(6506007)(40460700003)(33964004)(70586007)(4326008)(8676002)(70206006)(82310400005)(53546011)(19627235002)(86362001)(31696002)(6666004)(43740500002);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Nov 2022 11:42:16.4976 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c922c20f-c6e7-439e-7808-08dabbfe2062 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: AM7EUR03FT037.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR08MB6419 Content-Type: multipart/alternative; boundary="------------WMReF4DWLjG5er0dq0Tm0A6d" --------------WMReF4DWLjG5er0dq0Tm0A6d Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hi Jeff, I have two minor suggestions marked inline as [SAMI]. Other than those this patch looks good to me. With that updated, Reviewed-by: Sami Mujawar Regards, Sami Mujawar On 27/10/2022 03:40 pm, Jeff Brasen via groups.io wrote: > Add a new parser for the Arm Performance Monitoring Unit Table. > > The APMT table describes the properties of PMU support > > implemented by components in an Arm-based system. > > > > Signed-off-by: Jeff Brasen > > --- > > .../UefiShellAcpiViewCommandLib/AcpiParser.h | 21 ++++ > > .../Parsers/Apmt/ApmtParser.c | 105 ++++++++++++++++++ > > .../UefiShellAcpiViewCommandLib.c | 1 + > > .../UefiShellAcpiViewCommandLib.inf | 1 + > > 4 files changed, 128 insertions(+) > > create mode 100644 ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Apmt/ApmtParser.c > > > > diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h > > index db8c88f6df..6a1de4e12b 100644 > > --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h > > +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h > > @@ -531,6 +531,27 @@ ParseAcpiAest ( > > IN UINT8 AcpiTableRevision > > ); > > > > +/** > > + This function parses the ACPI APMT table. > > + When trace is enabled this function parses the APMT table and > > + traces the ACPI table fields. > > + > > + This function also performs validation of the ACPI table fields. > > + > > + @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 > > +ParseAcpiApmt ( > > + IN BOOLEAN Trace, > > + IN UINT8 *Ptr, > > + IN UINT32 AcpiTableLength, > > + IN UINT8 AcpiTableRevision > > + ); > > + > > /** > > This function parses the ACPI BGRT table. > > When trace is enabled this function parses the BGRT table and > > diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Apmt/ApmtParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Apmt/ApmtParser.c > > new file mode 100644 > > index 0000000000..b036cd12d3 > > --- /dev/null > > +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Apmt/ApmtParser.c > > @@ -0,0 +1,105 @@ > > +/** @file > > + APMT table parser > > + > > + Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved. > > + Copyright (c) 2017 - 2018, ARM Limited. All rights reserved. > > + SPDX-License-Identifier: BSD-2-Clause-Patent > > + > > + @par Reference(s): > > + - ACPI 6.2 Specification - Errata A, September 2017 > > +**/ > > + > > +#include > > +#include > > +#include > > +#include "AcpiParser.h" > > +#include "AcpiTableParser.h" > > + > > +// Local variables > > +STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; > > +STATIC CONST UINT16 *NodeLength; > > + > > +/** > > + An ACPI_PARSER array describing the ACPI APMT Table. > > +**/ > > +STATIC CONST ACPI_PARSER ApmtParser[] = { > > + PARSE_ACPI_HEADER (&AcpiHdrInfo) > > +}; > > + > > +/** > > + An ACPI_PARSER array describing the ACPI Arm PMU Node. > > +**/ > > +STATIC CONST ACPI_PARSER ArmPmuNodeParser[] = { > > + { L"Length", 2, 0, L"0x%x", NULL, (VOID **)&NodeLength, NULL, NULL }, > > + { L"Node flags", 1, 2, L"0x%x", NULL, NULL, NULL, NULL }, > > + { L"Node type", 1, 3, L"0x%x", NULL, NULL, NULL, NULL }, > > + { L"Identifier", 4, 4, L"0x%x", NULL, NULL, NULL, NULL }, > > + { L"Node Instance primary", 8, 8, L"0x%lx", NULL, NULL, NULL, NULL }, > > + { L"Node Instance secondary", 4, 16, L"0x%x", NULL, NULL, NULL, NULL }, > > + { L"Base address 0", 8, 20, L"0x%lx", NULL, NULL, NULL, NULL }, > > + { L"Base address 1", 8, 28, L"0x%lx", NULL, NULL, NULL, NULL }, > > + { L"Overflow interrupt", 4, 36, L"0x%x", NULL, NULL, NULL, NULL }, > > + { L"Reserved1", 4, 40, L"0x%x", NULL, NULL, NULL, NULL }, > > + { L"Overflow interrupt flags", 4, 44, L"0x%x", NULL, NULL, NULL, NULL }, > > + { L"Processor affinity", 4, 48, L"0x%x", NULL, NULL, NULL, NULL }, > > + { L"Implementation ID", 4, 52, L"0x%x", NULL, NULL, NULL, NULL } > > +}; > > + > > +/** > > + This function parses the ACPI APMT table. > > + When trace is enabled this function parses the APMT table and > > + traces the ACPI table fields. > > + > > + This function also performs validation of the ACPI table fields. > > + > > + @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 > > +ParseAcpiApmt ( > > + IN BOOLEAN Trace, > > + IN UINT8 *Ptr, > > + IN UINT32 AcpiTableLength, > > + IN UINT8 AcpiTableRevision > > + ) > > +{ > > + UINT32 Offset; > > + > > + if (!Trace) { > > + return; > > + } > > + > > + ParseAcpi ( > > + Trace, > > + 0, > > + "APMT", > > + Ptr, > > + AcpiTableLength, > > + PARSER_PARAMS (ApmtParser) > > + ); > > + Offset = sizeof (EFI_ACPI_DESCRIPTION_HEADER); > > + > > + while (Offset < AcpiTableLength) { > > + ParseAcpi ( > > + Trace, > > + 2, > > + "Arm PMU node", > > + Ptr + Offset, > > + (AcpiTableLength - Offset), > > + PARSER_PARAMS (ArmPmuNodeParser) > > + ); > > + if (NodeLength == NULL) { [SAMI] I think it will be good to increment the error count by calling'IncrementErrorCount ()'. > > + Print ( > > + L"ERROR: Insufficient remaining table buffer length to read the " \ > > + L"Node structure. Length = %d.\n", > > + (AcpiTableLength - Offset) > > + ); > > + break; > > + } > > + > > + Offset += *NodeLength; > > + } > > +} > > diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.c > > index 09bdddb56e..53f06fc757 100644 > > --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.c > > +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.c > > @@ -48,6 +48,7 @@ STATIC > > CONST > > ACPI_TABLE_PARSER ParserList[] = { > > { EFI_ACPI_6_3_ARM_ERROR_SOURCE_TABLE_SIGNATURE, ParseAcpiAest }, > > + { EFI_ACPI_6_4_ARM_PERFORMANCE_MONITORING_UNIT_TABLE_SIGNATURE, ParseAcpiApmt }, > > { EFI_ACPI_6_2_BOOT_GRAPHICS_RESOURCE_TABLE_SIGNATURE, ParseAcpiBgrt }, > > { EFI_ACPI_6_2_DEBUG_PORT_2_TABLE_SIGNATURE, ParseAcpiDbg2 }, > > { EFI_ACPI_6_2_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE, > > diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.inf b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.inf > > index 63fc5a1281..b03ec1a31b 100644 > > --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.inf > > +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.inf > > @@ -28,6 +28,7 @@ > > AcpiViewConfig.c > > AcpiViewConfig.h > > Parsers/Aest/AestParser.c > > + Parsers/Apmt/ApmtParser.c [SAMI] I think it would be good to update the STR_GET_HELP_ACPIVIEW text in ShellPkg\Library\UefiShellAcpiViewCommandLib\UefiShellAcpiViewCommandLib.uni to add APMT as a supported parser. [/SAMI] > > Parsers/Bgrt/BgrtParser.c > > Parsers/Dbg2/Dbg2Parser.c > > Parsers/Dsdt/DsdtParser.c > --------------WMReF4DWLjG5er0dq0Tm0A6d Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit

Hi Jeff,

I have two minor suggestions marked inline as [SAMI].

Other than those this patch looks good to me.

With that updated,

Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>

Regards,

Sami Mujawar

On 27/10/2022 03:40 pm, Jeff Brasen via groups.io wrote:
Add a new parser for the Arm Performance Monitoring Unit Table.

The APMT table describes the properties of PMU support

implemented by components in an Arm-based system.



Signed-off-by: Jeff Brasen <jbrasen@nvidia.com>

---

 .../UefiShellAcpiViewCommandLib/AcpiParser.h  |  21 ++++

 .../Parsers/Apmt/ApmtParser.c                 | 105 ++++++++++++++++++

 .../UefiShellAcpiViewCommandLib.c             |   1 +

 .../UefiShellAcpiViewCommandLib.inf           |   1 +

 4 files changed, 128 insertions(+)

 create mode 100644 ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Apmt/ApmtParser.c



diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h

index db8c88f6df..6a1de4e12b 100644

--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h

+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h

@@ -531,6 +531,27 @@ ParseAcpiAest (

   IN UINT8    AcpiTableRevision

   );

 

+/**

+  This function parses the ACPI APMT table.

+  When trace is enabled this function parses the APMT table and

+  traces the ACPI table fields.

+

+  This function also performs validation of the ACPI table fields.

+

+  @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

+ParseAcpiApmt (

+  IN BOOLEAN  Trace,

+  IN UINT8    *Ptr,

+  IN UINT32   AcpiTableLength,

+  IN UINT8    AcpiTableRevision

+  );

+

 /**

   This function parses the ACPI BGRT table.

   When trace is enabled this function parses the BGRT table and

diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Apmt/ApmtParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Apmt/ApmtParser.c

new file mode 100644

index 0000000000..b036cd12d3

--- /dev/null

+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Apmt/ApmtParser.c

@@ -0,0 +1,105 @@

+/** @file

+  APMT table parser

+

+  Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.

+  Copyright (c) 2017 - 2018, ARM Limited. All rights reserved.

+  SPDX-License-Identifier: BSD-2-Clause-Patent

+

+  @par Reference(s):

+    - ACPI 6.2 Specification - Errata A, September 2017

+**/

+

+#include <IndustryStandard/Acpi.h>

+#include <IndustryStandard/ArmPerformanceMonitoringUnitTable.h>

+#include <Library/UefiLib.h>

+#include "AcpiParser.h"

+#include "AcpiTableParser.h"

+

+// Local variables

+STATIC ACPI_DESCRIPTION_HEADER_INFO  AcpiHdrInfo;

+STATIC CONST UINT16                  *NodeLength;

+

+/**

+  An ACPI_PARSER array describing the ACPI APMT Table.

+**/

+STATIC CONST ACPI_PARSER  ApmtParser[] = {

+  PARSE_ACPI_HEADER (&AcpiHdrInfo)

+};

+

+/**

+  An ACPI_PARSER array describing the ACPI Arm PMU Node.

+**/

+STATIC CONST ACPI_PARSER  ArmPmuNodeParser[] = {

+  { L"Length",                   2, 0,  L"0x%x",  NULL, (VOID **)&NodeLength, NULL, NULL },

+  { L"Node flags",               1, 2,  L"0x%x",  NULL, NULL,                 NULL, NULL },

+  { L"Node type",                1, 3,  L"0x%x",  NULL, NULL,                 NULL, NULL },

+  { L"Identifier",               4, 4,  L"0x%x",  NULL, NULL,                 NULL, NULL },

+  { L"Node Instance primary",    8, 8,  L"0x%lx", NULL, NULL,                 NULL, NULL },

+  { L"Node Instance secondary",  4, 16, L"0x%x",  NULL, NULL,                 NULL, NULL },

+  { L"Base address 0",           8, 20, L"0x%lx", NULL, NULL,                 NULL, NULL },

+  { L"Base address 1",           8, 28, L"0x%lx", NULL, NULL,                 NULL, NULL },

+  { L"Overflow interrupt",       4, 36, L"0x%x",  NULL, NULL,                 NULL, NULL },

+  { L"Reserved1",                4, 40, L"0x%x",  NULL, NULL,                 NULL, NULL },

+  { L"Overflow interrupt flags", 4, 44, L"0x%x",  NULL, NULL,                 NULL, NULL },

+  { L"Processor affinity",       4, 48, L"0x%x",  NULL, NULL,                 NULL, NULL },

+  { L"Implementation ID",        4, 52, L"0x%x",  NULL, NULL,                 NULL, NULL }

+};

+

+/**

+  This function parses the ACPI APMT table.

+  When trace is enabled this function parses the APMT table and

+  traces the ACPI table fields.

+

+  This function also performs validation of the ACPI table fields.

+

+  @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

+ParseAcpiApmt (

+  IN BOOLEAN  Trace,

+  IN UINT8    *Ptr,

+  IN UINT32   AcpiTableLength,

+  IN UINT8    AcpiTableRevision

+  )

+{

+  UINT32  Offset;

+

+  if (!Trace) {

+    return;

+  }

+

+  ParseAcpi (

+    Trace,

+    0,

+    "APMT",

+    Ptr,

+    AcpiTableLength,

+    PARSER_PARAMS (ApmtParser)

+    );

+  Offset = sizeof (EFI_ACPI_DESCRIPTION_HEADER);

+

+  while (Offset < AcpiTableLength) {

+    ParseAcpi (

+      Trace,

+      2,

+      "Arm PMU node",

+      Ptr + Offset,

+      (AcpiTableLength - Offset),

+      PARSER_PARAMS (ArmPmuNodeParser)

+      );

+    if (NodeLength == NULL) {
[SAMI] I think it will be good to increment the error count by calling 'IncrementErrorCount ()'.

+      Print (

+        L"ERROR: Insufficient remaining table buffer length to read the " \

+        L"Node structure. Length = %d.\n",

+        (AcpiTableLength - Offset)

+        );

+      break;

+    }

+

+    Offset += *NodeLength;

+  }

+}

diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.c

index 09bdddb56e..53f06fc757 100644

--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.c

+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.c

@@ -48,6 +48,7 @@ STATIC

 CONST

 ACPI_TABLE_PARSER  ParserList[] = {

   { EFI_ACPI_6_3_ARM_ERROR_SOURCE_TABLE_SIGNATURE,                                                       ParseAcpiAest },

+  { EFI_ACPI_6_4_ARM_PERFORMANCE_MONITORING_UNIT_TABLE_SIGNATURE,                                        ParseAcpiApmt },

   { EFI_ACPI_6_2_BOOT_GRAPHICS_RESOURCE_TABLE_SIGNATURE,                                                 ParseAcpiBgrt },

   { EFI_ACPI_6_2_DEBUG_PORT_2_TABLE_SIGNATURE,                                                           ParseAcpiDbg2 },

   { EFI_ACPI_6_2_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE,

diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.inf b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.inf

index 63fc5a1281..b03ec1a31b 100644

--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.inf

+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.inf

@@ -28,6 +28,7 @@

   AcpiViewConfig.c

   AcpiViewConfig.h

   Parsers/Aest/AestParser.c

+  Parsers/Apmt/ApmtParser.c

[SAMI] I think it would be good to update the STR_GET_HELP_ACPIVIEW text in ShellPkg\Library\UefiShellAcpiViewCommandLib\UefiShellAcpiViewCommandLib.uni to add APMT as a supported parser.

[/SAMI]


   Parsers/Bgrt/BgrtParser.c

   Parsers/Dbg2/Dbg2Parser.c

   Parsers/Dsdt/DsdtParser.c

--------------WMReF4DWLjG5er0dq0Tm0A6d--