From nobody Mon May 6 16:07:54 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+43935+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 1563453119684963.7967005181442; Thu, 18 Jul 2019 05:31:59 -0700 (PDT) Return-Path: X-Received: from EUR04-VI1-obe.outbound.protection.outlook.com (EUR04-VI1-obe.outbound.protection.outlook.com [40.107.8.75]) by groups.io with SMTP; Thu, 18 Jul 2019 05:31:58 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QUnYQM6VdCImeMkqo4JlrEsDxvTe4Dxiu8KLVQNTgGNosqT85xIacOsXAXNHW9pMjRrh4TJ125f0K+SHaf0CkadQAt1sYQaFPulvhKuZK+RcXJKXOU2GiO7VXPx4C0nyicpgHvjBgZ/y97MmrTA2054MIuhorbj4AM6AirAqkTheQ70JXEHv6zR9FYzbuNDdk41d5pX/Wnmk7q2jO9PjwD7J4B2NcV7oAdc/anE7ks62JwXvZetVcNILf2MvWUZ7WjuCg/PfOhpLbKWcy41ban6vM3jRwYcFVj5lJdQZmSV+vQRp5Ct4RaEZNUVcJl012N84X7LnashyqgyVESimUQ== 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=MN82JiK8kS2UmaxB3vvOBaq8Gz52s8/x5p0fbAbJlLY=; b=FNC21NdULyDv2isCxg7zg5Y+M6iFzhKV3r/gTMsQIYyjBONI9eeWsDtlnEuRz7Vr/A3cpcw0Y8NPEUmhZOv20Vm7VmPfAhjizZ4OaXSRFd55JtM2oR9em0dmnr1GdWM4r5J5SJyZZJCPz2Lo17pks9Ahwz30/DMxp9lkSJxwyLafu8y7lfGXy6W1szB3OYyKMXpRaQ6T5ddS52Gc473NvVN0LGeWt6VNFI5O84+gK/4nW2IJIwKEpy700WpYHFmJEmAXf9KxcpdWkggxpNbJ8GsTBxqtFOgAlE0yZgjumYxYstrkAUmPMAhuauYRHxdsPMcuuOL9droif93a800xkg== 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 X-Received: from VE1PR08CA0005.eurprd08.prod.outlook.com (2603:10a6:803:104::18) by DB6PR0802MB2600.eurprd08.prod.outlook.com (2603:10a6:4:a1::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2073.14; Thu, 18 Jul 2019 12:31:54 +0000 X-Received: from AM5EUR03FT020.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e08::201) by VE1PR08CA0005.outlook.office365.com (2603:10a6:803:104::18) 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:31:53 +0000 Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+43935+1787277+3901457@groups.io; helo=web01.groups.io; Received-SPF: TempError (protection.outlook.com: error in processing during lookup of arm.com: DNS Timeout) X-Received: from nebula.arm.com (40.67.248.234) by AM5EUR03FT020.mail.protection.outlook.com (10.152.16.116) 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:31:52 +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; Thu, 18 Jul 2019 12:31:50 +0000 X-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:50 +0000 From: "Krzysztof Koch" To: CC: , , , , , Subject: [edk2-devel] [PATCH v1 1/6] ShellPkg: acpiview: Allow passing buffer length to DumpGasStruct() Date: Thu, 18 Jul 2019 13:31:37 +0100 Message-ID: <20190718123142.5696-2-krzysztof.koch@arm.com> In-Reply-To: <20190718123142.5696-1-krzysztof.koch@arm.com> References: <20190718123142.5696-1-krzysztof.koch@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8e43cf64-ccc1-4d5a-ad65-08d70b7be99a X-MS-TrafficTypeDiagnostic: DB6PR0802MB2600: X-Microsoft-Antispam-PRVS: NoDisclaimer: True X-MS-Oob-TLC-OOBClassifiers: OLM:5236; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: G7lVJBlTYD8b91fAKT/cMfUoReiqeGNEEz0E8y24r3uJdSIf1PJ2IzDnqX5lTtt/shGBubEsLgFfB4YEmkkYorwbvpEr+4K5sZoo+p8iLKnWYO4DblU4kQBqi0aACYgFZgO+sIzXo6hmDxvQHbD6OsVDfiuIQW4gVAL4kcoSjfVyQu2q2J8ISI8F/WojrqSfPy16oOz5sHlQQqjCzKyVA4BEnuPOs+otKgNM1CRApjKh1ZRiKK0rrHOgoK5xADe9Fd0Hei9Xu/0sQvx4J3ih63zwXWulSTVjUP+1EMSz/rHJcF1MyLHc7ZeNbmVoA5icCVoqEbvQ2reg0FfLB9e5qVmAmQo6mHbo/OYFhMf3FdJ4k8IiHmRiUwI1UpyV4Pwtg33i84A8mlJfXFduSGoy1rf5wkC2TC1rotWXQ0xox8c= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jul 2019 12:31:52.3004 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8e43cf64-ccc1-4d5a-ad65-08d70b7be99a 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: DB6PR0802MB2600 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,krzysztof.koch@arm.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1563453119; bh=DrKRVaHjaCrWIbRj/q4ArWic0SlOXHdGbZKn1ZXUVno=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=VuhmBCyzObYTNbdJ9qBhfM/fwSGpL7WWsmwY3e2u0q+yllab44jEpWbStEG6tJmTC7k 2y4lXfYpy9EDLEJI0iylSwkvxPM2dlk+oUPkpn3PHNgd82bJirpSjmnmyI0y2l2fnhyre wj0ju9jcS5u0g40Gy+urEeibwClBfru22II= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Modify the signature of the DumpGasStruct() function to include the buffer length parameter and to return the number of bytes parsed by the function. This way it becomes possible to prevent buffer overruns when dumping Generic Address Structure's (GAS) fields in the acpiview table parsers. Update all existing DumpGasStruct() calls in acpiview to add the length argument. Signed-off-by: Krzysztof Koch Reviewed-by: Alexei Fedorov Reviewed-by: Jaben Carsey Reviewed-by: Sami Mujawar Reviewed-by: Zhichao Gao --- Notes: v1: - Modify DumpGasStruct() signature [Krzysztof] ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c | 2= 6 +++++++++++--------- ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h | = 8 ++++-- ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c | = 2 +- 3 files changed, 22 insertions(+), 14 deletions(-) diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c b/Sh= ellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c index 8b3153516d2b7d9b920ab2de0344c17798ac572c..2d6ff80e299eebe7853061d3db8= 9332197c0dc0e 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c @@ -589,23 +589,27 @@ STATIC CONST ACPI_PARSER GasParser[] =3D { =20 @param [in] Ptr Pointer to the start of the buffer. @param [in] Indent Number of spaces to indent the output. + @param [in] Length Length of the GAS structure buffer. + + @retval Number of bytes parsed. **/ -VOID +UINT32 EFIAPI DumpGasStruct ( IN UINT8* Ptr, - IN UINT32 Indent + IN UINT32 Indent, + IN UINT32 Length ) { Print (L"\n"); - ParseAcpi ( - TRUE, - Indent, - NULL, - Ptr, - GAS_LENGTH, - PARSER_PARAMS (GasParser) - ); + return ParseAcpi ( + TRUE, + Indent, + NULL, + Ptr, + Length, + PARSER_PARAMS (GasParser) + ); } =20 /** @@ -621,7 +625,7 @@ DumpGas ( IN UINT8* Ptr ) { - DumpGasStruct (Ptr, 2); + DumpGasStruct (Ptr, 2, GAS_LENGTH); } =20 /** diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h b/Sh= ellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h index 7657892d9fd2e2e14c6578611ff0cf1b6f6cd750..20ca358bddfa5953bfb1d1bebae= bbf3079eaba01 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h @@ -405,12 +405,16 @@ ParseAcpi ( =20 @param [in] Ptr Pointer to the start of the buffer. @param [in] Indent Number of spaces to indent the output. + @param [in] Length Length of the GAS structure buffer. + + @retval Number of bytes parsed. **/ -VOID +UINT32 EFIAPI DumpGasStruct ( IN UINT8* Ptr, - IN UINT32 Indent + IN UINT32 Indent, + IN UINT32 Length ); =20 /** diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2= Parser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Pa= rser.c index 8de5ebf74775bab8e765849cba6ef4eb6f659a5a..2c47a3f848aa2dd512c53343ecf= 1c3c285173dd6 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c @@ -164,7 +164,7 @@ DumpDbgDeviceInfo ( AddrSize =3D (UINT32*)(Ptr + (*AddrSizeOffset)); while (Index < (*GasCount)) { PrintFieldName (4, L"BaseAddressRegister"); - DumpGasStruct (DataPtr, 4); + DumpGasStruct (DataPtr, 4, *DbgDevInfoLen); PrintFieldName (4, L"Address Size"); Print (L"0x%x\n", AddrSize[Index]); DataPtr +=3D GAS_LENGTH; -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#43935): https://edk2.groups.io/g/devel/message/43935 Mute This Topic: https://groups.io/mt/32514379/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 Mon May 6 16:07:54 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+43936+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 156345312050888.4550953674468; Thu, 18 Jul 2019 05:32:00 -0700 (PDT) Return-Path: X-Received: from EUR04-VI1-obe.outbound.protection.outlook.com (EUR04-VI1-obe.outbound.protection.outlook.com []) by groups.io with SMTP; Thu, 18 Jul 2019 05:31:59 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CLrxuVZYQVxneOVBaDHMk2ELEqqDLjiZOHW8vmMT/qpzl13bBGzWJx87qFQW578YIJ0ew8wx3dts77JNR74g+igZh97CbeUJW+6uuCf6YixQfyTprmqt1vxr6li66TcXl+Zceja1k3QF3MOmu1ccb2uedH2RBDCSjvwdJacXa/4YpRxbFDbJQFICXS+mvWvDG9m4SD1JgoRnrKfGEJvRRH8T9/HXA47xTDwwZSufifKoP/zM/WBQiEb22+21MHSobyGNe+Q6uFjSy4UJlxwF1RJ4iNJbafFomwwE0RZA8iS5xtjO4NpRmhGcvhNhDa1R7aIvjf2l01XtYRSKAt8uBA== 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=ns2I0PA7Uwg13DOfaLj1Ve4iscBni/oqc8auQASW5Ak=; b=RBSVgUvNk7s2FGNwJC2cZ77Hj2N4uPUGs99LCEtAduRBjLEzShgi8cN59eYuA5Kws14HNzfKbEBN5lsy1kTn4Pxlk6hoF9Y1BpZUeaN72YadcyUzpfFIET+BbySsCZ/2M2rCDMtihfiDwgsmTZVYoQ2+anTBFtzHX0b/CvvshYFoa4gcw+MObYIkl8NyIDepwWmaLlHXb+gU/sYzpLwSCkZupUUqX9mumbWxl/Q3wFKRvlWmZHEvdoqtWBAQP4oBJdxAL5S8nosPJ3DiGfyIhmjbwbvpTneYlalgPZcvEbakHu8hbcbi6B7oFCa4lgNQoILZg/YnHdlkDm28WocA9g== 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 X-Received: from VI1PR08CA0096.eurprd08.prod.outlook.com (10.175.228.22) by DB6PR0802MB2600.eurprd08.prod.outlook.com (10.172.251.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2073.14; Thu, 18 Jul 2019 12:31:55 +0000 X-Received: from AM5EUR03FT041.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e08::209) by VI1PR08CA0096.outlook.office365.com (2603:10a6:800:d3::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2073.14 via Frontend Transport; Thu, 18 Jul 2019 12:31:55 +0000 Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+43936+1787277+3901457@groups.io; helo=web01.groups.io; Received-SPF: TempError (protection.outlook.com: error in processing during lookup of arm.com: DNS Timeout) X-Received: from nebula.arm.com (40.67.248.234) by AM5EUR03FT041.mail.protection.outlook.com (10.152.17.186) 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:31:53 +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; Thu, 18 Jul 2019 12:31:51 +0000 X-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:51 +0000 From: "Krzysztof Koch" To: CC: , , , , , Subject: [edk2-devel] [PATCH v1 2/6] ShellPkg: acpiview: XSDT: Remove redundant ParseAcpi() call Date: Thu, 18 Jul 2019 13:31:38 +0100 Message-ID: <20190718123142.5696-3-krzysztof.koch@arm.com> In-Reply-To: <20190718123142.5696-1-krzysztof.koch@arm.com> References: <20190718123142.5696-1-krzysztof.koch@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 761da0f9-0be0-4539-6e38-08d70b7bea94 X-MS-TrafficTypeDiagnostic: DB6PR0802MB2600: X-Microsoft-Antispam-PRVS: NoDisclaimer: True X-MS-Oob-TLC-OOBClassifiers: OLM:4941; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: 28Y1ChZDyN+lUfzpUnS6Jv0nyZiPJuNf/Hcbg6nz4BhFhg3sZ3+3AnlE84JMKbratfiQ3Q2TVuqxeCY0IyIjwS2DrINwVgQGzhpAnsM5WEAi8JtW8zf9oobxUpy7WgrsUmUoT4S6n5jD4EUPCdkxIoKG8QxG+m/Z9GWoEv/AG9lKLfhf0bIP2kGIfBrnQO8G6tPyO1iVwUbEWGPi+qU+SKIvT8730xYzdDDqNgccDEjLJA6xM1z3E6zuwVEZMQBP7odvUGPoY7iGLRlls3v3MSvEkdexFpbtasEmzIq6DorCT/M4NzumPJ41G7CIhtOoqxf22DB0x4niQNUT0QuxpmngZbSR76/nSHhdaD5oLjGSJzOHShXicL74S976jatlPDTRlfgeD0mmjEj2Uw8xzQVSHIyIUcj1d98/jOarfFo= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jul 2019 12:31:53.9362 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 761da0f9-0be0-4539-6e38-08d70b7bea94 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: DB6PR0802MB2600 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,krzysztof.koch@arm.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1563453120; bh=bLWVulVZw74HmTKlfAcu2YnICfuU0/h3Py1Kf7keKBs=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=ALPPh1Lxva6ntwoSR1Z/5GR3S77mKpEb2u47aUNvIMto3MG4rP3CUJK3W9XUF4OAGtw SAgvN0CUftMgTcgqJ1WTuMEzy0mlP5Mp3s0LPFo2vaNtOTnF+lITgOAIqHav/cZrS/vbS 4wtkVcpaRTG5jJuoeg9e8i5B0Dqk8gG/i24= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Remove a call to ParseAcpi() responsible for getting the XSDT table length. This call is not needed because the ACPI table buffer length is provided as an input argument to the ParseAcpiXsdt() function. Modify remaining code to use the AcpiTableLength argument of the ParseAcpiXsdt() function instead of a global static variable. Signed-off-by: Krzysztof Koch Reviewed-by: Alexei Fedorov Reviewed-by: Jaben Carsey Reviewed-by: Sami Mujawar Reviewed-by: Zhichao Gao --- Notes: v1: - remove redundant ParseAcpi() call [Krzysztof] ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Xsdt/XsdtParser.c | 1= 8 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Xsdt/Xsdt= Parser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Xsdt/XsdtPa= rser.c index 4196168bff47d70c67f79f3fc1f4cdee302d460e..e39061f8e2612f2cce4aebf51a5= 11b63b703662b 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Xsdt/XsdtParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Xsdt/XsdtParser.c @@ -1,7 +1,7 @@ /** @file XSDT table parser =20 - Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. + Copyright (c) 2016 - 2019, ARM Limited. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent =20 @par Reference(s): @@ -60,22 +60,12 @@ ParseAcpiXsdt ( UINTN EntryIndex; CHAR16 Buffer[32]; =20 - // Parse the ACPI header to get the length - ParseAcpi ( - FALSE, - 0, - "XSDT", - Ptr, - ACPI_DESCRIPTION_HEADER_LENGTH, - PARSER_PARAMS (XsdtParser) - ); - Offset =3D ParseAcpi ( Trace, 0, "XSDT", Ptr, - *AcpiHdrInfo.Length, + AcpiTableLength, PARSER_PARAMS (XsdtParser) ); =20 @@ -84,7 +74,7 @@ ParseAcpiXsdt ( if (Trace) { EntryIndex =3D 0; TablePointer =3D (UINT64*)(Ptr + TableOffset); - while (Offset < (*AcpiHdrInfo.Length)) { + while (Offset < AcpiTableLength) { CONST UINT32* Signature; CONST UINT32* Length; CONST UINT8* Revision; @@ -140,7 +130,7 @@ ParseAcpiXsdt ( // Process the tables Offset =3D TableOffset; TablePointer =3D (UINT64*)(Ptr + TableOffset); - while (Offset < (*AcpiHdrInfo.Length)) { + while (Offset < AcpiTableLength) { if ((UINT64*)(UINTN)(*TablePointer) !=3D NULL) { ProcessAcpiTable ((UINT8*)(UINTN)(*TablePointer)); } -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#43936): https://edk2.groups.io/g/devel/message/43936 Mute This Topic: https://groups.io/mt/32514380/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 Mon May 6 16:07:54 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+43937+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 1563453121535937.9710821354565; Thu, 18 Jul 2019 05:32:01 -0700 (PDT) Return-Path: X-Received: from EUR04-VI1-obe.outbound.protection.outlook.com (EUR04-VI1-obe.outbound.protection.outlook.com [40.107.8.55]) by groups.io with SMTP; Thu, 18 Jul 2019 05:32:00 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WZrvpGkTbRlcLvbx1qNMerOczRdfnkXpsT0Rq5tDp92T6JjoHRALD/Y81jz9K3jthfyNSil1ybjZy0i92PJrRufw5GvQD8uo5TyKexkm3ya0GVVmeVmsAHWS0DzR+EhRLj7dJOqJPw3rgLKkR1ReMgtOClW6CkRG34CnkevGCSmffeYvo7YmX25bNX+kehSYndFnLbApk4ED7GAucHrIzKZi61NNAj1JXF+itc/lOWuqbnQpa28FLOC8jTmoVSaka5Ffx+gS2nUruTCFXWgPIS8KDTD8QDnCZj/uu0ddV29Lvc43OYSkVmWeeK8aOm7HE6nfhB6Ib55gelxQnTZ9TQ== 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=gtoe/8Eer41zMQbE12cgXWkt/E45M3JkVKMfEheKHxA=; b=D1LHIKhHRVN9J1GLBEVm+Hu084zxPcdY/SoU7BsgGOaUUmFhYZlZQQ6Q8hmW9E7qY+tlua9mTpDNDfpnf06A6SArcAGMEVMq9q6MjZqnRrtsxHqtsRGz3QmFpEftu6ZvlNUdizSBUQhZIqr1seRxFK0mh6OmoyYU1c4s8Ta7gQqF/K9ZXUFBjBvJHhW9FqH5I/gPqI2lkE49rt1Woyrwb1ammTbw1mLx2rtvW6btc4R1d3nrt20gFouSwZOFLrtx+kTiDaced3567IKkUocWXXla6zfhLHJwH0YjxNs8Pn6tRlOsd1SK8Hw7Fbp/C7+QOkPsxEG/I/WFGF+OAqVQjQ== 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 X-Received: from VE1PR08CA0028.eurprd08.prod.outlook.com (2603:10a6:803:104::41) by DB8PR08MB4956.eurprd08.prod.outlook.com (2603:10a6:10:e0::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2094.11; Thu, 18 Jul 2019 12:31:56 +0000 X-Received: from AM5EUR03FT020.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e08::200) by VE1PR08CA0028.outlook.office365.com (2603:10a6:803:104::41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2073.14 via Frontend Transport; Thu, 18 Jul 2019 12:31:55 +0000 Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+43937+1787277+3901457@groups.io; helo=web01.groups.io; Received-SPF: TempError (protection.outlook.com: error in processing during lookup of arm.com: DNS Timeout) X-Received: from nebula.arm.com (40.67.248.234) by AM5EUR03FT020.mail.protection.outlook.com (10.152.16.116) 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:31:54 +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; Thu, 18 Jul 2019 12:31:51 +0000 X-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:51 +0000 From: "Krzysztof Koch" To: CC: , , , , , Subject: [edk2-devel] [PATCH v1 3/6] ShellPkg: acpiview: RSDP: Make code consistent with other parsers Date: Thu, 18 Jul 2019 13:31:39 +0100 Message-ID: <20190718123142.5696-4-krzysztof.koch@arm.com> In-Reply-To: <20190718123142.5696-1-krzysztof.koch@arm.com> References: <20190718123142.5696-1-krzysztof.koch@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: abba7cbd-6716-4593-45e8-08d70b7bead1 X-MS-TrafficTypeDiagnostic: DB8PR08MB4956: X-Microsoft-Antispam-PRVS: NoDisclaimer: True X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: DA10viekm2nuSfDY0l28rbmHY/faU7bdO+kVkoIrnN7dauhq/IUrNR480sZ41tZoM6QEz2Oh7cRkyzdid+FashuwPz73sx0j4Jwo4xiBef49KNPqN6FTJwzsfiUJlUyBr7SNUzL6wBC89QcyLCYopjGfLhlTq9YgR3Pu9z3VMgtDG2YRiSJm6X9ksiSxUcC4a5s6dD4NHiZxv/M0LJtS2fUZ5f8qahQny12z75Dsb/3ib9cwroXSk7klf4ZSJDw/7yeMby8FZRNKw56tyec+QJ5iW9Cou5wcP7V19uctzO3PmhLP5fxAXY7rmpcihzU9yDxs97AUFC3uYscrRQ8Ep4mbfFOWIFr4E4wnUaahv6veYRcakbI73LaQadn8DJ+eBLDcdixMaDR8S09s/KiY9c+V6Msuy9ex2PXK5CaTrQQ= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jul 2019 12:31:54.3369 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: abba7cbd-6716-4593-45e8-08d70b7bead1 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: DB8PR08MB4956 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,krzysztof.koch@arm.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1563453120; bh=hrizKLewNmE4kpPJalMScONS2W6Y4xAx133yxL/lka8=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=DCsZw9gVoi6hvgVugtI8WCEiwSLAoG6Ca3axhus/7ZiIKBeVlQ98RklSwvelO1lKkmN ND2uWVPK9nP7B2dJNsE2XrGA/9iIGS3vO3OMbHQhDQfRFNYi9jIRjptSR82JjmoCqEq+I +m3SQkYeKz20DizcfPrjBwMoFUI2uX8xbpY= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" List ParseAcpi() function arguments one per line in order to make this function call consistent with ParseAcpi() calls in other ACPI table parsers. Also, notify the user that XsdtAddress value of 0 results in RSDP parsing being terminated and that the XSDT table will not be processed. This effectively means that no more ACPI tables will be parsed because of this RSDP table content error. Signed-off-by: Krzysztof Koch Reviewed-by: Alexei Fedorov Reviewed-by: Jaben Carsey Reviewed-by: Sami Mujawar Reviewed-by: Zhichao Gao --- Notes: v1: - minor code style enhancements [Krzysztof] ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c | 1= 1 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/Rsdp= Parser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpPa= rser.c index 586de7cbfb12f856c0c735b6e295c1cc32eb2ceb..bceda91386b5c070b81b2beac83= e2a0102a9b64e 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c @@ -159,7 +159,14 @@ ParseAcpiRsdp ( VerifyChecksum (TRUE, Ptr, AcpiTableLength); } =20 - ParseAcpi (Trace, 0, "RSDP", Ptr, AcpiTableLength, PARSER_PARAMS (RsdpPa= rser)); + ParseAcpi ( + Trace, + 0, + "RSDP", + Ptr, + AcpiTableLength, + PARSER_PARAMS (RsdpParser) + ); =20 // This code currently supports parsing of XSDT table only // and does not parse the RSDT table. Platforms provide the @@ -167,7 +174,7 @@ ParseAcpiRsdp ( // Therefore the RSDT should not be used on ARM platforms. if ((*XsdtAddress) =3D=3D 0) { IncrementErrorCount (); - Print (L"ERROR: XSDT Pointer is not set.\n"); + Print (L"ERROR: XSDT Pointer is not set. RSDP parsing aborted.\n"); return; } =20 -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#43937): https://edk2.groups.io/g/devel/message/43937 Mute This Topic: https://groups.io/mt/32514381/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 Mon May 6 16:07:54 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+43938+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 1563453170247546.0124379532565; Thu, 18 Jul 2019 05:32:50 -0700 (PDT) Return-Path: X-Received: from EUR02-AM5-obe.outbound.protection.outlook.com (EUR02-AM5-obe.outbound.protection.outlook.com [40.107.0.63]) by groups.io with SMTP; Thu, 18 Jul 2019 05:32:48 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fibrfTFmh0vV8uhF4oRniqFiaOUfaDWjZsRAznRuQwjf3wElkt8qAV/lgCqx/ZLdiy4jgtqZzH0iOuShtbg3IMXPiVHbiAhooC9H7ryj3+CCeAJZGy1eCruWgn/yB9izzy4tT3xgZfpH79EAS/ivSecCoKdKhOcLngg++ZCYuNIK7ILY2lnHBSgsJP3BufyKKtjh8nynx8VPLtC0p/3OrpqUeq/cmrN62cpAsH18ufy9W1GXbKQWNajkpwIa0IQGxEsXLqMcIK90/iM34UTcFveV8RfZ1/c/UZ/w1yEJvrxt0dVROzAu/A/C7vpDek+sLvMwrkqyrfztDrYljQNJFQ== 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=/ogoKEy8R2llwiek3otQQzAxJaGszxYBm4lG0XS5Xkw=; b=gJuALWJOMFyoHHYlHrRINmUw4QAdyvZ+zij1xEbi4uYzcFC1DvbpEaz+OYSMp3vNrrJ5B743j3qw4GyYKhPEf7kjGB5Rvlibc48VNqvrwN8NbKgJd5TOhv7mqQz1LWDs/BXwMq7tH9q+RsOZ6Qq+wm2UVrSOAASpwG/DHUEnjJFXIIznYPm4uhiT7b3TzcOejkyZmhQVn3+IXeBbgZ4hCNem1FJSQkgruaAULuryOrhu1JuIgDO8I2yoA8GctqhxdQQ/FZgRovW3RV4xP3jlhzaB+jGL2TnBdLKhdyQS+OsUFxJQZjAAgNSnAHl7UfosHtOFk5Z1eBWyqTUZ/UlbLA== 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 X-Received: from VI1PR08CA0118.eurprd08.prod.outlook.com (2603:10a6:800:d4::20) by AM5PR0801MB1844.eurprd08.prod.outlook.com (2603:10a6:203:39::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2073.14; Thu, 18 Jul 2019 12:32:44 +0000 X-Received: from AM5EUR03FT060.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e08::205) by VI1PR08CA0118.outlook.office365.com (2603:10a6:800:d4::20) 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:44 +0000 Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+43938+1787277+3901457@groups.io; helo=web01.groups.io; Received-SPF: TempError (protection.outlook.com: error in processing during lookup of arm.com: DNS Timeout) X-Received: from nebula.arm.com (40.67.248.234) by AM5EUR03FT060.mail.protection.outlook.com (10.152.16.160) 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:42 +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; Thu, 18 Jul 2019 12:31:51 +0000 X-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:51 +0000 From: "Krzysztof Koch" To: CC: , , , , , Subject: [edk2-devel] [PATCH v1 4/6] ShellPkg: acpiview: SRAT: Minor code style enhancements Date: Thu, 18 Jul 2019 13:31:40 +0100 Message-ID: <20190718123142.5696-5-krzysztof.koch@arm.com> In-Reply-To: <20190718123142.5696-1-krzysztof.koch@arm.com> References: <20190718123142.5696-1-krzysztof.koch@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0b360e7f-9ca6-440e-3e4d-08d70b7c0789 X-MS-TrafficTypeDiagnostic: AM5PR0801MB1844: X-Microsoft-Antispam-PRVS: NoDisclaimer: True X-MS-Oob-TLC-OOBClassifiers: OLM:1332; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: QfhphkrcUOmD1u1YOay0A/O15rZvLdUPu1W+hVBXBmin/lShsx8dakNGQgGrA0cPg0ccqaIvh0feiQ9nTIt41B+Io+UqOCHUoJ77TEyPU6ttDn5Xnn3rT2vMp7GFdZyy17py7Qrz/pPtatTcHTWZ34eVu9DFxkJax9/VWrsgOTXwoJWVNztpqa075qBPZGQ9+uzN10pOUoka0sj8EIV64ds/EnEaUw+Mw3oh6GuR4meL1WnyVG0EYlul1dMdyHk5+ZYPbOIC2F5zq8KsGNJos84GMeDIoC3i9GqYLtgd6QI8xGwFEQnOxvrkb3SGS+jfXHIn4p8vDj5VHiN6Hy9s+1d2n2UeiWpOawQyHQFPz8v+4LtAkiE069qyOTw743LmDqN7cyT4X/6SW/DTvO5u/bQoABOZjvYscbGwGkdbGys= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jul 2019 12:32:42.5188 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0b360e7f-9ca6-440e-3e4d-08d70b7c0789 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: AM5PR0801MB1844 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,krzysztof.koch@arm.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1563453169; bh=2G2tDQCOiPRYTge4DQhMo4CFIDvWqARKo/xCxbMaCAI=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=ZiLgMb4LYy9QveGRr0CGaHs2AAe5cRm5dQnQrUg+5PcswmFeY/rq4DnKID1YPJ531ys BsSLBuIg1C87proLYrhgeAhYknpinlaUEEC3MaBKWRy23ndgm96t4DECuJSX/HtT+kw+K 2ltCMJueHoRbp11d/rgtjGW/q4BY9N0FH0E= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Minor changes to the SRAT parser code to conform with the EDKII coding style and to make it consistent with other ACPI table parsers. Signed-off-by: Krzysztof Koch Reviewed-by: Alexei Fedorov Reviewed-by: Jaben Carsey Reviewed-by: Sami Mujawar Reviewed-by: Zhichao Gao --- Notes: v1: - minor code style enhancements [Krzysztof] ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c | 3= ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/Srat= Parser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratPa= rser.c index 075ff2a141a82b522e8aaedb7ad79249aaf5eaac..d0011ca65c17788c55555e2f222= 5380854e780fb 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c @@ -234,6 +234,7 @@ ParseAcpiSrat ( AcpiTableLength, PARSER_PARAMS (SratParser) ); + ResourcePtr =3D Ptr + Offset; =20 while (Offset < AcpiTableLength) { @@ -278,7 +279,7 @@ ParseAcpiSrat ( ResourcePtr, *SratRALength, PARSER_PARAMS (SratGicITSAffinityParser) - ); + ); break; =20 case EFI_ACPI_6_2_MEMORY_AFFINITY: -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#43938): https://edk2.groups.io/g/devel/message/43938 Mute This Topic: https://groups.io/mt/32514385/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 Mon May 6 16:07:54 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+43939+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 1563453172110535.3426572932909; Thu, 18 Jul 2019 05:32:52 -0700 (PDT) Return-Path: X-Received: from EUR03-DB5-obe.outbound.protection.outlook.com (EUR03-DB5-obe.outbound.protection.outlook.com [40.107.4.59]) by groups.io with SMTP; Thu, 18 Jul 2019 05:32:51 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AlePnR+0wh5zc1QFSuE3WI/89phww3J/gWexsctDsJflwHh5zwvBJaxbQ3xaukTwjKzgPQ/zRFxURN6ni7KhAldMLgNh4SUkQO3oZjdB1YoRE2LPsueLC/gUB3Hr8emkBrSGugADKlUQC2Ek3Fh8PFHT2W3dtYE1+eA7t6vemFdnQP/MgerrRLaXeOAOru08TkGnFfow5fyC9oWSlGt22BrZZzJlVB2dSUSGIUXoCaENAXeJ2dMoUNLlbHNeAwntan2dBmxTo5c8a+akUjN8fSOwcjGxBBvjbCwUFIkIEfj9No9GN/QrJCJDURETgX3+Ts6w4qkfQn4NqjP389ZVbw== 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=lylIpgI9rHQ6ynk6i8l8KYZ9nRhw30+IuINQ5W1OiI4=; b=hgsxrdj7/9BqhCIcuXt3zS4sXp6J58wsNpIHagOvLOMcJc4YEcR2lhVf+zTYBJFQzWgvKJpamvFkjRUg1Mvocn+LEbQoxZJSbYt1O6ukVYeZRQDMyOgxXQqEDsjqUxa2E3hzmdSyvCAwfhd2PowNJXSzRQ3f1uvBV9Pq1Q9udN/LQPD8IrdJ4qykS0DPYury72s19CxBGj/J1wpM/0pHrUStx3+Hk24Fmlts31/2W+8b0mLbR/8TJ2REhYQjZtWRZNXG86KWlnamw4GsiTBso5MCjeH1Z4y6S7XKppTg6b9PLZ4lUr0u57n0WwyKvKovPAMqpYnVZLcBwtLrvt9ojw== 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 X-Received: from VI1PR08CA0111.eurprd08.prod.outlook.com (2603:10a6:800:d4::13) by VE1PR08MB4960.eurprd08.prod.outlook.com (2603:10a6:803:110::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2073.14; Thu, 18 Jul 2019 12:32:46 +0000 X-Received: from AM5EUR03FT057.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e08::205) by VI1PR08CA0111.outlook.office365.com (2603:10a6:800:d4::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2094.11 via Frontend Transport; Thu, 18 Jul 2019 12:32:46 +0000 Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+43939+1787277+3901457@groups.io; helo=web01.groups.io; Received-SPF: TempError (protection.outlook.com: error in processing during lookup of arm.com: DNS Timeout) X-Received: from nebula.arm.com (40.67.248.234) by AM5EUR03FT057.mail.protection.outlook.com (10.152.17.44) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.2052.18 via Frontend Transport; Thu, 18 Jul 2019 12:32:45 +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; Thu, 18 Jul 2019 12:31:52 +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.1415.2; Thu, 18 Jul 2019 12:31:52 +0000 X-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: [edk2-devel] [PATCH v1 5/6] ShellPkg: acpiview: MADT: Split structure length validation Date: Thu, 18 Jul 2019 13:31:41 +0100 Message-ID: <20190718123142.5696-6-krzysztof.koch@arm.com> In-Reply-To: <20190718123142.5696-1-krzysztof.koch@arm.com> References: <20190718123142.5696-1-krzysztof.koch@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ce7c2040-d9a4-45a9-9943-08d70b7c095d X-MS-TrafficTypeDiagnostic: VE1PR08MB4960: X-Microsoft-Antispam-PRVS: NoDisclaimer: True X-MS-Oob-TLC-OOBClassifiers: OLM:3826; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: ojPabcoZA9yjrCh5Jw36Kr1VpOxSgEcAdZYuqCzcDJgtQ7W5xX5saxDo8BrvvEyFGABIVU22bmRsTApAYcjIaSSwwEfXEm5LVliT/YNK5nx53bLEL8wwuGuxM5ptB5gXmESTG2qR/xpGw/zm4g2VKmA/C4Ao2ACwgd7gNAit41GLc0Gn+ZuqndknTH62ufnkjLO316NddEiHC1R9DtWNlxFIUAYT2E5ci1I7TdMUEhQ3LZmnAFVb4XLnEQW4P5zy+7F6nuEiuU5Bzc1B6JjX/Vpu6GGkobmHtoGJzovQurOiRda1YVV6e1v19Ik9FBSvvLZMcqrW04mSQJ6qE9K8GHy9Y4n7lRUnCJGSVTdIiOz/SSrRkNn0z/iRgKPMwNK72lsnV/vsxJbnpVsEk8FN06fbkTIlkLtrJ51LhjmbCSo= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jul 2019 12:32:45.5862 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ce7c2040-d9a4-45a9-9943-08d70b7c095d 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: VE1PR08MB4960 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,krzysztof.koch@arm.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1563453171; bh=mTyqOv2YLVYJwEv2TrpA9WU3SxDs7cbSpT/aKko54r8=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=Z1T8ajowoa+Qi4bws7GJ5omEmw3edUHBbHLoVY10nzdXUPwduQHMLmVQDs1i7StOnLz ygvZ49OZCXpAh8coyX3QsRt7NJ3WNYamxwUVEQZmN9rfaeTAQ5o8D5L/DdSc0B2CgfcPl In2ise7n5X2sPQcDpCrfLC7kAykJcMUv2dw= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Split the Interrupt Controller Structure length validation in the acpiview UEFI shell tool into two logical parts: 1. Ensuring MADT table parser forward progress. 2. Preventing MADT table buffer overruns. Also, make the condition for infinite loop detection applicable to all types of Interrupt Controller Structures (for all interrupt models which can be represented in MADT). Check if the controller length specified is shorter than the byte size of the first two fields ('Type' and 'Length') present in every valid Interrupt Controller Structure. Signed-off-by: Krzysztof Koch Reviewed-by: Alexei Fedorov Reviewed-by: Jaben Carsey Reviewed-by: Sami Mujawar Reviewed-by: Zhichao Gao --- Notes: v1: - split MADT structure length validation [Krzysztof] ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c | 3= 0 ++++++++++++++------ 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/Madt= Parser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtPa= rser.c index 59c3df0cc8a080497b517baf36fc63f1e4ab866f..52b71f37a40733de20293733066= 58ca08c78c42d 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c @@ -290,16 +290,30 @@ ParseAcpiMadt ( PARSER_PARAMS (MadtInterruptControllerHeaderParser) ); =20 - if (((Offset + (*MadtInterruptControllerLength)) > AcpiTableLength) || - (*MadtInterruptControllerLength < 4)) { + // Make sure forward progress is made. + if (*MadtInterruptControllerLength < 2) { IncrementErrorCount (); Print ( - L"ERROR: Invalid Interrupt Controller Length," - L" Type =3D %d, Length =3D %d\n", - *MadtInterruptControllerType, - *MadtInterruptControllerLength - ); - break; + L"ERROR: Structure length is too small: " \ + L"MadtInterruptControllerLength =3D %d. " \ + L"MadtInterruptControllerType =3D %d. MADT parsing aborted.\n", + *MadtInterruptControllerLength, + *MadtInterruptControllerType + ); + return; + } + + // Make sure the MADT structure lies inside the table + if ((Offset + *MadtInterruptControllerLength) > AcpiTableLength) { + IncrementErrorCount (); + Print ( + L"ERROR: Invalid MADT structure length. " \ + L"MadtInterruptControllerLength =3D %d. " \ + L"RemainingTableBufferLength =3D %d. MADT parsing aborted.\n", + *MadtInterruptControllerLength, + AcpiTableLength - Offset + ); + return; } =20 switch (*MadtInterruptControllerType) { -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#43939): https://edk2.groups.io/g/devel/message/43939 Mute This Topic: https://groups.io/mt/32514386/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 Mon May 6 16:07:54 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+43940+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 1563453175174627.1375976108702; Thu, 18 Jul 2019 05:32:55 -0700 (PDT) Return-Path: X-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 X-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 X-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 Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+43940+1787277+3901457@groups.io; helo=web01.groups.io; Received-SPF: TempError (protection.outlook.com: error in processing during lookup of arm.com: DNS Timeout) X-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 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; Thu, 18 Jul 2019 12:31:53 +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.1415.2; Thu, 18 Jul 2019 12:31:52 +0000 X-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: [edk2-devel] [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> In-Reply-To: <20190718123142.5696-1-krzysztof.koch@arm.com> References: <20190718123142.5696-1-krzysztof.koch@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ba5d3bc0-75c7-4a4c-c0b2-08d70b7c0b14 X-MS-TrafficTypeDiagnostic: VI1PR0802MB2608: X-Microsoft-Antispam-PRVS: NoDisclaimer: True X-MS-Oob-TLC-OOBClassifiers: OLM:8273; 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 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,krzysztof.koch@arm.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1563453174; bh=Fbq4NBBYdLu+T1Oj8kl1zOzx0wDRBJrx+56TdgwfA+s=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=BglsDrxYvDDc6PuNkef18Uq3IidBciUxkGui5RDfe+WblmlXaddsdBV0ROqgy7E45Jf S5c+kS6+bWZ1OIKCtyQZQMAwo/ojA4CVhwcS7IoicDjS4Jysy12YzAmZHOfAxt5uhiGVB Hgnd/dXwwYi55W7aXLq0lKkaW5wd8xn3bfY= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Alexei Fedorov Reviewed-by: Jaben Carsey Reviewed-by: Sami Mujawar Reviewed-by: Zhichao Gao --- Notes: v1: - refactor PMCG node mapping count validation [Krzysztof] ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c | 3= 2 ++++++++++++++------ 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/Iort= Parser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortPa= rser.c index 93f78e1a9786ed53f6b5529f478b72a220b4f8df..4d29ca2818804fb472bec0f632a= 87cd3c8a7cd48 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 ); =20 +/** + 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. =20 @@ -204,7 +226,7 @@ STATIC CONST ACPI_PARSER IortNodeRootComplexParser[] = =3D { An ACPI_PARSER array describing the IORT PMCG node. **/ STATIC CONST ACPI_PARSER IortNodePmcgParser[] =3D { - 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 !=3D 0) { DumpIortNodeIdMappings (Ptr, MappingCount, MappingOffset); } - - if (*IortIdMappingCount > 1) { - IncrementErrorCount (); - Print ( - L"ERROR: ID mapping must not be greater than 1. Id Mapping Count =3D= %d\n", - *IortIdMappingCount - ); - } } =20 /** -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#43940): https://edk2.groups.io/g/devel/message/43940 Mute This Topic: https://groups.io/mt/32514387/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-