From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.26930.1683292667507844474 for ; Fri, 05 May 2023 06:17:47 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: pierre.gondois@arm.com) 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 7FF611477; Fri, 5 May 2023 06:18:31 -0700 (PDT) Received: from e126645.arm.com (e126645.nice.arm.com [10.34.100.110]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 0FD063F64C; Fri, 5 May 2023 06:17:45 -0700 (PDT) From: "PierreGondois" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Leif Lindholm , Sami Mujawar , Michael D Kinney , Liming Gao , Zhiguang Liu Subject: [PATCH v1 09/11] DynamicTablesPkg: Generate _PSD in SsdtCpuTopologyGenerator Date: Fri, 5 May 2023 15:17:19 +0200 Message-Id: <20230505131721.1310590-10-pierre.gondois@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230505131721.1310590-1-pierre.gondois@arm.com> References: <20230505131721.1310590-1-pierre.gondois@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Pierre Gondois Make use of the newly added AmlCreatePsdNode() to generate _PSD objects. _PSD objects allow to describe 'performance control, P-state or CPPC, logical processor dependency', Cf. ACPI 6.4, s8.4.5.5 _PSD (P-State Dependency). Signed-off-by: Pierre Gondois --- .../SsdtCpuTopologyGenerator.c | 98 ++++++++++++++++++- 1 file changed, 97 insertions(+), 1 deletion(-) diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/= SsdtCpuTopologyGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCp= uTopologyLibArm/SsdtCpuTopologyGenerator.c index 6fb131b66482..9cebf57e8a46 100644 --- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpu= TopologyGenerator.c +++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpu= TopologyGenerator.c @@ -1,7 +1,7 @@ /** @file SSDT Cpu Topology Table Generator. =20 - Copyright (c) 2021, Arm Limited. All rights reserved.
+ Copyright (c) 2021 - 2023, Arm Limited. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 @par Reference(s): @@ -35,6 +35,7 @@ Requirements: - EArmObjProcHierarchyInfo (OPTIONAL) along with - EArmObjCmRef (OPTIONAL) - EArmObjLpiInfo (OPTIONAL) + - EArmObjPsdInfo (OPTIONAL) */ =20 /** This macro expands to a function that retrieves the GIC @@ -86,6 +87,16 @@ GET_OBJECT_LIST ( CM_ARM_CPC_INFO ); =20 +/** + This macro expands to a function that retrieves the PSD + information from the Configuration Manager. +*/ +GET_OBJECT_LIST ( + EObjNameSpaceArm, + EArmObjPsdInfo, + CM_ARM_PSD_INFO + ); + /** Initialize the TokenTable. =20 One entry should be allocated for each CM_ARM_PROC_HIERARCHY_INFO @@ -239,6 +250,75 @@ WriteAslName ( return EFI_SUCCESS; } =20 +/** Create and add an _PSD Node to Cpu Node. + + For instance, transform an AML node from: + Device (C002) + { + Name (_UID, 2) + Name (_HID, "ACPI0007") + } + + To: + Device (C002) + { + Name (_UID, 2) + Name (_HID, "ACPI0007") + Name (_PSD, Package() + { + NumEntries, // Integer + Revision, // Integer + Domain, // Integer + CoordType, // Integer + NumProcessors, // Integer + }) + } + + @param [in] Generator The SSDT Cpu Topology generator. + @param [in] CfgMgrProtocol Pointer to the Configuration Manag= er + Protocol Interface. + @param [in] GicCInfo Pointer to the CM_ARM_GICC_INFO ob= ject + describing the Cpu. + @param [in] Node CPU Node to which the _CPC node is + attached. + + @retval EFI_SUCCESS The function completed successfully. + @retval EFI_INVALID_PARAMETER Invalid parameter. + @retval EFI_OUT_OF_RESOURCES Failed to allocate memory. +**/ +STATIC +EFI_STATUS +EFIAPI +CreateAmlPsdNode ( + IN ACPI_CPU_TOPOLOGY_GENERATOR *Generator, + IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol= , + IN CM_ARM_GICC_INFO *GicCInfo, + IN AML_OBJECT_NODE_HANDLE *Node + ) +{ + EFI_STATUS Status; + CM_ARM_PSD_INFO *PsdInfo; + + Status =3D GetEArmObjPsdInfo ( + CfgMgrProtocol, + GicCInfo->PsdToken, + &PsdInfo, + NULL + ); + if (EFI_ERROR (Status)) { + ASSERT_EFI_ERROR (Status); + return Status; + } + + Status =3D AmlCreatePsdNode ( + PsdInfo, + Node, + NULL + ); + ASSERT_EFI_ERROR (Status); + return Status; +} + /** Create and add an _CPC Node to Cpu Node. =20 For instance, transform an AML node from: @@ -684,6 +764,14 @@ CreateAmlCpuFromProcHierarchy ( } } =20 + if (GicCInfo->PsdToken !=3D CM_NULL_TOKEN) { + Status =3D CreateAmlPsdNode (Generator, CfgMgrProtocol, GicCInfo, Cp= uNode); + if (EFI_ERROR (Status)) { + ASSERT_EFI_ERROR (Status); + return Status; + } + } + // If a CPC info is associated with the // GicCinfo, create an _CPC method returning them. if (GicCInfo->CpcToken !=3D CM_NULL_TOKEN) { @@ -1126,6 +1214,14 @@ CreateTopologyFromGicC ( break; } =20 + if (GicCInfo->PsdToken !=3D CM_NULL_TOKEN) { + Status =3D CreateAmlPsdNode (Generator, CfgMgrProtocol, GicCInfo, = CpuNode); + if (EFI_ERROR (Status)) { + ASSERT_EFI_ERROR (Status); + return Status; + } + } + // If a CPC info is associated with the // GicCinfo, create an _CPC method returning them. if (GicCInfo->CpcToken !=3D CM_NULL_TOKEN) { --=20 2.25.1