From nobody Fri May 3 21:06:58 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+65563+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1600948174888885.8672005930225; Thu, 24 Sep 2020 04:49:34 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id EpBFYY1788612xPThYVOcrva; Thu, 24 Sep 2020 04:49:34 -0700 X-Received: from EUR05-AM6-obe.outbound.protection.outlook.com (EUR05-AM6-obe.outbound.protection.outlook.com [40.107.22.81]) by mx.groups.io with SMTP id smtpd.web11.14912.1600948173442776236 for ; Thu, 24 Sep 2020 04:49:33 -0700 X-Received: from MR2P264CA0132.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500:30::24) by AM5PR0801MB2019.eurprd08.prod.outlook.com (2603:10a6:203:4b::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.22; Thu, 24 Sep 2020 11:49:29 +0000 X-Received: from VE1EUR03FT029.eop-EUR03.prod.protection.outlook.com (2603:10a6:500:30:cafe::e8) by MR2P264CA0132.outlook.office365.com (2603:10a6:500:30::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.20 via Frontend Transport; Thu, 24 Sep 2020 11:49:29 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; edk2.groups.io; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;edk2.groups.io; dmarc=bestguesspass action=none header.from=arm.com; Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+65563+1787277+3901457@groups.io; helo=web01.groups.io; 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; X-Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT029.mail.protection.outlook.com (10.152.18.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.21 via Frontend Transport; Thu, 24 Sep 2020 11:49:29 +0000 X-Received: ("Tessian outbound e8cdb8c6f386:v64"); Thu, 24 Sep 2020 11:49:29 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: aef70be743a308e2 X-CR-MTA-TID: 64aa7808 X-Received: from e12be6cdff8b.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id EF7B940B-3A78-4C91-A252-3824CECA940E.1; Thu, 24 Sep 2020 11:49:19 +0000 X-Received: from EUR01-DB5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id e12be6cdff8b.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 24 Sep 2020 11:49:19 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Phxa2sQl5Rjq4hFH604ZqlKbuvkS9lwRo8eWogs5Qz5SBzfzPyEZiUbxA29oTnyi+8pMHhlc3J8yqwUqTmV+Jj671Bhnw5HT5c9PyJSG+xA56oO/yPkWYZAZSPYt9OZcXvKh/dK0z74nByIvB+MgbL4UpTZB6LE/vkag6o8QKJX9lx7Ty49hRLvYrcjGQycSv6h+UBK/cQDpcKVRDnr5vENiEg7TahSpaSXNKXwUWUJUo1Zd8EAlyN5e+hI9+OhVyZQYgocSkh0eb8RCVqzaWfE03i7nBWxAeMRxkcid2o82Jih/rFvXdva04YlKW8XCGYxJeIPsclQi/VDW8XjBtw== 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-SenderADCheck; bh=0fiDFRLGQY9tDn1vDxVMdAy4Ns/uUfcnrYqkp2OqhO4=; b=EpqfsKR4sZ9AKLTiRUGblRhU+0AUIRfuzPvGInEZ4N3D6YM/mAHl0m1OhPHHMeUn4LJV/6GDJ7+WiSGe31dU16a27ehldgD2zDSGfQu36JLVBXVYn5bMJi65YanHiRoHEkYoZkdSHaQl77i/6rkZzP3uhroL7Q4GLltmg36AH9dIyKjebhEeSZhICKXeWlJjL+Xv1lsKowxujTW3Kf73j+rChDSQKzF6JktauYMvNQ4h8c4bGc1qQUYw0BXiiNH2/5jTwcflXCUaO1j2MhUKT9i1Hn4SobsFXkLpm1ayK7hOf/fQ7bpPIeMD2IrUUdPGTHBDRsafhyttqvXEo7Rp4A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=edk2.groups.io smtp.mailfrom=arm.com; dmarc=bestguesspass action=none header.from=arm.com; dkim=none (message not signed); arc=none X-Received: from AM7PR04CA0003.eurprd04.prod.outlook.com (2603:10a6:20b:110::13) by AM6PR08MB4951.eurprd08.prod.outlook.com (2603:10a6:20b:eb::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3391.19; Thu, 24 Sep 2020 11:49:17 +0000 X-Received: from AM5EUR03FT022.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:110:cafe::c0) by AM7PR04CA0003.outlook.office365.com (2603:10a6:20b:110::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.23 via Frontend Transport; Thu, 24 Sep 2020 11:49:17 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=bestguesspass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; X-Received: from nebula.arm.com (40.67.248.234) by AM5EUR03FT022.mail.protection.outlook.com (10.152.16.79) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3412.21 via Frontend Transport; Thu, 24 Sep 2020 11:49:17 +0000 X-Received: from AZ-NEU-EX01.Emea.Arm.com (10.251.26.4) by AZ-NEU-EX04.Arm.com (10.251.24.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2044.4; Thu, 24 Sep 2020 11:49:16 +0000 X-Received: from AZ-NEU-EX03.Arm.com (10.251.24.31) by AZ-NEU-EX01.Emea.Arm.com (10.251.26.4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1779.2; Thu, 24 Sep 2020 11:49:14 +0000 X-Received: from E107187.Arm.com (10.57.53.17) by mail.arm.com (10.251.24.31) with Microsoft SMTP Server id 15.1.2044.4 via Frontend Transport; Thu, 24 Sep 2020 11:49:14 +0000 From: "Sami Mujawar" To: CC: Sami Mujawar , , , , , Subject: [edk2-devel] [PATCH v2 1/2] ShellPkg/AcpiView: PCCT Parser Date: Thu, 24 Sep 2020 12:49:12 +0100 Message-ID: <20200924114913.109188-2-sami.mujawar@arm.com> In-Reply-To: <20200924114913.109188-1-sami.mujawar@arm.com> References: <20200924114913.109188-1-sami.mujawar@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9a14f3bc-9dfa-4f15-3ae3-08d8607fe51f X-MS-TrafficTypeDiagnostic: AM6PR08MB4951:|AM5PR0801MB2019: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:10000;OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: Msno8j4WXDCx5A4/h78IXWsPM7S2/oIaKsxmEUzkI7nj/ntDQSOzYJp4E7UZzLbX/rf97FvQZAg0/zmAPNrax7i5lz88T9hRu3BehZpR5NKakH9S5ADJl8hfvD7MGdQmHqrrEzgvKq2Do0d5eSQ7i2JTL1p0Fm2BRlTvzt4merbv2gKe/a3fYk1fTcI0KVsnxVCyfxaLMTNaAk0h96UtvyeLt5V/ML3tvb1CnMVIG4IDpIYnhEyf8XT7xGn5eQWOxKor6gWimIvEyDm2fGQI6BHy55492wGBTFonn0SY0BcastXt0sS99VCHVavn8tTBQMBqBgW2G96D9qDWaxXO4iXwRtd++LP/O4E+8ucdJ/hidf5bYT0/swZdUVBzzCQCmi04CuZt89F2aJ5e7KahRQ== X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(4636009)(39850400004)(376002)(396003)(136003)(346002)(46966005)(6916009)(44832011)(8676002)(356005)(7696005)(5660300002)(30864003)(8936002)(2906002)(426003)(1076003)(336012)(86362001)(19627235002)(316002)(82740400003)(47076004)(81166007)(4326008)(70206006)(478600001)(70586007)(26005)(186003)(2616005)(82310400003)(54906003)(83380400001)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB4951 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT029.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: ed33b41a-d2a2-4c45-4410-08d8607fddfb X-Microsoft-Antispam-Message-Info: BtL43Ho0l51pTzrVL9bmxIY7VrDOgEjzdSl2SnLBZXFNGfJ7JzWqNLrNxMx6SP93xKiJX6OT8prbakRGDXFkrNEF9Kc8oEPB4TW44cNJb3OIt3kQWYL5M5BuHNmn8k6QhfeRD56z8Zd1KE1Roo+uMpMMphjyyvK2go7+lHrF+tVIfKk7AxtxvP6L8FHiJdc/dl5yGY6tBnfyNvcMOoudGDDUNvZLgaGJe93rFTy8uj/mkrFoXYKEJ38+fZNdr4wojJXVhHT1aakXniAVd/RfqGlf7pgZYsWE0nGDloHFI0BCb+nl+FIQe3wgD4XWWycSDIf0lj7mbPDcmxRKMnkIVI9m5W8JiLuCe3ayH6wBoLzhzEFT5aYutojdh9JQIeBXywloG45Z1YpAljNePZbkDA== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Sep 2020 11:49:29.2528 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9a14f3bc-9dfa-4f15-3ae3-08d8607fe51f 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: VE1EUR03FT029.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0801MB2019 Precedence: Bulk List-Unsubscribe: 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,sami.mujawar@arm.com X-Gm-Message-State: zOoTYVlyuLlobTk22IjXBVOdx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1600948174; bh=R857fax2G0RbF/etbvv43cNcgf3SBsl5v7UbD5pSNnY=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=ethUG5H9L4yDc+StKm9sK0At4WZtY9O1s6xtQ04tIn0uhbg0iegYwuZoG0iUPIajucz OVLtGx4p0AEZihlYR8AEnZNJbGmUfMXs18FJlEntakCkNn9P4aGBOQviY27qYQXjh6vkq JWqPEmaZEoox4NKnbdDVsdHrZpr7B41NqLA= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Marc Moisson-Franckhauser Create a new parser for the PCCT Table. The PCCT Table is used to describe how the OSPM can communicate with entities outside the platform. It describes which memory spaces correspond to which entity as well as a few of the needed information to handle the communications. This new PCCT parser dumps the values and names of the table fields. It also performs some validation on the table's fields. Signed-off-by: Marc Moisson-Franckhauser Signed-off-by: Sami Mujawar --- Notes: v2: - Addressed review comments by adding validation functions [SAMI] for Doorbell, Interrupt Ack and Error Status GAS fields. Also added validation to check if the global platform interrupt flag is set for type 4 structure. ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h = | 24 +- ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.h = | 4 +- ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pcct/PcctParser.c = | 615 ++++++++++++++++++++ ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pcct/PcctParser.h = | 33 ++ ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.c= | 4 +- ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.i= nf | 4 +- 6 files changed, 679 insertions(+), 5 deletions(-) diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h b/Sh= ellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h index f81ccac7e118378aa185db4b625e5bcd75f78347..051fdf807abb1067a264c136364= bb6d145b38dab 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h @@ -1,7 +1,7 @@ /** @file Header file for ACPI parser =20 - Copyright (c) 2016 - 2020, ARM Limited. All rights reserved. + Copyright (c) 2016 - 2020, Arm Limited. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent **/ =20 @@ -671,6 +671,28 @@ ParseAcpiMcfg ( ); =20 /** + This function parses the ACPI PCCT table including its sub-structures + of type 0 through 4. + When trace is enabled this function parses the PCCT 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 +ParseAcpiPcct ( + IN BOOLEAN Trace, + IN UINT8* Ptr, + IN UINT32 AcpiTableLength, + IN UINT8 AcpiTableRevision + ); + +/** This function parses the ACPI PPTT table. When trace is enabled this function parses the PPTT table and traces the ACPI table fields. diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.h= b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.h index 4f92596b90a6ee422d8d0959881015ffd3de4da0..0ebf79fb653ae3a8190273aee45= 2723c6213eb58 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.h +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.h @@ -1,7 +1,7 @@ /** @file Header file for ACPI table parser =20 - Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. + Copyright (c) 2016 - 2020, Arm Limited. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent **/ =20 @@ -11,7 +11,7 @@ /** The maximum number of ACPI table parsers. */ -#define MAX_ACPI_TABLE_PARSERS 16 +#define MAX_ACPI_TABLE_PARSERS 32 =20 /** An invalid/NULL signature value. */ diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pcct/Pcct= Parser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pcct/PcctPa= rser.c new file mode 100644 index 0000000000000000000000000000000000000000..ca553d5953f05651d8df4c95d1e= 39a73eded5129 --- /dev/null +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pcct/PcctParser.c @@ -0,0 +1,615 @@ +/** @file + PCCT table parser + + Copyright (c) 2020, Arm Limited. + SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Reference(s): + - ACPI 6.3 Specification - January 2019 +**/ + +#include +#include +#include +#include "AcpiParser.h" +#include "AcpiView.h" +#include "AcpiViewConfig.h" +#include "PcctParser.h" + +// Local variables +STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; + +STATIC UINT32* PccGlobalFlags; +STATIC UINT8* PccSubspaceLength; +STATIC UINT8* PccSubspaceType; +STATIC UINT8* ExtendedPccSubspaceInterruptFlags; + +/** + This function validates the length coded on 4 bytes of a shared memory r= ange + + @param [in] Ptr Pointer to the start of the field data. + @param [in] Context Pointer to context specific information e.g. this + could be a pointer to the ACPI table header. +**/ +STATIC +VOID +EFIAPI +ValidateRangeLength4 ( + IN UINT8* Ptr, + IN VOID* Context + ) +{ + if (*(UINT32*)Ptr < MIN_EXT_PCC_SUBSPACE_MEM_RANGE_LEN) { + IncrementErrorCount (); + Print ( + L"\nError: Shared memory range length is too short.\n" + L"Length is %u when it should be greater than or equal to %u", + *(UINT32*)Ptr, + MIN_EXT_PCC_SUBSPACE_MEM_RANGE_LEN + ); + } +} + +/** + This function validates the length coded on 8 bytes of a shared memory r= ange + + @param [in] Ptr Pointer to the start of the field data. + @param [in] Context Pointer to context specific information e.g. this + could be a pointer to the ACPI table header. +**/ +STATIC +VOID +EFIAPI +ValidateRangeLength8 ( + IN UINT8* Ptr, + IN VOID* Context + ) +{ + if (*(UINT64*)Ptr <=3D MIN_MEMORY_RANGE_LENGTH) { + IncrementErrorCount (); + Print ( + L"\nError: Shared memory range length is too short.\n" + L"Length is %u when it should be greater than %u", + *(UINT64*)Ptr, + MIN_MEMORY_RANGE_LENGTH + ); + } +} + +/** + This function validates address space for type 0 structure. + + @param [in] Ptr Pointer to the start of the field data. + @param [in] Context Pointer to context specific information e.g. this + could be a pointer to the ACPI table header. +**/ +STATIC +VOID +EFIAPI +ValidatePccType0Gas ( + IN UINT8* Ptr, + IN VOID* Context + ) +{ + switch (*(UINT8*)Ptr) { +#if !(defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)) + case EFI_ACPI_6_3_SYSTEM_IO: +#endif //if not (defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)) + case EFI_ACPI_6_3_SYSTEM_MEMORY: + return; + default: + IncrementErrorCount (); + Print (L"\nError: Invalid address space"); + } +} + +/** + This function validates address space for structures of types other than= 0. + + @param [in] Ptr Pointer to the start of the field data. + @param [in] Context Pointer to context specific information e.g. this + could be a pointer to the ACPI table header. +**/ +STATIC +VOID +EFIAPI +ValidatePccGas ( + IN UINT8* Ptr, + IN VOID* Context + ) +{ + switch (*(UINT8*)Ptr) { +#if !(defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)) + case EFI_ACPI_6_3_SYSTEM_IO: +#endif //if not (defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)) + case EFI_ACPI_6_3_FUNCTIONAL_FIXED_HARDWARE: + case EFI_ACPI_6_3_SYSTEM_MEMORY: + return; + default: + IncrementErrorCount (); + Print (L"\nError: Invalid address space"); + } +} + +/** + This function validates doorbell address space for type 4 structure. + + @param [in] Ptr Pointer to the start of the field data. + @param [in] Context Pointer to context specific information e.g. this + could be a pointer to the ACPI table header. +**/ +STATIC +VOID +EFIAPI +ValidatePccDoorbellGas ( + IN UINT8* Ptr, + IN VOID* Context + ) +{ + // For slave subspaces this field is optional, if not present the field + // should just contain zeros. + if (*PccSubspaceType =3D=3D EFI_ACPI_6_3_PCCT_SUBSPACE_TYPE_4_EXTENDED_P= CC) { + if (IsZeroBuffer ( + Ptr, + sizeof (EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE) + )) { + return; + } + } + + ValidatePccGas (Ptr, Context); +} + +/** + This function validates interrupt acknowledge address space for + type 4 structure. + + @param [in] Ptr Pointer to the start of the field data. + @param [in] Context Pointer to context specific information e.g. this + could be a pointer to the ACPI table header. +**/ +STATIC +VOID +EFIAPI +ValidatePccIntAckGas ( + IN UINT8* Ptr, + IN VOID* Context + ) +{ + // If the subspace does not support interrupts or the interrupt is + // edge driven the register may be omitted. A value of 0x0 on all + // 12 bytes of the GAS structure indicates the register is not + // present. + if (((*PccGlobalFlags & EFI_ACPI_6_3_PCCT_FLAGS_PLATFORM_INTERRUPT) !=3D + EFI_ACPI_6_3_PCCT_FLAGS_PLATFORM_INTERRUPT) || + ((*ExtendedPccSubspaceInterruptFlags & + EFI_ACPI_6_3_PCCT_SUBSPACE_PLATFORM_INTERRUPT_FLAGS_MODE) =3D=3D + EFI_ACPI_6_3_PCCT_SUBSPACE_PLATFORM_INTERRUPT_FLAGS_MODE)) { + if (IsZeroBuffer ( + Ptr, + sizeof (EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE) + )) { + return; + } + } + + ValidatePccGas (Ptr, Context); +} + +/** + This function validates error status address space for type 4 structure. + + @param [in] Ptr Pointer to the start of the field data. + @param [in] Context Pointer to context specific information e.g. this + could be a pointer to the ACPI table header. +**/ +STATIC +VOID +EFIAPI +ValidatePccErrStatusGas ( + IN UINT8* Ptr, + IN VOID* Context + ) +{ + // This field is ignored by the OSPM on slave channels. + if (*PccSubspaceType =3D=3D EFI_ACPI_6_3_PCCT_SUBSPACE_TYPE_4_EXTENDED_P= CC) { + return; + } + + ValidatePccGas (Ptr, Context); +} + +/** + This function validates platform interrupt flags for type 4 structure. + + @param [in] Ptr Pointer to the start of the field data. + @param [in] Context Pointer to context specific information e.g. this + could be a pointer to the ACPI table header. +**/ +STATIC +VOID +EFIAPI +ValidatePlatInterrupt ( + IN UINT8* Ptr, + IN VOID* Context + ) +{ + // If a slave subspace is present in the PCCT, then the global Platform + // Interrupt flag must be set to 1. + if ((*PccSubspaceType =3D=3D EFI_ACPI_6_3_PCCT_SUBSPACE_TYPE_4_EXTENDED_= PCC) && + ((*PccGlobalFlags & EFI_ACPI_6_3_PCCT_FLAGS_PLATFORM_INTERRUPT) !=3D + EFI_ACPI_6_3_PCCT_FLAGS_PLATFORM_INTERRUPT)) { + IncrementErrorCount (); + Print ( + L"\nError: Global Platform interrupt flag must be set to 1" \ + L" if a PCC type 4 structure is present in PCCT." + ); + } +} + +/** + An ACPI_PARSER array describing the ACPI PCCT Table. +*/ +STATIC CONST ACPI_PARSER PcctParser[] =3D { + PARSE_ACPI_HEADER (&AcpiHdrInfo), + {L"Flags", 4, 36, NULL, NULL, (VOID**)&PccGlobalFlags, NULL, NULL}, + {L"Reserved", 8, 40, NULL, NULL, NULL, NULL, NULL} +}; + +/** + An ACPI_PARSER array describing the platform communications channel subs= pace + structure header. +*/ +STATIC CONST ACPI_PARSER PccSubspaceHeaderParser[] =3D { + PCC_SUBSPACE_HEADER () + // ... Type Specific Fields ... +}; + +/** + An ACPI_PARSER array describing the Generic Communications Subspace - Ty= pe 0 +*/ +STATIC CONST ACPI_PARSER PccSubspaceType0Parser[] =3D { + PCC_SUBSPACE_HEADER (), + {L"Reserved", 6, 2, L"%x %x %x %x %x %x", Dump6Chars, NULL, NULL, NULL}, + {L"Base Address", 8, 8, L"0x%lx", NULL, NULL, NULL, NULL}, + {L"Memory Range Length", 8, 16, L"0x%lx", NULL, NULL, ValidateRangeLengt= h8, + NULL}, + {L"Doorbell Register", 12, 24, NULL, DumpGas, NULL, ValidatePccType0Gas, + NULL}, + {L"Doorbell Preserve", 8, 36, L"0x%lx", NULL, NULL, NULL, NULL}, + {L"Doorbell Write", 8, 44, L"0x%lx", NULL, NULL, NULL, NULL}, + {L"Nominal Latency", 4, 52, L"%u", NULL, NULL, NULL, NULL}, + {L"Maximum Periodic Access Rate", 4, 56, L"%u", NULL, NULL, NULL, NULL}, + {L"Minimum Request Turnaround Time", 2, 60, L"%u", NULL, NULL, NULL, NUL= L} +}; + +/** + An ACPI_PARSER array describing the HW-Reduced Communications Subspace + - Type 1 +*/ +STATIC CONST ACPI_PARSER PccSubspaceType1Parser[] =3D { + PCC_SUBSPACE_HEADER (), + {L"Platform Interrupt", 4, 2, L"0x%x", NULL, NULL, NULL, NULL}, + {L"Platform Interrupt Flags", 1, 6, L"0x%x", NULL, NULL, NULL, NULL}, + {L"Reserved", 1, 7, L"0x%x", NULL, NULL, NULL, NULL}, + {L"Base Address", 8, 8, L"0x%lx", NULL, NULL, NULL, NULL}, + {L"Memory Range Length", 8, 16, L"0x%lx", NULL, NULL, ValidateRangeLengt= h8, + NULL}, + {L"Doorbell Register", 12, 24, NULL, DumpGas, NULL, + ValidatePccGas, NULL}, + {L"Doorbell Preserve", 8, 36, L"0x%lx", NULL, NULL, NULL, NULL}, + {L"Doorbell Write", 8, 44, L"0x%lx", NULL, NULL, NULL, NULL}, + {L"Nominal Latency", 4, 52, L"%u", NULL, NULL, NULL, NULL}, + {L"Maximum Periodic Access Rate", 4, 56, L"%u", NULL, NULL, NULL, NULL}, + {L"Minimum Request Turnaround Time", 2, 60, L"%u", NULL, NULL, NULL, NUL= L} +}; + +/** + An ACPI_PARSER array describing the HW-Reduced Communications Subspace + - Type 2 +*/ +STATIC CONST ACPI_PARSER PccSubspaceType2Parser[] =3D { + PCC_SUBSPACE_HEADER (), + {L"Platform Interrupt", 4, 2, L"0x%x", NULL, NULL, NULL, NULL}, + {L"Platform Interrupt Flags", 1, 6, L"0x%x", NULL, NULL, NULL, NULL}, + {L"Reserved", 1, 7, L"0x%x", NULL, NULL, NULL, NULL}, + {L"Base Address", 8, 8, L"0x%lx", NULL, NULL, NULL, NULL}, + {L"Memory Range Length", 8, 16, L"0x%lx", NULL, NULL, ValidateRangeLengt= h8, + NULL}, + {L"Doorbell Register", 12, 24, NULL, DumpGas, NULL, + ValidatePccGas, NULL}, + {L"Doorbell Preserve", 8, 36, L"0x%lx", NULL, NULL, NULL, NULL}, + {L"Doorbell Write", 8, 44, L"0x%lx", NULL, NULL, NULL, NULL}, + {L"Nominal Latency", 4, 52, L"%u", NULL, NULL, NULL, NULL}, + {L"Maximum Periodic Access Rate", 4, 56, L"%u", NULL, NULL, NULL, NULL}, + {L"Minimum Request Turnaround Time", 2, 60, L"%u", NULL, NULL, NULL, NUL= L}, + {L"Platform Interrupt Ack Register", 12, 62, NULL, DumpGas, NULL, + ValidatePccGas, NULL}, + {L"Platform Interrupt Ack Preserve", 8, 74, L"0x%lx", NULL, NULL, NULL, = NULL}, + {L"Platform Interrupt Ack Write", 8, 82, L"0x%lx", NULL, NULL, + NULL, NULL}, +}; + +/** + An ACPI_PARSER array describing the Extended PCC Subspaces - Type 3/4 +*/ +STATIC CONST ACPI_PARSER PccSubspaceType3Parser[] =3D { + PCC_SUBSPACE_HEADER (), + {L"Platform Interrupt", 4, 2, L"0x%x", NULL, NULL, + ValidatePlatInterrupt, NULL}, + {L"Platform Interrupt Flags", 1, 6, L"0x%x", NULL, + (VOID**)&ExtendedPccSubspaceInterruptFlags, NULL, NULL}, + {L"Reserved", 1, 7, L"0x%x", NULL, NULL, NULL, NULL}, + {L"Base Address", 8, 8, L"0x%lx", NULL, NULL, NULL, NULL}, + {L"Memory Range Length", 4, 16, L"0x%x", NULL, NULL, ValidateRangeLength= 4, + NULL}, + {L"Doorbell Register", 12, 20, NULL, DumpGas, NULL, + ValidatePccDoorbellGas, NULL}, + {L"Doorbell Preserve", 8, 32, L"0x%lx", NULL, NULL, NULL, NULL}, + {L"Doorbell Write", 8, 40, L"0x%lx", NULL, NULL, NULL, NULL}, + {L"Nominal Latency", 4, 48, L"%u", NULL, NULL, NULL, NULL}, + {L"Maximum Periodic Access Rate", 4, 52, L"%u", NULL, NULL, NULL, NULL}, + {L"Minimum Request Turnaround Time", 4, 56, L"%u", NULL, NULL, NULL, NUL= L}, + {L"Platform Interrupt Ack Register", 12, 60, NULL, DumpGas, NULL, + ValidatePccIntAckGas, NULL}, + {L"Platform Interrupt Ack Preserve", 8, 72, L"0x%lx", NULL, NULL, NULL, = NULL}, + {L"Platform Interrupt Ack Set", 8, 80, L"0x%lx", NULL, NULL, NULL, NULL}, + {L"Reserved", 8, 88, L"0x%lx", NULL, NULL, NULL, NULL}, + {L"Cmd Complete Check Reg Addr", 12, 96, NULL, DumpGas, NULL, + ValidatePccGas, NULL}, + {L"Cmd Complete Check Mask", 8, 108, L"0x%lx", NULL, NULL, NULL, NULL}, + {L"Cmd Update Reg Addr", 12, 116, NULL, DumpGas, NULL, + ValidatePccGas, NULL}, + {L"Cmd Update Preserve mask", 8, 128, L"0x%lx", NULL, NULL, NULL, NULL}, + {L"Cmd Update Set mask", 8, 136, L"0x%lx", NULL, NULL, NULL, NULL}, + {L"Error Status Register", 12, 144, NULL, DumpGas, NULL, + ValidatePccErrStatusGas, NULL}, + {L"Error Status Mask", 8, 156, L"0x%lx", NULL, NULL, NULL, NULL}, +}; + +/** + This function parses the PCC Subspace type 0. + + @param [in] Ptr Pointer to the start of Subspace Structure. + @param [in] Length Length of the Subspace Structure. +**/ +STATIC +VOID +DumpPccSubspaceType0 ( + IN UINT8* Ptr, + IN UINT8 Length + ) +{ + ParseAcpi ( + TRUE, + 2, + "Subspace Type 0", + Ptr, + Length, + PARSER_PARAMS (PccSubspaceType0Parser) + ); +} + +/** + This function parses the PCC Subspace type 1. + + @param [in] Ptr Pointer to the start of the Subspace Structure. + @param [in] Length Length of the Subspace Structure. +**/ +STATIC +VOID +DumpPccSubspaceType1 ( + IN UINT8* Ptr, + IN UINT8 Length + ) +{ + ParseAcpi ( + TRUE, + 2, + "Subspace Type 1", + Ptr, + Length, + PARSER_PARAMS (PccSubspaceType1Parser) + ); +} + +/** + This function parses the PCC Subspace type 2. + + @param [in] Ptr Pointer to the start of the Subspace Structure. + @param [in] Length Length of the Subspace Structure. +**/ +STATIC +VOID +DumpPccSubspaceType2 ( + IN UINT8* Ptr, + IN UINT8 Length + ) +{ + ParseAcpi ( + TRUE, + 2, + "Subspace Type 2", + Ptr, + Length, + PARSER_PARAMS (PccSubspaceType2Parser) + ); +} + +/** + This function parses the PCC Subspace type 3. + + @param [in] Ptr Pointer to the start of the Subspace Structure. + @param [in] Length Length of the Subspace Structure. +**/ +STATIC +VOID +DumpPccSubspaceType3 ( + IN UINT8* Ptr, + IN UINT8 Length + ) +{ + ParseAcpi ( + TRUE, + 2, + "Subspace Type 3", + Ptr, + Length, + PARSER_PARAMS (PccSubspaceType3Parser) + ); +} + +/** + This function parses the PCC Subspace type 4. + + @param [in] Ptr Pointer to the start of the Subspace Structure. + @param [in] Length Length of the Subspace Structure. +**/ +STATIC +VOID +DumpPccSubspaceType4 ( + IN UINT8* Ptr, + IN UINT8 Length + ) +{ + ParseAcpi ( + TRUE, + 2, + "Subspace Type 4", + Ptr, + Length, + PARSER_PARAMS (PccSubspaceType3Parser) + ); +} + +/** + This function parses the ACPI PCCT table including its sub-structures + of type 0 through 4. + When trace is enabled this function parses the PCCT 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 +ParseAcpiPcct ( + IN BOOLEAN Trace, + IN UINT8* Ptr, + IN UINT32 AcpiTableLength, + IN UINT8 AcpiTableRevision + ) +{ + UINT32 Offset; + UINT8* PccSubspacePtr; + UINTN SubspaceCount; + + if (!Trace) { + return; + } + + Offset =3D ParseAcpi ( + TRUE, + 0, + "PCCT", + Ptr, + AcpiTableLength, + PARSER_PARAMS (PcctParser) + ); + + PccSubspacePtr =3D Ptr + Offset; + + SubspaceCount =3D 0; + while (Offset < AcpiTableLength) { + // Parse common structure header to obtain Type and Length. + ParseAcpi ( + FALSE, + 0, + NULL, + PccSubspacePtr, + AcpiTableLength - Offset, + PARSER_PARAMS (PccSubspaceHeaderParser) + ); + + // Check if the values used to control the parsing logic have been + // successfully read. + if ((PccSubspaceType =3D=3D NULL) || + (PccSubspaceLength =3D=3D NULL)) { + IncrementErrorCount (); + Print ( + L"ERROR: Insufficient remaining table buffer length to read the " \ + L"structure header. Length =3D %u.\n", + AcpiTableLength - Offset + ); + return; + } + + // Validate Structure length + if ((*PccSubspaceLength =3D=3D 0) || + ((Offset + (*PccSubspaceLength)) > AcpiTableLength)) { + IncrementErrorCount (); + Print ( + L"ERROR: Invalid Structure length. " \ + L"Length =3D %u. Offset =3D %u. AcpiTableLength =3D %u.\n", + *PccSubspaceLength, + Offset, + AcpiTableLength + ); + return; + } + + switch (*PccSubspaceType) { + case EFI_ACPI_6_3_PCCT_SUBSPACE_TYPE_GENERIC: + DumpPccSubspaceType0 ( + PccSubspacePtr, + *PccSubspaceLength + ); + break; + case EFI_ACPI_6_3_PCCT_SUBSPACE_TYPE_1_HW_REDUCED_COMMUNICATIONS: + DumpPccSubspaceType1 ( + PccSubspacePtr, + *PccSubspaceLength + ); + break; + case EFI_ACPI_6_3_PCCT_SUBSPACE_TYPE_2_HW_REDUCED_COMMUNICATIONS: + DumpPccSubspaceType2 ( + PccSubspacePtr, + *PccSubspaceLength + ); + break; + case EFI_ACPI_6_3_PCCT_SUBSPACE_TYPE_3_EXTENDED_PCC: + DumpPccSubspaceType3 ( + PccSubspacePtr, + *PccSubspaceLength + ); + break; + case EFI_ACPI_6_3_PCCT_SUBSPACE_TYPE_4_EXTENDED_PCC: + DumpPccSubspaceType4 ( + PccSubspacePtr, + *PccSubspaceLength + ); + break; + default: + IncrementErrorCount (); + Print ( + L"ERROR: Unknown PCC subspace structure:" + L" Type =3D %u, Length =3D %u\n", + PccSubspaceType, + *PccSubspaceLength + ); + } + + PccSubspacePtr +=3D *PccSubspaceLength; + Offset +=3D *PccSubspaceLength; + SubspaceCount++; + } // while + + if (SubspaceCount > MAX_PCC_SUBSPACES) { + IncrementErrorCount (); + Print (L"ERROR: Too many PCC subspaces."); + } +} diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pcct/Pcct= Parser.h b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pcct/PcctPa= rser.h new file mode 100644 index 0000000000000000000000000000000000000000..278dc83c5de8860cbb2b1e2b2e2= 77aa7c6c58698 --- /dev/null +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pcct/PcctParser.h @@ -0,0 +1,33 @@ +/** @file + Header file for PCCT parser + + Copyright (c) 2020, Arm Limited. + SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#ifndef PCCT_PARSER_H_ +#define PCCT_PARSER_H_ + +/** + Minimum value for the 'length' field in subspaces of types 0, 1 and 2. +*/ +#define MIN_MEMORY_RANGE_LENGTH 8 + +/** + Minimum value for the 'length' field in subspaces of types 3 and 4. +*/ +#define MIN_EXT_PCC_SUBSPACE_MEM_RANGE_LEN 16 + +/** + Maximum number of PCC subspaces. +*/ +#define MAX_PCC_SUBSPACES 256 + +/** + Parser for the header of any type of PCC subspace. +*/ +#define PCC_SUBSPACE_HEADER() \ + {L"Type", 1, 0, L"0x%x", NULL, (VOID**)&PccSubspaceType, NULL, NULL}, \ + {L"Length", 1, 1, L"%u", NULL, (VOID**)&PccSubspaceLength, NULL, NULL} + +#endif // PCCT_PARSER_H_ diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiView= CommandLib.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiVi= ewCommandLib.c index d2f26ff89f12e596702281c38ab0de3729aa68e4..feb80661cddc420670edb2d8c7a= 570b0a89272d8 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommand= Lib.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommand= Lib.c @@ -1,7 +1,7 @@ /** @file Main file for 'acpiview' Shell command function. =20 - Copyright (c) 2016 - 2020, ARM Limited. All rights reserved.
+ Copyright (c) 2016 - 2020, Arm Limited. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent **/ =20 @@ -57,6 +57,8 @@ ACPI_TABLE_PARSER ParserList[] =3D { {EFI_ACPI_6_2_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE, ParseAcpiMadt}, {EFI_ACPI_6_2_PCI_EXPRESS_MEMORY_MAPPED_CONFIGURATION_SPACE_BASE_ADDRESS= _DESCRIPTION_TABLE_SIGNATURE, ParseAcpiMcfg}, + {EFI_ACPI_6_2_PLATFORM_COMMUNICATIONS_CHANNEL_TABLE_SIGNATURE, + ParseAcpiPcct}, {EFI_ACPI_6_2_PROCESSOR_PROPERTIES_TOPOLOGY_TABLE_STRUCTURE_SIGNATURE, ParseAcpiPptt}, {RSDP_TABLE_INFO, ParseAcpiRsdp}, diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiView= CommandLib.inf b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpi= ViewCommandLib.inf index 91459f9ec632635ee453c5ef46f67445cd9eee0c..efa9c8784a6670e5a4f500e0ae5= 59a4938852f95 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommand= Lib.inf +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommand= Lib.inf @@ -1,7 +1,7 @@ ## @file # Provides Shell 'acpiview' command functions # -# Copyright (c) 2016 - 2020, ARM Limited. All rights reserved.
+# Copyright (c) 2016 - 2020, Arm Limited. All rights reserved.
# # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -37,6 +37,8 @@ [Sources.common] Parsers/Madt/MadtParser.c Parsers/Madt/MadtParser.h Parsers/Mcfg/McfgParser.c + Parsers/Pcct/PcctParser.c + Parsers/Pcct/PcctParser.h Parsers/Pptt/PpttParser.c Parsers/Pptt/PpttParser.h Parsers/Rsdp/RsdpParser.c --=20 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' -=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 (#65563): https://edk2.groups.io/g/devel/message/65563 Mute This Topic: https://groups.io/mt/77055383/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Fri May 3 21:06:58 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+65562+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1600948173011862.0856548001148; Thu, 24 Sep 2020 04:49:33 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id a3k5YY1788612xnp82lPWpsY; Thu, 24 Sep 2020 04:49:32 -0700 X-Received: from EUR05-VI1-obe.outbound.protection.outlook.com (EUR05-VI1-obe.outbound.protection.outlook.com [40.107.21.40]) by mx.groups.io with SMTP id smtpd.web10.14832.1600948171094595083 for ; Thu, 24 Sep 2020 04:49:32 -0700 X-Received: from AM6P194CA0080.EURP194.PROD.OUTLOOK.COM (2603:10a6:209:8f::21) by HE1PR0802MB2457.eurprd08.prod.outlook.com (2603:10a6:3:df::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3391.19; Thu, 24 Sep 2020 11:49:27 +0000 X-Received: from VE1EUR03FT010.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:8f:cafe::e0) by AM6P194CA0080.outlook.office365.com (2603:10a6:209:8f::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.20 via Frontend Transport; Thu, 24 Sep 2020 11:49:27 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; edk2.groups.io; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;edk2.groups.io; dmarc=bestguesspass action=none header.from=arm.com; Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+65562+1787277+3901457@groups.io; helo=web01.groups.io; 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; X-Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT010.mail.protection.outlook.com (10.152.18.113) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.21 via Frontend Transport; Thu, 24 Sep 2020 11:49:27 +0000 X-Received: ("Tessian outbound 7a6fb63c1e64:v64"); Thu, 24 Sep 2020 11:49:27 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: d7fca4c1aa85fb19 X-CR-MTA-TID: 64aa7808 X-Received: from 756ab1743ef6.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 4CBD435D-8409-46C7-BD6B-69EECBF28733.1; Thu, 24 Sep 2020 11:49:19 +0000 X-Received: from EUR05-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 756ab1743ef6.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 24 Sep 2020 11:49:19 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OK5RdqDwtCee0pcvwAWcEMLMdzu+39KUqiuh2tjX/cQpmaEPIoXfX9ZESt+y8VjzxvR8SkpWkWiyyk1gvVGj+u1HLUaIvZLxapnnb/Rrzas2JmsiC6p/ybjf+EboMXhruw2EQv8bWhBiZa0FDU2v/I9JruAg//ofVvJSeWi+rTNhfo2o8kUKv0UmAw07zmKD1nSlMN0erBwgLZhfcF3NG+2xDGoEClRSDFmPaCcaY/1kraEX2YZESkL6z5TNbrrKmubWGG5oSk+cBOYoSjCrG0gkqn9xfS1/Ld5P3gxT0xN0iKiXA7RZ7Oj/qeNo7CbHMSsqZQGR8yQzwPqxZoa6vA== 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-SenderADCheck; bh=Sm1bYvV4ijKNbmxg3n7rJDBl7ZCon1KmrlFnBSOWtPA=; b=kMdyZUa3wL8VhrA3qGOPqqH44T2OImSxxLq+UkvRPO+j2dTvAHG4AkkB0p50ZmrANOc0V9qE+oCXHQQh4hJImvrRgl90YZivWPUycUPaZ7If87qVm3pDQ5ceGdzoCpVOZT3aktlUVOwkGDpNYDpU7WTugRujujBMqBB8WpcTxC6cCCJXn5XTUeA5pG1fP5rryXGaWrZ1KBTOGe1+gAzxI+HUiG3ST/jo2csuBJMYeakrcYMAP09Hw8TPJ5xlG1vy/Gea6WcG81FsVjw3Ht9paB7sObFsbQNqKP8qrFAym4gvemkzn9t2Neuqo2MxZLXV/8Ym5Zfb9NxeahfLhpByhw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=edk2.groups.io smtp.mailfrom=arm.com; dmarc=bestguesspass action=none header.from=arm.com; dkim=none (message not signed); arc=none X-Received: from MR2P264CA0044.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500::32) by DB8PR08MB4570.eurprd08.prod.outlook.com (2603:10a6:10:ae::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.22; Thu, 24 Sep 2020 11:49:17 +0000 X-Received: from VE1EUR03FT025.eop-EUR03.prod.protection.outlook.com (2603:10a6:500:0:cafe::4d) by MR2P264CA0044.outlook.office365.com (2603:10a6:500::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.20 via Frontend Transport; Thu, 24 Sep 2020 11:49:17 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=bestguesspass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; X-Received: from nebula.arm.com (40.67.248.234) by VE1EUR03FT025.mail.protection.outlook.com (10.152.18.74) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3412.21 via Frontend Transport; Thu, 24 Sep 2020 11:49:17 +0000 X-Received: from AZ-NEU-EX01.Emea.Arm.com (10.251.26.4) by AZ-NEU-EX03.Arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2044.4; Thu, 24 Sep 2020 11:49:16 +0000 X-Received: from AZ-NEU-EX03.Arm.com (10.251.24.31) by AZ-NEU-EX01.Emea.Arm.com (10.251.26.4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1779.2; Thu, 24 Sep 2020 11:49:16 +0000 X-Received: from E107187.Arm.com (10.57.53.17) by mail.arm.com (10.251.24.31) with Microsoft SMTP Server id 15.1.2044.4 via Frontend Transport; Thu, 24 Sep 2020 11:49:15 +0000 From: "Sami Mujawar" To: CC: Sami Mujawar , , , , , Subject: [edk2-devel] [PATCH v2 2/2] ShellPkg/AcpiView: Fix field validator invocation Date: Thu, 24 Sep 2020 12:49:13 +0100 Message-ID: <20200924114913.109188-3-sami.mujawar@arm.com> In-Reply-To: <20200924114913.109188-1-sami.mujawar@arm.com> References: <20200924114913.109188-1-sami.mujawar@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 38f2e3b3-6eac-4e4a-5466-08d8607fe3cf X-MS-TrafficTypeDiagnostic: DB8PR08MB4570:|HE1PR0802MB2457: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:8273;OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: kEDRi1pnG9D3gkv/WoEar82acGT0jem54Qm5YSx/zLBgxXLQDVSdq1YQtqbrsImAuFct61xwotx8VwnN7c54hvoIRyPoQJnX+QYtBny9i638sAMXax7R4EtdAC7eKlHu0071E6JoLARvmi4aknQ7qrlXeJ7jjvs3JT2gU9o4hCANakhncZt70ujE1Eeq0jmSRYHUULJJDSLTol1LO81e/2DNcQ4R8xLyQCU1axUTNHipwgLptvp3SLGd2/N+XZsxJDBDhAZmGmyUK0vUAD2HxHm3XLOh7IoEzi3+0+U+sZtOmtO+fPPqOrFKas45nqRMQL3uAAvCTutfmP2WHASQOls1uy/A9qm4kkXJeiX0W1bHudwVXy0CfdeXEAWJMAxn2dsx0tCQ2dd8E6iXMX/z2IHVVpL9Ke9JyvHikScWX7aUd7vQ3yZHg0f7gYe4Jk1n X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(4636009)(396003)(346002)(136003)(39860400002)(376002)(46966005)(478600001)(54906003)(6916009)(4326008)(316002)(44832011)(86362001)(2906002)(8676002)(8936002)(5660300002)(36756003)(1076003)(82310400003)(83380400001)(70206006)(70586007)(7696005)(2616005)(47076004)(81166007)(82740400003)(336012)(26005)(186003)(426003)(356005);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR08MB4570 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT010.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: cf3ab5f1-0741-4084-fd5d-08d8607fdded X-Microsoft-Antispam-Message-Info: Plrlk9jJjBfu3CRW0HQ/HwYZQ0YuF/3xHDVAaTytXTC0Tm13LljM5SLdz1G/BZNimL3SEQQSxjcP8s/oPGh3DH6UbEj1BkWY6RIsFbVgx7JO93d+7cklXMClzftUHpMFhdi4rlolZYodWO92HoChU5E9FwsYCTPQZbdpU/KTcSnWtU6rrGkxm2oultry+8j45/Vb/i53RqpWEpG7iw6SKlkDvUb5UXWhKJme/Ngcuqg3ltH8LeD+KT8D61kXCrthph8R2pu0dnJH5fOyKRAM/T7+UzyTFEo2OnDX0ltjMSlLa/QYuJnChmqIfAWueV2ecaWfZih9bGGyNH87qMfr8MrS5DfLuqOXC/g7HdJauXaq5QSd1t2VBHyRThC8YUQK3mq1E3fYOoHQGsY1zVwCRQ== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Sep 2020 11:49:27.0944 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 38f2e3b3-6eac-4e4a-5466-08d8607fe3cf 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: VE1EUR03FT010.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0802MB2457 Precedence: Bulk List-Unsubscribe: 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,sami.mujawar@arm.com X-Gm-Message-State: VjVQQjsbsp1E2QES99IhA3P5x1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1600948172; bh=Ob3h4KJ8nI8JUYMBl+49/fyDQuIgdx8W+O6BFxML7xk=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=vBLz/yqYHO/ogX3AGyArKNjOIlSWeYk4u3ObL1P2vzuNFUaFjIxSUgFVtUcyCWqGxR9 5p6ca8A5mpqeC9Tapbmirb+rl+azAvRpd8iP7FFL5hVG8z5/XbfnCKHFsHiLZJ4cweSXh kvd/kDChBmgVQVwS+/YdOJR7h05pnwBqO6w= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The field validator function provides means to validate fields in the ACPI table structures. To print complex field types a print formatter function is provided. The field validator was being invoked for simple data fields for which the default print format is used. However, the field validator function was not invoked if a print formatter function was provided. This problem is noticed when a Generic Address Structure (GAS) is printed using DumpGas() and a field validator is present to validate the GAS structure. To fix this move the invocation of the field validator after the field is printed such that the validation function is called even when a print formatter function is present. Signed-off-by: Sami Mujawar --- Notes: v2: - This is a new patch introduced in v2 series. [SAMI] ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c | 15 +++++++----= ---- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c b/Sh= ellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c index 02f6d771c7e1a9b8faa577b38e51c9de350d24fd..01ac9a9bafeb2ca12c1ba19f406= d626b108f5fe2 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c @@ -1,7 +1,7 @@ /** @file ACPI parser =20 - Copyright (c) 2016 - 2020, ARM Limited. All rights reserved. + Copyright (c) 2016 - 2020, Arm Limited. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent **/ =20 @@ -596,13 +596,12 @@ ParseAcpi ( Parser[Index].Length ); } // switch - - // Validating only makes sense if we are tracing - // the parsed table entries, to report by table name. - if (GetConsistencyChecking () && - (Parser[Index].FieldValidator !=3D NULL)) { - Parser[Index].FieldValidator (Ptr, Parser[Index].Context); - } + } + // Validating only makes sense if we are tracing + // the parsed table entries, to report by table name. + if (GetConsistencyChecking () && + (Parser[Index].FieldValidator !=3D NULL)) { + Parser[Index].FieldValidator (Ptr, Parser[Index].Context); } Print (L"\n"); } // if (Trace) --=20 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' -=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 (#65562): https://edk2.groups.io/g/devel/message/65562 Mute This Topic: https://groups.io/mt/77055382/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-