From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (EUR01-VE1-obe.outbound.protection.outlook.com [40.107.14.41]) by mx.groups.io with SMTP id smtpd.web10.4299.1657101447541992074 for ; Wed, 06 Jul 2022 02:57:28 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=D+XfpGs9; spf=pass (domain: arm.com, ip: 40.107.14.41, mailfrom: sami.mujawar@arm.com) ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=BzLi+3mBsszJXhdwPDeZmc1rexDWHcaDhIyCEdpJnr5Vj0Ibe33K7izV/EHK2tzCBfmDWdkyOHvRhJQBTyf84iUy6noY4oj4KQJg1ePJ6k0kLTGNK30Cc2LbT4EUo6raiiEKHyTZsDM99LVHYAjurRDPXNxYonxJMQDQAEq5RHUhOs2m04SZ97jIa61KG6Tz+Cv+Y6KfnJOhP6DfJdnpPsNVDdys7jNykH4VM/Tu58F/L/zs3s/iiCjwrr8sMJqdvC7pKq/9fcDt9tpWbtxYH5HiybQ4DC/eVGw0wyytlaVDJI69Vo4dfz3heYxrqp936rvQcQUo+X2Pnz5oiD5eEw== 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=TvE7T99xwGqCQHNi+1DmY7Ahnoxuw/9dFjiaKOF0TF8=; b=chpZO5uQ17UHP6gLIsuWLxV6e5WN9Zw/YRbDLqlHr0LsQKxI53DAczHZvcmlETImq7X6w63uH2y86z/1YQ/bEBzczJG/tWCijIUM8eNJO6g9p1vtNFW8SLvrG0rxT/XoyuJ6iaRq+XRthyKXPMxTMEnymRxJVrwfGTXG/6V+BSdWSKq6l5x7z2e8Ms40gTKnUXu4Ij3sD7KY4b5ffjYUOTaLd9PGLeybmtoNevVLOB+Z5obWu6sVeY1oF+hSO6mKY14+WR0CT9/mDHvxwsG/PZaC7yptJiKmZUfvxuZZ7QBHHulvc613EyPm/o67VoJGHUkjA87SR+BKg9lZ7ZTYqw== 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=TvE7T99xwGqCQHNi+1DmY7Ahnoxuw/9dFjiaKOF0TF8=; b=D+XfpGs9fendPKfIgqnwroGmPIgKemV+KXDEkaiGztWXKVE56GHj1Biev7thhwPB+yjJAT96I9SLLONeikFQY1TfV83osEJ30Vv8/L/hYnZVZzaISxwXmLMDYmO6CqINiRHUf+RpK+vv3M/n+ToTSanKiJV1vXt+hip/wTtbxVc= Received: from AS9PR01CA0015.eurprd01.prod.exchangelabs.com (2603:10a6:20b:540::28) by PA4PR08MB6016.eurprd08.prod.outlook.com (2603:10a6:102:e3::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5395.15; Wed, 6 Jul 2022 09:57:24 +0000 Received: from AM5EUR03FT014.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:540:cafe::d) by AS9PR01CA0015.outlook.office365.com (2603:10a6:20b:540::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.15 via Frontend Transport; Wed, 6 Jul 2022 09:57:24 +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 AM5EUR03FT014.mail.protection.outlook.com (10.152.16.130) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.15 via Frontend Transport; Wed, 6 Jul 2022 09:57:22 +0000 Received: ("Tessian outbound 0ba541f03a2a:v122"); Wed, 06 Jul 2022 09:57:22 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 2e25fe6887fafe1b X-CR-MTA-TID: 64aa7808 Received: from 5b1adcae615b.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 29DC6856-257D-4B0C-90B4-56934E6063B9.1; Wed, 06 Jul 2022 09:57:15 +0000 Received: from EUR01-VE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 5b1adcae615b.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 06 Jul 2022 09:57:15 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Zhg4WFMqPVl9088VpGA6rDyJbloNqKy7xnDVzn+GOV47yWhsE+upCetskAtjjVUlmntKetIpzlm/ZGXSn9rcIuT54bnHUvavOB8I3eF99An5aOdlIU3WNsGw2Uya1KByEu5c+zz6xIMvuWrzx8CgNWX/BFCLkprbpvHJIeUN+NCdX1u2pKPygskxxJzEqUUzzPWgSIbS8b2UQ2R8QgF7L578BEEx5rrTTT4SjSxqhB33Xqbwba/5cTR0t++JNm0/nXNIZTturLsrv+f4/MZBu/+T9HwAOFKzYJp6h8Pezk9scuqoVgxVRy+rOVmVVSUdZkpNvhf3LliGZYfFjyRc6Q== 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=TvE7T99xwGqCQHNi+1DmY7Ahnoxuw/9dFjiaKOF0TF8=; b=Id0K799ndTHxgtDU0i5H+5CEwkn3PYuWCfZSUgI9SKuoPj4p+HJWf4BB300kaDAYBIRXVqg8DtGC3mBQ5dKiqbvRdnlyzFdfpxhfSSZfjJHDM5HqHyaD7I+wVolXhVJBk05hr4zZqCkgtR4semtuJK/zyHRbuW7g3uYEfkA8fbKLkWPX2Z+jeLYW4Npxz3QjEGCzQhgJlv6qu3rKMRDMj/v92JR8HvmhOwx/TzKZzBwtt8q6aaTFtfxUYEkhPRqYeZBK+BXD2/ancSs8fUPS9ADf8eVPZV+5YkYrmzFLEDqvYJR2bpbiKA1b4hP63ANEJdWIxpg6lbBumhObaRJeug== 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=TvE7T99xwGqCQHNi+1DmY7Ahnoxuw/9dFjiaKOF0TF8=; b=D+XfpGs9fendPKfIgqnwroGmPIgKemV+KXDEkaiGztWXKVE56GHj1Biev7thhwPB+yjJAT96I9SLLONeikFQY1TfV83osEJ30Vv8/L/hYnZVZzaISxwXmLMDYmO6CqINiRHUf+RpK+vv3M/n+ToTSanKiJV1vXt+hip/wTtbxVc= Received: from AM7PR04CA0004.eurprd04.prod.outlook.com (2603:10a6:20b:110::14) by AM0PR08MB5265.eurprd08.prod.outlook.com (2603:10a6:208:160::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.15; Wed, 6 Jul 2022 09:57:12 +0000 Received: from VE1EUR03FT039.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:110:cafe::79) by AM7PR04CA0004.outlook.office365.com (2603:10a6:20b:110::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5395.21 via Frontend Transport; Wed, 6 Jul 2022 09:57:12 +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 VE1EUR03FT039.mail.protection.outlook.com (10.152.19.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5395.14 via Frontend Transport; Wed, 6 Jul 2022 09:57:11 +0000 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.2507.9; Wed, 6 Jul 2022 09:56:34 +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; Wed, 6 Jul 2022 09:56:34 +0000 From: "Sami Mujawar" To: CC: Sami Mujawar , , , , , , , , , , Subject: [PATCH 3/8] ShellPkg: Acpiview: IORT parser update for IORT Rev E.d spec Date: Wed, 6 Jul 2022 10:56:26 +0100 Message-ID: <20220706095631.27196-4-sami.mujawar@arm.com> X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: <20220706095631.27196-1-sami.mujawar@arm.com> References: <20220706095631.27196-1-sami.mujawar@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-Correlation-Id: d71a9a85-a260-4482-5158-08da5f35ec26 X-MS-TrafficTypeDiagnostic: AM0PR08MB5265:EE_|AM5EUR03FT014:EE_|PA4PR08MB6016: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: BekM2kAVnHG90W840t2o8uxBJIziT8HaCbzHQYlcd3x2LhvL8kOkzQioswo5BjHHnbr71HWYVbOAHHuH6Ay8/OPrCV0oCDyGA+/Vw/Sh7Xmbf8rcdz9ylVm79fQDJtwe9PWv7OPz/r4xMgWElUG85KstZzu9xXMP8rn76A3GXEgZmpTTi2nAN8YDOj6jdYD0zFNiwCPeSDGe3UJPHwRvP2FDIzYVZVQv01tN5UMX9ZJUkqOI4fIEPHD0geKuTGYSmmgNpARK02p2V/wgxaW/RKGWP7xF8A6WklTmtabQq5x3oYGus649Ah49GrQr+/LrqoKFFT0F/aBVsDmVSCViFIDnBdYCrUqI5Wyhc1RgOx9bAUcUzxPh2JbrGxfRkub1ryYJKD81qafLx2TLVjBXpA3YM9TMuGa8irnL8cOj56/x5Kfsba4z6gUfADF6Zb30+OsDc/iD91RpWt1D6VCKPSniukw+nzvAAXmKmrrBM05q1tMRtI1xGQeapMHfESvulmdxEr6lpAGTuLiK6lq/a8hk20yoe4nFCzLoYV2EMrtq0LFpw5pK0HgxMhU/byfIhFPLfR3e2dxuNKiBVc7WUofz8s9e3qj/tEstFPUQAlSkx+uy4o5RDk5QuhrsWMoBapzBu3P2tk6wjX3opSHngokhgBh3Ic897JxT4V3rqrHQ6wmkZw/9FGc/nfSuFdUsCypHqU4N3l/YfgWXMf6k/HPabSrKbbjNad2KVQ7p2k64rU2xJ9VWhRZcRpG8g2Uz/lDI4Hty2B+VFdNmIj7Vn2EJ8GwhhrHfflDNkrozKeSeyJNiPXfqakVXt0kIRcGwyX1sq8eqo4pnkfbUILXYibbF/sBzULF1pv2kYLWnCjWn2jZJsFyJZuKF8nIZbfCxHLvl4WO41FiJiktgIcHAQJEMIMfyCfqhfS5Dqvhsz6E= 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)(346002)(376002)(39860400002)(396003)(136003)(46966006)(36840700001)(40470700004)(2616005)(47076005)(1076003)(426003)(336012)(70206006)(8936002)(4326008)(8676002)(70586007)(5660300002)(36756003)(6916009)(41300700001)(6666004)(7696005)(86362001)(40480700001)(82310400005)(2906002)(966005)(186003)(26005)(478600001)(15650500001)(82740400003)(83380400001)(81166007)(356005)(316002)(40460700003)(30864003)(54906003)(44832011)(36860700001)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB5265 Return-Path: Sami.Mujawar@arm.com X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT014.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 3ee78898-dfb6-4d23-8681-08da5f35e5b1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SsEitg24Aw75u30NX597UCwlKG6ahLlmpHYpwjEJzanyQlzeOFevXglVUw8DVfUgYq1WuV5vErDwQf7AJz4gmwNUv3Mgq+zoNzZtRKIEuAvgQadq8v7nlrdLVcvp1fMTdP+mRIzSOatOHvD75osN420nxZvK3OoMjyp2Ph2YUHnNV3nAE0IGy3g50T1nTUPyes1ZpaJR8c6+Dz3DZydiIdp6AQeOsx1y86aAnKKKV4qNgtpFuHvkj5Yz8j7rcv3BYUou92SU3RDotx+bLZ+uGi1J6Ygm8Geky/j/vig3t0Th9XJ16k+yyMJFCtKxikVFo9Zl2Y3b2/jbnYqhqh+ZBi80fsQ0LAZJ0lBrsBot0lQC9IrbyeWtaFBv5l13J1U+uXTjan1+u643uAewAtugOwX4/K5ym1cr5B5DxnFLqnJ0V/LMhRfHMIO/VFe4t062zp8hUTJWJdQjLS3COUvSgr5h11RMeg51B9V2fLlLcCDsPeBKoZmRQaKEOgHPbj9vdnh1KYc732q+Cvge3UX2OvRGVwyzl2F75qVc0Oh1VndlrKFlyD/4X2m2ld0yEWcvgSa7WKMXh69lYUS9oh9ptq7pMCTMRPSYm/VwCp7sWXCWsDsTHGtseo9Xwqbh+otjwQ3hjGPEKptDQwtwEeOgpt33Ld2S4iviafUN7tZ3P25tRCideg57GR6BtrTi7mN5BXWrlWyGNo0gWnl+lU7fELbifHz4LR8CMNRa5eOwmw6UeRw5+CIlVBBNT8Re4bcfGxtDsfVhgHAQhdbtZIi7ssOq6Z6mgi1NozDel7Nqpa/4xcdOPxvPglO0wWB2I3rSGbZhXovyZ8QRFyLe6Xq0ZKfFCn+S1X0V0JtNWxxki1UK9fXa3vMd2eB38wxOPnqrfWzrAn/umdB9hkB3ao0ugw== 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)(39860400002)(346002)(376002)(396003)(136003)(40470700004)(36840700001)(46966006)(7696005)(15650500001)(82740400003)(47076005)(40480700001)(30864003)(44832011)(40460700003)(426003)(8936002)(6666004)(36860700001)(81166007)(478600001)(336012)(5660300002)(2906002)(83380400001)(1076003)(186003)(86362001)(36756003)(6916009)(2616005)(41300700001)(54906003)(316002)(26005)(82310400005)(8676002)(70206006)(70586007)(4326008)(966005);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jul 2022 09:57:22.5404 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d71a9a85-a260-4482-5158-08da5f35ec26 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: AM5EUR03FT014.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB6016 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. Signed-off-by: Sami Mujawar --- Notes: 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 | 221 ++++++++++++++++++-- 1 file changed, 203 insertions(+), 18 deletions(-) diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c index 44d633c5282463078a4cc990bb24ca1992f95634..0b42ff3b354a7cf54cdc2e6e15d0617fadda17f2 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"%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 == 2) { + 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,13 @@ ParseAcpiIort ( return; } + if (AcpiTableRevision == 4) { + IncrementErrorCount (); + Print ( + L"ERROR: IORT tabe Revision E.c is deprecated and must not be used.\n" + ); + } + ParseAcpi ( TRUE, 0, @@ -765,7 +943,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)'