From nobody Fri May 10 19:35: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+86304+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+86304+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1643736166; cv=none; d=zohomail.com; s=zohoarc; b=f+AniapoisenyzbmkyiGNwU0cZgWQoOaf+puLhHpccWKS4fbmzCogmp0zQfcTyyIHwUCKvDhqRj5Q/VtcDCoytc2ImZc0H8uRXYrVWgz7pDlyh1t+5CeFdks3aH1kkYTbYuuzqrALNGprhL6eG9RWQkqVmEzfYXNLvKqyx+Ym8k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1643736166; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=o3Pa1hb/9ChMvmGVq33wM2IGQwY4+Xww4VsnDXCcDh8=; b=Iw6BCQLyBU+6yI4ErbxHG+yKcTgifbkco4Y0h8ap//7SqB7SIAdeYSjrJdZZBzbkFIqXdi2RYGZOR5BfhZDwMR8rk3JviPqTNqvouXFyZiy5KtKGxBMEaSEZM05iWuoAD43PULFEutMHOkR/T0aKUTsppm4suVtaG2GBJP5lc+w= 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+86304+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 1643736166784627.9105655729355; Tue, 1 Feb 2022 09:22:46 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id K9pBYY1788612xE16OYij6Qq; Tue, 01 Feb 2022 09:22:46 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web08.51317.1643736165689059802 for ; Tue, 01 Feb 2022 09:22:45 -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 4E24B11FB; Tue, 1 Feb 2022 09:22:45 -0800 (PST) X-Received: from e126645.home (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id DA1383F40C; Tue, 1 Feb 2022 09:22:43 -0800 (PST) From: "PierreGondois" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Sami Mujawar , Rebecca Cran , Pierre Gondois Subject: [edk2-devel] [PATCH v5 1/9] DynamicTablesPkg: Print specifier macro for CM_OBJECT_ID Date: Tue, 1 Feb 2022 18:22:44 +0100 Message-Id: <20220201172252.799725-2-Pierre.Gondois@arm.com> In-Reply-To: <20220201172252.799725-1-Pierre.Gondois@arm.com> References: <20220201172252.799725-1-Pierre.Gondois@arm.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: 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,pierre.gondois@arm.com X-Gm-Message-State: Oql2TStpozm8s9IsbMr8eN6ux1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1643736166; bh=pgM6iZ4qSx+6MojAdmS37BdZa+NH4GEoJfeGRRSocIs=; h=Cc:Date:From:Reply-To:Subject:To; b=tM8zCjKkXVgNqxhgysYSI+89q23dvVlcpdouvofAVr09mBz9HV/U4CU9BWz020DvRlL 0+NeABIhBs/8ZGmSXQbiKDYCgGSVKzxEgusTKmEpRzMVx16lObw7hPZ2Xc4RA38Ba9wBZ Lvah5Hr4s2/r7lymuaTP0WhNz+jYD5PTJos= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1643736169386100007 Content-Type: text/plain; charset="utf-8" From: Pierre Gondois Add a macro that specifies the format for printing CM_OBJECT_ID. This allows to print the CM_OBJECT_ID is a consistent way in the output logs. Signed-off-by: Pierre Gondois --- Notes: v2: - New patch, requested by Laszlo. DynamicTablesPkg/Include/ConfigurationManagerObject.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/DynamicTablesPkg/Include/ConfigurationManagerObject.h b/Dynami= cTablesPkg/Include/ConfigurationManagerObject.h index 60d825a2b253..74ad25d5d94a 100644 --- a/DynamicTablesPkg/Include/ConfigurationManagerObject.h +++ b/DynamicTablesPkg/Include/ConfigurationManagerObject.h @@ -1,6 +1,6 @@ /** @file =20 - Copyright (c) 2017 - 2019, ARM Limited. All rights reserved. + Copyright (c) 2017 - 2022, ARM Limited. All rights reserved. =20 SPDX-License-Identifier: BSD-2-Clause-Patent =20 @@ -84,6 +84,11 @@ Object ID's in the ARM Namespace: */ typedef UINT32 CM_OBJECT_ID; =20 +// +// Helper macro to format a CM_OBJECT_ID. +// +#define FMT_CM_OBJECT_ID "0x%lx" + /** A mask for Object ID */ #define OBJECT_ID_MASK 0xFF --=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 (#86304): https://edk2.groups.io/g/devel/message/86304 Mute This Topic: https://groups.io/mt/88838051/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 10 19:35: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+86305+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+86305+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1643736169; cv=none; d=zohomail.com; s=zohoarc; b=bep7uVlLKqakmCT/Mh1fb/Oozpgz0cz4cDwUC3MuM3vtHExFtmLcgtAmMV9tOQ2HzMHeU/AEcOQLF5KwcOvjkNuMritn5IFNOq4Fbs/S+TmqvD+j/TFMDZlZyKM3d7Shxn+ntEPLJmJnkNXaPMqd6XwB5D8pqN4mCzZj/Pkd0og= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1643736169; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=Lbvn1VHxchLVl8dbTf1s/WQmEBNzBuYmr3Ee/tc8SKo=; b=T6C+cRy2wTcpursKf3C79s17iz6bo3PaJL1IW7On8SJP/E0CI8KBrBOkvqr3nJK6JxdhLKDlAQl9jfCUIyTDVlmxKWPEnjleASGhUS21K6BY1EkMg3ZGMhwDmhWoKso1Etc5e4JAH+SgJOdaRS/I+hw7o2gk5/bo4U41X8vA92w= 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+86305+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 1643736169027479.0491639587482; Tue, 1 Feb 2022 09:22:49 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id gvv0YY1788612x0CLNTbABEU; Tue, 01 Feb 2022 09:22:48 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web11.51793.1643736167698807450 for ; Tue, 01 Feb 2022 09:22:47 -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 4F2DD11B3; Tue, 1 Feb 2022 09:22:47 -0800 (PST) X-Received: from e126645.home (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id B3C2C3F40C; Tue, 1 Feb 2022 09:22:45 -0800 (PST) From: "PierreGondois" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Sami Mujawar , Rebecca Cran , Pierre Gondois Subject: [edk2-devel] [PATCH v5 2/9] DynamicTablesPkg: FdtHwInfoParserLib: Parse Pmu info Date: Tue, 1 Feb 2022 18:22:45 +0100 Message-Id: <20220201172252.799725-3-Pierre.Gondois@arm.com> In-Reply-To: <20220201172252.799725-1-Pierre.Gondois@arm.com> References: <20220201172252.799725-1-Pierre.Gondois@arm.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: 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,pierre.gondois@arm.com X-Gm-Message-State: 4vmMztGSGCjhdIUaKh7Q9j2zx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1643736168; bh=L0mBEKZxDFwQOHZdz65b4rw8WRPDpq6cn6fVoAFVbk4=; h=Cc:Date:From:Reply-To:Subject:To; b=qqL/K+t5Ejl9h5FmCIXQZB3F7q6m0jQSwAksO+yMJ4S/U2pqqBR1TgCQzNafGLEHeUr W6Ge2D5mp9DtfyqtTW1RSGUVTljpyhigf2AfGiUiQoV5G0OaiUSbMGQL5PwmXOt1h7XD3 0roTI7XhyjxhFg28aZZxVdEnyedWZtuK+YA= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1643736171849100013 Content-Type: text/plain; charset="utf-8" From: Pierre Gondois Parse the Pmu interrupts if a pmu compatible node is present, and populate the MADT GicC structure accordingly. Signed-off-by: Pierre Gondois --- Notes: v3: - New patch. [Pierre] v4: - Add more information in ASSERT () checks. [Ard] .../FdtHwInfoParserLib/Gic/ArmGicCParser.c | 132 +++++++++++++++++- .../FdtHwInfoParserLib/Gic/ArmGicCParser.h | 8 +- 2 files changed, 136 insertions(+), 4 deletions(-) diff --git a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Gic/ArmGicCParser.= c b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Gic/ArmGicCParser.c index b4e6729a4ab2..fb01aa0d19e2 100644 --- a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Gic/ArmGicCParser.c +++ b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Gic/ArmGicCParser.c @@ -1,13 +1,14 @@ /** @file Arm Gic cpu parser. =20 - Copyright (c) 2021, ARM Limited. All rights reserved.
+ Copyright (c) 2021 - 2022, Arm Limited. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 @par Reference(s): - linux/Documentation/devicetree/bindings/arm/cpus.yaml - linux/Documentation/devicetree/bindings/interrupt-controller/arm,gic.y= aml - linux/Documentation/devicetree/bindings/interrupt-controller/arm,gic-v= 3.yaml + - linux/Documentation/devicetree/bindings/arm/pmu.yaml **/ =20 #include "FdtHwInfoParser.h" @@ -34,6 +35,21 @@ STATIC CONST COMPATIBILITY_INFO CpuCompatibleInfo =3D { CpuCompatibleStr }; =20 +/** Pmu compatible strings. + + Any other "compatible" value is not supported by this module. +*/ +STATIC CONST COMPATIBILITY_STR PmuCompatibleStr[] =3D { + { "arm,armv8-pmuv3" } +}; + +/** COMPATIBILITY_INFO structure for the PmuCompatibleStr. +*/ +CONST COMPATIBILITY_INFO PmuCompatibleInfo =3D { + ARRAY_SIZE (PmuCompatibleStr), + PmuCompatibleStr +}; + /** Parse a "cpu" node. =20 @param [in] Fdt Pointer to a Flattened Device Tree (Fdt). @@ -639,6 +655,111 @@ GicCv3IntcNodeParser ( return EFI_SUCCESS; } =20 +/** Parse a Pmu compatible node, extracting Pmu information. + + This function modifies a CM_OBJ_DESCRIPTOR object. + The following CM_ARM_GICC_INFO fields are patched: + - PerformanceInterruptGsiv; + + @param [in] Fdt Pointer to a Flattened Device Tree (F= dt). + @param [in] GicIntcNode Offset of a Gic compatible + interrupt-controller node. + @param [in, out] GicCCmObjDesc The CM_ARM_GICC_INFO to patch. + + @retval EFI_SUCCESS The function completed successfully. + @retval EFI_ABORTED An error occurred. + @retval EFI_INVALID_PARAMETER Invalid parameter. +**/ +STATIC +EFI_STATUS +EFIAPI +GicCPmuNodeParser ( + IN CONST VOID *Fdt, + IN INT32 GicIntcNode, + IN OUT CM_OBJ_DESCRIPTOR *GicCCmObjDesc + ) +{ + EFI_STATUS Status; + INT32 IntCells; + INT32 PmuNode; + UINT32 PmuNodeCount; + UINT32 PmuIrq; + UINT32 Index; + CM_ARM_GICC_INFO *GicCInfo; + CONST UINT8 *Data; + INT32 DataSize; + + if (GicCCmObjDesc =3D=3D NULL) { + ASSERT (GicCCmObjDesc !=3D NULL); + return EFI_INVALID_PARAMETER; + } + + GicCInfo =3D (CM_ARM_GICC_INFO *)GicCCmObjDesc->Data; + PmuNode =3D 0; + + // Count the number of pmu nodes. + Status =3D FdtCountCompatNodeInBranch ( + Fdt, + 0, + &PmuCompatibleInfo, + &PmuNodeCount + ); + if (EFI_ERROR (Status)) { + ASSERT_EFI_ERROR (Status); + return Status; + } + + if (PmuNodeCount =3D=3D 0) { + return EFI_NOT_FOUND; + } + + Status =3D FdtGetNextCompatNodeInBranch ( + Fdt, + 0, + &PmuCompatibleInfo, + &PmuNode + ); + if (EFI_ERROR (Status)) { + ASSERT_EFI_ERROR (Status); + if (Status =3D=3D EFI_NOT_FOUND) { + // Should have found the node. + Status =3D EFI_ABORTED; + } + } + + // Get the number of cells used to encode an interrupt. + Status =3D FdtGetInterruptCellsInfo (Fdt, GicIntcNode, &IntCells); + if (EFI_ERROR (Status)) { + ASSERT_EFI_ERROR (Status); + return Status; + } + + Data =3D fdt_getprop (Fdt, PmuNode, "interrupts", &DataSize); + if ((Data =3D=3D NULL) || (DataSize !=3D (IntCells * sizeof (UINT32)))) { + // If error or not 1 interrupt. + ASSERT (Data !=3D NULL); + ASSERT (DataSize =3D=3D (IntCells * sizeof (UINT32))); + return EFI_ABORTED; + } + + PmuIrq =3D FdtGetInterruptId ((CONST UINT32 *)Data); + + // Only supports PPI 23 for now. + // According to BSA 1.0 s3.6 PPI assignments, PMU IRQ ID is 23. A non BSA + // compliant system may assign a different IRQ for the PMU, however this + // is not implemented for now. + if (PmuIrq !=3D BSA_PMU_IRQ) { + ASSERT (PmuIrq =3D=3D BSA_PMU_IRQ); + return EFI_ABORTED; + } + + for (Index =3D 0; Index < GicCCmObjDesc->Count; Index++) { + GicCInfo[Index].PerformanceInterruptGsiv =3D PmuIrq; + } + + return EFI_SUCCESS; +} + /** CM_ARM_GICC_INFO parser function. =20 This parser expects FdtBranch to be the "\cpus" node node. @@ -649,7 +770,7 @@ GicCv3IntcNodeParser ( UINT32 AcpiProcessorUid; // {Populated} UINT32 Flags; // {Populated} UINT32 ParkingProtocolVersion; // {default =3D 0} - UINT32 PerformanceInterruptGsiv; // {default =3D 0} + UINT32 PerformanceInterruptGsiv; // {Populated} UINT64 ParkedAddress; // {default =3D 0} UINT64 PhysicalBaseAddress; // {Populated} UINT64 GICV; // {Populated} @@ -764,6 +885,13 @@ ArmGicCInfoParser ( goto exit_handler; } =20 + // Parse the Pmu Interrupt. + Status =3D GicCPmuNodeParser (Fdt, IntcNode, NewCmObjDesc); + if (EFI_ERROR (Status) && (Status !=3D EFI_NOT_FOUND)) { + ASSERT_EFI_ERROR (Status); + goto exit_handler; + } + // Add all the CmObjs to the Configuration Manager. Status =3D AddMultipleCmObj (FdtParserHandle, NewCmObjDesc, 0, NULL); if (EFI_ERROR (Status)) { diff --git a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Gic/ArmGicCParser.= h b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Gic/ArmGicCParser.h index 2a0f966bf0c2..fd980484a28d 100644 --- a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Gic/ArmGicCParser.h +++ b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Gic/ArmGicCParser.h @@ -1,7 +1,7 @@ /** @file Arm Gic cpu parser. =20 - Copyright (c) 2021, ARM Limited. All rights reserved.
+ Copyright (c) 2021 - 2022, Arm Limited. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 @par Reference(s): @@ -12,6 +12,10 @@ #ifndef ARM_GICC_PARSER_H_ #define ARM_GICC_PARSER_H_ =20 +/* According to BSA 1.0 s3.6 PPI assignments, PMU IRQ ID is 23. +*/ +#define BSA_PMU_IRQ 23 + /** CM_ARM_GICC_INFO parser function. =20 This parser expects FdtBranch to be the "\cpus" node node. @@ -22,7 +26,7 @@ UINT32 AcpiProcessorUid; // {Populated} UINT32 Flags; // {Populated} UINT32 ParkingProtocolVersion; // {default =3D 0} - UINT32 PerformanceInterruptGsiv; // {default =3D 0} + UINT32 PerformanceInterruptGsiv; // {Populated} UINT64 ParkedAddress; // {default =3D 0} UINT64 PhysicalBaseAddress; // {Populated} UINT64 GICV; // {Populated} --=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 (#86305): https://edk2.groups.io/g/devel/message/86305 Mute This Topic: https://groups.io/mt/88838055/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 10 19:35: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+86306+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+86306+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1643736170; cv=none; d=zohomail.com; s=zohoarc; b=WwwgJjepl0yzTMR6NvPSq9q3Jf5IP7yTY0zF7Txv+tjjRJa5aM6Zzq4F9UrUKV7JfwLRtTFlGLKeuDvowIflOfudIvyK6hPu31Bx/yRgywKTdNZadIbVLzJwRNemi07ng+WWaAv4u7h5b+xkCl37eqEOWn/oX9wJslrY9LT388k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1643736170; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=NEuok8mPS6WBf+7HgmHk+YRUi/pB1eoVViE+YWjfkqw=; b=HI9usxaDiu0C+vBdYEVYgah+5I6x1KiupwSV+acCH5tGCkTnJ47QR64uCqBSip4j8p5RFlsDdB+hO34W3N9ee5TVquX5GCEQDNPGZfpHdLfm3gmp8KFLUNvUeZ57D6Zeebk1sjDzvfvTiRIkDn4w36bPApMcj+WE6QEUMH7Yo2c= 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+86306+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 1643736170631288.40269139956354; Tue, 1 Feb 2022 09:22:50 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id EWtQYY1788612xUy2Up2j4Mv; Tue, 01 Feb 2022 09:22:50 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web09.51763.1643736169431800035 for ; Tue, 01 Feb 2022 09:22:49 -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 2215611FB; Tue, 1 Feb 2022 09:22:49 -0800 (PST) X-Received: from e126645.home (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id A66F83F40C; Tue, 1 Feb 2022 09:22:47 -0800 (PST) From: "PierreGondois" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Sami Mujawar , Rebecca Cran , Pierre Gondois Subject: [edk2-devel] [PATCH v5 3/9] DynamicTablesPkg: AmlLib: AmlAddPrtEntry() to handle GSI Date: Tue, 1 Feb 2022 18:22:46 +0100 Message-Id: <20220201172252.799725-4-Pierre.Gondois@arm.com> In-Reply-To: <20220201172252.799725-1-Pierre.Gondois@arm.com> References: <20220201172252.799725-1-Pierre.Gondois@arm.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: 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,pierre.gondois@arm.com X-Gm-Message-State: HrJbwQ5VQ2s94egsn7DvDZdUx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1643736170; bh=oJ/O2+hR8YEzV3J5Bps8cFu1lpxo/PmK7bW+WSpozzM=; h=Cc:Date:From:Reply-To:Subject:To; b=npqRhnSbivuIQIc4i6ZENlb6N1JhoJKdkqoYoys/P1TWve21pWotyIwzWHebG0UzcGW blbhZ5QAh+FS9hfywGYD/qTpLvY14IUhq6kOlEhdHq/XxFn8KMk6Zb/zZ2D7/tltGH3hA zsoKtQ9SIVISYeflVGfpEOx8swd5ZnYhQqo= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1643736172220100015 Content-Type: text/plain; charset="utf-8" From: Pierre Gondois In ACPI 6.4, s6.2.13, _PRT objects describing PCI legacy interrupts can be defined following 2 models. In the first model, _PRT entries reference link devices. Link devices then describe interrupts. This allows to dynamically modify interrupts through _SRS and _PRS objects and to choose exactly the interrupt type (level/edge triggered, active high/low). In the second model, interrupt numbers are described in the _PRT entry. The interrupt type is then assumed by the OS. AmlAddPrtEntry() currently only handles the first model. Make changes to also handle the second model. Signed-off-by: Pierre Gondois --- Notes: v4: - New patch (to handle GSI description in _PRT). [Pierre] .../Common/AmlLib/CodeGen/AmlCodeGen.c | 89 ++++++++++++------- 1 file changed, 55 insertions(+), 34 deletions(-) diff --git a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c b/= DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c index d245848ce3fa..2d55db97c7bf 100644 --- a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c +++ b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c @@ -1,7 +1,7 @@ /** @file AML Code Generation. =20 - Copyright (c) 2020 - 2021, Arm Limited. All rights reserved.
+ Copyright (c) 2020 - 2022, Arm Limited. All rights reserved.
=20 SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -881,6 +881,9 @@ AmlCodeGenNameResourceTemplate ( // interrupt, so let it to index 0. } =20 + The 2 models described in ACPI 6.4, s6.2.13 "_PRT (PCI Routing Table)" c= an + be generated by this function. The example above matches the first model. + The package is added at the tail of the list of the input _PRT node name: Name (_PRT, Package () { @@ -901,8 +904,10 @@ AmlCodeGenNameResourceTemplate ( @param [in] Pin PCI pin number of the device (0-INTA ... 3-I= NTD). Must be between 0-3. @param [in] LinkName Link Name, i.e. device in the AML NameSpace - describing the interrupt used. - The input string is copied. + describing the interrupt used. The input str= ing + is copied. + If NULL, generate 0 in the 'Source' field (c= f. + second model, using GSIV). @param [in] SourceIndex Source index or GSIV. @param [in] PrtNameNode Prt Named node to add the object to .... =20 @@ -930,7 +935,6 @@ AmlAddPrtEntry ( AML_DATA_NODE *DataNode; =20 if ((Pin > 3) || - (LinkName =3D=3D NULL) || (PrtNameNode =3D=3D NULL) || (AmlGetNodeType ((AML_NODE_HANDLE)PrtNameNode) !=3D EAmlNodeObject) = || (!AmlNodeHasOpCode (PrtNameNode, AML_NAME_OP, 0)) || @@ -999,41 +1003,58 @@ AmlAddPrtEntry ( =20 NewElementNode =3D NULL; =20 - Status =3D ConvertAslNameToAmlName (LinkName, &AmlNameString); - if (EFI_ERROR (Status)) { - ASSERT (0); - goto error_handler; - } + if (LinkName !=3D NULL) { + Status =3D ConvertAslNameToAmlName (LinkName, &AmlNameString); + if (EFI_ERROR (Status)) { + ASSERT_EFI_ERROR (Status); + goto error_handler; + } =20 - Status =3D AmlGetNameStringSize (AmlNameString, &AmlNameStringSize); - if (EFI_ERROR (Status)) { - ASSERT (0); - goto error_handler; - } + Status =3D AmlGetNameStringSize (AmlNameString, &AmlNameStringSize); + if (EFI_ERROR (Status)) { + ASSERT_EFI_ERROR (Status); + goto error_handler; + } =20 - Status =3D AmlCreateDataNode ( - EAmlNodeDataTypeNameString, - (UINT8 *)AmlNameString, - AmlNameStringSize, - &DataNode - ); - if (EFI_ERROR (Status)) { - ASSERT (0); - goto error_handler; - } + Status =3D AmlCreateDataNode ( + EAmlNodeDataTypeNameString, + (UINT8 *)AmlNameString, + AmlNameStringSize, + &DataNode + ); + if (EFI_ERROR (Status)) { + ASSERT_EFI_ERROR (Status); + goto error_handler; + } =20 - // AmlNameString will be freed before returning. + // AmlNameString will be freed be fore returning. =20 - Status =3D AmlVarListAddTail ( - (AML_NODE_HANDLE)PackageNode, - (AML_NODE_HANDLE)DataNode - ); - if (EFI_ERROR (Status)) { - ASSERT (0); - goto error_handler; - } + Status =3D AmlVarListAddTail ( + (AML_NODE_HANDLE)PackageNode, + (AML_NODE_HANDLE)DataNode + ); + if (EFI_ERROR (Status)) { + ASSERT_EFI_ERROR (Status); + goto error_handler; + } + + DataNode =3D NULL; + } else { + Status =3D AmlCodeGenInteger (0, &NewElementNode); + if (EFI_ERROR (Status)) { + ASSERT_EFI_ERROR (Status); + goto error_handler; + } =20 - DataNode =3D NULL; + Status =3D AmlVarListAddTail ( + (AML_NODE_HANDLE)PackageNode, + (AML_NODE_HANDLE)NewElementNode + ); + if (EFI_ERROR (Status)) { + ASSERT_EFI_ERROR (Status); + goto error_handler; + } + } =20 Status =3D AmlCodeGenInteger (SourceIndex, &NewElementNode); if (EFI_ERROR (Status)) { --=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 (#86306): https://edk2.groups.io/g/devel/message/86306 Mute This Topic: https://groups.io/mt/88838057/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 10 19:35: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+86307+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+86307+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1643736172; cv=none; d=zohomail.com; s=zohoarc; b=B5P7wW+BQwsEnu51Ojr66UttNbiv3wUKiPvAGuAu7lD3zKra827vVwg+vm9BBBzRhCN/iIpobsIEHWsPSfTQRYJrLmJQPTlJAZBqDlBtcbzrbOnPK47JHsr1a9pC5K+i2RSqluxTcmvf4LVrcsvJjPtPEUyOSEOqNYcO0TWv+AQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1643736172; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=i3ZEox4nos4aOqVC2UdszKMS5NNkO3AkA5nppLH1hfU=; b=Q6C+T77uo/xgJCx11MotUkleMugvJBVxC204zaDIxVz27UBQVGg5ivagZ/QwyhCK5vcDNBwvMjHCaaKZusx40PlVH5UO3HkdOKoG03yg9Ld+cmRfK0VNB/JgaQglfkOPNSDxnuqFkRUw+bfRryM+/zDT/8yoMmvWcei5LFiwCaY= 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+86307+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 1643736172522297.5379551961055; Tue, 1 Feb 2022 09:22:52 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id JuOGYY1788612xI0fiYhFeEZ; Tue, 01 Feb 2022 09:22:51 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web08.51318.1643736171100978297 for ; Tue, 01 Feb 2022 09:22:51 -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 C5DEE11FB; Tue, 1 Feb 2022 09:22:50 -0800 (PST) X-Received: from e126645.home (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 658B53F40C; Tue, 1 Feb 2022 09:22:49 -0800 (PST) From: "PierreGondois" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Sami Mujawar , Rebecca Cran , Pierre Gondois Subject: [edk2-devel] [PATCH v5 4/9] DynamicTablesPkg: AcpiSsdtPcieLibArm: Remove link device generation Date: Tue, 1 Feb 2022 18:22:47 +0100 Message-Id: <20220201172252.799725-5-Pierre.Gondois@arm.com> In-Reply-To: <20220201172252.799725-1-Pierre.Gondois@arm.com> References: <20220201172252.799725-1-Pierre.Gondois@arm.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: 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,pierre.gondois@arm.com X-Gm-Message-State: Gzy1duDE48n93WXbk4Rq4CLMx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1643736171; bh=XfUzAGiwVrpMHL3PJMil1lFrJaz+XsVXf4n+0CM5drc=; h=Cc:Date:From:Reply-To:Subject:To; b=dGlRDSyues2z6KswzWzh23JKRhs7ODiRrLeT1++pho+5Ns757RMtbdm4AgNO4MVUv8x Ix49+ChFjTmemP8DBrg+DR2rFvjMkkwA/fgcFh1ZyF6VxRdJcIhijKAlO+jCJcx0eqyX6 CD+Dj0I0tBgEMKHAepPFf0IxZPeZngMEuHo= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1643736174756100019 Content-Type: text/plain; charset="utf-8" From: Pierre Gondois In ACPI 6.4, s6.2.13, _PRT objects describing PCI legacy interrupts can be defined following 2 models. In the first model, _PRT entries reference link devices. Link devices then describe interrupts. This allows to dynamically modify interrupts through _SRS and _PRS objects and to choose exactly the interrupt type (level/edge triggered, active high/low). In the second model, interrupt numbder are described in the _PRT entry. The interrupt type is then assumed by the OS. The Arm BSA, sE.6 "Legacy interrupts" states that PCI legacy interrupts must be converted to SPIs, and programmed level-sensitive, active high. Thus any OS must configure interrupts as such and there is no need to specify the interrupt type. Plus it is not possible to dynamically configure PCI interrupts. Thus remove the link device generation and use the second model for _PRT. Suggested-by: Ard Biesheuvel Signed-off-by: Pierre Gondois --- Notes: v4: - New patch. [Ard] .../AcpiSsdtPcieLibArm/SsdtPcieGenerator.c | 239 +----------------- .../AcpiSsdtPcieLibArm/SsdtPcieGenerator.h | 64 +---- 2 files changed, 15 insertions(+), 288 deletions(-) diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieG= enerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieG= enerator.c index 3e22587d4a25..a34018151f2d 100644 --- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerato= r.c +++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerato= r.c @@ -1,7 +1,7 @@ /** @file SSDT Pcie Table Generator. =20 - Copyright (c) 2021, Arm Limited. All rights reserved.
+ Copyright (c) 2021 - 2022, Arm Limited. All rights reserved.
=20 SPDX-License-Identifier: BSD-2-Clause-Patent =20 @@ -12,6 +12,7 @@ - s6.1.1 "_ADR (Address)" - linux kernel code - Arm Base Boot Requirements v1.0 + - Arm Base System Architecture v1.0 **/ =20 #include @@ -279,171 +280,6 @@ GeneratePciDeviceInfo ( return Status; } =20 -/** Generate a Link device. - - The Link device is added at the beginning of the ASL Pci device definiti= on. - - Each Link device represents a Pci legacy interrupt (INTA-...-INTD). - - ASL code: - Device () { - Name (_UID, ]) - Name (_HID, EISAID ("PNP0C0F")) - Name (CRS0, ResourceTemplate () { - Interrupt (ResourceProducer, Level, ActiveHigh, Exclusive) { ] } - }) - Method (_CRS, 0) { - Return CRS0 - }) - Method (_DIS) { } - } - - The list of objects to define is available at: - PCI Firmware Specification - Revision 3.3, - s3.5. "Device State at Firmware/Operating System Handoff" - - The _PRS and _SRS are not supported, cf Arm Base Boot Requirements v1.0: - "The _PRS (Possible Resource Settings) and _SRS (Set Resource Settings) - are not supported." - - @param [in] Irq Interrupt controller interrupt. - @param [in] IrqFlags Interrupt flags. - @param [in] LinkIndex Legacy Pci interrupt index. - Must be between 0-INTA and 3-INTD. - @param [in, out] PciNode Pci node to amend. - - @retval EFI_SUCCESS Success. - @retval EFI_INVALID_PARAMETER Invalid parameter. - @retval EFI_OUT_OF_RESOURCES Failed to allocate memory. -**/ -STATIC -EFI_STATUS -EFIAPI -GenerateLinkDevice ( - IN UINT32 Irq, - IN UINT32 IrqFlags, - IN UINT32 LinkIndex, - IN OUT AML_OBJECT_NODE_HANDLE PciNode - ) -{ - EFI_STATUS Status; - CHAR8 AslName[AML_NAME_SEG_SIZE + 1]; - AML_OBJECT_NODE_HANDLE LinkNode; - AML_OBJECT_NODE_HANDLE CrsNode; - UINT32 EisaId; - - ASSERT (LinkIndex < 4); - ASSERT (PciNode !=3D NULL); - - CopyMem (AslName, "LNKx", AML_NAME_SEG_SIZE + 1); - AslName[AML_NAME_SEG_SIZE - 1] =3D 'A' + LinkIndex; - - // ASL: Device (LNKx) {} - Status =3D AmlCodeGenDevice (AslName, NULL, &LinkNode); - if (EFI_ERROR (Status)) { - ASSERT (0); - return Status; - } - - Status =3D AmlAttachNode (PciNode, LinkNode); - if (EFI_ERROR (Status)) { - ASSERT (0); - // Failed to add. - AmlDeleteTree ((AML_NODE_HANDLE)LinkNode); - return Status; - } - - // ASL: Name (_UID, ) - Status =3D AmlCodeGenNameInteger ("_UID", LinkIndex, LinkNode, NULL); - if (EFI_ERROR (Status)) { - ASSERT (0); - return Status; - } - - // ASL: Name (_HID, EISAID ("PNP0C0F")) - Status =3D AmlGetEisaIdFromString ("PNP0C0F", &EisaId); - if (EFI_ERROR (Status)) { - ASSERT (0); - return Status; - } - - Status =3D AmlCodeGenNameInteger ("_HID", EisaId, LinkNode, NULL); - if (EFI_ERROR (Status)) { - ASSERT (0); - return Status; - } - - // ASL: - // Name (CRS0, ResourceTemplate () { - // Interrupt (ResourceProducer, Level, ActiveHigh, Exclusive) { } - // }) - Status =3D AmlCodeGenNameResourceTemplate ("CRS0", LinkNode, &CrsNode); - if (EFI_ERROR (Status)) { - ASSERT (0); - return Status; - } - - Status =3D AmlCodeGenRdInterrupt ( - FALSE, - (IrqFlags & BIT0) !=3D 0, - (IrqFlags & BIT1) !=3D 0, - FALSE, - &Irq, - 1, - CrsNode, - NULL - ); - if (EFI_ERROR (Status)) { - ASSERT (0); - return Status; - } - - // ASL: - // Method (_CRS, 0) { - // Return (CRS0) - // } - Status =3D AmlCodeGenMethodRetNameString ( - "_CRS", - "CRS0", - 0, - FALSE, - 0, - LinkNode, - NULL - ); - if (EFI_ERROR (Status)) { - ASSERT (0); - return Status; - } - - // ASL:Method (_DIS, 1) {} - // Not possible to disable interrupts. - Status =3D AmlCodeGenMethodRetNameString ( - "_DIS", - NULL, - 0, - FALSE, - 0, - LinkNode, - NULL - ); - if (EFI_ERROR (Status)) { - ASSERT (0); - return Status; - } - - // _STA: - // ACPI 6.4, s6.3.7 "_STA (Device Status)": - // If a device object describes a device that is not on an enumerable bus - // and the device object does not have an _STA object, then OSPM assumes - // that the device is present, enabled, shown in the UI, and functioning. - - // _MAT: - // Not supported. Mainly used for processors. - - return Status; -} - /** Generate Pci slots devices. =20 PCI Firmware Specification - Revision 3.3, @@ -556,14 +392,10 @@ GeneratePrt ( { EFI_STATUS Status; INT32 Index; - UINT32 IrqTableIndex; AML_OBJECT_NODE_HANDLE PrtNode; - CHAR8 AslName[AML_NAME_SEG_SIZE + 1]; CM_ARM_OBJ_REF *RefInfo; UINT32 RefCount; CM_ARM_PCI_INTERRUPT_MAP_INFO *IrqMapInfo; - UINT32 IrqFlags; - UINT32 PrevIrqFlags; =20 ASSERT (Generator !=3D NULL); ASSERT (CfgMgrProtocol !=3D NULL); @@ -585,13 +417,6 @@ GeneratePrt ( return Status; } =20 - // Initialized IrqTable. - Status =3D MappingTableInitialize (&Generator->IrqTable, RefCount); - if (EFI_ERROR (Status)) { - ASSERT (0); - return Status; - } - // Initialized DeviceTable. Status =3D MappingTableInitialize (&Generator->DeviceTable, RefCount); if (EFI_ERROR (Status)) { @@ -606,8 +431,6 @@ GeneratePrt ( goto exit_handler; } =20 - CopyMem (AslName, "LNKx", AML_NAME_SEG_SIZE + 1); - for (Index =3D 0; Index < RefCount; Index++) { // Get CM_ARM_PCI_INTERRUPT_MAP_INFO structures one by one. Status =3D GetEArmObjPciInterruptMapInfo ( @@ -621,25 +444,15 @@ GeneratePrt ( goto exit_handler; } =20 - // Add the interrupt in the IrqTable and get the link name. - IrqTableIndex =3D MappingTableAdd ( - &Generator->IrqTable, - IrqMapInfo->IntcInterrupt.Interrupt - ); - if (IrqTableIndex >=3D MAX_PCI_LEGACY_INTERRUPT) { - ASSERT (0); - Status =3D EFI_INVALID_PARAMETER; - goto exit_handler; - } - - AslName[AML_NAME_SEG_SIZE - 1] =3D 'A' + IrqTableIndex; - - // Check that the interrupts flags are identical for all interrupts. - PrevIrqFlags =3D IrqFlags; - IrqFlags =3D IrqMapInfo->IntcInterrupt.Flags; - if ((Index > 0) && (PrevIrqFlags !=3D IrqFlags)) { - ASSERT (0); + // Check that the interrupts flags are SPIs, level high. + // Cf. Arm BSA v1.0, sE.6 "Legacy interrupts" + if ((Index > 0) && + (IrqMapInfo->IntcInterrupt.Interrupt >=3D 32) && + (IrqMapInfo->IntcInterrupt.Interrupt < 1020) && + ((IrqMapInfo->IntcInterrupt.Flags & 0x3) !=3D BIT0)) + { Status =3D EFI_INVALID_PARAMETER; + ASSERT_EFI_ERROR (Status); goto exit_handler; } =20 @@ -662,8 +475,8 @@ GeneratePrt ( Status =3D AmlAddPrtEntry ( (IrqMapInfo->PciDevice << 16) | 0xFFFF, IrqMapInfo->PciInterrupt, - AslName, - 0, + NULL, + IrqMapInfo->IntcInterrupt.Interrupt, PrtNode ); if (EFI_ERROR (Status)) { @@ -672,24 +485,10 @@ GeneratePrt ( } } // for =20 - // Generate the LNKx devices now that we know all the interrupts used. - for (Index =3D 0; Index < Generator->IrqTable.LastIndex; Index++) { - Status =3D GenerateLinkDevice ( - Generator->IrqTable.Table[Index], - IrqFlags, - Index, - PciNode - ); - if (EFI_ERROR (Status)) { - ASSERT (0); - goto exit_handler; - } - } // for - - // Attach the _PRT entry now, after the LNKx devices. + // Attach the _PRT entry. Status =3D AmlAttachNode (PciNode, PrtNode); if (EFI_ERROR (Status)) { - ASSERT (0); + ASSERT_EFI_ERROR (Status); goto exit_handler; } =20 @@ -705,7 +504,6 @@ GeneratePrt ( exit_handler: MappingTableFree (&Generator->DeviceTable); exit_handler0: - MappingTableFree (&Generator->IrqTable); if (PrtNode !=3D NULL) { AmlDeleteTree (PrtNode); } @@ -1382,15 +1180,6 @@ ACPI_PCI_GENERATOR SsdtPcieGenerator =3D { =20 // Private fields are defined from here. =20 - // IrqTable - { - // Table - NULL, - // LastIndex - 0, - // MaxIndex - 0 - }, // DeviceTable { // Table diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieG= enerator.h b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieG= enerator.h index d1e5465e1346..59a0d601a36d 100644 --- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerato= r.h +++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerato= r.h @@ -33,12 +33,6 @@ */ #define MAX_PCI_ROOT_COMPLEXES_SUPPORTED 16 =20 -/** Maximum number of Pci legacy interrupts. - - Currently 4 for INTA-INTB-INTC-INTD. -*/ -#define MAX_PCI_LEGACY_INTERRUPT 4 - // _SB scope of the AML namespace. #define SB_SCOPE "\\_SB_" =20 @@ -73,64 +67,8 @@ typedef struct AcpiPcieGenerator { =20 // Private fields are defined from here. =20 - /** A structure used to handle the Address and Interrupt Map referencing. - - A CM_ARM_PCI_CONFIG_SPACE_INFO structure references two CM_ARM_OBJ_REF: - - one for the address mapping, referencing - CM_ARM_PCI_ADDRESS_MAP_INFO structures. - - one for the interrupt mapping, referencing - CM_ARM_PCI_INTERRUPT_MAP_INFO structures. - - Example: - (Pci0) - CM_ARM_PCI_CONFIG_SPACE_INFO - | - +---------------------------------------- - | | - v v - CM_ARM_OBJ_REF CM_ARM_OBJ_REF - (List of references to (List of references to - address mappings) interrupt mappings) - | | - v v - CM_ARM_PCI_ADDRESS_MAP_INFO[0..N] CM_ARM_PCI_INTERRUPT_MAP_INFO[0= ..M] - (A list of address mappings) (A list of interrupt mappings) - - The CM_ARM_PCI_INTERRUPT_MAP_INFO objects cannot be handled individual= ly. - Device's Pci legacy interrupts that are mapped to the same CPU interru= pt - are grouped under a Link device. - For instance, the following mapping: - - [INTA of device 0] mapped on [GIC irq 168] - - [INTB of device 1] mapped on [GIC irq 168] - will be represented in an SSDT table as: - - [INTA of device 0] mapped on [Link device A] - - [INTB of device 1] mapped on [Link device A] - - [Link device A] mapped on [GIC irq 168] - - Counting the number of Cpu interrupts used and grouping them in Link - devices is done through this IRQ_TABLE. - - ASL code: - Scope (_SB) { - Device (LNKA) { - [...] - Name (_PRS, ResourceTemplate () { - Interrupt (ResourceProducer, Level, ActiveHigh, Exclusive) { 168= } - }) - } - - Device (PCI0) { - Name (_PRT, Package () { - Package (0x0FFFF, 0, LNKA, 0) // INTA of device 0 <-> LNKA - Package (0x1FFFF, 1, LNKA, 0) // INTB of device 1 <-> LNKA - }) - } - } - */ - MAPPING_TABLE IrqTable; - /// Table to map: Index <-> Pci device - MAPPING_TABLE DeviceTable; + MAPPING_TABLE DeviceTable; } ACPI_PCI_GENERATOR; =20 #pragma pack() --=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 (#86307): https://edk2.groups.io/g/devel/message/86307 Mute This Topic: https://groups.io/mt/88838058/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 10 19:35: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+86308+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+86308+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1643736173; cv=none; d=zohomail.com; s=zohoarc; b=Zh7xvFnaRWXZJFDUKikeUZx03OP087q4Wu2FQ7BYZ+UrDxa6MxEf6WKAsGmwz/MpD7O57y6sVmcjD8NcacIliy0GLakkevQKXp2EA6ugHpKXNChrX6qI82b4GCmvO9DM1YFxnmVgxONLxxrFfJ4PEcGovr7BK8Qkc1OQfj95G3M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1643736173; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=WEnKhy90fbutpjhXFd0UEmNXIa8cNcvFF06xh6LoPJY=; b=UN/NYmog+WeyYOa3MVGX0kE2s5nrru4oru1kSJtM1VG4+nYMyE5neelg4vQCVjdGnjA5saSMeIaFNwmdyJOt1d3jMhnfsyArSkVfW/Pnp9EecQfkow5GUVZDkjdf4ujuk/bWUPkhyGDa39zaCimq/tyjVduzKvvDJeOMZP/v4w8= 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+86308+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 16437361738181023.8568323384495; Tue, 1 Feb 2022 09:22:53 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id jA7CYY1788612xJWklPltGgm; Tue, 01 Feb 2022 09:22:53 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web11.51795.1643736172607439198 for ; Tue, 01 Feb 2022 09:22:52 -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 4201D11B3; Tue, 1 Feb 2022 09:22:52 -0800 (PST) X-Received: from e126645.home (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 27EDA3F40C; Tue, 1 Feb 2022 09:22:50 -0800 (PST) From: "PierreGondois" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Sami Mujawar , Rebecca Cran , Pierre Gondois Subject: [edk2-devel] [PATCH v5 5/9] ArmVirtPkg: Add cspell exceptions Date: Tue, 1 Feb 2022 18:22:48 +0100 Message-Id: <20220201172252.799725-6-Pierre.Gondois@arm.com> In-Reply-To: <20220201172252.799725-1-Pierre.Gondois@arm.com> References: <20220201172252.799725-1-Pierre.Gondois@arm.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: 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,pierre.gondois@arm.com X-Gm-Message-State: YBF6N0uELCHAPNEBxc6jbrBfx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1643736173; bh=gpSZNbvMqEoNky2WV4BO5lTA672HaX5xjHiwrgy8bBI=; h=Cc:Date:From:Reply-To:Subject:To; b=N0k8E8bdyNYgBNEaX4NkNMybDIrjrFnFXqEYeq04vckVw9VEWJ6BYyRccEN9p7VnJsT 0tlOc6kxztrCsy4CPN4q+1x5SWhOzy2/mf1Di2Bvev5yYXHYZpwzzKtU+Z9gxntKXthT3 +v2xpuAVegjgWBgwCeFdHaCo2RV9wBdiU9s= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1643736175103100021 Content-Type: text/plain; charset="utf-8" From: Pierre Gondois The cpsell tool checks for unknown words in the upstream CI. Add some new words to the list of exceptions. Signed-off-by: Pierre Gondois --- Notes: v2: - Adding 'acpiview'. Since the patch change, Laszlo's Reviewed-by is not added. [Pierre] ArmVirtPkg/ArmVirtPkg.ci.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ArmVirtPkg/ArmVirtPkg.ci.yaml b/ArmVirtPkg/ArmVirtPkg.ci.yaml index 67b0e9594f3e..d5d63ddd4fd7 100644 --- a/ArmVirtPkg/ArmVirtPkg.ci.yaml +++ b/ArmVirtPkg/ArmVirtPkg.ci.yaml @@ -6,7 +6,7 @@ # # Copyright (c) Microsoft Corporation # Copyright (c) 2020, Intel Corporation. All rights reserved.
-# Copyright (c) 2020, ARM Limited. All rights reserved. +# Copyright (c) 2020 - 2022, ARM Limited. All rights reserved.
# # SPDX-License-Identifier: BSD-2-Clause-Patent ## @@ -48,6 +48,7 @@ "MdePkg/MdePkg.dec", "MdeModulePkg/MdeModulePkg.dec", "ArmVirtPkg/ArmVirtPkg.dec", + "DynamicTablesPkg/DynamicTablesPkg.dec", "NetworkPkg/NetworkPkg.dec", "ArmPkg/ArmPkg.dec", "OvmfPkg/OvmfPkg.dec", @@ -98,6 +99,9 @@ "AuditOnly": False, # Fails right now with over 270 erro= rs "IgnoreFiles": [], # use gitignore syntax to ignore erro= rs in matching files "ExtendWords": [ + "acpiview", + "armltd", + "ssdts", "setjump", "plong", "lparam", --=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 (#86308): https://edk2.groups.io/g/devel/message/86308 Mute This Topic: https://groups.io/mt/88838059/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 10 19:35: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+86309+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+86309+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1643736175; cv=none; d=zohomail.com; s=zohoarc; b=msVm6C05YftOVWqwnFzdv+iUYt+crwdaP5RGBIqpF8K21pqDLUgL9ValLt8HfXgukPyqqccYMgQid8QkVqRLfDPsG7zj+ALwjKwn+2EzMhzPlyeL34b2A6nE4tKxmJbtmZCdIm6vIwXL/BTXf8096Gen9OqgAeZWwVvIzIlMSYU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1643736175; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=zbt+D4sz2TXXLNHghbcAuwK2gHSn1FomabcemXGfQCE=; b=MsNI7JYpbh/D4KusZa7wftorcfMBtbp/LOF/dvBZgthg7y/HDMc6z2YagJS+KdVuvbmV9K5+DL2khUk7tdksoE/ZGoI93C/HXQJfKRcWyjNx1yqgvugYdvIZc1F4/SPc22zNre2dlbc4ldZJLGSWVzVmXUonMz3gTCrckGzH44g= 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+86309+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 1643736175538453.91591900335834; Tue, 1 Feb 2022 09:22:55 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id VFHVYY1788612xcCmFxrXZfL; Tue, 01 Feb 2022 09:22:55 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web08.51319.1643736174277428485 for ; Tue, 01 Feb 2022 09:22:54 -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 E71E011FB; Tue, 1 Feb 2022 09:22:53 -0800 (PST) X-Received: from e126645.home (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id AAE633F40C; Tue, 1 Feb 2022 09:22:52 -0800 (PST) From: "PierreGondois" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Sami Mujawar , Rebecca Cran , Pierre Gondois Subject: [edk2-devel] [PATCH v5 6/9] ArmVirtPkg/Kvmtool: Add DSDT ACPI table Date: Tue, 1 Feb 2022 18:22:49 +0100 Message-Id: <20220201172252.799725-7-Pierre.Gondois@arm.com> In-Reply-To: <20220201172252.799725-1-Pierre.Gondois@arm.com> References: <20220201172252.799725-1-Pierre.Gondois@arm.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: 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,pierre.gondois@arm.com X-Gm-Message-State: eky43jUv9dAHasybyeveVZrcx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1643736175; bh=W6fwb2emYLTx3VQkPaugF7YkEPSDgSsX43iOMQzIp10=; h=Cc:Date:From:Reply-To:Subject:To; b=wlRSLAFrgeIDhuEldSJdW/SezacLtTnVwYL1+KY6t7zMgx+dfeb3OchA8TntzsTSgnS u2TvSWHFW4XhkuqYRfms/9OKaVhuDAwdnIwrXmwVG+JUDmuRt8ZJbPTET0JgW7Xcv1MHM ajmQa3DcXbfwGmJdHAxGC41PT4+vNwO9USE= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1643736177693100027 Content-Type: text/plain; charset="utf-8" From: Sami Mujawar Most ACPI tables for Kvmtool firmware are dynamically generated. The AML code is also generated at runtime for most components in appropriate SSDTs. Although there may not be much to describe in the DSDT, the DSDT table is mandatory. Therefore, add an empty stub for DSDT. Signed-off-by: Sami Mujawar Signed-off-by: Pierre Gondois Reviewed-by: Laszlo Ersek --- Notes: v2: - Coding style modifications. [Laszlo] v5: - Update DSDT table revision to 2. [Rebecca] .../KvmtoolCfgMgrDxe/AslTables/Dsdt.asl | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 ArmVirtPkg/KvmtoolCfgMgrDxe/AslTables/Dsdt.asl diff --git a/ArmVirtPkg/KvmtoolCfgMgrDxe/AslTables/Dsdt.asl b/ArmVirtPkg/Kv= mtoolCfgMgrDxe/AslTables/Dsdt.asl new file mode 100644 index 000000000000..13d1e1d8d6bd --- /dev/null +++ b/ArmVirtPkg/KvmtoolCfgMgrDxe/AslTables/Dsdt.asl @@ -0,0 +1,21 @@ +/** @file + Differentiated System Description Table Fields (DSDT) + + Copyright (c) 2021 - 2022, ARM Ltd. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +DefinitionBlock ("DsdtTable.aml", "DSDT", 2, "ARMLTD", "ARM-KVMT", 1) { + Scope (_SB) { + // + // Most ACPI tables for Kvmtool firmware are + // dynamically generated. The AML code is also + // generated at runtime for most components in + // appropriate SSDTs. + // Although there may not be much to describe + // in the DSDT, the DSDT table is mandatory. + // Therefore, add an empty stub for DSDT. + // + } // 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 (#86309): https://edk2.groups.io/g/devel/message/86309 Mute This Topic: https://groups.io/mt/88838060/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 10 19:35: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+86310+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+86310+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1643736177; cv=none; d=zohomail.com; s=zohoarc; b=R4ngMrRhan3peCxCpoxtUGgVtAQ0f7Ze9h2Tcwj7MDxQg5Cg0b9fV8bFIOmr/ALn6lzw99Mgnqi7tPRtgU5uobUBblGo8x1SQ+ky2x/r/hGEEv1VJtogayexE5mWD0rXrADHuvKZxCy2ELMwamyyYZGlz77mXmwnI9iuhRIn5VA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1643736177; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=DvYl9B5O4MWTKDcq0VFnuEPu5eSqmjm8qrAJIpZYb7s=; b=d+Pn5N9CNuGQqq4SDrycDQHS3TbXhsakg8K/jJDc+7E8WPjMmHatFlPaWGt4MIA5aVYTtpY8Go8bchCuzQulmwzsQw8eYawvV5iuO3pLvcjpsr8A1eZ55kTWnzwNEL5t+54iEU9mz7cFVS0CfiVohVTXwPuEk1b81/AnV9hEP8E= 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+86310+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 1643736177836945.5724067732023; Tue, 1 Feb 2022 09:22:57 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id a9Q5YY1788612xBqMhQHNsnB; Tue, 01 Feb 2022 09:22:57 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web12.51381.1643736176261024064 for ; Tue, 01 Feb 2022 09:22:56 -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 D9DF711B3; Tue, 1 Feb 2022 09:22:55 -0800 (PST) X-Received: from e126645.home (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 529963F40C; Tue, 1 Feb 2022 09:22:54 -0800 (PST) From: "PierreGondois" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Sami Mujawar , Rebecca Cran , Pierre Gondois Subject: [edk2-devel] [PATCH v5 7/9] ArmVirtPkg/Kvmtool: Add Configuration Manager Date: Tue, 1 Feb 2022 18:22:50 +0100 Message-Id: <20220201172252.799725-8-Pierre.Gondois@arm.com> In-Reply-To: <20220201172252.799725-1-Pierre.Gondois@arm.com> References: <20220201172252.799725-1-Pierre.Gondois@arm.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: 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,pierre.gondois@arm.com X-Gm-Message-State: Iiu35zsX0VsZJkP1gahylGv0x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1643736177; bh=ViTd9MIxwnImWIuqXovrmtCIfzqDVzv4puak4bk9h3Y=; h=Cc:Date:From:Reply-To:Subject:To; b=vyhmwIrH1eOnbvuy/AGE7Jj+kUnFbRQ1oSJMJ2eGIAs6wpW9dfc9xea4d74a95tDr29 VbxQgW23Coi9iLcc8wQvRkOd3k8w8f3FrLsx1caJpri1tS3YhtHvpRgqECLfNlcFpqQ6p cqeZFowyiZWhF+jwc3JgkoZcgUzVbyrQXP4= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1643736180351100031 Content-Type: text/plain; charset="utf-8" From: Sami Mujawar Add Configuration Manager to enable ACPI tables for Kvmtool firmware. The Configuration Manager for Kvmtool uses the DT Hardware Information Parser module (FdtHwInfoParser) to parse the DT provided by Kvmtool. The FdtHwInfoParser parses the DT and invokes the callback function HW_INFO_ADD_OBJECT to add the Configuration Manager objects to the Platform Information repository. The information for some Configuration Manager objects may not be available in the DT. Such objects are initialised locally by the Configuration Manager. Support for the following ACPI tables is provided: - DBG2 - DSDT (Empty stub) - FADT - GTDT - MADT - SPCR - SSDT (Cpu Hierarchy) - SSDT (Pcie bus) Signed-off-by: Sami Mujawar Signed-off-by: Pierre Gondois Acked-by: Laszlo Ersek --- Notes: v2: - Only keep AARCH64 as a valid architecture. [Laszlo] - Move modifications to ArmVirtKvmTool.dsc to the next patch. [Laszlo] - Various coding style/error handling/ASSERT corrections. [Laszlo] - Remove dependency to PcdForceNoAcpi and rely on DEPEX to load the module. [Laszlo] - Not possible to make 'struct PlatformRepositoryInfo' an unamed struct since this is a redifinition. [Laszlo/Pierre] - Define 'FMT_CM_OBJECT_ID' print formatter in an earlier patch and use it in this patch. [Laszlo/Pierre] =20 v3: - Add address size limit for IORT PCI root complex. [Pierre] .../KvmtoolCfgMgrDxe/ConfigurationManager.c | 1065 +++++++++++++++++ .../KvmtoolCfgMgrDxe/ConfigurationManager.h | 125 ++ .../ConfigurationManagerDxe.inf | 54 + 3 files changed, 1244 insertions(+) create mode 100644 ArmVirtPkg/KvmtoolCfgMgrDxe/ConfigurationManager.c create mode 100644 ArmVirtPkg/KvmtoolCfgMgrDxe/ConfigurationManager.h create mode 100644 ArmVirtPkg/KvmtoolCfgMgrDxe/ConfigurationManagerDxe.inf diff --git a/ArmVirtPkg/KvmtoolCfgMgrDxe/ConfigurationManager.c b/ArmVirtPk= g/KvmtoolCfgMgrDxe/ConfigurationManager.c new file mode 100644 index 000000000000..e8c1b13c8f2c --- /dev/null +++ b/ArmVirtPkg/KvmtoolCfgMgrDxe/ConfigurationManager.c @@ -0,0 +1,1065 @@ +/** @file + Configuration Manager Dxe + + Copyright (c) 2021 - 2022, Arm Limited. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Glossary: + - Cm or CM - Configuration Manager + - Obj or OBJ - Object +**/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "ConfigurationManager.h" + +// +// The platform configuration repository information. +// +STATIC +EDKII_PLATFORM_REPOSITORY_INFO mKvmtoolPlatRepositoryInfo =3D { + // + // Configuration Manager information + // + { CONFIGURATION_MANAGER_REVISION, CFG_MGR_OEM_ID }, + + // + // ACPI Table List + // + { + // + // FADT Table + // + { + EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE, + EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE_REVISION, + CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdFadt), + NULL + }, + // + // GTDT Table + // + { + EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE_SIGNATURE, + EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE_REVISION, + CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdGtdt), + NULL + }, + // + // MADT Table + // + { + EFI_ACPI_6_3_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE, + EFI_ACPI_6_3_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION, + CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdMadt), + NULL + }, + // + // SPCR Table + // + { + EFI_ACPI_6_3_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_SIGNATURE, + EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_REVISION, + CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdSpcr), + NULL + }, + // + // DSDT Table + // + { + EFI_ACPI_6_3_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE, + 0, // Unused + CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdDsdt), + (EFI_ACPI_DESCRIPTION_HEADER *)dsdt_aml_code + }, + // + // SSDT Cpu Hierarchy Table + // + { + EFI_ACPI_6_3_SECONDARY_SYSTEM_DESCRIPTION_TABLE_SIGNATURE, + 0, // Unused + CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdSsdtCpuTopology), + NULL + }, + // + // DBG2 Table + // + { + EFI_ACPI_6_3_DEBUG_PORT_2_TABLE_SIGNATURE, + EFI_ACPI_DBG2_DEBUG_DEVICE_INFORMATION_STRUCT_REVISION, + CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdDbg2), + NULL + }, + // + // PCI MCFG Table + // + { + EFI_ACPI_6_3_PCI_EXPRESS_MEMORY_MAPPED_CONFIGURATION_SPACE_BASE_ADDR= ESS_DESCRIPTION_TABLE_SIGNATURE, + EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_SPACE_ACCESS_TABLE_REVISION, + CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdMcfg), + NULL + }, + // + // SSDT table describing the PCI root complex + // + { + EFI_ACPI_6_3_SECONDARY_SYSTEM_DESCRIPTION_TABLE_SIGNATURE, + 0, // Unused + CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdSsdtPciExpress), + NULL + }, + // + // IORT Table + // + { + EFI_ACPI_6_3_IO_REMAPPING_TABLE_SIGNATURE, + EFI_ACPI_IO_REMAPPING_TABLE_REVISION, + CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdIort), + NULL + }, + }, + + // + // Power management profile information + // + { EFI_ACPI_6_3_PM_PROFILE_ENTERPRISE_SERVER }, // PowerManagement Pro= file + + // + // ITS group node + // + { + // + // Reference token for this Iort node + // + REFERENCE_TOKEN (ItsGroupInfo), + // + // The number of ITS identifiers in the ITS node. + // + 1, + // + // Reference token for the ITS identifier array + // + REFERENCE_TOKEN (ItsIdentifierArray) + }, + + // + // ITS identifier array + // + { + { 0 }, // The ITS Identifier + }, + + // + // Root Complex node info + // + { + // + // Reference token for this Iort node + // + REFERENCE_TOKEN (RootComplexInfo), + // + // Number of ID mappings + // + 1, + // + // Reference token for the ID mapping array + // + REFERENCE_TOKEN (DeviceIdMapping[0]), + // + // Memory access properties : Cache coherent attributes + // + EFI_ACPI_IORT_MEM_ACCESS_PROP_CCA, + // + // Memory access properties : Allocation hints + // + 0, + // + // Memory access properties : Memory access flags + // + 0, + // + // ATS attributes + // + EFI_ACPI_IORT_ROOT_COMPLEX_ATS_UNSUPPORTED, + // + // PCI segment number + // + 0, + /// + /// Memory address size limit + /// + MEMORY_ADDRESS_SIZE_LIMIT + }, + + // + // Array of Device ID mappings + // + { + // + // Device ID mapping for Root complex node + // RootComplex -> ITS Group + // + { + // + // Input base + // + 0x0, + // + // Number of input IDs + // + 0x0000FFFF, + // + // Output Base + // + 0x0, + // + // Output reference + // + REFERENCE_TOKEN (ItsGroupInfo), + // + // Flags + // + 0 + }, + }, +}; + +/** + A helper function for returning the Configuration Manager Objects. + + @param [in] CmObjectId The Configuration Manager Object ID. + @param [in] Object Pointer to the Object(s). + @param [in] ObjectSize Total size of the Object(s). + @param [in] ObjectCount Number of Objects. + @param [in, out] CmObjectDesc Pointer to the Configuration Manager Ob= ject + descriptor describing the requested Obj= ect. + + @retval EFI_SUCCESS Success. +**/ +STATIC +EFI_STATUS +EFIAPI +HandleCmObject ( + IN CONST CM_OBJECT_ID CmObjectId, + IN VOID *Object, + IN CONST UINTN ObjectSize, + IN CONST UINTN ObjectCount, + IN OUT CM_OBJ_DESCRIPTOR *CONST CmObjectDesc + ) +{ + CmObjectDesc->ObjectId =3D CmObjectId; + CmObjectDesc->Size =3D ObjectSize; + CmObjectDesc->Data =3D Object; + CmObjectDesc->Count =3D ObjectCount; + DEBUG (( + DEBUG_INFO, + "INFO: CmObjectId =3D " FMT_CM_OBJECT_ID ", " + "Ptr =3D 0x%p, Size =3D %lu, Co= unt =3D %lu\n", + CmObjectId, + CmObjectDesc->Data, + CmObjectDesc->Size, + CmObjectDesc->Count + )); + return EFI_SUCCESS; +} + +/** + A helper function for returning the Configuration Manager Objects that + match the token. + + @param [in] This Pointer to the Configuration Manager Pro= tocol. + @param [in] CmObjectId The Configuration Manager Object ID. + @param [in] Object Pointer to the Object(s). + @param [in] ObjectSize Total size of the Object(s). + @param [in] ObjectCount Number of Objects. + @param [in] Token A token identifying the object. + @param [in] HandlerProc A handler function to search the object + referenced by the token. + @param [in, out] CmObjectDesc Pointer to the Configuration Manager Obj= ect + descriptor describing the requested Obje= ct. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER A parameter is invalid. + @retval EFI_NOT_FOUND The required object information is not fou= nd. +**/ +STATIC +EFI_STATUS +EFIAPI +HandleCmObjectRefByToken ( + IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST This, + IN CONST CM_OBJECT_ID CmObjectId, + IN VOID *Object, + IN CONST UINTN ObjectSize, + IN CONST UINTN ObjectCount, + IN CONST CM_OBJECT_TOKEN Token, + IN CONST CM_OBJECT_HANDLER_PROC HandlerProc, + IN OUT CM_OBJ_DESCRIPTOR *CONST CmObjectDesc + ) +{ + EFI_STATUS Status; + + CmObjectDesc->ObjectId =3D CmObjectId; + if (Token =3D=3D CM_NULL_TOKEN) { + CmObjectDesc->Size =3D ObjectSize; + CmObjectDesc->Data =3D Object; + CmObjectDesc->Count =3D ObjectCount; + Status =3D EFI_SUCCESS; + } else { + Status =3D HandlerProc (This, CmObjectId, Token, CmObjectDesc); + } + + DEBUG (( + DEBUG_INFO, + "INFO: Token =3D 0x%p, CmObjectId =3D " FMT_CM_OBJECT_ID ", " + "Ptr =3D 0x%p, Si= ze =3D %lu, Count =3D %lu\n", + (VOID *)Token, + CmObjectId, + CmObjectDesc->Data, + CmObjectDesc->Size, + CmObjectDesc->Count + )); + return Status; +} + +/** + Return an ITS identifier array. + + @param [in] This Pointer to the Configuration Manager Protocol. + @param [in] CmObjectId The Configuration Manager Object ID. + @param [in] Token A token for identifying the object + @param [out] CmObject Pointer to the Configuration Manager Object + descriptor describing the requested Object. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER A parameter is invalid. + @retval EFI_NOT_FOUND The required object information is not fou= nd. +**/ +EFI_STATUS +EFIAPI +GetItsIdentifierArray ( + IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST This, + IN CONST CM_OBJECT_ID CmObjectId, + IN CONST CM_OBJECT_TOKEN Token, + OUT CM_OBJ_DESCRIPTOR *CONST CmObject + ) +{ + EDKII_PLATFORM_REPOSITORY_INFO *PlatformRepo; + + if ((This =3D=3D NULL) || (CmObject =3D=3D NULL)) { + ASSERT (This !=3D NULL); + ASSERT (CmObject !=3D NULL); + return EFI_INVALID_PARAMETER; + } + + PlatformRepo =3D This->PlatRepoInfo; + + if (Token !=3D (CM_OBJECT_TOKEN)&PlatformRepo->ItsIdentifierArray) { + return EFI_NOT_FOUND; + } + + CmObject->ObjectId =3D CmObjectId; + CmObject->Size =3D sizeof (PlatformRepo->ItsIdentifierArray); + CmObject->Data =3D (VOID *)&PlatformRepo->ItsIdentifierArray; + CmObject->Count =3D ARRAY_SIZE (PlatformRepo->ItsIdentifierArray); + return EFI_SUCCESS; +} + +/** + Return a device Id mapping array. + + @param [in] This Pointer to the Configuration Manager Protocol. + @param [in] CmObjectId The Configuration Manager Object ID. + @param [in] Token A token for identifying the object + @param [out] CmObject Pointer to the Configuration Manager Object + descriptor describing the requested Object. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER A parameter is invalid. + @retval EFI_NOT_FOUND The required object information is not fou= nd. +**/ +EFI_STATUS +EFIAPI +GetDeviceIdMappingArray ( + IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST This, + IN CONST CM_OBJECT_ID CmObjectId, + IN CONST CM_OBJECT_TOKEN Token, + OUT CM_OBJ_DESCRIPTOR *CONST CmObject + ) +{ + EDKII_PLATFORM_REPOSITORY_INFO *PlatformRepo; + + if ((This =3D=3D NULL) || (CmObject =3D=3D NULL)) { + ASSERT (This !=3D NULL); + ASSERT (CmObject !=3D NULL); + return EFI_INVALID_PARAMETER; + } + + PlatformRepo =3D This->PlatRepoInfo; + + if (Token !=3D (CM_OBJECT_TOKEN)&PlatformRepo->DeviceIdMapping[0]) { + return EFI_NOT_FOUND; + } + + CmObject->ObjectId =3D CmObjectId; + CmObject->Size =3D sizeof (CM_ARM_ID_MAPPING); + CmObject->Data =3D (VOID *)Token; + CmObject->Count =3D 1; + return EFI_SUCCESS; +} + +/** + Function pointer called by the parser to add information. + + Callback function that the parser can use to add new + CmObj. This function must copy the CmObj data and not rely on + the parser preserving the CmObj memory. + This function is responsible of the Token allocation. + + @param [in] ParserHandle A handle to the parser instance. + @param [in] Context A pointer to the caller's context provided in + HwInfoParserInit (). + @param [in] CmObjDesc CM_OBJ_DESCRIPTOR containing the CmObj(s) to= add. + @param [out] Token If provided and success, contain the token + generated for the CmObj. + + @retval EFI_SUCCESS The function completed successfully. + @retval EFI_INVALID_PARAMETER Invalid parameter. +**/ +STATIC +EFI_STATUS +EFIAPI +HwInfoAdd ( + IN HW_INFO_PARSER_HANDLE ParserHandle, + IN VOID *Context, + IN CONST CM_OBJ_DESCRIPTOR *CmObjDesc, + OUT CM_OBJECT_TOKEN *Token OPTIONAL + ) +{ + EFI_STATUS Status; + EDKII_PLATFORM_REPOSITORY_INFO *PlatformRepo; + + if ((ParserHandle =3D=3D NULL) || + (Context =3D=3D NULL) || + (CmObjDesc =3D=3D NULL)) + { + ASSERT (ParserHandle !=3D NULL); + ASSERT (Context !=3D NULL); + ASSERT (CmObjDesc !=3D NULL); + return EFI_INVALID_PARAMETER; + } + + PlatformRepo =3D (EDKII_PLATFORM_REPOSITORY_INFO *)Context; + + DEBUG_CODE_BEGIN (); + // + // Print the received objects. + // + ParseCmObjDesc (CmObjDesc); + DEBUG_CODE_END (); + + Status =3D DynPlatRepoAddObject ( + PlatformRepo->DynamicPlatformRepo, + CmObjDesc, + Token + ); + if (EFI_ERROR (Status)) { + ASSERT_EFI_ERROR (Status); + } + + return Status; +} + +/** + Cleanup the platform configuration repository. + + @param [in] This Pointer to the Configuration Manager Protocol. + + @retval EFI_SUCCESS Success + @retval EFI_INVALID_PARAMETER A parameter is invalid. +**/ +STATIC +EFI_STATUS +EFIAPI +CleanupPlatformRepository ( + IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST This + ) +{ + EFI_STATUS Status; + EDKII_PLATFORM_REPOSITORY_INFO *PlatformRepo; + + if (This =3D=3D NULL) { + ASSERT (This !=3D NULL); + return EFI_INVALID_PARAMETER; + } + + PlatformRepo =3D This->PlatRepoInfo; + + // + // Shutdown the dynamic repo and free all objects. + // + Status =3D DynamicPlatRepoShutdown (PlatformRepo->DynamicPlatformRepo); + if (EFI_ERROR (Status)) { + ASSERT_EFI_ERROR (Status); + return Status; + } + + // + // Shutdown parser. + // + Status =3D HwInfoParserShutdown (PlatformRepo->FdtParserHandle); + if (EFI_ERROR (Status)) { + ASSERT_EFI_ERROR (Status); + } + + return Status; +} + +/** + Initialize the platform configuration repository. + + @param [in] This Pointer to the Configuration Manager Protocol. + + @retval EFI_SUCCESS Success + @retval EFI_INVALID_PARAMETER A parameter is invalid. + @retval EFI_OUT_OF_RESOURCES An allocation has failed. +**/ +STATIC +EFI_STATUS +EFIAPI +InitializePlatformRepository ( + IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST This + ) +{ + EFI_STATUS Status; + EDKII_PLATFORM_REPOSITORY_INFO *PlatformRepo; + VOID *Hob; + + if (This =3D=3D NULL) { + ASSERT (This !=3D NULL); + return EFI_INVALID_PARAMETER; + } + + Hob =3D GetFirstGuidHob (&gFdtHobGuid); + if ((Hob =3D=3D NULL) || (GET_GUID_HOB_DATA_SIZE (Hob) !=3D sizeof (UINT= 64))) { + ASSERT (FALSE); + ASSERT (GET_GUID_HOB_DATA_SIZE (Hob) !=3D sizeof (UINT64)); + return EFI_NOT_FOUND; + } + + PlatformRepo =3D This->PlatRepoInfo; + PlatformRepo->FdtBase =3D (VOID *)*(UINTN *)GET_GUID_HOB_DATA (Hob); + + // + // Initialise the dynamic platform repository. + // + Status =3D DynamicPlatRepoInit (&PlatformRepo->DynamicPlatformRepo); + if (EFI_ERROR (Status)) { + ASSERT_EFI_ERROR (Status); + return Status; + } + + // + // Initialise the FDT parser + // + Status =3D HwInfoParserInit ( + PlatformRepo->FdtBase, + PlatformRepo, + HwInfoAdd, + &PlatformRepo->FdtParserHandle + ); + if (EFI_ERROR (Status)) { + ASSERT_EFI_ERROR (Status); + goto ErrorHandler; + } + + Status =3D HwInfoParse (PlatformRepo->FdtParserHandle); + if (EFI_ERROR (Status)) { + ASSERT_EFI_ERROR (Status); + goto ErrorHandler; + } + + Status =3D DynamicPlatRepoFinalise (PlatformRepo->DynamicPlatformRepo); + if (EFI_ERROR (Status)) { + ASSERT_EFI_ERROR (Status); + goto ErrorHandler; + } + + return EFI_SUCCESS; + +ErrorHandler: + CleanupPlatformRepository (This); + return Status; +} + +/** + Return a standard namespace object. + + @param [in] This Pointer to the Configuration Manager Protoc= ol. + @param [in] CmObjectId The Configuration Manager Object ID. + @param [in] Token An optional token identifying the object. If + unused this must be CM_NULL_TOKEN. + @param [in, out] CmObject Pointer to the Configuration Manager Object + descriptor describing the requested Object. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER A parameter is invalid. + @retval EFI_NOT_FOUND The required object information is not fou= nd. +**/ +EFI_STATUS +EFIAPI +GetStandardNameSpaceObject ( + IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST This, + IN CONST CM_OBJECT_ID CmObjectId, + IN CONST CM_OBJECT_TOKEN Token OPTIONAL, + IN OUT CM_OBJ_DESCRIPTOR *CONST CmObject + ) +{ + EFI_STATUS Status; + EDKII_PLATFORM_REPOSITORY_INFO *PlatformRepo; + UINTN AcpiTableCount; + CM_OBJ_DESCRIPTOR CmObjDesc; + + if ((This =3D=3D NULL) || (CmObject =3D=3D NULL)) { + ASSERT (This !=3D NULL); + ASSERT (CmObject !=3D NULL); + return EFI_INVALID_PARAMETER; + } + + Status =3D EFI_NOT_FOUND; + PlatformRepo =3D This->PlatRepoInfo; + + switch (GET_CM_OBJECT_ID (CmObjectId)) { + case EStdObjCfgMgrInfo: + Status =3D HandleCmObject ( + CmObjectId, + &PlatformRepo->CmInfo, + sizeof (PlatformRepo->CmInfo), + 1, + CmObject + ); + break; + + case EStdObjAcpiTableList: + AcpiTableCount =3D ARRAY_SIZE (PlatformRepo->CmAcpiTableList); + + // + // Get Pci config space information. + // + Status =3D DynamicPlatRepoGetObject ( + PlatformRepo->DynamicPlatformRepo, + CREATE_CM_ARM_OBJECT_ID (EArmObjPciConfigSpaceInfo), + CM_NULL_TOKEN, + &CmObjDesc + ); + if (Status =3D=3D EFI_NOT_FOUND) { + // + // The last 3 tables are for PCIe. If PCIe information is not + // present, Kvmtool was launched without the PCIe option. + // Therefore, reduce the table count by 3. + // + AcpiTableCount -=3D 3; + } else if (EFI_ERROR (Status)) { + ASSERT_EFI_ERROR (Status); + return Status; + } + + // + // Get the Gic version. + // + Status =3D DynamicPlatRepoGetObject ( + PlatformRepo->DynamicPlatformRepo, + CREATE_CM_ARM_OBJECT_ID (EArmObjGicDInfo), + CM_NULL_TOKEN, + &CmObjDesc + ); + if (EFI_ERROR (Status)) { + ASSERT_EFI_ERROR (Status); + return Status; + } + + if (((CM_ARM_GICD_INFO *)CmObjDesc.Data)->GicVersion < 3) { + // + // IORT is only required for GicV3/4 + // + AcpiTableCount -=3D 1; + } + + Status =3D HandleCmObject ( + CmObjectId, + PlatformRepo->CmAcpiTableList, + (sizeof (PlatformRepo->CmAcpiTableList[0]) * AcpiTableCou= nt), + AcpiTableCount, + CmObject + ); + break; + + default: + Status =3D EFI_NOT_FOUND; + DEBUG (( + DEBUG_ERROR, + "ERROR: CmObjectId " FMT_CM_OBJECT_ID ". Status =3D %r\n", + CmObjectId, + Status + )); + break; + } + + return Status; +} + +/** + Return an ARM namespace object. + + @param [in] This Pointer to the Configuration Manager Protoc= ol. + @param [in] CmObjectId The Configuration Manager Object ID. + @param [in] Token An optional token identifying the object. If + unused this must be CM_NULL_TOKEN. + @param [in, out] CmObject Pointer to the Configuration Manager Object + descriptor describing the requested Object. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER A parameter is invalid. + @retval EFI_NOT_FOUND The required object information is not fou= nd. +**/ +EFI_STATUS +EFIAPI +GetArmNameSpaceObject ( + IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST This, + IN CONST CM_OBJECT_ID CmObjectId, + IN CONST CM_OBJECT_TOKEN Token OPTIONAL, + IN OUT CM_OBJ_DESCRIPTOR *CONST CmObject + ) +{ + EFI_STATUS Status; + EDKII_PLATFORM_REPOSITORY_INFO *PlatformRepo; + + if ((This =3D=3D NULL) || (CmObject =3D=3D NULL)) { + ASSERT (This !=3D NULL); + ASSERT (CmObject !=3D NULL); + return EFI_INVALID_PARAMETER; + } + + Status =3D EFI_NOT_FOUND; + PlatformRepo =3D This->PlatRepoInfo; + + // + // First check among the static objects. + // + switch (GET_CM_OBJECT_ID (CmObjectId)) { + case EArmObjPowerManagementProfileInfo: + Status =3D HandleCmObject ( + CmObjectId, + &PlatformRepo->PmProfileInfo, + sizeof (PlatformRepo->PmProfileInfo), + 1, + CmObject + ); + break; + + case EArmObjItsGroup: + Status =3D HandleCmObject ( + CmObjectId, + &PlatformRepo->ItsGroupInfo, + sizeof (PlatformRepo->ItsGroupInfo), + 1, + CmObject + ); + break; + + case EArmObjGicItsIdentifierArray: + Status =3D HandleCmObjectRefByToken ( + This, + CmObjectId, + PlatformRepo->ItsIdentifierArray, + sizeof (PlatformRepo->ItsIdentifierArray), + ARRAY_SIZE (PlatformRepo->ItsIdentifierArray), + Token, + GetItsIdentifierArray, + CmObject + ); + break; + + case EArmObjRootComplex: + Status =3D HandleCmObject ( + CmObjectId, + &PlatformRepo->RootComplexInfo, + sizeof (PlatformRepo->RootComplexInfo), + 1, + CmObject + ); + break; + + case EArmObjIdMappingArray: + Status =3D HandleCmObjectRefByToken ( + This, + CmObjectId, + PlatformRepo->DeviceIdMapping, + sizeof (PlatformRepo->DeviceIdMapping), + ARRAY_SIZE (PlatformRepo->DeviceIdMapping), + Token, + GetDeviceIdMappingArray, + CmObject + ); + break; + + default: + // + // No match found among the static objects. + // Check the dynamic objects. + // + Status =3D DynamicPlatRepoGetObject ( + PlatformRepo->DynamicPlatformRepo, + CmObjectId, + Token, + CmObject + ); + break; + } // switch + + if (Status =3D=3D EFI_NOT_FOUND) { + DEBUG (( + DEBUG_INFO, + "INFO: CmObjectId " FMT_CM_OBJECT_ID ". Status =3D %r\n", + CmObjectId, + Status + )); + } else { + ASSERT_EFI_ERROR (Status); + } + + return Status; +} + +/** + Return an OEM namespace object. + + @param [in] This Pointer to the Configuration Manager Protoc= ol. + @param [in] CmObjectId The Configuration Manager Object ID. + @param [in] Token An optional token identifying the object. If + unused this must be CM_NULL_TOKEN. + @param [in, out] CmObject Pointer to the Configuration Manager Object + descriptor describing the requested Object. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER A parameter is invalid. + @retval EFI_NOT_FOUND The required object information is not fou= nd. +**/ +EFI_STATUS +EFIAPI +GetOemNameSpaceObject ( + IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST This, + IN CONST CM_OBJECT_ID CmObjectId, + IN CONST CM_OBJECT_TOKEN Token OPTIONAL, + IN OUT CM_OBJ_DESCRIPTOR *CONST CmObject + ) +{ + EFI_STATUS Status; + + Status =3D EFI_SUCCESS; + if ((This =3D=3D NULL) || (CmObject =3D=3D NULL)) { + ASSERT (This !=3D NULL); + ASSERT (CmObject !=3D NULL); + return EFI_INVALID_PARAMETER; + } + + switch (GET_CM_OBJECT_ID (CmObjectId)) { + default: + Status =3D EFI_NOT_FOUND; + DEBUG (( + DEBUG_ERROR, + "ERROR: CmObjectId " FMT_CM_OBJECT_ID ". Status =3D %r\n", + CmObjectId, + Status + )); + break; + } + + return Status; +} + +/** + The GetObject function defines the interface implemented by the + Configuration Manager Protocol for returning the Configuration + Manager Objects. + + @param [in] This Pointer to the Configuration Manager Protoc= ol. + @param [in] CmObjectId The Configuration Manager Object ID. + @param [in] Token An optional token identifying the object. If + unused this must be CM_NULL_TOKEN. + @param [in, out] CmObject Pointer to the Configuration Manager Object + descriptor describing the requested Object. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER A parameter is invalid. + @retval EFI_NOT_FOUND The required object information is not fou= nd. +**/ +EFI_STATUS +EFIAPI +ArmKvmtoolPlatformGetObject ( + IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST This, + IN CONST CM_OBJECT_ID CmObjectId, + IN CONST CM_OBJECT_TOKEN Token OPTIONAL, + IN OUT CM_OBJ_DESCRIPTOR *CONST CmObject + ) +{ + EFI_STATUS Status; + + if ((This =3D=3D NULL) || (CmObject =3D=3D NULL)) { + ASSERT (This !=3D NULL); + ASSERT (CmObject !=3D NULL); + return EFI_INVALID_PARAMETER; + } + + switch (GET_CM_NAMESPACE_ID (CmObjectId)) { + case EObjNameSpaceStandard: + Status =3D GetStandardNameSpaceObject (This, CmObjectId, Token, CmOb= ject); + break; + case EObjNameSpaceArm: + Status =3D GetArmNameSpaceObject (This, CmObjectId, Token, CmObject); + break; + case EObjNameSpaceOem: + Status =3D GetOemNameSpaceObject (This, CmObjectId, Token, CmObject); + break; + default: + Status =3D EFI_INVALID_PARAMETER; + DEBUG (( + DEBUG_ERROR, + "ERROR: Unknown Namespace CmObjectId " FMT_CM_OBJECT_ID ". " + "Status = =3D %r\n", + CmObjectId, + Status + )); + break; + } + + return Status; +} + +/** + The SetObject function defines the interface implemented by the + Configuration Manager Protocol for updating the Configuration + Manager Objects. + + @param [in] This Pointer to the Configuration Manager Protoc= ol. + @param [in] CmObjectId The Configuration Manager Object ID. + @param [in] Token An optional token identifying the object. If + unused this must be CM_NULL_TOKEN. + @param [in] CmObject Pointer to the Configuration Manager Object + descriptor describing the Object. + + @retval EFI_UNSUPPORTED This operation is not supported. +**/ +EFI_STATUS +EFIAPI +ArmKvmtoolPlatformSetObject ( + IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST This, + IN CONST CM_OBJECT_ID CmObjectId, + IN CONST CM_OBJECT_TOKEN Token OPTIONAL, + IN CM_OBJ_DESCRIPTOR *CONST CmObject + ) +{ + return EFI_UNSUPPORTED; +} + +// +// A structure describing the configuration manager protocol interface. +// +STATIC +CONST +EDKII_CONFIGURATION_MANAGER_PROTOCOL mKvmtoolPlatformConfigManagerProtoco= l =3D { + CREATE_REVISION (1, 0), + ArmKvmtoolPlatformGetObject, + ArmKvmtoolPlatformSetObject, + &mKvmtoolPlatRepositoryInfo +}; + +/** + Entrypoint of Configuration Manager Dxe. + + @param ImageHandle + @param SystemTable + + @retval EFI_SUCCESS + @retval EFI_LOAD_ERROR + @retval EFI_OUT_OF_RESOURCES +**/ +EFI_STATUS +EFIAPI +ConfigurationManagerDxeInitialize ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + + Status =3D gBS->InstallProtocolInterface ( + &ImageHandle, + &gEdkiiConfigurationManagerProtocolGuid, + EFI_NATIVE_INTERFACE, + (VOID *)&mKvmtoolPlatformConfigManagerProtocol + ); + if (EFI_ERROR (Status)) { + DEBUG (( + DEBUG_ERROR, + "ERROR: Failed to get Install Configuration Manager Protocol." \ + " Status =3D %r\n", + Status + )); + return Status; + } + + Status =3D InitializePlatformRepository ( + &mKvmtoolPlatformConfigManagerProtocol + ); + if (EFI_ERROR (Status)) { + DEBUG (( + DEBUG_ERROR, + "ERROR: Failed to initialize the Platform Configuration Repository."= \ + " Status =3D %r\n", + Status + )); + goto ErrorHandler; + } + + return Status; + +ErrorHandler: + gBS->UninstallProtocolInterface ( + &ImageHandle, + &gEdkiiConfigurationManagerProtocolGuid, + (VOID *)&mKvmtoolPlatformConfigManagerProtocol + ); + return Status; +} + +/** + Unload function for this image. + + @param ImageHandle Handle for the image of this driver. + + @retval EFI_SUCCESS Driver unloaded successfully. + @retval other Driver can not unloaded. +**/ +EFI_STATUS +EFIAPI +ConfigurationManagerDxeUnloadImage ( + IN EFI_HANDLE ImageHandle + ) +{ + return CleanupPlatformRepository (&mKvmtoolPlatformConfigManagerProtocol= ); +} diff --git a/ArmVirtPkg/KvmtoolCfgMgrDxe/ConfigurationManager.h b/ArmVirtPk= g/KvmtoolCfgMgrDxe/ConfigurationManager.h new file mode 100644 index 000000000000..3373948bc4eb --- /dev/null +++ b/ArmVirtPkg/KvmtoolCfgMgrDxe/ConfigurationManager.h @@ -0,0 +1,125 @@ +/** @file + + Copyright (c) 2021 - 2022, Arm Limited. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Glossary: + - Cm or CM - Configuration Manager + - Obj or OBJ - Object +**/ + +#ifndef CONFIGURATION_MANAGER_H_ +#define CONFIGURATION_MANAGER_H_ + +/// +/// C array containing the compiled AML template. +/// This symbol is defined in the auto generated C file +/// containing the AML bytecode array. +/// +extern CHAR8 dsdt_aml_code[]; + +/// +/// The configuration manager version. +/// +#define CONFIGURATION_MANAGER_REVISION CREATE_REVISION (1, 0) + +/// +/// The OEM ID +/// +#define CFG_MGR_OEM_ID { 'A', 'R', 'M', 'L', 'T', 'D' } + +/// +/// Memory address size limit. Assume the whole address space. +/// +#define MEMORY_ADDRESS_SIZE_LIMIT 64 + +/** A function that prepares Configuration Manager Objects for returning. + + @param [in] This Pointer to the Configuration Manager Protocol. + @param [in] CmObjectId The Configuration Manager Object ID. + @param [in] Token A token for identifying the object. + @param [out] CmObject Pointer to the Configuration Manager Object + descriptor describing the requested Object. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER A parameter is invalid. + @retval EFI_NOT_FOUND The required object information is not fou= nd. +**/ +typedef EFI_STATUS (*CM_OBJECT_HANDLER_PROC) ( + IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST This, + IN CONST CM_OBJECT_ID CmObjectId, + IN CONST CM_OBJECT_TOKEN Token, + IN OUT CM_OBJ_DESCRIPTOR *CONST CmObject + ); + +/// +/// A helper macro for mapping a reference token. +/// +#define REFERENCE_TOKEN(Field) \ + (CM_OBJECT_TOKEN)((UINT8*)&mKvmtoolPlatRepositoryInfo + \ + OFFSET_OF (EDKII_PLATFORM_REPOSITORY_INFO, Field)) + +/// +/// The number of ACPI tables to install +/// +#define PLAT_ACPI_TABLE_COUNT 10 + +/// +/// A structure describing the platform configuration +/// manager repository information +/// +typedef struct PlatformRepositoryInfo { + /// + /// Configuration Manager Information. + /// + CM_STD_OBJ_CONFIGURATION_MANAGER_INFO CmInfo; + + /// + /// List of ACPI tables + /// + CM_STD_OBJ_ACPI_TABLE_INFO CmAcpiTableList[PLAT_ACPI_TABLE= _COUNT]; + + /// + /// Power management profile information + /// + CM_ARM_POWER_MANAGEMENT_PROFILE_INFO PmProfileInfo; + + /// + /// ITS Group node + /// + CM_ARM_ITS_GROUP_NODE ItsGroupInfo; + + /// + /// ITS Identifier array + /// + CM_ARM_ITS_IDENTIFIER ItsIdentifierArray[1]; + + /// + /// PCI Root complex node + /// + CM_ARM_ROOT_COMPLEX_NODE RootComplexInfo; + + /// + /// Array of DeviceID mapping + /// + CM_ARM_ID_MAPPING DeviceIdMapping[1]; + + /// + /// Dynamic platform repository. + /// CmObj created by parsing the Kvmtool device tree are stored here. + /// + DYNAMIC_PLATFORM_REPOSITORY_INFO *DynamicPlatformRepo; + + /// + /// Base address of the FDT. + /// + VOID *FdtBase; + + /// + /// A handle to the FDT HwInfoParser. + /// + HW_INFO_PARSER_HANDLE FdtParserHandle; +} EDKII_PLATFORM_REPOSITORY_INFO; + +#endif // CONFIGURATION_MANAGER_H_ diff --git a/ArmVirtPkg/KvmtoolCfgMgrDxe/ConfigurationManagerDxe.inf b/ArmV= irtPkg/KvmtoolCfgMgrDxe/ConfigurationManagerDxe.inf new file mode 100644 index 000000000000..a333966a8c96 --- /dev/null +++ b/ArmVirtPkg/KvmtoolCfgMgrDxe/ConfigurationManagerDxe.inf @@ -0,0 +1,54 @@ +## @file +# Configuration Manager Dxe +# +# Copyright (c) 2021 - 2022, Arm Limited. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION =3D 0x0001001B + BASE_NAME =3D ConfigurationManagerDxe + FILE_GUID =3D 3C80D366-510C-4154-BB3A-E12439AD337C + MODULE_TYPE =3D DXE_DRIVER + VERSION_STRING =3D 1.0 + ENTRY_POINT =3D ConfigurationManagerDxeInitialize + UNLOAD_IMAGE =3D ConfigurationManagerDxeUnloadImage + +# +# The following information is for reference only and not required by the = build tools. +# +# VALID_ARCHITECTURES =3D AARCH64 +# + +[Sources] + AslTables/Dsdt.asl + ConfigurationManager.c + ConfigurationManager.h + ConfigurationManagerDxe.inf + +[Packages] + ArmVirtPkg/ArmVirtPkg.dec + DynamicTablesPkg/DynamicTablesPkg.dec + EmbeddedPkg/EmbeddedPkg.dec + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + +[LibraryClasses] + DynamicPlatRepoLib + HobLib + HwInfoParserLib + PrintLib + TableHelperLib + UefiBootServicesTableLib + UefiDriverEntryPoint + UefiRuntimeServicesTableLib + +[Protocols] + gEdkiiConfigurationManagerProtocolGuid + +[Guids] + gFdtHobGuid + +[Depex] + gEdkiiPlatformHasAcpiGuid --=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 (#86310): https://edk2.groups.io/g/devel/message/86310 Mute This Topic: https://groups.io/mt/88838061/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 10 19:35: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+86311+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+86311+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1643736179; cv=none; d=zohomail.com; s=zohoarc; b=b41bxj3b1DA0s7zI5TbJQKoXWt17SFi56dVo8MshN67h8zmSifhpfiswW5SAXMD0h6SkTLxXPcMlo2EKVHDeWy7frye3e69rXwUbE9NWCN+jTo1Qg9B1nbU2Vtrp42r+crEfd3lep0sS4KHiW5U39tKRBZ0jtK3cJPqiuH4J0Cs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1643736179; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=E1fN3W30cmDnygRKkjBDHJpIAKKgmEMjfFYFSL47WfU=; b=gAH2NO+NfhOg6XgdaJipu9WfUXRJFFrheGbhxqVjqTo3Ue02XgPgQ6DpZaVclXIN9lG1qetuLrQ0bDs/3PAiwVrggW5g1R29BH5tJLC6Wm+bQexB92MLo4XvfCyJkhJQ0oY6cnZ4OKlr1JroH6zqmttFYi6ZhPS3yce+SF8OeEQ= 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+86311+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 1643736179234722.6740951805385; Tue, 1 Feb 2022 09:22:59 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id wszhYY1788612xxYVq0Q9PSX; Tue, 01 Feb 2022 09:22:58 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web12.51383.1643736177965639131 for ; Tue, 01 Feb 2022 09:22: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 9BDFD11FB; Tue, 1 Feb 2022 09:22:57 -0800 (PST) X-Received: from e126645.home (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 456FF3F40C; Tue, 1 Feb 2022 09:22:56 -0800 (PST) From: "PierreGondois" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Sami Mujawar , Rebecca Cran , Pierre Gondois Subject: [edk2-devel] [PATCH v5 8/9] ArmVirtPkg/Kvmtool: Enable ACPI support Date: Tue, 1 Feb 2022 18:22:51 +0100 Message-Id: <20220201172252.799725-9-Pierre.Gondois@arm.com> In-Reply-To: <20220201172252.799725-1-Pierre.Gondois@arm.com> References: <20220201172252.799725-1-Pierre.Gondois@arm.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: 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,pierre.gondois@arm.com X-Gm-Message-State: sqUrhF0FApyoE6GGK2NN82Oix1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1643736178; bh=UG+t5jy+zlWVcxpYNMT11QshWjMVW4jzS6cWxCClzx0=; h=Cc:Date:From:Reply-To:Subject:To; b=Gys8PMOfUnBBx62ESvVLaRkjgypBar3twc+Aa6syvg3jSb+yecXoOnk/aHucYy1zp68 Y1FKLtzYWD8VnAqwcnTo8JQ1BQ6TI8/4Ly/4i/KHMJryQ3vqvh4Fn05hhVtDZLP89desw +b9EYdNriZCrY+QoOANKNt87W6umHr1UaWo= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1643736180845100033 Content-Type: text/plain; charset="utf-8" From: Sami Mujawar A Configuration Manager that uses the Dynamic Tables framework to generate ACPI tables for Kvmtool Guests has been provided. This Configuration Manager uses the FdtHwInfoParser module to parse the Kvmtool Device Tree and generate the required Configuration Manager objects for generating the ACPI tables. Therefore, enable ACPI table generation for Kvmtool. Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3742 Signed-off-by: Sami Mujawar Signed-off-by: Pierre Gondois --- Notes: v2: - Remove Pcds that are redefined to their default value, and modules already included in ArmVirtPkg/ArmVirt.dsc.inc [Laszlo] - Use guards as '!if $(ARCH) =3D=3D AARCH64' to conditionnaly generate ACPI tables. This allows to prevent the 32bits ARM/ACPI combination without restricting the DynamicTablesPkg to AARCH64. This means that KvmTool on ARM will use the DT. Not adding Laszlo's Acked-by since this is not exactly what was suggested. [Laszlo/Pierre] ArmVirtPkg/ArmVirtKvmTool.dsc | 17 ++++++++++++++--- ArmVirtPkg/ArmVirtKvmTool.fdf | 15 ++++++++++++++- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/ArmVirtPkg/ArmVirtKvmTool.dsc b/ArmVirtPkg/ArmVirtKvmTool.dsc index 4a54d13735e9..4b6090ab6075 100644 --- a/ArmVirtPkg/ArmVirtKvmTool.dsc +++ b/ArmVirtPkg/ArmVirtKvmTool.dsc @@ -29,6 +29,10 @@ [Defines] =20 !include ArmVirtPkg/ArmVirt.dsc.inc =20 +!if $(ARCH) =3D=3D AARCH64 +!include DynamicTablesPkg/DynamicTables.dsc.inc +!endif + !include MdePkg/MdeLibs.dsc.inc =20 [LibraryClasses.common] @@ -71,6 +75,9 @@ [LibraryClasses.common] PlatformHookLib|ArmVirtPkg/Library/Fdt16550SerialPortHookLib/Fdt16550Ser= ialPortHookLib.inf SerialPortLib|MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPort= Lib16550.inf =20 + HwInfoParserLib|DynamicTablesPkg/Library/FdtHwInfoParserLib/FdtHwInfoPar= serLib.inf + DynamicPlatRepoLib|DynamicTablesPkg/Library/Common/DynamicPlatRepoLib/Dy= namicPlatRepoLib.inf + [LibraryClasses.common.SEC, LibraryClasses.common.PEI_CORE, LibraryClasses= .common.PEIM] PciExpressLib|MdePkg/Library/BasePciExpressLib/BasePciExpressLib.inf PlatformHookLib|ArmVirtPkg/Library/Fdt16550SerialPortHookLib/EarlyFdt165= 50SerialPortHookLib.inf @@ -195,9 +202,6 @@ [PcdsDynamicDefault.common] gEfiMdeModulePkgTokenSpaceGuid.PcdSetupVideoHorizontalResolution|640 gEfiMdeModulePkgTokenSpaceGuid.PcdSetupVideoVerticalResolution|480 =20 - ## Force DTB - gArmVirtTokenSpaceGuid.PcdForceNoAcpi|TRUE - # Setup Flash storage variables gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase|0 gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize|0x40000 @@ -353,3 +357,10 @@ [Components.common] } OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf OvmfPkg/Virtio10Dxe/Virtio10.inf + +!if $(ARCH) =3D=3D AARCH64 + # + # ACPI Support + # + ArmVirtPkg/KvmtoolCfgMgrDxe/ConfigurationManagerDxe.inf +!endif diff --git a/ArmVirtPkg/ArmVirtKvmTool.fdf b/ArmVirtPkg/ArmVirtKvmTool.fdf index 14a5fce43a09..9e006e83ee5c 100644 --- a/ArmVirtPkg/ArmVirtKvmTool.fdf +++ b/ArmVirtPkg/ArmVirtKvmTool.fdf @@ -1,5 +1,5 @@ # -# Copyright (c) 2018 - 2021, ARM Limited. All rights reserved. +# Copyright (c) 2018 - 2022, ARM Limited. All rights reserved. # # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -201,6 +201,19 @@ [FV.FvMain] INF OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf INF OvmfPkg/Virtio10Dxe/Virtio10.inf =20 +!if $(ARCH) =3D=3D AARCH64 + # + # ACPI Support + # + INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf + # + # Dynamic Table fdf + # + !include DynamicTablesPkg/DynamicTables.fdf.inc + + INF ArmVirtPkg/KvmtoolCfgMgrDxe/ConfigurationManagerDxe.inf +!endif + # # TianoCore logo (splash screen) # --=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 (#86311): https://edk2.groups.io/g/devel/message/86311 Mute This Topic: https://groups.io/mt/88838065/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 10 19:35: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+86312+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+86312+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1643736180; cv=none; d=zohomail.com; s=zohoarc; b=Eslia54NTIpkaR9zKirXJ3uNmK8b5eejg2yEh67a9FwH6gTRV3OPVwTn9MJPYWfHReXZABJ4rY1EOcJlcm6xtFZgk9yihAA5VlVSlgTwVfcWBTz5I4FH/w6G/i8sNaSNRWiA8n4ACGzegKK7irNtPbiz9pgYnThG8Ewe/fKHGMc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1643736180; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=b4JwtUWfxRkxOT/fZYau4P/hNxcNzvdnWCKqWYOVE14=; b=MDLzeVoXBCecuAERFxOvneR6uldq6YIzdFvHcVrTGs848exFi5j9mcwPUOzqExO2m5KE0Bf3E/x91lugb223Vi2y32vfRvUnm3kGL9DwgUB2pWH9k3t73TQ5guwZuVHfIJkZxhmHmfzqTReqzGnb3YUUrmIdf8erlQka27yJ2Xc= 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+86312+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 1643736180610527.5893823462263; Tue, 1 Feb 2022 09:23:00 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id r7zoYY1788612xvsLzEHtduH; Tue, 01 Feb 2022 09:23:00 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web08.51323.1643736179507620254 for ; Tue, 01 Feb 2022 09:22:59 -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 2AD4F1424; Tue, 1 Feb 2022 09:22:59 -0800 (PST) X-Received: from e126645.home (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id EB9F43F40C; Tue, 1 Feb 2022 09:22:57 -0800 (PST) From: "PierreGondois" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Sami Mujawar , Rebecca Cran , Pierre Gondois Subject: [edk2-devel] [PATCH v5 9/9] ArmVirtPkg/Kvmtool: Enable Acpiview Date: Tue, 1 Feb 2022 18:22:52 +0100 Message-Id: <20220201172252.799725-10-Pierre.Gondois@arm.com> In-Reply-To: <20220201172252.799725-1-Pierre.Gondois@arm.com> References: <20220201172252.799725-1-Pierre.Gondois@arm.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: 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,pierre.gondois@arm.com X-Gm-Message-State: 23tp8bz2GjZz8x05cV83j3Pex1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1643736180; bh=Ma2t7sdp4MHYLsYGA083yqbuXfJgB4AYVenDlfm2kfg=; h=Cc:Date:From:Reply-To:Subject:To; b=scwg0RaKM5CsJHVGXlVioZGcM2+JJCStXNPFiIjSLcRWb3DyfhfPJD5zri19z3PJCq8 2i663pWPOge5jxJ6b8x1qYi2U2EJS813x41jZGMzbXQEUBsJ21UsOzORAEEsPU5HsQ1gT qDzQY3R/j609HY8Cf264k2d8cgKjWPXg8m8= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1643736183146100039 Content-Type: text/plain; charset="utf-8" From: Sami Mujawar Acpiview is a command line tool allowing to display, dump, or check installed ACPI tables. Add a 'ACPIVIEW_ENABLE' switch to enable it on an ArmVirt platform. The switch is set for the ArmVirtKvmTool platform. Signed-off-by: Sami Mujawar Signed-off-by: Pierre Gondois Acked-by: Laszlo Ersek --- Notes: v2: - Only add AcpiView for ArmVirtKvmTool instead of all ArmVirt platforms. This is done using a 'ACPIVIEW_ENABLE' switch. [Laszlo] ArmVirtPkg/ArmVirt.dsc.inc | 5 ++++- ArmVirtPkg/ArmVirtKvmTool.dsc | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ArmVirtPkg/ArmVirt.dsc.inc b/ArmVirtPkg/ArmVirt.dsc.inc index 4db8ad5a7999..ba711deac025 100644 --- a/ArmVirtPkg/ArmVirt.dsc.inc +++ b/ArmVirtPkg/ArmVirt.dsc.inc @@ -1,5 +1,5 @@ # -# Copyright (c) 2011-2015, ARM Limited. All rights reserved. +# Copyright (c) 2011 - 2022, ARM Limited. All rights reserved. # Copyright (c) 2014, Linaro Limited. All rights reserved. # Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved. # Copyright (c) Microsoft Corporation. @@ -397,6 +397,9 @@ [Components.common] NULL|ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3Comm= andsLib.inf NULL|ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1Co= mmandsLib.inf NULL|ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1Comm= andsLib.inf +!if $(ACPIVIEW_ENABLE) =3D=3D TRUE + NULL|ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewC= ommandLib.inf +!endif NULL|ShellPkg/Library/UefiShellInstall1CommandsLib/UefiShellInstall1= CommandsLib.inf NULL|ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1= CommandsLib.inf !if $(NETWORK_IP6_ENABLE) =3D=3D TRUE diff --git a/ArmVirtPkg/ArmVirtKvmTool.dsc b/ArmVirtPkg/ArmVirtKvmTool.dsc index 4b6090ab6075..a1bf4b9be87b 100644 --- a/ArmVirtPkg/ArmVirtKvmTool.dsc +++ b/ArmVirtPkg/ArmVirtKvmTool.dsc @@ -1,7 +1,7 @@ # @file # Workspace file for KVMTool virtual platform. # -# Copyright (c) 2018 - 2021, ARM Limited. All rights reserved. +# Copyright (c) 2018 - 2022, ARM Limited. All rights reserved. # # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -27,6 +27,9 @@ [Defines] SKUID_IDENTIFIER =3D DEFAULT FLASH_DEFINITION =3D ArmVirtPkg/ArmVirtKvmTool.fdf =20 +[Defines.AARCH64] + DEFINE ACPIVIEW_ENABLE =3D TRUE + !include ArmVirtPkg/ArmVirt.dsc.inc =20 !if $(ARCH) =3D=3D AARCH64 --=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 (#86312): https://edk2.groups.io/g/devel/message/86312 Mute This Topic: https://groups.io/mt/88838066/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-