From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR01-HE1-obe.outbound.protection.outlook.com (EUR01-HE1-obe.outbound.protection.outlook.com [40.107.13.42]) by mx.groups.io with SMTP id smtpd.web10.10389.1636541755893363686 for ; Wed, 10 Nov 2021 02:55:57 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=WofWnoFY; spf=pass (domain: arm.com, ip: 40.107.13.42, mailfrom: sami.mujawar@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=LOofdiaKx98V3AzFeV7bI4s05ifv1cS4Q3MD7UIu/Ow=; b=WofWnoFY65OWTxtEDr9s8q1d1y5MzcBCBcJF/mC+wQtwMOBXO14DAkK1YQjwtfhVcQZh/9j2Zeiaos//lRdRU/jIHWR1fDfoWvLgfG6W4Q6VSr0StsiYTqIygIgXTopeNfRSAK4rRzLkdrgTzNEHYXasFrvI+noN4Hco8RLbBFk= Received: from AM5PR1001CA0044.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:206:15::21) by DBBPR08MB4347.eurprd08.prod.outlook.com (2603:10a6:10:c8::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.11; Wed, 10 Nov 2021 10:55:51 +0000 Received: from AM5EUR03FT029.eop-EUR03.prod.protection.outlook.com (2603:10a6:206:15:cafe::cb) by AM5PR1001CA0044.outlook.office365.com (2603:10a6:206:15::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.16 via Frontend Transport; Wed, 10 Nov 2021 10:55:51 +0000 X-MS-Exchange-Authentication-Results: spf=temperror (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=temperror action=none header.from=arm.com; Received-SPF: TempError (protection.outlook.com: error in processing during lookup of arm.com: DNS Timeout) Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM5EUR03FT029.mail.protection.outlook.com (10.152.16.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4649.14 via Frontend Transport; Wed, 10 Nov 2021 10:55:49 +0000 Received: ("Tessian outbound 7b0bcc4a550a:v108"); Wed, 10 Nov 2021 10:55:49 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 73d623092b8e767c X-CR-MTA-TID: 64aa7808 Received: from d8fb13ec933b.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 5CC84200-A58D-4357-A97D-372701F462A1.1; Wed, 10 Nov 2021 10:55:33 +0000 Received: from EUR05-AM6-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id d8fb13ec933b.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 10 Nov 2021 10:55:33 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YMFC+anr/9XfW0HuyEsxx1qK4PBntAo2NEReBrr//2Q1UHh3AKJEyja9rySMW0dh9Up/RLx6FrzkFtk/mNJTSiM10VJ/zaaYUqWB5yHJwtyM3IkcQhh9zFz0Pv7v10fNto3bxPpb4S8XGR1z+OX+BXSFVMd/xsjrq6EwmWWLYdRejRS8AvNXeb2PF5zLn1cr2RktHL1EGhYEJHpw4VsaQn0GxGKspm/nhQ3CTP4tYdnwL7uctLCmiEfBqJ6LJKeDKqAnmkvcqnffPtUs1cF912zpzjL6pt5/oOlZTC/wjKyS1b4KEc+D94DdikDqMJC64LOYwTyKSvlqfHjfHiGNRQ== 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=LOofdiaKx98V3AzFeV7bI4s05ifv1cS4Q3MD7UIu/Ow=; b=KaJUsYw9YDlfJYEmYWcenUB+ZyeHUfgEOAIHnbkH9NgRg5+cYGFu18mZYkutx/+1j3D0bZS11m5W4u/LCvx2GFr0DfuTYKYfHwXsQPysrGURzJnisz5KNJshJ8soxooVz7wIdD5pdNGU+o0NfWs+K4i82IPF6iPCSM7kmkxbgoMB0Ydp137TAo6hWbNi71A7iAU7aQ4OLMxuQ9wUk4mMKsjH6iqSmAIlT2KGnZeJGI/7xzomDdkSwrLtBuIdsewEDMfDQcFomqkvsr1XjiBHCRkjt+OBvYoNv29BA9dmfhkDdNJnIFO5LqmpfDIOQWtJS5ManBuHeDgqVj2IEoHXeQ== 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=LOofdiaKx98V3AzFeV7bI4s05ifv1cS4Q3MD7UIu/Ow=; b=WofWnoFY65OWTxtEDr9s8q1d1y5MzcBCBcJF/mC+wQtwMOBXO14DAkK1YQjwtfhVcQZh/9j2Zeiaos//lRdRU/jIHWR1fDfoWvLgfG6W4Q6VSr0StsiYTqIygIgXTopeNfRSAK4rRzLkdrgTzNEHYXasFrvI+noN4Hco8RLbBFk= Received: from AM6P191CA0010.EURP191.PROD.OUTLOOK.COM (2603:10a6:209:8b::23) by AM9PR08MB7088.eurprd08.prod.outlook.com (2603:10a6:20b:41c::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.15; Wed, 10 Nov 2021 10:55:31 +0000 Received: from VE1EUR03FT037.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:8b:cafe::82) by AM6P191CA0010.outlook.office365.com (2603:10a6:209:8b::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.11 via Frontend Transport; Wed, 10 Nov 2021 10:55:31 +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; Received: from nebula.arm.com (40.67.248.234) by VE1EUR03FT037.mail.protection.outlook.com (10.152.19.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4649.14 via Frontend Transport; Wed, 10 Nov 2021 10:55:31 +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.2308.14; Wed, 10 Nov 2021 10:55:29 +0000 Received: from AZ-NEU-EX03.Arm.com (10.251.24.31) 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.2308.14; Wed, 10 Nov 2021 10:55:28 +0000 Received: from E114225.Arm.com (10.1.196.43) by mail.arm.com (10.251.24.31) with Microsoft SMTP Server id 15.1.2308.14 via Frontend Transport; Wed, 10 Nov 2021 10:55:28 +0000 From: "Sami Mujawar" To: CC: Sami Mujawar , , , , , , , , , , Subject: [PATCH v3 3/8] ShellPkg: Acpiview: IORT parser update for IORT Rev E.b spec Date: Wed, 10 Nov 2021 10:55:27 +0000 Message-ID: <20211110105532.38696-4-sami.mujawar@arm.com> X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: <20211110105532.38696-1-sami.mujawar@arm.com> References: <20211110105532.38696-1-sami.mujawar@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a3616ae4-6c24-46a2-32b4-08d9a438a86e X-MS-TrafficTypeDiagnostic: AM9PR08MB7088:|DBBPR08MB4347: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:8273;OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: TfHqUspQCLRSPrKlsEqXk7mYeQQZfq1delEj36jPp8Kj+N1EE20esgJ0q98QspiiyXTjA/ds6ExgXPwyuvyywv9N1tfrlrmlkIGsmV8s9eR/osGAbHMWEyjlJAF2raApM3EeKR4JZec6YImVooQlUAL/vp/0ip0Pddm9RNowIhUK8snsisteBsSEyTtH+cBX9I5uNuaLwPucLnmXCuIB/J3+261rcz0Z74RIIuVAvh533xf1/qMSiHZV9MEKt03hj/FD4N5Hxlpq2nJaHgzOVX22MloShAzaRMLYgJYJBAmcRnz7H5yAE4oPRaDX1LTrBDfwB656kTRYRMrDlJ951JZomslLs4mr/5vCBy/75E8Qd/uzasV1NMuk4q0rCSVPpQVp6kU9+F1ZUDBCF5Pb5jMhIRJMB1T+BLpOdx3XjPwcsTUjyyxJuhuojz0+DSPA6EAGgUVaBPgKr+pgr2jVaNWHNdOLUo/7vhRNwTX6V7Ef+6UufesTBiXpQZMKwvMlgp6Wj4EYGdsuYZ88wdm/5nBbKqY1C6wnU/9CxMd3Pqzxwb+mB0+1kHpfzEyGDu+72Qk/LpnM5uFXoLPXub6s+pBKmjFr9rGm+oCwsZ/sN1nrzB/FPqvAYdR5Ga0l2aE2rVnPmGD0fd0wGbGupwKaZ3oc3qOemzZWJQmIjQrTu4zkptymNztuS/3RnSOI9/pVBTSbC4y3LLHt1ttbwDs7wXfnqw0+beVD3YsotxxkDPMNuun8g1g7B9FFi2fesOIbKCilmJ7phAHwBSVf1JTTjH4QswNd/yATw4UVXgQ/n2VYVMohDJ/GponUNx1K48ItcZfinGCwoj3VNsjYFObMLKLcVSd53N4V7JDq92qwrpA= 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:(4636009)(36840700001)(46966006)(426003)(86362001)(82310400003)(36860700001)(2906002)(26005)(186003)(70586007)(70206006)(54906003)(47076005)(316002)(356005)(1076003)(2616005)(508600001)(15650500001)(8936002)(83380400001)(7696005)(8676002)(81166007)(6916009)(44832011)(4326008)(36756003)(336012)(5660300002)(966005)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR08MB7088 Return-Path: Sami.Mujawar@arm.com X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT029.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 1a99fa12-e557-4e18-706c-08d9a4389d46 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zAev1vbgTfAH5JfI8pgQpYBDDOS5HJJ5UHKMLSUJeASCjKzAzO7tFQpznLA486+VESjTm96S3zX2yXDAfdUWs2dJkE6uAPXaTVu8DLC0v+YyY4nRsS8q/LnrA/PWC2aFdkDeucOK3SPIa7ra2ZJqt55nEGKuLWe9d3tTG+QxSE6gF+vzTmBr4BecdoeabcbnhBrNKLns2DEMDTpYgB3XX1FqCDZHXjPSK5f62J4w/JTazGX5V8oNRFAMZCEuWb+020HeJQPfoicleVYAOKpcaIRlyjCE6QlISxqTSZTXHUvo2xXzviJd535NNU1ydt/WRqlO0k6sy3qb16+ymKWsU0tu1bgqAb7ZS0jIUz+ePBpRx0OLxaBOuwRtNNeoUXtYN5JqXxhfE5Vfq5eQFOZl6neiiOlNg30QYPZXuv544BVYx9XOsRpCoM3GFSCo9+/xY1aR20fiZRiXM10/j3yPXqp65NP8toNe2i4g6LRDuulPKUicKc6Q7qdajfhHIcvvb+qu/FthDyc3XXPp5cbUPI0jeFd/WzyeyFXT6oAyvFQ/Gjd3jW8uvEQNlrXFpa4rY1fenz2/Ylm/FBz1Qd61d4CT9NdmLjv0F16qOS8dIkcrNjhf5tXcJIsLW1dHaJVst3qPTe91o+k5AAQ5s2XQUPsu/gBmbzR83eOA/ckhHYe69Mgw4ZLxfpE162eJp0ql1M6e9GAYtqW+RMSULWYqjnWRblxmfxYx4dgQRNrDEcGaLRmN6l4cO68niBVLSxOKVF/IufgvhLSU5t5wPMYJOiv+5wfoxUDcBehLrjqzEPuX77yjOS+4pcIFLD2raG5ytPlzdQ0Qkvmy4y091Rkflw== 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:(4636009)(46966006)(36840700001)(336012)(316002)(186003)(8936002)(6916009)(4326008)(5660300002)(36860700001)(70206006)(70586007)(54906003)(26005)(63350400001)(47076005)(2616005)(44832011)(8676002)(83380400001)(63370400001)(426003)(86362001)(15650500001)(508600001)(966005)(1076003)(2906002)(36756003)(81166007)(82310400003)(7696005);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Nov 2021 10:55:49.9744 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a3616ae4-6c24-46a2-32b4-08d9a438a86e 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: AM5EUR03FT029.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR08MB4347 Content-Type: text/plain Bugzilla: 3458 - Add support IORT Rev E.b specification updates (https://bugzilla.tianocore.org/show_bug.cgi?id=3458) The IO Remapping Table, Platform Design Document, Revision E.b, Feb 2021 (https://developer.arm.com/documentation/den0049/) introduces the following updates, collectively including the updates and errata fixes to Rev E and Rev E.a: - increments the IORT table revision to 3. - 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. 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 ID mapping count is set to 1. Signed-off-by: Sami Mujawar Reviewed-by: Zhichao Gao --- Notes: v2: - No code change since v1. Re-sending with v2 series. [SAMI] v3: - No code change since v1. Included r-b received for [SAMI] v2 series. Ref: https://edk2.groups.io/g/devel/topic/83600720#76658 ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c | 196 +++++++++++++++++++- 1 file changed, 191 insertions(+), 5 deletions(-) diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c index fcecaff5134256497bda87241f339076897c3ece..1507dd3a4d79e61024b0c5526e21ffdacb782251 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c @@ -5,10 +5,12 @@ 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.b, Feb 2021 + (https://developer.arm.com/documentation/den0049/) @par Glossary: - Ref - Reference + - Desc - Descriptor **/ #include @@ -36,6 +38,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 +105,72 @@ ValidateItsIdArrayReference ( } } +/** + This function validates that the address or length 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 +Validate64KAlignment ( + IN UINT8* Ptr, + IN VOID* Context + ) +{ + UINT64 Address; + Address = *(UINT64*)Ptr; + if ((Address & (SIZE_64KB - 1)) != 0) { + IncrementErrorCount (); + Print (L"\nERROR: Value must be 64K aligned."); + } +} + +/** + 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."); + } +} + +/** + This function validates the ID Mapping array count for the Reserved + Memory Range (RMR) 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 +ValidateRmrIdMappingCount ( + IN UINT8* Ptr, + IN VOID* Context + ) +{ + if (*(UINT32*)Ptr != 1) { + IncrementErrorCount (); + Print (L"\nERROR: IORT ID Mapping count must be set to 1."); + } +} + /** Helper Macro for populating the IORT Node header in the ACPI_PARSER array. @@ -113,7 +184,7 @@ ValidateItsIdArrayReference ( { 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"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, \ @@ -253,6 +324,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 (ValidateRmrIdMappingCount, 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, Validate64KAlignment, + NULL}, + {L"Physical Range length", 8, 8, L"0x%lx", NULL, NULL, Validate64KAlignment, + NULL}, + {L"Reserved", 4, 16, L"0x%x", NULL, NULL, NULL, NULL} +}; + /** This function parses the IORT Node Id Mapping array. @@ -601,9 +695,93 @@ 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) + ); + + 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 @@ -612,6 +790,7 @@ DumpIortNodePmcg ( - SMMUv1/2 - SMMUv3 - PMCG + - RMR This function also performs validation of the ACPI table fields. @@ -753,9 +932,16 @@ ParseAcpiIort ( *IortNodeLength, *IortIdMappingCount, *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)'