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=kN/rmFU+; spf=pass (domain: arm.com, ip: 40.107.1.45, mailfrom: krzysztof.koch@arm.com) Received: from EUR02-HE1-obe.outbound.protection.outlook.com (EUR02-HE1-obe.outbound.protection.outlook.com [40.107.1.45]) by groups.io with SMTP; Thu, 18 Jul 2019 05:32:54 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QVTPYM/w+piUphMelHtnacRRIj0ScsMukYL2UKr5gpSnLgPi+zKM0tsj2lHwggp3poelkVyGG/vUPfXNZXHTQ7NyuL3CQWDKpPgST6m+MQVIyNBsgzV3FJRaiFfMQoxJDsALiccW32uZrmvvnr3AUqmZR35kTdcXgtPyG9ptUQI3GmCwL665GIEuLSdHBcdvMsSuSUUWTmG9fHAuFxCgLKDP2RaZUCr61fcNl6jbPdZ3qz0xd4Wm/Ah2joyaskAp7zph9BeV+rgkrf8StHYtHiFcQad1unyLN0KS9LzDJMTH9U8Nx0jd+gZvZvHi6ShS0/Cec88rmjkEsgMzOYeOHg== 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=gX9dJ9s+kYI/CA325gcdOiHHzp1w1rtvk5Nhwv3N8xo=; b=DTxif5RWN8kshZkj8pBSBT4oFJ8tsiOSyLPBZLZf8YmDtxh3JuA/rouXIXBvyp6p1r8pZZW6oh0396EdbUV+ThpUnea31gcNygTNtM0mfio3WEKEEzFu3YNgpf+y91tPZSiwSVKqWELBaQDnWBYkMrL1iJsBqoWQ7c6V3G/0YvkBlRqVGQuYisSK09Gc4l0bx4qRtxVfglPGEJ1SixJBJearfXYInKyPUCuCv6O1L5TeRxz8aEPsucKTXNdoRzQtjsgM359EIysWbKxBL1z/bfUQ7OlKWah5w4CS265QGjnJXLwnERtKxFcA007dHiXoMa6d0mC+SA4n/r6a+wbSQw== ARC-Authentication-Results: i=1; mx.microsoft.com 1;spf=temperror (sender ip is 40.67.248.234) smtp.rcpttodomain=edk2.groups.io smtp.mailfrom=arm.com;dmarc=temperror action=none header.from=arm.com;dkim=none (message not signed);arc=none 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=gX9dJ9s+kYI/CA325gcdOiHHzp1w1rtvk5Nhwv3N8xo=; b=kN/rmFU+6yyDyO79WoLiSaWNVXP2H8RHmXRyiNGMJfQ05CkxIV72Z6dsFBF6sDkM3xBrux11asVN90asI0IILEN3WUlsw4XrDe20FOkXWTMpqWvr7sUZ/AuubsIpkmEq3nQEXeYWphaRcMl7bbniiJYubsUM+GFnMcTs7t8ee2c= Received: from AM6PR08CA0016.eurprd08.prod.outlook.com (2603:10a6:20b:b2::28) by VI1PR0802MB2608.eurprd08.prod.outlook.com (2603:10a6:800:ae::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2094.12; Thu, 18 Jul 2019 12:32:50 +0000 Received: from AM5EUR03FT061.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e08::200) by AM6PR08CA0016.outlook.office365.com (2603:10a6:20b:b2::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2094.12 via Frontend Transport; Thu, 18 Jul 2019 12:32:49 +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 AM5EUR03FT061.mail.protection.outlook.com (10.152.16.247) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.2052.18 via Frontend Transport; Thu, 18 Jul 2019 12:32:48 +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; Thu, 18 Jul 2019 12:31:53 +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; Thu, 18 Jul 2019 12:31:52 +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; Thu, 18 Jul 2019 12:31:52 +0000 From: "Krzysztof Koch" To: CC: , , , , , Subject: [PATCH v1 6/6] ShellPkg: acpiview: IORT: Refactor PMCG node mapping count validation Date: Thu, 18 Jul 2019 13:31:42 +0100 Message-ID: <20190718123142.5696-7-krzysztof.koch@arm.com> X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: <20190718123142.5696-1-krzysztof.koch@arm.com> References: <20190718123142.5696-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)(39860400002)(376002)(346002)(396003)(136003)(2980300002)(199004)(189003)(70206006)(426003)(11346002)(446003)(63350400001)(63370400001)(36756003)(26005)(53936002)(126002)(2616005)(476003)(336012)(186003)(478600001)(47776003)(2351001)(486006)(44832011)(305945005)(316002)(6666004)(356004)(6916009)(4326008)(16586007)(8676002)(86362001)(54906003)(1076003)(50466002)(51416003)(7696005)(5660300002)(2906002)(48376002)(76176011)(50226002)(8936002)(81166006)(53416004)(68736007)(70586007)(81156014);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR0802MB2608;H:nebula.arm.com;FPR:;SPF:TempError;LANG:en;PTR:InfoDomainNonexistent;A:1;MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ba5d3bc0-75c7-4a4c-c0b2-08d70b7c0b14 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(2017052603328);SRVR:VI1PR0802MB2608; X-MS-TrafficTypeDiagnostic: VI1PR0802MB2608: X-Microsoft-Antispam-PRVS: NoDisclaimer: True X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-Forefront-PRVS: 01026E1310 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: nOqczlDAU/LqQJPH6Y1wsBPrmCObSVU1SG6mFuinWuXNNhVVcgyZhHBCswEWtBdUSE/wx9d754TAwOUA0fmyqsoCClxTDQ3Lrlfultdu9cjfU0X87MP4W/mgdZRscIZgCAtA/xueB3MFp9DcWCevXzrgNFYLWBXIykc5OXhgaCuJDFy18a82sFDyUFl6DQiuYeTM7N0u0LxD33DFbSb5WtHec6wza7waaWynJYzIJaV0xJrecAA0gI/6Dgz45D+9rTZjDxwUtw7U/NZortPRR35E/CLW3MIJIf0xnyrKHgAYivrpr309KTfgAus4+eHPcrPAaE32AexrmP/ij3Y+xdGadkl0a7Qd/pGRDjW9z2Sry292N7uQWhqYgwvjW04/GV7ApyTAmnQ+cvlgjfATn1KONvR8Yv/QQjBj2gpkJJs= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jul 2019 12:32:48.4723 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ba5d3bc0-75c7-4a4c-c0b2-08d70b7c0b14 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: VI1PR0802MB2608 Content-Type: text/plain Move Performance Monitoring Counter Group (PMCG) node ID mapping count validation from the core IORT acpiview parser logic to a dedicated function. Now, the pointer to the validation function is passed to the IortNodePmcgParser[] ACPI_PARSER array. This check does not affect the flow of IORT parsing and is limited to a single table field in scope, therefore, it is better to keep it away from the code responsible for traversing the table. Signed-off-by: Krzysztof Koch --- Notes: v1: - refactor PMCG node mapping count validation [Krzysztof] ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c | 32 ++++++++++++++------ 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c index 93f78e1a9786ed53f6b5529f478b72a220b4f8df..4d29ca2818804fb472bec0f632a87cd3c8a7cd48 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c @@ -47,6 +47,28 @@ ValidateItsIdMappingCount ( IN VOID* Context ); +/** + This function validates the ID Mapping array count for the Performance + Monitoring Counter Group (PMCG) node. + + @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 +ValidatePmcgIdMappingCount ( + IN UINT8* Ptr, + IN VOID* Context + ) +{ + if (*(UINT32*)Ptr > 1) { + IncrementErrorCount (); + Print (L"\nERROR: IORT ID Mapping count must not be greater than 1."); + } +} + /** This function validates the ID Mapping array offset for the ITS node. @@ -204,7 +226,7 @@ STATIC CONST ACPI_PARSER IortNodeRootComplexParser[] = { An ACPI_PARSER array describing the IORT PMCG node. **/ STATIC CONST ACPI_PARSER IortNodePmcgParser[] = { - PARSE_IORT_NODE_HEADER (NULL, NULL), + PARSE_IORT_NODE_HEADER (ValidatePmcgIdMappingCount, NULL), {L"Base Address", 8, 16, L"0x%lx", NULL, NULL, NULL, NULL}, {L"Overflow interrupt GSIV", 4, 24, L"0x%x", NULL, NULL, NULL, NULL}, {L"Node reference", 4, 28, L"0x%x", NULL, NULL, NULL, NULL}, @@ -567,14 +589,6 @@ DumpIortNodePmcg ( if (*IortIdMappingCount != 0) { DumpIortNodeIdMappings (Ptr, MappingCount, MappingOffset); } - - if (*IortIdMappingCount > 1) { - IncrementErrorCount (); - Print ( - L"ERROR: ID mapping must not be greater than 1. Id Mapping Count =%d\n", - *IortIdMappingCount - ); - } } /** -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'