From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail05.groups.io (mail05.groups.io [45.79.224.7]) by spool.mail.gandi.net (Postfix) with ESMTPS id D0970740039 for ; Wed, 19 Jun 2024 22:07:27 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=lyUw4AGrhZ9ev8nvZcCleathMR4caZ3LZI/41/qMFh8=; 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:Resent-Date:Resent-From:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20240206; t=1718834847; v=1; b=iX9OCjqTGarTbxlDc0LEIoMj2yQh3KqByN3JlNCORs8x5J5rMVWTb2tdHBCvM/5Jyqr49r5A WNHHMJvYWbEASiAAEH73Ve5KBlrFXTyTCZjqq62nfd0m7daXYdkMksjSP3JfNN2LilWfgtXyIPj x1+CbipKadTkqfYYSgwJM+ZjZ4cZzZkBgYDZkwZgbS9VndhR8H7fiOc5HYosvF5bZuEpAWUfG6u 2MeI93InQbiE5C9JazM+c1+q4QYRGXfy8oyekoITO6dKPDKHpn/dzu5Zak+IngKmiNzv3NjAiko IjtuZ5dNPbLI84oxEnK7EutzvJdJHE9X9UIE9Ftpgqf6g== X-Received: by 127.0.0.2 with SMTP id 9G9OYY7687511xBbHGwLkus7; Wed, 19 Jun 2024 15:07:26 -0700 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web11.34011.1718834845646130178 for ; Wed, 19 Jun 2024 15:07:25 -0700 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 1A6C6DA7; Wed, 19 Jun 2024 15:07:50 -0700 (PDT) X-Received: from e126645.home (usa-sjc-mx-foss1.foss.arm.com [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id BEE833F64C; Wed, 19 Jun 2024 15:07:22 -0700 (PDT) From: "PierreGondois" To: devel@edk2.groups.io Cc: Pierre Gondois , AbdulLateef Attar , Girish Mahadevan , Jeff Brasen , Jeshua Smith , Leif Lindholm , Meenakshi Aggarwal , Sami Mujawar , Sunil V L , Yeo Reum Yun Subject: [edk2-devel] [staging/dynamictables-reorg PATCH 14/15] DynamicTablesPkg: FdtHwInfoParserLib: Move IRQ map to arch folder Date: Thu, 20 Jun 2024 00:06:28 +0200 Message-Id: <20240619220629.1994362-15-pierre.gondois@arm.com> In-Reply-To: <20240619220629.1994362-1-pierre.gondois@arm.com> References: <20240619220629.1994362-1-pierre.gondois@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 Resent-Date: Wed, 19 Jun 2024 15:07:25 -0700 Resent-From: pierre.gondois@arm.com Reply-To: devel@edk2.groups.io,pierre.gondois@arm.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: YKuMYP24DTNvWj8daC3L2ZNHx7686176AA= Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b=iX9OCjqT; 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 45.79.224.7 as permitted sender) smtp.mailfrom=bounce@groups.io The interrupts-extended property in DT is arch specific. Move the current implementation and the way to decode the property to the Arm folder to prepare for other architecture support. Suggested-by: Sunil V L Signed-off-by: Pierre Gondois --- .../FdtHwInfoParserLib/Arm/ArmFdtUtility.c | 85 +++++++++++++++++++ .../FdtHwInfoParserLib/FdtHwInfoParserLib.inf | 1 + .../Library/FdtHwInfoParserLib/FdtUtility.c | 71 ---------------- 3 files changed, 86 insertions(+), 71 deletions(-) create mode 100644 DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/ArmFdtU= tility.c diff --git a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/ArmFdtUtility.= c b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/ArmFdtUtility.c new file mode 100644 index 000000000000..21b1306e577d --- /dev/null +++ b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/ArmFdtUtility.c @@ -0,0 +1,85 @@ +/** @file=0D + Flattened device tree utility.=0D +=0D + Copyright (c) 2021, ARM Limited. All rights reserved.
=0D + SPDX-License-Identifier: BSD-2-Clause-Patent=0D +=0D + @par Reference(s):=0D + - Device tree Specification - Release v0.3=0D + - linux/Documentation/devicetree/bindings/interrupt-controller/arm%2Cgic= .yaml=0D + - linux//Documentation/devicetree/bindings/interrupt-controller/arm%2Cgi= c.yaml=0D +**/=0D +=0D +#include =0D +#include "FdtUtility.h"=0D +=0D +/** Get the interrupt Id of an interrupt described in a fdt.=0D +=0D + Data must describe a GIC interrupt. A GIC interrupt is on at least=0D + 3 UINT32 cells.=0D + This function DOES NOT SUPPORT extended SPI range and extended PPI range= .=0D +=0D + @param [in] Data Pointer to the first cell of an "interrupts" propert= y.=0D +=0D + @retval The interrupt id.=0D +**/=0D +UINT32=0D +EFIAPI=0D +FdtGetInterruptId (=0D + UINT32 CONST *Data=0D + )=0D +{=0D + UINT32 IrqType;=0D + UINT32 IrqId;=0D +=0D + ASSERT (Data !=3D NULL);=0D +=0D + IrqType =3D fdt32_to_cpu (Data[IRQ_TYPE_OFFSET]);=0D + IrqId =3D fdt32_to_cpu (Data[IRQ_NUMBER_OFFSET]);=0D +=0D + switch (IrqType) {=0D + case DT_SPI_IRQ:=0D + IrqId +=3D SPI_OFFSET;=0D + break;=0D +=0D + case DT_PPI_IRQ:=0D + IrqId +=3D PPI_OFFSET;=0D + break;=0D +=0D + default:=0D + ASSERT (0);=0D + IrqId =3D 0;=0D + }=0D +=0D + return IrqId;=0D +}=0D +=0D +/** Get the ACPI interrupt flags of an interrupt described in a fdt.=0D +=0D + Data must describe a GIC interrupt. A GIC interrupt is on at least=0D + 3 UINT32 cells.=0D +=0D + PPI interrupt cpu mask on bits [15:8] are ignored.=0D +=0D + @param [in] Data Pointer to the first cell of an "interrupts" propert= y.=0D +=0D + @retval The interrupt flags (for ACPI).=0D +**/=0D +UINT32=0D +EFIAPI=0D +FdtGetInterruptFlags (=0D + UINT32 CONST *Data=0D + )=0D +{=0D + UINT32 IrqFlags;=0D + UINT32 AcpiIrqFlags;=0D +=0D + ASSERT (Data !=3D NULL);=0D +=0D + IrqFlags =3D fdt32_to_cpu (Data[IRQ_FLAGS_OFFSET]);=0D +=0D + AcpiIrqFlags =3D DT_IRQ_IS_EDGE_TRIGGERED (IrqFlags) ? BIT0 : 0;=0D + AcpiIrqFlags |=3D DT_IRQ_IS_ACTIVE_LOW (IrqFlags) ? BIT1 : 0;=0D +=0D + return AcpiIrqFlags;=0D +}=0D diff --git a/DynamicTablesPkg/Library/FdtHwInfoParserLib/FdtHwInfoParserLib= .inf b/DynamicTablesPkg/Library/FdtHwInfoParserLib/FdtHwInfoParserLib.inf index d3010af527c1..8e1ea100bd34 100644 --- a/DynamicTablesPkg/Library/FdtHwInfoParserLib/FdtHwInfoParserLib.inf +++ b/DynamicTablesPkg/Library/FdtHwInfoParserLib/FdtHwInfoParserLib.inf @@ -28,6 +28,7 @@ [Sources] Serial/SerialPortParser.h=0D =0D [Sources.ARM, Sources.AARCH64]=0D + Arm/ArmFdtUtility.c=0D Arm/ArmFdtHwInfoParser.c=0D Arm/BootArch/ArmBootArchParser.c=0D Arm/BootArch/ArmBootArchParser.h=0D diff --git a/DynamicTablesPkg/Library/FdtHwInfoParserLib/FdtUtility.c b/Dyn= amicTablesPkg/Library/FdtHwInfoParserLib/FdtUtility.c index 5314cf3808c2..bab228575938 100644 --- a/DynamicTablesPkg/Library/FdtHwInfoParserLib/FdtUtility.c +++ b/DynamicTablesPkg/Library/FdtHwInfoParserLib/FdtUtility.c @@ -13,77 +13,6 @@ #include =0D #include "FdtUtility.h"=0D =0D -/** Get the interrupt Id of an interrupt described in a fdt.=0D -=0D - Data must describe a GIC interrupt. A GIC interrupt is on at least=0D - 3 UINT32 cells.=0D - This function DOES NOT SUPPORT extended SPI range and extended PPI range= .=0D -=0D - @param [in] Data Pointer to the first cell of an "interrupts" propert= y.=0D -=0D - @retval The interrupt id.=0D -**/=0D -UINT32=0D -EFIAPI=0D -FdtGetInterruptId (=0D - UINT32 CONST *Data=0D - )=0D -{=0D - UINT32 IrqType;=0D - UINT32 IrqId;=0D -=0D - ASSERT (Data !=3D NULL);=0D -=0D - IrqType =3D fdt32_to_cpu (Data[IRQ_TYPE_OFFSET]);=0D - IrqId =3D fdt32_to_cpu (Data[IRQ_NUMBER_OFFSET]);=0D -=0D - switch (IrqType) {=0D - case DT_SPI_IRQ:=0D - IrqId +=3D SPI_OFFSET;=0D - break;=0D -=0D - case DT_PPI_IRQ:=0D - IrqId +=3D PPI_OFFSET;=0D - break;=0D -=0D - default:=0D - ASSERT (0);=0D - IrqId =3D 0;=0D - }=0D -=0D - return IrqId;=0D -}=0D -=0D -/** Get the ACPI interrupt flags of an interrupt described in a fdt.=0D -=0D - Data must describe a GIC interrupt. A GIC interrupt is on at least=0D - 3 UINT32 cells.=0D -=0D - PPI interrupt cpu mask on bits [15:8] are ignored.=0D -=0D - @param [in] Data Pointer to the first cell of an "interrupts" propert= y.=0D -=0D - @retval The interrupt flags (for ACPI).=0D -**/=0D -UINT32=0D -EFIAPI=0D -FdtGetInterruptFlags (=0D - UINT32 CONST *Data=0D - )=0D -{=0D - UINT32 IrqFlags;=0D - UINT32 AcpiIrqFlags;=0D -=0D - ASSERT (Data !=3D NULL);=0D -=0D - IrqFlags =3D fdt32_to_cpu (Data[IRQ_FLAGS_OFFSET]);=0D -=0D - AcpiIrqFlags =3D DT_IRQ_IS_EDGE_TRIGGERED (IrqFlags) ? BIT0 : 0;=0D - AcpiIrqFlags |=3D DT_IRQ_IS_ACTIVE_LOW (IrqFlags) ? BIT1 : 0;=0D -=0D - return AcpiIrqFlags;=0D -}=0D -=0D /** Check whether a node has the input name.=0D =0D @param [in] Fdt Pointer to a Flattened Device Tree.=0D --=20 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#119646): https://edk2.groups.io/g/devel/message/119646 Mute This Topic: https://groups.io/mt/106770184/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-