From nobody Sat Apr 27 17:11:54 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.108 as permitted sender) smtp.mailfrom=bounce+27952+66991+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one); dmarc=fail(p=none dis=none) header.from=arm.com Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1604493286778826.3358698871461; Wed, 4 Nov 2020 04:34:46 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id 2i8lYY1788612x2im9DLJFiH; Wed, 04 Nov 2020 04:34:46 -0800 X-Received: from EUR05-AM6-obe.outbound.protection.outlook.com (EUR05-AM6-obe.outbound.protection.outlook.com [40.107.22.60]) by mx.groups.io with SMTP id smtpd.web09.12286.1604493285216646844 for ; Wed, 04 Nov 2020 04:34:45 -0800 X-Received: from MR2P264CA0012.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500:1::24) by AM6PR08MB4568.eurprd08.prod.outlook.com (2603:10a6:20b:ac::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.18; Wed, 4 Nov 2020 12:34:41 +0000 X-Received: from VE1EUR03FT052.eop-EUR03.prod.protection.outlook.com (2603:10a6:500:1:cafe::a7) by MR2P264CA0012.outlook.office365.com (2603:10a6:500:1::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.18 via Frontend Transport; Wed, 4 Nov 2020 12:34:41 +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=pass action=none header.from=arm.com; Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+66991+1787277+3901457@groups.io; helo=mail02.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 VE1EUR03FT052.mail.protection.outlook.com (10.152.19.173) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3520.15 via Frontend Transport; Wed, 4 Nov 2020 12:34:39 +0000 X-Received: ("Tessian outbound c579d876a324:v64"); Wed, 04 Nov 2020 12:34:37 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 02c87c6934b707a2 X-CR-MTA-TID: 64aa7808 X-Received: from 78e8713e8dcc.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id F5BEEE1A-B4E0-4F94-9870-CFC734CAC910.1; Wed, 04 Nov 2020 12:33:59 +0000 X-Received: from EUR05-AM6-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 78e8713e8dcc.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 04 Nov 2020 12:33:59 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZhGWhNRIwrGar1R3IwlnEJzE5Fct/qpo7X5Q959YZc20JtgT5jPU4WhumdX6wkRRG6QlzoNz2LDjSHzchQeFjeabZGws3vgWd0+E5NMBs/A0xX1Gb/qurwn2V+8fv7leqyVg7mEfj5ww17noIDDUBJ83wQaAapsfG00LQD/vBQL7KLWVSUDuCkHTXB42+r9cN2o4kbzOXhNdoVyCHBQzE8FL4PV93Hquw+eCMMk5WB+8k9And3nsJvsyr07ynSXZc8102HR26qTf95ucUPOnUVC555AhoDoyXW1afYmPJVXAmJGrcl5U7ZCj2MvWMAJVfy7UHPD+jFWQ1WvJLGMdZw== 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=C03xTJJQPqHyCHyya2NgnmzGIZgpI5dvNsqAXC82kkg=; b=AQeEw1qX6ThfM8m6mHasoXyaQKxCLcNU/J2roYPwIPD19GZa7Grn7c9O5tlRoWuhqmPYvSsvEoReDS3zYB2xr/qNwVyn61HEp1Lp+HkU9uXqHoShsrqHTDIzrA2gyjMMmzY74wt0J+ABt447CD3z5d46ZjYo55qpIhO+jIOufTyqlgyX5uZH7Lcvh/qrJ/yLHcan1D9LuxGUjmxQhgdD3QnjeRhXBhnyjV8EsEX7dJpjGz4JW2PZzN3Rii1uRSL4yTeeIkC04D6HkkvtA0b7jguxlKOOVNTactFQIieDyFyM1rOcgU5TPHzuAl0P8zo0+RRz62Ns2rMjVOaLRLLXeA== 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=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none X-Received: from DB6PR0501CA0018.eurprd05.prod.outlook.com (2603:10a6:4:8f::28) by AM5PR0801MB1876.eurprd08.prod.outlook.com (2603:10a6:203:42::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.18; Wed, 4 Nov 2020 12:33:58 +0000 X-Received: from DB5EUR03FT008.eop-EUR03.prod.protection.outlook.com (2603:10a6:4:8f:cafe::ff) by DB6PR0501CA0018.outlook.office365.com (2603:10a6:4:8f::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.19 via Frontend Transport; Wed, 4 Nov 2020 12:33:58 +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=pass 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 DB5EUR03FT008.mail.protection.outlook.com (10.152.20.98) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3520.15 via Frontend Transport; Wed, 4 Nov 2020 12:33:58 +0000 X-Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX03.Arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2044.4; Wed, 4 Nov 2020 12:33:14 +0000 X-Received: from E107187.Arm.com (10.57.51.198) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2044.4 via Frontend Transport; Wed, 4 Nov 2020 12:33:14 +0000 From: "Sami Mujawar" To: CC: Sami Mujawar , , , , , Subject: [edk2-devel] [PATCH v2-resend 1/2] ShellPkg/AcpiView: Fix field validator invocation Date: Wed, 4 Nov 2020 12:33:12 +0000 Message-ID: <20201104123313.32524-2-sami.mujawar@arm.com> In-Reply-To: <20201104123313.32524-1-sami.mujawar@arm.com> References: <20201104123313.32524-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: 741bf3a9-bc21-4617-37aa-08d880be007a X-MS-TrafficTypeDiagnostic: AM5PR0801MB1876:|AM6PR08MB4568: 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: eIlnne0DoW2DLrm24n6z8Cz0KQPa+U87spXa1AWVoEGa0aNtYUkQiRvnzhUVg9AX5hOCObRNtm9ZQ7uOz9n3jo9LG8o1l1ElRmwrIyO6Nx3atXcc77aCBs9ERsrgt4+JYpkKPAgPz1HA2FtmWlg/HSWDZhhqB01z2ZC4G46iProObZem5apT225/E7PPL5ZT1YhUD7FQit6ZprHmRcZnLL4giyQCwALq9Y7EEeci7nnDSN58FIuxTbE4LYO2cmM2M3JX4Lv8ZMmDRgU6OWHWtDqX5CzFNLXhzCRAq3Z9X3Il3wNwvTV+iR+d0HKGPJ6R3F6egkFUwLnJCJa5amIpU4fTmLFjGuAES64YYIoKEUPSc+OMZMaw/8HFN7vWoD7lA/5ctPfi/Gp2z5JcZDCKGAhcTnB79LR84O2pm4QT6escf6Z5WwguPWIe61ltfkOBO06ipwltydMLK3hTK8JeJHFYCNLNbDLD2MZBv8IXP+4= 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)(346002)(376002)(136003)(39860400002)(396003)(46966005)(54906003)(2616005)(426003)(26005)(44832011)(7696005)(316002)(4326008)(6916009)(336012)(478600001)(186003)(47076004)(81166007)(5660300002)(82310400003)(8936002)(2906002)(86362001)(70206006)(356005)(70586007)(83380400001)(36756003)(8676002)(82740400003)(1076003);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0801MB1876 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT052.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 61ac98c5-7634-462a-95c2-08d880bde6d3 X-Microsoft-Antispam-Message-Info: 2OQFEL91+GcNHkR17efE5b0srsjMZqv4cQkaBe5h1cN2nnJkAlw4I9X5ehAOmwbLHfLJD6bCTt6jMkaijOMatlpZMhOzP4uO+RqYecDl8D5eTm2r3XjuZi2fW1AgvGr3U7+06yoGBv3hhjc125uEDmFbjcR1CF81M04v6XBUEhi+fkkeIhXXK5bYleRNMKz/AsI64uejcuh5ga+si4qNlpEP2Euyhpb0kTNEvoBEgexBsqukBpNE5rh/NgREJaUhUd2lOU3ik6S8wdgyBwfYhay9612rSR7PQXxpITtuNS8lYKNwG/1v06k6XO2wfxNrgs25MckTyP/Kfe8jaFXXlWvEQDhVMrC/EVIwRsVFsTm7ptO4rrtRcdND7EAiBFCr/3aRZ7PRp208JBq8TggU4Qdeo0OiXfo80B23smv7klOx23YDcJlPfOVh55YbrSs6JSX5hxsb5d385YKOw0CX4MBGySqrw3dNonLMElaYb1M= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2020 12:34:39.9582 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 741bf3a9-bc21-4617-37aa-08d880be007a 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: VE1EUR03FT052.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB4568 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: abaIe9bcTEwgvgSUiz1Dahw8x1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1604493286; bh=ElTur3+Euavd/R0yF9BOexI155IWF7H/cxfqsnG2fW4=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=gBnsBbQqTvJZIg6ksliREY0WHZBYIiJ9Ex7EGeTqbGPg2cHywakLHjJnd7YRegLAYtY 9pIAfUJ/1tOqCg7ugVD7qTdn//d1bIlb84+b+3OfvVIISQNljnEgAe12KlY+X4+roSZVz k43NQFVLzs84EgevT9QaK0nKs5WXVFy8Ybo= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Bugzilla: 3046 (https://bugzilla.tianocore.org/show_bug.cgi?id=3D3046) 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 (#66991): https://edk2.groups.io/g/devel/message/66991 Mute This Topic: https://groups.io/mt/78027603/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 Sat Apr 27 17:11:54 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.108 as permitted sender) smtp.mailfrom=bounce+27952+66990+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one); dmarc=fail(p=none dis=none) header.from=arm.com Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1604493268594764.2309438276209; Wed, 4 Nov 2020 04:34:28 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id hKLUYY1788612xeWBT9NvBWK; Wed, 04 Nov 2020 04:34:27 -0800 X-Received: from EUR02-AM5-obe.outbound.protection.outlook.com (EUR02-AM5-obe.outbound.protection.outlook.com [40.107.0.47]) by mx.groups.io with SMTP id smtpd.web08.12221.1604493263652063778 for ; Wed, 04 Nov 2020 04:34:26 -0800 X-Received: from MR2P264CA0073.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500:32::13) by DB8PR08MB4985.eurprd08.prod.outlook.com (2603:10a6:10:bf::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.27; Wed, 4 Nov 2020 12:34:18 +0000 X-Received: from VE1EUR03FT034.eop-EUR03.prod.protection.outlook.com (2603:10a6:500:32:cafe::3b) by MR2P264CA0073.outlook.office365.com (2603:10a6:500:32::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.18 via Frontend Transport; Wed, 4 Nov 2020 12:34:17 +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=pass action=none header.from=arm.com; Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+66990+1787277+3901457@groups.io; helo=mail02.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 VE1EUR03FT034.mail.protection.outlook.com (10.152.18.85) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3520.15 via Frontend Transport; Wed, 4 Nov 2020 12:34:16 +0000 X-Received: ("Tessian outbound d5e343850048:v64"); Wed, 04 Nov 2020 12:34:14 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 98e7229a7edd1aab X-CR-MTA-TID: 64aa7808 X-Received: from a2ad176d9307.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 45D8154B-E7F7-4893-84B2-02F2FAD878D1.1; Wed, 04 Nov 2020 12:34:07 +0000 X-Received: from EUR02-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id a2ad176d9307.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 04 Nov 2020 12:34:07 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TN3bcv0uPoDtfmwrRvVBkKaveINNbEQOVaPNaMuY+inGZlmu6yJIXpD5lIQA4ZA7vZ+onVKiMmd9BEx5gAlpEvMw2IPgMeX3N3eDqeUI/xDaMcpTnVE6S+5z2yWx18RnWCDM1hfxR5ZIOHFH1NdkJ4NbfAHbSdeYAkxQA/W2wJrDsNx41gklnppbZ6rVO4K1lXiWz0wTpA124PX4e59Evr7X1uIUnHLGbrY8HzePbuSVUPQepGxz2RSP4qNEEITNfDvqQYVZ2xwRAD7Fv1dtm0E3BFIgGysrF+1QAUBIyVdZUJDOl2xXVEaBPPAWgpWqu+B7YALv4y2kF9vVwjMWrg== 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=GBqHvGpEkfGQnklSGr2ltezf4gVzwEa5NAUrzd/P8pM=; b=ZMmnsIBqoUe1NSy/pcWQAODZ4i5a6owLryBkqUqAyPQLGZsr91iSydgsK6QK2nUuvUcSN4Jx8lWrrg2AZ29lwUbqB7EjuO89W9BSeuO0lmDMIKpo14jd0l7i/Nn+qDRVIok8Ob4D7gKwSgbrqwie1ar8yGCe93srT+ctcqm27mtItYuGwK1erxWVTCPNRT0heN42BqYinXAgRF+nm0zUdiQdNmU6lluWo/Uyo51T7LXZZrg0W1TxjeenZEs5klBLIYkYEdB8DAXuvBTXMDVXmSR11jZj3TUbDPB5UYBgiwfLkCO9es41E7M3J2fwJdYWVGmtv2VXcwG24FHpsDjkpg== 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=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none X-Received: from DB6PR0501CA0022.eurprd05.prod.outlook.com (2603:10a6:4:8f::32) by VI1PR0802MB2336.eurprd08.prod.outlook.com (2603:10a6:800:9c::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.19; Wed, 4 Nov 2020 12:33:59 +0000 X-Received: from DB5EUR03FT008.eop-EUR03.prod.protection.outlook.com (2603:10a6:4:8f:cafe::27) by DB6PR0501CA0022.outlook.office365.com (2603:10a6:4:8f::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.18 via Frontend Transport; Wed, 4 Nov 2020 12:33:59 +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=pass 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 DB5EUR03FT008.mail.protection.outlook.com (10.152.20.98) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3520.15 via Frontend Transport; Wed, 4 Nov 2020 12:33:59 +0000 X-Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX03.Arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2044.4; Wed, 4 Nov 2020 12:33:15 +0000 X-Received: from E107187.Arm.com (10.57.51.198) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2044.4 via Frontend Transport; Wed, 4 Nov 2020 12:33:14 +0000 From: "Sami Mujawar" To: CC: Sami Mujawar , , , , , Subject: [edk2-devel] [PATCH v2-resend 2/2] ShellPkg/AcpiView: PCCT Parser Date: Wed, 4 Nov 2020 12:33:13 +0000 Message-ID: <20201104123313.32524-3-sami.mujawar@arm.com> In-Reply-To: <20201104123313.32524-1-sami.mujawar@arm.com> References: <20201104123313.32524-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: b3e1ac61-0bac-4a38-aa8b-08d880bdf19b X-MS-TrafficTypeDiagnostic: VI1PR0802MB2336:|DB8PR08MB4985: 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: xnYJ1pb8tN6hUI9o2Fds9iy8kmfZ5TqaMcfhUlPYOHmF4Z31h8x1ez6nrfpvg8imkOAnxfsK292iNwU+njnraxlCrMmCnDL0ZWndHtNOQRm0wItiY5jU6ygdvFXSjSiELD38LRaPmppNVX/bEHP43COTnW7Q7sdqC+QbKPaUdmI9TTg1ixGhImblm7vYzuPaTDy2dOZYRJL2HzGJhZFqeCfSnifbk5jiOZUKSEEkGf16EmP7/68qG1xkNkDsl64D2wfytTRF27SEAjYIiSxaC5FXjbShGFxaR6kato+Y9zHeTLvfWyU63MxJaeo8PmfXs5LquF4ne2i/JfTSz9ZZf76/y2uhGJ+OhuKbwcN9plrPZpyiphe0gV+kYFGtKSsoOzhE41SazaHnKa7/2LILTjHwi27rtcXjDbXK+DcjI34fGj4Wsf/2egnGMNpzen9KlDy7gFWntxzdishvTQAc6eSuF4QwSISADSOSJG9iMzI= 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)(136003)(39860400002)(376002)(396003)(346002)(46966005)(1076003)(2906002)(356005)(44832011)(26005)(186003)(54906003)(2616005)(6916009)(316002)(478600001)(7696005)(86362001)(4326008)(70586007)(19627235002)(47076004)(426003)(82310400003)(36756003)(30864003)(8936002)(8676002)(83380400001)(82740400003)(70206006)(336012)(81166007)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0802MB2336 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT034.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 70cb2b6f-b720-4e6d-e442-08d880bde783 X-Microsoft-Antispam-Message-Info: Rdl1XkklzXK/u/xri8ZPFWAje/MNhOqYsczgoJ2VHa51O7naQWOdjK7Iyx9FLad7//xCJcFsPX/0vn0x5SjZK5cAvzd2yhnIglBVt0JZX8lVpZe6G41yYhOrz3UfE+8gddzSRF1lLS2aYw3lxWTHfkcDKn9uxL0QtzIn9QHHwBFel13cC1go2lLnafWDx5VpOHhKwRosjb9MmNCLsK1JbS2raajY039kP9lZfsler7YxswYxKIGodAm/xv8LHAS7kvK+jH/BQIt5pji6HAI5zc76rR7Dh7DJIXwG0gGZ+1RCG8/o30p4VaQOrA/L9RK6yKwnaTWMigWcO8H3zxk5ikYYw/+2Z856kvZOMzsB6nbobKMocWumspDY2J/SYqnJvuQM5IHkf2OfP5Vi4MFaFCsIPNeGWyuCaZVdgFCud0ftKVLnGaFINTwuU3qunAT94uqvVaxu+v1HFAbvfnZvstNdBRKm5ipAPRFDuwdMJMI= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2020 12:34:16.1691 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b3e1ac61-0bac-4a38-aa8b-08d880bdf19b 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: VE1EUR03FT034.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR08MB4985 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: i3Tv4fufb918ZMvjUiG06XI8x1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1604493267; bh=LRsKD7Ttw+Xi8tbnH5N8qmpT6EZzXkMS1g84qKzrmqI=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=W9TG/wdMV8YZ4ttTLqvyF/Pv9ZLRjKSBOsdsCGeyCL7qLkBoeq9fH+8hvXcEP7SYEwY XeMQtRKCYyIRuRIjh7Hx1p4ecm/ruXwW6j13svuy1BxzS2Uy6WFKNkOqIzCdE9aMYkJSo iHkZyur/dby+qP5QTk+SedBMJ25VKzOFYas= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Marc Moisson-Franckhauser Bugzilla: 3047 (https://bugzilla.tianocore.org/show_bug.cgi?id=3D3047) 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 Reviewed-by: Zhichao Gao --- 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 (#66990): https://edk2.groups.io/g/devel/message/66990 Mute This Topic: https://groups.io/mt/78027598/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-