From nobody Mon May 6 21:26:13 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+80815+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 1631803584920714.2666421153986; Thu, 16 Sep 2021 07:46:24 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id XzN2YY1788612xdf7le85wsI; Thu, 16 Sep 2021 07:46:24 -0700 X-Received: from EUR02-HE1-obe.outbound.protection.outlook.com (EUR02-HE1-obe.outbound.protection.outlook.com [40.107.1.80]) by mx.groups.io with SMTP id smtpd.web08.226.1631803582051288005 for ; Thu, 16 Sep 2021 07:46:23 -0700 X-Received: from DB9PR02CA0024.eurprd02.prod.outlook.com (2603:10a6:10:1d9::29) by PAXPR08MB7170.eurprd08.prod.outlook.com (2603:10a6:102:208::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.15; Thu, 16 Sep 2021 14:46:17 +0000 X-Received: from DB5EUR03FT051.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:1d9:cafe::2c) by DB9PR02CA0024.outlook.office365.com (2603:10a6:10:1d9::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.16 via Frontend Transport; Thu, 16 Sep 2021 14:46: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+80815+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 DB5EUR03FT051.mail.protection.outlook.com (10.152.21.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.14 via Frontend Transport; Thu, 16 Sep 2021 14:46:17 +0000 X-Received: ("Tessian outbound 8e26f7114b75:v103"); Thu, 16 Sep 2021 14:46:17 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 15fd87f5478baff2 X-CR-MTA-TID: 64aa7808 X-Received: from ea85adf85d55.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 93957484-082C-4E6A-B191-52E19418BA76.1; Thu, 16 Sep 2021 14:46:10 +0000 X-Received: from EUR04-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id ea85adf85d55.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 16 Sep 2021 14:46:10 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BtcMrCdcsGsF6AyeP7QnC0O1LFleHtjJ7Le89NAfYMvP19FKfQS8qJbYD/Ru7kMziTaljwes5z31S00jItq3g2BDsDn3D9LKU2ORZDZ4Td72wkcSiwPt+w5zqAKyNuJcB3ncZ6NNOTTouN2YMgJkEHZxqvggMSg9DE5PmnmQ5Yz1Xid0L2XpMgul7qKYHz2obDdH43xH+aJk2JHUWu3FxKcgDJVdhRJ+z+XUT2w+mwy3ESCIWcZK6iAFpSFZ8MKmhazao1o9yIo7xxg8f0Mw4xsKx7IfEDuMejiO5YySXcH9j0pq7+gkrU7S4N9ck2SkzF0alZ6/LNyOKldUt3GDPw== 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; bh=Unc3PTPnCOO05kxnohWOc8O2YC/IdWoNED+B3XdF/4w=; b=EqxmGZUkpdKWZzpZGZohcJt3U3N03e5uAqagdebEc4aQoQ9NDL7cJ9JAbYziSlTkP/Lx55UO9GwuOmusSL9geYJfXhiox04TZdsjptRnrDIncmKEflaYcXK+zoMrUfyjYwgDjQGAQb/9IyXRPzXtmSUjQo63AdtilYf1oMF2XGTl8JJa4EBBNv/ct7xns7LGrXlC7yArf307gqThThrME5gZQZs9+QJjRwIMfkVYMo9JZjduZ7dLs0PnBD3NCq6Wr/cwzgQypcfrLyV50pY4kg+qDW5akkA54/XXYXssxGj72Om/l4UXEze2dWflAeM/0bqv+vukfggloP6GIwSiig== 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 DU2PR04CA0236.eurprd04.prod.outlook.com (2603:10a6:10:2b1::31) by DBBPR08MB4281.eurprd08.prod.outlook.com (2603:10a6:10:c4::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.17; Thu, 16 Sep 2021 14:46:07 +0000 X-Received: from DB5EUR03FT020.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:2b1:cafe::7d) by DU2PR04CA0236.outlook.office365.com (2603:10a6:10:2b1::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.16 via Frontend Transport; Thu, 16 Sep 2021 14:46:07 +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 DB5EUR03FT020.mail.protection.outlook.com (10.152.20.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4523.14 via Frontend Transport; Thu, 16 Sep 2021 14:46:07 +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.2308.14; Thu, 16 Sep 2021 14:46:14 +0000 X-Received: from e124191.cambridge.arm.com (10.11.7.12) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2308.14 via Frontend Transport; Thu, 16 Sep 2021 14:46:14 +0000 From: "Joey Gouly" To: CC: , , , , Subject: [edk2-devel] [PATCH v2 1/5] ShellPkg: Replace 'Trace' parameter with 'ParseFlags' Date: Thu, 16 Sep 2021 15:46:01 +0100 Message-ID: <20210916144605.42071-2-joey.gouly@arm.com> In-Reply-To: <20210916144605.42071-1-joey.gouly@arm.com> References: <20210916144605.42071-1-joey.gouly@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 81b7b325-de01-46d0-c0b5-08d97920bd82 X-MS-TrafficTypeDiagnostic: DBBPR08MB4281:|PAXPR08MB7170: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:3826;OLM:3826; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: LrLFhZmtidNztZmfOo0T6aUDnjg+U0W1Vb4ELEasLDOFMLGGNA49PpeAjcCzsHE26gw1LRmkrR/Gqe2hHZtCntBsJJBvLIlRsiDQddJx3HuJWyRtQAoDq+Qj1YlHShXGmHrljWn1fSSvo4QtsNjfDmLRiDN1vqQxo+2zDAmklGX+kGaT0bGAABQpfQbDa6PyM2C0RtUKGOlpVrPTZ0gAiixqG7IDuG+C36SoK7k4Wkw3N8qx2TP57YUX1HIgOYXG75qNHvwt8HaKPqCTNfoP9klAvzH7goCRCYhLGhRAKvpwPaAF58dCfbxPwdpP/tfMQ/9j7nkWAcrEiC8OrbndUAQzhkiGskI+SH9sUT466I6dWBE1YdpSC+WJa92xtNrlTt+UcUjT7JcKKz0Rd7/3n/yy2v8mOxm2XRlaH7PQRpWoaRgnlgAX3VlPZ0Q/gftjecD2Ip5TFg6IdtXP7Gd19+kVbvP9R+imRt/ll7rLFDlXexky5J7UyI3LHl//xjVjiiNN842FnqFsbflQKgm4SFmp+Gsbwv9KrDMjsTuXbGJvyG/SUEtGXRqnhYQ/TI67ALZ/9ETn4snK2LQmubmxsS76RdW2e2jTBZBZkeYkksIm4ufVpXjNnbxbNuJdJOvn65pbm88WXOgsB5i3kqMT+0uJgDCv1dog4fwLY1LGYaGqc9KBEIlnpz2fTCkEmfVppU53+5JWM8wMRCzRcuJKEJrgf+N0/XWuY7/MSCkj34wTEmdVIiSXmZnua/KacPGpMx8CzMjCOEcX2H8yIJktm/M8CJq+4uAOcAyFNumhnHgz7UZEcpIyKrFc57twd6mu 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)(39860400002)(346002)(396003)(376002)(136003)(36840700001)(46966006)(1076003)(44832011)(81166007)(82310400003)(5660300002)(82740400003)(30864003)(356005)(426003)(6666004)(70206006)(86362001)(36756003)(83380400001)(478600001)(316002)(8676002)(8936002)(6916009)(26005)(19627235002)(2906002)(70586007)(47076005)(7696005)(36860700001)(186003)(54906003)(4326008)(336012)(2616005)(36900700001)(579004);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR08MB4281 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT051.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 3ad99828-e515-4c44-b105-08d97920b74f X-Microsoft-Antispam-Message-Info: 57MY5FIHB7ZAb4V6tApasj+aMnxwfBloJqBmLKPotFz8SUcwx5b+qb2X6goBorJlJjP4FgJHH7miDGEO0Ks+CNn1mLg2nVdlBLmJHcnn4cubyH5jOdhgxHzPCtPaX5R9haiJoqy25AAIwdwLcPHbZ967xRZVzsGdLXQNbxvA1O1RObXy7YZiZUK+3sP6OSjK5cfbUjUO4Y/SsEuA9asl5cOL6+WKDxy0ZXMV3dJJ8U2IEXOJT0K0YB2Hh67ifwMyQKI3yfdgFtjdLCUS8KSfy46+lgZCsZDYtoFVFJFHM57ROfSl5XQj1xozMWd8mIdsTibEG4DBrHMrjh08YpP3orUhuH5og0CoDPGuB86O1ySTXXMhr+8s0bQsoRKacFcIxyF9Wld3FYAZgocV2qn//O2yFAnswr2O9v/4O5k7n7FVxNVYjMUem4c5WhfQKZoHQ6vDfT1bwonwbKtlm7BfMQ6y6rBRZX0trxHcQuhD1fTbPeN33zqbIu0pjs/HT3psOPd1FK/ZvlHGa6Sytqv62PeOOAC94dEpagPJXro2OBBbGjwRwp7cnwPRQ4c6Sk7e6T/fEgEpyBnvk4polRxHIpN2yQ/rAyoX17+5NFEkWJ8rnUVAY2/sDTFYoMW7shnwqd9jazvWdeCsZMIDd7CYLkEt3akph19iPrkbFtiXQsdj3HQs4ZVANsv+bp+4NwuS7q8VngxGjPiFNqSPHAcZ1wWJLIpnLBaNHTnlTUcEp2Tw3ExAD2aNSAm8ZKCe8v5h0dgntdWmQJGvqy2dA5tRqLFgiklqHNma9gDoQY5pJME= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Sep 2021 14:46:17.4933 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 81b7b325-de01-46d0-c0b5-08d97920bd82 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: DB5EUR03FT051.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR08MB7170 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: 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,joey.gouly@arm.com X-Gm-Message-State: Nt1g4G2G6kw2xIuA00NZxY7hx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1631803584; bh=ds4XmM3Ga9reGIRCgJRwDTILNO7ne7nAkfwuiGkKUuM=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=HG1yZftZ00m0bMejCE/y3DgJ01B3uFFrq35LgLJAu8GZf5Lnt+Jh2uP0Uk45l/gLQu2 jecbgH7Gn6nhTNcpD/9GfwehrkcWBUNkim5p42J1lxNGiTJjitUr8W8iruVRD27v4VrUt zhEEsGuH3afzFpbLLdS0MTFOLHjuk8rpQrg= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1631803586332100013 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Marc Moisson-Franckhauser Bugzilla: 3378 (https://bugzilla.tianocore.org/show_bug.cgi?id=3D3378) This is preparation for adding a second flag to the parsers. Signed-off-by: Joey Gouly --- ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h | 7= 7 +++++++++++--------- ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.h | = 6 +- ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c | 2= 0 ++--- ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c | 2= 8 ++++--- ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Bgrt/BgrtParser.c | 1= 0 +-- ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c | = 8 +- ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dsdt/DsdtParser.c | = 8 +- ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Facs/FacsParser.c | 1= 0 +-- ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c | 2= 7 ++++--- ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c | = 8 +- ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c | = 8 +- ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c | = 8 +- ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Mcfg/McfgParser.c | = 8 +- ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/PpttParser.c | 4= 7 +++++++----- ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c | 1= 0 +-- ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Slit/SlitParser.c | = 8 +- ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Spcr/SpcrParser.c | = 8 +- ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c | = 8 +- ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Ssdt/SsdtParser.c | = 8 +- ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Xsdt/XsdtParser.c | 1= 0 +-- 20 files changed, 179 insertions(+), 146 deletions(-) diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h b/Sh= ellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h index 0b7726b9d5807ad2f5c5447408c4c5451718938b..b078c0b99335ba28f7589cac6b0= a4190d9a6c3b5 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 - 2021, Arm Limited. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent **/ =20 @@ -16,6 +16,16 @@ /// that allows us to process the log options. #define RSDP_TABLE_INFO SIGNATURE_32('R', 'S', 'D', 'P') =20 +/** + Flags for the parser. +*/ +#define PARSE_FLAGS_TRACE BIT0 + +/** + Helper macros to test parser flags. +*/ +#define IS_TRACE_FLAG_SET(Flags) (((Flags) & PARSE_FLAGS_TRACE) !=3D 0) + /** This function increments the ACPI table error counter. **/ @@ -489,7 +499,7 @@ ParseAcpiAest ( =20 This function also performs validation of the ACPI table fields. =20 - @param [in] Trace If TRUE, trace the ACPI fields. + @param [in] ParseFlags Flags describing what the parser needs to= do. @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. @@ -497,7 +507,7 @@ ParseAcpiAest ( VOID EFIAPI ParseAcpiBgrt ( - IN BOOLEAN Trace, + IN UINT8 ParseFlags, IN UINT8* Ptr, IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision @@ -510,7 +520,7 @@ ParseAcpiBgrt ( =20 This function also performs validation of the ACPI table fields. =20 - @param [in] Trace If TRUE, trace the ACPI fields. + @param [in] ParseFlags Flags describing what the parser needs to= do. @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. @@ -518,7 +528,7 @@ ParseAcpiBgrt ( VOID EFIAPI ParseAcpiDbg2 ( - IN BOOLEAN Trace, + IN UINT8 ParseFlags, IN UINT8* Ptr, IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision @@ -531,7 +541,7 @@ ParseAcpiDbg2 ( For the DSDT table only the ACPI header fields are parsed and traced. =20 - @param [in] Trace If TRUE, trace the ACPI fields. + @param [in] ParseFlags Flags describing what the parser needs to= do. @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. @@ -539,7 +549,7 @@ ParseAcpiDbg2 ( VOID EFIAPI ParseAcpiDsdt ( - IN BOOLEAN Trace, + IN UINT8 ParseFlags, IN UINT8* Ptr, IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision @@ -552,7 +562,7 @@ ParseAcpiDsdt ( =20 This function also performs validation of the ACPI table fields. =20 - @param [in] Trace If TRUE, trace the ACPI fields. + @param [in] ParseFlags Flags describing what the parser needs to= do. @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. @@ -560,7 +570,7 @@ ParseAcpiDsdt ( VOID EFIAPI ParseAcpiFacs ( - IN BOOLEAN Trace, + IN UINT8 ParseFlags, IN UINT8* Ptr, IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision @@ -573,7 +583,7 @@ ParseAcpiFacs ( =20 This function also performs validation of the ACPI table fields. =20 - @param [in] Trace If TRUE, trace the ACPI fields. + @param [in] ParseFlags Flags describing what the parser needs to= do. @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. @@ -581,7 +591,7 @@ ParseAcpiFacs ( VOID EFIAPI ParseAcpiFadt ( - IN BOOLEAN Trace, + IN UINT8 ParseFlags, IN UINT8* Ptr, IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision @@ -598,7 +608,7 @@ ParseAcpiFadt ( =20 This function also performs validation of the ACPI table fields. =20 - @param [in] Trace If TRUE, trace the ACPI fields. + @param [in] ParseFlags Flags describing what the parser needs to= do. @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. @@ -606,7 +616,7 @@ ParseAcpiFadt ( VOID EFIAPI ParseAcpiGtdt ( - IN BOOLEAN Trace, + IN UINT8 ParseFlags, IN UINT8* Ptr, IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision @@ -653,7 +663,7 @@ ParseAcpiHmat ( =20 This function also performs validation of the ACPI table fields. =20 - @param [in] Trace If TRUE, trace the ACPI fields. + @param [in] ParseFlags Flags describing what the parser needs to= do. @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. @@ -661,7 +671,7 @@ ParseAcpiHmat ( VOID EFIAPI ParseAcpiIort ( - IN BOOLEAN Trace, + IN UINT8 ParseFlags, IN UINT8* Ptr, IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision @@ -682,7 +692,7 @@ ParseAcpiIort ( =20 This function also performs validation of the ACPI table fields. =20 - @param [in] Trace If TRUE, trace the ACPI fields. + @param [in] ParseFlags Flags describing what the parser needs to= do. @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. @@ -690,7 +700,7 @@ ParseAcpiIort ( VOID EFIAPI ParseAcpiMadt ( - IN BOOLEAN Trace, + IN UINT8 ParseFlags, IN UINT8* Ptr, IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision @@ -703,7 +713,7 @@ ParseAcpiMadt ( =20 This function also performs validation of the ACPI table fields. =20 - @param [in] Trace If TRUE, trace the ACPI fields. + @param [in] ParseFlags Flags describing what the parser needs to= do. @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. @@ -711,7 +721,7 @@ ParseAcpiMadt ( VOID EFIAPI ParseAcpiMcfg ( - IN BOOLEAN Trace, + IN UINT8 ParseFlags, IN UINT8* Ptr, IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision @@ -746,7 +756,7 @@ ParseAcpiPcct ( =20 This function also performs validation of the ACPI table fields. =20 - @param [in] Trace If TRUE, trace the ACPI fields. + @param [in] ParseFlags Flags describing what the parser needs to= do. @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. @@ -754,7 +764,7 @@ ParseAcpiPcct ( VOID EFIAPI ParseAcpiPptt ( - IN BOOLEAN Trace, + IN UINT8 ParseFlags, IN UINT8* Ptr, IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision @@ -769,7 +779,7 @@ ParseAcpiPptt ( This function also performs a RAW dump of the ACPI table and validates the checksum. =20 - @param [in] Trace If TRUE, trace the ACPI fields. + @param [in] ParseFlags Flags describing what the parser needs to= do. @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. @@ -777,7 +787,7 @@ ParseAcpiPptt ( VOID EFIAPI ParseAcpiRsdp ( - IN BOOLEAN Trace, + IN UINT8 ParseFlags, IN UINT8* Ptr, IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision @@ -793,7 +803,8 @@ ParseAcpiRsdp ( - Relative distance from System Locality at i*N+j is same as j*N+i =20 - @param [in] Trace If TRUE, trace the ACPI fields. + @param [in] ParseFlags Flags describing what the parser need= s to + do. @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. @@ -801,7 +812,7 @@ ParseAcpiRsdp ( VOID EFIAPI ParseAcpiSlit ( - IN BOOLEAN Trace, + IN UINT8 ParseFlags, IN UINT8* Ptr, IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision @@ -814,7 +825,7 @@ ParseAcpiSlit ( =20 This function also performs validations of the ACPI table fields. =20 - @param [in] Trace If TRUE, trace the ACPI fields. + @param [in] ParseFlags Flags describing what the parser needs to= do. @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. @@ -822,7 +833,7 @@ ParseAcpiSlit ( VOID EFIAPI ParseAcpiSpcr ( - IN BOOLEAN Trace, + IN UINT8 ParseFlags, IN UINT8* Ptr, IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision @@ -841,7 +852,7 @@ ParseAcpiSpcr ( =20 This function also performs validation of the ACPI table fields. =20 - @param [in] Trace If TRUE, trace the ACPI fields. + @param [in] ParseFlags Flags describing what the parser needs to= do. @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. @@ -849,7 +860,7 @@ ParseAcpiSpcr ( VOID EFIAPI ParseAcpiSrat ( - IN BOOLEAN Trace, + IN UINT8 ParseFlags, IN UINT8* Ptr, IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision @@ -862,7 +873,7 @@ ParseAcpiSrat ( For the SSDT table only the ACPI header fields are parsed and traced. =20 - @param [in] Trace If TRUE, trace the ACPI fields. + @param [in] ParseFlags Flags describing what the parser needs to= do. @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. @@ -870,7 +881,7 @@ ParseAcpiSrat ( VOID EFIAPI ParseAcpiSsdt ( - IN BOOLEAN Trace, + IN UINT8 ParseFlags, IN UINT8* Ptr, IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision @@ -882,7 +893,7 @@ ParseAcpiSsdt ( =20 This function also performs validation of the XSDT table. =20 - @param [in] Trace If TRUE, trace the ACPI fields. + @param [in] ParseFlags Flags describing what the parser needs to= do. @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. @@ -890,7 +901,7 @@ ParseAcpiSsdt ( VOID EFIAPI ParseAcpiXsdt ( - IN BOOLEAN Trace, + IN UINT8 ParseFlags, IN UINT8* Ptr, IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.h= b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.h index 0ebf79fb653ae3a8190273aee452723c6213eb58..94ce0a4860e5296d99d39848065= 5a8013ab0f240 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 - 2020, Arm Limited. All rights reserved. + Copyright (c) 2016 - 2021, Arm Limited. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent **/ =20 @@ -20,7 +20,7 @@ /** A function that parses the ACPI table. =20 - @param [in] Trace If TRUE, trace the ACPI fields. + @param [in] ParseFlags Flags describing what the parser needs to= do. @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. @@ -28,7 +28,7 @@ typedef VOID (EFIAPI * PARSE_ACPI_TABLE_PROC) ( - IN BOOLEAN Trace, + IN UINT8 ParseFlags, IN UINT8* Ptr, IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c= b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c index 4b618f131eac3957f4070a95e06c8cd157c3223c..ecb5d6339af37397c6ba1ba4c8f= 0d42a95811bf6 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c @@ -1,7 +1,7 @@ /** @file ACPI table parser =20 - Copyright (c) 2016 - 2020, ARM Limited. All rights reserved. + Copyright (c) 2016 - 2021, Arm Limited. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent =20 @par Glossary: @@ -183,7 +183,7 @@ ProcessAcpiTable ( ) { EFI_STATUS Status; - BOOLEAN Trace; + UINT8 ParseFlags; CONST UINT32* AcpiTableSignature; CONST UINT32* AcpiTableLength; CONST UINT8* AcpiTableRevision; @@ -197,13 +197,13 @@ ProcessAcpiTable ( &AcpiTableRevision ); =20 - Trace =3D ProcessTableReportOptions ( - *AcpiTableSignature, - Ptr, - *AcpiTableLength - ); + ParseFlags =3D ProcessTableReportOptions ( + *AcpiTableSignature, + Ptr, + *AcpiTableLength + ); =20 - if (Trace) { + if (IS_TRACE_FLAG_SET (ParseFlags)) { DumpRaw (Ptr, *AcpiTableLength); =20 // Do not process the ACPI table any further if the table length read @@ -236,14 +236,14 @@ ProcessAcpiTable ( Status =3D GetParser (*AcpiTableSignature, &ParserProc); if (EFI_ERROR (Status)) { // No registered parser found, do default handling. - if (Trace) { + if (IS_TRACE_FLAG_SET (ParseFlags)) { DumpAcpiHeader (Ptr); } return; } =20 ParserProc ( - Trace, + ParseFlags, Ptr, *AcpiTableLength, *AcpiTableRevision diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c b/Shel= lPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c index 9a5b013fb234e2a09a12a690607b5b871dffde72..a4242ba9d99b05d07c829520c40= 11439445aadb0 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c @@ -1,6 +1,6 @@ /** @file =20 - Copyright (c) 2016 - 2020, ARM Limited. All rights reserved. + Copyright (c) 2016 - 2021, Arm Limited. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent =20 @par Glossary: @@ -73,9 +73,9 @@ DumpAcpiTableToFile ( @param [in] TablePtr Pointer to the ACPI table data. @param [in] Length The length fo the ACPI table. =20 - @retval Returns TRUE if the ACPI table should be traced. + @retval Returns the ParseFlags for the ACPI table. **/ -BOOLEAN +UINT8 ProcessTableReportOptions ( IN CONST UINT32 Signature, IN CONST UINT8* TablePtr, @@ -84,7 +84,7 @@ ProcessTableReportOptions ( { UINTN OriginalAttribute; UINT8 *SignaturePtr; - BOOLEAN Log; + UINT8 ParseFlags; BOOLEAN HighLight; SELECTED_ACPI_TABLE *SelectedTable; =20 @@ -93,17 +93,17 @@ ProcessTableReportOptions ( // OriginalAttribute =3D 0; SignaturePtr =3D (UINT8*)(UINTN)&Signature; - Log =3D FALSE; + ParseFlags =3D 0; HighLight =3D GetColourHighlighting (); GetSelectedAcpiTable (&SelectedTable); =20 switch (GetReportOption ()) { case ReportAll: - Log =3D TRUE; + ParseFlags |=3D PARSE_FLAGS_TRACE; break; case ReportSelected: if (Signature =3D=3D SelectedTable->Type) { - Log =3D TRUE; + ParseFlags |=3D PARSE_FLAGS_TRACE; SelectedTable->Found =3D TRUE; } break; @@ -143,7 +143,7 @@ ProcessTableReportOptions ( break; } // switch =20 - if (Log) { + if (IS_TRACE_FLAG_SET (ParseFlags)) { if (HighLight) { OriginalAttribute =3D gST->ConOut->Mode->Attribute; gST->ConOut->SetAttribute ( @@ -164,7 +164,7 @@ ProcessTableReportOptions ( } } =20 - return Log; + return ParseFlags; } =20 =20 @@ -196,7 +196,7 @@ AcpiView ( UINT32 RsdpLength; UINT8 RsdpRevision; PARSE_ACPI_TABLE_PROC RsdpParserProc; - BOOLEAN Trace; + UINT8 ParseFlags; SELECTED_ACPI_TABLE *SelectedTable; =20 // @@ -249,7 +249,11 @@ AcpiView ( // The RSDP length is 4 bytes starting at offset 20 RsdpLength =3D *(UINT32*)(RsdpPtr + RSDP_LENGTH_OFFSET); =20 - Trace =3D ProcessTableReportOptions (RSDP_TABLE_INFO, RsdpPtr, RsdpLen= gth); + ParseFlags =3D ProcessTableReportOptions ( + RSDP_TABLE_INFO, + RsdpPtr, + RsdpLength + ); =20 Status =3D GetParser (RSDP_TABLE_INFO, &RsdpParserProc); if (EFI_ERROR (Status)) { @@ -260,7 +264,7 @@ AcpiView ( } =20 RsdpParserProc ( - Trace, + ParseFlags, RsdpPtr, RsdpLength, RsdpRevision diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Bgrt/Bgrt= Parser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Bgrt/BgrtPa= rser.c index 1a180271a4ebe47948b7f0b56d1cb6f81b5fdf13..6bd4c35bec85e038875ce3d9548= c9139b1de2755 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Bgrt/BgrtParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Bgrt/BgrtParser.c @@ -1,7 +1,7 @@ /** @file BGRT table parser =20 - Copyright (c) 2017 - 2018, ARM Limited. All rights reserved. + Copyright (c) 2017 - 2021, Arm Limited. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent =20 @par Reference(s): @@ -36,7 +36,7 @@ STATIC CONST ACPI_PARSER BgrtParser[] =3D { =20 This function also performs validation of the ACPI table fields. =20 - @param [in] Trace If TRUE, trace the ACPI fields. + @param [in] ParseFlags Flags describing what the parser needs to= do. @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. @@ -44,18 +44,18 @@ STATIC CONST ACPI_PARSER BgrtParser[] =3D { VOID EFIAPI ParseAcpiBgrt ( - IN BOOLEAN Trace, + IN UINT8 ParseFlags, IN UINT8* Ptr, IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision ) { - if (!Trace) { + if (!IS_TRACE_FLAG_SET (ParseFlags)) { return; } =20 ParseAcpi ( - Trace, + TRUE, 0, "BGRT", Ptr, diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2= Parser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Pa= rser.c index 9df111ecaa7d7a703a13a39c243ed78b9f12ee97..a22f8ab76b84432b2073bea6ca6= d8245ea9df7fb 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c @@ -1,7 +1,7 @@ /** @file DBG2 table parser =20 - Copyright (c) 2016 - 2020, ARM Limited. All rights reserved. + Copyright (c) 2016 - 2021, Arm Limited. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent =20 @par Reference(s): @@ -212,7 +212,7 @@ DumpDbgDeviceInfo ( =20 This function also performs validation of the ACPI table fields. =20 - @param [in] Trace If TRUE, trace the ACPI fields. + @param [in] ParseFlags Flags describing what the parser needs to= do. @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. @@ -220,7 +220,7 @@ DumpDbgDeviceInfo ( VOID EFIAPI ParseAcpiDbg2 ( - IN BOOLEAN Trace, + IN UINT8 ParseFlags, IN UINT8* Ptr, IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision @@ -229,7 +229,7 @@ ParseAcpiDbg2 ( UINT32 Offset; UINT32 Index; =20 - if (!Trace) { + if (!IS_TRACE_FLAG_SET (ParseFlags)) { return; } =20 diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dsdt/Dsdt= Parser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dsdt/DsdtPa= rser.c index 6d43974f54d23fd9990fa7af721c96518bb96a36..609c17ef02d460be66f0c390203= cae55ece653e3 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dsdt/DsdtParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dsdt/DsdtParser.c @@ -1,7 +1,7 @@ /** @file DSDT table parser =20 - Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. + Copyright (c) 2016 - 2021, Arm Limited. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent =20 @par Reference(s): @@ -20,7 +20,7 @@ For the DSDT table only the ACPI header fields are parsed and traced. =20 - @param [in] Trace If TRUE, trace the ACPI fields. + @param [in] ParseFlags Flags describing what the parser needs to= do. @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. @@ -28,13 +28,13 @@ VOID EFIAPI ParseAcpiDsdt ( - IN BOOLEAN Trace, + IN UINT8 ParseFlags, IN UINT8* Ptr, IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision ) { - if (!Trace) { + if (!IS_TRACE_FLAG_SET (ParseFlags)) { return; } =20 diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Facs/Facs= Parser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Facs/FacsPa= rser.c index d6bea86bdbaa79aa35b86840c809394b3c7a3bf6..d7545b6161eadd24e986a782891= 0662f2f52b2ec 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Facs/FacsParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Facs/FacsParser.c @@ -1,7 +1,7 @@ /** @file FACS table parser =20 - Copyright (c) 2019, ARM Limited. All rights reserved. + Copyright (c) 2019 - 2021, Arm Limited. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent =20 @par Reference(s): @@ -42,7 +42,7 @@ STATIC CONST ACPI_PARSER FacsParser[] =3D { =20 This function also performs validation of the ACPI table fields. =20 - @param [in] Trace If TRUE, trace the ACPI fields. + @param [in] ParseFlags Flags describing what the parser needs to= do. @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. @@ -50,18 +50,18 @@ STATIC CONST ACPI_PARSER FacsParser[] =3D { VOID EFIAPI ParseAcpiFacs ( - IN BOOLEAN Trace, + IN UINT8 ParseFlags, IN UINT8* Ptr, IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision ) { - if (!Trace) { + if (!IS_TRACE_FLAG_SET (ParseFlags)) { return; } =20 ParseAcpi ( - Trace, + TRUE, 0, "FACS", Ptr, diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/Fadt= Parser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtPa= rser.c index d86718bab67d45fd612bb7ac725b5eb3eeb7dfdc..8d0eb42ec3b361c1727184c542a= 757e39ef3da5c 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c @@ -1,7 +1,7 @@ /** @file FADT table parser =20 - Copyright (c) 2016 - 2020, ARM Limited. All rights reserved. + Copyright (c) 2016 - 2021, Arm Limited. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent =20 @par Reference(s): @@ -198,7 +198,7 @@ STATIC CONST ACPI_PARSER FadtParser[] =3D { =20 This function also performs validation of the ACPI table fields. =20 - @param [in] Trace If TRUE, trace the ACPI fields. + @param [in] ParseFlags Flags describing what the parser needs to= do. @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. @@ -206,7 +206,7 @@ STATIC CONST ACPI_PARSER FadtParser[] =3D { VOID EFIAPI ParseAcpiFadt ( - IN BOOLEAN Trace, + IN UINT8 ParseFlags, IN UINT8* Ptr, IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision @@ -219,6 +219,9 @@ ParseAcpiFadt ( UINT32 FacsLength; UINT8 FacsRevision; PARSE_ACPI_TABLE_PROC FacsParserProc; + BOOLEAN Trace; + + Trace =3D IS_TRACE_FLAG_SET (ParseFlags); =20 ParseAcpi ( Trace, @@ -253,7 +256,7 @@ ParseAcpiFadt ( // if HW_REDUCED_ACPI flag is not set, both FIRMWARE_CTRL and // X_FIRMWARE_CTRL cannot be zero, and the FACS Table must be // present. - if ((Trace) && + if (Trace && (Flags !=3D NULL) && ((*Flags & EFI_ACPI_6_3_HW_REDUCED_ACPI) !=3D EFI_ACPI_6_3_HW_REDU= CED_ACPI)) { IncrementErrorCount (); @@ -274,11 +277,15 @@ ParseAcpiFadt ( // The FACS version is 1 byte starting at offset 32. FacsRevision =3D *(UINT8*)(FirmwareCtrlPtr + FACS_VERSION_OFFSET); =20 - Trace =3D ProcessTableReportOptions ( - FacsSignature, - FirmwareCtrlPtr, - FacsLength - ); + if (ProcessTableReportOptions ( + FacsSignature, + FirmwareCtrlPtr, + FacsLength + )) { + ParseFlags |=3D PARSE_FLAGS_TRACE; + } else { + ParseFlags &=3D ~PARSE_FLAGS_TRACE; + } =20 Status =3D GetParser (FacsSignature, &FacsParserProc); if (EFI_ERROR (Status)) { @@ -289,7 +296,7 @@ ParseAcpiFadt ( } =20 FacsParserProc ( - Trace, + ParseFlags, FirmwareCtrlPtr, FacsLength, FacsRevision diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/Gtdt= Parser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtPa= rser.c index d02fc4929d6fa5e04672276810b19d3f4c62efd2..da93938771bfcf0da146fd46a02= 5addeb05e71cc 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c @@ -1,7 +1,7 @@ /** @file GTDT table parser =20 - Copyright (c) 2016 - 2020, ARM Limited. All rights reserved. + Copyright (c) 2016 - 2021, Arm Limited. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent =20 @par Reference(s): @@ -254,7 +254,7 @@ DumpWatchdogTimer ( =20 This function also performs validation of the ACPI table fields. =20 - @param [in] Trace If TRUE, trace the ACPI fields. + @param [in] ParseFlags Flags describing what the parser needs to= do. @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. @@ -262,7 +262,7 @@ DumpWatchdogTimer ( VOID EFIAPI ParseAcpiGtdt ( - IN BOOLEAN Trace, + IN UINT8 ParseFlags, IN UINT8* Ptr, IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision @@ -272,7 +272,7 @@ ParseAcpiGtdt ( UINT32 Offset; UINT8* TimerPtr; =20 - if (!Trace) { + if (!IS_TRACE_FLAG_SET (ParseFlags)) { return; } =20 diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/Iort= Parser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortPa= rser.c index f7447947b2308d35d4d2890373778f0fd2f97f9e..2f659349499a02175820ee4faf3= a84034c8ced76 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c @@ -1,7 +1,7 @@ /** @file IORT table parser =20 - Copyright (c) 2016 - 2020, ARM Limited. All rights reserved. + Copyright (c) 2016 - 2021, Arm Limited. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent =20 @par Reference(s): @@ -612,7 +612,7 @@ DumpIortNodePmcg ( =20 This function also performs validation of the ACPI table fields. =20 - @param [in] Trace If TRUE, trace the ACPI fields. + @param [in] ParseFlags Flags describing what the parser needs to= do. @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. @@ -620,7 +620,7 @@ DumpIortNodePmcg ( VOID EFIAPI ParseAcpiIort ( - IN BOOLEAN Trace, + IN UINT8 ParseFlags, IN UINT8* Ptr, IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision @@ -630,7 +630,7 @@ ParseAcpiIort ( UINT32 Index; UINT8* NodePtr; =20 - if (!Trace) { + if (!IS_TRACE_FLAG_SET (ParseFlags)) { return; } =20 diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/Madt= Parser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtPa= rser.c index 15aa2392b60cee9e3843c7c560b0ab84e0be4174..a29bf97a3985a74ff888f225eb0= e5cfbcbea72b0 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c @@ -1,7 +1,7 @@ /** @file MADT table parser =20 - Copyright (c) 2016 - 2020, ARM Limited. All rights reserved. + Copyright (c) 2016 - 2021, Arm Limited. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent =20 @par Reference(s): @@ -216,7 +216,7 @@ STATIC CONST ACPI_PARSER MadtInterruptControllerHeaderP= arser[] =3D { =20 This function also performs validation of the ACPI table fields. =20 - @param [in] Trace If TRUE, trace the ACPI fields. + @param [in] ParseFlags Flags describing what the parser needs to= do. @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. @@ -224,7 +224,7 @@ STATIC CONST ACPI_PARSER MadtInterruptControllerHeaderP= arser[] =3D { VOID EFIAPI ParseAcpiMadt ( - IN BOOLEAN Trace, + IN UINT8 ParseFlags, IN UINT8* Ptr, IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision @@ -236,7 +236,7 @@ ParseAcpiMadt ( =20 GICDCount =3D 0; =20 - if (!Trace) { + if (!IS_TRACE_FLAG_SET (ParseFlags)) { return; } =20 diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Mcfg/Mcfg= Parser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Mcfg/McfgPa= rser.c index 9da4d60e849721ed3b635bfff8a3bd76728c0ade..febf8a2bd92d8e38bdc59a3f97a= 8c4485cdba5a5 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Mcfg/McfgParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Mcfg/McfgParser.c @@ -1,7 +1,7 @@ /** @file MCFG table parser =20 - Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. + Copyright (c) 2016 - 2021, Arm Limited. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent =20 @par Reference(s): @@ -42,7 +42,7 @@ STATIC CONST ACPI_PARSER PciCfgSpaceBaseAddrParser[] =3D { =20 This function also performs validation of the ACPI table fields. =20 - @param [in] Trace If TRUE, trace the ACPI fields. + @param [in] ParseFlags Flags describing what the parser needs to= do. @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. @@ -50,7 +50,7 @@ STATIC CONST ACPI_PARSER PciCfgSpaceBaseAddrParser[] =3D { VOID EFIAPI ParseAcpiMcfg ( - IN BOOLEAN Trace, + IN UINT8 ParseFlags, IN UINT8* Ptr, IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision @@ -60,7 +60,7 @@ ParseAcpiMcfg ( UINT32 PciCfgOffset; UINT8* PciCfgSpacePtr; =20 - if (!Trace) { + if (!IS_TRACE_FLAG_SET (ParseFlags)) { return; } =20 diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/Pptt= Parser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/PpttPa= rser.c index acd2b81bb3258c7322aa10d2c0e0d842d89e358b..538b6a69350d75ccbf36b86fff1= 15255e77437c7 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/PpttParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/PpttParser.c @@ -1,7 +1,7 @@ /** @file PPTT table parser =20 - Copyright (c) 2019 - 2020, ARM Limited. All rights reserved. + Copyright (c) 2019 - 2021, Arm Limited. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent =20 @par Reference(s): @@ -241,13 +241,15 @@ STATIC CONST ACPI_PARSER IdStructureParser[] =3D { /** This function parses the Processor Hierarchy Node Structure (Type 0). =20 - @param [in] Ptr Pointer to the start of the Processor Hierarchy Node - Structure data. - @param [in] Length Length of the Processor Hierarchy Node Structure. + @param [in] ParseFlags Flags describing what the parser needs to do. + @param [in] Ptr Pointer to the start of the Processor Hierarchy= Node + Structure data. + @param [in] Length Length of the Processor Hierarchy Node Structur= e. **/ STATIC VOID DumpProcessorHierarchyNodeStructure ( + IN UINT8 ParseFlags, IN UINT8* Ptr, IN UINT8 Length ) @@ -257,7 +259,7 @@ DumpProcessorHierarchyNodeStructure ( CHAR16 Buffer[OUTPUT_FIELD_COLUMN_WIDTH]; =20 Offset =3D ParseAcpi ( - TRUE, + IS_TRACE_FLAG_SET (ParseFlags), 2, "Processor Hierarchy Node Structure", Ptr, @@ -315,18 +317,20 @@ DumpProcessorHierarchyNodeStructure ( /** This function parses the Cache Type Structure (Type 1). =20 - @param [in] Ptr Pointer to the start of the Cache Type Structure dat= a. - @param [in] Length Length of the Cache Type Structure. + @param [in] ParseFlags Flags describing what the parser needs to do. + @param [in] Ptr Pointer to the start of the Cache Type Structure= data. + @param [in] Length Length of the Cache Type Structure. **/ STATIC VOID DumpCacheTypeStructure ( + IN UINT8 ParseFlags, IN UINT8* Ptr, IN UINT8 Length ) { ParseAcpi ( - TRUE, + IS_TRACE_FLAG_SET (ParseFlags), 2, "Cache Type Structure", Ptr, @@ -338,18 +342,20 @@ DumpCacheTypeStructure ( /** This function parses the ID Structure (Type 2). =20 - @param [in] Ptr Pointer to the start of the ID Structure data. - @param [in] Length Length of the ID Structure. + @param [in] ParseFlags Flags describing what the parser needs to= do. + @param [in] Ptr Pointer to the start of the ID Structure = data. + @param [in] Length Length of the ID Structure. **/ STATIC VOID DumpIDStructure ( + IN UINT8 ParseFlags, IN UINT8* Ptr, - IN UINT8 Length + IN UINT8 Length ) { ParseAcpi ( - TRUE, + IS_TRACE_FLAG_SET (ParseFlags), 2, "ID Structure", Ptr, @@ -370,7 +376,7 @@ DumpIDStructure ( =20 This function also performs validation of the ACPI table fields. =20 - @param [in] Trace If TRUE, trace the ACPI fields. + @param [in] ParseFlags Flags describing what the parser needs to= do. @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. @@ -378,7 +384,7 @@ DumpIDStructure ( VOID EFIAPI ParseAcpiPptt ( - IN BOOLEAN Trace, + IN UINT8 ParseFlags, IN UINT8* Ptr, IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision @@ -387,12 +393,12 @@ ParseAcpiPptt ( UINT32 Offset; UINT8* ProcessorTopologyStructurePtr; =20 - if (!Trace) { + if (!IS_TRACE_FLAG_SET (ParseFlags)) { return; } =20 Offset =3D ParseAcpi ( - TRUE, + IS_TRACE_FLAG_SET (ParseFlags), 0, "PPTT", Ptr, @@ -440,24 +446,29 @@ ParseAcpiPptt ( return; } =20 - PrintFieldName (2, L"* Structure Offset *"); - Print (L"0x%x\n", Offset); + if (IS_TRACE_FLAG_SET (ParseFlags)) { + PrintFieldName (2, L"* Structure Offset *"); + Print (L"0x%x\n", Offset); + } =20 switch (*ProcessorTopologyStructureType) { case EFI_ACPI_6_2_PPTT_TYPE_PROCESSOR: DumpProcessorHierarchyNodeStructure ( + ParseFlags, ProcessorTopologyStructurePtr, *ProcessorTopologyStructureLength ); break; case EFI_ACPI_6_2_PPTT_TYPE_CACHE: DumpCacheTypeStructure ( + ParseFlags, ProcessorTopologyStructurePtr, *ProcessorTopologyStructureLength ); break; case EFI_ACPI_6_2_PPTT_TYPE_ID: DumpIDStructure ( + ParseFlags, ProcessorTopologyStructurePtr, *ProcessorTopologyStructureLength ); diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/Rsdp= Parser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpPa= rser.c index f4a8732a7db7c437031f2a3d2f266b80eff17b4b..c98bc62719c3aef3381152ff243= 6cb1a29f98362 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c @@ -1,7 +1,7 @@ /** @file RSDP table parser =20 - Copyright (c) 2016 - 2019, ARM Limited. All rights reserved. + Copyright (c) 2016 - 2021, Arm Limited. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent =20 @par Reference(s): @@ -110,7 +110,7 @@ STATIC CONST ACPI_PARSER RsdpParser[] =3D { This function also performs a RAW dump of the ACPI table and validates the checksum. =20 - @param [in] Trace If TRUE, trace the ACPI fields. + @param [in] ParseFlags Flags describing what the parser needs to= do. @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. @@ -118,19 +118,19 @@ STATIC CONST ACPI_PARSER RsdpParser[] =3D { VOID EFIAPI ParseAcpiRsdp ( - IN BOOLEAN Trace, + IN UINT8 ParseFlags, IN UINT8* Ptr, IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision ) { - if (Trace) { + if (IS_TRACE_FLAG_SET (ParseFlags)) { DumpRaw (Ptr, AcpiTableLength); VerifyChecksum (TRUE, Ptr, AcpiTableLength); } =20 ParseAcpi ( - Trace, + IS_TRACE_FLAG_SET (ParseFlags), 0, "RSDP", Ptr, diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Slit/Slit= Parser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Slit/SlitPa= rser.c index e4625ee8b13907893a9b6990ecb956baf91cc3b9..20d2fb79a8ea6251b0e31b5370c= c400be9e1478f 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Slit/SlitParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Slit/SlitParser.c @@ -1,7 +1,7 @@ /** @file SLIT table parser =20 - Copyright (c) 2016 - 2019, ARM Limited. All rights reserved. + Copyright (c) 2016 - 2021, Arm Limited. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent =20 @par Reference(s): @@ -42,7 +42,7 @@ STATIC CONST ACPI_PARSER SlitParser[] =3D { - Relative distance from System Locality at i*N+j is same as j*N+i =20 - @param [in] Trace If TRUE, trace the ACPI fields. + @param [in] ParseFlags Flags describing what the parser needs to= do. @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. @@ -50,7 +50,7 @@ STATIC CONST ACPI_PARSER SlitParser[] =3D { VOID EFIAPI ParseAcpiSlit ( - IN BOOLEAN Trace, + IN UINT8 ParseFlags, IN UINT8* Ptr, IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision @@ -63,7 +63,7 @@ ParseAcpiSlit ( UINT8* LocalityPtr; CHAR16 Buffer[80]; // Used for AsciiName param of ParseAcpi =20 - if (!Trace) { + if (!IS_TRACE_FLAG_SET (ParseFlags)) { return; } =20 diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Spcr/Spcr= Parser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Spcr/SpcrPa= rser.c index 3b06b05dee8c056c6e009b9e485ccd35d4194e95..99cffafa946979b79a06cd28f14= 257beaa6cafec 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Spcr/SpcrParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Spcr/SpcrParser.c @@ -1,7 +1,7 @@ /** @file SPCR table parser =20 - Copyright (c) 2016 - 2019, ARM Limited. All rights reserved. + Copyright (c) 2016 - 2021, Arm Limited. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent =20 @par Reference(s): @@ -114,7 +114,7 @@ STATIC CONST ACPI_PARSER SpcrParser[] =3D { =20 This function also performs validations of the ACPI table fields. =20 - @param [in] Trace If TRUE, trace the ACPI fields. + @param [in] ParseFlags Flags describing what the parser needs to= do. @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. @@ -122,13 +122,13 @@ STATIC CONST ACPI_PARSER SpcrParser[] =3D { VOID EFIAPI ParseAcpiSpcr ( - IN BOOLEAN Trace, + IN UINT8 ParseFlags, IN UINT8* Ptr, IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision ) { - if (!Trace) { + if (!IS_TRACE_FLAG_SET (ParseFlags)) { return; } =20 diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/Srat= Parser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratPa= rser.c index b9b67820b89f7fc5560a1022e976663db7d9df2d..907856368fbe0ad9f140d8f27e5= 1bd9460f35b1a 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c @@ -1,7 +1,7 @@ /** @file SRAT table parser =20 - Copyright (c) 2016 - 2020, ARM Limited. All rights reserved. + Copyright (c) 2016 - 2021, Arm Limited. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent =20 @par Reference(s): @@ -344,7 +344,7 @@ STATIC CONST ACPI_PARSER SratX2ApciAffinityParser[] =3D= { =20 This function also performs validation of the ACPI table fields. =20 - @param [in] Trace If TRUE, trace the ACPI fields. + @param [in] ParseFlags Flags describing what the parser needs to= do. @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. @@ -352,7 +352,7 @@ STATIC CONST ACPI_PARSER SratX2ApciAffinityParser[] =3D= { VOID EFIAPI ParseAcpiSrat ( - IN BOOLEAN Trace, + IN UINT8 ParseFlags, IN UINT8* Ptr, IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision @@ -375,7 +375,7 @@ ParseAcpiSrat ( ApicSapicAffinityIndex =3D 0; X2ApicAffinityIndex =3D 0; =20 - if (!Trace) { + if (!IS_TRACE_FLAG_SET (ParseFlags)) { return; } =20 diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Ssdt/Ssdt= Parser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Ssdt/SsdtPa= rser.c index f18664b8a6879b82dc9c55d9979ca21e01c4fc99..138a3159fb1a6121387f832621d= 23960c688ce30 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Ssdt/SsdtParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Ssdt/SsdtParser.c @@ -1,7 +1,7 @@ /** @file SSDT table parser =20 - Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. + Copyright (c) 2016 - 2021, Arm Limited. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent =20 @par Reference(s): @@ -20,7 +20,7 @@ For the SSDT table only the ACPI header fields are parsed and traced. =20 - @param [in] Trace If TRUE, trace the ACPI fields. + @param [in] ParseFlags Flags describing what the parser needs to= do. @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. @@ -28,13 +28,13 @@ VOID EFIAPI ParseAcpiSsdt ( - IN BOOLEAN Trace, + IN UINT8 ParseFlags, IN UINT8* Ptr, IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision ) { - if (!Trace) { + if (!IS_TRACE_FLAG_SET (ParseFlags)) { return; } =20 diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Xsdt/Xsdt= Parser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Xsdt/XsdtPa= rser.c index e39061f8e2612f2cce4aebf51a511b63b703662b..bbd58d72ad9c676b4843d3b4f1d= 7c554a5abbd3f 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Xsdt/XsdtParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Xsdt/XsdtParser.c @@ -1,7 +1,7 @@ /** @file XSDT table parser =20 - Copyright (c) 2016 - 2019, ARM Limited. All rights reserved. + Copyright (c) 2016 - 2021, Arm Limited. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent =20 @par Reference(s): @@ -40,7 +40,7 @@ GetAcpiXsdtHeaderInfo ( =20 This function also performs validation of the XSDT table. =20 - @param [in] Trace If TRUE, trace the ACPI fields. + @param [in] ParseFlags Flags describing what the parser needs to= do. @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. @@ -48,7 +48,7 @@ GetAcpiXsdtHeaderInfo ( VOID EFIAPI ParseAcpiXsdt ( - IN BOOLEAN Trace, + IN UINT8 ParseFlags, IN UINT8* Ptr, IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision @@ -61,7 +61,7 @@ ParseAcpiXsdt ( CHAR16 Buffer[32]; =20 Offset =3D ParseAcpi ( - Trace, + IS_TRACE_FLAG_SET (ParseFlags), 0, "XSDT", Ptr, @@ -71,7 +71,7 @@ ParseAcpiXsdt ( =20 TableOffset =3D Offset; =20 - if (Trace) { + if (IS_TRACE_FLAG_SET (ParseFlags)) { EntryIndex =3D 0; TablePointer =3D (UINT64*)(Ptr + TableOffset); while (Offset < AcpiTableLength) { --=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 (#80815): https://edk2.groups.io/g/devel/message/80815 Mute This Topic: https://groups.io/mt/85653267/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 Mon May 6 21:26:13 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+80813+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 1631803584005370.63324698393444; Thu, 16 Sep 2021 07:46:24 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id AUIjYY1788612xqZtbbsXLpS; Thu, 16 Sep 2021 07:46:23 -0700 X-Received: from EUR03-AM5-obe.outbound.protection.outlook.com (EUR03-AM5-obe.outbound.protection.outlook.com [40.107.3.46]) by mx.groups.io with SMTP id smtpd.web08.225.1631803580842709204 for ; Thu, 16 Sep 2021 07:46:21 -0700 X-Received: from AM5PR0701CA0066.eurprd07.prod.outlook.com (2603:10a6:203:2::28) by DB8PR08MB3947.eurprd08.prod.outlook.com (2603:10a6:10:ae::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.15; Thu, 16 Sep 2021 14:46:16 +0000 X-Received: from VE1EUR03FT032.eop-EUR03.prod.protection.outlook.com (2603:10a6:203:2:cafe::61) by AM5PR0701CA0066.outlook.office365.com (2603:10a6:203:2::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.6 via Frontend Transport; Thu, 16 Sep 2021 14:46:16 +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+80813+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 VE1EUR03FT032.mail.protection.outlook.com (10.152.18.121) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.14 via Frontend Transport; Thu, 16 Sep 2021 14:46:15 +0000 X-Received: ("Tessian outbound a8bfe25d7364:v103"); Thu, 16 Sep 2021 14:46:15 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 34271058d2fed4d7 X-CR-MTA-TID: 64aa7808 X-Received: from 497e6df1c115.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 39D8C5CE-8B1E-4B3B-A319-A493E076D030.1; Thu, 16 Sep 2021 14:46:08 +0000 X-Received: from EUR02-AM5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 497e6df1c115.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 16 Sep 2021 14:46:08 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BUY54hCd1OgKc7/yF8qc89eeSSSgd2WOmynYK9817wIhuhf933sWAmI8Iwijr3TmsYEKfFQaY0dsGw9MPsXRuY7LELkg5fRKZ9/c6uo6gHeUN09WIl/8lvWfwtzDzcH2BLmhWRdm9EO5q0gZ+iO7Vd0LzGC5y2trRKnOPZrkwy34e1gz4KAkIk2XBM2GVsaq2h6rCWmBwH2k6QZ6q7WT16t/KtCT0RTbN5OCwhFgeYEw4lAmWoxoLk1zzpNbpeABMWC163CF/XlkdieYKzeU2qp7f/VBdwzuHdVRHgBRG8TjvY2N4ud1cUF/p57VMcSNr7Ayh8PekL7UQQ14RVmPiQ== 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; bh=Ot8rS2CH5oi1pRCwtzcdnx2Jbv1StEdTtchFe/5eFAQ=; b=Ftt988BK5eNpdLn68/f8/1HBqEQ31Pic3yC/EQt7P2O8ZotqAWN0NvgiwxybrJ820fnpseo+ChI67ZkDRKDTwiMGf5XXDTbPxHOb22Z0W/zaboES/8j0eqYQ1BCVpxlNLVMveJkSsan5G8mkEXjVyscUYzX2SHK9cKf1iWeHaY2K7cf9hTG+EQbOSQIZMOReJomT4YPQDNvaojw5USZ39eUB2Nhoecsaqdm9s6rb2Iojf6RSnQNxAqe7IcfVkDUnpT3nojNKH21xB2U0mz9EdU+IKKufiiLVpdlltUNQ65vVNEJzCkrP9bD1j5+UKqf9no2ewvkVOCgHIbji/eYpbA== 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 DU2PR04CA0233.eurprd04.prod.outlook.com (2603:10a6:10:2b1::28) by DBAPR08MB5750.eurprd08.prod.outlook.com (2603:10a6:10:1a6::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.14; Thu, 16 Sep 2021 14:46:07 +0000 X-Received: from DB5EUR03FT020.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:2b1:cafe::ee) by DU2PR04CA0233.outlook.office365.com (2603:10a6:10:2b1::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.16 via Frontend Transport; Thu, 16 Sep 2021 14:46:07 +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 DB5EUR03FT020.mail.protection.outlook.com (10.152.20.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4523.14 via Frontend Transport; Thu, 16 Sep 2021 14:46:07 +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.2308.14; Thu, 16 Sep 2021 14:46:14 +0000 X-Received: from e124191.cambridge.arm.com (10.11.7.12) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2308.14 via Frontend Transport; Thu, 16 Sep 2021 14:46:14 +0000 From: "Joey Gouly" To: CC: , , , , Subject: [edk2-devel] [PATCH v2 2/5] ShellPkg: add a helper function for getting a new file name Date: Thu, 16 Sep 2021 15:46:02 +0100 Message-ID: <20210916144605.42071-3-joey.gouly@arm.com> In-Reply-To: <20210916144605.42071-1-joey.gouly@arm.com> References: <20210916144605.42071-1-joey.gouly@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1580bfde-ea2e-4b03-f974-08d97920bc96 X-MS-TrafficTypeDiagnostic: DBAPR08MB5750:|DB8PR08MB3947: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:473;OLM:473; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: jHNytOYcfS2/AN/Vjc5KkIjGuOtGc6jF2rinu4eWbhVxx0Zq4YzNmpy893tJXOE5S9Dq7/fZ+Qs8P815EHia/TSeyJLDGVwGwtjIVEmQ+/J0KP+zEMTkWJnuXJpxBZPMz68ceIq6bFATIWhM5hrNwIcBKkt9xGv/mV+Er82Kutm8UbVaxXmIuxrPYlchz0WJ3kJz7HVtqtUatmzDWN80LSC3NEnI5Ee5OGQi1DtfmWpczmPCaWQXiAML9M1cqDoPtrY+i9kOJv+HuWMrvX02PIpA12ylFvulr+6yWQ4m4h/8uBp7yMLHRO6xm7nz/9AoS2/FO/04/+fvHnmcgbiuZ6bBRdsvEvng2/Y3d/fMTk8eJWtCbPUgcd3+S2ozxpCKYm2I3uBwUVTQX2wZ7yOBq4MNEX/vsP6wtgKbeBDD2k1otM8BvCdy93DtybOLgN18XgQBtiiIaLKcgEOCGXu65FLBLVwdWaY3kf2Imo4wGdBU6Mkq7Ozd1I5uOkiaKxSWs3yWJDoR8fLSKpSYavdIlgL2dRqYzL3wznGQp90uhkLJ8RkHraLSvNlpC6hU5QGRjWlc8241gd/nbq5ppIb1syxzxPvBHjGHYw5WWZ5EPwm82ParU8lMyt0M6uTYKWTHyHcoVrs4x9+F84tw1fE07K51npwiteS9IOyDPjLdFzBfAM34YeF1rcXr5vf+4d158bGyzPOfllMFBF3FfNUc++mJuoxewKS4myjsvQP5Rdvzpsbp6lty+XhebrKE5ilr+SVxb5rgY29tJWORmlQU9FkewSPg9b2dQnYUc+V2E2JmUEUfNC3YaRMjyGeb/VZA 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)(376002)(396003)(39860400002)(136003)(346002)(36840700001)(46966006)(2616005)(70206006)(36860700001)(6916009)(70586007)(1076003)(4326008)(2906002)(426003)(47076005)(336012)(82310400003)(83380400001)(316002)(8676002)(36756003)(478600001)(356005)(6666004)(81166007)(8936002)(7696005)(82740400003)(5660300002)(26005)(86362001)(54906003)(186003)(44832011)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR08MB5750 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT032.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 00ea9306-ab95-4f6c-c92c-08d97920b779 X-Microsoft-Antispam-Message-Info: /9D4/XVflPEXi41eAC8BqmlNuUf1ji9jvJvmBwGiV0aDoF7sfvCG3rSfm/gCu3a65fXVBMJsDhNNG94TUVZieaMB7xe38QmUPhrMvvzf73rrf/+S1KDO0Mfb2iA56sFUqKUhcWEWI/F3ZWPMQlHyIg6/NSEgkr1a6/cO+H7wfpk3xPh5Xd2Cne5tV+qtB4aWx9lajPwuDoPBc7FskK9jmr+AK5Ww7KbcZ6ABTVjEXRxqgPlTvC6DnK7xA14Ro0nyh4LpdsEXQ1H+rSIZA9iJ63OXRbSNG0moRINUhQybqznyY6su0+Mhs8lVPKB5OdGBefG55LsUv/b/nQwlu39wvCfSkbMDz67M6OLrJi7NCGFQOHABCmbti3UDyYCMhTrjbpzMoa0tBHcO0unJYVzgnK5E0w3qQf/LwemSdHTavvgztxWArDzoH7agmm5RdvtEDDKz3ue2f1MfGvl2qnqc89r7BVP2q29Jz6lncwZ8za9dovBkwzvKxQXYb9mTj+GCWkxRpxi1AcmZKdWP5ORfmVaEeRlQWIij+sdaK4nX5zsp3XCO3vtJkvn0SRruCcOWAFXhzRp8O3iDckt9RbZdfXkaVnMOJY4n8OsTg52fURVrFlgF5pAukJX3U3M7JPmY/5R1NgjM/IonL5Asr/OapmHD/hgg1NxXKOkwfuktHJzZuVZdF8Qx0IJtYyYLBj0F7U+CEkg2ipL4ZnQ6j7JO/qelOf1YpmsQasBkCNSvYJmrsBgPFsqJ9qwG+fO1MkQNMXkZwGnGpWeXRmZZPRCF1nezipNGMMClts3MVB51JBc= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Sep 2021 14:46:15.8501 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1580bfde-ea2e-4b03-f974-08d97920bc96 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: VE1EUR03FT032.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR08MB3947 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: 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,joey.gouly@arm.com X-Gm-Message-State: 5XBMrI95gILgpI68GwtrQv9hx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1631803583; bh=WGTTMhn1duhe7xgr0w+AJhYgjrDyQSbaGwL3jmvIaBw=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=ITT3KdCh6PYAbo4v+/40lalF3wAYfoHOHuhaFCbr2h5IFgSz2a/+8i6lin5GXioH3sA 9J5+6ZtdE6Vb7nvqNF7qQgs7UGluEjKJoaNObypKbPxKN1wjY6bZn6c69Pv6vc94n90Iu YzXKU9ZxWs33IOmTPqVCqzM58RkMz+bSFjg= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1631803585954100005 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Marc Moisson-Franckhauser Bugzilla: 3378 (https://bugzilla.tianocore.org/show_bug.cgi?id=3D3378) This new helper will not overwrite existing files, by appending a number to the end of the filename. Signed-off-by: Joey Gouly --- ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h | 25 +++++- ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c | 80 +++++++++++++= +++---- 2 files changed, 91 insertions(+), 14 deletions(-) diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h b/Shel= lPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h index d5b95f5ee707de18be1879b3cd235d6c5db11d9f..ae8a67b7681033d66d068341ae4= 89ded67de8b44 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h @@ -1,12 +1,13 @@ /** @file Header file for AcpiView =20 - Copyright (c) 2016 - 2020, ARM Limited. All rights reserved. + Copyright (c) 2016 - 2021, Arm Limited. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent **/ =20 #ifndef ACPIVIEW_H_ #define ACPIVIEW_H_ +#include =20 /** A macro to define the max file name length @@ -23,6 +24,28 @@ **/ #define RSDP_LENGTH_OFFSET 20 =20 +/** + This function finds a filename not already used by adding a number in be= tween + the BaseFileName and the extension. + + Make sure the buffer FileName is big enough before calling the function.= A + size of MAX_FILE_NAME_LEN is recommended. + + @param [in] BaseFileName Start of the desired file name. + @param [in] Extension Extension of the desired file name + (without '.'). + @param [in, out] FileName Preallocated buffer for the returned = file + name. + @param [in] FileNameBufferLen Size of FileName buffer.. +**/ +EFI_STATUS +GetNewFileName ( + IN CONST CHAR16* BaseFileName, + IN CONST CHAR16* Extension, + IN OUT CHAR16* FileName, + IN UINT32 FileNameBufferLen + ); + /** This function resets the ACPI table error counter to Zero. **/ diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c b/Shel= lPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c index a4242ba9d99b05d07c829520c4011439445aadb0..db7b2e2a30525cc85a333b93f5e= b97ec3a517b37 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c @@ -27,8 +27,55 @@ #include "Arm/SbbrValidator.h" #endif =20 -STATIC UINT32 mTableCount; -STATIC UINT32 mBinTableCount; +STATIC UINT32 mTableCount; + +/** + This function finds a filename not already used by adding a number in be= tween + The BaseFileName and the extension. + + Make sure the buffer FileName is big enough before calling the function.= A + size of MAX_FILE_NAME_LEN is recommended. + + @param [in] BaseFileName Start of the desired file name. + @param [in] Extension Extension of the desired file name + (without '.'). + @param [in, out] FileName Preallocated buffer for the returned = file + name. + @param [in] FileNameBufferLen Size of FileName buffer.. +**/ +EFI_STATUS +GetNewFileName ( + IN CONST CHAR16* BaseFileName, + IN CONST CHAR16* Extension, + IN OUT CHAR16* FileName, + IN UINT32 FileNameBufferLen + ) +{ + UINT16 Index; + EFI_STATUS Status; + SHELL_FILE_HANDLE tmpFileHandle; + for (Index =3D 0; Index <=3D 99; Index++) { + UnicodeSPrint( + FileName, + FileNameBufferLen, + L"%s%02d.%s", + BaseFileName, + Index, + Extension + ); + Status =3D ShellOpenFileByName ( + FileName, + &tmpFileHandle, + EFI_FILE_MODE_READ, + 0 + ); + if (Status =3D=3D EFI_NOT_FOUND) { + return EFI_SUCCESS; + } + ShellCloseFile (&tmpFileHandle); + } + return EFI_OUT_OF_RESOURCES; +} =20 /** This function dumps the ACPI table to a file. @@ -46,19 +93,27 @@ DumpAcpiTableToFile ( IN CONST UINTN Length ) { - CHAR16 FileNameBuffer[MAX_FILE_NAME_LEN]; - UINTN TransferBytes; - SELECTED_ACPI_TABLE *SelectedTable; + CHAR16 FileNameBuffer[MAX_FILE_NAME_LEN]; + UINTN TransferBytes; + EFI_STATUS Status; + SELECTED_ACPI_TABLE* SelectedTable; =20 GetSelectedAcpiTable (&SelectedTable); =20 - UnicodeSPrint ( - FileNameBuffer, - sizeof (FileNameBuffer), - L".\\%s%04d.bin", - SelectedTable->Name, - mBinTableCount++ - ); + Status =3D GetNewFileName ( + SelectedTable->Name, + L"bin", + FileNameBuffer, + sizeof (FileNameBuffer) + ); + if (EFI_ERROR (Status)) { + Print ( + L"Error: Could not open bin file for %s table:\n" + L"Could not get a file name.", + SelectedTable->Name + ); + return FALSE; + } =20 Print (L"Dumping ACPI table to : %s ... ", FileNameBuffer); =20 @@ -207,7 +262,6 @@ AcpiView ( =20 // Reset Table counts mTableCount =3D 0; - mBinTableCount =3D 0; =20 // Reset The error/warning counters ResetErrorCount (); --=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 (#80813): https://edk2.groups.io/g/devel/message/80813 Mute This Topic: https://groups.io/mt/85653265/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 Mon May 6 21:26:13 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+80817+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 163180358689768.68311816912399; Thu, 16 Sep 2021 07:46:26 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 9fYSYY1788612xYwCYRUe6ZV; Thu, 16 Sep 2021 07:46:26 -0700 X-Received: from EUR05-DB8-obe.outbound.protection.outlook.com (EUR05-DB8-obe.outbound.protection.outlook.com [40.107.20.89]) by mx.groups.io with SMTP id smtpd.web11.220.1631803585504452343 for ; Thu, 16 Sep 2021 07:46:26 -0700 X-Received: from DU2PR04CA0181.eurprd04.prod.outlook.com (2603:10a6:10:28d::6) by DB9PR08MB6329.eurprd08.prod.outlook.com (2603:10a6:10:25a::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.16; Thu, 16 Sep 2021 14:46:18 +0000 X-Received: from DB5EUR03FT047.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:28d:cafe::fd) by DU2PR04CA0181.outlook.office365.com (2603:10a6:10:28d::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.16 via Frontend Transport; Thu, 16 Sep 2021 14:46:18 +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+80817+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 DB5EUR03FT047.mail.protection.outlook.com (10.152.21.232) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.14 via Frontend Transport; Thu, 16 Sep 2021 14:46:18 +0000 X-Received: ("Tessian outbound b9598e0ead92:v103"); Thu, 16 Sep 2021 14:46:18 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 7476b39b99024f61 X-CR-MTA-TID: 64aa7808 X-Received: from b3957123ee04.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id B32F022C-5459-44C5-88A0-E792003B5756.1; Thu, 16 Sep 2021 14:46:11 +0000 X-Received: from EUR04-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id b3957123ee04.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 16 Sep 2021 14:46:11 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Yflo+7Ngi5R5F8Nx3u0DzaOLXseysSrlx4qVtSpAdpjVrlYl/v47B8ys/YQ/2yW9++mCFdRStHYmHrUKkrKblN2pE0lnsZapEByB3C6d7+R7/Qq+5UABxWDe1OT36/FnhMjNfAgLhAkiPV6/m7o3oLYTBS42hc5/K23rh+FVi/IvgtyvclKJrKSUoCfyBDc2FlR8Zj8NyXwnrUTCt4FIBVANOOTku6NpRR+Ery9EIO1oY5cn5Crviz+ASIE94IVTCuE+DPWkwtyev/bN55caJWjo7XKZydrTFcw3rmQiSEKiu4XGQkViOBa4nFGuUqUyHREOvF6cymYdMPgTxVNF4w== 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; bh=uW68lwuFaSu1Z48o7pdg6P3V/E1/2HQF3+zjc9kIaMs=; b=nGmkJeGtciBNrCLvwdfIddSeU8rWLp7OxNH2d0j2UnXB4NEKsuJ51uCVWfqxUdhM3hWdg5PTwUqnkKsew5QUO9ex3jXOkUKlmX31QxR1yqIhGZ8EKbZOhvZ33z+FT15E9ndwUDc0c7DNLNZqpBIf49l489P+Cmgm7UVabnYADiywMx3GuF1H5PfQDM47b29f8jTzMoqnUMOoCbf+E7iBz85F+p1JAsWmopYe7WzWLR8koY+4FNEZZJVC4MXeTcdA8YQ0yaTu+vZ0JPSiXj8449i/oTFdNb6xS3XXHGoRY3/zN/w/6OrZiVScEiXrIBtyQE3gCi+01R1bg1OcE0pSiQ== 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 DU2PR04CA0233.eurprd04.prod.outlook.com (2603:10a6:10:2b1::28) by DB6PR0802MB2581.eurprd08.prod.outlook.com (2603:10a6:4:a1::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.14; Thu, 16 Sep 2021 14:46:07 +0000 X-Received: from DB5EUR03FT020.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:2b1:cafe::4b) by DU2PR04CA0233.outlook.office365.com (2603:10a6:10:2b1::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.16 via Frontend Transport; Thu, 16 Sep 2021 14:46:07 +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 DB5EUR03FT020.mail.protection.outlook.com (10.152.20.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4523.14 via Frontend Transport; Thu, 16 Sep 2021 14:46:07 +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.2308.14; Thu, 16 Sep 2021 14:46:14 +0000 X-Received: from e124191.cambridge.arm.com (10.11.7.12) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2308.14 via Frontend Transport; Thu, 16 Sep 2021 14:46:14 +0000 From: "Joey Gouly" To: CC: , , , , Subject: [edk2-devel] [PATCH v2 3/5] ShellPkg: add a Graph option to the Parser Flags Date: Thu, 16 Sep 2021 15:46:03 +0100 Message-ID: <20210916144605.42071-4-joey.gouly@arm.com> In-Reply-To: <20210916144605.42071-1-joey.gouly@arm.com> References: <20210916144605.42071-1-joey.gouly@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 94ff2c19-3b50-42d2-1abc-08d97920be4c X-MS-TrafficTypeDiagnostic: DB6PR0802MB2581:|DB9PR08MB6329: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:1051;OLM:1051; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: Q4i/lhMMf8on/4C8nkkpxDnsq2K9qooDU1RiYVc9F58852pWswxVHMlkC5e5uj4XE9m7UAl0F3ynipky0JYTAcco1EP/Bid8qH8eIl6ZtciVwykQ/up+X49sJqDXoV1ZK2JW0bNZDFpmIQcJifADly5DL6hoVEodE3ZSqasNvDyFo6lXzW1KqqPeuJW+ys6iFhs4nnlu0oyrR9IZ9Otb8rl7FMZMishTTUckqkMxLYcsOHZPZXIuWzY0xb1nY+wXMm7EI/1U1m53yvVKBfYmYlugZnA0t/dSL+SU22RioBWOjnQjI1IvkWYzOA/pdhtp+WRJ3sNzlTnwiHsXtZbZxsBMvcBG35UwJFadECdNSVRZXNETvj0/EbO/E2Cl9FmwjANqchYv3EPud7yobrk01kCBD0CsZsNthk+zcx6hzGIl99OSjGi5N5JedOk7FAhYQRRAw/20/MuMDLKLWRRu0mkCqE3A5ivwiE3R/oSzhjQnxisrMBssNygjAGn9LxhmxU2QBNbWOWzqNy6YXxHcLWXinEpqM2N9RYnggSFs8YimkA3uzVEY4u9lw2PbMN+h1JRIp2uaAiJW+spnQfAOVA0ss3h1qbZNhsG/UFm17xaqTWprTmLcCEVStCM+rIs+eQQAHlBowlbAJLg7m2w1Rj3+i//E55CMmcr+rk33z6UcuZLYXKT7rxP1y2ESEu67H593crOzO6F6FgHpSw8hyuAlGe3nhJJcILf3Sru3rUhK+7QiNlAsQrVEkXlzl52evvwsds0Ty1V2yPlOasaD8KmtO1+JjMjGSrnn/b5Y4+23IcWl/AVjTUkBpFkygyI+ 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)(39860400002)(136003)(376002)(396003)(346002)(36840700001)(46966006)(81166007)(2616005)(4326008)(7696005)(356005)(186003)(26005)(44832011)(2906002)(54906003)(426003)(82740400003)(336012)(316002)(47076005)(36756003)(478600001)(8936002)(36860700001)(1076003)(83380400001)(5660300002)(70206006)(70586007)(6916009)(82310400003)(86362001)(8676002)(6666004)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0802MB2581 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT047.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 5fd484fa-140a-4b27-0725-08d97920b7bf X-Microsoft-Antispam-Message-Info: DJjvHuCBcpfZ88StqaxlWJQZO9BTDFgT96nOsAWqFQXh6czjA8S6YBDnDfuug9TAoUEVs0WJ6V5aL49sCsBadzRxQgImKBzZnCkPhbX94CSJn48ZJ8JTYgaNFC6tnjd4elzrWBPdofW/+kXSfBERoaTk38nJY8XIMepXXOzGB0b8Kvi6QiYODExHVBmfwpz99FYpZPeaTCN8oXsMhCtoAmexsqiFga5f0yQYW8M8vEuPjx8jXSZxkZxAFnP9lvGwPPmDxH8TDqNs92wQfZJ38waIgRO2HOgJWYt08AUCXo6Sf5k6QxaMveuIhy2VZLHDpVwdrfQTxv6xGSsCjs5/sxGNSpxB0L5aVaHlmPE3HEMxtIPxa3HDKfcBY5d1zxpW7NXSiyJpg3YmokjI3onQbmoYFWfbZiUpYpb/2zBMh0zMNz0/bPOGDBH7q+jxnwAwQBmwmDvclTDr66zI2oA5A7y1IT3/INYobyhBGQSoTtkQEqgqjNbANaMPxfe7NSg4fFI9ROAhn+7wj6VsKMhJ0kF6mUIBTHKkweqOTbWMcmmtOcmJnl5kL3do0uV4SHhkDopgCADGR5YZJQwOnD3kHQxFB96oq3ekxOt+O2wWMxOdadilrOh7i/zRrqNyovisJISQsjwI75NlV7EhkBw2AfVvURPwx8AFCpKgQqcvUwTf8HpO8r1NI9xwfOa2K58qrUbE8pyOwlzUtYYxOq5nG5qf24zeoN+ePB9++uviuR7T3o4s48arme/j2TtTiBWmOxEpydeB1m8Gi6+180U5O1zRkY8nN2IOxRenVhPg/8E= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Sep 2021 14:46:18.8138 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 94ff2c19-3b50-42d2-1abc-08d97920be4c 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: DB5EUR03FT047.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB6329 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: 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,joey.gouly@arm.com X-Gm-Message-State: KI43yGMqRHs4emMQv7LSkTdPx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1631803586; bh=rsDbJE+E8HC5ZDAVJJKvH2/X7B8yBBuwEyfrTCSKaac=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=cK7ekDR81L6Ci9y8quuBARKlQ0MTrKBlJFINVPYH3BvfUFbVVy1cWOe/tBf+7gFivyx SZyIa1g4Bawelddpk8wXN7pR4Dols784VxgN6GXlpCkjRrZ5ukzqss8dOUYooszFxMib3 c3ZaJr6igOt30ABjSbdlU4+XLqoeYABHboI= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1631803588684100002 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Marc Moisson-Franckhauser Bugzilla: 3378 (https://bugzilla.tianocore.org/show_bug.cgi?id=3D3378) This option informs the parser to generate a dot graph of a table. This can be useful to understand or debug a table, such as the PPTT table. Signed-off-by: Joey Gouly --- ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h = | 2 ++ ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiViewConfig.h = | 3 ++- ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c = | 9 +++++++- ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.c= | 24 +++++++++++++++++--- ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.u= ni | 9 ++++++-- 5 files changed, 40 insertions(+), 7 deletions(-) diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h b/Sh= ellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h index b078c0b99335ba28f7589cac6b0a4190d9a6c3b5..9a67fe084327434bf21b37b3089= 779468edfb0f1 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h @@ -20,11 +20,13 @@ Flags for the parser. */ #define PARSE_FLAGS_TRACE BIT0 +#define PARSE_FLAGS_GRAPH BIT1 =20 /** Helper macros to test parser flags. */ #define IS_TRACE_FLAG_SET(Flags) (((Flags) & PARSE_FLAGS_TRACE) !=3D 0) +#define IS_GRAPH_FLAG_SET(Flags) (((Flags) & PARSE_FLAGS_GRAPH) !=3D 0) =20 /** This function increments the ACPI table error counter. diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiViewConfig.h = b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiViewConfig.h index 2db4a65415d8f9e70686cb2cc432862ab4e4c2dd..262302a15cbbe04a228fd55e523= 930fb76bcf6a8 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiViewConfig.h +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiViewConfig.h @@ -1,7 +1,7 @@ /** @file Header file for 'acpiview' configuration. =20 - Copyright (c) 2016 - 2020, ARM Limited. All rights reserved.
+ Copyright (c) 2016 - 2021, Arm Limited. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent **/ =20 @@ -106,6 +106,7 @@ typedef enum { ReportSelected, ///< Report Selected table. ReportTableList, ///< Report List of tables. ReportDumpBinFile, ///< Dump selected table to a file. + ReportDotGraph, ///< Create Dot Graph for selected compatible table. ReportMax, } EREPORT_OPTION; =20 diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c b/Shel= lPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c index db7b2e2a30525cc85a333b93f5eb97ec3a517b37..1155b2f3f411247c866f635fb66= 6dd76455f18a4 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c @@ -192,6 +192,12 @@ ProcessTableReportOptions ( DumpAcpiTableToFile (TablePtr, Length); } break; + case ReportDotGraph: + if (Signature =3D=3D SelectedTable->Type) { + SelectedTable->Found =3D TRUE; + ParseFlags |=3D PARSE_FLAGS_GRAPH; + } + break; case ReportMax: // We should never be here. // This case is only present to prevent compiler warning. @@ -340,7 +346,8 @@ AcpiView ( =20 ReportOption =3D GetReportOption (); if (ReportTableList !=3D ReportOption) { - if (((ReportSelected =3D=3D ReportOption) || + if (((ReportSelected =3D=3D ReportOption) || + (ReportDotGraph =3D=3D ReportOption) || (ReportDumpBinFile =3D=3D ReportOption)) && (!SelectedTable->Found)) { Print (L"\nRequested ACPI Table not found.\n"); diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiView= CommandLib.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiVi= ewCommandLib.c index b30ed3fc8597b229dd15b6ad4f2aab2e3d0ca583..d837b390938f3c3bc5cb90c1161= e2feeb1ed6a6b 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 - 2021, Arm Limited. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent **/ =20 @@ -34,6 +34,7 @@ EFI_HII_HANDLE gShellAcpiViewHiiHandle =3D NULL; STATIC CONST SHELL_PARAM_ITEM ParamList[] =3D { {L"-q", TypeFlag}, {L"-d", TypeFlag}, + {L"-g", TypeFlag}, {L"-h", TypeFlag}, {L"-l", TypeFlag}, {L"-s", TypeValue}, @@ -293,6 +294,18 @@ ShellCommandRunAcpiView ( L"-d" ); ShellStatus =3D SHELL_INVALID_PARAMETER; + } else if (ShellCommandLineGetFlag (Package, L"-g") && + !ShellCommandLineGetFlag (Package, L"-s")) { + ShellPrintHiiEx ( + -1, + -1, + NULL, + STRING_TOKEN (STR_GEN_MISSING_OPTION), + gShellAcpiViewHiiHandle, + L"acpiview", + L"-s", + L"-g" + ); } else { // Turn on colour highlighting if requested SetColourHighlighting (ShellCommandLineGetFlag (Package, L"-h")); @@ -316,10 +329,15 @@ ShellCommandRunAcpiView ( SelectAcpiTable (SelectedTableName); SetReportOption (ReportSelected); =20 - if (ShellCommandLineGetFlag (Package, L"-d")) { + if (ShellCommandLineGetFlag (Package, L"-d") || + ShellCommandLineGetFlag (Package, L"-g")) { // Create a temporary file to check if the media is writable. CHAR16 FileNameBuffer[MAX_FILE_NAME_LEN]; - SetReportOption (ReportDumpBinFile); + if (ShellCommandLineGetFlag (Package, L"-d")) { + SetReportOption (ReportDumpBinFile); + } else { + SetReportOption (ReportDotGraph); + } =20 UnicodeSPrint ( FileNameBuffer, diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiView= CommandLib.uni b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpi= ViewCommandLib.uni index 393110e0ee98d54b3be0309c2d297a121c258570..51f2bea10f7b768e5e67f930237= 207193cba4246 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommand= Lib.uni +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommand= Lib.uni @@ -1,6 +1,6 @@ // /** // -// Copyright (c) 2016 - 2020, Arm Limited. All rights reserved.
+// Copyright (c) 2016 - 2021, Arm Limited. All rights reserved.
// SPDX-License-Identifier: BSD-2-Clause-Patent // // Module Name: @@ -30,7 +30,7 @@ "Display ACPI Table information.\r\n" ".SH SYNOPSIS\r\n" " \r\n" -"ACPIVIEW [[-?] | [[[[-l] | [-s AcpiTable [-d]]] [-q] [-h]] [-r Spec]]]\r\= n" +"ACPIVIEW [[-?] | [[[[-l] | [-s AcpiTable [-d] [-g]]] [-q] [-h]] [-r Spec]= ]]\r\n" " \r\n" ".SH OPTIONS\r\n" " \r\n" @@ -39,6 +39,7 @@ " invocation option.\r\n" " AcpiTable : The required ACPI Table type.\r\n" " -d - Generate a binary file dump of the specified AcpiTable.\r\n" +" -g - Generate a dot graph of the specified AcpiTable.\r\n" " -q - Quiet. Suppress errors and warnings. Disables consistency checks.\= r\n" " -h - Enable colour highlighting.\r\n" " -r - Validate that all required ACPI tables are installed\r\n" @@ -123,6 +124,10 @@ " in the current working directory:\r\n" " fs0:\> acpiview -s DSDT -d\r\n" " \r\n" +" * To save a dot graph in the current working directory\r\n" +" representing the processor architecture described in the PPTT table:\= r\n" +" fs0:\> acpiview -s PPTT -g\r\n" +" \r\n" " * To display contents of all ACPI tables:\r\n" " fs0:\> acpiview\r\n" " \r\n" --=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 (#80817): https://edk2.groups.io/g/devel/message/80817 Mute This Topic: https://groups.io/mt/85653271/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 Mon May 6 21:26:13 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+80812+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 16318035836041002.9569781420895; Thu, 16 Sep 2021 07:46:23 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id iuTKYY1788612xPd2kHgAdN6; Thu, 16 Sep 2021 07:46:23 -0700 X-Received: from EUR05-AM6-obe.outbound.protection.outlook.com (EUR05-AM6-obe.outbound.protection.outlook.com [40.107.22.43]) by mx.groups.io with SMTP id smtpd.web09.197.1631803579987778444 for ; Thu, 16 Sep 2021 07:46:21 -0700 X-Received: from DU2PR04CA0210.eurprd04.prod.outlook.com (2603:10a6:10:28d::35) by AM6PR08MB3016.eurprd08.prod.outlook.com (2603:10a6:209:44::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.16; Thu, 16 Sep 2021 14:46:16 +0000 X-Received: from DB5EUR03FT047.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:28d:cafe::ca) by DU2PR04CA0210.outlook.office365.com (2603:10a6:10:28d::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.16 via Frontend Transport; Thu, 16 Sep 2021 14:46:16 +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+80812+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 DB5EUR03FT047.mail.protection.outlook.com (10.152.21.232) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.14 via Frontend Transport; Thu, 16 Sep 2021 14:46:16 +0000 X-Received: ("Tessian outbound b9598e0ead92:v103"); Thu, 16 Sep 2021 14:46:16 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: b0fcebcd4128b07b X-CR-MTA-TID: 64aa7808 X-Received: from b147a66631c6.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 8AE07B08-1B25-40C0-A51B-6A794DE8DBED.1; Thu, 16 Sep 2021 14:46:10 +0000 X-Received: from EUR04-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id b147a66631c6.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 16 Sep 2021 14:46:10 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AO85foxT6DBJytMAnPnIm3udrEaqqunh932stg0szk1kRPb9lv3K0/+9NPapr0Z5KUaoXrVOF4Zb1EZYZNPUUWyCRNflLIxqg2cKYVL2Ds6P/8qVpXp8VA7Sh3YVsP5Cb8Kwsg1FlOdN98xmKNUFIQDBfSWngW2NaARMPUO+8sSYlu7/aMHa3jYjhoMGsJlra3+pfmV7eF3lkr1Xas10jBDsdXw4rGSwCUpfeTWQ4Qf88l0DYt0HZ4zjj6gvFvIO3ax/nUsrSIl4CY73zkvO5GBHz/RdhIvseuhusJJOUqqOk4XXIYlJtK3jrMFSILCd1/AOJdmQ71Q5OOMmlwf/IQ== 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; bh=E+5CC71aWxyi8PB09i2ca08GPb65OgEkberWxw3wCQQ=; b=m5b+3zlrlWvHtXuHgdfV1VzDYdGBfhcuZp+KMjHYvtyNhLK3tVkJa37iMWJQIF8jGBdA74syZdua/vFz91HHd2PHpqMZh5N4inWvyAqbPl/gY0jIbCpqpc1DZ3utg30wyBXWebMaYdGY7Oa8j+0Fy7YYyUHUvPvnJiXszBYADxQJs7v2KIsUgDGrJh6aWvlIt++L18wReizLgNCiEUx7ufcyvmpvDIZPzL1ZaZ1Zm9pwA8T+aQSlSbuV2GFjy4p6fpaN4ZdAoL7To094Bik3iPb8CWjpx3LfH4ttqsYZgC737Qvw6EYNUTPANKeLlosXHaYZ4QOz9vR3hka/z9LQdA== 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 DU2PR04CA0240.eurprd04.prod.outlook.com (2603:10a6:10:2b1::35) by PAXPR08MB6735.eurprd08.prod.outlook.com (2603:10a6:102:138::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.14; Thu, 16 Sep 2021 14:46:08 +0000 X-Received: from DB5EUR03FT020.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:2b1:cafe::cb) by DU2PR04CA0240.outlook.office365.com (2603:10a6:10:2b1::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.16 via Frontend Transport; Thu, 16 Sep 2021 14:46:08 +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 DB5EUR03FT020.mail.protection.outlook.com (10.152.20.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4523.14 via Frontend Transport; Thu, 16 Sep 2021 14:46:08 +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.2308.14; Thu, 16 Sep 2021 14:46:15 +0000 X-Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) 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.2308.14; Thu, 16 Sep 2021 14:46:06 +0000 X-Received: from e124191.cambridge.arm.com (10.11.7.12) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2308.14 via Frontend Transport; Thu, 16 Sep 2021 14:46:15 +0000 From: "Joey Gouly" To: CC: , , , , Subject: [edk2-devel] [PATCH v2 4/5] ShellPkg: add dot file generator functions Date: Thu, 16 Sep 2021 15:46:04 +0100 Message-ID: <20210916144605.42071-5-joey.gouly@arm.com> In-Reply-To: <20210916144605.42071-1-joey.gouly@arm.com> References: <20210916144605.42071-1-joey.gouly@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a4e23cab-11c2-458c-92f0-08d97920bcfc X-MS-TrafficTypeDiagnostic: PAXPR08MB6735:|AM6PR08MB3016: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:2043;OLM:2043; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: t7YpRioWES+6m/tzK+xgadVVuqPfcMAsXiaBdbCqtjjnEVw3HgC9ynbnMV35zuTh7kxpShsdZo+jKF3svGRnh6sN0cl9+vvlbx8V6d8ky33qPMUL6G2blcVG+uKJq/R5qi5jveZ6sGkwr/XQzgRnuoYAW+6/NoFHrVTedElVaLy/zmiitJgt84SdSeDn0utP41+YztZ1x9cLSnSvrOVS+75xYLxcWn+guFMjo9l0r0wI8JnZxeDT10+3NB2YI9WyHYjLoPXEFuzqeUKX/vUokdGivSxRqJf72D7EKxEB9pMIPvit8o6IRDvNhjODGSbZapvER/D7TDSoRTik2H3Rr75JmZ3gKQ2TQJ1qLyMkIIvCKqUsSTcTbx+y+P46rlrZAxwyibAc5erS0RrqQJkITurmmJrB1+X7tadtzxOjzR88hd4U4PJrgbpUDvZ1G9cRiUx3bXRWoX7OFTbHj+zGBsNoWmfN3G8M6LIihvWPemQu2rf2g5MV0j6zkRAXG/L5m07hsteqCvdPz6OmxaCWtWTFrq0jT7Ksw/GKbBturAtcF6iUaRZIwfdxlkJpCMIrTtP3WAghSG6DBEbIPigfZb9+PxWpSBMZHMQ/jLsIAlwv57Y9pPqepq61fp8zS5Lkm/zjmpfESae6TotkbhXsvOrXT9NHaRJys2zYgUIXaFhIgCUCBn34liHPw56wuplKdlKgr6nL+1AO2MTLJ6By5wGKuXZT5ExA+zO6PKzgwVSOlmw+l3+THFT7zsn6Oz+uV6UHXlqvZgoRT8sKG28AZdPuZ9k/C6orbdubBL73I/tfoTQJE5gw6ThH+KZC/Cn6 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)(39860400002)(376002)(346002)(136003)(396003)(46966006)(36840700001)(8936002)(30864003)(7696005)(2906002)(6666004)(44832011)(83380400001)(70206006)(356005)(70586007)(6916009)(82740400003)(26005)(1076003)(186003)(81166007)(36756003)(316002)(47076005)(86362001)(478600001)(4326008)(36860700001)(19627235002)(5660300002)(426003)(2616005)(8676002)(336012)(82310400003)(54906003)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR08MB6735 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT047.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 3ab04007-92db-4ae3-a9b3-08d97920b852 X-Microsoft-Antispam-Message-Info: ZXNEv4DT1Wa7v+WD3UKccuY5ltur1xfHDpIFsTEzYQgN9Us8uM51SS+a3rv2QvKdiA8B6Z23r+U1w+2xJq+fD5B/BgdX9QJJrvB9Fictys/Cv9eh8RdoJEHCqjgKhS130nBmyiSb6j3YIsiwJgk8OKOrIyW9E9n3nrUCDACK1n5ltSO4cxZoPM0MOUkC47vHoGkma3gDgvyocIBS1dLD6dvF2jEaxTkDj1JhGFkP1PndMdJEEL292ufONbqK3ro/UfjViUEW52R/+g4rnTtY4uG+VfknzUGRV+aPPSHqqbsgVVRhLVqTa0bhcMzbs30cgx9So+l3dCQffKDJMQGF46+rNYVj8HD1pEBgYdtM/bA8rYYacox0GWMmVMvsdIt8zO+0LKAWRiHptoimvVZSwTbA9KM+HTqB2Qw8vVXUAbcg1GklFGm1lFYe/uTEIxRqXK9n+dLxi1xL+rjQWkVLYN2kfUbV2GYgveqcjtFfeh5EpR/3FcD6CBtpkzSiUDefK+8NIoLHgvuIik+A483BEgiTxInmkLNIYOR37CLiRqm9Br8DXTKoJhpokD+WViZdschqkXRcVtDz1yRVYqqMPFdY9jTeRg62eAODiSEnxo+m/aiWnsoSuA9EeW81tvHJ6A0qVS7J7/6gBx6cFmpE/+lbTCuUHVVj3oiLwK07Q19ZriDk7AksFmR3MKw2ixxOacnb+HKPdH0o8o8t9NqIHRlxyRbBlfpHxHLaARxLhRNV5e05I3SRYuVpk2RkJbn0/spcP7ACT/f7h9SYZa0dYQ== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Sep 2021 14:46:16.6149 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a4e23cab-11c2-458c-92f0-08d97920bcfc 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: DB5EUR03FT047.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3016 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: 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,joey.gouly@arm.com X-Gm-Message-State: ioAfFOqUrTmxUExzCztjgCaXx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1631803583; bh=7KEdyEwTxhf2mjTFst7oqqpVAcutFTH7+qtgKhJbj5I=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=EnGfEHcSuP36H0HmdciRi55Ih9kdyK0P58qoEsEanrJmrTFtiTtsadXz9kUaGUyngnb R4JzOu37sajJgJPrAZQf3foaBXtbO4uCIOA7sp7bTSpWkJvDRgOsUWU/kVOfKXKhcn8sI bMRP4Zqt9v12OFk4azIkX0IPoh9E3jHmK4A= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1631803583956100002 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Marc Moisson-Franckhauser Bugzilla: 3378 (https://bugzilla.tianocore.org/show_bug.cgi?id=3D3378) These can be used to generate dot files, that can be used to visualise graphs in tables, such as PPTT. Signed-off-by: Joey Gouly --- ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.i= nf | 4 +- ShellPkg/Library/UefiShellAcpiViewCommandLib/DotGenerator.h = | 101 +++++++ ShellPkg/Library/UefiShellAcpiViewCommandLib/DotGenerator.c = | 283 ++++++++++++++++++++ 3 files changed, 387 insertions(+), 1 deletion(-) diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiView= CommandLib.inf b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpi= ViewCommandLib.inf index 63fc5a1281a894841dac704484c3d4f9481edb46..ffe4979b3ac5d0120bcf678cf78= 23afac6674e4f 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 - 2021, Arm Limited. All rights reserved.
# # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -27,6 +27,8 @@ [Sources.common] AcpiView.h AcpiViewConfig.c AcpiViewConfig.h + DotGenerator.c + DotGenerator.h Parsers/Aest/AestParser.c Parsers/Bgrt/BgrtParser.c Parsers/Dbg2/Dbg2Parser.c diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/DotGenerator.h b/= ShellPkg/Library/UefiShellAcpiViewCommandLib/DotGenerator.h new file mode 100644 index 0000000000000000000000000000000000000000..8e196eee75417c0a422023c00b0= 43441076ac599 --- /dev/null +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/DotGenerator.h @@ -0,0 +1,101 @@ +/** @file + Header file for Dot File Generation + + Copyright (c) 2021, Arm Limited. All rights reserved. + SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#ifndef DOT_GENERATOR_H_ +#define DOT_GENERATOR_H_ + +#include + +#define DOT_COLOR_MASK 0b111 +// Flags for color of arrow or node. +#define DOT_COLOR_BLACK 0b000 // default +#define DOT_COLOR_GRAY 0b001 +#define DOT_COLOR_BLUE 0b010 +#define DOT_COLOR_YELLOW 0b011 +#define DOT_COLOR_RED 0b100 + +#define DOT_ARROW_TYPE_MASK 0b1000 +// Flags for style of arrow. +#define DOT_ARROW_FULL 0b0000 // default +#define DOT_ARROW_DOTTED 0b1000 + +// Flag for reversing how the nodes will be ranked and displayed. +#define DOT_ARROW_RANK_REVERSE 0b10000 + +#define DOT_BOX_TYPE_MASK 0b1100000 +// Flag for shape of box +#define DOT_BOX_SQUARE 0b0000000 // default +#define DOT_BOX_DIAMOND 0b0100000 + +// Flag for adding the node's ID to the end of the label. +#define DOT_BOX_ADD_ID_TO_LABEL 0b10000000 + +// Valid flags for DotAddNode. +#define DOT_BOX_FLAGS_MASK (DOT_COLOR_MASK |\ + DOT_BOX_TYPE_MASK |\ + DOT_BOX_ADD_ID_TO_LABEL) +// Valid flags for DotAddLink. +#define DOT_ARROW_FLAGS_MASK (DOT_COLOR_MASK |\ + DOT_ARROW_TYPE_MASK |\ + DOT_ARROW_RANK_REVERSE) + + +/** + Opens a new dot file and writes a dot directional graph. + + @param [in] FileName Null terminated unicode string. +**/ +SHELL_FILE_HANDLE +DotOpenNewFile ( + IN CHAR16* FileName + ); + +/** + Writes a dot graph footer and closes the dot file. + + @param [in] DotFileHandle The handle of the dot file. +**/ +VOID +DotCloseFile ( + SHELL_FILE_HANDLE DotFileHandle + ); + +/** + Writes a line in the previously opened dot file describing a + new node. + + @param [in] DotFileHandle The handle of the dot file. + @param [in] Id A unique identifier for the node. + @param [in] Flags Flags describing the node's characteristics. + @param [in] Label Label to be shown on the graph node. +**/ +VOID +DotAddNode ( + SHELL_FILE_HANDLE DotFileHandle, + IN UINT32 Id, + IN UINT16 Flags, + IN CONST CHAR16* Label + ); + +/** + Writes a line in the previously opened dot file describing a + new link between two nodes. + + @param [in] DotFileHandle The handle of the dot file. + @param [in] IdSource An identifier for the source node of the link. + @param [in] IdTarget An identifier for the target node of the link. + @param [in] Flags Flags describing the node's characteristics. +**/ +VOID +DotAddLink ( + SHELL_FILE_HANDLE DotFileHandle, + IN UINT32 IdSource, + IN UINT32 IdTarget, + IN UINT16 Flags + ); + +#endif // DOT_GENERATOR_H_ diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/DotGenerator.c b/= ShellPkg/Library/UefiShellAcpiViewCommandLib/DotGenerator.c new file mode 100644 index 0000000000000000000000000000000000000000..e19b17537ca85babca5cda38025= ae95701ff794f --- /dev/null +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/DotGenerator.c @@ -0,0 +1,283 @@ +/** @file + Dot File Generator + + Copyright (c) 2021, Arm Limited. All rights reserved. + SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#include +#include +#include +#include +#include "DotGenerator.h" +#include "AcpiView.h" + +#define MAX_DOT_BUFFER_SIZE 128 + +/** + Writes a Null terminated ASCII string to the dot file handle. + + @param [in] DotFileHandle The handle of the dot file. + @param [in] String Null terminated ascii string. +**/ +STATIC +VOID +DotWriteFile ( + SHELL_FILE_HANDLE DotFileHandle, + IN CHAR8* String + ) +{ + UINTN TransferBytes; + EFI_STATUS Status; + + if (DotFileHandle =3D=3D NULL) { + Print (L"ERROR: Failed to write to dot file\n"); + ASSERT (0); + return; + } + + TransferBytes =3D AsciiStrLen (String); + Status =3D ShellWriteFile ( + DotFileHandle, + &TransferBytes, + String + ); + ASSERT_EFI_ERROR (Status); + ASSERT (AsciiStrLen (String) =3D=3D TransferBytes); +} + +/** + Writes a new parameter to a previously started parameter list. + + @param [in] DotFileHandle The handle of the dot file. + @param [in] Name Null terminated string of the parameter's nam= e. + @param [in] Value Null terminated string of the parameter's val= ue. + @param [in] Quoted True if value needs to be quoted. +**/ +STATIC +VOID +DotAddParameter ( + SHELL_FILE_HANDLE DotFileHandle, + IN CHAR16* Name, + IN CHAR16* Value, + IN BOOLEAN Quoted + ) +{ + CHAR8 StringBuffer[MAX_DOT_BUFFER_SIZE]; + + ASSERT(DotFileHandle !=3D NULL); + + if (Quoted) { + AsciiSPrint ( + StringBuffer, + sizeof (StringBuffer), + "[%s=3D\"%s\"]", + Name, + Value + ); + } else { + AsciiSPrint ( + StringBuffer, + sizeof (StringBuffer), + "[%s=3D%s]", + Name, + Value + ); + } + + DotWriteFile (DotFileHandle, StringBuffer); +} + +/** + Writes the color argument of nodes or links according to flags. + + @param [in] DotFileHandle The handle of the dot file. + @param [in] Flags Flags describing the color (one of DOT_COLOR_= ...) +**/ +STATIC +VOID +WriteColor ( + SHELL_FILE_HANDLE DotFileHandle, + IN UINT16 Flags + ) +{ + ASSERT(DotFileHandle !=3D NULL); + + switch (Flags & DOT_COLOR_MASK) { + case DOT_COLOR_GRAY: + DotAddParameter (DotFileHandle, L"color", L"gray", FALSE); + break; + case DOT_COLOR_YELLOW: + DotAddParameter (DotFileHandle, L"color", L"yellow", FALSE); + break; + case DOT_COLOR_BLUE: + DotAddParameter (DotFileHandle, L"color", L"blue", FALSE); + break; + case DOT_COLOR_RED: + DotAddParameter (DotFileHandle, L"color", L"red", FALSE); + break; + case DOT_COLOR_BLACK: + default: + DotAddParameter (DotFileHandle, L"color", L"black", FALSE); + break; + } +} + +/** + Opens a new dot file and writes a dot directional graph. + + @param [in] FileName Null terminated unicode string. +**/ +SHELL_FILE_HANDLE +DotOpenNewFile ( + IN CHAR16* FileName + ) +{ + SHELL_FILE_HANDLE DotFileHandle; + EFI_STATUS Status; + + Status =3D ShellOpenFileByName ( + FileName, + &DotFileHandle, + EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE | EFI_FILE_MODE_CREA= TE, + 0 + ); + if (EFI_ERROR (Status)) { + Print (L"ERROR: Couldn't open dot file"); + return NULL;//Status; + } + Print (L"Creating DOT Graph in : %s... ", FileName); + DotWriteFile (DotFileHandle, "digraph {\n\trankdir=3DBT\n"); + return DotFileHandle; +} + +/** + Writes a dot graph footer and closes the dot file. + + @param [in] DotFileHandle The handle of the dot file. +**/ +VOID +DotCloseFile ( + SHELL_FILE_HANDLE DotFileHandle + ) +{ + ASSERT(DotFileHandle !=3D NULL); + + DotWriteFile (DotFileHandle, "}\n"); + ShellCloseFile (&DotFileHandle); + Print (L"Done.\n"); +} + +/** + Writes a line in the previously opened dot file describing a + new node. + + @param [in] DotFileHandle The handle of the dot file. + @param [in] Id A unique identifier for the node. + @param [in] Flags Flags describing the node's characteristics. + @param [in] Label Label to be shown on the graph node. +**/ +VOID +DotAddNode ( + SHELL_FILE_HANDLE DotFileHandle, + IN UINT32 Id, + IN UINT16 Flags, + IN CONST CHAR16* Label + ) +{ + CHAR8 LineBuffer[64]; + CHAR16 LabelBuffer[MAX_DOT_BUFFER_SIZE]; + + ASSERT ((Flags & ~DOT_BOX_FLAGS_MASK) =3D=3D 0); + ASSERT(DotFileHandle !=3D NULL); + + AsciiSPrint ( + LineBuffer, + sizeof (LineBuffer), + "\tx%x", + Id + ); + DotWriteFile (DotFileHandle, LineBuffer); + + switch (Flags & DOT_BOX_TYPE_MASK) { + case DOT_BOX_DIAMOND: + DotAddParameter (DotFileHandle, L"shape", L"diamond", FALSE); + break; + case DOT_BOX_SQUARE: + default: + DotAddParameter (DotFileHandle, L"shape", L"box", FALSE); + break; + } + + if (Label !=3D NULL) { + if ((Flags & DOT_BOX_ADD_ID_TO_LABEL) !=3D 0) { + UnicodeSPrint ( + LabelBuffer, + sizeof (LabelBuffer), + L"%s\\n0x%x", + Label, + Id + ); + } else { + UnicodeSPrint ( + LabelBuffer, + sizeof (LabelBuffer), + L"%s", + Label + ); + } + DotAddParameter (DotFileHandle, L"label", LabelBuffer, TRUE); + } + + WriteColor (DotFileHandle, Flags); + DotWriteFile (DotFileHandle, "\n"); +} + +/** + Writes a line in the previously opened dot file describing a + new link between two nodes. + + @param [in] DotFileHandle The handle of the dot file. + @param [in] IdSource An identifier for the source node of the link. + @param [in] IdTarget An identifier for the target node of the link. + @param [in] Flags Flags describing the node's characteristics. +**/ +VOID +DotAddLink ( + SHELL_FILE_HANDLE DotFileHandle, + IN UINT32 IdSource, + IN UINT32 IdTarget, + IN UINT16 Flags + ) +{ + CHAR8 LineBuffer[64]; + + ASSERT(DotFileHandle !=3D NULL); + ASSERT ((Flags & ~DOT_ARROW_FLAGS_MASK) =3D=3D 0); + + AsciiSPrint ( + LineBuffer, + sizeof (LineBuffer), + "\tx%x -> x%x", + IdSource, + IdTarget + ); + DotWriteFile (DotFileHandle, LineBuffer); + + if ((Flags & DOT_ARROW_RANK_REVERSE) !=3D 0) { + DotAddParameter (DotFileHandle, L"dir", L"back", FALSE); + } + + switch (Flags & DOT_ARROW_TYPE_MASK) { + case DOT_ARROW_DOTTED: + DotAddParameter (DotFileHandle, L"style", L"dotted", FALSE); + break; + case DOT_ARROW_FULL: + default: + DotAddParameter (DotFileHandle, L"style", L"solid", FALSE); + break; + } + + WriteColor (DotFileHandle, Flags); + DotWriteFile (DotFileHandle, "\n"); +} --=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 (#80812): https://edk2.groups.io/g/devel/message/80812 Mute This Topic: https://groups.io/mt/85653263/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 Mon May 6 21:26:13 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+80814+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 1631803584453416.0068790403701; Thu, 16 Sep 2021 07:46:24 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id m2qOYY1788612x0yhFK1e6vW; Thu, 16 Sep 2021 07:46:24 -0700 X-Received: from EUR05-VI1-obe.outbound.protection.outlook.com (EUR05-VI1-obe.outbound.protection.outlook.com [40.107.21.73]) by mx.groups.io with SMTP id smtpd.web11.217.1631803581407471109 for ; Thu, 16 Sep 2021 07:46:22 -0700 X-Received: from DB6PR0201CA0022.eurprd02.prod.outlook.com (2603:10a6:4:3f::32) 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.4523.14; Thu, 16 Sep 2021 14:46:17 +0000 X-Received: from DB5EUR03FT006.eop-EUR03.prod.protection.outlook.com (2603:10a6:4:3f:cafe::e) by DB6PR0201CA0022.outlook.office365.com (2603:10a6:4:3f::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.16 via Frontend Transport; Thu, 16 Sep 2021 14:46: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+80814+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 DB5EUR03FT006.mail.protection.outlook.com (10.152.20.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.14 via Frontend Transport; Thu, 16 Sep 2021 14:46:17 +0000 X-Received: ("Tessian outbound 8e26f7114b75:v103"); Thu, 16 Sep 2021 14:46:17 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 6d455b6d52a69a1d X-CR-MTA-TID: 64aa7808 X-Received: from cdda5c2bdc9c.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 638D2CB9-3925-4986-B9E9-95F9B09762BC.1; Thu, 16 Sep 2021 14:46:10 +0000 X-Received: from EUR01-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id cdda5c2bdc9c.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 16 Sep 2021 14:46:10 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gQXsWkd7zzDelrHOl3I0SyVTZDUnS7dn4rY2QLBcVWRxDnNHU9d0XV9q028tU9wWoJiDVcLHoIX4GSXL0nMYqXN1OQvg/mT5pzfzePL7v8FPtLOVno7kYTBvb7vLJSN8ZfCg9ZHLZ58/JWYosJ1dFW7vnR7zlcVlOUP33xx34BZ41kZ+ibj1Tcpklwv+th62CJ4bHbmjsaWur37K/BWCxUkwZP+ulYjcKyfrm1Vqr2jff/lO950pLA+aotoY0JxJu9CNH5DHcCL6CFVGF8s8qhDu5RbTDRfct9E1barACXvU8G21rz90BC/solMsckRbF1YqSk4PPH5y0CuCp8c60w== 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; bh=bXA/WPvXA3ykdduPnGKcsSwGpadpQnUPXpbmlsFtgxc=; b=D887ybOWRli0qUPkO9O+q58iHCAIQjsprW91E5JWCOuRo8bMGUEF+8Cc5pxi6MgUdUettlG0SY9bnAjkDvWv7ky11EBTv2eJo+T4wHVjP7r+DmflygMYv97ag+CPbuZQMIPCteCEKn7C9f5iJCrWSSYRcodcUwoiMjpeCNjJVxaaoDtDKVoQhT1mIrqC1YXNeXJiLYr7kM4gSwp3d6R0G0iqcDrQZ9dHdN3Z3N8GoBaT+Q403/wqHU9KYAAuLP0E3xNigzm5Nt8JEq8GcCzeMfM69FzMTJn7sNBnEDJXCgNKLGQBvn/l60FSZqMz5QnEQxWHfKgj0EO+yncOcYe0Nw== 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 DU2PR04CA0222.eurprd04.prod.outlook.com (2603:10a6:10:2b1::17) by AS8PR08MB5909.eurprd08.prod.outlook.com (2603:10a6:20b:297::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.17; Thu, 16 Sep 2021 14:46:08 +0000 X-Received: from DB5EUR03FT020.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:2b1:cafe::64) by DU2PR04CA0222.outlook.office365.com (2603:10a6:10:2b1::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.14 via Frontend Transport; Thu, 16 Sep 2021 14:46:08 +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 DB5EUR03FT020.mail.protection.outlook.com (10.152.20.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4523.14 via Frontend Transport; Thu, 16 Sep 2021 14:46:08 +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.2308.14; Thu, 16 Sep 2021 14:46:15 +0000 X-Received: from e124191.cambridge.arm.com (10.11.7.12) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2308.14 via Frontend Transport; Thu, 16 Sep 2021 14:46:15 +0000 From: "Joey Gouly" To: CC: , , , , Subject: [edk2-devel] [PATCH v2 5/5] ShellPkg: add PPTT dot file genration Date: Thu, 16 Sep 2021 15:46:05 +0100 Message-ID: <20210916144605.42071-6-joey.gouly@arm.com> In-Reply-To: <20210916144605.42071-1-joey.gouly@arm.com> References: <20210916144605.42071-1-joey.gouly@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 302585de-3221-46e3-24e0-08d97920bd82 X-MS-TrafficTypeDiagnostic: AS8PR08MB5909:|AM6PR08MB4568: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:3173;OLM:3173; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: jrYnaHe+HFG1vepuDyt3qhzDh/Ug6mpv7MSzIgcGgQX9bpdws7tjpTJ8wmbmjHlAyvL4DIi+pevM2q6UNWLddyiowNBt7kPcj9D/A7z8bYPRbEKYmiYaJTCfpDcC7nB2tJiDjzh6CKzW9Bj3XILNszP0tTBgD0JExX/6dBlUduUT6I1WoNkANL8p4R3rcVspbIDqfMTr5ABgp+K9/DnviXG3os9KMbBGQ6eJzA8BlxlRrPsL1sLIQGqdBEIjHtx76gAa5VGdE9yG3ud5/Trwq4CavkTh67ZxWzAqt5KWVqovonX2lphvz580gWpnI1wHI7w9N4fGkUm3Z5v9TR05m7r+tzBfj4uuNi2PAG5ChyI+jmLk/ZxmyjQKWDTfatFw3t8evaMCrRJb+MIg0+am1C01D0kjRFs3B1VSh65s0n8luZ90WSm7Exi11mJCmXC277FfC3OREZvO1F3PLYS9ECowgfXs5YqUueCqcOQWK2GulKxHgQdoPgx2djK2bHVcIdzOAlmtpd9EzALxJ4/3V/u4FCjlgsNPq82LgxVAGaZ58aQhORnlma21Ms/O2NlifSdXYTuqwqDuvNwFjZJ/Y9EEt7ckM63IoBXraIhUXOpGUXhwmmRO3g9eY0cmdGux4Llpry9H6NfXqdfGze5t+fzRSlPLA9RJ6ypxIqh2D+hwr7aoJOwzCS3xZfq02jE2MSAHCRjpbVI6eVfUHx4/UmD5hyocNq21IUQqTqe9tHnvZnA5ObwiH1I8oHB1q38l3V0ABR9M+xIiApeSo/1D/GcT181Vh6iXNBEL7pZuBwVAxENfWo37Ui8T+76Vo4wk 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)(376002)(136003)(39860400002)(396003)(346002)(36840700001)(46966006)(70206006)(7696005)(83380400001)(426003)(54906003)(47076005)(5660300002)(6666004)(6916009)(4326008)(2906002)(8676002)(82310400003)(478600001)(36756003)(186003)(336012)(8936002)(44832011)(36860700001)(26005)(316002)(356005)(86362001)(1076003)(70586007)(2616005)(82740400003)(81166007)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB5909 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT006.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: c8822fbf-6499-4ea5-3a35-08d97920b835 X-Microsoft-Antispam-Message-Info: vF8vXlQAPKUaiRm42KQ95cjHLy+XnN2bLfqV/mQHEL4uNyDPLtU7wJ8c2tHSPhaZPmC8WnqrN+o6or91hfA9IGENkOT+6E1VvDFJUj0hHu4sPsGh3YSOJPU+TMtdT8cD6T3WQhSdoENhTA+wS2oe6YcqgXUk57tQipLdttHaQKvvhjC7fsN98BA7d2kA269GFATLh55b98We3TTed+snTMerKsF8YlINbshsk2RoFYpGuAe57xAgDCjpcSgqmV41YQkcIciFp/FOFcZYRR/buDISpc8zf1yNeoDsQbm30NrhDS8TBHTkeCAy0gO3hT7PV2Ww1CHvdvZ2QUBwKSUZiP1lH/5N2XMMzq4UqMtEfWNi1T6xCtWweGjIzM04fkeoaQ19RXO5MSZ+V+Md2/JRTjc4spezK1hqYLU7rpWWARGkGnG1kWO9VZ5JyAn98L1v8Ef9g8ezUg2iQl5eH7KpskkC20M2GYQpGYgLbz2iYYyovEGh8sCnVvxfaRjpe2yTKQcCgQl4H0RydQdze/RHk0eIdq7wdC3jkurDwNuBUTyNpFbPSPG+jSCJZSRwP6IkQpgz+wZyFEEoFcLpaa/9Bsod1O6H0NB4O8Sv8poz0f6V1ouYHeCkV/AV8LYVns9COynQ0I+XB5+y3HISKEZ5zTcWWRgNhghX+IY/P7dEkEHHju5Iugjjoi32dva1HITlNDBpezRqYpNdmuXxIgzg/7BYAZE5jK9JYkRLPe3slOC5XB5yEh+Yqxv80morq/3e3hKIcjnzWgKLeg+y81226XJKOzyFdNaRCAM2gVpC1II= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Sep 2021 14:46:17.4903 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 302585de-3221-46e3-24e0-08d97920bd82 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: DB5EUR03FT006.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: List-Subscribe: List-Help: 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,joey.gouly@arm.com X-Gm-Message-State: fRrzjFcM4gmHGnlowQOs08QQx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1631803584; bh=XgHWZBV83ANpmp5Ta1knZWhuoPaWv5eRHL5YldGLr80=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=mxizJDEADZ8LBO17AHzvylpCG0IDY/wwSGVrblxjF5hPmjc4wblXGSSDW9u6HT4GV21 FzqHlqL+vLWgCvYG2bOHCRUOqLhuwjlobrnIgGI7KLqlTy4S7kp+fUu4LgW1xrEhPS/Po CEVBfQyJhmZ4PJIcs4OEV2cxLLMAjAg/iMs= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1631803586126100011 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Marc Moisson-Franckhauser Bugzilla: 3378 (https://bugzilla.tianocore.org/show_bug.cgi?id=3D3378) This generates a dot file from the PPTT table that can be used to visualise the topology of the CPUs and Caches. Signed-off-by: Joey Gouly --- ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/PpttParser.c | 2= 40 ++++++++++++++++++-- 1 file changed, 218 insertions(+), 22 deletions(-) diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/Pptt= Parser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/PpttPa= rser.c index 538b6a69350d75ccbf36b86fff115255e77437c7..b52bd532b846b9cec0ca315b043= beff95df40bd5 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/PpttParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/PpttParser.c @@ -15,11 +15,23 @@ #include "AcpiView.h" #include "AcpiViewConfig.h" #include "PpttParser.h" +#include "DotGenerator.h" =20 // Local variables STATIC CONST UINT8* ProcessorTopologyStructureType; STATIC CONST UINT8* ProcessorTopologyStructureLength; + STATIC CONST UINT32* NumberOfPrivateResources; +STATIC CONST UINT32* ProcessorHierarchyParent; +STATIC CONST EFI_ACPI_6_3_PPTT_STRUCTURE_PROCESSOR_FLAGS* ProcStructFlags; +STATIC CONST UINT32* NextLevelOfCache; +STATIC CONST EFI_ACPI_6_3_PPTT_STRUCTURE_CACHE_ATTRIBUTES* CacheAttributes; +STATIC CONST UINT32* CacheSize; + +STATIC CONST UINT8* PpttStartPointer; + +STATIC SHELL_FILE_HANDLE mDotFileHandle; + STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; =20 /** @@ -198,8 +210,9 @@ STATIC CONST ACPI_PARSER ProcessorHierarchyNodeStructur= eParser[] =3D { {L"Length", 1, 1, L"%d", NULL, NULL, NULL, NULL}, {L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL}, =20 - {L"Flags", 4, 4, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Parent", 4, 8, L"0x%x", NULL, NULL, NULL, NULL}, + {L"Flags", 4, 4, L"0x%x", NULL, (VOID**)&ProcStructFlags, NULL, NULL}, + {L"Parent", 4, 8, L"0x%x", NULL, + (VOID**)&ProcessorHierarchyParent, NULL, NULL}, {L"ACPI Processor ID", 4, 12, L"0x%x", NULL, NULL, NULL, NULL}, {L"Number of private resources", 4, 16, L"%d", NULL, (VOID**)&NumberOfPrivateResources, NULL, NULL} @@ -214,11 +227,13 @@ STATIC CONST ACPI_PARSER CacheTypeStructureParser[] = =3D { {L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL}, =20 {L"Flags", 4, 4, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Next Level of Cache", 4, 8, L"0x%x", NULL, NULL, NULL, NULL}, - {L"Size", 4, 12, L"0x%x", NULL, NULL, NULL, NULL}, + {L"Next Level of Cache", 4, 8, L"0x%x", NULL, + (VOID**)&NextLevelOfCache, NULL, NULL}, + {L"Size", 4, 12, L"0x%x", NULL, (VOID**)&CacheSize, NULL, NULL}, {L"Number of sets", 4, 16, L"%d", NULL, NULL, ValidateCacheNumberOfSets,= NULL}, {L"Associativity", 1, 20, L"%d", NULL, NULL, ValidateCacheAssociativity,= NULL}, - {L"Attributes", 1, 21, L"0x%x", NULL, NULL, ValidateCacheAttributes, NUL= L}, + {L"Attributes", 1, 21, L"0x%x", NULL, (VOID**)&CacheAttributes, + ValidateCacheAttributes, NULL}, {L"Line size", 2, 22, L"%d", NULL, NULL, ValidateCacheLineSize, NULL} }; =20 @@ -257,6 +272,7 @@ DumpProcessorHierarchyNodeStructure ( UINT32 Offset; UINT32 Index; CHAR16 Buffer[OUTPUT_FIELD_COLUMN_WIDTH]; + CONST UINT8* TypePtr; =20 Offset =3D ParseAcpi ( IS_TRACE_FLAG_SET (ParseFlags), @@ -291,26 +307,67 @@ DumpProcessorHierarchyNodeStructure ( return; } =20 - Index =3D 0; + if (IS_GRAPH_FLAG_SET (ParseFlags)) { + if (ProcStructFlags->ProcessorIsAThread) { + UnicodeSPrint(Buffer, sizeof (Buffer), L"Thread"); + } else if (ProcStructFlags->NodeIsALeaf) { + UnicodeSPrint(Buffer, sizeof (Buffer), L"Core"); + } else if (ProcStructFlags->PhysicalPackage) { + UnicodeSPrint(Buffer, sizeof (Buffer), L"Physical\\nPackage"); + } else { + UnicodeSPrint(Buffer, sizeof (Buffer), L"Cluster"); + } + + DotAddNode ( + mDotFileHandle, + (UINT32)(Ptr - PpttStartPointer), + DOT_BOX_SQUARE | DOT_COLOR_BLUE | DOT_BOX_ADD_ID_TO_LABEL, + Buffer + ); + + // Add link to parent node. + if (*ProcessorHierarchyParent !=3D 0) { + DotAddLink ( + mDotFileHandle, + (UINT32)(Ptr - PpttStartPointer), + *ProcessorHierarchyParent, + 0x0 + ); + } + } =20 // Parse the specified number of private resource references or the Proc= essor // Hierarchy Node length. Whichever is minimum. - while (Index < *NumberOfPrivateResources) { - UnicodeSPrint ( - Buffer, - sizeof (Buffer), - L"Private resources [%d]", - Index - ); + for (Index =3D 0; Index < *NumberOfPrivateResources; Index++) { + if (IS_TRACE_FLAG_SET (ParseFlags)) { + UnicodeSPrint ( + Buffer, + sizeof (Buffer), + L"Private resources [%d]", + Index + ); =20 - PrintFieldName (4, Buffer); - Print ( - L"0x%x\n", - *((UINT32*)(Ptr + Offset)) - ); + PrintFieldName (4, Buffer); + Print ( + L"0x%x\n", + *((UINT32*)(Ptr + Offset)) + ); + } + + if (IS_GRAPH_FLAG_SET (ParseFlags)) { + TypePtr =3D PpttStartPointer + *((UINT32*)(Ptr + Offset)); + if (*TypePtr =3D=3D EFI_ACPI_6_2_PPTT_TYPE_ID) { + continue; + } + DotAddLink ( + mDotFileHandle, + *((UINT32*)(Ptr + Offset)), + (UINT32)(Ptr - PpttStartPointer), + DOT_ARROW_RANK_REVERSE + ); + } =20 Offset +=3D sizeof (UINT32); - Index++; } } =20 @@ -329,6 +386,8 @@ DumpCacheTypeStructure ( IN UINT8 Length ) { + CHAR16 LabelBuffer[64]; + ParseAcpi ( IS_TRACE_FLAG_SET (ParseFlags), 2, @@ -337,6 +396,88 @@ DumpCacheTypeStructure ( Length, PARSER_PARAMS (CacheTypeStructureParser) ); + + if (IS_GRAPH_FLAG_SET (ParseFlags)) { + // Create cache node + + // Start node label with type of cache + switch (CacheAttributes->CacheType) { + case EFI_ACPI_6_3_CACHE_ATTRIBUTES_CACHE_TYPE_DATA: + UnicodeSPrint ( + LabelBuffer, + sizeof (LabelBuffer), + L"D-Cache\\n" + ); + break; + case EFI_ACPI_6_3_CACHE_ATTRIBUTES_CACHE_TYPE_INSTRUCTION: + UnicodeSPrint ( + LabelBuffer, + sizeof (LabelBuffer), + L"I-Cache\\n" + ); + break; + default: + UnicodeSPrint ( + LabelBuffer, + sizeof (LabelBuffer), + L"Unified Cache\\n" + ); + } + + // Add size of cache to node label + if (((*CacheSize) & 0xfff00000) !=3D 0) { + UnicodeSPrint ( + LabelBuffer, + sizeof (LabelBuffer), + L"%s%dMiB", + LabelBuffer, + *CacheSize >> 20 + ); + } + if ((*CacheSize & 0xffc00) !=3D 0) { + UnicodeSPrint ( + LabelBuffer, + sizeof (LabelBuffer), + L"%s%dkiB", + LabelBuffer, + (*CacheSize >> 10) & 0x3ff + ); + } + if ((*CacheSize & 0x3ff) !=3D 0) { + UnicodeSPrint ( + LabelBuffer, + sizeof (LabelBuffer), + L"%s%dB", + LabelBuffer, + *CacheSize & 0x3ff + ); + } + if (*CacheSize =3D=3D 0) { + UnicodeSPrint ( + LabelBuffer, + sizeof (LabelBuffer), + L"%s0B", + LabelBuffer + ); + } + + //Add node to dot file + DotAddNode ( + mDotFileHandle, + (UINT32)(Ptr - PpttStartPointer), + DOT_BOX_SQUARE | DOT_COLOR_YELLOW | DOT_BOX_ADD_ID_TO_LABEL, + LabelBuffer + ); + + if (*NextLevelOfCache !=3D 0) { + DotAddLink ( + mDotFileHandle, + *NextLevelOfCache, + (UINT32)(Ptr - PpttStartPointer), + DOT_ARROW_RANK_REVERSE | DOT_COLOR_GRAY + ); + } + } } =20 /** @@ -390,13 +531,46 @@ ParseAcpiPptt ( IN UINT8 AcpiTableRevision ) { - UINT32 Offset; - UINT8* ProcessorTopologyStructurePtr; + EFI_STATUS Status; + UINT32 Offset; + UINT8* ProcessorTopologyStructurePtr; + CHAR16 Buffer[128]; + CHAR16 FileNameBuffer[MAX_FILE_NAME_LEN]; =20 - if (!IS_TRACE_FLAG_SET (ParseFlags)) { + if (!IS_TRACE_FLAG_SET (ParseFlags) && + !IS_GRAPH_FLAG_SET (ParseFlags)) { return; } =20 + if (IS_GRAPH_FLAG_SET (ParseFlags)) { + Status =3D GetNewFileName ( + L"PPTT", + L"dot", + FileNameBuffer, + sizeof (FileNameBuffer) + ); + + if (EFI_ERROR (Status)) { + Print ( + L"Error: Could not open dot file for PPTT table:\n" + L"Could not get a file name." + ); + // Abandonning creation of dot graph by unsetting the flag. + // We continue parsing in case trace is set. + ParseFlags &=3D ~PARSE_FLAGS_GRAPH; + } else { + mDotFileHandle =3D DotOpenNewFile (FileNameBuffer); + if (mDotFileHandle =3D=3D NULL) { + Print (L"ERROR: Could not open dot file for PPTT table.\n"); + // Abandonning creation of dot graph by unsetting the flag. + // We continue parsing in case trace is set. + ParseFlags &=3D ~PARSE_FLAGS_GRAPH; + } + } + } + + PpttStartPointer =3D Ptr; + Offset =3D ParseAcpi ( IS_TRACE_FLAG_SET (ParseFlags), 0, @@ -406,6 +580,24 @@ ParseAcpiPptt ( PARSER_PARAMS (PpttParser) ); =20 + if (*(AcpiHdrInfo.Revision) < 2 && + IS_GRAPH_FLAG_SET (ParseFlags)) { + Print (L"\nWARNING: Dot output may not be consistent for PPTT revision= s < 2\n"); + UnicodeSPrint ( + Buffer, + sizeof (Buffer), + L"WARNING: PPTT table revision is %u.\\n" \ + L"Revisions lower than 2 might lead to incorrect labelling", + *(AcpiHdrInfo.Revision) + ); + DotAddNode ( + mDotFileHandle, + 0, + DOT_COLOR_RED | DOT_BOX_SQUARE, + Buffer + ); + } + ProcessorTopologyStructurePtr =3D Ptr + Offset; =20 while (Offset < AcpiTableLength) { @@ -486,4 +678,8 @@ ParseAcpiPptt ( ProcessorTopologyStructurePtr +=3D *ProcessorTopologyStructureLength; Offset +=3D *ProcessorTopologyStructureLength; } // while + + if (IS_GRAPH_FLAG_SET (ParseFlags)) { + DotCloseFile (mDotFileHandle); + } } --=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 (#80814): https://edk2.groups.io/g/devel/message/80814 Mute This Topic: https://groups.io/mt/85653266/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-