From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=udvjXhn0; spf=pass (domain: arm.com, ip: 40.107.4.83, mailfrom: krzysztof.koch@arm.com) Received: from EUR03-DB5-obe.outbound.protection.outlook.com (EUR03-DB5-obe.outbound.protection.outlook.com [40.107.4.83]) by groups.io with SMTP; Fri, 28 Jun 2019 01:58:01 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7tXAHrRq6aykUamUAFWgQV5mRyC20DY6SgbBkqxoJqw=; b=udvjXhn08sF/ZiLVPZTEYHTPtAF0X4sdXV4HEh3FpQh/22YsBbT8c+kFZPxkgFDSCV0Tcs2EoPe/noeJ+7Hf6z+QbnlPP8kXlJPUVAqiLAorOWGn3JTuC1s28YaBDSwjc9814n5MWbhbqcdx5UlOUNNJpQhvlfud5sUOkpQOwE8= Received: from VI1PR08CA0135.eurprd08.prod.outlook.com (2603:10a6:800:d5::13) by AM6PR08MB4311.eurprd08.prod.outlook.com (2603:10a6:20b:b8::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2032.18; Fri, 28 Jun 2019 08:57:57 +0000 Received: from VE1EUR03FT025.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e09::209) by VI1PR08CA0135.outlook.office365.com (2603:10a6:800:d5::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2032.17 via Frontend Transport; Fri, 28 Jun 2019 08:57:57 +0000 Authentication-Results: spf=temperror (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=temperror action=none header.from=arm.com; Received-SPF: TempError (protection.outlook.com: error in processing during lookup of arm.com: DNS Timeout) Received: from nebula.arm.com (40.67.248.234) by VE1EUR03FT025.mail.protection.outlook.com (10.152.18.74) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.2032.15 via Frontend Transport; Fri, 28 Jun 2019 08:57:55 +0000 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; Fri, 28 Jun 2019 08:57:11 +0000 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.1415.2; Fri, 28 Jun 2019 08:57:11 +0000 Received: from E119924.Arm.com (10.1.199.124) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.1415.2 via Frontend Transport; Fri, 28 Jun 2019 08:57:11 +0000 From: "Krzysztof Koch" To: CC: , , , , , Subject: [PATCH v1 3/5] ShellPkg: acpiview: Allow disabling consistency checks (-q flag) Date: Fri, 28 Jun 2019 09:56:58 +0100 Message-ID: <20190628085700.17472-4-krzysztof.koch@arm.com> X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: <20190628085700.17472-1-krzysztof.koch@arm.com> References: <20190628085700.17472-1-krzysztof.koch@arm.com> Return-Path: Krzysztof.Koch@arm.com MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:40.67.248.234;IPV:NLI;CTRY:IE;EFV:NLI;SFV:NSPM;SFS:(10009020)(4636009)(136003)(39860400002)(396003)(376002)(346002)(2980300002)(189003)(199004)(77096007)(186003)(53936002)(26005)(305945005)(2351001)(76176011)(4326008)(54906003)(316002)(16586007)(478600001)(8676002)(86362001)(81166006)(81156014)(8936002)(51416003)(7696005)(47776003)(11346002)(486006)(126002)(476003)(446003)(2616005)(336012)(426003)(5660300002)(1076003)(50226002)(63370400001)(63350400001)(36756003)(2906002)(6666004)(356004)(44832011)(6916009)(6306002)(50466002)(48376002)(53416004)(70206006)(70586007)(68736007)(966005)(72206003);DIR:OUT;SFP:1101;SCL:1;SRVR:AM6PR08MB4311;H:nebula.arm.com;FPR:;SPF:TempError;LANG:en;PTR:InfoDomainNonexistent;MX:1;A:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3fb9362e-de54-4b94-b5a2-08d6fba6b622 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(2017052603328);SRVR:AM6PR08MB4311; X-MS-TrafficTypeDiagnostic: AM6PR08MB4311: X-MS-Exchange-PUrlCount: 1 NoDisclaimer: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:480; X-Forefront-PRVS: 00826B6158 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: omdCtilros0nNti06z9PTXy0SahhrUzVQD3LfpWXJrMYEsYBiU3GM9jJmMYh6TkdzL5nn4URADPne9A0m52PBW2KynuMJMWUcqiZVi5Xh0VA84pHqzyVkH3nKtGFPMoXcuuwWNYRPrd/9zNFb2g4eBl1FEe916nibTortlFSk3ATEQP6rfPIHo32P2cpMSWkBeJkTzzFIrcVoXw4fP9KstfWEchnyR/ofsKjKjleVOxq63bC9oREuvNYNNm8tQRNBQKNEvRZzW9oSnp4rsInwQe80E85BL+R832J07FLW4BPL9ooZhsluyQf8ZTRRVJ/lhNfuFNHmFvzs5kug8gmWeTANBpea0uq2YC8tHa3EYC+kJWmYr1MJ1S0oo7FMawkeaANJHZe9v+VTtS1J3AFyQA9KXpSgSWNL39UGa3UVok= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jun 2019 08:57:55.6803 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3fb9362e-de54-4b94-b5a2-08d6fba6b622 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[40.67.248.234];Helo=[nebula.arm.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB4311 Content-Type: text/plain The current documentation for the acpiview UEFI shell tool states that the '-c' flag enables consistency checks on ACPI table data. However, these checks are enabled anyway by default. This patch keeps ACPI table validation as a default option, but it makes it possible to turn ACPI table validation off by setting the newly-introduced '-q' flag. Consequently, the '-c' flag is removed. The remaining code changes in this patch make a number of consistency checks optional (but enabled by default): 1. ACPI table field offset mismatch. 2. ACPI table field validation functions provided in the ACPI_PARSER arrays. 3. Table checksum computation. Signed-off-by: Krzysztof Koch --- Changes can be seen at: https://github.com/KrzysztofKoch1/edk2/commit/fa016236b0955d19db70bf83fe4e5048e3b858f4 Notes: v1: - make table consistency checks optional where applicable [Krzysztof] ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c | 6 ++-- ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c | 6 ++-- ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c | 35 ++++++++++++++++++-- ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h | 23 ++++++++++++- ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.uni | 4 +-- 5 files changed, 65 insertions(+), 9 deletions(-) diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c index f9dbbd35449e74fdf81f09e627920b10583a9816..8b3153516d2b7d9b920ab2de0344c17798ac572c 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c @@ -506,7 +506,8 @@ ParseAcpi ( break; } - if (Offset != Parser[Index].Offset) { + if (GetConsistencyChecking () && + (Offset != Parser[Index].Offset)) { IncrementErrorCount (); Print ( L"\nERROR: %a: Offset Mismatch for %s\n" @@ -549,7 +550,8 @@ ParseAcpi ( // Validating only makes sense if we are tracing // the parsed table entries, to report by table name. - if (Parser[Index].FieldValidator != NULL) { + if (GetConsistencyChecking () && + (Parser[Index].FieldValidator != NULL)) { Parser[Index].FieldValidator (Ptr, Parser[Index].Context); } } diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c index 504c81e3f1405095afd0d77fee64a02fd06a64d2..d5500bcb2b4a55c7a69f45444aa49d36d2c1694f 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiTableParser.c @@ -1,7 +1,7 @@ /** @file ACPI table parser - Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. + Copyright (c) 2016 - 2019, ARM Limited. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -193,7 +193,9 @@ ProcessAcpiTable ( if (Trace) { DumpRaw (Ptr, *AcpiTableLength); - VerifyChecksum (TRUE, Ptr, *AcpiTableLength); + if (GetConsistencyChecking ()) { + VerifyChecksum (TRUE, Ptr, *AcpiTableLength); + } } Status = GetParser (*AcpiTableSignature, &ParserProc); diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c index 9bbb00cacafa34760c9d45cb6a9fe15bcd4c100e..e99537acf36616783103e1e9d154278f8dedb78e 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.c @@ -33,7 +33,7 @@ STATIC BOOLEAN mColourHighlighting; An array of acpiview command line parameters. **/ STATIC CONST SHELL_PARAM_ITEM ParamList[] = { - {L"-c", TypeFlag}, + {L"-q", TypeFlag}, {L"-d", TypeFlag}, {L"-h", TypeValue}, {L"-l", TypeFlag}, @@ -69,6 +69,33 @@ SetColourHighlighting ( mColourHighlighting = 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 = ConsistencyChecking; +} + /** This function returns the report options. @@ -380,7 +407,8 @@ AcpiView ( (ReportDumpBinFile == ReportOption)) && (!mSelectedAcpiTableFound)) { Print (L"\nRequested ACPI Table not found.\n"); - } else if (ReportDumpBinFile != ReportOption) { + } else if (GetConsistencyChecking () && + (ReportDumpBinFile != ReportOption)) { OriginalAttribute = gST->ConOut->Mode->Attribute; Print (L"\nTable Statistics:\n"); @@ -554,6 +582,9 @@ ShellCommandRunAcpiView ( } } + // Surpress consistency checking if requested + SetConsistencyChecking (!ShellCommandLineGetFlag (Package, L"-q")); + if (ShellCommandLineGetFlag (Package, L"-l")) { mReportType = ReportTableList; } else { diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h index 1b26d8fb1771eb4adb3f381e04234932480b6110..b5cb274ecbf77f7ccb81d78f852caa0f50854312 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiView.h @@ -1,7 +1,7 @@ /** @file Header file for AcpiView - Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. + Copyright (c) 2016 - 2019, ARM Limited. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -91,6 +91,27 @@ 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 processes the table reporting options for the ACPI table. diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.uni b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.uni index 4c63143cbef85262793c287dfeb8ebb394394416..f0610870505d5c5d89e6516122fc9e782479df0c 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.uni +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.uni @@ -30,7 +30,7 @@ "Display ACPI Table information.\r\n" ".SH SYNOPSIS\r\n" " \r\n" -"ACPIVIEW [[-?] | [[-l] | [-s AcpiTable [-d]]] [-c] [-v] [-h Highlight]]\r\n" +"ACPIVIEW [[-?] | [[-l] | [-s AcpiTable [-d]]] [-q] [-v] [-h Highlight]]\r\n" " \r\n" ".SH OPTIONS\r\n" " \r\n" @@ -39,7 +39,7 @@ " invocation option.\r\n" " AcpiTable : The required ACPI Table type.\r\n" " -d - Generate a binary file dump of the specified AcpiTable.\r\n" -" -c - Consistency checking (enabled by default).\r\n" +" -q - Quiet. Suppress errors and warnings. Disables consistency checks.\r\n" " -v - Display verbose data (enabled by default).\r\n" " -h - Enable/Disable Colour Highlighting.\r\n" " Highlight : TRUE/ON enables highlighting;\r\n" -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'