From nobody Fri May 17 05:54:41 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+113141+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+113141+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1704355389; cv=none; d=zohomail.com; s=zohoarc; b=FuoEmy41sw6kjYOElyHbZozs9nIbekJzB7hHF4JcP3pm61lyhbZLXoOLGdweFKHzNMR3qAgr2gE2KFF4G/dSEeTyHEbhlpHHdLfJ0K/WexTMqMZy7CHWHxnUncvJfcpjfgICFau7+xh3ihAlgnIwgcg9HwAobGsJwF9cmK8J0Vs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1704355389; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=RaohQzv36LF5pklfkWi6RHFBJNgsqjlTHzTUDe/9RhM=; b=emdofBEEncfxUjI38H9ec9EbieM7eiF8Z3TCor1nJn1Pk82IYSdM4yDQwbCmt+U+ZR/8TwcPLRuTgOuVjv37rJt02Zlf/ya86NwFo7mpmepF2lZ2XEhGT4SX8CPz+RhWQQ9UH5+jiM3IC5hwDBH5CC9tMsvmkG5gyN2WOAcq7gw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+113141+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 170435538932141.907514113972866; Thu, 4 Jan 2024 00:03:09 -0800 (PST) Return-Path: DKIM-Signature: a=rsa-sha256; bh=uDaNPxZmhIV66XDETnfD6umXZnYY3wXRU8D3hv7GtzA=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20140610; t=1704355389; v=1; b=R74fteBVfUl0iIXfq/KbobQXMA1q9N7swCuF4oSExsZJ8haTSNgbwmP91QxHkWxNQ6r3X5zV eijvA5oaZ8zLbZ6t1hXl6icD+xIJLvIV15U7V2QJ0Gg+3f1rtnQj/Cdl4Hzubxz4oal4EG1pqg3 0xlmkpbCLg2+A5WjflBuvnDU= X-Received: by 127.0.0.2 with SMTP id flAdYY1788612xb8lWLKqlnk; Thu, 04 Jan 2024 00:03:09 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.49724.1704355388372376228 for ; Thu, 04 Jan 2024 00:03:08 -0800 X-Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C62751007; Thu, 4 Jan 2024 00:03:53 -0800 (PST) X-Received: from usa.arm.com (a076756.arm.com [10.162.16.85]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 206263F7A6; Thu, 4 Jan 2024 00:03:05 -0800 (PST) From: "Himanshu Sharma" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Leif Lindholm , Sami Mujawar , Pierre Gondois , Himanshu Sharma Subject: [edk2-devel] [edk2][PATCH V2 1/2] ArmPkg/ArmGicArchLib: Add macros for SPI and extended SPI ranges Date: Thu, 4 Jan 2024 13:32:56 +0530 Message-Id: <20240104080257.319631-2-Himanshu.Sharma@arm.com> In-Reply-To: <20240104080257.319631-1-Himanshu.Sharma@arm.com> References: <20240104080257.319631-1-Himanshu.Sharma@arm.com> MIME-Version: 1.0 Precedence: Bulk List-Subscribe: List-Help: 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,Himanshu.Sharma@arm.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: n3EMkVa3WkFX80MOpjJCf9A3x1787277AA= Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1704355391455100007 Content-Type: text/plain; charset="utf-8" Taking reference from Table 2-1 of the Arm Generic Interrupt Controller Architecture Specification, Issue H, January 2022, add macros for the SPI and extended SPI ranges with the purpose of reusability on including the ArmPkg. Signed-off-by: Himanshu Sharma Reviewed-by: Sami Mujawar --- ArmPkg/Include/Library/ArmGicArchLib.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/ArmPkg/Include/Library/ArmGicArchLib.h b/ArmPkg/Include/Librar= y/ArmGicArchLib.h index 72ac17e13b5a..ed6fe6fecb09 100644 --- a/ArmPkg/Include/Library/ArmGicArchLib.h +++ b/ArmPkg/Include/Library/ArmGicArchLib.h @@ -1,9 +1,15 @@ /** @file * * Copyright (c) 2015, Linaro Ltd. All rights reserved. +* Copyright (c) 2024, Arm Limited. All rights reserved. * * SPDX-License-Identifier: BSD-2-Clause-Patent * +* @par Reference(s): +* - Arm Generic Interrupt Controller Architecture Specification, +* Issue H, January 2022. +* (https://developer.arm.com/documentation/ihi0069/) +* **/ =20 #ifndef ARM_GIC_ARCH_LIB_H_ @@ -23,4 +29,12 @@ ArmGicGetSupportedArchRevision ( VOID ); =20 +// +// GIC SPI and extended SPI ranges +// +#define ARM_GIC_ARCH_SPI_MIN 32 +#define ARM_GIC_ARCH_SPI_MAX 1019 +#define ARM_GIC_ARCH_EXT_SPI_MIN 4096 +#define ARM_GIC_ARCH_EXT_SPI_MAX 5119 + #endif // ARM_GIC_ARCH_LIB_H_ --=20 2.25.1 -=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 (#113141): https://edk2.groups.io/g/devel/message/113141 Mute This Topic: https://groups.io/mt/103518972/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 Fri May 17 05:54:41 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+113142+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+113142+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1704355392; cv=none; d=zohomail.com; s=zohoarc; b=mMUPg5j5zZ5ZLMIWYfuNT6ZVo7XZIslg4WXWqm8yGGK74xWKehuRAKHx5mhdA+7qSH5HcC9oNoReKtI/+0l4BKWr8r6k5f34z5TfhhLIcijsUlFIM1oRGiR3DEQ9nI22JjCCpaHC20Q0T4fwij43TN0Qo9W4sZwcraJEpqKMlZ0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1704355392; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=m6l7IsQSfIAjrt1+GTbwcYEGEX23QC9BtyIU8ZTmc84=; b=YGggOpT0KVeJ4B8bk5mglU7z2El77u5W8X4OxUzOc4ndyf37ZDgT2vH/hru4hB/B0j4Zu6wM03sjVI/KLQB1tXkZbKuZWFB+e/zjj4X4dpAmNFqwrSVNMeYy3J7Mfm+puvP37WyDeFBkTkmnq0mVgsJDyDfR5wFJ4uR7I4gAa+c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+113142+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1704355392026862.9713649488918; Thu, 4 Jan 2024 00:03:12 -0800 (PST) Return-Path: DKIM-Signature: a=rsa-sha256; bh=POeVjzd+e4lCBiScUVdoR1EHaDQASOoyn+61x2yIA0U=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20140610; t=1704355391; v=1; b=o9ZC42dEn/yaDZeMRL8dyXVoxASeQPYxAMGm4q3s2ZGYmqBw1NeOKGZkEEcChHaHPi5vOLCp v3MUQmVVom+O1xbK2f9QNw2PzB6EpSY2dMGu+ZGirRFr6Y2yGUf67elISYUJDzDXDHQ27d6aYU1 UDrq74LzxSmG3be5pgRjSXx0= X-Received: by 127.0.0.2 with SMTP id EJL2YY1788612xsA28bb2B9W; Thu, 04 Jan 2024 00:03:11 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.49727.1704355390997786488 for ; Thu, 04 Jan 2024 00:03:11 -0800 X-Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3CDEEC15; Thu, 4 Jan 2024 00:03:56 -0800 (PST) X-Received: from usa.arm.com (a076756.arm.com [10.162.16.85]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 8B6B03F7A6; Thu, 4 Jan 2024 00:03:08 -0800 (PST) From: "Himanshu Sharma" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Leif Lindholm , Sami Mujawar , Pierre Gondois , Himanshu Sharma Subject: [edk2-devel] [edk2][PATCH V2 2/2] DynamicTablesPkg/SsdtSerialPortFixupLib: Add Interrupt node for SPIs only Date: Thu, 4 Jan 2024 13:32:57 +0530 Message-Id: <20240104080257.319631-3-Himanshu.Sharma@arm.com> In-Reply-To: <20240104080257.319631-1-Himanshu.Sharma@arm.com> References: <20240104080257.319631-1-Himanshu.Sharma@arm.com> MIME-Version: 1.0 Precedence: Bulk List-Subscribe: List-Help: 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,Himanshu.Sharma@arm.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: nlT67yfRI2AiceiXYfD4Tpudx1787277AA= Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1704355393540100001 Content-Type: text/plain; charset="utf-8" Add interrupt node to the AML description of the serial-port only if the IRQ ID from the Configuration Manager is a valid SPI (shared processor interrupt) or an extended SPI. So, for DBG2 UART ports where interrupt is not mandatory, adding of an interrupt node in the AML description using Serial Port Fixup Library can be ignored if the UART is not defined with a valid SPI, like in N1SDP. This update generates the interrupt node for the valid SPI range using the AML Codegen API instead of updating it using the AML Fixup API. Signed-off-by: Himanshu Sharma Reviewed-by: Sami Mujawar --- DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSerialPortFixup= Lib.inf | 3 +- DynamicTablesPkg/Include/ArmNameSpaceObjects.h = | 6 ++- DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSerialPortFixup= Lib.c | 49 ++++++++++++++------ DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSerialPortTempl= ate.asl | 29 +++++++----- 4 files changed, 58 insertions(+), 29 deletions(-) diff --git a/DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSer= ialPortFixupLib.inf b/DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLi= b/SsdtSerialPortFixupLib.inf index 965167bdc4e1..5e2615c961ad 100644 --- a/DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSerialPort= FixupLib.inf +++ b/DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSerialPort= FixupLib.inf @@ -1,7 +1,7 @@ ## @file # SSDT Serial Port fixup Library # -# Copyright (c) 2020 - 2021, Arm Limited. All rights reserved.
+# Copyright (c) 2020 - 2021, 2024, Arm Limited. All rights reserved.
# # SPDX-License-Identifier: BSD-2-Clause-Patent ## @@ -19,6 +19,7 @@ SsdtSerialPortTemplate.asl =20 [Packages] + ArmPkg/ArmPkg.dec MdePkg/MdePkg.dec MdeModulePkg/MdeModulePkg.dec EmbeddedPkg/EmbeddedPkg.dec diff --git a/DynamicTablesPkg/Include/ArmNameSpaceObjects.h b/DynamicTables= Pkg/Include/ArmNameSpaceObjects.h index 8c00bdac20bb..e9df0ec94808 100644 --- a/DynamicTablesPkg/Include/ArmNameSpaceObjects.h +++ b/DynamicTablesPkg/Include/ArmNameSpaceObjects.h @@ -1,6 +1,6 @@ /** @file =20 - Copyright (c) 2017 - 2023, Arm Limited. All rights reserved.
+ Copyright (c) 2017 - 2024, Arm Limited. All rights reserved.
=20 SPDX-License-Identifier: BSD-2-Clause-Patent =20 @@ -311,7 +311,9 @@ typedef struct CmArmSerialPortInfo { /// The physical base address for the serial port UINT64 BaseAddress; =20 - /// The serial port interrupt + /** The serial port interrupt + to be speciifed 0 if the serial port does not have an interrupt wire= d. + */ UINT32 Interrupt; =20 /// The serial port baud rate diff --git a/DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSer= ialPortFixupLib.c b/DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/= SsdtSerialPortFixupLib.c index a65c1fe7e30d..d0b1f61fdf85 100644 --- a/DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSerialPort= FixupLib.c +++ b/DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSerialPort= FixupLib.c @@ -1,7 +1,7 @@ /** @file SSDT Serial Port Fixup Library. =20 - Copyright (c) 2019 - 2021, Arm Limited. All rights reserved.
+ Copyright (c) 2019 - 2021, 2024, Arm Limited. All rights reserved.
=20 SPDX-License-Identifier: BSD-2-Clause-Patent =20 @@ -9,10 +9,14 @@ - Arm Server Base Boot Requirements (SBBR), s4.2.1.8 "SPCR". - Microsoft Debug Port Table 2 (DBG2) Specification - December 10, 2015. - ACPI for Arm Components 1.0 - 2020 + - Arm Generic Interrupt Controller Architecture Specification, + Issue H, January 2022. + (https://developer.arm.com/documentation/ihi0069/) **/ =20 #include #include +#include #include #include #include @@ -270,7 +274,6 @@ FixupCrs ( EFI_STATUS Status; AML_OBJECT_NODE_HANDLE NameOpCrsNode; AML_DATA_NODE_HANDLE QWordRdNode; - AML_DATA_NODE_HANDLE InterruptRdNode; =20 // Get the "_CRS" object defined by the "Name ()" statement. Status =3D AmlFindNode ( @@ -303,20 +306,38 @@ FixupCrs ( return Status; } =20 - // Get the Interrupt node. - // It is the second Resource Data element in the NameOpCrsNode's - // variable list of arguments. - Status =3D AmlNameOpGetNextRdNode (QWordRdNode, &InterruptRdNode); - if (EFI_ERROR (Status)) { - return Status; + // Generate an interrupt node as the second Resource Data element in the + // NameOpCrsNode, if the interrupt for the serial-port is a valid SPI fr= om + // Table 2-1 in Arm Generic Interrupt Controller Architecture Specificat= ion. + if (((SerialPortInfo->Interrupt >=3D ARM_GIC_ARCH_SPI_MIN) && + (SerialPortInfo->Interrupt <=3D ARM_GIC_ARCH_SPI_MAX)) || + ((SerialPortInfo->Interrupt >=3D ARM_GIC_ARCH_EXT_SPI_MIN) && + (SerialPortInfo->Interrupt <=3D ARM_GIC_ARCH_EXT_SPI_MAX))) + { + Status =3D AmlCodeGenRdInterrupt ( + TRUE, // Resource Consumer + FALSE, // Level Triggered + FALSE, // Active High + FALSE, // Exclusive + (UINT32 *)&SerialPortInfo->Interrupt, + 1, + NameOpCrsNode, + NULL + ); + ASSERT_EFI_ERROR (Status); + } else if (SerialPortInfo->Interrupt !=3D 0) { + // If an interrupt is not wired to the serial port, the + // Configuration Manager specifies the interrupt as 0. + // Any other value must be treated as an error. + DEBUG (( + DEBUG_ERROR, + "ERROR: SSDT-SERIAL-PORT-FIXUP: Invalid interrupt ID for Serial Port= \n" + )); + ASSERT (0); + Status =3D EFI_INVALID_PARAMETER; } =20 - if (InterruptRdNode =3D=3D NULL) { - return EFI_INVALID_PARAMETER; - } - - // Update the interrupt number. - return AmlUpdateRdInterrupt (InterruptRdNode, SerialPortInfo->Interrupt); + return Status; } =20 /** Fixup the Serial Port device name. diff --git a/DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSer= ialPortTemplate.asl b/DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLi= b/SsdtSerialPortTemplate.asl index fcae2160ac3d..22e6c04e020c 100644 --- a/DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSerialPort= Template.asl +++ b/DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSerialPort= Template.asl @@ -1,7 +1,7 @@ /** @file SSDT Serial Template =20 - Copyright (c) 2019 - 2020, Arm Limited. All rights reserved.
+ Copyright (c) 2019 - 2020, 2024, Arm Limited. All rights reserved.
=20 SPDX-License-Identifier: BSD-2-Clause-Patent =20 @@ -10,6 +10,7 @@ =20 @par Glossary: - {template} - Data fixed up using AML Fixup APIs. + - {codegen} - Data generated using AML Codegen APIs. **/ =20 DefinitionBlock ("SsdtSerialPortTemplate.aml", "SSDT", 2, "ARMLTD", "SERIA= L", 1) { @@ -43,17 +44,21 @@ DefinitionBlock ("SsdtSerialPortTemplate.aml", "SSDT", = 2, "ARMLTD", "SERIAL", 1) , // MemoryRangeType // TranslationType ) // QWordMemory - Interrupt ( - ResourceConsumer, // ResourceUsage - Level, // EdgeLevel - ActiveHigh, // ActiveLevel - Exclusive, // Shared - , // ResourceSourceIndex - , // ResourceSource - // DescriptorName - ) { - 0xA5 // {template} - } // Interrupt + + // The Interrupt information is generated using AmlCodegen. + // + // Interrupt ( // {codegen} + // ResourceConsumer, // ResourceUsage + // Level, // EdgeLevel + // ActiveHigh, // ActiveLevel + // Exclusive, // Shared + // , // ResourceSourceIndex + // , // ResourceSource + // // DescriptorName + // ) { + // // + // } // Interrupt + }) // Name } // Device } // Scope (_SB) --=20 2.25.1 -=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 (#113142): https://edk2.groups.io/g/devel/message/113142 Mute This Topic: https://groups.io/mt/103518973/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-