From nobody Mon May 20 22:42:18 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+112117+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+112117+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1701857518; cv=none; d=zohomail.com; s=zohoarc; b=UfNZ5zy3jWlRgmmPQHE45yxhwIJtu5l49172qJZauTuQT9NNzB+c8+Gva5LkRe8yzNS3BSaBYvm/IRkegXN8sk6Wba7n7uWE2/98Am3VAXL6+JJMfzv31QF60q88dlrrWcv26/zJoKwSyTEhXwLHWNZ2M+MZw8xKxmhl1QjEpIY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1701857518; 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=ZBpxgPC+USzMfSV4VwBR2j1QtkH6x9yawz61mtg7JmY=; b=lkJbbZZlgOuhqBOUKQoSHEjWrlsJSwEXuvK7NqEDmq5kHodgpPWgX9I1tdGENgGLK9yK/QcWS17Z++UfTsmOnAGex9A8hw3hNDIcVEeviCNNK5Far0DKFCrUIXCZSa4w+KdzUaI2vPkdALgPkrW/BEVsTRPMYmxN8S7KnSIqzQM= 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+112117+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 17018575188421012.7741752604038; Wed, 6 Dec 2023 02:11:58 -0800 (PST) Return-Path: DKIM-Signature: a=rsa-sha256; bh=/fD2tL98qG9G/4EEyWT0QF/lXsDzghnSv5+Nrlghz9M=; 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=1701857518; v=1; b=CkO5L7JinDUB8wlrFqo1xROucnMI1xvORvKf5CEt77UynBdjhFFw4pR8W1U46cnuu8tKltL4 NGl+bzGYYx1HPF/GVv93wLxwqyN/+CvMJs++sTLQCkOeING7S/jUinVREcePLhwwcE7+hAEcO/O 7NrAAQcFlogNkJouSYSzcddQ= X-Received: by 127.0.0.2 with SMTP id v9pgYY1788612xfQHo8HTHXP; Wed, 06 Dec 2023 02:11:58 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.28488.1701857517872862107 for ; Wed, 06 Dec 2023 02:11:58 -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 8E249150C; Wed, 6 Dec 2023 02:12:43 -0800 (PST) X-Received: from usa.arm.com (a076756.arm.com [10.162.16.58]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 78F8F3F762; Wed, 6 Dec 2023 02:11:55 -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 V1 1/2] ArmPkg/ArmGicArchLib: Add macros for SPI and extended SPI ranges Date: Wed, 6 Dec 2023 15:41:45 +0530 Message-Id: <20231206101146.1309296-2-Himanshu.Sharma@arm.com> In-Reply-To: <20231206101146.1309296-1-Himanshu.Sharma@arm.com> References: <20231206101146.1309296-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: yTVLSyFypM94iYOVVZHgMe3zx1787277AA= Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1701857519485100003 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 | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ArmPkg/Include/Library/ArmGicArchLib.h b/ArmPkg/Include/Librar= y/ArmGicArchLib.h index 72ac17e13b5a..1b90b354f785 100644 --- a/ArmPkg/Include/Library/ArmGicArchLib.h +++ b/ArmPkg/Include/Library/ArmGicArchLib.h @@ -1,6 +1,7 @@ /** @file * * Copyright (c) 2015, Linaro Ltd. All rights reserved. +* Copyright (c) 2023, Arm Limited. All rights reserved. * * SPDX-License-Identifier: BSD-2-Clause-Patent * @@ -23,4 +24,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 (#112117): https://edk2.groups.io/g/devel/message/112117 Mute This Topic: https://groups.io/mt/103010240/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 Mon May 20 22:42:18 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+112118+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+112118+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1701857521; cv=none; d=zohomail.com; s=zohoarc; b=RgtHroOt0n+VmEZ0keWu9YRJ7xRDxbWC49OPBfkXtBFwqxEG9d8xUzG4NFZnGOcLMCPoOEWeA2W2wSXrV0bV8bI7MURYciqP5voNBnaeToTBw9F+PRD8hQ5RZwh66b7AzWtFaRwlp/GksNtFNRYP4skSVcwVsy0kmfUQEhYQyIU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1701857521; 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=ucvWHxwhaFi6zCpv7kdmlVUeRBV2CRx2sIs9249aIxk=; b=ZYgBsILI5iJiPabORW+0qwTRf2ALosf1zy8JS8PAieGDTGYwF8Z5WOJkeNp/Li3wmY2A2kv1SRb6JQ/avGIt1hFWOBtnKw/LcIBYff/5EddM4jFsqJtFLj4QUQ3QJdYe5eE4phr9lMEWtjJ0BI8uyfODbYUYej72lkiEs3p6ihg= 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+112118+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 1701857521249521.6286016651447; Wed, 6 Dec 2023 02:12:01 -0800 (PST) Return-Path: DKIM-Signature: a=rsa-sha256; bh=jNDPp+nfLDN8XhtbJpzBpgQzlX86NVSCYQaUxRT1e64=; 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=1701857520; v=1; b=sQjvy8VtjBLPQuP/oGgcNWPHMPAmVfrq9+srSX31HxHww7Ko4UlFB6jMTIuSLYAmiEivqT8q ld2cIRWpTb3TbirvSTERqLMczdjKp7DZUsscCZk3qKI72RS024uMSSXQyqSEBF1MVLMIkh+M07A gccjg0vGZ6oTOHMa9Mn/EC2I= X-Received: by 127.0.0.2 with SMTP id pv7XYY1788612xXDJfMHgf6b; Wed, 06 Dec 2023 02:12:00 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.28490.1701857520259133165 for ; Wed, 06 Dec 2023 02:12:00 -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 05E8C1474; Wed, 6 Dec 2023 02:12:46 -0800 (PST) X-Received: from usa.arm.com (a076756.arm.com [10.162.16.58]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id ED31D3F762; Wed, 6 Dec 2023 02:11:57 -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 V1 2/2] DynamicTablesPkg/SsdtSerialPortFixupLib: Add Interrupt node for SPIs only Date: Wed, 6 Dec 2023 15:41:46 +0530 Message-Id: <20231206101146.1309296-3-Himanshu.Sharma@arm.com> In-Reply-To: <20231206101146.1309296-1-Himanshu.Sharma@arm.com> References: <20231206101146.1309296-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: WPbbc9nxXh0tGpx0NlZSBzcmx1787277AA= Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1701857523432100003 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 Tested-by: Himanshu Sharma --- DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSerialPortFixup= Lib.inf | 3 +- DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSerialPortFixup= Lib.c | 38 ++++++++++++-------- DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSerialPortTempl= ate.asl | 29 ++++++++------- 3 files changed, 42 insertions(+), 28 deletions(-) diff --git a/DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSer= ialPortFixupLib.inf b/DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLi= b/SsdtSerialPortFixupLib.inf index 965167bdc4e1..2d16a22aeb41 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, 2023, Arm Limited. All rights reserved.
# # SPDX-License-Identifier: BSD-2-Clause-Patent ## @@ -23,6 +23,7 @@ MdeModulePkg/MdeModulePkg.dec EmbeddedPkg/EmbeddedPkg.dec DynamicTablesPkg/DynamicTablesPkg.dec + ArmPkg/ArmPkg.dec =20 [LibraryClasses] AcpiHelperLib diff --git a/DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSer= ialPortFixupLib.c b/DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/= SsdtSerialPortFixupLib.c index a65c1fe7e30d..fb77136aa844 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, 2023, Arm Limited. All rights reserved.
=20 SPDX-License-Identifier: BSD-2-Clause-Patent =20 @@ -9,10 +9,12 @@ - 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. **/ =20 #include #include +#include #include #include #include @@ -270,7 +272,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 +304,27 @@ 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 if the interrupt for the serial-port is a = valid SPI. + // SPI ranges from Table 2-1 in Arm Generic Interrupt Controller Archite= cture Specification. + 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 ( + 1, // Resource Consumer + 0, // Level Triggered + 0, // Active High + 0, // Exclusive + (UINT32 *)&SerialPortInfo->Interrupt, + 1, + NameOpCrsNode, + NULL + ); + if (EFI_ERROR (Status)) { + return Status; + } } - - if (InterruptRdNode =3D=3D NULL) { - return EFI_INVALID_PARAMETER; - } - - // Update the interrupt number. - return AmlUpdateRdInterrupt (InterruptRdNode, SerialPortInfo->Interrupt); + return EFI_SUCCESS; } =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..46f800b0cdad 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, 2023, 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 (#112118): https://edk2.groups.io/g/devel/message/112118 Mute This Topic: https://groups.io/mt/103010241/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-