From nobody Wed May 8 12:12:24 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+44109+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 1563781852301116.98406681672668; Mon, 22 Jul 2019 00:50:52 -0700 (PDT) Return-Path: X-Received: from EUR02-AM5-obe.outbound.protection.outlook.com (EUR02-AM5-obe.outbound.protection.outlook.com [40.107.0.76]) by groups.io with SMTP; Mon, 22 Jul 2019 00:50:51 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Lu4Yivr5dPEG6yPOHu7r7Z8Yt91TE4F2hQHTnMZM/0UeTFBx/KP42FA0VtEsDelQIydEkMBLTM31IOR4mcunDwwB2IYoIS8hGuKCie1bJtVF0P/dclgHKNgrgAM59IbzNUc2YJX1H6tSqGpzi+ejBgXhiKkotpzBnywALA4jQhGzr5SYA7HSi8RdhHvEaQ6zaOcOH9MN8qKvL1quh5JeSgdBvKsnRZ8R7SrNIKWjB2JdzaB+yF4frRMP6z6y1DQ4ETHMxWzk1/YIuMT4Ga0COp0wDvGV4pOcM0gCT+BvtRoRQ/NUJLBck/8/lkX9aiGf/O3dKyde9RONjl/XF7a53w== 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=nGRRsdv3tyjUUpm3jLQJVAcXEyzdZS4eT9eMia9X8U8=; b=RDeqNzMNFY6UmYzHQE4RUxg+OGCcYRVb6E7TM19TbtJlNdSjZsob9z5+dw9HaJUaDgjc2bBhDmfObUjER8V0kG0hZvOjT1+oogk67owcKkYZsexZ62H8QHXL6IvAlCHEYLo3s2wMHs7vfY/ScxjB7X0zf+HyudfOyW74NXZe7C75Uy62s9mQfooqJxjQSU2ET3+HIaNn3b+efScmbAg2TB7KgiZu99tWZtCUj/uYnHuPsWpR59+f7PdzebIBjCwE8X36imdVwhTKWG+AsB/rFghoXywNtCnb24H9uqcUA5xSzoTkvXi5KNfjSZc/uJC4sU1w0AgyJXvrkmJnik3VEQ== 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 HE1PR0802CA0021.eurprd08.prod.outlook.com (2603:10a6:3:bd::31) by AM0PR08MB4948.eurprd08.prod.outlook.com (2603:10a6:208:163::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2094.16; Mon, 22 Jul 2019 07:50:47 +0000 X-Received: from DB5EUR03FT021.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e0a::205) by HE1PR0802CA0021.outlook.office365.com (2603:10a6:3:bd::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2094.14 via Frontend Transport; Mon, 22 Jul 2019 07:50:47 +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+44109+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 DB5EUR03FT021.mail.protection.outlook.com (10.152.20.238) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.2052.18 via Frontend Transport; Mon, 22 Jul 2019 07:50:45 +0000 X-Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX04.Arm.com (10.251.24.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1415.2; Mon, 22 Jul 2019 07:50:35 +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; Mon, 22 Jul 2019 07:50:35 +0000 From: "Krzysztof Koch" To: CC: , , , , , Subject: [edk2-devel] [PATCH v2 1/6] ShellPkg: acpiview: Allow passing buffer length to DumpGasStruct() Date: Mon, 22 Jul 2019 08:50:21 +0100 Message-ID: <20190722075026.20244-2-krzysztof.koch@arm.com> In-Reply-To: <20190722075026.20244-1-krzysztof.koch@arm.com> References: <20190722075026.20244-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: c898fd1e-1735-48e7-9227-08d70e794def X-MS-TrafficTypeDiagnostic: AM0PR08MB4948: X-Microsoft-Antispam-PRVS: NoDisclaimer: True X-MS-Oob-TLC-OOBClassifiers: OLM:5236; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: J/oT7+99kCYRlhK/DbSQk29BEE43Puf3seZgBpsTAkTH0RMLPpKgZI+M8NuXObD8yXF8iDc9+rDLtaVp5uROuiLNL/fmtFDo0zovcZG3So3+JMEIUUAm70cnNRTBhprzR0O6f529A3tSyIHZzZeKh8QsoGtkVlNnL97zViVJ4Btiw/ZLMGbktM0PB72abA+PpB3J8Gj0HsGs4wC05SCux8K/xRgiZDpLGVQ957nHNnJt1aslQNkO7T9mk8Uavm/470iAmKRyIO/S4L3kW8mvi8QeiGalh1Jnr2V3bYgpTQWTvSzrprFbZUgoSz1AzVaa5lBhxH8ML3YwDsnPcNvHIW2z3Gv8WMncD5uU2+X0pXc8fuxV/SaZSRXkQ3RL3fhsd0qPIMAlwpqqBVTXVPnNWzb+XyxCsbNkiGU+kPndqiI= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jul 2019 07:50:45.7472 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c898fd1e-1735-48e7-9227-08d70e794def 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: AM0PR08MB4948 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=1563781851; bh=QdMAZQeVNpxpHEzoISRrJjS87exIxWkUTRfBxqRq9/E=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=S57EhD2JFkR8uoTOsFQx715oPHfJ4sNYlKnyfkS/DhmLu73BadQa/7qreqhjU40yQg3 oa/5mp042S0DHz7eINCJwNyC81J1R20EZLOz7VCRfY28Nk7D7eIKaasWlnjl72w4XLMY3 hdbe4Nfh/0PwQsLEfTL/O6iGoGxGiUyAn7Y= 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 --- Notes: v2: - Pass GAS_LENGTH to DumpGasStruct() in DBG2 parser [Zhichao] 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 1efcbd40f86efdabed2152540a415db8a950fb71..c6929695a1032c57761ef85002d= 6c51b7800ce23 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c @@ -134,7 +134,7 @@ DumpDbgDeviceInfo ( AddrSize =3D (UINT32*)(Ptr + (*AddrSizeOffset)); while (Index < (*GasCount)) { PrintFieldName (4, L"BaseAddressRegister"); - DumpGasStruct (DataPtr, 4); + DumpGasStruct (DataPtr, 4, GAS_LENGTH); 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 (#44109): https://edk2.groups.io/g/devel/message/44109 Mute This Topic: https://groups.io/mt/32556318/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 Wed May 8 12:12:24 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+44107+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 1563781845139119.00810255946294; Mon, 22 Jul 2019 00:50:45 -0700 (PDT) Return-Path: X-Received: from EUR02-HE1-obe.outbound.protection.outlook.com (EUR02-HE1-obe.outbound.protection.outlook.com [40.107.1.77]) by groups.io with SMTP; Mon, 22 Jul 2019 00:50:43 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Lm+cN0YzS9eawyC2ZO5BTp2aE3LeAxuUTejSc0rD7AvvtsOX7nWFtAlEw+PlrZCPo+ENoVoE8rFn90+kS4Rt+w63qmTMukPhbldYOQx5yP31Xjj7HoapTgBfd5IHJ/Kdh6JGsRr4d6e1rxAe/hyM86UiFyizO/6fdLEzb4gpC3UJwAnlI8y3LISBALzhmPQFUjRIRlUUDlXalT94jECurmvVKXv309vJb1+vua+m/fZnuLo6nMJk3pmCqqmsd8omBjDyZy0VOytsAVICG5NTA/c1+H3W+rrYm0jzNgdE3htDkP+Y8twwcsT29X/igpM2eb2YSjqZnR8PkfcAq/9CDQ== 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=dcwaZeciRzl40/E6+wCbDQKwz29TseGhQKGw9/uNQLGhSiG7SF1H21HmvM00e58VVoUREYeFXd7KClLQvee4lrnySs39b88dmtkaIA6Wfp6drsn+1uf2hLxzqM8X2Tb6rj/E7QgT8RkGL9QYpSk4UkgUPv7di5Obeinyl3vJbNDdl8Gus2EZcnXNHOlHng3VLHU5hIlRr4HCeRI8C2ft8GDQ8zikW+9EmDMkapxifJ8Zx9Ph8X9l2Gv/xlsDL2QuQZ0p5TE9ovGyT3/aHG5W+JSYd/mBmLmCK+hxh6Hh5iBm/JMNMpwv/9xfvngX5p39tm/lBPC6c6OPIcPJAwopFQ== 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 AM4PR08CA0068.eurprd08.prod.outlook.com (2603:10a6:205:2::39) by DB8PR08MB4953.eurprd08.prod.outlook.com (2603:10a6:10:ef::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2094.17; Mon, 22 Jul 2019 07:50:38 +0000 X-Received: from AM5EUR03FT020.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e08::208) by AM4PR08CA0068.outlook.office365.com (2603:10a6:205:2::39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2094.14 via Frontend Transport; Mon, 22 Jul 2019 07:50:38 +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+44107+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; Mon, 22 Jul 2019 07:50:37 +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, 22 Jul 2019 07:50:36 +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; Mon, 22 Jul 2019 07:50:36 +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; Mon, 22 Jul 2019 07:50:35 +0000 From: "Krzysztof Koch" To: CC: , , , , , Subject: [edk2-devel] [PATCH v2 2/6] ShellPkg: acpiview: XSDT: Remove redundant ParseAcpi() call Date: Mon, 22 Jul 2019 08:50:22 +0100 Message-ID: <20190722075026.20244-3-krzysztof.koch@arm.com> In-Reply-To: <20190722075026.20244-1-krzysztof.koch@arm.com> References: <20190722075026.20244-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: 98b4e73c-1e23-45a1-8eca-08d70e794907 X-MS-TrafficTypeDiagnostic: DB8PR08MB4953: X-Microsoft-Antispam-PRVS: NoDisclaimer: True X-MS-Oob-TLC-OOBClassifiers: OLM:4941; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: GGVMXdLUAIkrb/gbbRAF5lh8pYs5GTN1RrtKiQtmihzcsxXlefB8tQWtZnqV6oNFzO4Ect8GekVZR82vXfg4pZsdm4GIR7BvG4I76oA29CIQsbHouEB79yCJWIHoVC3QHpxiJg88KO0iUoQrxq85HO2D1NUhv+Uvp51ne6GPE6rOWAluYUPWVI9OZ5gveew+cn4Abu0smGvxxg+HYM5KitUGEJvPnJEl8cgWTmMZoWeOHGx2xw7+/hKBjUeN/WCSunx7Sz+J8eTi8BtZtBF8aLb1bOz1yeGF2OXLPVGiUnIhDhNP5UDCrjW+xLtBrfNFb0x49t73RE+aZCtCqGATpV2u3itgpZZxxSAaGQ5VRc5/SQt0eQWZgnYT5Gc07EEazeUVXhhB49DuhdlZVWWqww9Z7din8lq8HeE3l2HNeVY= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jul 2019 07:50:37.4147 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 98b4e73c-1e23-45a1-8eca-08d70e794907 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: DB8PR08MB4953 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=1563781844; bh=bhB/e3CPLZertZVvQOGYDUqtQ7uihx5G/rszhv8JV6k=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=PDoWlOycuBJDDY7XVPHZivculmLwuYZQ11cGuhm+AQbG9MGDtDkk6zHT0D70FeCayWS GUnZxwNW5WghpJcAeshzqzShu9Ex2osGP3S2JyNxQsNY6ZCeetjN0SPP17noyZNWDc5+g hPM+TY7iid42EP6Cq8EsFUbwGVyIgqN+bHI= 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 --- 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 (#44107): https://edk2.groups.io/g/devel/message/44107 Mute This Topic: https://groups.io/mt/32556316/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 Wed May 8 12:12:24 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+44110+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 1563781854257651.5549567303235; Mon, 22 Jul 2019 00:50:54 -0700 (PDT) Return-Path: X-Received: from EUR04-VI1-obe.outbound.protection.outlook.com (EUR04-VI1-obe.outbound.protection.outlook.com [40.107.8.70]) by groups.io with SMTP; Mon, 22 Jul 2019 00:50:53 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JW5R18XY2m3QHnS6Gk08wKMItG3PVRguVZn+IkJm7K1sl6c8Hf2lFRVC1vd0s/4ZK3chmEaZnvZeqq+HEIUqd8OFqr4NcRUy85UvVotwQgKh+i74dxyEm8x+SHgbO8ZKj8XqKcP2caWhOOXZOcqS4cJSBtEKJzOn/jFxmxSkC+I9m+uRA7PwhwPnPX5+gJwGeSa4wzzOgER1wxCqi/zZJ1a8Rn2eA6qTQzEqqUb6FIQFpCVFQQr1SNhwoqBTHK4uQsluYI9tIIekckxTtEAkVBJoj9IJDoMXLk4agkDIafpoEWYZ7aeUALHbdknfkA4fCpBQs1zQcsSRAunM4uBE6A== 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=pqeUI6lEWWVY2bcb1WfAb/g/G1uqxCpRn+LGqqszclA=; b=A5elTsqDYW2l5YYQBgGAnMjmHdA05Vxrrp8OlGnRfivVf9Y0xBfHELjtHH4RpnF8U0LXBrA7f3/9mPiVTwrfECmwEhAUxuLIt3+4Zn777eN+XyRVDEDE96jpe0Y/jMKHLogMyko/+54N2yI+BGvF++Ra9B/Xbu5AKyMhV8Ktbndf8j7ZU7OJl5aJDri77r2Hvt/D/BNwV/ftg5ico68sgZForMBtTru1zuGjIPtLUPvQNsNS+GzXTMM7QjCij20cRxZCgfPCJb9YOyzJ4SHs0yGNj2wBRlyh6/F7SS9vv8AYWzqbQ6vpaaGSArWFyVN2x8GqidfxuXocUJ7wiygqeg== 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 HE1PR0802CA0021.eurprd08.prod.outlook.com (2603:10a6:3:bd::31) by AM6PR08MB4951.eurprd08.prod.outlook.com (2603:10a6:20b:e1::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2094.16; Mon, 22 Jul 2019 07:50:49 +0000 X-Received: from DB5EUR03FT021.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e0a::205) by HE1PR0802CA0021.outlook.office365.com (2603:10a6:3:bd::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2094.14 via Frontend Transport; Mon, 22 Jul 2019 07:50: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+44110+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 DB5EUR03FT021.mail.protection.outlook.com (10.152.20.238) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.2052.18 via Frontend Transport; Mon, 22 Jul 2019 07:50:47 +0000 X-Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX04.Arm.com (10.251.24.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1415.2; Mon, 22 Jul 2019 07:50:36 +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; Mon, 22 Jul 2019 07:50:36 +0000 From: "Krzysztof Koch" To: CC: , , , , , Subject: [edk2-devel] [PATCH v2 3/6] ShellPkg: acpiview: RSDP: Make code consistent with other parsers Date: Mon, 22 Jul 2019 08:50:23 +0100 Message-ID: <20190722075026.20244-4-krzysztof.koch@arm.com> In-Reply-To: <20190722075026.20244-1-krzysztof.koch@arm.com> References: <20190722075026.20244-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: fc6348d5-dbd0-4cb1-821c-08d70e794f1d X-MS-TrafficTypeDiagnostic: AM6PR08MB4951: X-Microsoft-Antispam-PRVS: NoDisclaimer: True X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: 0lA6H6mfU7luXWXIwXlwvm3tTOGloDj1EI9Ie+LYhXPbn6g78UL2D3Uh3Mzt6f6ivi6TjR8L4z6uT0Y0QuLChg5Dr4Wib/GIcgCwlez47iFsI4OBv0Eqx2RjuX9IFCgxOWXRzk94yxo8F68iDjaqAPtRM3/Hpeo4EmvWkfYbJZGCNLe6VundEQAIwjAqmzEXR94/fluzktjGIrarZKyJLc5vmk21NHJJN90fyN53UfAmwi9werx73rLFez+rDu4q8EOnxdEzppYWl+TfROATVrHol0gY3H9jxBzfT+HLZOlHdumous7jmTO/XkXVPdhSwBleaNSgr0L2geZeEQeSVep9fuBwvsCiBu151XIu/haPjhjQc6V2cssSBM7fcGHBu35ZMgj9mqYzFOlVzdjLPfuXXTDj92lyv3L7DMR9nLU= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jul 2019 07:50:47.7250 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fc6348d5-dbd0-4cb1-821c-08d70e794f1d 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: AM6PR08MB4951 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=1563781853; bh=nWW8CQU8nhIN6pKmutbPRujCqeVyxnxN15wb6kAB4Rc=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=aN9DWbdGmvqI2OuRV1UU2rRuTmjI2H6dLg7iHcI9LvmR54s9yRPf3pOO8iSs2ishlmH AJOQBRB54+PJvuAq7u0eb763KAKmo1jdZdhAAnW+sfhvqX3ARIXyLFw9U3NwgL2b83pP2 sL9FZXwM9ueHdPa2Da+bUyxAkzsT44x2EgA= 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 --- 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 4bf928139a507d0b8f203ed0cbf0863cc2ec5de5..5a5c4b50c12e6eb0aa0efb1765d= f7e123f614da3 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c @@ -129,7 +129,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 @@ -137,7 +144,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 (#44110): https://edk2.groups.io/g/devel/message/44110 Mute This Topic: https://groups.io/mt/32556319/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 Wed May 8 12:12:24 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+44112+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 156378198792268.14226272638734; Mon, 22 Jul 2019 00:53:07 -0700 (PDT) Return-Path: X-Received: from EUR02-HE1-obe.outbound.protection.outlook.com (EUR02-HE1-obe.outbound.protection.outlook.com [40.107.1.69]) by groups.io with SMTP; Mon, 22 Jul 2019 00:53:07 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QAaofmlPHEb3yXf5AnVjELfUoLpmMd49g8zYVfF0cVcIpsdkBPSJtXEOVXywS0tc90yFNPxgm4g28kqwNuD2z/xQF1wszbwHoZLwhMnRe4PER0vcqk1cyATHwRro45YAx2nVV0/s8tWcd0GhH5yoIn0tJrQi6cZarL7RmOGXTruBpg8dakK/kvyaqs6su/LZmfdwkold6lE0urGNV9ZvOi82Iu1rLxYeV+UJfo56idZopJ+dnSboI9WSNhvuAZuKWcdaJbE69cvDZdaI/CGk2wTGXdSAwsyhOdABA0Qbw0VLTMZlGyIUPna+sYwUnvoBAhGIW8yJ9x9hlLZDQhcfVw== 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=MkSctGL+71K5psnH4Q0EppxgZPyQAoxv0QIcfaLgq48=; b=i58zJMbQfGY4jI64znXRGeUgZGPJe2j5MHEZEwKjirodaDA7dvvDqK81aGj07Y0hIsdzjw2lzV4nqO2zVpi82ldiMCHsrPspT9uy9/wMf80yoIkle6vn1yMGREDDraeE+UO1+M/V1WzYWRFgeF6QEn6dHdz9ZQvKbAEgr1XRtY5byQGYgmmcRuw/MlZ9LncCrFwLSKziii+axAcoPPLwpM6wZKUnHNV5y5UXE+9VKlwfRHUnygCjUxUiVZd1su9BYoPStIWyA/LV6uhswPhGPgSNps1xvygSlwjLc2ldrG1ao7plx2efnOIukK59qb/iL2ORBC4QBfICfEmu849ZXg== 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 VI1PR08CA0131.eurprd08.prod.outlook.com (2603:10a6:800:d4::33) by AM0PR08MB4946.eurprd08.prod.outlook.com (2603:10a6:208:165::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2094.17; Mon, 22 Jul 2019 07:53:02 +0000 X-Received: from DB5EUR03FT038.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e0a::204) by VI1PR08CA0131.outlook.office365.com (2603:10a6:800:d4::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2094.14 via Frontend Transport; Mon, 22 Jul 2019 07:53:02 +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+44112+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 DB5EUR03FT038.mail.protection.outlook.com (10.152.21.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.2052.18 via Frontend Transport; Mon, 22 Jul 2019 07:53:00 +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, 22 Jul 2019 07:50:37 +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; Mon, 22 Jul 2019 07:50:37 +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; Mon, 22 Jul 2019 07:50:37 +0000 From: "Krzysztof Koch" To: CC: , , , , , Subject: [edk2-devel] [PATCH v2 4/6] ShellPkg: acpiview: SRAT: Minor code style enhancements Date: Mon, 22 Jul 2019 08:50:24 +0100 Message-ID: <20190722075026.20244-5-krzysztof.koch@arm.com> In-Reply-To: <20190722075026.20244-1-krzysztof.koch@arm.com> References: <20190722075026.20244-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: 90b2058c-1174-4d94-1ae0-08d70e799e7f X-MS-TrafficTypeDiagnostic: AM0PR08MB4946: X-Microsoft-Antispam-PRVS: NoDisclaimer: True X-MS-Oob-TLC-OOBClassifiers: OLM:1332; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: uOu+mCGpSXhSVn+YcAzOIPsk6MLatnUvigTMcgv6MaKTppD0HB2WgozWx3fKtNz3PdTFfkxnNrMCneNvDvymqxNhCKNSxog+LuzgIL+oIgcJGn2X7fD+dlR3973alzju4xc2pPpUh942o+WhtgKamuxmbmbq5gvn4U/wjoNCVEIAkPmENsC03QhtVJTHTd4Cx948fpf+SnbddG667WE6yH6WLG8nf1NtvXHm4k7YmtPWUijiB7C4EKzo0Y8TmrtIBBQEE6wfW9BHV17cCTPC0kzQmpGnz1ss6A3LROtZjCg0L5DK5hf6exDjztV8LKTJ/RdnajcHcqgK5OOBag6riuwzUEGXqs47D7Ocu4+d4CGb274GHIauEaiRqHLgjkGK+FrDtBMzCQnZXm3a01oKaxx1/3zcxc/FB07DWUaC8cs= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jul 2019 07:53:00.9056 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 90b2058c-1174-4d94-1ae0-08d70e799e7f 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: AM0PR08MB4946 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=1563781987; bh=6CfgS9tUAmj2Nw2D9sJSAsCPa0Xn93KDtaoMrhpHaW0=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=WNw8dHS5VOIPmeGB/cPcpdKZDRYrI8b8yoYhk0MjN69auxrOXwhWjItnc8jz1xlU6JZ Y4IEej4q8Tg+b9dKGH/tUdbNcFd/FfI+ZCBagBq8DLy5UtheTFUodBLVoQZo9J9o18Xfc dsG555T15T7dV13ZxOkhFHvZDayg6cVLqE8= 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 --- 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 03d28d52842040e4872e204fc10ae3dba7861936..59c77401eaab32b73a9f83fd4d6= 3785221b3c222 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c @@ -206,6 +206,7 @@ ParseAcpiSrat ( AcpiTableLength, PARSER_PARAMS (SratParser) ); + ResourcePtr =3D Ptr + Offset; =20 while (Offset < AcpiTableLength) { @@ -250,7 +251,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 (#44112): https://edk2.groups.io/g/devel/message/44112 Mute This Topic: https://groups.io/mt/32556345/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 Wed May 8 12:12:24 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+44113+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 1563782007307541.670077570351; Mon, 22 Jul 2019 00:53:27 -0700 (PDT) Return-Path: X-Received: from EUR03-AM5-obe.outbound.protection.outlook.com (EUR03-AM5-obe.outbound.protection.outlook.com [40.107.3.46]) by groups.io with SMTP; Mon, 22 Jul 2019 00:53:26 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=B/Jl3drFcSjH+DfAyWfGcALZKxvt/exF0aV7mVLJwbC3x19vlTl8VN+D08BQKZXG/FG3xpat3Eg/2UPiUzUfAMi8M9yfW1c7VfTzMbssuRJUZ4AfI2kv3xR12yfzU9XclzxUi1amDv78pcHEThfLI/3Ej95jfya/QYkt2br06Pjbzvzh4dJOieJNR3PNw2YTz2HIuyqO21gue7tBFOGkE2h8A06pbwNNcKAiJ1KNq35Hvy/pQUDiFIkMjGFrHRmmFm6YlJieJ4hKLXO8Hbd1ZpUl4WTz1mCl1TGrw96RNcIEKZwNp3bzYnmREBgHNN0/dcDE7gEtV01YAAdTb63MpQ== 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=ODUJFB15+/7wSpoxlcTZvpHFai9hOSqSZr8HjDWDvAE=; b=kihYdLuMRNjpC1AeV9msFcAtlWX12cmpNWhUs7GT1CXtzFOI1/XF+eDqBpvfehhl8R/3uMMGLE4CoJTGHdI7zZuL6i2fPGGIqnFSA46ryAnBcyS6P2T7a3SRgLwI8zv8SvUDOqiUvSOmcmo9HtP9z52QkTyp5hby1NDIR5rEiO3ZfofxvtB/gJuu3p0D/5si2jDbEddXH3QcGfQmYAdfssCXnywgh6ejAZjU8uIgP4uPkcXax+07txhWX7lLZw6toD3gKGpzBXfdKe/ir6hrCuDAGnj5cQcxXjci3c06vZyzt2QJQVI+CNLTnHklc6e0J3vEm5iQ9Byn3OPPInvUlA== 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 VI1PR0802CA0047.eurprd08.prod.outlook.com (10.172.253.33) by AM5PR0802MB2596.eurprd08.prod.outlook.com (10.175.41.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2094.17; Mon, 22 Jul 2019 07:53:21 +0000 X-Received: from DB5EUR03FT059.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e0a::206) by VI1PR0802CA0047.outlook.office365.com (2603:10a6:800:a9::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2094.11 via Frontend Transport; Mon, 22 Jul 2019 07:53:21 +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+44113+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 DB5EUR03FT059.mail.protection.outlook.com (10.152.21.175) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.2052.18 via Frontend Transport; Mon, 22 Jul 2019 07:53:20 +0000 X-Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX04.Arm.com (10.251.24.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1415.2; Mon, 22 Jul 2019 07:50:37 +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; Mon, 22 Jul 2019 07:50:37 +0000 From: "Krzysztof Koch" To: CC: , , , , , Subject: [edk2-devel] [PATCH v2 5/6] ShellPkg: acpiview: MADT: Split structure length validation Date: Mon, 22 Jul 2019 08:50:25 +0100 Message-ID: <20190722075026.20244-6-krzysztof.koch@arm.com> In-Reply-To: <20190722075026.20244-1-krzysztof.koch@arm.com> References: <20190722075026.20244-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: 27cc271c-a872-4913-db00-08d70e79a9ed X-MS-TrafficTypeDiagnostic: AM5PR0802MB2596: X-Microsoft-Antispam-PRVS: NoDisclaimer: True X-MS-Oob-TLC-OOBClassifiers: OLM:3826; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: 5Yo6IPB3s4MjSXn3BqaLLDqaLMV64306p+OSEhJ+f+XmWp7NnRVFrYCPsFmnC1OmA20pu7R25GrWBagLClVDIRjYQx5FdXbgqNotkXdWG+cJipYTqyy81+V9iWIL7gsOQC6zLFl2cvNn2fj/ScyDNU6vkL6wkXMDsW4UkrJu+pUfTHbPUkCm0qJX1RDe0RQqmFeMBgUBYW3W4uajjQlr+CIQbmr/yNky/CPjjBK3v/+8/7xYXjlDbcDIBr4agR3G2GirGP7kYVsm9lSLuZ5ywI+JrQ1sJhN8epFFlp2XfhvM7/5hYhYd4iqg1VRYKDW8RRp1UKho5KVufd+zKhPt03QVTOb/MopzGVUjmHQDR0VG5qClxrgDVSvwGqQhWsRbYmEsO8hNCvACCxEMLuG+Xa+dXL8mbMFZ+SdayDkYE08= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jul 2019 07:53:20.0851 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 27cc271c-a872-4913-db00-08d70e79a9ed 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: AM5PR0802MB2596 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=1563782006; bh=54poodB0VDtm0MgS40hMbF10weGoC/1tBFSiZVImPko=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=MtTUBmsDc1ajvI0l9tjrT/03rq0X/RQCQrPr61Tlc72Dv+y/6NOf/pWWN7CQ99a19/E 5FeazZoqGXLA5Hamw//4EmaihIEvnn4T7tL5sCwB1Y1e4fkzFaa8ZNUZ7UFtf+BSBYbes xfcbrhnMv33J5vM2/kD3D2Y42zL0Z+Z3Dxc= 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 --- 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 338295d30e35c366a60505225cf57145a8e73d93..d80ebd1a2bae7a4acffe687ca5e= e7b4090f0e223 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c @@ -260,16 +260,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 (#44113): https://edk2.groups.io/g/devel/message/44113 Mute This Topic: https://groups.io/mt/32556349/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 Wed May 8 12:12:24 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+44111+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 1563781986609868.0728495110602; Mon, 22 Jul 2019 00:53:06 -0700 (PDT) Return-Path: X-Received: from EUR03-VE1-obe.outbound.protection.outlook.com (EUR03-VE1-obe.outbound.protection.outlook.com [40.107.5.62]) by groups.io with SMTP; Mon, 22 Jul 2019 00:53:05 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HNa1pRpLtBH5O5I0eQXv9mtkV34JNls+Kzi2KfT26GWiDn4Cv8aOUAPa2Gs1oz2+pn3FBK2hzoi0EcpFHEb5w24pAUrbr8nz/TiXF+chFFZdKDVGumYOX1CavC+s2P0urLYc1WeSMFyUEflAW+XGCTWHN6sYonS7jGtKnNNSx7zATxJO71laJbPgB3sGy0PVdAnf/2IBPxKJ1MKXG6yMm3k7IbdEA78mfa38xhG3hpB6TxkMf6MGlmqcE0HdZ5T6GtT/L+xelpE/pRDkMlwsX9gCwkIihZTKzG7UQRQ7+J4W5p9qFZGs9ADn15BcaGpV6WpaudApC+k+QpWgV3WC5A== 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=17xfkri1qQLqm/Awan27Fad6oJHKS69tw9lx/fntXR0=; b=HYZHDWapykxtkzmXa4UA9E+0BOKKdeTaDMgMYEZ6QRvip0MJ+SzlZLohFM+FNGeZJgKq1LqSHMkEyVB/ZEm4vvU/K8S0iuJD4h+581e9inIBCkqTuZcuR+v4sFV6kQ2yBk0lTzp2w4WpTdO58QJ5UGY+/evjaXr33n/2Il6qBnDFfEDHKiP5tBfUeUcGi7RHr81sMTL8kQsJ+w/0i5eVP8ucCZPf4Jj+j4dfJ+pGmxvpstCw8Svw5SaX5zo7X7NqvOMJPl1iTIr15Mt+bK3UgzsPkgGq1iMaT+icGEeRqTNzy7w4dTzxif4KNc61+MLQrNEbvrF457tDfCzsLgAxFg== 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 AM6PR08CA0017.eurprd08.prod.outlook.com (2603:10a6:20b:b2::29) by HE1PR0802MB2602.eurprd08.prod.outlook.com (2603:10a6:3:e2::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2094.17; Mon, 22 Jul 2019 07:53:00 +0000 X-Received: from AM5EUR03FT046.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e08::202) by AM6PR08CA0017.outlook.office365.com (2603:10a6:20b:b2::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2094.14 via Frontend Transport; Mon, 22 Jul 2019 07:53:00 +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+44111+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 AM5EUR03FT046.mail.protection.outlook.com (10.152.16.164) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.2052.18 via Frontend Transport; Mon, 22 Jul 2019 07:52:59 +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, 22 Jul 2019 07:50:38 +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; Mon, 22 Jul 2019 07:50:37 +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; Mon, 22 Jul 2019 07:50:37 +0000 From: "Krzysztof Koch" To: CC: , , , , , Subject: [edk2-devel] [PATCH v2 6/6] ShellPkg: acpiview: IORT: Refactor PMCG node mapping count validation Date: Mon, 22 Jul 2019 08:50:26 +0100 Message-ID: <20190722075026.20244-7-krzysztof.koch@arm.com> In-Reply-To: <20190722075026.20244-1-krzysztof.koch@arm.com> References: <20190722075026.20244-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: 2b459ee1-7f4d-4759-2a78-08d70e799dac X-MS-TrafficTypeDiagnostic: HE1PR0802MB2602: X-Microsoft-Antispam-PRVS: NoDisclaimer: True X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: JjxeNgOTQ2mDV7zJeIsT6adivVARFq+8pzKib6lhHG74UlsdBKlmXsYOmSwdmkrCPm1XemN0JYdBvLep1UERrLzbrvIRmF4SaZUmPmhxRvDczCNf3WsKbf6dzHrTC9Az17ngcIpysQzNdNuYdmIFJ1SWEq5B9MgdF8wbmrybh0n1Qmy4L+nUt/EAgJBAeciEKw3irNO6fI4XG8Hsw275gGKQeH7RTv3JTk+egkinzob2ApBzEejc9LRWubojN6piZ06pWfMcE0J3C7T+SrtgdABdROrvxlm+9UDKNYbfDW/r9nkXYT+Nui+v/K741P2BQeQ4fgLAv1gzWvIV/eFH+Az36oMY97PfyMnSiR+eHYLKMpKy2eLY5ngagp56MJ+6Qu7o4CTpxKLGUoNKthzxJ58/+R8ig5otbLDJ8EMtoQg= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jul 2019 07:52:59.4041 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2b459ee1-7f4d-4759-2a78-08d70e799dac 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: HE1PR0802MB2602 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=1563781986; bh=FFjRCmIa6dJj0tHXn2qRhaDh+140A0b6Ml4UVACnTCg=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=jlUBty0Gtzf3GHzIbpb0AD0e/Mvabl1BMrdTI5vGyfEplCjsVKiJmlvfE2D4TVq67Zu stcWHVdDUyitqZFsj/bwvaHCXjGtbA4ZAyCt9QjKX3taSpFVBLm5RLUNIbaMbsf/CVv0C Kt5suRxx02P8Qj34eDbz9PQznLfLK/uvYac= 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 --- 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 0461205b4f8bc02aa11ab1db1d0deb73bce053b7..7c850b3813d5204775e2cc247ca= bf42358b25769 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c @@ -53,6 +53,28 @@ ValidateItsIdMappingCount ( } } =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 @@ -216,7 +238,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}, @@ -537,14 +559,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 (#44111): https://edk2.groups.io/g/devel/message/44111 Mute This Topic: https://groups.io/mt/32556344/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-