From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector1-arm-com header.b=RYmloi/x; spf=pass (domain: arm.com, ip: 40.107.1.75, mailfrom: krzysztof.koch@arm.com) Received: from EUR02-HE1-obe.outbound.protection.outlook.com (EUR02-HE1-obe.outbound.protection.outlook.com [40.107.1.75]) by groups.io with SMTP; Wed, 08 May 2019 06:44:30 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector1-arm-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=U8QvbiJfJxoTEBnI2Gk5SNriTI+QrvTWhY02LEyeY4g=; b=RYmloi/xHpH9/+X/Yu+vW/ba0lVMHCxjzECfvBTwtvaocDKH8dzzgPi0/zgvG5WriQvRw9B5JIHjg7HHhUNtj+acpYngVeQqoddimUXSQi/9dKiGkOkGN2OJgPRG0HMSdZZjuAKeO9wF0c8O8a3/pb2da+xI/bj9t+/WGMdB7Xg= Received: from VE1PR08CA0007.eurprd08.prod.outlook.com (2603:10a6:803:104::20) by VI1PR08MB4462.eurprd08.prod.outlook.com (2603:10a6:803:f9::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1856.12; Wed, 8 May 2019 13:44:26 +0000 Received: from AM5EUR03FT011.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e08::201) by VE1PR08CA0007.outlook.office365.com (2603:10a6:803:104::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1878.20 via Frontend Transport; Wed, 8 May 2019 13:44:26 +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 AM5EUR03FT011.mail.protection.outlook.com (10.152.16.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.1856.11 via Frontend Transport; Wed, 8 May 2019 13:44:24 +0000 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; Wed, 8 May 2019 13:44:15 +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; Wed, 8 May 2019 13:44:14 +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; Wed, 8 May 2019 13:44:14 +0000 From: "Krzysztof Koch" To: CC: , , , , , , , Subject: [PATCH v1 1/1] ShellPkg: acpiview: Add GT Frame Number validation to GTDT parser Date: Wed, 8 May 2019 14:44:08 +0100 Message-ID: <20190508134408.23096-1-krzysztof.koch@arm.com> X-Mailer: git-send-email 2.16.2.windows.1 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:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(346002)(39860400002)(136003)(396003)(376002)(2980300002)(40434004)(189003)(199004)(305945005)(81156014)(1076003)(6306002)(48376002)(8676002)(70586007)(8746002)(51416003)(316002)(81166006)(8936002)(86362001)(54906003)(70206006)(5024004)(47776003)(14444005)(2351001)(4326008)(356004)(72206003)(44832011)(68736007)(2906002)(5660300002)(966005)(53936002)(7696005)(478600001)(6916009)(26005)(186003)(77096007)(50226002)(50466002)(6666004)(63350400001)(63370400001)(426003)(336012)(53416004)(476003)(486006)(36756003)(2616005)(126002);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR08MB4462;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: 7ab6570d-ece3-44b8-f879-08d6d3bb484f X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600141)(711020)(4605104)(2017052603328);SRVR:VI1PR08MB4462; X-MS-TrafficTypeDiagnostic: VI1PR08MB4462: X-MS-Exchange-PUrlCount: 1 X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-Forefront-PRVS: 0031A0FFAF X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: 96hKUijBLtW8ervHKfJdoKFI4REFF2ffhMDtZf3vJs7heBt7MKRZsbJ9UJR4oVhLIYYH/w/43UMpMXpqxUWenNbMCOhFxNA7iNIthHb72T4ss9s3QJxwVU1wGJN2ZJa6C2igLwhx95U2xCXZet3cGWwkp7AqXwjGqn717cg6N1CPebXOqm7AYignoSbu6eRqESoSSlTtTgLkqPv/yXecr6Y3XLxAAz1CCOF0IAX8hlsbqg0WTDPs5Xf8SGQAJhuu/ozQCnPaDDDsNi4oTaPdpG+XDekVMtbcCjzFaBgSjE62Kn6OTdaa7zPZLVz7eYCSmiGnIM3rE6Z+Yp/qGu3muJ7wihc9pqPN3Rb08dRK5UYzVp40NatZtVGaUPzX7+tem7IJ/QwiT02Jj6Hf6q0uIpEMgaYfjLRC0Oh8sjF+ejI= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 May 2019 13:44:24.3978 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7ab6570d-ece3-44b8-f879-08d6d3bb484f 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: VI1PR08MB4462 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable The ACPI 6.2 specification mandates that the Generic Timer (GT) Block Timer Structures must have a frame number in the range 0-7. Update the GTDT parser to warn if this condition is violated. Signed-off-by: Krzysztof Koch --- The changes can be seen at: https://github.com/KrzysztofKoch1/edk2/tree/woa= _528_acpiview_gt_frame_validate_v1 Notes: v1: - Add GTDT Frame Number checks [Krzysztof] ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c | 4= 7 +++++++++++++++++++- 1 file changed, 45 insertions(+), 2 deletions(-) diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/Gtdt= Parser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtPa= rser.c index f31c4a2761751c58d4b1d3eb75084e24ec318e7f..572e52385c54932b14630481e85= a67d0b211966a 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.= c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.= c @@ -1,7 +1,7 @@ /** @file GTDT table parser - 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 @par Reference(s): @@ -38,6 +38,21 @@ ValidateGtBlockTimerCount ( IN VOID* Context ); +/** + This function validates the GT Frame Number. + + @param [in] Ptr Pointer to the start of the field data. + @param [in] Context Pointer to context specific information e.g. this + could be a pointer to the ACPI table header. +**/ +STATIC +VOID +EFIAPI +ValidateGtFrameNumber ( + IN UINT8* Ptr, + IN VOID* Context + ); + /** An ACPI_PARSER array describing the ACPI GTDT Table. **/ @@ -92,7 +107,7 @@ STATIC CONST ACPI_PARSER GtBlockParser[] =3D { An ACPI_PARSER array describing the GT Block timer. **/ STATIC CONST ACPI_PARSER GtBlockTimerParser[] =3D { - {L"Frame Number", 1, 0, L"%d", NULL, NULL, NULL, NULL}, + {L"Frame Number", 1, 0, L"%d", NULL, NULL, ValidateGtFrameNumber, NULL}, {L"Reserved", 3, 1, L"%x %x %x", Dump3Chars, NULL, NULL, NULL}, {L"Physical address (CntBaseX)", 8, 4, L"0x%lx", NULL, NULL, NULL, NULL}= , {L"Physical address (CntEL0BaseX)", 8, 12, L"0x%lx", NULL, NULL, NULL, @@ -145,6 +160,34 @@ ValidateGtBlockTimerCount ( } } +/** + This function validates the GT Frame Number. + + @param [in] Ptr Pointer to the start of the field data. + @param [in] Context Pointer to context specific information e.g. this + could be a pointer to the ACPI table header. +**/ +STATIC +VOID +EFIAPI +ValidateGtFrameNumber ( + IN UINT8* Ptr, + IN VOID* Context + ) +{ + UINT32 FrameNumber; + + FrameNumber =3D *(UINT8*)Ptr; + + if (FrameNumber > 7) { + IncrementErrorCount (); + Print ( + L"\nERROR: GT Frame Number =3D %d. GT Frame Number must be in range = 0-7.", + FrameNumber + ); + } +} + /** This function parses the Platform GT Block. -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' IMPORTANT NOTICE: The contents of this email and any attachments are confid= ential and may also be privileged. If you are not the intended recipient, p= lease notify the sender immediately and do not disclose the contents to any= other person, use it for any purpose, or store or copy the information in = any medium. Thank you.