From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 34E97740045 for ; Wed, 6 Dec 2023 10:12:01 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=F4Ob3qLpXsNEeeV/Exh3PKqr5tdeM5Ddj6qgyH780Iw=; 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=l1gho+AkEQHj4BeIqkOTUcd0c0OY28LDsk5h/McoFpFuqje6qy5fC/Ddw9/D+nvM5t4Cyzsu uKd3m8kgiPZAU2nOBS48mM+welq7lt7SRjf9TFE0z5OPg7QNsEukwi7IvG1evc1uX9CEzIojH1B hcjKgqS3woOqFJKGl22icFeo= X-Received: by 127.0.0.2 with SMTP id hqpyYY7687511x03bRnkSUVj; 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: OA187FbxenkXPEyZ5rYlGJJpx7686176AA= Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=l1gho+Ak; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=arm.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io 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 --- 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=0D # SSDT Serial Port fixup Library=0D #=0D -# Copyright (c) 2020 - 2021, Arm Limited. All rights reserved.
=0D +# Copyright (c) 2020 - 2021, 2023, Arm Limited. All rights reserved.
= =0D #=0D # SPDX-License-Identifier: BSD-2-Clause-Patent=0D ##=0D @@ -23,6 +23,7 @@ MdeModulePkg/MdeModulePkg.dec=0D EmbeddedPkg/EmbeddedPkg.dec=0D DynamicTablesPkg/DynamicTablesPkg.dec=0D + ArmPkg/ArmPkg.dec=0D =0D [LibraryClasses]=0D AcpiHelperLib=0D 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=0D SSDT Serial Port Fixup Library.=0D =0D - Copyright (c) 2019 - 2021, Arm Limited. All rights reserved.
=0D + Copyright (c) 2019 - 2021, 2023, Arm Limited. All rights reserved.
=0D =0D SPDX-License-Identifier: BSD-2-Clause-Patent=0D =0D @@ -9,10 +9,12 @@ - Arm Server Base Boot Requirements (SBBR), s4.2.1.8 "SPCR".=0D - Microsoft Debug Port Table 2 (DBG2) Specification - December 10, 2015.= =0D - ACPI for Arm Components 1.0 - 2020=0D + - Arm Generic Interrupt Controller Architecture Specification, Issue H, = January 2022.=0D **/=0D =0D #include =0D #include =0D +#include =0D #include =0D #include =0D #include =0D @@ -270,7 +272,6 @@ FixupCrs ( EFI_STATUS Status;=0D AML_OBJECT_NODE_HANDLE NameOpCrsNode;=0D AML_DATA_NODE_HANDLE QWordRdNode;=0D - AML_DATA_NODE_HANDLE InterruptRdNode;=0D =0D // Get the "_CRS" object defined by the "Name ()" statement.=0D Status =3D AmlFindNode (=0D @@ -303,20 +304,27 @@ FixupCrs ( return Status;=0D }=0D =0D - // Get the Interrupt node.=0D - // It is the second Resource Data element in the NameOpCrsNode's=0D - // variable list of arguments.=0D - Status =3D AmlNameOpGetNextRdNode (QWordRdNode, &InterruptRdNode);=0D - if (EFI_ERROR (Status)) {=0D - return Status;=0D + // Generate an interrupt node if the interrupt for the serial-port is a = valid SPI.=0D + // SPI ranges from Table 2-1 in Arm Generic Interrupt Controller Archite= cture Specification.=0D + if (((SerialPortInfo->Interrupt >=3D ARM_GIC_ARCH_SPI_MIN) &&=0D + (SerialPortInfo->Interrupt <=3D ARM_GIC_ARCH_SPI_MAX)) ||=0D + ((SerialPortInfo->Interrupt >=3D ARM_GIC_ARCH_EXT_SPI_MIN) &&=0D + (SerialPortInfo->Interrupt <=3D ARM_GIC_ARCH_EXT_SPI_MAX))) {=0D + Status =3D AmlCodeGenRdInterrupt (=0D + 1, // Resource Consumer=0D + 0, // Level Triggered=0D + 0, // Active High=0D + 0, // Exclusive=0D + (UINT32 *)&SerialPortInfo->Interrupt,=0D + 1,=0D + NameOpCrsNode,=0D + NULL=0D + );=0D + if (EFI_ERROR (Status)) {=0D + return Status;=0D + }=0D }=0D -=0D - if (InterruptRdNode =3D=3D NULL) {=0D - return EFI_INVALID_PARAMETER;=0D - }=0D -=0D - // Update the interrupt number.=0D - return AmlUpdateRdInterrupt (InterruptRdNode, SerialPortInfo->Interrupt)= ;=0D + return EFI_SUCCESS;=0D }=0D =0D /** Fixup the Serial Port device name.=0D 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=0D SSDT Serial Template=0D =0D - Copyright (c) 2019 - 2020, Arm Limited. All rights reserved.
=0D + Copyright (c) 2019 - 2020, 2023, Arm Limited. All rights reserved.
=0D =0D SPDX-License-Identifier: BSD-2-Clause-Patent=0D =0D @@ -10,6 +10,7 @@ =0D @par Glossary:=0D - {template} - Data fixed up using AML Fixup APIs.=0D + - {codegen} - Data generated using AML Codegen APIs.=0D **/=0D =0D DefinitionBlock ("SsdtSerialPortTemplate.aml", "SSDT", 2, "ARMLTD", "SERIA= L", 1) {=0D @@ -43,17 +44,21 @@ DefinitionBlock ("SsdtSerialPortTemplate.aml", "SSDT", = 2, "ARMLTD", "SERIAL", 1) , // MemoryRangeType=0D // TranslationType=0D ) // QWordMemory=0D - Interrupt (=0D - ResourceConsumer, // ResourceUsage=0D - Level, // EdgeLevel=0D - ActiveHigh, // ActiveLevel=0D - Exclusive, // Shared=0D - , // ResourceSourceIndex=0D - , // ResourceSource=0D - // DescriptorName=0D - ) {=0D - 0xA5 // {template}=0D - } // Interrupt=0D +=0D + // The Interrupt information is generated using AmlCodegen.=0D + //=0D + // Interrupt ( // {codegen}=0D + // ResourceConsumer, // ResourceUsage=0D + // Level, // EdgeLevel=0D + // ActiveHigh, // ActiveLevel=0D + // Exclusive, // Shared=0D + // , // ResourceSourceIndex=0D + // , // ResourceSource=0D + // // DescriptorName=0D + // ) {=0D + // // =0D + // } // Interrupt=0D +=0D }) // Name=0D } // Device=0D } // Scope (_SB)=0D --=20 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- 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/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-