From nobody Sat May 18 14:54:15 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+74811+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 16203839249470.04639277797195973; Fri, 7 May 2021 03:38:44 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id gOmXYY1788612xHsslJdFV1b; Fri, 07 May 2021 03:38:44 -0700 X-Received: from EUR01-DB5-obe.outbound.protection.outlook.com (EUR01-DB5-obe.outbound.protection.outlook.com [40.107.15.54]) by mx.groups.io with SMTP id smtpd.web12.8383.1620383916413403550 for ; Fri, 07 May 2021 03:38:36 -0700 X-Received: from AM5PR0601CA0080.eurprd06.prod.outlook.com (2603:10a6:206::45) by DBBPR08MB6105.eurprd08.prod.outlook.com (2603:10a6:10:20d::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25; Fri, 7 May 2021 10:38:29 +0000 X-Received: from AM5EUR03FT043.eop-EUR03.prod.protection.outlook.com (2603:10a6:206:0:cafe::f6) by AM5PR0601CA0080.outlook.office365.com (2603:10a6:206::45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25 via Frontend Transport; Fri, 7 May 2021 10:38:29 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; edk2.groups.io; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;edk2.groups.io; dmarc=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+74811+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 AM5EUR03FT043.mail.protection.outlook.com (10.152.17.43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25 via Frontend Transport; Fri, 7 May 2021 10:38:27 +0000 X-Received: ("Tessian outbound 52fcc5bd9d3a:v91"); Fri, 07 May 2021 10:38:27 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 9aee4c5c15bc87ec X-CR-MTA-TID: 64aa7808 X-Received: from b3f028c6dcb6.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id FDFED41D-2B9F-41B5-BC03-A100FF88E3D1.1; Fri, 07 May 2021 10:38:16 +0000 X-Received: from EUR04-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id b3f028c6dcb6.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 07 May 2021 10:38:16 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UI494/Fii1Bz3Xz7Oa4ex8Z0CLbmV9/qwlQYRl1CsV+c3azGbcFkahUG57V8KeYkSsXTXKfcDRBiOlYKpCw+JT4qSBxEuQykego2LAIdvr3DaIerVzaRbX/ZBroxnNn9Iuq94y3VTl06/hUJWIz73/56skR6rFWbt3Oo/jBadn1d/EfrDMpxwT8BSpGHqavcyE7bi/nfqNY/taE5ny+cPn7LiAKqG7v2noWOyyEIf/98YXVj6WYpUCWD2hA9OKeRMostDU18WDrRxIXDhQbbYnddW+mys+okxisdJWeVPUfuPAREoevBXGSg1axJ9nJM9nB1XnMyvSvSyN5/d/b0qg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=AOPG57gp77WetjHGM/Ze+4DZe7UhA+Hq6DnHbZA2css=; b=mjPwXrZ6Q2Qg7LG8Eam6YpsidjDoFgFNN7yEKt/O3dcGIdqBPYFuN9L+txE+KZSlsJPtPeWCc/nVCWlYgerZDdeTp9HP4yX7Yshzdqec3rMxbT6USRkmZ+VVyYOQxJOKxCdexwoE3mrqQZf4z6O7JxtJyp0CflgM2cPY2eEe31JsZHT4LPldrNGbTh/ZgDotjF1UASeQMqJIQrtc0NfgxdBMg3XkNZEdJxV+KClR1/A2svOXSNLXQUc//DrjsBHBGFDqZLmRckP5R3lT6qSJ1PG/mncWnr3j7hZ+tbx6hK6U1wSUDbaini7PxC84suC5JgUVdNt1BM3G5Mbbo9Qeyg== 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 AM6PR0202CA0048.eurprd02.prod.outlook.com (2603:10a6:20b:3a::25) by VI1PR08MB4160.eurprd08.prod.outlook.com (2603:10a6:803:ea::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.27; Fri, 7 May 2021 10:38:13 +0000 X-Received: from AM5EUR03FT033.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:3a:cafe::c) by AM6PR0202CA0048.outlook.office365.com (2603:10a6:20b:3a::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25 via Frontend Transport; Fri, 7 May 2021 10:38:13 +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 AM5EUR03FT033.mail.protection.outlook.com (10.152.16.99) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4108.25 via Frontend Transport; Fri, 7 May 2021 10:38:12 +0000 X-Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX04.Arm.com (10.251.24.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Fri, 7 May 2021 10:38:04 +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.2176.2 via Frontend Transport; Fri, 7 May 2021 10:38:04 +0000 From: "Joey Gouly" To: CC: , , , , Subject: [edk2-devel] [PATCH v1 1/5] ShellPkg: Replace 'Trace' parameter with 'ParseFlags' Date: Fri, 7 May 2021 11:38:00 +0100 Message-ID: <20210507103804.8131-2-joey.gouly@arm.com> In-Reply-To: <20210507103804.8131-1-joey.gouly@arm.com> References: <20210507103804.8131-1-joey.gouly@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3e32aa6d-1075-45ee-c05a-08d911444015 X-MS-TrafficTypeDiagnostic: VI1PR08MB4160:|DBBPR08MB6105: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:3826;OLM:3826; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: 6Oy5Kb1C1FWqeRQa4m9HUrhyT46w7itkGRpPCd3/mNPrBi7SggHcLxl0ArRYEfPbWeyj3Vd9DSMjn8NLelTGfaf/5PLSuKnRfTPdLKsF+2lTsKM3pwGZ1V5+GhFP+qeg84OeqvjwL4N6liTj1Yot/16gZx3lYZvJntzRSNLC2EJRdggT3+o3/5hS9ktmQkamjMLbZEnYbD9ong5X98hoYkiEcdKzoxkLDuwSbUKFy53C0sTXIFhIoFIQF6Fu6DTyUgPHk+TvEc5EGhWG7hXDOHmjpB6YKWyV58JS9YVsZaIJMrSZpaiYetL/9WKsd++SMo0ayfZhLjjHO67u6CcnxK0KFCwRRB2cVj4kkapVty8kZagOrXlrrq+cAfyx6F1fxnOTgYlVVRbcxUTUk7VsLfoWfQ9nQnEgnEA4HLGPicnazsjCT5OKSCHvnl58ot4dTcORsBUjVCGM7SxEVcAtjMN08WReTIGkO6KCQOGCVRSFPMtk5/9m6UkSHhjLqOVd4jDnzbOAIwbZiSutK+beLbuEo6ptfqDM4uAk3CFxci+Mlp63NivMGHXX5abGtdNwQdhZzca9UweoIIifJM1NHFJx7oleAhosZubJWvP8igr7nMToyLmpmDTkdHuvhvKqkdXVhDWj3NbblzhewtXKeSnpcZUgU0M5MkjX3Y+qsR0plqAOe0Cqlp/8e6dkxU+WowFdxgVmyMnAW/azZGlZXOVo+101Dz7BzDoyB6+Dq5SOe2eng8e7vTQr3B9v4HybTintv4Ivfa6NK+NgMyUnjQ== X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(4636009)(136003)(346002)(396003)(376002)(39850400004)(36840700001)(46966006)(186003)(30864003)(19627235002)(7696005)(47076005)(70206006)(6666004)(6916009)(54906003)(36756003)(36860700001)(1076003)(82740400003)(356005)(4326008)(478600001)(316002)(426003)(86362001)(5660300002)(70586007)(83380400001)(26005)(2616005)(2906002)(8936002)(44832011)(336012)(81166007)(82310400003)(8676002)(36900700001)(579004);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB4160 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT043.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 5a3f805a-ec75-4864-3753-08d9114436f5 X-Microsoft-Antispam-Message-Info: CQLwkosqwrkXraR4DNIqYsYsz/xx5doVbOih46IIcnk7O5Ao1Me2hkKZq7cYpENlVR/QVU9qaQZrv+dOHz9mizx0MW7PLqfTiWZv0KzwPisz9Pr5ORXb/QIQmEYxC5FYzxPqX5bFMHsHC+wUZId+pPJcQJoHW+58+Nvb6haMXQQIlpJGLwiUVLX76ZkkM1ltsXpu6SLuCg1r5G7m+MvZHYnbd+JbZX6FIFYg7RUIJcR+mj8QMYxHYHl9JZ7sr1tHDQfRKfhbyjecD6fxRd+4xjIWBsmKt2b8pQc96i52QImWYVjgxXpGyAQcGabN+195MqLX6nemGH9hOHrgDvfREK+wG/EMyFaCNly7qVYXFklrMBekLq1H9tVJtV6/c0+3w/w9xy+amPbromix33U1K7Vfqpjzv/aVMI5v5QBlCv++DEEJ+DV7PJ9JMGy7jxN2kWc+dU2En4VmldheA545hidVgZPc56sLyio5iX4k4AqHXr2BSK0KIAgbg7EMPNDReGiraL1+bHVvDvOKlOELhELT8f0RLzcCFio2NncXqx8WvxSohTXrPYhnixHPqTkBsmEKg21uNjgvZK90yRy2zJhSOOW1eNMQY/AiCeZw2AHBkzbGxPXPPnApltHiqyjcwxuF/s1/xY04UCBNKC0Z6LqN6FDmpKu1dSQgTJm5viVv+vMq3SlJXdL6Q9Yewaq22gOReaQsy9DE0rLcd866OWyxWkDX0ya5j73mrcaDIJQ= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 May 2021 10:38:27.9487 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3e32aa6d-1075-45ee-c05a-08d911444015 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: AM5EUR03FT043.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR08MB6105 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: S9TD04Pr8DN5NdWNI8PGUWtBx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1620383924; bh=IN6mLu68IgTUgqQBOz7LcRBOrBrnOYZbYV+ikXaiihg=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=JhZErknuvP5SKCIO/NwloZQqwAu9iCon6VattG77B5YvXlsKD0vu0Hp9NsxoyOjEAi6 COpMWHc4VTnE+QPQuJfvcTWEzDYFxAuJUEBR+Ro+0Onmtqpb9p92LkaqtKmr+qzqBTA3R bcQVd/z7lKiMY3wN2z31KUx4kHS2U9CTct0= X-ZohoMail-DKIM: pass (identity @groups.io) 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: Marc Moisson-Franckhauser 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 (#74811): https://edk2.groups.io/g/devel/message/74811 Mute This Topic: https://groups.io/mt/82651826/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Sat May 18 14:54:15 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+74812+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 1620383924094393.34265036048055; Fri, 7 May 2021 03:38:44 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id Ui69YY1788612xf8Ab6c7KeT; Fri, 07 May 2021 03:38:38 -0700 X-Received: from EUR05-DB8-obe.outbound.protection.outlook.com (EUR05-DB8-obe.outbound.protection.outlook.com [40.107.20.59]) by mx.groups.io with SMTP id smtpd.web08.8403.1620383916546275757 for ; Fri, 07 May 2021 03:38:37 -0700 X-Received: from DB6PR0402CA0008.eurprd04.prod.outlook.com (2603:10a6:4:91::18) by AM0PR08MB3507.eurprd08.prod.outlook.com (2603:10a6:208:dc::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25; Fri, 7 May 2021 10:38:30 +0000 X-Received: from DB5EUR03FT020.eop-EUR03.prod.protection.outlook.com (2603:10a6:4:91:cafe::3) by DB6PR0402CA0008.outlook.office365.com (2603:10a6:4:91::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25 via Frontend Transport; Fri, 7 May 2021 10:38:30 +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+74812+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 DB5EUR03FT020.mail.protection.outlook.com (10.152.20.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25 via Frontend Transport; Fri, 7 May 2021 10:38:30 +0000 X-Received: ("Tessian outbound 6c4b4bc1cefb:v91"); Fri, 07 May 2021 10:38:30 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 1e570dba06be487a X-CR-MTA-TID: 64aa7808 X-Received: from 915c9ee77e01.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 0B9726B1-EFDB-4F55-96D5-CF9FC7CD3F62.1; Fri, 07 May 2021 10:38:22 +0000 X-Received: from EUR04-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 915c9ee77e01.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 07 May 2021 10:38:22 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BKJ/GMQPjvUla4kxWsiklGRNxz/Pca2BP11TERs5d5EhgJg6q5vhRC2NmJZ1AUwypN1zG1y6z2WgwWHkXzhIn77oU11xHyy9dbT2er2J+iGawoXEHq9OguoTG6S0b+xEfnpMlxR1K8tW0sfRF9HTTVdUiq59sY01E9YqXvRtTW2KVHL48KxZr8g3CC3QNHjePACR/00cdU+OO6HidP1VldQQpKt0Y1YIgqd5/QgKLpl/7XT1HFF0nuYqy0SJDIHQsm5unbFCErmytIyng0PwWg4levG1wSFjdJU3yPXBQnKIU5QAarnKUvi9QZDqoUmWue82MfGcl4ScbLGTaftAiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3WVCME9ZvQqgj3CjaN/eEK1K4UYoKAO06zu/P2hKcIw=; b=QbNAGcWLz81fMZP/udHsG7LVg7xQtD+9XDsPdDclzen5F6uJ2VhpcERFEAOqHCTtg21xkZAA/agDwRUM2ywwEBwgUjWjnhdMdIrtlb9v3+EYWzVAHwIMS0sX8sAzUEa1tWDhQdjBYcnivU4B1OJDvEDpd5g9yx80FYa8cPkUK5fHqaYoxpfi3yg4y0tu/76Y15O/ghzG+qVuD5dLH9jNExCX4lF+sp/Nu7wpxbtW7heE9BrhA90iyRbcB3Xdy5SLd0ViJPmLAO7wJPusKkSD7jUPgbkyPye6KysVLrkD9s79jras7dfxgatvSDwb3SjTF4jfaTv/HUwiY56eDbGmnQ== 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 AM6PR0202CA0046.eurprd02.prod.outlook.com (2603:10a6:20b:3a::23) by AS8PR08MB6103.eurprd08.prod.outlook.com (2603:10a6:20b:296::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.26; Fri, 7 May 2021 10:38:14 +0000 X-Received: from AM5EUR03FT033.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:3a:cafe::6b) by AM6PR0202CA0046.outlook.office365.com (2603:10a6:20b:3a::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.24 via Frontend Transport; Fri, 7 May 2021 10:38:14 +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 AM5EUR03FT033.mail.protection.outlook.com (10.152.16.99) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4108.25 via Frontend Transport; Fri, 7 May 2021 10:38:13 +0000 X-Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX04.Arm.com (10.251.24.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Fri, 7 May 2021 10:38:05 +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.2176.2 via Frontend Transport; Fri, 7 May 2021 10:38:04 +0000 From: "Joey Gouly" To: CC: , , , , Subject: [edk2-devel] [PATCH v1 2/5] ShellPkg: add a helper function for getting a new file name Date: Fri, 7 May 2021 11:38:01 +0100 Message-ID: <20210507103804.8131-3-joey.gouly@arm.com> In-Reply-To: <20210507103804.8131-1-joey.gouly@arm.com> References: <20210507103804.8131-1-joey.gouly@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: beccfa80-ffe8-4c8c-4e6d-08d91144417a X-MS-TrafficTypeDiagnostic: AS8PR08MB6103:|AM0PR08MB3507: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:473;OLM:473; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: 4Z0Pvz0QXwX9eESfkZhbgIobYC9+AO86DTVqZxrtNADrmXfkyDQwnYg7RRKC6up86W13HEqeDRQtQb/WCeOsYcPCNfT9dWsCmgCsAjCg6fOx2NQeXwiDKSUJU2Fo9oEms4SW9+35fC8edqttwGlSRheyVRb0row8hEyUzv76Im+J+FZp4/4WughRye2NGRCcVeo49L4f3uPxnPKS+fsTJJtGLWcPQRAzmCjTzoBgC2TSpJCkw98JYnxkZnIJlnDbz08ylSfCYaBYltuV6Lt6b3zZg3dwA5F6AUEVqIdzP8elTQK3DExwNJ1JpKrFXf5YWunKf9awZMYPZClQQImEY3PHVqCj/FGKOrfEMthc9H80U6ca4jJdiWX8ZfVTtRjTSlFS1Q86LiF56pTgjycscxVLHaeE+GVuFTtl2CZFbWxYpNxHpgAXcIyY+4rtMM8HuXe6UrqqSZLo9o78l1mTLlyrCUvo58+G/GVFKv4xYCz0+ioAeZpW/h3uV6bqW2SQg3mWlmbh3s/z3J0d+VIPpOBisKr+EhARrOyGbHJv8zTyUAJAsK+NVNhYl7EV1B9dooGtUkADSGZXk5MrrzZ2GXV4gVz1q/wdu5FzqoexOAT2aNUH2nI4pJfx/gePtznVFB/6FwqJ0SeLIxn7X68EcXr/h/yrpi2kQM8B7cpPiHjXtdn1Ibl6UECjIdqvy8UUtf5tMoGcH28CkbZSAY8NYabUkV53rtUGw3d+OWuHzIHoC/lqh6m4/pw70sx/HsqRC78XmqgDmozflGkXg5kY3w== X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(4636009)(39850400004)(376002)(136003)(346002)(396003)(36840700001)(46966006)(336012)(82310400003)(7696005)(8676002)(2906002)(26005)(6666004)(47076005)(83380400001)(36860700001)(81166007)(316002)(54906003)(4326008)(186003)(70586007)(2616005)(6916009)(1076003)(36756003)(5660300002)(82740400003)(478600001)(86362001)(44832011)(356005)(426003)(70206006)(8936002)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB6103 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT020.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 6bbe18c4-bf58-4593-e59d-08d9114437a6 X-Microsoft-Antispam-Message-Info: 3S5YBdL+sNmAydZEvC7tu63Zyb4MdZgBeP2U3crNLH77Mha0ebL+aPMHjku4uPMEuo8BKCReqn0WVAghu1kN0hR3eIC1LFMfhHEMZHFJEAH86xCXDdTycWdRLUsqvSUAF2MUjun6h8gTRrAt1xlztChwp6D8q3WGvMfFJBpEZIhbGOySGfg8FYD7lTae3GslS7qZszDv/aCqdIlNyNcSTKkZhfDrEBqk4ioA+0lHA0XuOy+9n45QSUBjYZSl5zcfMxlb18tSY0KO6tXJvzoH+cVvtKtvj9YCTDxPyCQLYc5FwP8cz491korXXg9GH/cgK+lCTUWxGo7hozGEOMmq2TV5LwArTq18l1pqjNxrMcwL518TjvcYXV2LNuoXhk50Z9J0EO8fSHFIJ0iKOoFGUGF5QkOCPsKjZvHx8nTn8QHavloDotxdswPB24SUVo6EnpIdz/U6iwxvbVnYe3COxLAuKEMHzLJ9rI3EGTNDAm1uwrx6tYqc4kBSdFrLkdqtW4KafvqhIoq2n0XcMUEzuAVXXf9K7VCPV9X7h0gIAxdg0nRuBGV2b5WZoROrmbvW8VKD6LRal2VOIfzC+Dgop/eI6KSlrLlcuY1pTBUdzh/U3dKh8P5WgDBPmQyfz8HlJo2gQf5xHNF6yfZ7r738Xb9JIpWAT0gCHyGIIf+7XcE/S72PGrGsgzQsKOafGHfHzP8sTzid0Ve3yF9Yq7xbV76howq+S5RrkyYT6gfbkgI= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 May 2021 10:38:30.3548 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: beccfa80-ffe8-4c8c-4e6d-08d91144417a 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: DB5EUR03FT020.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB3507 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: 7VXZIU8hg5fENcwOWnUbR3kCx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1620383918; bh=spUsPRrJZIiCsCia8t7WKvk725UGjaGmMlC1l7JG2nY=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=aXhkL6O7rOt17LpJYHpzI53iigQe7NFXzb5Z2exet3NHBTL8S0Im17/Qxdzhml9Efcz JESgsKJH/dXGT5Ub6iXQ4lqxivio9B56585Da/YKS6R4rhtLq+6JmuA0Du3agpTnOgrk0 7DP12Cu8DovYzvHd03SuGbhwA7mr8lRSlnQ= X-ZohoMail-DKIM: pass (identity @groups.io) 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: Marc Moisson-Franckhauser 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 (#74812): https://edk2.groups.io/g/devel/message/74812 Mute This Topic: https://groups.io/mt/82651827/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Sat May 18 14:54:15 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+74810+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 1620383916155855.6745907608964; Fri, 7 May 2021 03:38:36 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id ZfCkYY1788612x72icYCuCDa; Fri, 07 May 2021 03:38:35 -0700 X-Received: from EUR04-HE1-obe.outbound.protection.outlook.com (EUR04-HE1-obe.outbound.protection.outlook.com [40.107.7.57]) by mx.groups.io with SMTP id smtpd.web12.8382.1620383914176655589 for ; Fri, 07 May 2021 03:38:34 -0700 X-Received: from DB9PR06CA0019.eurprd06.prod.outlook.com (2603:10a6:10:1db::24) by DB6PR08MB2661.eurprd08.prod.outlook.com (2603:10a6:6:17::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4087.41; Fri, 7 May 2021 10:38:31 +0000 X-Received: from DB5EUR03FT014.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:1db:cafe::ec) by DB9PR06CA0019.outlook.office365.com (2603:10a6:10:1db::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25 via Frontend Transport; Fri, 7 May 2021 10:38:31 +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+74810+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 DB5EUR03FT014.mail.protection.outlook.com (10.152.20.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25 via Frontend Transport; Fri, 7 May 2021 10:38:31 +0000 X-Received: ("Tessian outbound 52fcc5bd9d3a:v91"); Fri, 07 May 2021 10:38:31 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 8f1d9988d156defb X-CR-MTA-TID: 64aa7808 X-Received: from 2ecd4f12729b.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 5DAB225C-8B9A-4073-A7E3-B2FA2A7BF263.1; Fri, 07 May 2021 10:38:21 +0000 X-Received: from EUR04-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 2ecd4f12729b.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 07 May 2021 10:38:21 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZXdb1K1FhinmZ8v23fqTIWBqG0WTN1euKzR4/IRFX6Clf3kz2/2ezWiuhQUXLzWdhM4lsvPJ4dB5PuiDXLMXU622pRlvxBbiz6B27NQWKezRMcKTsQ1G5spZZKuKkA1V8ltWEZoR4YqeL8dAdRPyyn9BmNXPPxvrZL2iJPlasxF8Ev95VeP2WOKfCIGUDkpO4fFfBmS8BdWUpz+hTAUiK/lbRp+KjzBsNOBxNyd8YhAcSROjvmY0F/I6kdcLv9SxL/OMRmu8krEv8gJFX/N2UV6t5k72D6y9rdUurm1kB+u2lqSJO5SrpEEErqhfhDbs5+x8dDpW22MEd1gf0c5iBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ZqG1EdBoW7C3LTkpY4kO3J0iydBTxVmW+PPIli+XqJg=; b=mVMnTqQz862NDK7gx90UhD9gao2hVr55xTUZJ0z40nXuVZHHMySOLuLt9MQiCdhmxb8Dteq2e5s2U1bbcpYyGy7Tswpl6I8MZU/K1hcx4gqo/8zYE/VA91+J2VAtfKCTda2CrsBJGfyJ8j2/HmrJlhaqDBYfFlChfdJbhTQExa3/ozeU16BilbX8J18FyGp5yObtmSup8tQ3JFZLBHmMzrUN8nfE+GBBF2IeK4qMWfgtvh09byj0iZEYs18vQ2LwJJeDff7scWP7FgYYlD0fItFDAiyQkbSPRq6aaRxYc484QmQMZkah1R4F3Mt48RvKo/hfqA1S8ELRP2Kj++1MVg== 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 AM5PR1001CA0056.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:206:15::33) by DB6PR0801MB2087.eurprd08.prod.outlook.com (2603:10a6:4:77::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4087.44; Fri, 7 May 2021 10:38:18 +0000 X-Received: from AM5EUR03FT051.eop-EUR03.prod.protection.outlook.com (2603:10a6:206:15:cafe::36) by AM5PR1001CA0056.outlook.office365.com (2603:10a6:206:15::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25 via Frontend Transport; Fri, 7 May 2021 10:38:18 +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 AM5EUR03FT051.mail.protection.outlook.com (10.152.16.246) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4108.25 via Frontend Transport; Fri, 7 May 2021 10:38:18 +0000 X-Received: from AZ-NEU-EX01.Emea.Arm.com (10.251.26.4) by AZ-NEU-EX04.Arm.com (10.251.24.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2176.2; Fri, 7 May 2021 10:38:05 +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.2176.2; Fri, 7 May 2021 10:38:05 +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.2176.2 via Frontend Transport; Fri, 7 May 2021 10:38:05 +0000 From: "Joey Gouly" To: CC: , , , , Subject: [edk2-devel] [PATCH v1 3/5] ShellPkg: add a Graph option to the Parser Flags Date: Fri, 7 May 2021 11:38:02 +0100 Message-ID: <20210507103804.8131-4-joey.gouly@arm.com> In-Reply-To: <20210507103804.8131-1-joey.gouly@arm.com> References: <20210507103804.8131-1-joey.gouly@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 810b5cd0-a204-47b2-eed5-08d9114441e5 X-MS-TrafficTypeDiagnostic: DB6PR0801MB2087:|DB6PR08MB2661: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:1051;OLM:1051; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: mRteSuYjziHRVqiEJvgfmPOFNRqPQ0orDfQ6NQ17A/a1w0WZ+aV9kvZX6QfU0UvqBtehpopmQB46yTeWgxRqrBiffeoXUJTcqZkOj57aJuU5M8/0S3kO67lf6mzg56y5KHXR9xnAZ+O9VGLn/QRlzzcYBXnkYY42DO4HbQhO/2a/lWUCp2YWGkOOOrXiJIN0j9qLdIZcwWxSRlyeUypTmNDo+6Ys68pauXeD5qTBZZNErsAa+M9PgxoXi3dBXrpStkZBXT0ZnuxkW6P4L8qjnmDdhGPJVMPDi4BlwXIIRhMwvs6kB44U2dDS7rk9qwDRw2GMlSnt6Ak2QWvZMLDRbFVg453rF/GuPyJ50ApLLLYOsycyOAgnRVjCMTo+2FQmov7scO1TFfM+edlUq6qwgq9ocMiOjxGR34yL9zPFe5wY4J4CpvkTksCv9oXobwi9Cbk1z4KLYjvlw5R4oaDxLV46nEb4gFHeiPgMY1NjseDE2Z3ZzhD4AcHbNZYSCQFRnhg8s4uwfTWOmAAcmKNBmv9s5XmBlgvwfSEKoGCgGY+qs1xeB8QdgDA2Po38egDEv0P/JLr6Ib7GYJda4q0k4NMYacBj1HsWHgI9ISSWk/wVEgOKRC2TZ4uulpTsrMTLOXNNU9EhCiCu8oq7Es3/0+DiwH+B4ELvVjHxF9G4wkNx8JDCfLSl7wczjKRd+cu9EHoSn1hdz6OYy42CW8nlnwOVUzKXh0D3g0NmoO1Vk1vRrJDHymDD8w4i1mvgzsR7z+IzZrtgkapbZZLTNNBmtg== 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)(396003)(39850400004)(346002)(36840700001)(46966006)(6666004)(1076003)(4326008)(86362001)(36860700001)(44832011)(82310400003)(8676002)(36756003)(478600001)(47076005)(70586007)(186003)(426003)(2616005)(5660300002)(83380400001)(7696005)(82740400003)(6916009)(26005)(356005)(8936002)(81166007)(2906002)(54906003)(336012)(316002)(70206006)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0801MB2087 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT014.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 5d9014ff-8f91-4d8c-367f-08d911443a41 X-Microsoft-Antispam-Message-Info: UwgQ0KFGDLB74nO7bKF4RXNxiMuIecjdbOZajN1A5YkTPv0csl4VDVzlF5IO7xKWWsecKu/zsPMlZqbHbv1IVDBjGSzb32tMSatb8Zbxz4SxHk39INlnvUt0YDTqk3Aj11EzWdOgaqNq+SDwqJ6I04InJ81ZLdaQKs+tcAgiAxE/YXAiSD6SluTPqBUHD4264b/E2ILAyqmg3o9Xe8CeGrmSKM2dgR5YFH+cP3W/puFkxd/hKTqFbqPJl/zofaEsBpz4Kd9Lv6xpMnb+zkRCtCYfdrv0jdRmGwI2h2aWC0rOShnSvybdFX9OxZD5MNORCQTNLzuGMaAHjHLzoNySPYPkvPNpBpCPbUHTrUVXp4m41mPoNvYj59QOX1l+tc06f2TAEGJK3f1JyXZl3YfYzj14bFlFsTa2Qp/8wCXmOlMZDqlImbTky1MMxdPuzcCZ6vap3RJuSbTpGmWfq430Fbn1ttOEWGsj9oi9kTkeMjV1wVnOYiXFJzmHMFnSbzwM1QgRXYYMT+VO3bydDDPlNzdR5vxocUj0WJU23VpUM4aDe4Vf+7QoOGz+PXJnvHxdThEY9NQW7Mwoo3AkIV6yGfGOHsw3EsWoBuhDkBPgfnlpqVSZBfxRWf/V8PT+x9MvlzaxV4k1a5h3k+/59FGWgwvmP3RUnHFReHjgqHKZi/I4pgzAbvUJb9kPY8Zmkh9ahoai+HposzCp2U+X635AQpKVqzLkqmuZ2Rc8zQ2BJ1k= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 May 2021 10:38:31.0602 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 810b5cd0-a204-47b2-eed5-08d9114441e5 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: DB5EUR03FT014.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR08MB2661 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: BJwf9z8iQRc4mj1GSkpcQOYRx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1620383915; bh=0Jc0x2OxJ0lP388C1qPyYgwioLQ53QUBqEC6xqFFMhY=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=XcCezgJ9b4HtnxOVgnyLVe61E6a0am4xigwUN9JukeL1V+iPbnm06yyuZIYQ30tzGOt 1x9GIQp0Fjha12KoilJwN3Yo+nQpL0RLJPFGzxEQXKMa8CbUA3uZwCYGBWVrZTI/BpwNu RFQLXhRFGiSEnSFjqRxP+gxHi9B2aQpbIY0= X-ZohoMail-DKIM: pass (identity @groups.io) 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: Marc Moisson-Franckhauser 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 (#74810): https://edk2.groups.io/g/devel/message/74810 Mute This Topic: https://groups.io/mt/82651825/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Sat May 18 14:54:15 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+74809+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 1620383915670986.2773507359577; Fri, 7 May 2021 03:38:35 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 1m5SYY1788612xBxHLz2g2YJ; Fri, 07 May 2021 03:38:35 -0700 X-Received: from EUR04-DB3-obe.outbound.protection.outlook.com (EUR04-DB3-obe.outbound.protection.outlook.com [40.107.6.80]) by mx.groups.io with SMTP id smtpd.web09.8491.1620383909343578885 for ; Fri, 07 May 2021 03:38:29 -0700 X-Received: from AM6P193CA0058.EURP193.PROD.OUTLOOK.COM (2603:10a6:209:8e::35) by DB6PR08MB2647.eurprd08.prod.outlook.com (2603:10a6:6:22::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.27; Fri, 7 May 2021 10:38:23 +0000 X-Received: from AM5EUR03FT062.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:8e:cafe::66) by AM6P193CA0058.outlook.office365.com (2603:10a6:209:8e::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25 via Frontend Transport; Fri, 7 May 2021 10:38:23 +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+74809+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 AM5EUR03FT062.mail.protection.outlook.com (10.152.17.120) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25 via Frontend Transport; Fri, 7 May 2021 10:38:22 +0000 X-Received: ("Tessian outbound 6c4b4bc1cefb:v91"); Fri, 07 May 2021 10:38:22 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: a4b4145823cb3ab3 X-CR-MTA-TID: 64aa7808 X-Received: from d07be2646f68.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id BC77BA92-2D1B-4E2A-A65B-FEC92F6FBF90.1; Fri, 07 May 2021 10:38:15 +0000 X-Received: from EUR05-DB8-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id d07be2646f68.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 07 May 2021 10:38:15 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Dau66Y2hh5gkoPq2QS9ExV9NA6IyIRjBhRXnml8S1x/itz1TmTspNHVZVJ5bCnYy4p4hLe4ek6tUI4To9dm5ZILALIB10JMY19kcyUkRUBPDVFaGuEsEIZekRnM3GappL2JJSAxenE51PNGph+wSUcdmypqqtZcW1Xh22WVhQKcd9G4L5qk8SdUv6iqEqNa6IFWsCNXC3zXvv/j7StbNPxh3ucy4lL8ED6lQVhqw/aal2JdnRL5wh60jVg/Ldre3O8kqm8xWV7d/2g0v1Ijy6zMvU85LBDgioD/K+uLs9qiW1qaloy+kHnaRNZx/r/XVIGtmIq5lh1SZ45KK+8SEGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4ujfq/MHx4Yx/0SYxpzXrlyqFS9/rN0eC4wHw4WwLR4=; b=M5idu//EXzN9CrlmhaeBKVhZk0/XDgSdMwdrsvkpsy/cNLTEyLXXBnvaVzq6f6nCM06/Yk9gMbsA908+nrkwW6jJbpvAWGuK2o3Oz51nuYcx6A70Qxq4WixJVA47hxPQ1CBlXclvJjLUTvImwvWkL9sWTETnfuOLk3cYld1mFwdYifEMZiYRapJdVEPZLcDc1pTandbRYwFc5XeuJN/6NjFFKl3aE3kedkdKcGV6Yt/DldSLHJcMFs6cOtJGYrc4Xc5iL8ODx35qlC8yTi5cgvSM5Fwk8F5ONVhodiob+7nlYGLLaDDe2gPh/MsqGdYv9l+VK7ewVGERtbcixnKLRQ== 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 AM5PR1001CA0057.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:206:15::34) by DB9PR08MB6796.eurprd08.prod.outlook.com (2603:10a6:10:2ad::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.27; Fri, 7 May 2021 10:38:14 +0000 X-Received: from AM5EUR03FT051.eop-EUR03.prod.protection.outlook.com (2603:10a6:206:15:cafe::e4) by AM5PR1001CA0057.outlook.office365.com (2603:10a6:206:15::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25 via Frontend Transport; Fri, 7 May 2021 10:38:14 +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 AM5EUR03FT051.mail.protection.outlook.com (10.152.16.246) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4108.25 via Frontend Transport; Fri, 7 May 2021 10:38:14 +0000 X-Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX04.Arm.com (10.251.24.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Fri, 7 May 2021 10:38:05 +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.2176.2 via Frontend Transport; Fri, 7 May 2021 10:38:05 +0000 From: "Joey Gouly" To: CC: , , , , Subject: [edk2-devel] [PATCH v1 4/5] ShellPkg: add dot file generator functions Date: Fri, 7 May 2021 11:38:03 +0100 Message-ID: <20210507103804.8131-5-joey.gouly@arm.com> In-Reply-To: <20210507103804.8131-1-joey.gouly@arm.com> References: <20210507103804.8131-1-joey.gouly@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d2c627b7-4d87-4a4e-b853-08d911443cfa X-MS-TrafficTypeDiagnostic: DB9PR08MB6796:|DB6PR08MB2647: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:2043;OLM:2043; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: leeOr9gMjdhcQKTyZvwULIH+1ynIffDtw9UOPRhbx9fOw3dqPUV9sBqA8KiyZjRrCz96z5tPxxWL58AIeerCRwMsiBE4H9FV7n8r3gy2YLY41lHYcIn7qrMDir6zx0xjMYfcImlQo4Y8SzamQAgVsuJSng18zZLSRoVVlhmUeq9Mz2DCaFrr85KY2pfD+5gP5SazctPwlN9y2/BkJVYahELl1nAQzM4IbdKoHU1KYm2zvectaBViTgOL51Capg0TQsXgnIWNEg0QnlonppfO9N+7C1nKlKzP4zeTRtyth3+eENU+oHamXglqdEVWCJWAzn63yCpeMhOtUJJpmJq1GdkW5FVH1CY275YWFytLMRkmv4f4h6oVwbz5WdyfLyxsZnLPX3RBJ29AIn6R6C+qsiqbbQMjAIVXVr2Svxi0qSbPV+CVdUAunjlhEOJv0TE9PG4Kp/4RxT11EpXHs7OIFKEW4QZYFVOcrUpypAhbMZjtqN4BO7bw6RwOIHh1NjvBvEoG3klLWxBjA+5y7Xtj0MgteE2vap0RCq6zG9AIlPZHtvtQneogqHRRNV6UTE5CJ0IrE+WAXH8WPBnp2VFYDhQBAcoGfKchEHy6h+Y114LoS8AeKWY0uzZpgXgI2SMdXz0GkOBOytqVi9rrKhAhkwZhnShZ3+JCOr3T9ijKLeKhB/lgqnD0WMwMapxtQwLVHAa+7a0sWeNTq1El0BbNqzQDHwtrPoV9rlVJCG6LTxC/f9eoopQyOeKtJ8iUkadlibBJfdD1JaqyArRPDGHtKg== X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(4636009)(346002)(39850400004)(376002)(136003)(396003)(36840700001)(46966006)(70586007)(316002)(44832011)(7696005)(36860700001)(2616005)(70206006)(82740400003)(478600001)(26005)(5660300002)(81166007)(356005)(186003)(19627235002)(8936002)(83380400001)(54906003)(36756003)(86362001)(8676002)(6916009)(30864003)(4326008)(426003)(82310400003)(336012)(1076003)(2906002)(47076005)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB6796 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT062.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 530d7bf6-6078-4085-0553-08d911443835 X-Microsoft-Antispam-Message-Info: v8geN6DB0ijbFG8Fx8ZbNtOwqRWk2RCSe7T3UtobjGMsflCUFcWMsp2X0WMntpgUlYs4Wsc5ME0A+c5w4gStaWdO+cX8l6H+B8kF+TNsmdzm8ZU76l3993hht6QZprzvFDOH3/Jj7JPhwt9kDltrMNJQlTdAX+mu7qrYR9zXwAc8Ul1iwqfYBJUKHKxtul3e4sfr2jtwHvbxqIxMnDwj1rgIKZqp+kDtqK2ec//5YtM1pDV6onM6LVJLRSWf/MOfCZ/sWXJBKGPmVl6ANGfyiDufJJwVXnsQ6fb6kjPgQILkmeRzk4mxRLHb6V6FDlt9ypuRBJJy4fkb3lfADyoagxjZ4LAwZ8AeluIQTF1hEnb8M+AvD2eEjxqquFZckr4ew/ZMdsebEpGHd3x2uFzSaw8wQdwJ3QCK8fc7HQBcrPK9AaquQzYim0tYRb3M3dGTvUXTldMANN6zUIGGJ3DkFH8MZD37Te/KC9t4pd32hrDE0WxzDP21suLEY1D8g+tROz/f3CDn+ghPz2fJc3mQpelkNOSMm7Wy3/y/YcPiH/HOHprthQ+Zp4ZCoVvD4evtPksnl2bUHEtKywEN6j/TqBVapd9vrY4ntL0rf+VMP0Dq5DoupH7TnsdDqQUkMT9cA2Nv+xXYQ4irCvcpFZY8DOdimBOLHi0HEwvRy3U3jkNZsKdR34eMUro5/7zka/8nR6k8EEEjxiduOa4/TVTq4CIVwJ6yXK6sL0jqGBFTI4Q= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 May 2021 10:38:22.7288 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d2c627b7-4d87-4a4e-b853-08d911443cfa 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: AM5EUR03FT062.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR08MB2647 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: l5HhyYUuAHaS1J9vY3UHjQhqx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1620383915; bh=GJ82DXzD5P77x+HYZuB1haWjN4p3IPx0rIZSowtJ9do=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=AioL95m8oRXehMdYtKiMg0xFP1lNctDeqWkCbHyCjR0LdWrzZZ/wjKfzDLTKBoz+WMi mZbtVuNtCHgZua9EfgIUQx5FlzSqsJgTcixV1tfY9WvIN+RBdQZWPn+9FnEiybE5ZAznA Go2arfVdBWyTPy61XT711RdBabdDIvcC/9A= X-ZohoMail-DKIM: pass (identity @groups.io) 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: Marc Moisson-Franckhauser Signed-off-by: Joey Gouly --- ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.i= nf | 4 +- ShellPkg/Library/UefiShellAcpiViewCommandLib/DotGenerator.h = | 97 +++++++ ShellPkg/Library/UefiShellAcpiViewCommandLib/DotGenerator.c = | 276 ++++++++++++++++++++ 3 files changed, 376 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..7a8e2fdc2d2024ae54fdce963d7= 51ab53a8a5758 --- /dev/null +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/DotGenerator.h @@ -0,0 +1,97 @@ +/** @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. +**/ +VOID +DotCloseFile ( + SHELL_FILE_HANDLE DotFile + ); + +/** + Writes a line in the previously opened dot file describing a + new node. + + @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 DotFile, + 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] 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 DotFile, + 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..8c644d96af30ca4b1160bc892fe= 391ae1ff5211b --- /dev/null +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/DotGenerator.c @@ -0,0 +1,276 @@ +/** @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] 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 ("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] Name Null terminated string of the parameter's name. + @param [in] Value Null terminated string of the parameter's value. + @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] 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. +**/ +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] 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] 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 (#74809): https://edk2.groups.io/g/devel/message/74809 Mute This Topic: https://groups.io/mt/82651822/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Sat May 18 14:54:15 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+74807+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 1620383901957292.80923666302874; Fri, 7 May 2021 03:38:21 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id gshZYY1788612xqK1CqX4nol; Fri, 07 May 2021 03:38:21 -0700 X-Received: from EUR04-DB3-obe.outbound.protection.outlook.com (EUR04-DB3-obe.outbound.protection.outlook.com [40.107.6.83]) by mx.groups.io with SMTP id smtpd.web11.8260.1620383900120056340 for ; Fri, 07 May 2021 03:38:21 -0700 X-Received: from AM6PR05CA0023.eurprd05.prod.outlook.com (2603:10a6:20b:2e::36) by VI1PR08MB3791.eurprd08.prod.outlook.com (2603:10a6:803:c0::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25; Fri, 7 May 2021 10:38:17 +0000 X-Received: from AM5EUR03FT064.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:2e:cafe::c9) by AM6PR05CA0023.outlook.office365.com (2603:10a6:20b:2e::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25 via Frontend Transport; Fri, 7 May 2021 10:38: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+74807+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 AM5EUR03FT064.mail.protection.outlook.com (10.152.17.53) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25 via Frontend Transport; Fri, 7 May 2021 10:38:16 +0000 X-Received: ("Tessian outbound 1e34f83e4964:v91"); Fri, 07 May 2021 10:38:16 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: c43e000225b91e70 X-CR-MTA-TID: 64aa7808 X-Received: from f21d2d26a897.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 02C10E9A-4527-4468-8170-2FB6A9CDF8F8.1; Fri, 07 May 2021 10:38:09 +0000 X-Received: from EUR05-DB8-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id f21d2d26a897.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 07 May 2021 10:38:09 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cF0PtHciQLz9HHQcAXjU68vBQB11BCv1fLsHasA54+tbEpIgNpNOg3Z622KuudJzNEi+tyHHYtaAXERHleqZs1iU7wpiweP1Bf8fBkY+YkjNUvrqNC3DYSFRiKLjxHTvilvNnXHPPqfYW0vJcLxbtzNUFKLo+nc/imAsNY07Z5z+854nRSWt22SiV9OSCZXOfUo48SNL7XTyyPt5hvZ7NeeTQ1pKXJQdVlugtdihavDFQUlXLiK1L++AKDs0eFsnMRQn2LZYkf2pB4kJ3J7umWTURwFg2SpsEh9L/6mFh4mUNzuEfvxlzhugwoI7ngCSTT2eLhhwKCPV29vfgdmNLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=AH3T5znk9v3EoB8tanjC5q0mP5vhwGilzAwH0C8GrNo=; b=awQ5Jp6vJMLBpFPiaZvsUNo2h7uMOXp6MglxqMZKIBFirwwQYJrSxt65ovkBENMhQErsZKH5v4IMdQLZnqhrOGRkviAe8F1ztm3U86XUdcIJCCBMBw5UyFaam/AJ94KnFjB3lSgosC8cTkook3zddhpxJvHxMzYT62DVCTEVehcrhsr0uyekiYSIQGdziEmt7DVRki4DmpZIHkZ8m86m1WqHWmaBY8d03TyJHlmZgA2qRDApXiEdDLTvRUP4oq6uCkeQOZp0Axrv8Rx/JPvTwKVKM4CNggUKZMgDK7RXq1NNDUmXf3PHJ5YYwSqvFGZDUk7z3PN/japxXAMJkWiCNA== 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 AM6P194CA0060.EURP194.PROD.OUTLOOK.COM (2603:10a6:209:84::37) by VE1PR08MB5854.eurprd08.prod.outlook.com (2603:10a6:800:1b0::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.27; Fri, 7 May 2021 10:38:08 +0000 X-Received: from AM5EUR03FT018.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:84:cafe::86) by AM6P194CA0060.outlook.office365.com (2603:10a6:209:84::37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25 via Frontend Transport; Fri, 7 May 2021 10:38: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 AM5EUR03FT018.mail.protection.outlook.com (10.152.16.114) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4108.25 via Frontend Transport; Fri, 7 May 2021 10:38:07 +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.2176.2; Fri, 7 May 2021 10:38:06 +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.2176.2; Fri, 7 May 2021 10:38: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.2176.2 via Frontend Transport; Fri, 7 May 2021 10:38:05 +0000 From: "Joey Gouly" To: CC: , , , , Subject: [edk2-devel] [PATCH v1 5/5] ShellPkg: add PPTT dot file genration Date: Fri, 7 May 2021 11:38:04 +0100 Message-ID: <20210507103804.8131-6-joey.gouly@arm.com> In-Reply-To: <20210507103804.8131-1-joey.gouly@arm.com> References: <20210507103804.8131-1-joey.gouly@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 11a48d06-24b7-495c-579b-08d91144394d X-MS-TrafficTypeDiagnostic: VE1PR08MB5854:|VI1PR08MB3791: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:3173;OLM:3173; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: qV0g2ZupU3TmRUVCm4AToWaoHK/w3FdBCIOzXunzpvt4uuJJc4zkklYYjaJ3+BalVvoafuDe/qr8m+lfcDODm6tMRdwHST0Bfvq4qkWVH/qhdbCzIIak+kh67j3fZBMLAxEcbagmBV7SL7AgTN6L5CNIdoYbhSeaA0uJM4xjN38giGJMF3F2Z3qMNKecw7h+PMTOu0vWjUU26SvFJgjLeAipRLZD+6FgITpRi8WMI/mKskpDQH5BlBK3L58psVxnEDiTK5lOfiUuag+61frkg0ccOdSDs7oNxTM4FP/YSklcYzneAy8rYU5nHaMz42s+A8pDJ9flUnGgO9MLD3efO7PMRuATxtdF0EWMaIrfiU+jbyTeqZteA4dG/BWg4qJIQO+sg7Qz/dOuiypOOcgqhr3aaM1Knepc8cBjc5KjojN4xfyng0b5d9aVv+IF17txiMpGa/pCOEUshb9SJ6H6l5tg06SKnmwDXResq5W9ZSExDEYl3fQ0WqEiZX8vBSFYWj2TaVnHsZxBaufYWy5qDKMWyIoP3kCNogJFTnXjf+FRcKVdCSRORt2QtFdqNB4KM6amlIrtTZsibtYklCLZcscAHTZcQXMyZKdQejGj3rjOHNoPKJfBYpLOgvgQEOesTVq4Bn6MmqRdXLviL/PFCDvMl4UQe8KFbPBipPhAFmMHf8STAIoZyu0V+yLzZ6Ys2vFJLh+7wRljx+Cjb05/H+8NKCLfKeWTAkymbDcoFs6N1zngBJWaBPObbE8CCpIUOUSWUhavN69XY0LffdNNHQ== X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(4636009)(396003)(136003)(39850400004)(346002)(376002)(36840700001)(46966006)(82310400003)(336012)(1076003)(6916009)(426003)(4326008)(2906002)(47076005)(316002)(2616005)(36860700001)(82740400003)(81166007)(356005)(5660300002)(26005)(186003)(70586007)(7696005)(478600001)(83380400001)(44832011)(54906003)(36756003)(86362001)(8936002)(70206006)(8676002)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB5854 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT064.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 981938d4-4465-42ba-353d-08d9114433e6 X-Microsoft-Antispam-Message-Info: MNfQO6bf9Kth5moh7eyfm1iMQSGozIpp3vqpQw9MNq4mbnXkFaXtpKBaV6i85x3QqQFnXHMBeJBQkycq7x6H06dPZ+AXl9OL2ZVsDisyBDPHO8Ct+Xss9YCAt8t/Y5iEwh/tLRg87GGaeIJYLeID61UQxPzzcveMSymG6wRQzUlfCkbWnNGyM+RPdvLF4kKqthMRk8oGBbTZpbrmmhPQj+vwxnF83o/U7iNKE+N8oGGJeVeQlPJr6riNgKVm2jylHggdvjfzIB2CNra3MGlFsqekK1+ZlxgW0SHoweAcObS5m87OCKUSAuD1YvfzrjfFCbf3QyShIVXTjnNaIeBdTlEonX/wGJoX5HuufW0B6dm5UjBQJ90dJDtPjWhWoRYxUVJk3wZ0mvEBfI66vvDDNmalePxVInxBxntY1UlDSN3UJFGU5/NYhNG4szQv1BS+IjxyWgsNnPsUyMoL2dpPbn/l2ekgXnzHgDTRwe9IM4+iJmQcYkbOsuuDu2rDtodRLArT1IA3ufO/KfEpc3WBDV5X2cxyghKkzBdLdVKzOvkRhcw0OLcGhzpYvhx4pSlc0YI1zI0NlB9z0k4gncsxFnTMgj7TCYggIaw2suzD27oAEzXlCAKWMF97ofptPztMuIWLEcRYgKBtMJPn7vmI+7YeA2KXuOE8k6EVmAxLbat2gNyIzR/rUh7y84rv1Tg1VFATaXOrZbYBNasPkLgk9ODzzQHrQ5+wI2rp/ikcbxY= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 May 2021 10:38:16.5704 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 11a48d06-24b7-495c-579b-08d91144394d 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: AM5EUR03FT064.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB3791 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: fuGHQMW04T1YVFoIr4a02nBFx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1620383901; bh=Zp3wHcaMhRp4FgnotlanTK46iJF/HOe3oP4ru02UjAU=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=dL33gxSctcYlXcGPIvvFTaghm2PLr8+oD/lgyDTqfZGBzf888eYsMTC21HuuF1J/9Tx NEkxo7ZYfJNKdL8UL6FydUio8JyrACVcDLY1257EL7J+ExYcCQ9ZEoPtvsb7txJo9VoqS KrSFAPh1HBTYXUpqNkcYX8Wf9ZL/i/q3ODU= X-ZohoMail-DKIM: pass (identity @groups.io) 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: Marc Moisson-Franckhauser 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 (#74807): https://edk2.groups.io/g/devel/message/74807 Mute This Topic: https://groups.io/mt/82651819/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-