From nobody Sat May 18 23:55:23 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+61292+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1592229865490740.21165845213; Mon, 15 Jun 2020 07:04:25 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id rLtnYY1788612xSEdyLE86MS; Mon, 15 Jun 2020 07:04:23 -0700 X-Received: from EUR05-AM6-obe.outbound.protection.outlook.com (EUR05-AM6-obe.outbound.protection.outlook.com [40.107.22.67]) by mx.groups.io with SMTP id smtpd.web10.18922.1592229862592606739 for ; Mon, 15 Jun 2020 07:04:23 -0700 X-Received: from AM6P191CA0059.EURP191.PROD.OUTLOOK.COM (2603:10a6:209:7f::36) by AM6PR08MB4913.eurprd08.prod.outlook.com (2603:10a6:20b:ce::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.18; Mon, 15 Jun 2020 14:04:19 +0000 X-Received: from AM5EUR03FT006.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:7f:cafe::83) by AM6P191CA0059.outlook.office365.com (2603:10a6:209:7f::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.21 via Frontend Transport; Mon, 15 Jun 2020 14:04:19 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; edk2.groups.io; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;edk2.groups.io; dmarc=bestguesspass action=none header.from=arm.com; Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+61292+1787277+3901457@groups.io; helo=web01.groups.io; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; X-Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM5EUR03FT006.mail.protection.outlook.com (10.152.16.122) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.18 via Frontend Transport; Mon, 15 Jun 2020 14:04:19 +0000 X-Received: ("Tessian outbound d3ae83885012:v59"); Mon, 15 Jun 2020 14:04:19 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 9f2c930988e11e0e X-CR-MTA-TID: 64aa7808 X-Received: from eafa92f87f00.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 934FBA2B-6C8A-490A-A89A-430103AB4A8E.1; Mon, 15 Jun 2020 14:04:14 +0000 X-Received: from EUR04-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id eafa92f87f00.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 15 Jun 2020 14:04:14 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nBFgX5V5OJ5w92O3BnSf8JOP6k4YGZa9y9gf39nnsxoTk+8BD79eYhQOCn0/A6iYq+UKLVAYlzMMxUVxa48ThjkRIK4hyvkOqrKu86wV0pT4kAkdgWkqfn8y1ePd1NRA5JTb72GhRGVwLDNy8cNch/Ec3CzsBEl7e9NcXlXd1QV5kO2S2dcjfkiQpjCF7EwI0Y2BrtUtsZZnOtUohLUB0tWxQv/a8NwLX5EWX+We25TSqQqbiKO/lx68AMPqyAm0pGMXADS3l4U9sfBG6jaMkZVs8RkR0v/PUawa1ZBjmsKHOz5lMFVkQQy+WqQZef8m2eJviBVd4IMMVT1r4Dlf5A== 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=yLimyfg67ksFHw+Iha9g0rDeDe83NlUb1d+MgXR53Q0=; b=bA+/UUEuRvsowTAUBoLUYKL+dzkJREzf17EQrzNzVy2mQr4ArNA7HOgtrcT4mRmWmJdKcKpOJqfcdJJ1ZFcd2Gg8mKUGd1chO8sqpiQtEKn7CTNqVp/xjBi6PMUYL3lELykY3Wo14RvnuE6MwZ9Og5v9q4RvKB9fivPPCcPq+lj9aXpbPjCRBkKfvO+IZ6IkAMAQtiEcVnmK9vZshLVKQ+O6TD4jV5tSbV16B3dfkAPd1Rc9FBFJMPfcXTCg3bKyjC/8vXXsUtkhLf6XZP5GP7eDoFlz9dlEnM3dgtHNsmQwX+gKWZcKh5ckjvrGmDx4Vqwh6Zg2kkhDMJcmAjA3gg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=edk2.groups.io smtp.mailfrom=arm.com; dmarc=bestguesspass action=none header.from=arm.com; dkim=none (message not signed); arc=none X-Received: from DBBPR09CA0016.eurprd09.prod.outlook.com (2603:10a6:10:c0::28) by AM0PR08MB3633.eurprd08.prod.outlook.com (2603:10a6:208:de::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.19; Mon, 15 Jun 2020 14:04:12 +0000 X-Received: from DB5EUR03FT018.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:c0:cafe::72) by DBBPR09CA0016.outlook.office365.com (2603:10a6:10:c0::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.21 via Frontend Transport; Mon, 15 Jun 2020 14:04:12 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=bestguesspass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; X-Received: from nebula.arm.com (40.67.248.234) by DB5EUR03FT018.mail.protection.outlook.com (10.152.20.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3088.18 via Frontend Transport; Mon, 15 Jun 2020 14:04:12 +0000 X-Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX03.Arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1415.2; Mon, 15 Jun 2020 14:04:10 +0000 X-Received: from localhost.localdomain (10.57.15.84) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.1415.2 via Frontend Transport; Mon, 15 Jun 2020 14:04:10 +0000 From: "Tomas Pilar (tpilar)" To: CC: , Ray Ni , Zhichao Gao Subject: [edk2-devel] [PATCH v3 1/7] ShellPkg/AcpiView: Move log reset to main method Date: Mon, 15 Jun 2020 15:03:45 +0100 Message-ID: <20200615140351.1725-2-Tomas.Pilar@arm.com> In-Reply-To: <20200615140351.1725-1-Tomas.Pilar@arm.com> References: <20200615140351.1725-1-Tomas.Pilar@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-HT: Tenant 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;SFTY:;SFS:(4636009)(396003)(346002)(376002)(39860400002)(136003)(46966005)(70586007)(70206006)(36756003)(2906002)(8676002)(8936002)(478600001)(86362001)(82740400003)(336012)(426003)(82310400002)(4326008)(47076004)(83380400001)(81166007)(356005)(6666004)(5660300002)(1076003)(54906003)(6916009)(186003)(26005)(2616005)(316002);DIR:OUT;SFP:1101; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 57a02535-a2e4-471e-c48d-08d81134ff9f X-MS-TrafficTypeDiagnostic: AM0PR08MB3633:|AM6PR08MB4913: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:127;OLM:127; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: RM4+qVJMltvuBgvdyIB55o27c9N5CD5UvUBuE+X7SCawseGdwbCFvEnmuYFMBmfFFi7o9FtfqlXhtSurwbsijIAwSGO637hyyNweptxu33JCXuxO8303xouNE+8lpANaEofj+w12zy1xQnbHJRNrvDHAzIkbdcaizED2xz7ksrx8/IQ59y7tnengMUZUtQ4AL6NnDyDe1uvKXRIvflFzNAalaEzp2QBdtrQeOYcxVghj9W4C4piSY00XFmONk9TR02Elxa8nfUHrDe3EbV5tq2lomYzHzgXusSTF5xUqrpGHNutuf48iE5BG9ffkg2YAvWeVVCQIGBk3Uy15flKnQWQfxFXn+aNkYbXKoAlV3zMmeq1f341vldDKePPS1UdVS62Q0RIGKz73Eq+qAdPRog== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB3633 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT006.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: a00766a9-9f16-4986-2149-08d81134fb49 X-Microsoft-Antispam-Message-Info: AZ204+u0xvIBS37muqYNsTJNpUIsTsraZRM4LaYSpN76eTYNiJFU6oTOUh/tRByt9gl42gybLAADmBWxYm3GxVhQC6Nszz7mJ5GV2QcECZvtn74dtVFi756XxG0rOZD0B91C+Q2jPlVgYoKXtabqFekHith5vUWm1XBUHSFDf1SyH0PVSH4XzbY1gtERi+T/vvecZuqCgn4UWecTqnvGoFC1+XotO9u30PUaIi11/MhEw79aQ1uY5nfuIrNpdJQI4QRzwJdpcakMduTu6hhsFV2Cfp9T0D+WqokBv7XN7TMEs2QKQuDqgkFuWd0NbCZ36FQEvuNlTU9Qjt6jbhB4dHgqd+SC+TtBEcEUR/OxhdOfsbr6g3TctR5qdvTzlXWI7Ug+/rCZnbQRSyw9Yc88+Q== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2020 14:04:19.6967 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 57a02535-a2e4-471e-c48d-08d81134ff9f 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-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB4913 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,Tomas.Pilar@arm.com X-Gm-Message-State: L1jk0WHkAR19CmIncRlRoNKPx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1592229863; bh=0rVxI5AqxOE3vjTPplDi7ImO25KGz0QmXlOVGN1vCK8=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=BzlIdaMLOcZsd35irECWZxLGsfOO7X7aUyIN0XPF9Z5yN6pp0jR20MIQfpZ9x/jEXXk mlCsG5cXgWBnUn+f2GrnTKEwggo4WwLzLnbzbA3wro/nQAaIhgyMZAkh9G16oorxalxow AqIL+BmNujVOa04pDo50I3uZ+h1C3r2f5BQ= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" The error and warning counters are reset in the AcpiView main method. This improves reusability of the main method. Cc: Ray Ni Cc: Zhichao Gao Reviewed-by: Zhichao Gao Signed-off-by: Tomas Pilar --- ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c b/Shel= lPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c index 84ffb3595750..f1a95b7b8f03 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c @@ -424,6 +424,10 @@ AcpiView ( EfiConfigurationTable =3D NULL; OriginalAttribute =3D 0; =20 + // Reset The error/warning counters + ResetErrorCount (); + ResetWarningCount (); + // Search the table for an entry that matches the ACPI Table Guid FoundAcpiTable =3D FALSE; for (Index =3D 0; Index < SystemTable->NumberOfTableEntries; Index++) { @@ -566,10 +570,6 @@ ShellCommandRunAcpiView ( Package =3D NULL; TmpDumpFileHandle =3D NULL; =20 - // Reset The error/warning counters - ResetErrorCount (); - ResetWarningCount (); - Status =3D ShellCommandLineParse (ParamList, &Package, &ProblemParam, TR= UE); if (EFI_ERROR (Status)) { if (Status =3D=3D EFI_VOLUME_CORRUPTED && ProblemParam !=3D NULL) { --=20 2.24.1.windows.2 -=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 (#61292): https://edk2.groups.io/g/devel/message/61292 Mute This Topic: https://groups.io/mt/74894923/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 23:55:23 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+61297+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1592229879524609.8333305866332; Mon, 15 Jun 2020 07:04:39 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id fCQ1YY1788612xgrEQIfCUJ3; Mon, 15 Jun 2020 07:04:39 -0700 X-Received: from EUR02-HE1-obe.outbound.protection.outlook.com (EUR02-HE1-obe.outbound.protection.outlook.com [40.107.1.84]) by mx.groups.io with SMTP id smtpd.web12.18914.1592229864720388202 for ; Mon, 15 Jun 2020 07:04:25 -0700 X-Received: from MR2P264CA0076.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500:32::16) by DB8PR08MB5436.eurprd08.prod.outlook.com (2603:10a6:10:111::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.18; Mon, 15 Jun 2020 14:04:21 +0000 X-Received: from VE1EUR03FT056.eop-EUR03.prod.protection.outlook.com (2603:10a6:500:32:cafe::37) by MR2P264CA0076.outlook.office365.com (2603:10a6:500:32::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.18 via Frontend Transport; Mon, 15 Jun 2020 14:04:21 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; edk2.groups.io; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;edk2.groups.io; dmarc=bestguesspass action=none header.from=arm.com; Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+61297+1787277+3901457@groups.io; helo=web01.groups.io; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; X-Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT056.mail.protection.outlook.com (10.152.19.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.18 via Frontend Transport; Mon, 15 Jun 2020 14:04:21 +0000 X-Received: ("Tessian outbound 39cdd740f5cb:v59"); Mon, 15 Jun 2020 14:04:20 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 3de3595461860dae X-CR-MTA-TID: 64aa7808 X-Received: from f5518b1d11b7.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id ACFBB44E-B0A5-4892-9B89-E7432C3E459F.1; Mon, 15 Jun 2020 14:04:15 +0000 X-Received: from EUR02-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id f5518b1d11b7.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 15 Jun 2020 14:04:15 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iB9IIYZRZRRju82gpIlX/r8H8WwozwNQBIZ7nScm3Z0JWtwSk/OUn9vkBmx8uLccMm5ldFRLhbPmirYwEua7qv8oOUqkNOE7DYudJfCg/Cyjm2HGGnNaiQ7g4bqXXoFGcag0ounxhre+LqywoX6BIXYBwtHHWiUh2coO02ao/vmgN1szzvzDihwmTNaADPEtAsC5slxJSao2gapFiCVSVXN9hbU3a7ynGGy2I4pJkOlw3EWgHJ3yzUdZQNpl+fAaLEpRQbQfhQ5XC8+UAityjzjB4+Kk2/x57Lrd7iYCNy5m6f/3Opyq31AOW5dGQ+nrGaA4oOEpaN1DfRw4kml1ag== 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=HC3yqxWxF94mZOk0k7XOxM3P2jXGtJCTe4+afYgUarc=; b=GovV9OsNXwV1M54QZHhdFdjRI2a/O9WBy/gDpzdEdI+svZDpI0R0hNUNinIKsmQy1lYhR2Lgux+5Ge1mrblE/ODNEMwlr2OfphLUJm9ag/oSocihjnH/wQQGsXWaCxAMhWdxAjjP8GtPUvOKV9fTrPhYXO85ETEvNznVhlvaiZVEKqziFq7JpnjmJTBTYAlzq46c43+aRmXyiW/G8LjwihvRs1R7BWB6uMpFh+uq1fmbhBbw3EZwEVLuwR5SRf6DyTMGGDUNDn3AI1rtVjp7Fe9MldxwAOaCw0alTDbGlmgIanEm7uafhstnqXI61tlVXJr8fflV3DOpcFYVBtb1tQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=edk2.groups.io smtp.mailfrom=arm.com; dmarc=bestguesspass action=none header.from=arm.com; dkim=none (message not signed); arc=none X-Received: from DBBPR09CA0009.eurprd09.prod.outlook.com (2603:10a6:10:c0::21) by DB7PR08MB3337.eurprd08.prod.outlook.com (2603:10a6:5:26::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.20; Mon, 15 Jun 2020 14:04:12 +0000 X-Received: from DB5EUR03FT009.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:c0:cafe::bc) by DBBPR09CA0009.outlook.office365.com (2603:10a6:10:c0::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.18 via Frontend Transport; Mon, 15 Jun 2020 14:04:12 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=bestguesspass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; X-Received: from nebula.arm.com (40.67.248.234) by DB5EUR03FT009.mail.protection.outlook.com (10.152.20.117) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3088.18 via Frontend Transport; Mon, 15 Jun 2020 14:04:12 +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.1415.2; Mon, 15 Jun 2020 14:04:11 +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.1779.2; Mon, 15 Jun 2020 14:04:10 +0000 X-Received: from localhost.localdomain (10.57.15.84) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.1415.2 via Frontend Transport; Mon, 15 Jun 2020 14:04:10 +0000 From: "Tomas Pilar (tpilar)" To: CC: , Ray Ni , Zhichao Gao Subject: [edk2-devel] [PATCH v3 2/7] ShellPkg/AcpiView: Refactor configuration Date: Mon, 15 Jun 2020 15:03:46 +0100 Message-ID: <20200615140351.1725-3-Tomas.Pilar@arm.com> In-Reply-To: <20200615140351.1725-1-Tomas.Pilar@arm.com> References: <20200615140351.1725-1-Tomas.Pilar@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-HT: Tenant 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;SFTY:;SFS:(4636009)(396003)(39860400002)(346002)(376002)(136003)(46966005)(36756003)(5660300002)(70206006)(6916009)(186003)(1076003)(70586007)(8936002)(26005)(6666004)(8676002)(356005)(316002)(336012)(478600001)(426003)(82310400002)(82740400003)(2906002)(54906003)(47076004)(4326008)(19627235002)(86362001)(83380400001)(30864003)(2616005)(81166007);DIR:OUT;SFP:1101; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 07461d2c-237a-4711-96e5-08d811350099 X-MS-TrafficTypeDiagnostic: DB7PR08MB3337:|DB8PR08MB5436: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:5236;OLM:5236; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: aHiVgKLS643ZwNMsAqC9p1xTI4ht78oPNnEsC3QrYhioA8Jmgjt7QfPGA71EC01Lk7EakP9hKBs7nALloAiORhnEfoXWCEeRPoz+AXwtm4H8MVo3UeScXZAxrDAjGU0qtMqNkeH+FL1t5DN+8Fwwab1/3vfj48fVjS2v1ozmzoT+dXAkVXqDGRN5ky0IgDXSHYLhPynL6L/G0CXCDpIN/AotETEtIYc6qRLP0dyD91sx0U2xULL1VyEjEa37DGuwYsXTYjf4Sc8sdPwKNbFJaIMzzR5i6Fkx+Ie89evMMzr8p1dXh4Mx5dyL8mcH7Ksp1Rskb/VRWDj/WDWi2r1zHa1WPEI0iEaTZF244LDwZn/iqfj8QSwJj3qAhXVi5tGBlJT3UrKTblaz/z1trdDpvg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR08MB3337 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT056.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 65607554-b9fc-43fe-d74a-08d81134fb0e X-Microsoft-Antispam-Message-Info: ImcgCj0EGTAFjMzALluDBqmk6YpqjQOq/NRzQmmLhWBkPNEcDth+zfPtPAp0RSE7SsFUoSCcTtUDQraYVdv83IYoqJj2HyLnjPnnYD5kGRtZGXJU0gXYxv+F+QAULTELP2ON6ZnsPCMeG3OW5GTCr6aJ/8Wgnsr2fhI0eKMfS5PWhpoxiNeG1sFETS5sbPlyjePdVczUOpWjOfru35gqoKz6uQqbZilw0N4Iv8OTL19mNBOHrvuCmCe5cPXmhJWb1jemsD/KnJ+e2aiVspEfUYJJAQoLrL4sWBziEr1M605HGqdOUUq+mz4YRpKaVgKPY2WJaB7whnisqu1nCN1lK1Iek6v9Dt09v8IhSl0TPBIhJoO9lP7qXp9DbZ40T4FxSz5lsmXoTtrBlenxEq2Lqw== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2020 14:04:21.2450 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 07461d2c-237a-4711-96e5-08d811350099 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-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR08MB5436 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,Tomas.Pilar@arm.com X-Gm-Message-State: tIk1QKycZrUwJy7gasL8hGyYx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1592229879; bh=+Mth2Ler5zHoem8JL10wXkNKKLYWFtJoMlJAdzXhezE=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=kZZ11G5fC1oDUIKLYsDTgT2U/Wv4r12wmXYLGufCTnrkFSav+mwtIlgNg9f54dobR9h vQU1htH7UnotzZf0aU50QRwVJPTXMXpUKyUMUgN5n6V2LSSryJnnxQ/B73lsk4q3ZMd3t QYazfFhPV5HRw5fSoxOcOfMfXXXeGpeThrk= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" A new file and header (AcpiViewConfig.[ch]) is created that houses the user configuration. This declutters the core code and improves modularity of the design. The module level symbols for verbosity, table selection, and highlighting are refactored into the new file. Cc: Ray Ni Cc: Zhichao Gao Signed-off-by: Tomas Pilar --- .../UefiShellAcpiViewCommandLib/AcpiParser.c | 1 + .../AcpiTableParser.c | 1 + .../UefiShellAcpiViewCommandLib/AcpiView.c | 237 +++-------------- .../UefiShellAcpiViewCommandLib/AcpiView.h | 95 ------- .../AcpiViewConfig.c | 246 ++++++++++++++++++ .../AcpiViewConfig.h | 177 +++++++++++++ .../Parsers/Gtdt/GtdtParser.c | 1 + .../Parsers/Iort/IortParser.c | 1 + .../Parsers/Madt/MadtParser.c | 1 + .../Parsers/Pptt/PpttParser.c | 1 + .../Parsers/Srat/SratParser.c | 1 + .../UefiShellAcpiViewCommandLib.inf | 32 +-- 12 files changed, 479 insertions(+), 315 deletions(-) create mode 100644 ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiViewCo= nfig.c create mode 100644 ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiViewCo= nfig.h diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c b/Sh= ellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c index 3f12a33050a4..02f6d771c7e1 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c @@ -10,6 +10,7 @@ #include #include "AcpiParser.h" #include "AcpiView.h" +#include "AcpiViewConfig.h" =20 STATIC UINT32 gIndent; STATIC UINT32 mTableErrorCount; diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c= b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c index d5b9eee52323..4b618f131eac 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c @@ -17,6 +17,7 @@ #include "AcpiParser.h" #include "AcpiTableParser.h" #include "AcpiView.h" +#include "AcpiViewConfig.h" =20 #if defined(MDE_CPU_ARM) || defined (MDE_CPU_AARCH64) #include "Arm/SbbrValidator.h" diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c b/Shel= lPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c index f1a95b7b8f03..390e378e9a6c 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c @@ -20,6 +20,7 @@ #include "AcpiParser.h" #include "AcpiTableParser.h" #include "AcpiView.h" +#include "AcpiViewConfig.h" #include "UefiShellAcpiViewCommandLib.h" =20 #if defined(MDE_CPU_ARM) || defined (MDE_CPU_AARCH64) @@ -28,17 +29,8 @@ =20 EFI_HII_HANDLE gShellAcpiViewHiiHandle =3D NULL; =20 -// Report variables -STATIC UINT32 mSelectedAcpiTable; -STATIC CONST CHAR16* mSelectedAcpiTableName; -STATIC BOOLEAN mSelectedAcpiTableFound; -STATIC EREPORT_OPTION mReportType; STATIC UINT32 mTableCount; STATIC UINT32 mBinTableCount; -STATIC BOOLEAN mConsistencyCheck; -STATIC BOOLEAN mColourHighlighting; -STATIC BOOLEAN mMandatoryTableValidate; -STATIC UINTN mMandatoryTableSpec; =20 /** An array of acpiview command line parameters. @@ -53,142 +45,6 @@ STATIC CONST SHELL_PARAM_ITEM ParamList[] =3D { {NULL, TypeMax} }; =20 -/** - This function returns the colour highlighting status. - - @retval TRUE if colour highlighting is enabled. -**/ -BOOLEAN -GetColourHighlighting ( - VOID - ) -{ - return mColourHighlighting; -} - -/** - This function sets the colour highlighting status. - - @param Highlight The Highlight status. - -**/ -VOID -SetColourHighlighting ( - BOOLEAN Highlight - ) -{ - mColourHighlighting =3D Highlight; -} - -/** - This function returns the consistency checking status. - - @retval TRUE if consistency checking is enabled. -**/ -BOOLEAN -GetConsistencyChecking ( - VOID - ) -{ - return mConsistencyCheck; -} - -/** - This function sets the consistency checking status. - - @param ConsistencyChecking The consistency checking status. - -**/ -VOID -SetConsistencyChecking ( - BOOLEAN ConsistencyChecking - ) -{ - mConsistencyCheck =3D ConsistencyChecking; -} - -/** - This function returns the ACPI table requirements validation flag. - - @retval TRUE if check for mandatory table presence should be performed. -**/ -BOOLEAN -GetMandatoryTableValidate ( - VOID - ) -{ - return mMandatoryTableValidate; -} - -/** - This function sets the ACPI table requirements validation flag. - - @param Validate Enable/Disable ACPI table requirements validation. -**/ -VOID -SetMandatoryTableValidate ( - BOOLEAN Validate - ) -{ - mMandatoryTableValidate =3D Validate; -} - -/** - This function returns the identifier of specification to validate ACPI t= able - requirements against. - - @return ID of specification listing mandatory tables. -**/ -UINTN -GetMandatoryTableSpec ( - VOID - ) -{ - return mMandatoryTableSpec; -} - -/** - This function sets the identifier of specification to validate ACPI table - requirements against. - - @param Spec ID of specification listing mandatory tables. -**/ -VOID -SetMandatoryTableSpec ( - UINTN Spec - ) -{ - mMandatoryTableSpec =3D Spec; -} - -/** - This function returns the report options. - - @retval Returns the report option. -**/ -STATIC -EREPORT_OPTION -GetReportOption ( - VOID - ) -{ - return mReportType; -} - -/** - This function returns the selected ACPI table. - - @retval Returns signature of the selected ACPI table. -**/ -STATIC -UINT32 -GetSelectedAcpiTable ( - VOID - ) -{ - return mSelectedAcpiTable; -} - /** This function dumps the ACPI table to a file. =20 @@ -205,19 +61,21 @@ DumpAcpiTableToFile ( IN CONST UINTN Length ) { - EFI_STATUS Status; - CHAR16 FileNameBuffer[MAX_FILE_NAME_LEN]; - SHELL_FILE_HANDLE DumpFileHandle; - UINTN TransferBytes; + EFI_STATUS Status; + CHAR16 FileNameBuffer[MAX_FILE_NAME_LEN]; + SHELL_FILE_HANDLE DumpFileHandle; + UINTN TransferBytes; + SELECTED_ACPI_TABLE *SelectedTable; =20 DumpFileHandle =3D NULL; TransferBytes =3D Length; + GetSelectedAcpiTable (&SelectedTable); =20 UnicodeSPrint ( FileNameBuffer, sizeof (FileNameBuffer), L".\\%s%04d.bin", - mSelectedAcpiTableName, + SelectedTable->Name, mBinTableCount++ ); =20 @@ -273,10 +131,11 @@ ProcessTableReportOptions ( IN CONST UINT32 Length ) { - UINTN OriginalAttribute; - UINT8* SignaturePtr; - BOOLEAN Log; - BOOLEAN HighLight; + UINTN OriginalAttribute; + UINT8 *SignaturePtr; + BOOLEAN Log; + BOOLEAN HighLight; + SELECTED_ACPI_TABLE *SelectedTable; =20 // // set local variables to suppress incorrect compiler/analyzer warnings @@ -285,15 +144,16 @@ ProcessTableReportOptions ( SignaturePtr =3D (UINT8*)(UINTN)&Signature; Log =3D FALSE; HighLight =3D GetColourHighlighting (); + GetSelectedAcpiTable (&SelectedTable); =20 switch (GetReportOption ()) { case ReportAll: Log =3D TRUE; break; case ReportSelected: - if (Signature =3D=3D GetSelectedAcpiTable ()) { + if (Signature =3D=3D SelectedTable->Type) { Log =3D TRUE; - mSelectedAcpiTableFound =3D TRUE; + SelectedTable->Found =3D TRUE; } break; case ReportTableList: @@ -321,8 +181,8 @@ ProcessTableReportOptions ( ); break; case ReportDumpBinFile: - if (Signature =3D=3D GetSelectedAcpiTable ()) { - mSelectedAcpiTableFound =3D TRUE; + if (Signature =3D=3D SelectedTable->Type) { + SelectedTable->Found =3D TRUE; DumpAcpiTableToFile (TablePtr, Length); } break; @@ -356,37 +216,7 @@ ProcessTableReportOptions ( return Log; } =20 -/** - This function converts a string to ACPI table signature. - - @param [in] Str Pointer to the string to be converted to the - ACPI table signature. =20 - @retval The ACPI table signature. -**/ -STATIC -UINT32 -ConvertStrToAcpiSignature ( - IN CONST CHAR16* Str - ) -{ - UINT8 Index; - CHAR8 Ptr[4]; - - ZeroMem (Ptr, sizeof (Ptr)); - Index =3D 0; - - // Convert to Upper case and convert to ASCII - while ((Index < 4) && (Str[Index] !=3D 0)) { - if (Str[Index] >=3D L'a' && Str[Index] <=3D L'z') { - Ptr[Index] =3D (CHAR8)(Str[Index] - (L'a' - L'A')); - } else { - Ptr[Index] =3D (CHAR8)Str[Index]; - } - Index++; - } - return *(UINT32*)Ptr; -} =20 /** This function iterates the configuration table entries in the @@ -417,6 +247,7 @@ AcpiView ( UINT8 RsdpRevision; PARSE_ACPI_TABLE_PROC RsdpParserProc; BOOLEAN Trace; + SELECTED_ACPI_TABLE *SelectedTable; =20 // // set local variables to suppress incorrect compiler/analyzer warnings @@ -428,6 +259,9 @@ AcpiView ( ResetErrorCount (); ResetWarningCount (); =20 + // Retrieve the user selection of ACPI table to process + GetSelectedAcpiTable (&SelectedTable); + // Search the table for an entry that matches the ACPI Table Guid FoundAcpiTable =3D FALSE; for (Index =3D 0; Index < SystemTable->NumberOfTableEntries; Index++) { @@ -496,7 +330,7 @@ AcpiView ( if (ReportTableList !=3D ReportOption) { if (((ReportSelected =3D=3D ReportOption) || (ReportDumpBinFile =3D=3D ReportOption)) && - (!mSelectedAcpiTableFound)) { + (!SelectedTable->Found)) { Print (L"\nRequested ACPI Table not found.\n"); } else if (GetConsistencyChecking () && (ReportDumpBinFile !=3D ReportOption)) { @@ -554,17 +388,12 @@ ShellCommandRunAcpiView ( CHAR16* ProblemParam; SHELL_FILE_HANDLE TmpDumpFileHandle; CONST CHAR16* MandatoryTableSpecStr; + CONST CHAR16 *SelectedTableName; =20 // Set Defaults - mReportType =3D ReportAll; mTableCount =3D 0; mBinTableCount =3D 0; - mSelectedAcpiTable =3D 0; - mSelectedAcpiTableName =3D NULL; - mSelectedAcpiTableFound =3D FALSE; - mConsistencyCheck =3D TRUE; - mMandatoryTableValidate =3D FALSE; - mMandatoryTableSpec =3D 0; + AcpiConfigSetDefaults (); =20 ShellStatus =3D SHELL_SUCCESS; Package =3D NULL; @@ -671,25 +500,23 @@ ShellCommandRunAcpiView ( } =20 if (ShellCommandLineGetFlag (Package, L"-l")) { - mReportType =3D ReportTableList; + SetReportOption (ReportTableList); } else { - mSelectedAcpiTableName =3D ShellCommandLineGetValue (Package, L"-s= "); - if (mSelectedAcpiTableName !=3D NULL) { - mSelectedAcpiTable =3D (UINT32)ConvertStrToAcpiSignature ( - mSelectedAcpiTableName - ); - mReportType =3D ReportSelected; + SelectedTableName =3D ShellCommandLineGetValue (Package, L"-s"); + if (SelectedTableName !=3D NULL) { + SelectAcpiTable (SelectedTableName); + SetReportOption (ReportSelected); =20 if (ShellCommandLineGetFlag (Package, L"-d")) { // Create a temporary file to check if the media is writable. CHAR16 FileNameBuffer[MAX_FILE_NAME_LEN]; - mReportType =3D ReportDumpBinFile; + SetReportOption (ReportDumpBinFile); =20 UnicodeSPrint ( FileNameBuffer, sizeof (FileNameBuffer), L".\\%s%04d.tmp", - mSelectedAcpiTableName, + SelectedTableName, mBinTableCount ); =20 diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h b/Shel= lPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h index be65564c86a6..92d64a88814d 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h @@ -23,17 +23,6 @@ **/ #define RSDP_LENGTH_OFFSET 20 =20 -/** - The EREPORT_OPTION enum describes ACPI table Reporting options. -**/ -typedef enum ReportOption { - ReportAll, ///< Report All tables. - ReportSelected, ///< Report Selected table. - ReportTableList, ///< Report List of tables. - ReportDumpBinFile, ///< Dump selected table to a file. - ReportMax, -} EREPORT_OPTION; - /** This function resets the ACPI table error counter to Zero. **/ @@ -70,90 +59,6 @@ GetWarningCount ( VOID ); =20 -/** - This function returns the colour highlighting status. - - @retval TRUE if colour highlighting is enabled. -**/ -BOOLEAN -GetColourHighlighting ( - VOID - ); - -/** - This function sets the colour highlighting status. - - @param Highlight The Highlight status. - -**/ -VOID -SetColourHighlighting ( - BOOLEAN Highlight - ); - -/** - This function returns the consistency checking status. - - @retval TRUE if consistency checking is enabled. -**/ -BOOLEAN -GetConsistencyChecking ( - VOID - ); - -/** - This function sets the consistency checking status. - - @param ConsistencyChecking The consistency checking status. - -**/ -VOID -SetConsistencyChecking ( - BOOLEAN ConsistencyChecking - ); - -/** - This function returns the ACPI table requirements validation flag. - - @retval TRUE if check for mandatory table presence should be performed. -**/ -BOOLEAN -GetMandatoryTableValidate ( - VOID - ); - -/** - This function sets the ACPI table requirements validation flag. - - @param Validate Enable/Disable ACPI table requirements validation. -**/ -VOID -SetMandatoryTableValidate ( - BOOLEAN Validate - ); - -/** - This function returns the identifier of specification to validate ACPI t= able - requirements against. - - @return ID of specification listing mandatory tables. -**/ -UINTN -GetMandatoryTableSpec ( - VOID - ); - -/** - This function sets the identifier of specification to validate ACPI table - requirements against. - - @param Spec ID of specification listing mandatory tables. -**/ -VOID -SetMandatoryTableSpec ( - UINTN Spec - ); - /** This function processes the table reporting options for the ACPI table. =20 diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiViewConfig.c = b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiViewConfig.c new file mode 100644 index 000000000000..759a915928c7 --- /dev/null +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiViewConfig.c @@ -0,0 +1,246 @@ +/** @file + State and accessors for 'acpiview' configuration. + + Copyright (c) 2016 - 2020, ARM Limited. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#include +#include + +#include "AcpiViewConfig.h" + +// Report variables +STATIC BOOLEAN mConsistencyCheck; +STATIC BOOLEAN mColourHighlighting; +STATIC EREPORT_OPTION mReportType; +STATIC BOOLEAN mMandatoryTableValidate; +STATIC UINTN mMandatoryTableSpec; + +// User selection of which ACPI table should be checked +SELECTED_ACPI_TABLE mSelectedAcpiTable; + +/** + Reset the AcpiView user configuration to defaults +**/ +VOID +EFIAPI +AcpiConfigSetDefaults ( + VOID + ) +{ + mReportType =3D ReportAll; + mSelectedAcpiTable.Type =3D 0; + mSelectedAcpiTable.Name =3D NULL; + mSelectedAcpiTable.Found =3D FALSE; + mConsistencyCheck =3D TRUE; + mMandatoryTableValidate =3D FALSE; + mMandatoryTableSpec =3D 0; +} + +/** + This function converts a string to ACPI table signature. + + @param [in] Str Pointer to the string to be converted to the + ACPI table signature. + + @retval The ACPI table signature. +**/ +STATIC +UINT32 +ConvertStrToAcpiSignature ( + IN CONST CHAR16 *Str + ) +{ + UINT8 Index; + CHAR8 Ptr[4]; + + ZeroMem (Ptr, sizeof (Ptr)); + Index =3D 0; + + // Convert to Upper case and convert to ASCII + while ((Index < 4) && (Str[Index] !=3D 0)) { + if (Str[Index] >=3D L'a' && Str[Index] <=3D L'z') { + Ptr[Index] =3D (CHAR8)(Str[Index] - (L'a' - L'A')); + } else { + Ptr[Index] =3D (CHAR8)Str[Index]; + } + Index++; + } + return *(UINT32 *) Ptr; +} + +/** + This function selects an ACPI table in current context. + The string name of the table is converted into UINT32 + table signature. + + @param [in] TableName The name of the ACPI table to select. +**/ +VOID +EFIAPI +SelectAcpiTable ( + IN CONST CHAR16 *TableName + ) +{ + ASSERT (TableName !=3D NULL); + + mSelectedAcpiTable.Name =3D TableName; + mSelectedAcpiTable.Type =3D ConvertStrToAcpiSignature (mSelectedAcpiTabl= e.Name); +} + +/** + This function returns the selected ACPI table. + + @param [out] SelectedAcpiTable Pointer that will contain the returned st= ruct. +**/ +VOID +EFIAPI +GetSelectedAcpiTable ( + OUT SELECTED_ACPI_TABLE **SelectedAcpiTable + ) +{ + *SelectedAcpiTable =3D &mSelectedAcpiTable; +} + +/** + This function returns the colour highlighting status. + + @retval TRUE Colour highlighting is enabled. +**/ +BOOLEAN +EFIAPI +GetColourHighlighting ( + VOID + ) +{ + return mColourHighlighting; +} + +/** + This function sets the colour highlighting status. + + @param [in] Highlight The highlight status. +**/ +VOID +EFIAPI +SetColourHighlighting ( + BOOLEAN Highlight + ) +{ + mColourHighlighting =3D Highlight; +} + +/** + This function returns the consistency checking status. + + @retval TRUE Consistency checking is enabled. +**/ +BOOLEAN +EFIAPI +GetConsistencyChecking ( + VOID + ) +{ + return mConsistencyCheck; +} + +/** + This function sets the consistency checking status. + + @param [in] ConsistencyChecking The consistency checking status. +**/ +VOID +EFIAPI +SetConsistencyChecking ( + BOOLEAN ConsistencyChecking + ) +{ + mConsistencyCheck =3D ConsistencyChecking; +} + +/** + This function returns the report options. + + @return The current report option. +**/ +EREPORT_OPTION +EFIAPI +GetReportOption ( + VOID + ) +{ + return mReportType; +} + +/** + This function sets the report options. + + @param [in] ReportType The report option to set. +**/ +VOID +EFIAPI +SetReportOption ( + EREPORT_OPTION ReportType + ) +{ + mReportType =3D ReportType; +} + +/** + This function returns the ACPI table requirements validation flag. + + @retval TRUE Check for mandatory table presence should be performed. +**/ +BOOLEAN +EFIAPI +GetMandatoryTableValidate ( + VOID + ) +{ + return mMandatoryTableValidate; +} + +/** + This function sets the ACPI table requirements validation flag. + + @param [in] Validate Enable/Disable ACPI table requirements validation. +**/ +VOID +EFIAPI +SetMandatoryTableValidate ( + BOOLEAN Validate + ) +{ + mMandatoryTableValidate =3D Validate; +} + +/** + This function returns the identifier of specification to validate ACPI t= able + requirements against. + + @return ID of specification listing mandatory tables. +**/ +UINTN +EFIAPI +GetMandatoryTableSpec ( + VOID + ) +{ + return mMandatoryTableSpec; +} + +/** + This function sets the identifier of specification to validate ACPI table + requirements against. + + @param [in] Spec ID of specification listing mandatory tables. +**/ +VOID +EFIAPI +SetMandatoryTableSpec ( + UINTN Spec + ) +{ + mMandatoryTableSpec =3D Spec; +} diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiViewConfig.h = b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiViewConfig.h new file mode 100644 index 000000000000..2db4a65415d8 --- /dev/null +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiViewConfig.h @@ -0,0 +1,177 @@ +/** @file + Header file for 'acpiview' configuration. + + Copyright (c) 2016 - 2020, ARM Limited. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#ifndef ACPI_VIEW_CONFIG_H_ +#define ACPI_VIEW_CONFIG_H_ + +/** + This function returns the colour highlighting status. + + @retval TRUE Colour highlighting is enabled. +**/ +BOOLEAN +EFIAPI +GetColourHighlighting ( + VOID + ); + +/** + This function sets the colour highlighting status. + + @param [in] Highlight The highlight status. +**/ +VOID +EFIAPI +SetColourHighlighting ( + BOOLEAN Highlight + ); + +/** + This function returns the consistency checking status. + + @retval TRUE Consistency checking is enabled. +**/ +BOOLEAN +EFIAPI +GetConsistencyChecking ( + VOID + ); + +/** + This function sets the consistency checking status. + + @param [in] ConsistencyChecking The consistency checking status. +**/ +VOID +EFIAPI +SetConsistencyChecking ( + BOOLEAN ConsistencyChecking + ); + +/** + This function returns the ACPI table requirements validation flag. + + @retval TRUE Check for mandatory table presence should be performed. +**/ +BOOLEAN +EFIAPI +GetMandatoryTableValidate ( + VOID + ); + +/** + This function sets the ACPI table requirements validation flag. + + @param [in] Validate Enable/Disable ACPI table requirements validation. +**/ +VOID +EFIAPI +SetMandatoryTableValidate ( + BOOLEAN Validate + ); + +/** + This function returns the identifier of specification to validate ACPI t= able + requirements against. + + @return ID of specification listing mandatory tables. +**/ +UINTN +EFIAPI +GetMandatoryTableSpec ( + VOID + ); + +/** + This function sets the identifier of specification to validate ACPI table + requirements against. + + @param [in] Spec ID of specification listing mandatory tables. +**/ +VOID +EFIAPI +SetMandatoryTableSpec ( + UINTN Spec + ); + +/** + The EREPORT_OPTION enum describes ACPI table Reporting options. +**/ +typedef enum { + ReportAll, ///< Report All tables. + ReportSelected, ///< Report Selected table. + ReportTableList, ///< Report List of tables. + ReportDumpBinFile, ///< Dump selected table to a file. + ReportMax, +} EREPORT_OPTION; + +/** + This function returns the report options. + + @return The current report option. +**/ +EREPORT_OPTION +EFIAPI +GetReportOption ( + VOID + ); + +/** + This function sets the report options. + + @param [in] ReportType The report option to set. +**/ +VOID +EFIAPI +SetReportOption ( + EREPORT_OPTION ReportType + ); + +/** + A structure holding the user selection detailing which + ACPI table is to be examined by the AcpiView code. +**/ +typedef struct { + UINT32 Type; ///< 32bit signature of the selected ACPI t= able. + CONST CHAR16* Name; ///< User friendly name of the selected ACP= I table. + BOOLEAN Found; ///< The selected table has been found in t= he system. +} SELECTED_ACPI_TABLE; + +/** + This function returns the selected ACPI table. + + @param [out] SelectedAcpiTable Pointer that will contain the returned st= ruct. +**/ +VOID +EFIAPI +GetSelectedAcpiTable ( + OUT SELECTED_ACPI_TABLE** SelectedAcpiTable + ); + +/** + This function selects an ACPI table in current context. + The string name of the table is converted into UINT32 + table signature. + + @param [in] TableName The name of the ACPI table to select. +**/ +VOID +EFIAPI +SelectAcpiTable ( + CONST CHAR16* TableName + ); + +/** + Reset the AcpiView user configuration to defaults. +**/ +VOID +EFIAPI +AcpiConfigSetDefaults ( + VOID + ); + +#endif // ACPI_VIEW_CONFIG_H_ diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/Gtdt= Parser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtPa= rser.c index bdd30ff45c61..d02fc4929d6f 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c @@ -12,6 +12,7 @@ #include #include "AcpiParser.h" #include "AcpiTableParser.h" +#include "AcpiViewConfig.h" =20 // "The number of GT Block Timers must be less than or equal to 8" #define GT_BLOCK_TIMER_COUNT_MAX 8 diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/Iort= Parser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortPa= rser.c index 9a006a01448b..f7447947b230 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c @@ -13,6 +13,7 @@ #include #include "AcpiParser.h" #include "AcpiTableParser.h" +#include "AcpiViewConfig.h" =20 // Local variables STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/Madt= Parser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtPa= rser.c index f85d2b36532c..15aa2392b60c 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c @@ -15,6 +15,7 @@ #include #include "AcpiParser.h" #include "AcpiTableParser.h" +#include "AcpiViewConfig.h" #include "MadtParser.h" =20 // Local Variables diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/Pptt= Parser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/PpttPa= rser.c index 0db272c16af0..acd2b81bb325 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/PpttParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/PpttParser.c @@ -13,6 +13,7 @@ #include #include "AcpiParser.h" #include "AcpiView.h" +#include "AcpiViewConfig.h" #include "PpttParser.h" =20 // Local variables diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/Srat= Parser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratPa= rser.c index 6f66be68cc0b..b9b67820b89f 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c @@ -13,6 +13,7 @@ #include #include "AcpiParser.h" #include "AcpiTableParser.h" +#include "AcpiViewConfig.h" =20 // Local Variables STATIC CONST UINT8* SratRAType; diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiView= CommandLib.inf b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpi= ViewCommandLib.inf index d21ecd40a8cf..92de2391b09f 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommand= Lib.inf +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommand= Lib.inf @@ -19,15 +19,14 @@ [Defines] DESTRUCTOR =3D UefiShellAcpiViewCommandLibDestructor =20 [Sources.common] - UefiShellAcpiViewCommandLib.uni - UefiShellAcpiViewCommandLib.c - UefiShellAcpiViewCommandLib.h - AcpiParser.h - AcpiTableParser.h - AcpiView.h AcpiParser.c + AcpiParser.h AcpiTableParser.c + AcpiTableParser.h AcpiView.c + AcpiView.h + AcpiViewConfig.c + AcpiViewConfig.h Parsers/Bgrt/BgrtParser.c Parsers/Dbg2/Dbg2Parser.c Parsers/Dsdt/DsdtParser.c @@ -36,40 +35,43 @@ [Sources.common] Parsers/Gtdt/GtdtParser.c Parsers/Iort/IortParser.c Parsers/Madt/MadtParser.c + Parsers/Madt/MadtParser.h Parsers/Mcfg/McfgParser.c Parsers/Pptt/PpttParser.c + Parsers/Pptt/PpttParser.h Parsers/Rsdp/RsdpParser.c Parsers/Slit/SlitParser.c Parsers/Spcr/SpcrParser.c Parsers/Srat/SratParser.c Parsers/Ssdt/SsdtParser.c Parsers/Xsdt/XsdtParser.c - Parsers/Madt/MadtParser.h - Parsers/Pptt/PpttParser.h + UefiShellAcpiViewCommandLib.c + UefiShellAcpiViewCommandLib.h + UefiShellAcpiViewCommandLib.uni =20 [Sources.ARM, Sources.AARCH64] Arm/SbbrValidator.h Arm/SbbrValidator.c =20 [Packages] + MdeModulePkg/MdeModulePkg.dec MdePkg/MdePkg.dec ShellPkg/ShellPkg.dec - MdeModulePkg/MdeModulePkg.dec =20 [LibraryClasses] - MemoryAllocationLib BaseLib BaseMemoryLib DebugLib + FileHandleLib + HiiLib + MemoryAllocationLib + PcdLib + PrintLib ShellCommandLib ShellLib + UefiBootServicesTableLib UefiLib UefiRuntimeServicesTableLib - UefiBootServicesTableLib - PcdLib - HiiLib - PrintLib - FileHandleLib =20 =20 [FixedPcd] --=20 2.24.1.windows.2 -=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 (#61297): https://edk2.groups.io/g/devel/message/61297 Mute This Topic: https://groups.io/mt/74894929/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 23:55:23 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+61291+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1592229867558937.60190204131; Mon, 15 Jun 2020 07:04:27 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id L4mLYY1788612x6SXqcMqTbW; Mon, 15 Jun 2020 07:04:26 -0700 X-Received: from EUR05-AM6-obe.outbound.protection.outlook.com (EUR05-AM6-obe.outbound.protection.outlook.com [40.107.22.79]) by mx.groups.io with SMTP id smtpd.web12.18912.1592229862593742205 for ; Mon, 15 Jun 2020 07:04:23 -0700 X-Received: from AM6PR0202CA0049.eurprd02.prod.outlook.com (2603:10a6:20b:3a::26) by AM6PR08MB5237.eurprd08.prod.outlook.com (2603:10a6:20b:e9::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.24; Mon, 15 Jun 2020 14:04:19 +0000 X-Received: from AM5EUR03FT054.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:3a:cafe::1a) by AM6PR0202CA0049.outlook.office365.com (2603:10a6:20b:3a::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.20 via Frontend Transport; Mon, 15 Jun 2020 14:04:19 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; edk2.groups.io; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;edk2.groups.io; dmarc=bestguesspass action=none header.from=arm.com; Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+61291+1787277+3901457@groups.io; helo=web01.groups.io; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; X-Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM5EUR03FT054.mail.protection.outlook.com (10.152.16.212) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.18 via Frontend Transport; Mon, 15 Jun 2020 14:04:19 +0000 X-Received: ("Tessian outbound d3ae83885012:v59"); Mon, 15 Jun 2020 14:04:19 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: cbae346db3c4ced2 X-CR-MTA-TID: 64aa7808 X-Received: from bcac2386ca0b.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id F1B9592C-761D-442C-BD32-3F26AC84B06E.1; Mon, 15 Jun 2020 14:04:13 +0000 X-Received: from EUR01-VE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id bcac2386ca0b.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 15 Jun 2020 14:04:13 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NaPAI1K/8XEPSB0mGHrz+BYbq8ncYjfMWHktDJzdQmMAnQvdNbUWvb9bdR3BwmMc2eJJdmg+RuYRPE66XTaSkKSvmQHT68N58H1J9r2YFSKKE9IoAHLE7hNcTgOeTdkX1o8oGS4CLOjwk5zTd0F95QIPye7dJqn+QuMphsCA+jso6qI/ofQE0XwTi6C/qeCxzvvu0nyxEJVgFusp9I6VC1KH9Ja9EhzVSPA0KR4+zFwksKxt+FRaoSBWwaxuFtVX1g18FiI9irZhvAasZglgSjoBIdeD3gK8W2X5zmT9J+bZtpEnT733tMqkl8GMPgE2SZsSoBvxO4DlaUN92jsgtg== 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=3vOCzCOa7OkwfGew4FK4hbMpazq9hzx93f9Apc6xIxw=; b=YesG7E3oEIV4tBt3gutPDtCycyhTM80CyLsXPim67bahQgPZJUhWhTNaSMQAm17e00cVQYjyGQEK6fnI3oHwdVOR8pVcZ7EfNPavCzsZY6vN7QvEuSzC9tgOHeoL0QtLQBjNBxP7sPRZsNfxCgGSN2bcKgnOCfJtkxJ2EvyCoLy7Dm9NxUPddpTzW1ky6vF2UjtuxvvVnfedFjCbi0EQzjAkDQScykUzcco1FU7EQBRO6mtduz1CbJlzgat8tp6/i49Bjt/TXmci7A4d+PU5Am+ZCguJnyjZDeICCtIe9a3K1ltmBKng3zZxCYH2FSOFI++qvMtqvsHEZw9OylsUJA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=edk2.groups.io smtp.mailfrom=arm.com; dmarc=bestguesspass action=none header.from=arm.com; dkim=none (message not signed); arc=none X-Received: from DBBPR09CA0019.eurprd09.prod.outlook.com (2603:10a6:10:c0::31) by AM0PR08MB4290.eurprd08.prod.outlook.com (2603:10a6:208:138::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.21; Mon, 15 Jun 2020 14:04:11 +0000 X-Received: from DB5EUR03FT018.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:c0:cafe::13) by DBBPR09CA0019.outlook.office365.com (2603:10a6:10:c0::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.19 via Frontend Transport; Mon, 15 Jun 2020 14:04:11 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=bestguesspass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; X-Received: from nebula.arm.com (40.67.248.234) by DB5EUR03FT018.mail.protection.outlook.com (10.152.20.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3088.18 via Frontend Transport; Mon, 15 Jun 2020 14:04:11 +0000 X-Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX03.Arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1415.2; Mon, 15 Jun 2020 14:04:11 +0000 X-Received: from localhost.localdomain (10.57.15.84) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.1415.2 via Frontend Transport; Mon, 15 Jun 2020 14:04:11 +0000 From: "Tomas Pilar (tpilar)" To: CC: , Ray Ni , Zhichao Gao Subject: [edk2-devel] [PATCH v3 3/7] ShellPkg/AcpiView: Move table count reset Date: Mon, 15 Jun 2020 15:03:47 +0100 Message-ID: <20200615140351.1725-4-Tomas.Pilar@arm.com> In-Reply-To: <20200615140351.1725-1-Tomas.Pilar@arm.com> References: <20200615140351.1725-1-Tomas.Pilar@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-HT: Tenant 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;SFTY:;SFS:(4636009)(396003)(39860400002)(136003)(346002)(376002)(46966005)(4326008)(356005)(82310400002)(6666004)(81166007)(83380400001)(82740400003)(336012)(6916009)(26005)(47076004)(5660300002)(186003)(36756003)(70586007)(316002)(70206006)(2906002)(8676002)(54906003)(1076003)(2616005)(86362001)(478600001)(8936002)(426003);DIR:OUT;SFP:1101; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 72591d23-0bd1-448a-2dea-08d81134ff5d X-MS-TrafficTypeDiagnostic: AM0PR08MB4290:|AM6PR08MB5237: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:1107;OLM:1107; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: B1PU0DwdkpEpKs3oj4oMxbjYzvgfJj1+IsUKoxufrozf3QsaHxTJV1/24MhoIeWC8DiyoHRMjoNe7lixZfTmrQlkxS/oWU+tvtjvWi6JEYNrXcEh8MIX6WpaYMC96YbheAfpRmmPJ07A8MXCXNrv1OKKTshGmhxdkUVj9bLUGIzZ59KyM6krNkV45WG+7t0GHRYDN4Ave9VZKPCEnL+KJvVg9R0hZ0kMgV4d0uusoSWDxUgrsBHxc4IwlrjKCPYcSTmvk2UycZvz1tk5m8tJ+QDochhhItFGzogkk7F5aBuDteb5TKX2y04WqpewmxW0zKvhCdQQ6IsCIA16lueHzPsozjwZfEL2kZYGkOgFOf/k+wMUIfbMSsDlZohhcDEyOb5/jjZcFEQzGRYnISElfw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB4290 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT054.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: e1aa142f-f9fe-46ad-5225-08d81134fad2 X-Microsoft-Antispam-Message-Info: B1gEa4XCI1CJxV8eu9TO9zsFpddriKye4YFNnDIJSLHEyh7KqyOkLJwLfbyWkmlhl0oYLbhkjA8LjkxRk5DfXjIfzSxGr3sWt6iEtz2oxcktNfB2fI4JWBAkT44pKssI8kRVs6b4jQyO8PIVvFXVRRtOoh05s7IVrMOUkPvxBo3hrBj0cPV0IJfYUZstn3qwS1QxgLVDTPWrjv63E21DDksXtdQsjBtKHhfMJKYCz7JfDeGb2aFqLafPNj66kcUL9gKQGMaS65t7sRWrRBXPlKZsrFZ1qoBW72Xp8J/7t2QlgSa6axU+KwO48KgTxJVHG6wqbjHImEH50Kyw9jxI9/rOO39HKg1gEosJtkftIXiy46yub28SzmO+dectsdo9qnScnROc0nXptPNdMxuznw== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2020 14:04:19.2553 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 72591d23-0bd1-448a-2dea-08d81134ff5d 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-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB5237 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,Tomas.Pilar@arm.com X-Gm-Message-State: JyD1WDEKUSJGxk1Y9v1lHeinx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1592229866; bh=LRxqO2LGni4DK9ttY35p2IMAeHpwGGAcIZDT6Nr4FUY=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=WPEXkZMRAwaqbr27aR9Y4o0Jl/ZFDWf9tVFxIpRL7Zmjf1DdJFPJaOY6nEs3xIjlc5P pMmAJApUF5vkeTE9gwfvOuwHBT7J6CYeS/Ck3TE+N5m7fsa0nxdQQZwIPcoD7Gs5GQja3 vn36zyDxlHqqr5p0zEUSaBjR2FaJIgpcmMA= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" The table count module level symbols are now reset when executing the core method, rather than the shell command wrapper. Cc: Ray Ni Cc: Zhichao Gao Reviewed-by: Zhichao Gao Signed-off-by: Tomas Pilar --- ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c b/Shel= lPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c index 390e378e9a6c..f314821ff8d6 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c @@ -255,6 +255,10 @@ AcpiView ( EfiConfigurationTable =3D NULL; OriginalAttribute =3D 0; =20 + // Reset Table counts + mTableCount =3D 0; + mBinTableCount =3D 0; + // Reset The error/warning counters ResetErrorCount (); ResetWarningCount (); @@ -390,9 +394,7 @@ ShellCommandRunAcpiView ( CONST CHAR16* MandatoryTableSpecStr; CONST CHAR16 *SelectedTableName; =20 - // Set Defaults - mTableCount =3D 0; - mBinTableCount =3D 0; + // Set configuration defaults AcpiConfigSetDefaults (); =20 ShellStatus =3D SHELL_SUCCESS; --=20 2.24.1.windows.2 -=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 (#61291): https://edk2.groups.io/g/devel/message/61291 Mute This Topic: https://groups.io/mt/74894922/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 23:55:23 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+61296+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1592229878039296.4896608917759; Mon, 15 Jun 2020 07:04:38 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id DvD4YY1788612xnK3beMJiky; Mon, 15 Jun 2020 07:04:37 -0700 X-Received: from EUR02-AM5-obe.outbound.protection.outlook.com (EUR02-AM5-obe.outbound.protection.outlook.com [40.107.0.44]) by mx.groups.io with SMTP id smtpd.web11.18789.1592229864138854099 for ; Mon, 15 Jun 2020 07:04:24 -0700 X-Received: from AM5PR0101CA0006.eurprd01.prod.exchangelabs.com (2603:10a6:206:16::19) by AM0PR08MB5441.eurprd08.prod.outlook.com (2603:10a6:208:17d::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.23; Mon, 15 Jun 2020 14:04:19 +0000 X-Received: from AM5EUR03FT046.eop-EUR03.prod.protection.outlook.com (2603:10a6:206:16:cafe::f9) by AM5PR0101CA0006.outlook.office365.com (2603:10a6:206:16::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.18 via Frontend Transport; Mon, 15 Jun 2020 14:04:19 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; edk2.groups.io; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;edk2.groups.io; dmarc=bestguesspass action=none header.from=arm.com; Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+61296+1787277+3901457@groups.io; helo=web01.groups.io; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; X-Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM5EUR03FT046.mail.protection.outlook.com (10.152.16.164) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.18 via Frontend Transport; Mon, 15 Jun 2020 14:04:19 +0000 X-Received: ("Tessian outbound fb809da9b456:v59"); Mon, 15 Jun 2020 14:04:19 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 3a67d518eabf11d8 X-CR-MTA-TID: 64aa7808 X-Received: from ab2e06121a2e.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id E3636DDD-705D-492C-8F2B-5AD70F7C5329.1; Mon, 15 Jun 2020 14:04:14 +0000 X-Received: from EUR05-DB8-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id ab2e06121a2e.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 15 Jun 2020 14:04:14 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hXjmb3xGW96gFhXodAHTu6Zi4Lw9wOwe5mERmxKthEEipTKgutTP6b1xEIE7sVOLK104cg6uW3fsWUycnq6pFc8fJGxOrGPm/40hbw1AGzg/jdHOePcD3+85f+NAwtSea7LXoVzKBDGY2+n4DoMrwV+ZvLt2VKKZx4D6OcllC3jT3zZM7SORfsVGJ+d4Idimr+x4zWyRav4UvChzcYEJRXrCujGGbwuI8hN5qerCxrn5nfkzs900gYNYkhfRHk4KGx4HsNDxA7Tz6UCRlkOC+7JupI91jBIcU09OIqVVglLoorVKqSxSD/d69A25m0piaVKMWKLoRlSB3mIWgfsy0A== 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=mYhJzTWHDvNAQIIpSxPPZH6Y/LuDSY4UpKwSEVEsyp0=; b=BXSpeaP68FGEfSnJ55YviNelvUfSS78oNaCnctiHI33a/EXnqQQTzCfqBvy+LuyMwkGICrs11hqHIk7u5x0E/cs77JBM8Y0PMsR2ZJ7EwC568njwM0ugJRoXL6LDENEt7PvtOy1Ira6gh58EHYv6jwMvkDg0JJXduD6DBBG0xbNkNRMP3l1xOYR52LZT06e6qj6d94X3ZXnIj0pomGieS9+KB5yLdSmRsFO2Qs8DEzmwQKDY4OmbvTirPQJxyjAwJvQUx9Ys1IsHSCNGswNyfR2KiJSsPxwjLmQGi9Vicb/09MScY2oLSGyMwnEIfCJ5StHsPsCzW2/iUslEXriMqg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=edk2.groups.io smtp.mailfrom=arm.com; dmarc=bestguesspass action=none header.from=arm.com; dkim=none (message not signed); arc=none X-Received: from DBBPR09CA0007.eurprd09.prod.outlook.com (2603:10a6:10:c0::19) by DB6PR0802MB2472.eurprd08.prod.outlook.com (2603:10a6:4:a0::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.25; Mon, 15 Jun 2020 14:04:12 +0000 X-Received: from DB5EUR03FT009.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:c0:cafe::e5) by DBBPR09CA0007.outlook.office365.com (2603:10a6:10:c0::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.18 via Frontend Transport; Mon, 15 Jun 2020 14:04:12 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=bestguesspass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; X-Received: from nebula.arm.com (40.67.248.234) by DB5EUR03FT009.mail.protection.outlook.com (10.152.20.117) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3088.18 via Frontend Transport; Mon, 15 Jun 2020 14:04:12 +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.1415.2; Mon, 15 Jun 2020 14:04:12 +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.1779.2; Mon, 15 Jun 2020 14:04:11 +0000 X-Received: from localhost.localdomain (10.57.15.84) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.1415.2 via Frontend Transport; Mon, 15 Jun 2020 14:04:11 +0000 From: "Tomas Pilar (tpilar)" To: CC: , Ray Ni , Zhichao Gao Subject: [edk2-devel] [PATCH v3 4/7] ShellPkg/AcpiView: Move parameter parsing Date: Mon, 15 Jun 2020 15:03:48 +0100 Message-ID: <20200615140351.1725-5-Tomas.Pilar@arm.com> In-Reply-To: <20200615140351.1725-1-Tomas.Pilar@arm.com> References: <20200615140351.1725-1-Tomas.Pilar@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-HT: Tenant 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;SFTY:;SFS:(4636009)(346002)(136003)(39860400002)(396003)(376002)(46966005)(30864003)(426003)(1076003)(336012)(5660300002)(4326008)(6916009)(6666004)(70586007)(70206006)(82310400002)(2616005)(86362001)(356005)(2906002)(36756003)(82740400003)(81166007)(47076004)(83380400001)(316002)(54906003)(26005)(186003)(478600001)(8936002)(8676002);DIR:OUT;SFP:1101; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 71ff021d-ffa6-4b1b-c625-08d81134ff7f X-MS-TrafficTypeDiagnostic: DB6PR0802MB2472:|AM0PR08MB5441: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:3044;OLM:3044; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: v0HETJRj0pdZWKxn85C3z9e4SH6YsIezaC9cDFKbq8F0IiQAJwuaiVtedrWgnYbAPFnAHcpJ7Ty+pUIZrULP8x7dryxvGnlyzly7JTp6pNcMk9oyCgDHerQoTWadIyCPylhlCzFDwxBWPEqOZgokYkgrg1qRlxfQg0NIv8aj4SzO2EtOwd8nlqQMSRx3iJnw7duVWaW6B232AMEwIzBF5aAR9Gun8MqJ9ot/Sr2wZ1gy6eD1b+o3c92kN7TNbWChS4cbQ7Vyov8eVPODKhByYXtzAHp8GfrAe0jra9KpXUu4+V0HiTQGqaqPpKdz1syFA322lzrA6EBdwNnft6+Od3qOaVzEtUhU7kUzy93cmAumQtgRB9Tl9Zmxw4R5uexYadUlkiJSIhx8C63qu3SkCw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0802MB2472 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT046.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 187dd91f-e7fc-4706-7170-08d81134fb3c X-Microsoft-Antispam-Message-Info: wjM3hwMkRYuPMN8D0XXNo7v89mz1KdTX9RxOcP8bmUU2K0skS4ACmvCaZMcEQcJNyZYz5H3YHayBnuEk/pI1eP2jjqmMdcypsJGE5h5quoE9lpZb85LB8IF0HU871e3xLtNmM/MRhnuAKHKnbTyEGIs0238O1ynRzqFXmp5DEMzJEc1V6toRlUkFWk/KyLAdZrKL5KgX2G/QyxmtQd3UtVbRQhudIYkjuj1GdcQafKL5ogpXcRbl559kNc+zja8IEyCkK96gFR4TcQIpJTUOL3eeJs0z7JpRa6ucfCeZ0u7dN9+vsbs5oJAGTrB1QzDAXGUBpyK+tJ70dLkhpuJh1UujG7rI5CmZNnRH8YAkgsx+N+j87pAzrV6Hl/yrc9xb+EMVrM3Bf66OfpsncyaXPg== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2020 14:04:19.4687 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 71ff021d-ffa6-4b1b-c625-08d81134ff7f 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-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB5441 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,Tomas.Pilar@arm.com X-Gm-Message-State: g7fc8XlAyXgQFmgOduSvAFj4x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1592229877; bh=3fLLMvXLT2leRJTxD55OJXvwrCpxKZAsQ3HGMcbsdN4=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=Sf2+hA4KVXjBkN6nSvWZzPkWVG1iyixOqMb/gLKm2nOKoZTKFr6OeMWNwsEnNET8ndT AzNLosJQxhv5T8MjJVKB29AhbxSgjzXwKCjf48M+gjSu6Hd/xSHJxsbujfHHho7KzmRLl PAKDboLmZ1DI6rh1W1tAeCLuLuOs2mhATmI= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Parsing command line parameters is done in the shell command wrapper. This declutters the core code and improves modular design. Cc: Ray Ni Cc: Zhichao Gao Reviewed-by: Zhichao Gao Signed-off-by: Tomas Pilar --- .../UefiShellAcpiViewCommandLib/AcpiView.c | 205 ---------------- .../UefiShellAcpiViewCommandLib/AcpiView.h | 18 +- .../UefiShellAcpiViewCommandLib.c | 218 +++++++++++++++++- .../UefiShellAcpiViewCommandLib.h | 10 +- 4 files changed, 240 insertions(+), 211 deletions(-) diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c b/Shel= lPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c index f314821ff8d6..2507ec78204b 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c @@ -32,19 +32,6 @@ EFI_HII_HANDLE gShellAcpiViewHiiHandle =3D NULL; STATIC UINT32 mTableCount; STATIC UINT32 mBinTableCount; =20 -/** - An array of acpiview command line parameters. -**/ -STATIC CONST SHELL_PARAM_ITEM ParamList[] =3D { - {L"-q", TypeFlag}, - {L"-d", TypeFlag}, - {L"-h", TypeFlag}, - {L"-l", TypeFlag}, - {L"-s", TypeValue}, - {L"-r", TypeValue}, - {NULL, TypeMax} -}; - /** This function dumps the ACPI table to a file. =20 @@ -228,7 +215,6 @@ ProcessTableReportOptions ( Returns EFI_UNSUPPORTED if the RSDP version is less than 2. Returns EFI_SUCCESS if successful. **/ -STATIC EFI_STATUS EFIAPI AcpiView ( @@ -372,194 +358,3 @@ AcpiView ( } return EFI_SUCCESS; } - -/** - Function for 'acpiview' command. - - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). -**/ -SHELL_STATUS -EFIAPI -ShellCommandRunAcpiView ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE* SystemTable - ) -{ - EFI_STATUS Status; - SHELL_STATUS ShellStatus; - LIST_ENTRY* Package; - CHAR16* ProblemParam; - SHELL_FILE_HANDLE TmpDumpFileHandle; - CONST CHAR16* MandatoryTableSpecStr; - CONST CHAR16 *SelectedTableName; - - // Set configuration defaults - AcpiConfigSetDefaults (); - - ShellStatus =3D SHELL_SUCCESS; - Package =3D NULL; - TmpDumpFileHandle =3D NULL; - - Status =3D ShellCommandLineParse (ParamList, &Package, &ProblemParam, TR= UE); - if (EFI_ERROR (Status)) { - if (Status =3D=3D EFI_VOLUME_CORRUPTED && ProblemParam !=3D NULL) { - ShellPrintHiiEx ( - -1, - -1, - NULL, - STRING_TOKEN (STR_GEN_PROBLEM), - gShellAcpiViewHiiHandle, - L"acpiview", - ProblemParam - ); - FreePool (ProblemParam); - } else { - Print (L"acpiview: Error processing input parameter(s)\n"); - } - ShellStatus =3D SHELL_INVALID_PARAMETER; - } else { - if (ShellCommandLineGetCount (Package) > 1) { - ShellPrintHiiEx ( - -1, - -1, - NULL, - STRING_TOKEN (STR_GEN_TOO_MANY), - gShellAcpiViewHiiHandle, - L"acpiview" - ); - ShellStatus =3D SHELL_INVALID_PARAMETER; - } else if (ShellCommandLineGetFlag (Package, L"-?")) { - ShellPrintHiiEx ( - -1, - -1, - NULL, - STRING_TOKEN (STR_GET_HELP_ACPIVIEW), - gShellAcpiViewHiiHandle, - L"acpiview" - ); - } else if (ShellCommandLineGetFlag (Package, L"-s") && - ShellCommandLineGetValue (Package, L"-s") =3D=3D NULL) { - ShellPrintHiiEx ( - -1, - -1, - NULL, - STRING_TOKEN (STR_GEN_NO_VALUE), - gShellAcpiViewHiiHandle, - L"acpiview", - L"-s" - ); - ShellStatus =3D SHELL_INVALID_PARAMETER; - } else if (ShellCommandLineGetFlag (Package, L"-r") && - ShellCommandLineGetValue (Package, L"-r") =3D=3D NULL) { - ShellPrintHiiEx ( - -1, - -1, - NULL, - STRING_TOKEN (STR_GEN_NO_VALUE), - gShellAcpiViewHiiHandle, - L"acpiview", - L"-r" - ); - ShellStatus =3D SHELL_INVALID_PARAMETER; - } else if ((ShellCommandLineGetFlag (Package, L"-s") && - ShellCommandLineGetFlag (Package, L"-l"))) { - ShellPrintHiiEx ( - -1, - -1, - NULL, - STRING_TOKEN (STR_GEN_TOO_MANY), - gShellAcpiViewHiiHandle, - L"acpiview" - ); - ShellStatus =3D SHELL_INVALID_PARAMETER; - } else if (ShellCommandLineGetFlag (Package, L"-d") && - !ShellCommandLineGetFlag (Package, L"-s")) { - ShellPrintHiiEx ( - -1, - -1, - NULL, - STRING_TOKEN (STR_GEN_MISSING_OPTION), - gShellAcpiViewHiiHandle, - L"acpiview", - L"-s", - L"-d" - ); - ShellStatus =3D SHELL_INVALID_PARAMETER; - } else { - // Turn on colour highlighting if requested - SetColourHighlighting (ShellCommandLineGetFlag (Package, L"-h")); - - // Surpress consistency checking if requested - SetConsistencyChecking (!ShellCommandLineGetFlag (Package, L"-q")); - - // Evaluate the parameters for mandatory ACPI table presence checks - SetMandatoryTableValidate (ShellCommandLineGetFlag (Package, L"-r")); - MandatoryTableSpecStr =3D ShellCommandLineGetValue (Package, L"-r"); - - if (MandatoryTableSpecStr !=3D NULL) { - SetMandatoryTableSpec (ShellHexStrToUintn (MandatoryTableSpecStr)); - } - - if (ShellCommandLineGetFlag (Package, L"-l")) { - SetReportOption (ReportTableList); - } else { - SelectedTableName =3D ShellCommandLineGetValue (Package, L"-s"); - if (SelectedTableName !=3D NULL) { - SelectAcpiTable (SelectedTableName); - SetReportOption (ReportSelected); - - if (ShellCommandLineGetFlag (Package, L"-d")) { - // Create a temporary file to check if the media is writable. - CHAR16 FileNameBuffer[MAX_FILE_NAME_LEN]; - SetReportOption (ReportDumpBinFile); - - UnicodeSPrint ( - FileNameBuffer, - sizeof (FileNameBuffer), - L".\\%s%04d.tmp", - SelectedTableName, - mBinTableCount - ); - - Status =3D ShellOpenFileByName ( - FileNameBuffer, - &TmpDumpFileHandle, - EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE | - EFI_FILE_MODE_CREATE, - 0 - ); - - if (EFI_ERROR (Status)) { - ShellStatus =3D SHELL_INVALID_PARAMETER; - TmpDumpFileHandle =3D NULL; - ShellPrintHiiEx ( - -1, - -1, - NULL, - STRING_TOKEN (STR_GEN_READONLY_MEDIA), - gShellAcpiViewHiiHandle, - L"acpiview" - ); - goto Done; - } - // Delete Temporary file. - ShellDeleteFile (&TmpDumpFileHandle); - } // -d - } // -s - } - - // Parse ACPI Table information - Status =3D AcpiView (SystemTable); - if (EFI_ERROR (Status)) { - ShellStatus =3D SHELL_NOT_FOUND; - } - } - } - -Done: - if (Package !=3D NULL) { - ShellCommandLineFreeVarList (Package); - } - return ShellStatus; -} diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h b/Shel= lPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h index 92d64a88814d..d5b95f5ee707 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h @@ -64,7 +64,7 @@ GetWarningCount ( =20 @param [in] Signature The ACPI table Signature. @param [in] TablePtr Pointer to the ACPI table data. - @param [in] Length The length fo the ACPI table. + @param [in] Length The length of the ACPI table. =20 @retval Returns TRUE if the ACPI table should be traced. **/ @@ -75,4 +75,20 @@ ProcessTableReportOptions ( IN CONST UINT32 Length ); =20 +/** + This function iterates the configuration table entries in the + system table, retrieves the RSDP pointer and starts parsing the ACPI tab= les. + + @param [in] SystemTable Pointer to the EFI system table. + + @retval EFI_NOT_FOUND The RSDP pointer was not found. + @retval EFI_UNSUPPORTED The RSDP version was less than 2. + @retval EFI_SUCCESS The command was successful. +**/ +EFI_STATUS +EFIAPI +AcpiView ( + IN EFI_SYSTEM_TABLE* SystemTable + ); + #endif // ACPIVIEW_H_ diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiView= CommandLib.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiVi= ewCommandLib.c index e0d5a8108552..c3942ad24e5b 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommand= Lib.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommand= Lib.c @@ -1,24 +1,44 @@ /** @file Main file for 'acpiview' Shell command function. =20 - Copyright (c) 2016 - 2019, ARM Limited. All rights reserved.
+ Copyright (c) 2016 - 2020, ARM Limited. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent **/ =20 #include #include + +#include #include +#include +#include #include -#include +#include #include +#include #include + #include "AcpiParser.h" #include "AcpiTableParser.h" #include "AcpiView.h" +#include "AcpiViewConfig.h" #include "UefiShellAcpiViewCommandLib.h" =20 CONST CHAR16 gShellAcpiViewFileName[] =3D L"ShellCommand"; =20 +/** + An array of acpiview command line parameters. +**/ +STATIC CONST SHELL_PARAM_ITEM ParamList[] =3D { + {L"-q", TypeFlag}, + {L"-d", TypeFlag}, + {L"-h", TypeFlag}, + {L"-l", TypeFlag}, + {L"-s", TypeValue}, + {L"-r", TypeValue}, + {NULL, TypeMax} +}; + /** A list of available table parsers. */ @@ -92,6 +112,200 @@ ShellCommandGetManFileNameAcpiView ( return gShellAcpiViewFileName; } =20 +/** + Function for 'acpiview' command. + + @param[in] ImageHandle Handle to the Image (NULL if internal). + @param[in] SystemTable Pointer to the System Table (NULL if internal). + + @retval SHELL_INVALID_PARAMETER The command line invocation could not be= parsed + @retval SHELL_NOT_FOUND The command failed + @retval SHELL_SUCCESS The command was successful +**/ +SHELL_STATUS +EFIAPI +ShellCommandRunAcpiView ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE* SystemTable + ) +{ + EFI_STATUS Status; + SHELL_STATUS ShellStatus; + LIST_ENTRY* Package; + CHAR16* ProblemParam; + SHELL_FILE_HANDLE TmpDumpFileHandle; + CONST CHAR16* MandatoryTableSpecStr; + CONST CHAR16* SelectedTableName; + + // Set configuration defaults + AcpiConfigSetDefaults (); + + ShellStatus =3D SHELL_SUCCESS; + Package =3D NULL; + TmpDumpFileHandle =3D NULL; + + Status =3D ShellCommandLineParse (ParamList, &Package, &ProblemParam, TR= UE); + if (EFI_ERROR (Status)) { + if (Status =3D=3D EFI_VOLUME_CORRUPTED && ProblemParam !=3D NULL) { + ShellPrintHiiEx ( + -1, + -1, + NULL, + STRING_TOKEN (STR_GEN_PROBLEM), + gShellAcpiViewHiiHandle, + L"acpiview", + ProblemParam + ); + FreePool (ProblemParam); + } else { + Print (L"acpiview: Error processing input parameter(s)\n"); + } + ShellStatus =3D SHELL_INVALID_PARAMETER; + } else { + if (ShellCommandLineGetCount (Package) > 1) { + ShellPrintHiiEx ( + -1, + -1, + NULL, + STRING_TOKEN (STR_GEN_TOO_MANY), + gShellAcpiViewHiiHandle, + L"acpiview" + ); + ShellStatus =3D SHELL_INVALID_PARAMETER; + } else if (ShellCommandLineGetFlag (Package, L"-?")) { + ShellPrintHiiEx ( + -1, + -1, + NULL, + STRING_TOKEN (STR_GET_HELP_ACPIVIEW), + gShellAcpiViewHiiHandle, + L"acpiview" + ); + } else if (ShellCommandLineGetFlag (Package, L"-s") && + ShellCommandLineGetValue (Package, L"-s") =3D=3D NULL) { + ShellPrintHiiEx ( + -1, + -1, + NULL, + STRING_TOKEN (STR_GEN_NO_VALUE), + gShellAcpiViewHiiHandle, + L"acpiview", + L"-s" + ); + ShellStatus =3D SHELL_INVALID_PARAMETER; + } else if (ShellCommandLineGetFlag (Package, L"-r") && + ShellCommandLineGetValue (Package, L"-r") =3D=3D NULL) { + ShellPrintHiiEx ( + -1, + -1, + NULL, + STRING_TOKEN (STR_GEN_NO_VALUE), + gShellAcpiViewHiiHandle, + L"acpiview", + L"-r" + ); + ShellStatus =3D SHELL_INVALID_PARAMETER; + } else if ((ShellCommandLineGetFlag (Package, L"-s") && + ShellCommandLineGetFlag (Package, L"-l"))) { + ShellPrintHiiEx ( + -1, + -1, + NULL, + STRING_TOKEN (STR_GEN_TOO_MANY), + gShellAcpiViewHiiHandle, + L"acpiview" + ); + ShellStatus =3D SHELL_INVALID_PARAMETER; + } else if (ShellCommandLineGetFlag (Package, L"-d") && + !ShellCommandLineGetFlag (Package, L"-s")) { + ShellPrintHiiEx ( + -1, + -1, + NULL, + STRING_TOKEN (STR_GEN_MISSING_OPTION), + gShellAcpiViewHiiHandle, + L"acpiview", + L"-s", + L"-d" + ); + ShellStatus =3D SHELL_INVALID_PARAMETER; + } else { + // Turn on colour highlighting if requested + SetColourHighlighting (ShellCommandLineGetFlag (Package, L"-h")); + + // Surpress consistency checking if requested + SetConsistencyChecking (!ShellCommandLineGetFlag (Package, L"-q")); + + // Evaluate the parameters for mandatory ACPI table presence checks + SetMandatoryTableValidate (ShellCommandLineGetFlag (Package, L"-r")); + MandatoryTableSpecStr =3D ShellCommandLineGetValue (Package, L"-r"); + + if (MandatoryTableSpecStr !=3D NULL) { + SetMandatoryTableSpec (ShellHexStrToUintn (MandatoryTableSpecStr)); + } + + if (ShellCommandLineGetFlag (Package, L"-l")) { + SetReportOption (ReportTableList); + } else { + SelectedTableName =3D ShellCommandLineGetValue (Package, L"-s"); + if (SelectedTableName !=3D NULL) { + SelectAcpiTable (SelectedTableName); + SetReportOption (ReportSelected); + + if (ShellCommandLineGetFlag (Package, L"-d")) { + // Create a temporary file to check if the media is writable. + CHAR16 FileNameBuffer[MAX_FILE_NAME_LEN]; + SetReportOption (ReportDumpBinFile); + + UnicodeSPrint ( + FileNameBuffer, + sizeof (FileNameBuffer), + L".\\%s0000.tmp", + SelectedTableName + ); + + Status =3D ShellOpenFileByName ( + FileNameBuffer, + &TmpDumpFileHandle, + EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE | + EFI_FILE_MODE_CREATE, + 0 + ); + + if (EFI_ERROR (Status)) { + ShellStatus =3D SHELL_INVALID_PARAMETER; + TmpDumpFileHandle =3D NULL; + ShellPrintHiiEx ( + -1, + -1, + NULL, + STRING_TOKEN (STR_GEN_READONLY_MEDIA), + gShellAcpiViewHiiHandle, + L"acpiview" + ); + goto Done; + } + // Delete Temporary file. + ShellDeleteFile (&TmpDumpFileHandle); + } // -d + } // -s + } + + // Parse ACPI Table information + Status =3D AcpiView (SystemTable); + if (EFI_ERROR (Status)) { + ShellStatus =3D SHELL_NOT_FOUND; + } + } + } + +Done: + if (Package !=3D NULL) { + ShellCommandLineFreeVarList (Package); + } + return ShellStatus; +} + /** Constructor for the Shell AcpiView Command library. =20 diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiView= CommandLib.h b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiVi= ewCommandLib.h index c1cf7a57af7a..a3a29164004d 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommand= Lib.h +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommand= Lib.h @@ -1,7 +1,7 @@ /** @file Header file for 'acpiview' Shell command functions. =20 - Copyright (c) 2016 - 2017, ARM Limited. All rights reserved.
+ Copyright (c) 2016 - 2020, ARM Limited. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent **/ =20 @@ -13,8 +13,12 @@ extern EFI_HII_HANDLE gShellAcpiViewHiiHandle; /** Function for 'acpiview' command. =20 - @param[in] ImageHandle Handle to the Image (NULL if Internal). - @param[in] SystemTable Pointer to the System Table (NULL if Internal). + @param[in] ImageHandle Handle to the Image (NULL if internal). + @param[in] SystemTable Pointer to the System Table (NULL if internal). + + @retval SHELL_INVALID_PARAMETER The command line invocation could not be= parsed + @retval SHELL_NOT_FOUND The command failed + @retval SHELL_SUCCESS The command was successful **/ SHELL_STATUS EFIAPI --=20 2.24.1.windows.2 -=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 (#61296): https://edk2.groups.io/g/devel/message/61296 Mute This Topic: https://groups.io/mt/74894928/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 23:55:23 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+61298+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1592229882638948.7360807529212; Mon, 15 Jun 2020 07:04:42 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id AIRQYY1788612xP1AcQrmufR; Mon, 15 Jun 2020 07:04:39 -0700 X-Received: from FRA01-PR2-obe.outbound.protection.outlook.com (FRA01-PR2-obe.outbound.protection.outlook.com [40.107.12.82]) by mx.groups.io with SMTP id smtpd.web11.18793.1592229865427492516 for ; Mon, 15 Jun 2020 07:04:25 -0700 X-Received: from AM6PR05CA0025.eurprd05.prod.outlook.com (2603:10a6:20b:2e::38) by PR2PR08MB4889.eurprd08.prod.outlook.com (2603:10a6:101:1d::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.19; Mon, 15 Jun 2020 14:04:22 +0000 X-Received: from VE1EUR03FT018.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:2e:cafe::38) by AM6PR05CA0025.outlook.office365.com (2603:10a6:20b:2e::38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.19 via Frontend Transport; Mon, 15 Jun 2020 14:04:21 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; edk2.groups.io; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;edk2.groups.io; dmarc=bestguesspass action=none header.from=arm.com; Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+61298+1787277+3901457@groups.io; helo=web01.groups.io; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; X-Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT018.mail.protection.outlook.com (10.152.18.135) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.18 via Frontend Transport; Mon, 15 Jun 2020 14:04:21 +0000 X-Received: ("Tessian outbound 3e82c366635e:v59"); Mon, 15 Jun 2020 14:04:20 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: af531cac3bca3e5c X-CR-MTA-TID: 64aa7808 X-Received: from d0b0b0cddf59.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id ABCD965F-44B9-4CE9-BBA5-055A4F75C778.1; Mon, 15 Jun 2020 14:04:15 +0000 X-Received: from EUR05-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id d0b0b0cddf59.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 15 Jun 2020 14:04:15 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NIESHU7+P0zko+JTNBasKBmHDTlGvtz6w0PLkpgo6TVjbtHpd05zENNnq7Jdj+b3CnK7ZOGMrPQXMjL5aBhIf1oGJn12erqoTeiuckQqtd+/dfX4sbUU9JCxvQ7+JzepyFXd+UKqGx+T4oM5W7gv9kmq/xUxLEdYGaFJdl9JsiVhti0xrH+qMv6utnHSGF9Ni0zK4J64iKSuw0VuXCflFjg4zLpuEftwwz2tSjTqosZzLmhKiHrf+kJMCnEBmmC+2lAm0DA7RbcX/OQaeMThhY//JfAxqV1uwvmf3H19NCzYZJnAb6dr6M2M2bxj9ty1zB5OFfTQMrOmFNCNJlQB3g== 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=HoxMJ9UtFi2PbEvrMUM3lKP5FmIsHrnrubxBAcWIel8=; b=HfcwVe/yPE25CznZBy5DPui0R/uLs2sLIwPtBAAqjR/ItgEwdNgkSrpDcvXsbdv9hs5UZwsQL6IqG6W4mLkPvJPEJiNvOv46/OqD+MskssYrKfbPBj/DGUg7LDieXN9Jk+hGSwX8ekCOVpfEYBMFXTJGW8S6hk0jXpdjrxSC4En2+EqS9BFPdAbqp8sJ3YKvekCi+dFZPVHMX+HsgVST+3YwZdCwf8WYBkKvWin7PtcBR9wYPggRgKdFwQGQV/xa3GS/M6ZHATiJt7SmmdDogdQgEttW1ncdbgKmsf3BtNlI8rNXUxo5WcN6eECPbVYKRIo2vZY9s6tUxI1b12gIsg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=edk2.groups.io smtp.mailfrom=arm.com; dmarc=bestguesspass action=none header.from=arm.com; dkim=none (message not signed); arc=none X-Received: from DBBPR09CA0014.eurprd09.prod.outlook.com (2603:10a6:10:c0::26) by HE1PR0802MB2348.eurprd08.prod.outlook.com (2603:10a6:3:c5::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.24; Mon, 15 Jun 2020 14:04:13 +0000 X-Received: from DB5EUR03FT018.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:c0:cafe::b3) by DBBPR09CA0014.outlook.office365.com (2603:10a6:10:c0::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.21 via Frontend Transport; Mon, 15 Jun 2020 14:04: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=bestguesspass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; X-Received: from nebula.arm.com (40.67.248.234) by DB5EUR03FT018.mail.protection.outlook.com (10.152.20.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3088.18 via Frontend Transport; Mon, 15 Jun 2020 14:04:13 +0000 X-Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX03.Arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1415.2; Mon, 15 Jun 2020 14:04:12 +0000 X-Received: from localhost.localdomain (10.57.15.84) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.1415.2 via Frontend Transport; Mon, 15 Jun 2020 14:04:12 +0000 From: "Tomas Pilar (tpilar)" To: CC: , Ray Ni , Zhichao Gao Subject: [edk2-devel] [PATCH v3 5/7] ShellPkg/AcpiView: Refactor DumpAcpiTableToFile Date: Mon, 15 Jun 2020 15:03:49 +0100 Message-ID: <20200615140351.1725-6-Tomas.Pilar@arm.com> In-Reply-To: <20200615140351.1725-1-Tomas.Pilar@arm.com> References: <20200615140351.1725-1-Tomas.Pilar@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-HT: Tenant 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;SFTY:;SFS:(6029001)(4636009)(136003)(396003)(376002)(39860400002)(346002)(46966005)(82740400003)(336012)(47076004)(81166007)(426003)(6916009)(83380400001)(82310400002)(36756003)(8936002)(6666004)(70206006)(26005)(86362001)(186003)(5660300002)(1076003)(316002)(2616005)(8676002)(478600001)(2906002)(70586007)(356005)(54906003)(4326008);DIR:OUT;SFP:1101; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6cad713f-1050-4a40-6f7d-08d811350071 X-MS-TrafficTypeDiagnostic: HE1PR0802MB2348:|PR2PR08MB4889: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:9508;OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: BuqEm87qCuo/+rZG8Bxbc06OXJjLSRdBsL2zLrGNrZtl4Zryr+kclc3mGDkJxDvAlq6K4I/ZlDePiC0J1PRuwv4OuSa8D8FLwxNGIWBZPq27hu97X7vP1rmxmbL+NPyMxyCwQ/5MQBFzGdobRba5tHjSgwHoQ/DNbQkgAQ51kPBZtt0jf376piK0sZa4fwzh5OJfCnhyZ75wEhbAgtHfyHPIr1RPYUBb5laOSGjWrbG9jAzN8hTZQOxQ9YUuuxBnKWrCcbJ8F346TluHr8A+md6BRCDYc4d9JZgPSvxGQk5uIaa2rFUOfIC3nhzF01FzJm//Pp1L5C0V61wYM9mU536ycnUXTzStOUp4t9IVNJLhigWDNxFNPJQEiRhX0ylJcbhzH2CeoQFsFQyq0Xqr9Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0802MB2348 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT018.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 9286273b-5cc0-4e34-b545-08d81134fb9c X-Microsoft-Antispam-Message-Info: 9ucGud3Df/0SgOf8VF12xPi+XWFlES9qK4rwsYokWrjkDlP9i+Vqyku4GU/TvvgtdzH1wP6x56EDRtuE8tSyFYXsMkCwIU5WqNktzpZzdm0dETgVO9xmpVkz2rNKdMFmVqlvJH2lbAnjEbRro6TcNZInOLrP2hp9GPkUmq2nxk+n+ZJRcacocpFtKYcxj22P46AnLEaVfsFbYYoA/FpU7JgSkeIwY4wIOacUjtvrrdjjr4Nnw05MI9MlU2GgXFNtZ3tDUWO/F9iMMcgFk5YR9SoilTLWnoiIjbDVF3KiMx6cJuxRU0qhGlqDwMcowbAmjLAHXLnFxFiTGuh2sHoIekALW5hE0YTZG46fEo39kqeH+fr5G8vOCe3CBpt6f88eZK/6jZaAwhbbGRLPam2jtw== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2020 14:04:21.0165 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6cad713f-1050-4a40-6f7d-08d811350071 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-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR2PR08MB4889 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,Tomas.Pilar@arm.com X-Gm-Message-State: g9TJBml5Rwj88JoHbl24Pg6Fx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1592229879; bh=phCUwl8OWPwMEQvP6H4w5yuZQSxHBD3xta94LBoJke0=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=viTr4RbA1kCH/3QmJMdRsFk2rEOHRvzGd7P/ZsEV7SBW8gqPjvUFZjxyhC34tVYVRtF EXucOh7ZcEoTfYqUnvGd52ibzGa8aopVCPLYoZ1z11i/NAUxe7wBNJfxWucNePxoYF6Vh HCsY0PXmTgeJoEcot/9bfuQwQFsA1cg/1yY= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Method is refactored into two parts. A new method is created that dumps arbitrary buffers into a newly created file. This method is called from core code after the core code determined the appropriate filename to be used. This improves the modular design. Cc: Ray Ni Cc: Zhichao Gao Signed-off-by: Tomas Pilar Reviewed-by: Zhichao Gao --- .../UefiShellAcpiViewCommandLib/AcpiView.c | 38 +----------- .../UefiShellAcpiViewCommandLib.c | 59 +++++++++++++++++++ .../UefiShellAcpiViewCommandLib.h | 17 +++++- 3 files changed, 76 insertions(+), 38 deletions(-) diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c b/Shel= lPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c index 2507ec78204b..1b6721e6734f 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c @@ -27,8 +27,6 @@ #include "Arm/SbbrValidator.h" #endif =20 -EFI_HII_HANDLE gShellAcpiViewHiiHandle =3D NULL; - STATIC UINT32 mTableCount; STATIC UINT32 mBinTableCount; =20 @@ -48,14 +46,10 @@ DumpAcpiTableToFile ( IN CONST UINTN Length ) { - EFI_STATUS Status; CHAR16 FileNameBuffer[MAX_FILE_NAME_LEN]; - SHELL_FILE_HANDLE DumpFileHandle; UINTN TransferBytes; SELECTED_ACPI_TABLE *SelectedTable; =20 - DumpFileHandle =3D NULL; - TransferBytes =3D Length; GetSelectedAcpiTable (&SelectedTable); =20 UnicodeSPrint ( @@ -66,39 +60,9 @@ DumpAcpiTableToFile ( mBinTableCount++ ); =20 - Status =3D ShellOpenFileByName ( - FileNameBuffer, - &DumpFileHandle, - EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE | EFI_FILE_MODE_CREA= TE, - 0 - ); - if (EFI_ERROR (Status)) { - ShellPrintHiiEx ( - -1, - -1, - NULL, - STRING_TOKEN (STR_GEN_READONLY_MEDIA), - gShellAcpiViewHiiHandle, - L"acpiview" - ); - return FALSE; - } - Print (L"Dumping ACPI table to : %s ... ", FileNameBuffer); =20 - Status =3D ShellWriteFile ( - DumpFileHandle, - &TransferBytes, - (VOID*)Ptr - ); - if (EFI_ERROR (Status)) { - Print (L"ERROR: Failed to dump table to binary file.\n"); - TransferBytes =3D 0; - } else { - Print (L"DONE.\n"); - } - - ShellCloseFile (&DumpFileHandle); + TransferBytes =3D ShellDumpBufferToFile (FileNameBuffer, Ptr, Length); return (Length =3D=3D TransferBytes); } =20 diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiView= CommandLib.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiVi= ewCommandLib.c index c3942ad24e5b..e6a65d5bc5f7 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommand= Lib.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommand= Lib.c @@ -25,6 +25,7 @@ #include "UefiShellAcpiViewCommandLib.h" =20 CONST CHAR16 gShellAcpiViewFileName[] =3D L"ShellCommand"; +EFI_HII_HANDLE gShellAcpiViewHiiHandle =3D NULL; =20 /** An array of acpiview command line parameters. @@ -98,6 +99,64 @@ RegisterAllParsers ( return Status; } =20 +/** + Dump a buffer to a file. Print error message if a file cannot be created. + + @param[in] FileName The filename that shall be created to contain the = buffer. + @param[in] Buffer Pointer to buffer that shall be dumped. + @param[in] BufferSize The size of buffer to be dumped in bytes. + + @return The number of bytes that were written +**/ +UINTN +EFIAPI +ShellDumpBufferToFile ( + IN CONST CHAR16* FileNameBuffer, + IN CONST VOID* Buffer, + IN CONST UINTN BufferSize + ) +{ + EFI_STATUS Status; + SHELL_FILE_HANDLE DumpFileHandle; + UINTN TransferBytes; + + Status =3D ShellOpenFileByName ( + FileNameBuffer, + &DumpFileHandle, + EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE | EFI_FILE_MODE_CREA= TE, + 0 + ); + + if (EFI_ERROR (Status)) { + ShellPrintHiiEx ( + -1, + -1, + NULL, + STRING_TOKEN (STR_GEN_READONLY_MEDIA), + gShellAcpiViewHiiHandle, + L"acpiview" + ); + return 0; + } + + TransferBytes =3D BufferSize; + Status =3D ShellWriteFile ( + DumpFileHandle, + &TransferBytes, + (VOID *) Buffer + ); + + if (EFI_ERROR (Status)) { + Print (L"ERROR: Failed to write binary file.\n"); + TransferBytes =3D 0; + } else { + Print (L"DONE.\n"); + } + + ShellCloseFile (&DumpFileHandle); + return TransferBytes; +} + /** Return the file name of the help text file if not using HII. =20 diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiView= CommandLib.h b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiVi= ewCommandLib.h index a3a29164004d..b1b1ffe63e28 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommand= Lib.h +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommand= Lib.h @@ -8,7 +8,22 @@ #ifndef UEFI_SHELL_ACPIVIEW_COMMAND_LIB_H_ #define UEFI_SHELL_ACPIVIEW_COMMAND_LIB_H_ =20 -extern EFI_HII_HANDLE gShellAcpiViewHiiHandle; +/** + Dump a buffer to a file. Print error message if a file cannot be created. + + @param[in] FileName The filename that shall be created to contain the = buffer. + @param[in] Buffer Pointer to buffer that shall be dumped. + @param[in] BufferSize The size of buffer to be dumped in bytes. + + @return The number of bytes that were written +**/ +UINTN +EFIAPI +ShellDumpBufferToFile ( + IN CONST CHAR16* FileNameBuffer, + IN CONST VOID* Buffer, + IN CONST UINTN BufferSize + ); =20 /** Function for 'acpiview' command. --=20 2.24.1.windows.2 -=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 (#61298): https://edk2.groups.io/g/devel/message/61298 Mute This Topic: https://groups.io/mt/74894930/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 23:55:23 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+61293+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1592229874780191.8471650587976; Mon, 15 Jun 2020 07:04:34 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id YPolYY1788612xokDs6gmwho; Mon, 15 Jun 2020 07:04:33 -0700 X-Received: from EUR04-VI1-obe.outbound.protection.outlook.com (EUR04-VI1-obe.outbound.protection.outlook.com [40.107.8.45]) by mx.groups.io with SMTP id smtpd.web10.18926.1592229863601968278 for ; Mon, 15 Jun 2020 07:04:24 -0700 X-Received: from AM6P191CA0059.EURP191.PROD.OUTLOOK.COM (2603:10a6:209:7f::36) by AM6PR08MB4440.eurprd08.prod.outlook.com (2603:10a6:20b:bc::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.24; Mon, 15 Jun 2020 14:04:20 +0000 X-Received: from AM5EUR03FT006.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:7f:cafe::83) by AM6P191CA0059.outlook.office365.com (2603:10a6:209:7f::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.21 via Frontend Transport; Mon, 15 Jun 2020 14:04:20 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; edk2.groups.io; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;edk2.groups.io; dmarc=bestguesspass action=none header.from=arm.com; Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+61293+1787277+3901457@groups.io; helo=web01.groups.io; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; X-Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM5EUR03FT006.mail.protection.outlook.com (10.152.16.122) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.18 via Frontend Transport; Mon, 15 Jun 2020 14:04:20 +0000 X-Received: ("Tessian outbound d3ae83885012:v59"); Mon, 15 Jun 2020 14:04:20 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: a44a2349a575df70 X-CR-MTA-TID: 64aa7808 X-Received: from 17d3fb343155.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 186DCE04-2946-41E7-A0FF-B06EAD5E7CB7.1; Mon, 15 Jun 2020 14:04:15 +0000 X-Received: from EUR02-VE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 17d3fb343155.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 15 Jun 2020 14:04:15 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=n4IxDueU3Lg2s89XB0fCob7sKRBVuV3paPLRVUXBDIPVU3i2YR6WMmXBXAGUa9RnnofYEExl2w0LiLfoZSvRkJPIA9dE6xwug+W/mYuN5otyjMS64GMmG8L1x+zhs5E1+0BFgEqMAr1wEwGgS92YmWHzgYxqnyJBJZguctK2l9kt1/WCgze3uc4tOZM11OrwF9XCIflSNl7FCMs9kFuLdlLGU98U0t9ND1ApPpgoQWfWbNRS6JYV++JE+7gDtkveEaPKFs6CWW5kccx25SIReH6j7lugf1oiy9NMfsh0vcEHmsXMyRen/d3bUGKZlup3KvTR3gMlO1bi3uHhbSI8ow== 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=/wcRWAP5FHXlHomNCCX8X8GUv/PJvwcahkAaSGdgFbc=; b=OUy6/GoXdv8tGNJSo1gi/uUdBWALxXBcRCRYv2TtlqZxRCNEa0MO3s+BBju4LdMpeGrGweQAiCuGc8jFDSKHQW3I4cxtbjAW6lWaFKnoH99cfX5DjYDeKam8suRhZ7GPg59xwetNNlPl2C2UYLxVvn3xzf/eumP5dThTK6F7d+gdwCQEfeu4rpNmg4j1i+HGI1UN5II+o5Jy4MBj5XQZ5OA/kaQR2o4N2G+pSq//5H5ggPEiQFPlGm/OjUV/K3RCfbsLVU6VqNt4P/fHrxfUjtnmUACwj3picjFe6nw3bEJWfPTzyXm8+6NQKa94IallhZ6XE7BeBp3dDF889GjIJg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=edk2.groups.io smtp.mailfrom=arm.com; dmarc=bestguesspass action=none header.from=arm.com; dkim=none (message not signed); arc=none X-Received: from DBBPR09CA0016.eurprd09.prod.outlook.com (2603:10a6:10:c0::28) by DB6PR0801MB1959.eurprd08.prod.outlook.com (2603:10a6:4:75::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.18; Mon, 15 Jun 2020 14:04:13 +0000 X-Received: from DB5EUR03FT018.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:c0:cafe::56) by DBBPR09CA0016.outlook.office365.com (2603:10a6:10:c0::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.21 via Frontend Transport; Mon, 15 Jun 2020 14:04: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=bestguesspass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; X-Received: from nebula.arm.com (40.67.248.234) by DB5EUR03FT018.mail.protection.outlook.com (10.152.20.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3088.18 via Frontend Transport; Mon, 15 Jun 2020 14:04:13 +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.1415.2; Mon, 15 Jun 2020 14:04:13 +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.1779.2; Mon, 15 Jun 2020 14:04:12 +0000 X-Received: from localhost.localdomain (10.57.15.84) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.1415.2 via Frontend Transport; Mon, 15 Jun 2020 14:04:12 +0000 From: "Tomas Pilar (tpilar)" To: CC: , Ray Ni , Zhichao Gao Subject: [edk2-devel] [PATCH v3 6/7] ShellPkg: Add AcpiViewCommandLib Date: Mon, 15 Jun 2020 15:03:50 +0100 Message-ID: <20200615140351.1725-7-Tomas.Pilar@arm.com> In-Reply-To: <20200615140351.1725-1-Tomas.Pilar@arm.com> References: <20200615140351.1725-1-Tomas.Pilar@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-HT: Tenant 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;SFTY:;SFS:(4636009)(346002)(376002)(136003)(396003)(39860400002)(46966005)(47076004)(81166007)(83380400001)(6916009)(70586007)(186003)(54906003)(2906002)(70206006)(1076003)(8676002)(356005)(26005)(82310400002)(6666004)(5660300002)(478600001)(8936002)(82740400003)(86362001)(4326008)(36756003)(316002)(426003)(2616005)(336012)(19627235002);DIR:OUT;SFP:1101; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: edec3e2f-9097-41a2-1bf3-08d81135004c X-MS-TrafficTypeDiagnostic: DB6PR0801MB1959:|AM6PR08MB4440: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:8882;OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: iJjDPafRSCNAbQBXcs3/tiMlUonFpF8TxWBPlzKMQ5lRrQ4bEfc2+HawacO+5vcjNiMQ+NIF9Odjp64AhTNSdyIcTZ0qNcKWDiY7dTNr+fD3iF6O9nHcBlc19o2ZY1M6/ENoAijUyLSNSAXVTWgYBJmL0cba/eputCu05k0jR/ONGembYEhcvjbWMu+ATzTrP1UF7QPelR0YxQjaYri4tf1U5jkdZATp1SPG+gY24mpVX2t22D6L+fwI5NkaSuH3BJQLajFVMzREfhbmAkLuQKAK7E8Dtsuk33GDF0g/YjBXB7j8ip9an/194vGkn1FGOSRTd9zzmEPJyq8pOHDNydvpn06xzEhleOFNZO6Ryz5u23a54E7z1gfmM/8KvjTd3BVFtjXTAILO6vFIzTevPg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0801MB1959 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT006.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: eb4293d6-ce50-4e21-fc05-08d81134fbdd X-Microsoft-Antispam-Message-Info: 10bnVkb0afR7LKO7RXYXOCz34RLSZ80i+ACg0xNlXwoBE8MT9d22wJyZcfZW3BEuFXV+2joXd0GfDYSm8S69+rSmBbIy5wSirmCsIjhwSpAK2HviCJVp78HwpZysCDGdq3igThnDu6qCIQyMvMM+E5NWKDKSdP8b45m1MZe+W1P+uJooeuXv1K1vy0qTbCC6qvjQYe/qZl3p3gzMe3W4KSHP5/jVziXUvcF9hTy2oOAwUpR9b74kjyW4oNQaOf0qG8VCeoVTa7VWOJvPvBrvcF+H19gpKMNnwXx6Qesu/UucSClbFBh+IMxZj6TFZZQdsodeOFkU4/aX2HUEf03TPfitP35tjYvcozzRpgv409pY2s9OUXJ2sqjq5ODLQb1w9BO0N6xMy93rTFST8Wl1fg== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2020 14:04:20.8162 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: edec3e2f-9097-41a2-1bf3-08d81135004c 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-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB4440 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,Tomas.Pilar@arm.com X-Gm-Message-State: JoVJn5H5SvXpAyIyZWfJ72Orx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1592229873; bh=8fwitMP25OMR7FuW+vZmUyDLZVQuuXbHdEs/bLunwwo=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=kPhiAHrsX/V3OX1Jzj5d4HDXg04mIjiw9U0KiKWXn9oXBGNkGj6NSpHsPNO3nA7eaOP qM5neVZ1MUZwSNr1MRjWJI5mbmUxrUeBKYxhgKpKJo95wvwjp5I6nex6lUx3xsaAiSDiz xF2xZh1UhidQZZBB1aTpivde7kA0IV8eD4I= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" The UefiShellAcpiViewCommandLib is converted from NULL library to a named library so that it may be used in modules other than shell. The library interface exposes the main method for to AcpiView functionality as well as a helper method to dump a buffer to a file. The Shell module is still built by pulling UefiShellAcpiViewCommandLib as a NULL library to preserve the modularity of shell builds. Cc: Ray Ni Cc: Zhichao Gao Signed-off-by: Tomas Pilar Reviewed-by: Zhichao Gao --- .../Library/AcpiViewCommandLib.h} | 15 ++++++++------- .../UefiShellAcpiViewCommandLib/AcpiView.c | 2 +- .../UefiShellAcpiViewCommandLib.c | 2 +- .../UefiShellAcpiViewCommandLib.inf | 3 +-- ShellPkg/ShellPkg.dec | 3 +++ ShellPkg/ShellPkg.dsc | 3 ++- 6 files changed, 16 insertions(+), 12 deletions(-) rename ShellPkg/{Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewComm= andLib.h =3D> Include/Library/AcpiViewCommandLib.h} (72%) diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiView= CommandLib.h b/ShellPkg/Include/Library/AcpiViewCommandLib.h similarity index 72% rename from ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewC= ommandLib.h rename to ShellPkg/Include/Library/AcpiViewCommandLib.h index b1b1ffe63e28..11cf96c6e0d7 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommand= Lib.h +++ b/ShellPkg/Include/Library/AcpiViewCommandLib.h @@ -1,12 +1,13 @@ /** @file - Header file for 'acpiview' Shell command functions. + Library providing 'acpiview' functionality to display and + validate installed ACPI tables. =20 Copyright (c) 2016 - 2020, ARM Limited. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent **/ =20 -#ifndef UEFI_SHELL_ACPIVIEW_COMMAND_LIB_H_ -#define UEFI_SHELL_ACPIVIEW_COMMAND_LIB_H_ +#ifndef ACPI_VIEW_COMMAND_LIB_H_ +#define ACPI_VIEW_COMMAND_LIB_H_ =20 /** Dump a buffer to a file. Print error message if a file cannot be created. @@ -26,14 +27,14 @@ ShellDumpBufferToFile ( ); =20 /** - Function for 'acpiview' command. + Display and validate ACPI tables. =20 @param[in] ImageHandle Handle to the Image (NULL if internal). @param[in] SystemTable Pointer to the System Table (NULL if internal). =20 - @retval SHELL_INVALID_PARAMETER The command line invocation could not be= parsed - @retval SHELL_NOT_FOUND The command failed - @retval SHELL_SUCCESS The command was successful + @retval SHELL_INVALID_PARAMETER The command line invocation could not be= parsed. + @retval SHELL_NOT_FOUND The command failed. + @retval SHELL_SUCCESS The command was successful. **/ SHELL_STATUS EFIAPI diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c b/Shel= lPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c index 1b6721e6734f..5a46d896c52b 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c @@ -17,11 +17,11 @@ #include #include #include +#include #include "AcpiParser.h" #include "AcpiTableParser.h" #include "AcpiView.h" #include "AcpiViewConfig.h" -#include "UefiShellAcpiViewCommandLib.h" =20 #if defined(MDE_CPU_ARM) || defined (MDE_CPU_AARCH64) #include "Arm/SbbrValidator.h" diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiView= CommandLib.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiVi= ewCommandLib.c index e6a65d5bc5f7..d2f26ff89f12 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommand= Lib.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommand= Lib.c @@ -16,13 +16,13 @@ #include #include #include +#include #include =20 #include "AcpiParser.h" #include "AcpiTableParser.h" #include "AcpiView.h" #include "AcpiViewConfig.h" -#include "UefiShellAcpiViewCommandLib.h" =20 CONST CHAR16 gShellAcpiViewFileName[] =3D L"ShellCommand"; EFI_HII_HANDLE gShellAcpiViewHiiHandle =3D NULL; diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiView= CommandLib.inf b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpi= ViewCommandLib.inf index 92de2391b09f..91459f9ec632 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommand= Lib.inf +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommand= Lib.inf @@ -14,7 +14,7 @@ [Defines] FILE_GUID =3D FB5B305E-84F5-461F-940D-82D345757AFA MODULE_TYPE =3D UEFI_APPLICATION VERSION_STRING =3D 1.0 - LIBRARY_CLASS =3D NULL|UEFI_APPLICATION UEFI_DRIVER + LIBRARY_CLASS =3D AcpiViewCommandLib|UEFI_APPLICATION U= EFI_DRIVER CONSTRUCTOR =3D UefiShellAcpiViewCommandLibConstructor DESTRUCTOR =3D UefiShellAcpiViewCommandLibDestructor =20 @@ -46,7 +46,6 @@ [Sources.common] Parsers/Ssdt/SsdtParser.c Parsers/Xsdt/XsdtParser.c UefiShellAcpiViewCommandLib.c - UefiShellAcpiViewCommandLib.h UefiShellAcpiViewCommandLib.uni =20 [Sources.ARM, Sources.AARCH64] diff --git a/ShellPkg/ShellPkg.dec b/ShellPkg/ShellPkg.dec index c17e358d15ed..d0843d338126 100644 --- a/ShellPkg/ShellPkg.dec +++ b/ShellPkg/ShellPkg.dec @@ -34,6 +34,9 @@ [LibraryClasses] ## @libraryclass provides BCFG command BcfgCommandLib|Include/Library/BcfgCommandLib.h =20 + ## @libraryclass provides the AcpiView command + AcpiViewCommandLib|Include/Library/AcpiViewCommandLib.h + [Guids] gEfiShellEnvironment2ExtGuid =3D {0xd2c18636, 0x40e5, 0x4eb5, {0xa3, = 0x1b, 0x36, 0x69, 0x5f, 0xd4, 0x2c, 0x87}} gEfiShellPkgTokenSpaceGuid =3D {0x171e9188, 0x31d3, 0x40f5, {0xb1, = 0x0c, 0x53, 0x9b, 0x2d, 0xb9, 0x40, 0xcd}} diff --git a/ShellPkg/ShellPkg.dsc b/ShellPkg/ShellPkg.dsc index b7ee856b3a16..5d2d96ab071c 100644 --- a/ShellPkg/ShellPkg.dsc +++ b/ShellPkg/ShellPkg.dsc @@ -2,7 +2,7 @@ # Shell Package # # Copyright (c) 2007 - 2019, Intel Corporation. All rights reserved.
-# Copyright (c) 2018, Arm Limited. All rights reserved.
+# Copyright (c) 2018 - 2020, Arm Limited. All rights reserved.
# Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All right= s reserved.
# # SPDX-License-Identifier: BSD-2-Clause-Patent @@ -50,6 +50,7 @@ [LibraryClasses.common] =20 PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeC= offGetEntryPointLib.inf BcfgCommandLib|ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCom= mandLib.inf + AcpiViewCommandLib|ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShel= lAcpiViewCommandLib.inf IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf =20 UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManag= erLib.inf --=20 2.24.1.windows.2 -=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 (#61293): https://edk2.groups.io/g/devel/message/61293 Mute This Topic: https://groups.io/mt/74894925/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 23:55:23 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+61295+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1592229871254289.55927565256; Mon, 15 Jun 2020 07:04:31 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id o4H7YY1788612xp154uapDdA; Mon, 15 Jun 2020 07:04:29 -0700 X-Received: from EUR02-VE1-obe.outbound.protection.outlook.com (EUR02-VE1-obe.outbound.protection.outlook.com [40.107.2.56]) by mx.groups.io with SMTP id smtpd.web10.18927.1592229863987254128 for ; Mon, 15 Jun 2020 07:04:24 -0700 X-Received: from AM6PR0502CA0066.eurprd05.prod.outlook.com (2603:10a6:20b:56::43) by VI1PR0801MB1790.eurprd08.prod.outlook.com (2603:10a6:800:5b::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.21; Mon, 15 Jun 2020 14:04:21 +0000 X-Received: from AM5EUR03FT004.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:56:cafe::9a) by AM6PR0502CA0066.outlook.office365.com (2603:10a6:20b:56::43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.18 via Frontend Transport; Mon, 15 Jun 2020 14:04:20 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; edk2.groups.io; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;edk2.groups.io; dmarc=bestguesspass action=none header.from=arm.com; Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+61295+1787277+3901457@groups.io; helo=web01.groups.io; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; X-Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM5EUR03FT004.mail.protection.outlook.com (10.152.16.163) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.18 via Frontend Transport; Mon, 15 Jun 2020 14:04:20 +0000 X-Received: ("Tessian outbound 8bb15bb571b3:v59"); Mon, 15 Jun 2020 14:04:20 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 8d875f023a49a517 X-CR-MTA-TID: 64aa7808 X-Received: from 3e322289a22b.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 7CD95854-45E2-4950-99DA-BB032AF24C40.1; Mon, 15 Jun 2020 14:04:15 +0000 X-Received: from EUR05-AM6-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 3e322289a22b.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 15 Jun 2020 14:04:15 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IrzbbohKPom32spmdrgejDKU27gK9XnHdHygDVSjcKMSuIXYhGrpLtVZxvvtfRRW/bqe12Lhr3ff4AiUB5tivAt3/R7l8yMlB4ixaX6XPz//0G+t49fcvcwHcgRrQ1J29LpSkkDRNdAvA77yIxvyiFhLzsMQ9MuCBTsFhX9ujuPZeRKEL40HLuQ7J3QeV5D7oK3d+3pNIfh7l0AekfQcOJFBaraWWNhgUWBVeo65YGUVgQPnmXKuRPRNi0kjDPG3kidYKs2ERkbyLIgWXT5A1aDOhC0PPs+S0Mbq+BXxaMhYsYItDJI1B0O/XCcIqd8mlN9cn3ov3VeMVmNZ15a8bw== 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=rauG4mPto0zdU0kNDx5KU11Q6aI3n5eqPGRiPh6U1U8=; b=MZ/C587BGvd/03RW8dVALAxovcivvNV9ZSJseb124Sx5qt8z/oLg5KMqWsfa+1xFOKZJe63/l8srl0fkTuReFNZI7wgJy2CQYiJtna2YPby5PjpjlSJlt1oGExUcaOgMLgffEUWnDi/i80cYPom2Ph9JhlLxFOL8V3G4j6SCJGIZj0ZANO0rG1RExKsOWZSmbzHNnyDQOnLnPl/pzGMn+0er59FrFLX/HzzsxiKiTVe4h1Ji0uwdfxf9hZZlnVZvSqFPWldfabHXrOmZnGG1EQqw1Jt5Nf1YWyOsH855YI9k8XqrWs9l7931GQlMn7l/pp1wDjeb0UqM5fDMJF03aw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=edk2.groups.io smtp.mailfrom=arm.com; dmarc=bestguesspass action=none header.from=arm.com; dkim=none (message not signed); arc=none X-Received: from DBBPR09CA0018.eurprd09.prod.outlook.com (2603:10a6:10:c0::30) by AM4PR08MB2628.eurprd08.prod.outlook.com (2603:10a6:205:c::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.18; Mon, 15 Jun 2020 14:04:13 +0000 X-Received: from DB5EUR03FT018.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:c0:cafe::e7) by DBBPR09CA0018.outlook.office365.com (2603:10a6:10:c0::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.19 via Frontend Transport; Mon, 15 Jun 2020 14:04: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=bestguesspass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; X-Received: from nebula.arm.com (40.67.248.234) by DB5EUR03FT018.mail.protection.outlook.com (10.152.20.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3088.18 via Frontend Transport; Mon, 15 Jun 2020 14:04:13 +0000 X-Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX03.Arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1415.2; Mon, 15 Jun 2020 14:04:13 +0000 X-Received: from localhost.localdomain (10.57.15.84) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.1415.2 via Frontend Transport; Mon, 15 Jun 2020 14:04:12 +0000 From: "Tomas Pilar (tpilar)" To: CC: , Ray Ni , Zhichao Gao Subject: [edk2-devel] [PATCH v3 7/7] ShellPkg/AcpiView: Add application wrapper Date: Mon, 15 Jun 2020 15:03:51 +0100 Message-ID: <20200615140351.1725-8-Tomas.Pilar@arm.com> In-Reply-To: <20200615140351.1725-1-Tomas.Pilar@arm.com> References: <20200615140351.1725-1-Tomas.Pilar@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-HT: Tenant 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;SFTY:;SFS:(4636009)(39860400002)(396003)(376002)(346002)(136003)(46966005)(1076003)(86362001)(81166007)(8676002)(82740400003)(2616005)(54906003)(4326008)(47076004)(2906002)(186003)(5660300002)(82310400002)(478600001)(26005)(356005)(426003)(6916009)(70206006)(70586007)(36756003)(83380400001)(316002)(336012)(6666004)(8936002);DIR:OUT;SFP:1101; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0e2f9ec5-4e0a-466e-f150-08d81135003d X-MS-TrafficTypeDiagnostic: AM4PR08MB2628:|VI1PR0801MB1790: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:2958;OLM:2958; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: 1avB7Hv0fihcQy8b8Y2q010R9zNdgjZjvCsyzIErku14Q5ZLGueRHBtUKrBmfP4JHKViY5/fIVo3bpSPtFavbMngXea9ayRTg7f5tRH3mOw4dsJ7glDP30+EgbwnBb5ZSklSLfB3TlSY1N4bLE3m/vgbfBiqw+VADa4IhL4h9p0iVJ6rWup0Zv1K6nbD6n12Wtnl0JW46qlFMIR6IHSyR6FWyBxJlsP1FItPjPcN/qUNQibq5Ypj0ILNAWO07xTZ2hSKo/An39NsYRZLtedc0RaAjv/gZ1Tm+j0YIutkG5CL/xolQ3e5K8uQoR3lzfEp8699id1WV/pVveHz+A2kRGD9YHtfjpnVO0d2U7lPZQBhk1ftQy8/tK04b5NN/vIk0JFFKD0NkWsuzXh7mBJ4iRn+96870Cy2tn5BgqhPiwNN4CZ+b2MB5+nMPsvpgb+5ipEtBGdoDdKOwnGCnA1iFH0WYw8UbHFdAsx4nW1fQb4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR08MB2628 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT004.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: b162ac9b-7cbb-41ea-4003-08d81134fbfd X-Microsoft-Antispam-Message-Info: kxsDUR60QHS3xg1bqwS5iw3+OmYbKTsF6bxwI23HpLWWryIqxNwXKZ71+L0MrxIelUmJvT84rrbX8RCldfFXc2SCmok0Isv9es/eY1VvIVMQl13mRSOwOyGJZRLTfQ5Wp0mbDYCvk/20FZWFYDkm1+a832KbqGidavCb/GVuishrSam5jN65GAaU1Z3ckwpqU1l3d67/yW/d7e6K6k9wnQk98q1lJruYXDA3jmX0Oaesw/hAYPb5t5EEMxhOpQ/r0g48nMltGMEwC6uziDLaNQ9WABLlMFbZS3qcjxxjSNfNCimWv4Ydvf7F+mpU4jwm1MDrjTTXpTKdRToBRVvkBozdnjQaUdoKfW7E1mW2X0kiAvcBaM5tvIC5t+/PjJjikll2V3ECwMeqpvyQtgf5crzHd/tcQolz59Sy68rhw3LmGomvot/FuojufOxTMFecfil+MPJcg1Mq9AGT/0h6auEhGsJ2zK2fIaWuyk41vpI= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2020 14:04:20.7323 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0e2f9ec5-4e0a-466e-f150-08d81135003d 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-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0801MB1790 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,Tomas.Pilar@arm.com X-Gm-Message-State: Zj7CEC3Pve3tufdMBN1qdGSkx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1592229869; bh=y69c5LvxizhHGnb02iEbe0x+sgBe8WXsK7w4B7jMDoE=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=BQDHBN6xdXqRhO1ekl+72dp5pMWwY5LJWZaphUaIl97syUYMJ56PlNPKezVpVufAKxx KaPoRfIgVazpGF23K816mrUIR93KY9wiNumnf6w0aEKftqW1tDuUjNhF1qwUPYudGs4Kv EJOPIzi5oil0NShZZHBC5f/1AOHy2bg2VjQ= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Simple application wrapper that invokes the shell command wrapper for 'acpiview'. This allows the AcpiView functionality to be used on platforms with older specifications of the UEFI shell or where the 'acpiview' command is not built in due to platform build configuration. Furthermore, this app can be integrated into more comprehensive testing frameworks as a single component of a more thorough specification compliance validation strategy. Cc: Ray Ni Cc: Zhichao Gao Signed-off-by: Tomas Pilar Reviewed-by: Zhichao Gao --- .../Application/AcpiViewApp/AcpiViewApp.c | 40 ++++++ .../Application/AcpiViewApp/AcpiViewApp.inf | 34 +++++ .../Application/AcpiViewApp/AcpiViewApp.uni | 122 ++++++++++++++++++ ShellPkg/ShellPkg.dsc | 1 + 4 files changed, 197 insertions(+) create mode 100644 ShellPkg/Application/AcpiViewApp/AcpiViewApp.c create mode 100644 ShellPkg/Application/AcpiViewApp/AcpiViewApp.inf create mode 100644 ShellPkg/Application/AcpiViewApp/AcpiViewApp.uni diff --git a/ShellPkg/Application/AcpiViewApp/AcpiViewApp.c b/ShellPkg/Appl= ication/AcpiViewApp/AcpiViewApp.c new file mode 100644 index 000000000000..2f650c9d92d2 --- /dev/null +++ b/ShellPkg/Application/AcpiViewApp/AcpiViewApp.c @@ -0,0 +1,40 @@ +/** @file + Main file for AcpiViewApp application + + Copyright (c) 2020, ARM Limited. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#include +#include +#include +#include +#include + +#include + +// +// String token ID of help message text. +// Shell supports to find help message in the resource section of an appli= cation image if +// .MAN file is not found. This global variable is added to make build too= l recognizes +// that the help string is consumed by user and then build tool will add t= he string into +// the resource section. Thus the application can use '-?' option to show = help message in +// Shell. +// +GLOBAL_REMOVE_IF_UNREFERENCED EFI_STRING_ID mStringHelpTokenId =3D STRING_= TOKEN (STR_GET_HELP_ACPIVIEW); + +/** + Application Entry Point wrapper around the shell command + + @param[in] ImageHandle Handle to the Image (NULL if internal). + @param[in] SystemTable Pointer to the System Table (NULL if internal). +**/ +EFI_STATUS +EFIAPI +AcpiViewAppMain ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + return ShellCommandRunAcpiView (gImageHandle, SystemTable); +} diff --git a/ShellPkg/Application/AcpiViewApp/AcpiViewApp.inf b/ShellPkg/Ap= plication/AcpiViewApp/AcpiViewApp.inf new file mode 100644 index 000000000000..2ed1d185339d --- /dev/null +++ b/ShellPkg/Application/AcpiViewApp/AcpiViewApp.inf @@ -0,0 +1,34 @@ +## @file +# EFI application that displays and verifies ACPI tables +# +# Copyright (c) 2020, ARM Limited. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +# +## + +[Defines] + INF_VERSION =3D 0x0001001B + BASE_NAME =3D AcpiViewApp + FILE_GUID =3D 46361B5B-AF17-41FF-95F9-E1BCE08435B9 + MODULE_TYPE =3D UEFI_APPLICATION + VERSION_STRING =3D 1.0 + ENTRY_POINT =3D AcpiViewAppMain + UEFI_HII_RESOURCE_SECTION =3D TRUE + +[Sources.common] + AcpiViewApp.c + AcpiViewApp.uni + +[Packages] + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + ShellPkg/ShellPkg.dec + +[LibraryClasses] + UefiBootServicesTableLib + UefiLib + BaseLib + UefiApplicationEntryPoint + AcpiViewCommandLib diff --git a/ShellPkg/Application/AcpiViewApp/AcpiViewApp.uni b/ShellPkg/Ap= plication/AcpiViewApp/AcpiViewApp.uni new file mode 100644 index 000000000000..c56f21084356 --- /dev/null +++ b/ShellPkg/Application/AcpiViewApp/AcpiViewApp.uni @@ -0,0 +1,122 @@ +// @file +// +// Standalone EFI application that displays and verifies ACPI tables +// +// Copyright (c) 2020, ARM Limited. All rights reserved.
+// SPDX-License-Identifier: BSD-2-Clause-Patent +// + +/=3D# + +#langdef en-US "english" + +#string STR_GET_HELP_ACPIVIEW #language en-US "" +".TH acpiview 0 "Display ACPI information."\r\n" +".SH NAME\r\n" +"Display ACPI Table information.\r\n" +".SH SYNOPSIS\r\n" +" \r\n" +"ACPIVIEWAPP.EFI [[-?] | [[[[-l] | [-s AcpiTable [-d]]] [-q] [-h]] [-r Spe= c]]]\r\n" +" \r\n" +".SH OPTIONS\r\n" +" \r\n" +" -l - Display list of installed ACPI Tables.\r\n" +" -s - Display only the specified AcpiTable type and only support single\= r\n" +" invocation option.\r\n" +" AcpiTable : The required ACPI Table type.\r\n" +" -d - Generate a binary file dump 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" +" Spec : Specification to validate against.\r\n" +" For Arm, the possible values are:\r\n" +" 0 - Server Base Boot Requirements v1.0\r\n" +" 1 - Server Base Boot Requirements v1.1\r\n" +" 2 - Server Base Boot Requirements v1.2\r\n" +" -? - Show help.\r\n" +" \r\n" +".SH DESCRIPTION\r\n" +" \r\n" +" This program is provided to allow examination of ACPI table values from= the\r\n" +" UEFI Shell. This can help with investigations, especially at that stag= e\r\n" +" where the tables are not enabling an OS to boot.\r\n" +" The program is not exhaustive, and only encapsulates detailed knowledge= of a\r\n" +" limited number of table types.\r\n" +" \r\n" +" Default behaviour is to display the content of all tables installed.\r\= n" +" 'Known' table types (listed in NOTES below) will be parsed and displaye= d\r\n" +" with descriptions and field values. Where appropriate a degree of\r\n" +" consistency checking is done and errors may be reported in the output.\= r\n" +" Other table types will be displayed as an array of Hexadecimal bytes.\r= \n" +" \r\n" +" To facilitate debugging, the -s and -d options can be used to generate = a\r\n" +" binary file image of a table that can be copied elsewhere for investiga= tion\r\n" +" using tools such as those provided by acpica.org. This is especially\r= \n" +" relevant for AML type tables like DSDT and SSDT.\r\n" +" \r\n" +"NOTES:\r\n" +" 1. The AcpiTable parameter can match any installed table type.\r\n" +" Tables without specific handling will be displayed as a raw hex dump= (or\r\n" +" dumped to a file if -d is used).\r\n" +" 2. -s option supports to display the specified AcpiTable type that is p= resent\r\n" +" in the system. For normal type AcpiTable, it would display the data = of the\r\n" +" AcpiTable and AcpiTable header. The following type may contain heade= r type\r\n" +" other than AcpiTable header. The actual header can refer to the ACPI= spec\r\n" +" 6.3\r\n" +" Extra A. Particular types:\r\n" +" APIC - Multiple APIC Description Table (MADT)\r\n" +" BGRT - Boot Graphics Resource Table\r\n" +" DBG2 - Debug Port Table 2\r\n" +" DSDT - Differentiated System Description Table\r\n" +" FACP - Fixed ACPI Description Table (FADT)\r\n" +" GTDT - Generic Timer Description Table\r\n" +" IORT - IO Remapping Table\r\n" +" MCFG - Memory Mapped Config Space Base Address Description Table\= r\n" +" PPTT - Processor Properties Topology Table\r\n" +" RSDP - Root System Description Pointer\r\n" +" SLIT - System Locality Information Table\r\n" +" SPCR - Serial Port Console Redirection Table\r\n" +" SRAT - System Resource Affinity Table\r\n" +" SSDT - Secondary SystemDescription Table\r\n" +" XSDT - Extended System Description Table\r\n" +" \r\n" +".SH STANDARDS\r\n" +" \r\n" +" Table details correspond to those in 'Advanced Configuration and Power\= r\n" +" Interface Specification' Version 6.3 [January 2019]\r\n" +" (https://uefi.org/specifications)\r\n" +" \r\n" +" NOTE: The nature of the ACPI standard means that almost all tables in 6= .3\r\n" +" will be 'backwards compatible' with prior version of the specific= ation\r\n" +" in terms of structure, so formatted output should be correct. Th= e main\r\n" +" exception will be that previously 'reserved' fields will be repor= ted\r\n" +" with new names, where they have been added in later versions of t= he\r\n" +" specification.\r\n" +" \r\n" +".SH EXAMPLES\r\n" +" \r\n" +" \r\n" +"EXAMPLES:\r\n" +" * To display a list of the installed table types:\r\n" +" fs0:\> acpiviewapp.efi -l\r\n" +" \r\n" +" * To parse and display a specific table type:\r\n" +" fs0:\> acpiviewapp.efi -s GTDT\r\n" +" \r\n" +" * To save a binary dump of the contents of a table to a file\r\n" +" in the current working directory:\r\n" +" fs0:\> acpiviewapp.efi -s DSDT -d\r\n" +" \r\n" +" * To display contents of all ACPI tables:\r\n" +" fs0:\> acpiviewapp.efi\r\n" +" \r\n" +" * To check if all Server Base Boot Requirements (SBBR) v1.2 mandatory\r= \n" +" ACPI tables are installed (Arm only):\r\n" +" fs0:\> acpiviewapp.efi -r 2\r\n" +" \r\n" +".SH RETURNVALUES\r\n" +" \r\n" +"RETURN VALUES:\r\n" +" SHELL_SUCCESS Data was displayed as requested.\r\n" +" SHELL_INVALID_PARAMETER ACPI Table parsing failed.\r\n" +" \r\n" diff --git a/ShellPkg/ShellPkg.dsc b/ShellPkg/ShellPkg.dsc index 5d2d96ab071c..86e9f1e0040d 100644 --- a/ShellPkg/ShellPkg.dsc +++ b/ShellPkg/ShellPkg.dsc @@ -144,6 +144,7 @@ [Components] gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE } ShellPkg/DynamicCommand/DpDynamicCommand/DpApp.inf + ShellPkg/Application/AcpiViewApp/AcpiViewApp.inf =20 [BuildOptions] *_*_*_CC_FLAGS =3D -D DISABLE_NEW_DEPRECATED_INTERFACES --=20 2.24.1.windows.2 -=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 (#61295): https://edk2.groups.io/g/devel/message/61295 Mute This Topic: https://groups.io/mt/74894927/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-