From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (EUR04-DB3-obe.outbound.protection.outlook.com [40.107.6.55]) by mx.groups.io with SMTP id smtpd.web09.10076.1657817474618633439 for ; Thu, 14 Jul 2022 09:51:15 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=hmBqFQ8x; spf=pass (domain: arm.com, ip: 40.107.6.55, mailfrom: sami.mujawar@arm.com) ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=Kt4IRQA3V2mJQ5dOt8z8JNUFxJUso+apsOD/Eo68vc4GEeAcYtJQwKNhTNFU1LnFc9T8I9w9Rn0U0Ou3XIENja4YpiYgwhv8oco6gCBtwZMaMrpXk2VYa22Uhr20F93gbSDr/BmXKCAVtCu6t/zqDrKEUIA+mEsD17KMEE/3hqfIOcsw3SgNxO19pGlR5A1cXv+3BDi9nNZisvEBqB3pKVllwdG3Ed2vGc8KtokiFMyH3hz4KCT+IdiU3Yx5HY1v0tFR5ZGEVtnZOJYhzLPSGQ6kqNChkTSf/iIkhtcxhWtcMVPhIDcRjy230meCM2Smx8FpkXgKCrnZmhg9EeeO6g== 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=gU5JL2XOPtur4rERWAhMKPiKU3AOwmlQK2H9ftHbPYY=; b=U0RX1dkTYib+JtI+SUM5tf8o7sMQSEi0UbV9OSRuiry54WuO8MZoUSgBDsslFWq6BE74BRVVF9hlekiz48912wOUtDLRdxyFDZrd8tyb5xX8ePQsGjK6+RS6oQYbI1uhU8vXDXHf50Bedd72/qSwsXu+LPFNFVAy2U10SEqGG4HfU3O/SA5aP7vmfEe4cEV21Y08tzWzmbzf72uLuShRjtgmTkGz8AVgRXr7kd09iCTqe/ItGMcyfvB7XRsZpRvUiH1kfUMRxnDyhh8yXWWaB4Jlwg7BVbo/ldbXdNxOJ36Vis8KQIuXhVJHY6hlfSaTSK1gSle/p6Ro+YxNc9OJeQ== 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=gU5JL2XOPtur4rERWAhMKPiKU3AOwmlQK2H9ftHbPYY=; b=hmBqFQ8xjr5hk8spP7oJZC9FSlSojazXPL29EaKIHvxWUBw1dTxA3n7RF+lqtQOyHhjhyYD/1ExS35iCkZabD+CzN870w483HOR8qkddNHBpUte0A6VsnRRO5BUmMUP9aKHzHOUSKvi5TaBT/qtpEuf0A3EV0z0+U3vtsG4R+Sk= Received: from AM6P194CA0046.EURP194.PROD.OUTLOOK.COM (2603:10a6:209:84::23) by VI1PR08MB3775.eurprd08.prod.outlook.com (2603:10a6:803:bc::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.14; Thu, 14 Jul 2022 16:51:10 +0000 Received: from VE1EUR03FT010.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:84:cafe::e8) by AM6P194CA0046.outlook.office365.com (2603:10a6:209:84::23) 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:09 +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 VE1EUR03FT010.mail.protection.outlook.com (10.152.18.113) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.12 via Frontend Transport; Thu, 14 Jul 2022 16:51:09 +0000 Received: ("Tessian outbound 8e3d5168572a:v122"); Thu, 14 Jul 2022 16:51:09 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: edb10a8a96e3e762 X-CR-MTA-TID: 64aa7808 Received: from c512828814bc.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 0B833390-DF7B-4307-B733-4FAD7F1D5EAD.1; Thu, 14 Jul 2022 16:51:03 +0000 Received: from EUR02-VE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id c512828814bc.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 14 Jul 2022 16:51:03 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FAaClkPiOuzBbBcbpVkez3GhUl1i8oD8w090m2YBeIaiL1gxgpKxVNAs2ewWUT2JrSYTHCDzn6tDapOPmWwbE+SP2EeFln8LJFNTCWpyBJJQR+z8Cf1GW7MHVaEkQJ7OgkQkjZBjAsS0nVVaJb8r2nG4P2fVgs8KLqPHYMwZ/SrcT/9cR02mJss4efSFzY1zyf0p7E5NLYl1xY+P02l3gQx0+v2DJ2wMiP10gVp0szRAiirh+J7PCKsQC9NmkAV8hEPXC1uJevEsHJPVoHs2dbtuPpv3lijQZ49pOWz+/BOLkzefN1kWzLLEMiooucFVSce3gY/L+zQDL+1RrYud9Q== 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=gU5JL2XOPtur4rERWAhMKPiKU3AOwmlQK2H9ftHbPYY=; b=dgJMX2f4QWROvvEzBK1iCD/VPN7CEtJIzAnzo8wfon0iFCfmsC/Dyl296BGoQ9ZzmCPEWQTqlDHyhnKjDIMjdN8WBo1stsZ1o+kyk8K1FQ2yIOZ8cr8Zvz7DVld+NvOGd9/dwfdFer6LrGOv89cnSkLlPWfRGmM5daP6FsOa30i9DiaJg4uxKTokQGXvdnEKdNT5fCu68HPB/PUwAuK4uMHt0ImBmqNjHjZ0F7zjYtKxCDJsbC5QPCGBxLpL8KafdYweVCxFoSL0fv8Epg6VyLnFu74omYf0xJ1CSruW7kYer0XSM6smHqHvo3UH/p5Ns4Ndh81q4oHrF8FhxkwMvg== 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=gU5JL2XOPtur4rERWAhMKPiKU3AOwmlQK2H9ftHbPYY=; b=hmBqFQ8xjr5hk8spP7oJZC9FSlSojazXPL29EaKIHvxWUBw1dTxA3n7RF+lqtQOyHhjhyYD/1ExS35iCkZabD+CzN870w483HOR8qkddNHBpUte0A6VsnRRO5BUmMUP9aKHzHOUSKvi5TaBT/qtpEuf0A3EV0z0+U3vtsG4R+Sk= Received: from AS9PR04CA0082.eurprd04.prod.outlook.com (2603:10a6:20b:48b::6) by DB9PR08MB7163.eurprd08.prod.outlook.com (2603:10a6:10:2cc::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.14; Thu, 14 Jul 2022 16:51:01 +0000 Received: from AM5EUR03FT059.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:48b:cafe::91) by AS9PR04CA0082.outlook.office365.com (2603:10a6:20b:48b::6) 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:01 +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:01 +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; Thu, 14 Jul 2022 16:50:40 +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:40 +0000 From: "Sami Mujawar" To: CC: Sami Mujawar , , , , , , Subject: [PATCH v6 4/8] DynamicTablesPkg: IORT set reference to interrupt array if present Date: Thu, 14 Jul 2022 17:50:27 +0100 Message-ID: <20220714165031.42640-5-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: fd42b15c-b816-4932-6e18-08da65b90d91 X-MS-TrafficTypeDiagnostic: DB9PR08MB7163:EE_|VE1EUR03FT010:EE_|VI1PR08MB3775: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: qPTnR9aI2wmv7rwOL6SLUeAJIF9JGlmBj85ShIFokUwXT3T/7epWkj+iOKUH7m7reqXI7243qRSS/9KUCoIzDjEsG2Hk6etWtuD94+cnUsURM8HfVnPwUSJSUL+4ViuJX/9wop+x3G9uFGVutceaoQjCv6sIc5XXxvuheaeGXykKjKUkLE3LurZCRBnAEKkqNt70/qx34AuPpc1nSM0hyqUJCLBpesBP5JUvcHXXUnf4mM0Puam4nv8LRnlb/UN+4doVNwVYtlxHudjfKpIJwMCrfnFVsTDQcfioBoSVu/WYVp9OyUUYK5pnNs6R4++itXwrzFyHAdT6SKGanxstUdoNp+0y8OFLHQ8FSTRwBpmVdiMuxZcOT7GA+vgWo9EDyVCzIVb/rHX0g3mHB0lpwy5/IAfZSrnjyLXpxyGNw6cboCP+6yfld2ZE8ySVDLSRrzRsQdBlrkBQ0Pn5HuoID6Qh1d9TOI88Xy4wlOjgTTLOjL2cPxOptwGpHZq+XAUcaIH8wCOJHG9Ga3Zsh/eOACjZtH16dXqhcq8jd6Qz9FmZ6SHRMi6ARS2aJvKsKn8VNuz3YZB8I/UrV5ZcNvmbITqt0kyHIQkV3aUHY9+fmTG+jiQCumfyUrrU8LIKLVbKsWovuTxABYWglJ1YMUm+VhjkxJ/p/dOs92iQJ2NwSc2pLR3MXfmTlD3DWlBfw2XWhKATG8CbsEXfVEWU6XUgt0uTvxJ7f17ji3QbJnCHp2vrDPhZsdI4sImEgGr5rPra0Owcew5LflB6WFQJzms8G1dxX4216t0l57zKgZDwxNrFMJXObVEpIk/xay8kKCcCzwtngYdUfMu9UN88p3H2/HWx//QcCoth4VLinXVkPBBOKJDtv1BsDkYOvPAP/fvU 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)(39860400002)(346002)(376002)(396003)(136003)(46966006)(40470700004)(36840700001)(81166007)(70206006)(70586007)(1076003)(186003)(8936002)(5660300002)(86362001)(6666004)(8676002)(41300700001)(2616005)(4326008)(316002)(26005)(356005)(7696005)(6916009)(54906003)(966005)(44832011)(478600001)(47076005)(2906002)(36860700001)(336012)(426003)(40460700003)(36756003)(83380400001)(82310400005)(40480700001)(82740400003)(36900700001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB7163 Return-Path: Sami.Mujawar@arm.com X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT010.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: dde0a852-dcce-4f1b-848c-08da65b908a5 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lazRqw3vQYFYWRzl+A+bu5ZswxZgg9Rx6YI11p78uFOw/HR9Qvl0OZ7TfPNb6KJPxkd6pu2OpS0a2LgpE8xHk0bLSx04grPOJ4ih9IkYNT8ei8WYt60akkwp/Yzn875879iufOoHkj7yG07z00dSqcQS0yoxfs9zRmzkFE4arFlblp/B2vBvV3hS24wvJVyXCrU/BoE7qVmgSZpzCxqZ9aBODCMy2vfdP4FYVWFjd0mOXZmptv8GzCwrDUYIWizUAuNzj+OmkbOv4qlzU//AToFCA8xNv/lzCXKAtWULybespEaJxji02pejuj4mL82HnavSXtyiH6FoPMgQ/uhhTK3MO7tZeULo3KTyn0JEu7r+LdyiJVBJ180jKFTEnPga11+BCOW6l2uPqz8wY/LT5nG75xcuaWu3iVqKmWAUbsI2b0cp29P+oLpA+KgGsvlp5VZzEeMGabMNdZjhzNXhDxjOOAOFws1wjdAPM8iuAkQTNUZv+UElZeowQMZJDFhAqhhkf1AlsHnPW2TSlGVNEKQ1nPefKbqnoBhUZlv6gHx0JXWhovNcF2ATBxf0wNCVmqeDcOw1GCfgDkiLZ5SO2FinRxQJ5/vu+m7PY75Q78E9XfPfqcx52SvX/q77Ds/4J5sjy9oEjFGY2Ac8DWFQcb4/2TP+AY5XOieD4AxIDPbkdtDv96kb2y+sLtHY8EDz3vDydV/4itGXfyhQoqa+DRnE953eQmoo2XoXz7EEIw47GttIC+wjNsyarSe0PzghvPupdRta78tuNBTFSQLNtOCmzhkQZ46ORtclVBFfhLudbvp4Jp8/E/bbyw9/9AqyB7WOQgzNPKMP4rL8sohStp79VQgU9NG3bdl4N2j7fGE= 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)(396003)(136003)(376002)(36840700001)(40470700004)(46966006)(40460700003)(26005)(82740400003)(86362001)(1076003)(966005)(2616005)(40480700001)(82310400005)(426003)(2906002)(47076005)(6666004)(336012)(41300700001)(478600001)(7696005)(83380400001)(44832011)(8936002)(186003)(81166007)(54906003)(6916009)(316002)(36860700001)(70586007)(70206006)(5660300002)(8676002)(4326008)(36756003);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jul 2022 16:51:09.6242 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fd42b15c-b816-4932-6e18-08da65b90d91 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: VE1EUR03FT010.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB3775 Content-Type: text/plain The IORT generator is populating the reference field for Context and PMU interrupts even if their count is zero. Update the IORT generator to set the references only if the interrupt count is not 0. Also add checks to ensure a valid reference token has been provided. Signed-off-by: Sami Mujawar Reviewed-by: Pierre Gondois --- Notes: v6: - No code change since v4. Re-sending with v6 series. [SAMI] v5: - No code change since v4. Re-sending with v5 series. [SAMI] v4: - Minor reordering of code to group initialisation and [SAMI] checks for the number of Context and PMU interrupts. v3: - Move error handling for IdMappingToken. [PIERRE] - Moved error handling for IdMappingToken in a separate [SAMI] patch in v3 series. Ref: https://edk2.groups.io/g/devel/topic/83600728#76662 v2: - No code change since v1. Re-sending with v2 series. [SAMI] DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c | 87 +++++++++++++------- 1 file changed, 57 insertions(+), 30 deletions(-) diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c index a4dd3d4a895e0a1ae305c937d9a413665fb8e171..abef9e5a7f90a38e1d697227d3cd2c110db364a4 100644 --- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c +++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c @@ -1164,6 +1164,7 @@ AddSmmuV1V2Nodes ( EFI_ACPI_6_0_IO_REMAPPING_SMMU_INT *ContextInterruptArray; EFI_ACPI_6_0_IO_REMAPPING_SMMU_INT *PmuInterruptArray; UINT64 NodeLength; + UINT32 Offset; ASSERT (Iort != NULL); @@ -1206,48 +1207,74 @@ AddSmmuV1V2Nodes ( SmmuNode->GlobalInterruptArrayRef = OFFSET_OF (EFI_ACPI_6_0_IO_REMAPPING_SMMU_NODE, SMMU_NSgIrpt); + Offset = sizeof (EFI_ACPI_6_0_IO_REMAPPING_SMMU_NODE); // Context Interrupt - SmmuNode->NumContextInterrupts = NodeList->ContextInterruptCount; - SmmuNode->ContextInterruptArrayRef = - sizeof (EFI_ACPI_6_0_IO_REMAPPING_SMMU_NODE); - ContextInterruptArray = - (EFI_ACPI_6_0_IO_REMAPPING_SMMU_INT *)((UINT8 *)SmmuNode + - sizeof (EFI_ACPI_6_0_IO_REMAPPING_SMMU_NODE)); + SmmuNode->NumContextInterrupts = NodeList->ContextInterruptCount; + if (NodeList->ContextInterruptCount != 0) { + SmmuNode->ContextInterruptArrayRef = Offset; + ContextInterruptArray = + (EFI_ACPI_6_0_IO_REMAPPING_SMMU_INT *)((UINT8 *)SmmuNode + Offset); + Offset += (NodeList->ContextInterruptCount * + sizeof (EFI_ACPI_6_0_IO_REMAPPING_SMMU_INT)); + } // PMU Interrupt - SmmuNode->NumPmuInterrupts = NodeList->PmuInterruptCount; - SmmuNode->PmuInterruptArrayRef = SmmuNode->ContextInterruptArrayRef + - (NodeList->ContextInterruptCount * - sizeof (EFI_ACPI_6_0_IO_REMAPPING_SMMU_INT)); - PmuInterruptArray = - (EFI_ACPI_6_0_IO_REMAPPING_SMMU_INT *)((UINT8 *)SmmuNode + - SmmuNode->PmuInterruptArrayRef); + SmmuNode->NumPmuInterrupts = NodeList->PmuInterruptCount; + if (NodeList->PmuInterruptCount != 0) { + SmmuNode->PmuInterruptArrayRef = Offset; + PmuInterruptArray = + (EFI_ACPI_6_0_IO_REMAPPING_SMMU_INT *)((UINT8 *)SmmuNode + Offset); + } SmmuNode->SMMU_NSgIrpt = NodeList->SMMU_NSgIrpt; SmmuNode->SMMU_NSgIrptFlags = NodeList->SMMU_NSgIrptFlags; SmmuNode->SMMU_NSgCfgIrpt = NodeList->SMMU_NSgCfgIrpt; SmmuNode->SMMU_NSgCfgIrptFlags = NodeList->SMMU_NSgCfgIrptFlags; - // Add Context Interrupt Array - Status = AddSmmuInterruptArray ( - CfgMgrProtocol, - ContextInterruptArray, - SmmuNode->NumContextInterrupts, - NodeList->ContextInterruptToken - ); - if (EFI_ERROR (Status)) { - DEBUG (( - DEBUG_ERROR, - "ERROR: IORT: Failed to Context Interrupt Array. Status = %r\n", - Status - )); - return Status; + if (NodeList->ContextInterruptCount != 0) { + if (NodeList->ContextInterruptToken == CM_NULL_TOKEN) { + Status = EFI_INVALID_PARAMETER; + DEBUG (( + DEBUG_ERROR, + "ERROR: IORT: Invalid Context Interrupt token," + " Token = 0x%x, Status =%r\n", + NodeList->ContextInterruptToken, + Status + )); + return Status; + } + + // Add Context Interrupt Array + Status = AddSmmuInterruptArray ( + CfgMgrProtocol, + ContextInterruptArray, + SmmuNode->NumContextInterrupts, + NodeList->ContextInterruptToken + ); + if (EFI_ERROR (Status)) { + DEBUG (( + DEBUG_ERROR, + "ERROR: IORT: Failed to Context Interrupt Array. Status = %r\n", + Status + )); + return Status; + } } // Add PMU Interrupt Array - if ((SmmuNode->NumPmuInterrupts > 0) && - (NodeList->PmuInterruptToken != CM_NULL_TOKEN)) - { + if (SmmuNode->NumPmuInterrupts != 0) { + if (NodeList->PmuInterruptToken == CM_NULL_TOKEN) { + Status = EFI_INVALID_PARAMETER; + DEBUG (( + DEBUG_ERROR, + "ERROR: IORT: Invalid PMU Interrupt token," + " Token = 0x%x, Status =%r\n", + NodeList->PmuInterruptToken, + Status + )); + return Status; + } + Status = AddSmmuInterruptArray ( CfgMgrProtocol, PmuInterruptArray, -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'