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.web09.9353.1651071599744902050 for ; Wed, 27 Apr 2022 08:00:00 -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 7708F143D; Wed, 27 Apr 2022 07:59:59 -0700 (PDT) Received: from pierre123.arm.com (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 39E753F73B; Wed, 27 Apr 2022 07:59:58 -0700 (PDT) From: "PierreGondois" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Sami Mujawar Subject: [PATCH edk2-platforms v1 1/3] Platform/ARM: Juno: Generate ASL description of CPU topology Date: Wed, 27 Apr 2022 16:59:41 +0200 Message-Id: <20220427145943.402487-2-Pierre.Gondois@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220427145943.402487-1-Pierre.Gondois@arm.com> References: <20220427145943.402487-1-Pierre.Gondois@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Pierre Gondois The Dynamic Tables Framework has been updated to add support for generating an ASL description of a CPU topology and its _LPI states. This patch: - Describes the _LPI states in the Configuration Manager of the Juno - Add the generation of a new SSDT table describing the CPU topology and its _LPI states - Removes the CPU topology description of the DSDT table Signed-off-by: Pierre Gondois --- .../AslTables/Dsdt.asl | 198 ------------------ .../ConfigurationManager.c | 196 ++++++++++++++++- .../ConfigurationManager.h | 20 +- 3 files changed, 206 insertions(+), 208 deletions(-) diff --git a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManag= erDxe/AslTables/Dsdt.asl b/Platform/ARM/JunoPkg/ConfigurationManager/Conf= igurationManagerDxe/AslTables/Dsdt.asl index 63c70c1e4f06..2270b517cd12 100644 --- a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/A= slTables/Dsdt.asl +++ b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/A= slTables/Dsdt.asl @@ -33,204 +33,6 @@ DefinitionBlock("DsdtTable.aml", "DSDT", 1, "ARMLTD",= "ARM-JUNO", EFI_ACPI_ARM_O } Return (Arg3) } - Device (CLU0) { // Cluster0 state - Name(_HID, "ACPI0010") - Name(_UID, 1) - Name (_LPI, Package() { - 0, // Version - 0, // Level Index - 1, // Count - Package() { // Power Gating state for Cluster - 2500, // Min residency (uS) - 1150, // Wake latency (uS) - 1, // Flags - 1, // Arch Context Flags - 100, //Residency Counter Frequency - 0, // No Parent State - 0x01000000, // Integer Entry method - ResourceTemplate() { // Null Residency Counter - Register (SystemMemory, 0, 0, 0, 0) - }, - ResourceTemplate() { // Null Usage Counter - Register (SystemMemory, 0, 0, 0, 0) - }, - "CluPwrDn" - }, - }) - Name(PLPI, Package() { - 0, // Version - 0, // Level Index - 2, // Count - Package() { // WFI for CPU - 1, // Min residency (uS) - 1, // Wake latency (uS) - 1, // Flags - 0, // Arch Context Flags - 100, //Residency Counter Frequency - 0, // No parent state - ResourceTemplate () { - // Register Entry method - Register (FFixedHW, - 0x20, // Bit Width - 0x00, // Bit Offset - 0xFFFFFFFF, // Address - 0x03, // Access Size - ) - }, - ResourceTemplate() { // Null Residency Counter - Register (SystemMemory, 0, 0, 0, 0) - }, - ResourceTemplate() { // Null Usage Counter - Register (SystemMemory, 0, 0, 0, 0) - }, - "WFI", - }, - Package() { // Power Gating state for CPU - 150, // Min residency (uS) - 350, // Wake latency (uS) - 1, // Flags - 1, // Arch Context Flags - 100, //Residency Counter Frequency - 1, // Parent node can be in any state - ResourceTemplate () { - // Register Entry method - Register (FFixedHW, - 0x20, // Bit Width - 0x00, // Bit Offset - 0x00010000, // Address - 0x03, // Access Size - ) - }, - ResourceTemplate() { // Null Residency Counter - Register (SystemMemory, 0, 0, 0, 0) - }, - ResourceTemplate() { // Null Usage Counter - Register (SystemMemory, 0, 0, 0, 0) - }, - "CorePwrDn" - }, - }) - Device(CPU0) { // A57-0: Cluster 0, Cpu 0 - Name(_HID, "ACPI0007") - Name(_UID, 0) - Method (_LPI, 0, NotSerialized) { - return(PLPI) - } - } - Device(CPU1) { // A57-1: Cluster 0, Cpu 1 - Name(_HID, "ACPI0007") - Name(_UID, 1) - Method (_LPI, 0, NotSerialized) { - return(PLPI) - } - } - } - Device (CLU1) { // Cluster1 state - Name(_HID, "ACPI0010") - Name(_UID, 2) - Name (_LPI, Package() { - 0, // Version - 0, // Level Index - 1, // Count - Package() { // Power Gating state for Cluster - 2500, // Min residency (uS) - 1150, // Wake latency (uS) - 1, // Flags - 1, // Arch Context Flags - 100, //Residency Counter Frequency - 0, // No Parent State - 0x01000000, // Integer Entry method - ResourceTemplate() { // Null Residency Counter - Register (SystemMemory, 0, 0, 0, 0) - }, - ResourceTemplate() { // Null Usage Counter - Register (SystemMemory, 0, 0, 0, 0) - }, - "CluPwrDn" - }, - }) - Name(PLPI, Package() { - 0, // Version - 0, // Level Index - 2, // Count - Package() { // WFI for CPU - 1, // Min residency (uS) - 1, // Wake latency (uS) - 1, // Flags - 0, // Arch Context Flags - 100, //Residency Counter Frequency - 0, // No parent state - ResourceTemplate () { - // Register Entry method - Register (FFixedHW, - 0x20, // Bit Width - 0x00, // Bit Offset - 0xFFFFFFFF, // Address - 0x03, // Access Size - ) - }, - ResourceTemplate() { // Null Residency Counter - Register (SystemMemory, 0, 0, 0, 0) - }, - ResourceTemplate() { // Null Usage Counter - Register (SystemMemory, 0, 0, 0, 0) - }, - "WFI", - }, - Package() { // Power Gating state for CPU - 150, // Min residency (uS) - 350, // Wake latency (uS) - 1, // Flags - 1, // Arch Context Flags - 100, //Residency Counter Frequency - 1, // Parent node can be in any state - ResourceTemplate () { - // Register Entry method - Register (FFixedHW, - 0x20, // Bit Width - 0x00, // Bit Offset - 0x00010000, // Address - 0x03, // Access Size - ) - }, - ResourceTemplate() { // Null Residency Counter - Register (SystemMemory, 0, 0, 0, 0) - }, - ResourceTemplate() { // Null Usage Counter - Register (SystemMemory, 0, 0, 0, 0) - }, - "CorePwrDn" - }, - }) - Device(CPU2) { // A53-0: Cluster 1, Cpu 0 - Name(_HID, "ACPI0007") - Name(_UID, 2) - Method (_LPI, 0, NotSerialized) { - return(PLPI) - } - } - Device(CPU3) { // A53-1: Cluster 1, Cpu 1 - Name(_HID, "ACPI0007") - Name(_UID, 3) - Method (_LPI, 0, NotSerialized) { - return(PLPI) - } - } - Device(CPU4) { // A53-2: Cluster 1, Cpu 2 - Name(_HID, "ACPI0007") - Name(_UID, 4) - Method (_LPI, 0, NotSerialized) { - return(PLPI) - } - } - Device(CPU5) { // A53-3: Cluster 1, Cpu 3 - Name(_HID, "ACPI0007") - Name(_UID, 5) - Method (_LPI, 0, NotSerialized) { - return(PLPI) - } - } - } =20 // // LAN9118 Ethernet diff --git a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManag= erDxe/ConfigurationManager.c b/Platform/ARM/JunoPkg/ConfigurationManager/= ConfigurationManagerDxe/ConfigurationManager.c index 8a0464c5f637..977aba5da5c4 100644 --- a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/C= onfigurationManager.c +++ b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/C= onfigurationManager.c @@ -1,7 +1,7 @@ /** @file Configuration Manager Dxe =20 - Copyright (c) 2017 - 2021, Arm Limited. All rights reserved.
+ Copyright (c) 2017 - 2022, Arm Limited. All rights reserved.
=20 SPDX-License-Identifier: BSD-2-Clause-Patent =20 @@ -90,6 +90,14 @@ EDKII_PLATFORM_REPOSITORY_INFO ArmJunoPlatformReposito= ryInfo =3D { CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdPptt), NULL }, + // SSDT Table (Cpu topology) + { + EFI_ACPI_6_3_SECONDARY_SYSTEM_DESCRIPTION_TABLE_SIGNATURE, + 0, // Unused + CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdSsdtCpuTopology), + NULL, + SIGNATURE_64 ('C','P','U','-','T','O','P','O') + }, /* PCI MCFG Table PCIe is only available on Juno R1 and R2. Add the PCI table entries at the end of the table so that @@ -277,6 +285,8 @@ EDKII_PLATFORM_REPOSITORY_INFO ArmJunoPlatformReposit= oryInfo =3D { // UINT32 NoOfPrivateResources 0, // CM_OBJECT_TOKEN PrivateResourcesArrayToken + CM_NULL_TOKEN, + // CM_OBJECT_TOKEN LpiToken CM_NULL_TOKEN }, // 'big' cluster @@ -298,7 +308,9 @@ EDKII_PLATFORM_REPOSITORY_INFO ArmJunoPlatformReposit= oryInfo =3D { // UINT32 NoOfPrivateResources BIG_CLUSTER_RESOURCE_COUNT, // CM_OBJECT_TOKEN PrivateResourcesArrayToken - REFERENCE_TOKEN (BigClusterResources) + REFERENCE_TOKEN (BigClusterResources), + // CM_OBJECT_TOKEN LpiToken + REFERENCE_TOKEN (ClustersLpiRef) }, // 'LITTLE' cluster { @@ -319,7 +331,9 @@ EDKII_PLATFORM_REPOSITORY_INFO ArmJunoPlatformReposit= oryInfo =3D { // UINT32 NoOfPrivateResources LITTLE_CLUSTER_RESOURCE_COUNT, // CM_OBJECT_TOKEN PrivateResourcesArrayToken - REFERENCE_TOKEN (LittleClusterResources) + REFERENCE_TOKEN (LittleClusterResources), + // CM_OBJECT_TOKEN LpiToken + REFERENCE_TOKEN (ClustersLpiRef) }, // Two 'big' cores { @@ -340,7 +354,9 @@ EDKII_PLATFORM_REPOSITORY_INFO ArmJunoPlatformReposit= oryInfo =3D { // UINT32 NoOfPrivateResources BIG_CORE_RESOURCE_COUNT, // CM_OBJECT_TOKEN PrivateResourcesArrayToken - REFERENCE_TOKEN (BigCoreResources) + REFERENCE_TOKEN (BigCoreResources), + // CM_OBJECT_TOKEN LpiToken + REFERENCE_TOKEN (CoresLpiRef) }, { // CM_OBJECT_TOKEN Token @@ -360,7 +376,9 @@ EDKII_PLATFORM_REPOSITORY_INFO ArmJunoPlatformReposit= oryInfo =3D { // UINT32 NoOfPrivateResources BIG_CORE_RESOURCE_COUNT, // CM_OBJECT_TOKEN PrivateResourcesArrayToken - REFERENCE_TOKEN (BigCoreResources) + REFERENCE_TOKEN (BigCoreResources), + // CM_OBJECT_TOKEN LpiToken + REFERENCE_TOKEN (CoresLpiRef) }, // Four 'LITTLE' cores { @@ -381,7 +399,9 @@ EDKII_PLATFORM_REPOSITORY_INFO ArmJunoPlatformReposit= oryInfo =3D { // UINT32 NoOfPrivateResources LITTLE_CORE_RESOURCE_COUNT, // CM_OBJECT_TOKEN PrivateResourcesArrayToken - REFERENCE_TOKEN (LittleCoreResources) + REFERENCE_TOKEN (LittleCoreResources), + // CM_OBJECT_TOKEN LpiToken + REFERENCE_TOKEN (CoresLpiRef) }, { // CM_OBJECT_TOKEN Token @@ -401,7 +421,9 @@ EDKII_PLATFORM_REPOSITORY_INFO ArmJunoPlatformReposit= oryInfo =3D { // UINT32 NoOfPrivateResources LITTLE_CORE_RESOURCE_COUNT, // CM_OBJECT_TOKEN PrivateResourcesArrayToken - REFERENCE_TOKEN (LittleCoreResources) + REFERENCE_TOKEN (LittleCoreResources), + // CM_OBJECT_TOKEN LpiToken + REFERENCE_TOKEN (CoresLpiRef) }, { // CM_OBJECT_TOKEN Token @@ -421,7 +443,9 @@ EDKII_PLATFORM_REPOSITORY_INFO ArmJunoPlatformReposit= oryInfo =3D { // UINT32 NoOfPrivateResources LITTLE_CORE_RESOURCE_COUNT, // CM_OBJECT_TOKEN PrivateResourcesArrayToken - REFERENCE_TOKEN (LittleCoreResources) + REFERENCE_TOKEN (LittleCoreResources), + // CM_OBJECT_TOKEN LpiToken + REFERENCE_TOKEN (CoresLpiRef) }, { // CM_OBJECT_TOKEN Token @@ -441,7 +465,9 @@ EDKII_PLATFORM_REPOSITORY_INFO ArmJunoPlatformReposit= oryInfo =3D { // UINT32 NoOfPrivateResources LITTLE_CORE_RESOURCE_COUNT, // CM_OBJECT_TOKEN PrivateResourcesArrayToken - REFERENCE_TOKEN (LittleCoreResources) + REFERENCE_TOKEN (LittleCoreResources), + // CM_OBJECT_TOKEN LpiToken + REFERENCE_TOKEN (CoresLpiRef) } }, =20 @@ -549,6 +575,84 @@ EDKII_PLATFORM_REPOSITORY_INFO ArmJunoPlatformReposi= toryInfo =3D { { { REFERENCE_TOKEN (CacheInfo[4]) }, // -> 'LITTLE' core's L1 I-cache { REFERENCE_TOKEN (CacheInfo[5]) } // -> 'LITTLE' core's L1 D-cache + }, + + // Low Power Idle state information (LPI) for all cores/clusters + { + { // LpiInfo[0] -> Clusters CluPwrDn + 2500, // MinResidency + 1150, // WorstCaseWakeLatency + 1, // Flags + 1, // ArchFlags + 100, // ResCntFreq + 0, // EnableParentState + 1, // IsInteger + 0x01000000, // IntegerEntryMethod + // RegisterEntryMethod (NULL, use IntegerEntryMethod) + { EFI_ACPI_6_3_SYSTEM_MEMORY, 0, 0, 0, 0 }, + // ResidencyCounterRegister (NULL) + { EFI_ACPI_6_3_SYSTEM_MEMORY, 0, 0, 0, 0 }, + // UsageCounterRegister (NULL) + { EFI_ACPI_6_3_SYSTEM_MEMORY, 0, 0, 0, 0 }, + "CluPwrDn" // StateName + }, + // LpiInfo[1] -> Cores WFI + { + 1, // MinResidency + 1, // WorstCaseWakeLatency + 1, // Flags + 0, // ArchFlags + 100, // ResCntFreq + 0, // EnableParentState + 0, // IsInteger + 0, // IntegerEntryMethod (0, use RegisterEntryMethod) + // RegisterEntryMethod + { + EFI_ACPI_6_3_FUNCTIONAL_FIXED_HARDWARE, // AddressSpaceId + 0x20, // RegisterBitWidth + 0x00, // RegisterBitOffset + 0x03, // AccessSize + 0xFFFFFFFF // Address + }, + // ResidencyCounterRegister (NULL) + { EFI_ACPI_6_3_SYSTEM_MEMORY, 0, 0, 0, 0 }, + // UsageCounterRegister (NULL) + { EFI_ACPI_6_3_SYSTEM_MEMORY, 0, 0, 0, 0 }, + "WFI" // StateName + }, + // LpiInfo[2] -> Cores CorePwrDn + { + 150, // MinResidency + 350, // WorstCaseWakeLatency + 1, // Flags + 1, // ArchFlags + 100, // ResCntFreq + 1, // EnableParentState + 0, // IsInteger + 0, // IntegerEntryMethod (0, use RegisterEntryMethod) + // RegisterEntryMethod + { + EFI_ACPI_6_3_FUNCTIONAL_FIXED_HARDWARE, // AddressSpaceId + 0x20, // RegisterBitWidth + 0x00, // RegisterBitOffset + 0x03, // AccessSize + 0x00010000 // Address + }, + // ResidencyCounterRegister (NULL) + { EFI_ACPI_6_3_SYSTEM_MEMORY, 0, 0, 0, 0 }, + // UsageCounterRegister (NULL) + { EFI_ACPI_6_3_SYSTEM_MEMORY, 0, 0, 0, 0 }, + "CorePwrDn" // StateName + }, + }, + // Cluster Low Power Idle state references (LPI) + { + { REFERENCE_TOKEN (LpiInfo[0]) } + }, + // Cores Low Power Idle state references (LPI) + { + { REFERENCE_TOKEN (LpiInfo[1]) }, + { REFERENCE_TOKEN (LpiInfo[2]) }, } }; =20 @@ -809,6 +913,55 @@ GetGicCInfo ( return EFI_NOT_FOUND; } =20 +/** Return Lpi State Infor. + + @param [in] This Pointer to the Configuration Manager P= rotocol. + @param [in] CmObjectId The Object ID of the CM object request= ed + @param [in] SearchToken A unique token for identifying the req= uested + CM_ARM_LPI_INFO object. + @param [in, out] CmObject Pointer to the Configuration Manager O= bject + descriptor describing the requested Ob= ject. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER A parameter is invalid. + @retval EFI_NOT_FOUND The required object information is not= found. +**/ +EFI_STATUS +EFIAPI +GetLpiInfo ( + IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST This, + IN CONST CM_OBJECT_ID CmObjectId, + IN CONST CM_OBJECT_TOKEN SearchToken, + IN OUT CM_OBJ_DESCRIPTOR * CONST CmObject + ) +{ + EDKII_PLATFORM_REPOSITORY_INFO * PlatformRepo; + UINT32 TotalObjCount; + UINT32 ObjIndex; + + 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; + + TotalObjCount =3D ARRAY_SIZE (PlatformRepo->LpiInfo); + + for (ObjIndex =3D 0; ObjIndex < TotalObjCount; ObjIndex++) { + if (SearchToken =3D=3D (CM_OBJECT_TOKEN)&PlatformRepo->LpiInfo[ObjIn= dex]) { + CmObject->ObjectId =3D CmObjectId; + CmObject->Size =3D sizeof (PlatformRepo->LpiInfo[ObjIndex]); + CmObject->Data =3D (VOID*)&PlatformRepo->LpiInfo[ObjIndex]; + CmObject->Count =3D 1; + return EFI_SUCCESS; + } + } + + return EFI_NOT_FOUND; +} + /** Return a list of Configuration Manager object references pointed to = by the given input token. =20 @@ -866,6 +1019,18 @@ GetCmObjRefs ( CmObject->Count =3D ARRAY_SIZE (PlatformRepo->LittleCoreResources); return EFI_SUCCESS; } + if (SearchToken =3D=3D (CM_OBJECT_TOKEN)&PlatformRepo->ClustersLpiRef)= { + CmObject->Size =3D sizeof (PlatformRepo->ClustersLpiRef); + CmObject->Data =3D (VOID*)&PlatformRepo->ClustersLpiRef; + CmObject->Count =3D ARRAY_SIZE (PlatformRepo->ClustersLpiRef); + return EFI_SUCCESS; + } + if (SearchToken =3D=3D (CM_OBJECT_TOKEN)&PlatformRepo->CoresLpiRef) { + CmObject->Size =3D sizeof (PlatformRepo->CoresLpiRef); + CmObject->Data =3D (VOID*)&PlatformRepo->CoresLpiRef; + CmObject->Count =3D ARRAY_SIZE (PlatformRepo->CoresLpiRef); + return EFI_SUCCESS; + } =20 return EFI_NOT_FOUND; } @@ -1142,6 +1307,19 @@ GetArmNameSpaceObject ( } break; =20 + case EArmObjLpiInfo: + Status =3D HandleCmObjectRefByToken ( + This, + CmObjectId, + NULL, + 0, + 0, + Token, + GetLpiInfo, + CmObject + ); + break; + default: { Status =3D EFI_NOT_FOUND; DEBUG (( diff --git a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManag= erDxe/ConfigurationManager.h b/Platform/ARM/JunoPkg/ConfigurationManager/= ConfigurationManagerDxe/ConfigurationManager.h index 771b00c31b9e..1bc242bc9d85 100644 --- a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/C= onfigurationManager.h +++ b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/C= onfigurationManager.h @@ -115,7 +115,7 @@ typedef EFI_STATUS (*CM_OBJECT_HANDLER_PROC) ( =20 /** The number of ACPI tables to install */ -#define PLAT_ACPI_TABLE_COUNT 10 +#define PLAT_ACPI_TABLE_COUNT 11 =20 /** The number of platform generic timer blocks */ @@ -172,6 +172,15 @@ typedef EFI_STATUS (*CM_OBJECT_HANDLER_PROC) ( */ #define LITTLE_CORE_RESOURCE_COUNT 2 =20 +/** The number of Lpi states for the platform: + - two for the cores + - one for the clusters +*/ +#define CORES_LPI_STATE_COUNT 2 +#define CLUSTERS_LPI_STATE_COUNT 1 +#define LPI_STATE_COUNT (CORES_LPI_STATE_COUNT + = \ + CLUSTERS_LPI_STATE_COUNT) + /** A structure describing the platform configuration manager repository information */ @@ -238,6 +247,15 @@ typedef struct PlatformRepositoryInfo { // 'LITTLE' core private resources CM_ARM_OBJ_REF LittleCoreResources[LITTLE_CORE_= RESOURCE_COUNT]; =20 + // Low Power Idle state information (LPI) for all cores/clusters + CM_ARM_LPI_INFO LpiInfo[LPI_STATE_COUNT]; + + // Clusters Low Power Idle state references (LPI) + CM_ARM_OBJ_REF ClustersLpiRef[CLUSTERS_LPI_STAT= E_COUNT]; + + // Cores Low Power Idle state references (LPI) + CM_ARM_OBJ_REF CoresLpiRef[CORES_LPI_STATE_COUN= T]; + /// Juno Board Revision UINT32 JunoRevision; } EDKII_PLATFORM_REPOSITORY_INFO; --=20 2.25.1