From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR03-AM5-obe.outbound.protection.outlook.com (EUR03-AM5-obe.outbound.protection.outlook.com [40.107.3.42]) by mx.groups.io with SMTP id smtpd.web10.10000.1657817477858624003 for ; Thu, 14 Jul 2022 09:51:18 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=n4Dyb0UB; spf=pass (domain: arm.com, ip: 40.107.3.42, mailfrom: sami.mujawar@arm.com) ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=J8VRSxMxC2n3WybABZ8ATtnGWaGpPTb4lamCGr2qtyRoCC2wh2wYkMG2nPm0WRO8nuj/3Wx0ouSw4v8sYFccP5onquVwu5gMv4galMfZ5T9lbkoyFTKe58rU5ZtKy+L79ClYoH2LObUenwOSW6nVvYFDL469UefvFdGZPmX6RnZprx+j+2Tasn9Kyov0Y6lut20eCOTj9WYxvypy4FCDfnmZaozee8PrT+fvwOZ7G+/1FyyLc2fjiMiPD8uYDabe+z1CWrS5NXRAQnn0WIAs0RwmmOOXy44/vZdQyG/87vW7a0PMA0WXRmE6N1tTbArdTD4S5Eb+IoagF867HFNwnQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=fwmQ0IctpyW8CerXZBupdfFcV3YwLL/0s8ia0nf9iTE=; b=Pc4zfH5RZUH6sGxGUf+HZLkMYBGuFqM/q4D0BtB0+9QmEy7cKjDCnLIVs0sRXl1ZOT3mGGCdISftvJ5mp9CtomRChlhFzm6J3FRnp/VXeu6tXZv8Ui/tLBMCPS/v5rjwyHHMwNhNwc5yDbKXgcEXn5hBVthWm9NNFrXRsyWs5sksAKsaOQmjwlknLWO8oXWzpBsp0vwiybrq5jGN/db2YQnw7PFFMJTm3F461OWanxC3ig9KDBFDG598Kq8xjPuEAMZc35C3Lr5WYH0/7deTd8pvzu1ua46XvFBhYg7NTVqlTOzgnliBChdIsRxVR9AGA8zMaJPG47sZP5sDhDlN4Q== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=edk2.groups.io smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dmarc=[1,1,header.from=arm.com]) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fwmQ0IctpyW8CerXZBupdfFcV3YwLL/0s8ia0nf9iTE=; b=n4Dyb0UBK5VZQ/0bVkiB8/ZhsrHORnNv3+65k+qGx7JHH/fD2zX5C6gU4HGRXXIIU4gf/lJwxBcWePP1gOuG19PDi/9ABoTn8HZhhpAHRANFKXX4U72VkLS+pLvHotFsRtp2JptWFUH6E27s14T8eHFX5jrO808Evlco3gL41s4= Received: from AS9PR04CA0110.eurprd04.prod.outlook.com (2603:10a6:20b:531::12) by GV1PR08MB7778.eurprd08.prod.outlook.com (2603:10a6:150:56::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.20; Thu, 14 Jul 2022 16:51:14 +0000 Received: from AM5EUR03FT054.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:531:cafe::40) by AS9PR04CA0110.outlook.office365.com (2603:10a6:20b:531::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.26 via Frontend Transport; Thu, 14 Jul 2022 16:51:13 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM5EUR03FT054.mail.protection.outlook.com (10.152.16.212) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.15 via Frontend Transport; Thu, 14 Jul 2022 16:51:13 +0000 Received: ("Tessian outbound 0ba541f03a2a:v122"); Thu, 14 Jul 2022 16:51:13 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: a6cee1fce1828498 X-CR-MTA-TID: 64aa7808 Received: from ba949088b368.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 3FB7A034-ED54-44FD-8522-42DE593B86D0.1; Thu, 14 Jul 2022 16:51:06 +0000 Received: from EUR02-AM5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id ba949088b368.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 14 Jul 2022 16:51:06 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=f2WlYweA+rtKLyblM54mNt+N5vHDlTTgN5DPs6LU4jmxY/9ceuhmXwr4SNpyDY8n74iIh7nlzo4aenUTLeeuYtq2hn9m9K4mQYKVqK4WUEp02hZ3NnARvzh7SvJUJYZR32ZKBtBdvlTlK2LK/Z66RuCdjQvOeMOV0HRdvqvoiHe+jx7B8IHQOasvx1DC2DF11Kqy9qzjyVD42peubtQgmahlx9bO89H5Wp6seVYQKKHu4AAuSZHPI5t5kogK83a8mplAh8DTbNjIKoXHbbYRs0TJAdQR6PV2XE4Bbo9Lnn4DbO0eqQP+TjgRcTsDyXSOh0Axg/qeJ1UkMSd430VBLg== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=fwmQ0IctpyW8CerXZBupdfFcV3YwLL/0s8ia0nf9iTE=; b=F4zgk66pFatAnNJs4AFeBTG1WJvAjjav3IXy+tkD9afplie5Mh13e7hQ6YEB6ggXmnegU+ZGmIFkIwpK3TE4v8ye7SQN1/jW/Pnb0+UL/SfusD8cbIu7RPBGCN+DMS9jPXInhSm1aWi5755Yin+XXuFo/hewRqJaxm6TK9iFaJYfd6+w0wBFDqfSi3k/MLNbjnPSsosLh+m9++bV7qklV7CbGWVRafGFe8I9y/cgyZeQKak064Jo6TCWhC3QELpLucwaFfv4HVCmE4c3c14MEkmbzc6Ojpsp3hs2DCxob8dpHqOaGv0jFlg8hnwm+eLqReyymxypbwrchGLhX+61QA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=edk2.groups.io smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fwmQ0IctpyW8CerXZBupdfFcV3YwLL/0s8ia0nf9iTE=; b=n4Dyb0UBK5VZQ/0bVkiB8/ZhsrHORnNv3+65k+qGx7JHH/fD2zX5C6gU4HGRXXIIU4gf/lJwxBcWePP1gOuG19PDi/9ABoTn8HZhhpAHRANFKXX4U72VkLS+pLvHotFsRtp2JptWFUH6E27s14T8eHFX5jrO808Evlco3gL41s4= Received: from AS9PR04CA0072.eurprd04.prod.outlook.com (2603:10a6:20b:48b::7) by DB6PR0802MB2293.eurprd08.prod.outlook.com (2603:10a6:4:86::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.23; Thu, 14 Jul 2022 16:51:04 +0000 Received: from AM5EUR03FT059.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:48b:cafe::e) by AS9PR04CA0072.outlook.office365.com (2603:10a6:20b:48b::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.15 via Frontend Transport; Thu, 14 Jul 2022 16:51:04 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; pr=C Received: from nebula.arm.com (40.67.248.234) by AM5EUR03FT059.mail.protection.outlook.com (10.152.17.193) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5438.12 via Frontend Transport; Thu, 14 Jul 2022 16:51:03 +0000 Received: from AZ-NEU-EX01.Emea.Arm.com (10.251.26.4) by AZ-NEU-EX04.Arm.com (10.251.24.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2507.9; Thu, 14 Jul 2022 16:50:42 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX01.Emea.Arm.com (10.251.26.4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.9; Thu, 14 Jul 2022 16:50:41 +0000 Received: from E114225.Arm.com (10.1.196.36) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2507.9 via Frontend Transport; Thu, 14 Jul 2022 16:50:41 +0000 From: "Sami Mujawar" To: CC: Sami Mujawar , , , , , , , , , , Subject: [PATCH v6 6/8] ShellPkg: Acpiview: IORT parser update for IORT Rev E.d spec Date: Thu, 14 Jul 2022 17:50:29 +0100 Message-ID: <20220714165031.42640-7-sami.mujawar@arm.com> X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: <20220714165031.42640-1-sami.mujawar@arm.com> References: <20220714165031.42640-1-sami.mujawar@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-Correlation-Id: 1d32c4ed-9de7-47b5-9a5f-08da65b90ff6 X-MS-TrafficTypeDiagnostic: DB6PR0802MB2293:EE_|AM5EUR03FT054:EE_|GV1PR08MB7778:EE_ x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: 9yLJ1ICv9rzFtu4wTtt6fNDzaFm7zFOu1Znc2qqhFgZfnPD3dID7LGZlIeoH0cQTCeD3kDpRTbTXUfvWLWPtUN0Daxk5F6rULEqS92rGplsUTuZSfShCP2x2UqdiPCe4uhJdIVa/zisXH4q/RFauhQUi36hJnHF7lnR8Bm8cEsRGXzvw1u6Nt9klNOI2VKBiIXF1T/bj7OaS+SvL/RmfEGR/J/NpcZb0O5vF1VvkMwSG5EmyLxwnYQc9uS6mZQu5k76czFyW+hQHO8sz+K7dJrKUE3bNu2Gnxs4pgZ7VJnppUrmYMn4NN/4aNDHsm+Nk2TNdMpvnSrGRJTkBpo7cNeA9u4qf6rQn+eblBUTs1vCjQwRZv1QQ5ORvuebH6V863IWKALav23UQ8Zl7upF4fQgplx7h3B7bvhF5AiB8INFQdJ33/5WYHQMzqWjSAuY40Vd/vB1s+AfkNYU8cCKruMukRafT6VTQxqDV2wRihm6sMB6mn11b7rA5ycrrSADl5o0UCs8b/azyGckh+zw53ljxrOrdrEjnpN49IbnnFSawiCqZ/rk8bZBicGJFlgSClYEDZI3F30T0OdVVpsayWP7TKhsWlMjO/XDeQF4Bt1zhJUyK65mCVUadYjFDKOGiZTVeBKzfomjA/KxW6ghYXyZZ/Hl7XLPzyBSSuLTDzkQsOfI3iFEIONBG/Eo9SopEWApwQJ7CUrObslt2Eod0CoojADVqzZBnjwcPxKTukQjxF0qYDQYwBLT3N5y4krGo2gsi3CN2ellm7HeeOl80BsEb5KELD7ZHWnRILe4wx4TuZ7mGjgSO/e6FH7m/hdJOPlb3ZEjuTnJtljeZALmeBjJ+igg58zNfQw8RysIUAuy6Cl7rsyWkdhrZO26B30Sf7QNyQQLb48NBdf6ggy8hSGTCcA9ZY5ThMQDhcGt3c0M= X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230016)(4636009)(376002)(136003)(39860400002)(396003)(346002)(46966006)(40470700004)(36840700001)(54906003)(36756003)(70206006)(44832011)(8676002)(316002)(336012)(83380400001)(6666004)(6916009)(26005)(4326008)(70586007)(356005)(2906002)(41300700001)(81166007)(15650500001)(30864003)(82740400003)(426003)(82310400005)(7696005)(186003)(8936002)(1076003)(40480700001)(40460700003)(2616005)(478600001)(47076005)(966005)(86362001)(36860700001)(5660300002)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0802MB2293 Return-Path: Sami.Mujawar@arm.com X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT054.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: a9adcfe0-51af-4dd2-eb25-08da65b90a23 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vCDaa4zkRIv4KIwmuXyC3EXPYpccpMqnyZty50HWSZDogHu8zdu3DYaWuPfUca9DbvtiaXV/LAHoydEnZLHni3cKfrocTbT41Fd7BTuJYKNj45wxvrfTif2cMFJ4b83iWxnqRYUInQwFxZlSjQTxciVzyp+7gu4qB2rmBQe4jflP0VZ+sDEeFplhLmAVwDcZ79n6y2cgruhjlKQUma3nO24fjpa+jov0C3Sp285ob5YIhon/jCznqKDHPuywKe6tNDYMu94tOeh9Qnf97OGyW+xVsEklf12pBhxrk5fLnTQpmh4D1coHsOHgsE5MgBY/MFDZrNmjpOuZaFhC1g1lZZw/3q+bDMKYhENNlkrnJymdHvTSNzn+J/LMLkKWweeAwH8vLST7KLsVjKZQYeMna+3AaKaStPt/IgpsAiN6WG7CjX4opmMCJnQeCn1KyZbv5SSQqiAue07JriyCJVEklVFNORsdSuzDFOrlnjio+i9bjJPXw/DivfhzB3tZefa/GXNe+/UPeugekjOyauozYNs99jc7fm3EOGVdbjrm74zeSJkEu3lSDugErdpKtX2AKMlgrvlqyjW1Wuv1RXqfhhf5OBKwStQ1bIkLcMAeQ4N1kekVHPVzyoUwdW5Pn9uJ4pmnLSYk10lTeRbXz3AzMZbO1N0GKqybR0/xLtZVlaLSLgGVE/TBA6s1MPPsF432F7KFl6pgyGsUTlUpbqb/LXoLvDBBrWEif7EbavxKoV54iPTHnoLcYzUhqOXcgtuU5txx60QFqEktI8x6bn8H/gk5Q2fPNkdx+WrcvEFw2s2eaIE/tqnNlcc0pgK8VWLj1wccBqDuzlLAkeoC4nG3x4F02JqFU4yzTyS930qGp0HuhiKmL8D+JF64NM9DYJY2JpSwqPGwZzd+67GSZSGDgw== X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(13230016)(4636009)(346002)(376002)(396003)(136003)(39860400002)(46966006)(36840700001)(40470700004)(8676002)(70586007)(8936002)(47076005)(44832011)(7696005)(26005)(478600001)(36756003)(2906002)(82310400005)(426003)(54906003)(30864003)(6666004)(86362001)(5660300002)(83380400001)(4326008)(15650500001)(336012)(82740400003)(81166007)(6916009)(316002)(70206006)(40480700001)(966005)(186003)(40460700003)(1076003)(41300700001)(36860700001)(2616005);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jul 2022 16:51:13.6782 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1d32c4ed-9de7-47b5-9a5f-08da65b90ff6 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: AM5EUR03FT054.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV1PR08MB7778 Content-Type: text/plain Bugzilla: 3458 - Add support IORT Rev E.d specification updates (https://bugzilla.tianocore.org/show_bug.cgi?id=3458) The IO Remapping Table, Platform Design Document, Revision E.d, Feb 2022 (https://developer.arm.com/documentation/den0049/) introduces the following updates, collectively including the updates and errata fixes to Rev E, Rev E.a, Rev E.b, Rev E.c: - increments the IORT table revision to 5. - updates the node definition to add an 'Identifier' field. - adds definition of node type 6 - Reserved Memory Range node. - adds definition for Memory Range Descriptors. - adds flag to indicate PRI support for root complexes. - adds flag to indicate if the root complex supports forwarding of PASID information on translated transactions to the SMMU. - adds flag to indicate if the root complex supports PASID. - adds flags to define access privilege and attributes for the memory ranges. Therefore, update the IORT parser to: - parse the Identifier field. - parse Reserved Memory Range node. - parse Memory Range Descriptors. - add validations to check that the physical range base and size of the Memory Range Descriptor is 64KB aligned. - add validation to check that the IORT Table Revision is not 4 as IORT Rev E.c is deprecated. - add validation to check that the IORT RMR node revision is not 2 as it breaks backward compatibility and was deprecated as part of IORT Rev E.c. - skip parsing of IORT Rev E, Rev E.a, Rev E.b, Rev E.c as some fields were deprecated in these revisions. Signed-off-by: Sami Mujawar --- Notes: v6: - Make output format for Flags filed consistent. [PIERRE] - Define macro for IORT Rev E.c and RMR Node revision 2 [PIERRE] and use these to check for deprecated table/node revisions. - Identifier field size changed between IORT revision E [PIERRE] and E.a. so extra checks should be needed. - Added check to skip parsing if IORT Rev E, E. [SAMI] as various fields were deprecated between revisions. v5: - No code change since v4. Included r-b received for [SAMI] v5 series. v4: - Add validation to check that the IORT Table Revision is [SAMI] not 4 as IORT Rev E.c is deprecated. - Add validation to check that the IORT RMR node revision [SAMI] is not 2 as it breaks backward compatibility and was deprecated as part of IORT Rev E.c. v3: - No code change since v1. Included r-b received for [SAMI] v2 series. Ref: https://edk2.groups.io/g/devel/topic/83600720#7665 v2: - No code change since v1. Re-sending with v2 series. [SAMI] ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c | 230 ++++++++++++++++++-- 1 file changed, 212 insertions(+), 18 deletions(-) diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c index 44d633c5282463078a4cc990bb24ca1992f95634..599cf0ee8f7e4c7ed398fa604602604d1955d2e6 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c @@ -1,14 +1,16 @@ /** @file IORT table parser - Copyright (c) 2016 - 2021, Arm Limited. All rights reserved. + Copyright (c) 2016 - 2022, Arm Limited. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent @par Reference(s): - - IO Remapping Table, Platform Design Document, Revision D, March 2018 + - IO Remapping Table, Platform Design Document, Revision E.d, Feb 2022 + (https://developer.arm.com/documentation/den0049/) @par Glossary: - Ref - Reference + - Desc - Descriptor **/ #include @@ -26,6 +28,7 @@ STATIC CONST UINT32 *IortNodeOffset; STATIC CONST UINT8 *IortNodeType; STATIC CONST UINT16 *IortNodeLength; +STATIC CONST UINT8 *IortNodeRevision; STATIC CONST UINT32 *IortIdMappingCount; STATIC CONST UINT32 *IortIdMappingOffset; @@ -36,6 +39,9 @@ STATIC CONST UINT32 *PmuInterruptOffset; STATIC CONST UINT32 *ItsCount; +STATIC CONST UINT32 *RmrMemDescCount; +STATIC CONST UINT32 *RmrMemDescOffset; + /** This function validates the ID Mapping array count for the ITS node. @@ -100,6 +106,52 @@ ValidateItsIdArrayReference ( } } +/** + This function validates that the Physical Range address or length is not zero + and is 64K aligned. + + @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 +ValidatePhysicalRange ( + IN UINT8 *Ptr, + IN VOID *Context + ) +{ + UINT64 Value; + + Value = *(UINT64 *)Ptr; + if ((Value == 0) || ((Value & (SIZE_64KB - 1)) != 0)) { + IncrementErrorCount (); + Print (L"\nERROR: Physical Range must be 64K aligned and cannot be zero."); + } +} + +/** + This function validates that the RMR memory range descriptor count. + + @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 +ValidateRmrMemDescCount ( + IN UINT8 *Ptr, + IN VOID *Context + ) +{ + if (*(UINT32 *)Ptr == 0) { + IncrementErrorCount (); + Print (L"\nERROR: Memory Range Descriptor count must be >=1."); + } +} + /** Helper Macro for populating the IORT Node header in the ACPI_PARSER array. @@ -108,15 +160,15 @@ ValidateItsIdArrayReference ( @param [out] ValidateIdArrayReference Optional pointer to a function for validating the ID Array reference. **/ -#define PARSE_IORT_NODE_HEADER(ValidateIdMappingCount, \ - ValidateIdArrayReference) \ - { L"Type", 1, 0, L"%d", NULL, (VOID**)&IortNodeType, NULL, NULL }, \ - { L"Length", 2, 1, L"%d", NULL, (VOID**)&IortNodeLength, NULL, NULL }, \ - { L"Revision", 1, 3, L"%d", NULL, NULL, NULL, NULL }, \ - { L"Reserved", 4, 4, L"0x%x", NULL, NULL, NULL, NULL }, \ - { L"Number of ID mappings", 4, 8, L"%d", NULL, \ - (VOID**)&IortIdMappingCount, ValidateIdMappingCount, NULL }, \ - { L"Reference to ID Array", 4, 12, L"0x%x", NULL, \ +#define PARSE_IORT_NODE_HEADER(ValidateIdMappingCount, \ + ValidateIdArrayReference) \ + { L"Type", 1, 0, L"%d", NULL, (VOID**)&IortNodeType, NULL, NULL }, \ + { L"Length", 2, 1, L"%d", NULL, (VOID**)&IortNodeLength, NULL, NULL }, \ + { L"Revision", 1, 3, L"%d", NULL, (VOID**)&IortNodeRevision, NULL, NULL }, \ + { L"Identifier", 4, 4, L"0x%x", NULL, NULL, NULL, NULL }, \ + { L"Number of ID mappings", 4, 8, L"%d", NULL, \ + (VOID**)&IortIdMappingCount, ValidateIdMappingCount, NULL }, \ + { L"Reference to ID Array", 4, 12, L"0x%x", NULL, \ (VOID**)&IortIdMappingOffset, ValidateIdArrayReference, NULL } /** @@ -235,11 +287,13 @@ STATIC CONST ACPI_PARSER IortNodeNamedComponentParser[] = { **/ STATIC CONST ACPI_PARSER IortNodeRootComplexParser[] = { PARSE_IORT_NODE_HEADER (NULL, NULL), - { L"Memory access properties",8, 16, L"0x%lx", NULL, NULL, NULL, NULL }, - { L"ATS Attribute", 4, 24, L"0x%x", NULL, NULL, NULL, NULL }, - { L"PCI Segment number", 4, 28, L"0x%x", NULL, NULL, NULL, NULL }, - { L"Memory access size limit",1, 32, L"0x%x", NULL, NULL, NULL, NULL }, - { L"Reserved", 3, 33, L"%x %x %x", Dump3Chars, NULL, NULL, NULL } + { L"Memory access properties",8, 16, L"0x%lx", NULL, NULL, NULL, NULL }, + { L"ATS Attribute", 4, 24, L"0x%x", NULL, NULL, NULL, NULL }, + { L"PCI Segment number", 4, 28, L"0x%x", NULL, NULL, NULL, NULL }, + { L"Memory access size limit",1, 32, L"0x%x", NULL, NULL, NULL, NULL }, + { L"PASID capabilities", 2, 33, L"0x%x", NULL, NULL, NULL, NULL }, + { L"Reserved", 1, 35, L"%x", NULL, NULL, NULL, NULL }, + { L"Flags", 4, 36, L"0x%x", NULL, NULL, NULL, NULL }, }; /** @@ -253,6 +307,29 @@ STATIC CONST ACPI_PARSER IortNodePmcgParser[] = { { L"Page 1 Base Address", 8, 32, L"0x%lx", NULL, NULL, NULL, NULL } }; +/** + An ACPI_PARSER array describing the IORT RMR node. +**/ +STATIC CONST ACPI_PARSER IortNodeRmrParser[] = { + PARSE_IORT_NODE_HEADER (NULL, NULL), + { L"Flags", 4, 16, L"0x%x", NULL, NULL, NULL, NULL }, + { L"Memory Range Desc count", 4, 20, L"%d", NULL, + (VOID **)&RmrMemDescCount, ValidateRmrMemDescCount,NULL }, + { L"Memory Range Desc Ref", 4, 24, L"0x%x", NULL, + (VOID **)&RmrMemDescOffset, NULL, NULL } +}; + +/** + An ACPI_PARSER array describing the IORT RMR Memory Range Descriptor. +**/ +STATIC CONST ACPI_PARSER IortNodeRmrMemRangeDescParser[] = { + { L"Physical Range offset", 8, 0, L"0x%lx", NULL, NULL, ValidatePhysicalRange, + NULL }, + { L"Physical Range length", 8, 8, L"0x%lx", NULL, NULL, ValidatePhysicalRange, + NULL }, + { L"Reserved", 4, 16, L"0x%x", NULL, NULL, NULL, NULL} +}; + /** This function parses the IORT Node Id Mapping array. @@ -607,9 +684,102 @@ DumpIortNodePmcg ( ); } +/** + This function parses the IORT RMR Node Memory Range Descriptor array. + + @param [in] Ptr Pointer to the start of the Memory Range Descriptor + array. + @param [in] Length Length of the buffer. + @param [in] DescCount Memory Range Descriptor count. +**/ +STATIC +VOID +DumpIortNodeRmrMemRangeDesc ( + IN UINT8 *Ptr, + IN UINT32 Length, + IN UINT32 DescCount + ) +{ + UINT32 Index; + UINT32 Offset; + CHAR8 Buffer[40]; // Used for AsciiName param of ParseAcpi + + Index = 0; + Offset = 0; + + while ((Index < DescCount) && + (Offset < Length)) + { + AsciiSPrint ( + Buffer, + sizeof (Buffer), + "Mem range Descriptor [%d]", + Index + ); + Offset += ParseAcpi ( + TRUE, + 4, + Buffer, + Ptr + Offset, + Length - Offset, + PARSER_PARAMS (IortNodeRmrMemRangeDescParser) + ); + Index++; + } +} + +/** + This function parses the IORT RMR node. + + @param [in] Ptr Pointer to the start of the buffer. + @param [in] Length Length of the buffer. + @param [in] MappingCount The ID Mapping count. + @param [in] MappingOffset The offset of the ID Mapping array + from the start of the IORT table. +**/ +STATIC +VOID +DumpIortNodeRmr ( + IN UINT8 *Ptr, + IN UINT16 Length, + IN UINT32 MappingCount, + IN UINT32 MappingOffset + ) +{ + ParseAcpi ( + TRUE, + 2, + "RMR Node", + Ptr, + Length, + PARSER_PARAMS (IortNodeRmrParser) + ); + + if (*IortNodeRevision == EFI_ACPI_IORT_RMR_NODE_REVISION_02) { + IncrementErrorCount (); + Print ( + L"ERROR: RMR node Rev 2 (defined in IORT Rev E.c) must not be used." + L" IORT tabe Revision E.c is deprecated and must not be used.\n" + ); + } + + DumpIortNodeIdMappings ( + Ptr + MappingOffset, + Length - MappingOffset, + MappingCount + ); + + DumpIortNodeRmrMemRangeDesc ( + Ptr + (*RmrMemDescOffset), + Length - (*RmrMemDescOffset), + *RmrMemDescCount + ); +} + /** This function parses the ACPI IORT table. - When trace is enabled this function parses the IORT table and traces the ACPI fields. + When trace is enabled this function parses the IORT table and traces the ACPI + fields. This function also parses the following nodes: - ITS Group @@ -618,6 +788,7 @@ DumpIortNodePmcg ( - SMMUv1/2 - SMMUv3 - PMCG + - RMR This function also performs validation of the ACPI table fields. @@ -643,6 +814,22 @@ ParseAcpiIort ( return; } + if ((AcpiTableRevision > EFI_ACPI_IO_REMAPPING_TABLE_REVISION_00) && + (AcpiTableRevision < EFI_ACPI_IO_REMAPPING_TABLE_REVISION_05)) + { + Print ( + L"ERROR: Parsing not supported for IORT tabe Revision E, E..\n" + ); + if (AcpiTableRevision == EFI_ACPI_IO_REMAPPING_TABLE_REVISION_04) { + IncrementErrorCount (); + Print ( + L"ERROR: IORT tabe Revision E.c is deprecated and must not be used.\n" + ); + } + + return; + } + ParseAcpi ( TRUE, 0, @@ -765,7 +952,14 @@ ParseAcpiIort ( *IortIdMappingOffset ); break; - + case EFI_ACPI_IORT_TYPE_RMR: + DumpIortNodeRmr ( + NodePtr, + *IortNodeLength, + *IortIdMappingCount, + *IortIdMappingOffset + ); + break; default: IncrementErrorCount (); Print (L"ERROR: Unsupported IORT Node type = %d\n", *IortNodeType); -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'