[edk2-devel] [PATCH edk2-platforms v1 1/3] Platform/ARM: Juno: Generate ASL description of CPU topology

PierreGondois posted 3 patches 3 years, 9 months ago
[edk2-devel] [PATCH edk2-platforms v1 1/3] Platform/ARM: Juno: Generate ASL description of CPU topology
Posted by PierreGondois 3 years, 9 months ago
From: Pierre Gondois <Pierre.Gondois@arm.com>

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 <Pierre.Gondois@arm.com>
---
 .../AslTables/Dsdt.asl                        | 198 ------------------
 .../ConfigurationManager.c                    | 196 ++++++++++++++++-
 .../ConfigurationManager.h                    |  20 +-
 3 files changed, 206 insertions(+), 208 deletions(-)

diff --git a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/AslTables/Dsdt.asl b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/AslTables/Dsdt.asl
index 63c70c1e4f06..2270b517cd12 100644
--- a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/AslTables/Dsdt.asl
+++ b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/AslTables/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)
-        }
-      }
-    }
 
     //
     // LAN9118 Ethernet
diff --git a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
index 8a0464c5f637..977aba5da5c4 100644
--- a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
+++ b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
@@ -1,7 +1,7 @@
 /** @file
   Configuration Manager Dxe
 
-  Copyright (c) 2017 - 2021, Arm Limited. All rights reserved.<BR>
+  Copyright (c) 2017 - 2022, Arm Limited. All rights reserved.<BR>
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
@@ -90,6 +90,14 @@ EDKII_PLATFORM_REPOSITORY_INFO ArmJunoPlatformRepositoryInfo = {
       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 ArmJunoPlatformRepositoryInfo = {
       // 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 ArmJunoPlatformRepositoryInfo = {
       // 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 ArmJunoPlatformRepositoryInfo = {
       // 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 ArmJunoPlatformRepositoryInfo = {
       // 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 ArmJunoPlatformRepositoryInfo = {
       // 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 ArmJunoPlatformRepositoryInfo = {
       // 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 ArmJunoPlatformRepositoryInfo = {
       // 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 ArmJunoPlatformRepositoryInfo = {
       // 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 ArmJunoPlatformRepositoryInfo = {
       // UINT32  NoOfPrivateResources
       LITTLE_CORE_RESOURCE_COUNT,
       // CM_OBJECT_TOKEN  PrivateResourcesArrayToken
-      REFERENCE_TOKEN (LittleCoreResources)
+      REFERENCE_TOKEN (LittleCoreResources),
+      // CM_OBJECT_TOKEN  LpiToken
+      REFERENCE_TOKEN (CoresLpiRef)
     }
   },
 
@@ -549,6 +575,84 @@ EDKII_PLATFORM_REPOSITORY_INFO ArmJunoPlatformRepositoryInfo = {
   {
     { 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]) },
   }
 };
 
@@ -809,6 +913,55 @@ GetGicCInfo (
   return EFI_NOT_FOUND;
 }
 
+/** Return Lpi State Infor.
+
+  @param [in]      This           Pointer to the Configuration Manager Protocol.
+  @param [in]      CmObjectId     The Object ID of the CM object requested
+  @param [in]      SearchToken    A unique token for identifying the requested
+                                  CM_ARM_LPI_INFO object.
+  @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 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 == NULL) || (CmObject == NULL)) {
+    ASSERT (This != NULL);
+    ASSERT (CmObject != NULL);
+    return EFI_INVALID_PARAMETER;
+  }
+
+  PlatformRepo = This->PlatRepoInfo;
+
+  TotalObjCount = ARRAY_SIZE (PlatformRepo->LpiInfo);
+
+  for (ObjIndex = 0; ObjIndex < TotalObjCount; ObjIndex++) {
+    if (SearchToken == (CM_OBJECT_TOKEN)&PlatformRepo->LpiInfo[ObjIndex]) {
+      CmObject->ObjectId = CmObjectId;
+      CmObject->Size = sizeof (PlatformRepo->LpiInfo[ObjIndex]);
+      CmObject->Data = (VOID*)&PlatformRepo->LpiInfo[ObjIndex];
+      CmObject->Count = 1;
+      return EFI_SUCCESS;
+    }
+  }
+
+  return EFI_NOT_FOUND;
+}
+
 /** Return a list of Configuration Manager object references pointed to by the
     given input token.
 
@@ -866,6 +1019,18 @@ GetCmObjRefs (
     CmObject->Count = ARRAY_SIZE (PlatformRepo->LittleCoreResources);
     return EFI_SUCCESS;
   }
+  if (SearchToken == (CM_OBJECT_TOKEN)&PlatformRepo->ClustersLpiRef) {
+    CmObject->Size = sizeof (PlatformRepo->ClustersLpiRef);
+    CmObject->Data = (VOID*)&PlatformRepo->ClustersLpiRef;
+    CmObject->Count = ARRAY_SIZE (PlatformRepo->ClustersLpiRef);
+    return EFI_SUCCESS;
+  }
+  if (SearchToken == (CM_OBJECT_TOKEN)&PlatformRepo->CoresLpiRef) {
+    CmObject->Size = sizeof (PlatformRepo->CoresLpiRef);
+    CmObject->Data = (VOID*)&PlatformRepo->CoresLpiRef;
+    CmObject->Count = ARRAY_SIZE (PlatformRepo->CoresLpiRef);
+    return EFI_SUCCESS;
+  }
 
   return EFI_NOT_FOUND;
 }
@@ -1142,6 +1307,19 @@ GetArmNameSpaceObject (
       }
       break;
 
+    case EArmObjLpiInfo:
+      Status = HandleCmObjectRefByToken (
+                 This,
+                 CmObjectId,
+                 NULL,
+                 0,
+                 0,
+                 Token,
+                 GetLpiInfo,
+                 CmObject
+                 );
+      break;
+
     default: {
       Status = EFI_NOT_FOUND;
       DEBUG ((
diff --git a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h
index 771b00c31b9e..1bc242bc9d85 100644
--- a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h
+++ b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h
@@ -115,7 +115,7 @@ typedef EFI_STATUS (*CM_OBJECT_HANDLER_PROC) (
 
 /** The number of ACPI tables to install
 */
-#define PLAT_ACPI_TABLE_COUNT   10
+#define PLAT_ACPI_TABLE_COUNT   11
 
 /** The number of platform generic timer blocks
 */
@@ -172,6 +172,15 @@ typedef EFI_STATUS (*CM_OBJECT_HANDLER_PROC) (
 */
 #define LITTLE_CORE_RESOURCE_COUNT  2
 
+/** 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];
 
+  // 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_STATE_COUNT];
+
+  // Cores Low Power Idle state references (LPI)
+  CM_ARM_OBJ_REF                        CoresLpiRef[CORES_LPI_STATE_COUNT];
+
   /// Juno Board Revision
   UINT32                                JunoRevision;
 } EDKII_PLATFORM_REPOSITORY_INFO;
-- 
2.25.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#89350): https://edk2.groups.io/g/devel/message/89350
Mute This Topic: https://groups.io/mt/90732525/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH edk2-platforms v1 1/3] Platform/ARM: Juno: Generate ASL description of CPU topology
Posted by Sami Mujawar 3 years, 6 months ago
Hi Pierre,

Thank you for this patch.

Please find my response inline marked [SAMI].

Other than the comment below, these changes looks good to me.

Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>

Regards,

Sami Mujawar

On 27/04/2022 03:59 pm, Pierre.Gondois@arm.com wrote:
> From: Pierre Gondois <Pierre.Gondois@arm.com>
>
> 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 <Pierre.Gondois@arm.com>
> ---
>   .../AslTables/Dsdt.asl                        | 198 ------------------
>   .../ConfigurationManager.c                    | 196 ++++++++++++++++-
>   .../ConfigurationManager.h                    |  20 +-
>   3 files changed, 206 insertions(+), 208 deletions(-)
>
> diff --git a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/AslTables/Dsdt.asl b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/AslTables/Dsdt.asl
> index 63c70c1e4f06..2270b517cd12 100644
> --- a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/AslTables/Dsdt.asl
> +++ b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/AslTables/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)
> -        }
> -      }
> -    }
>   
>       //
>       // LAN9118 Ethernet
> diff --git a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
> index 8a0464c5f637..977aba5da5c4 100644
> --- a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
> +++ b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
> @@ -1,7 +1,7 @@
>   /** @file
>     Configuration Manager Dxe
>   
> -  Copyright (c) 2017 - 2021, Arm Limited. All rights reserved.<BR>
> +  Copyright (c) 2017 - 2022, Arm Limited. All rights reserved.<BR>
>   
>     SPDX-License-Identifier: BSD-2-Clause-Patent
>   
> @@ -90,6 +90,14 @@ EDKII_PLATFORM_REPOSITORY_INFO ArmJunoPlatformRepositoryInfo = {
>         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 ArmJunoPlatformRepositoryInfo = {
>         // 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 ArmJunoPlatformRepositoryInfo = {
>         // 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 ArmJunoPlatformRepositoryInfo = {
>         // 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 ArmJunoPlatformRepositoryInfo = {
>         // 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 ArmJunoPlatformRepositoryInfo = {
>         // 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 ArmJunoPlatformRepositoryInfo = {
>         // 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 ArmJunoPlatformRepositoryInfo = {
>         // 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 ArmJunoPlatformRepositoryInfo = {
>         // 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 ArmJunoPlatformRepositoryInfo = {
>         // UINT32  NoOfPrivateResources
>         LITTLE_CORE_RESOURCE_COUNT,
>         // CM_OBJECT_TOKEN  PrivateResourcesArrayToken
> -      REFERENCE_TOKEN (LittleCoreResources)
> +      REFERENCE_TOKEN (LittleCoreResources),
> +      // CM_OBJECT_TOKEN  LpiToken
> +      REFERENCE_TOKEN (CoresLpiRef)
>       }
>     },
>   
> @@ -549,6 +575,84 @@ EDKII_PLATFORM_REPOSITORY_INFO ArmJunoPlatformRepositoryInfo = {
>     {
>       { 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

[SAMI] IsInteger field is of type BOOLEAN. Therefore, the value here 
should be TRUE. Similar changes are requires at other places in this file.

If you agree, I will make the nessary changes locally before pushing the 
patch.

[/SAMI]

> +      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]) },
>     }
>   };
>   
> @@ -809,6 +913,55 @@ GetGicCInfo (
>     return EFI_NOT_FOUND;
>   }
>   
> +/** Return Lpi State Infor.
> +
> +  @param [in]      This           Pointer to the Configuration Manager Protocol.
> +  @param [in]      CmObjectId     The Object ID of the CM object requested
> +  @param [in]      SearchToken    A unique token for identifying the requested
> +                                  CM_ARM_LPI_INFO object.
> +  @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 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 == NULL) || (CmObject == NULL)) {
> +    ASSERT (This != NULL);
> +    ASSERT (CmObject != NULL);
> +    return EFI_INVALID_PARAMETER;
> +  }
> +
> +  PlatformRepo = This->PlatRepoInfo;
> +
> +  TotalObjCount = ARRAY_SIZE (PlatformRepo->LpiInfo);
> +
> +  for (ObjIndex = 0; ObjIndex < TotalObjCount; ObjIndex++) {
> +    if (SearchToken == (CM_OBJECT_TOKEN)&PlatformRepo->LpiInfo[ObjIndex]) {
> +      CmObject->ObjectId = CmObjectId;
> +      CmObject->Size = sizeof (PlatformRepo->LpiInfo[ObjIndex]);
> +      CmObject->Data = (VOID*)&PlatformRepo->LpiInfo[ObjIndex];
> +      CmObject->Count = 1;
> +      return EFI_SUCCESS;
> +    }
> +  }
> +
> +  return EFI_NOT_FOUND;
> +}
> +
>   /** Return a list of Configuration Manager object references pointed to by the
>       given input token.
>   
> @@ -866,6 +1019,18 @@ GetCmObjRefs (
>       CmObject->Count = ARRAY_SIZE (PlatformRepo->LittleCoreResources);
>       return EFI_SUCCESS;
>     }
> +  if (SearchToken == (CM_OBJECT_TOKEN)&PlatformRepo->ClustersLpiRef) {
> +    CmObject->Size = sizeof (PlatformRepo->ClustersLpiRef);
> +    CmObject->Data = (VOID*)&PlatformRepo->ClustersLpiRef;
> +    CmObject->Count = ARRAY_SIZE (PlatformRepo->ClustersLpiRef);
> +    return EFI_SUCCESS;
> +  }
> +  if (SearchToken == (CM_OBJECT_TOKEN)&PlatformRepo->CoresLpiRef) {
> +    CmObject->Size = sizeof (PlatformRepo->CoresLpiRef);
> +    CmObject->Data = (VOID*)&PlatformRepo->CoresLpiRef;
> +    CmObject->Count = ARRAY_SIZE (PlatformRepo->CoresLpiRef);
> +    return EFI_SUCCESS;
> +  }
>   
>     return EFI_NOT_FOUND;
>   }
> @@ -1142,6 +1307,19 @@ GetArmNameSpaceObject (
>         }
>         break;
>   
> +    case EArmObjLpiInfo:
> +      Status = HandleCmObjectRefByToken (
> +                 This,
> +                 CmObjectId,
> +                 NULL,
> +                 0,
> +                 0,
> +                 Token,
> +                 GetLpiInfo,
> +                 CmObject
> +                 );
> +      break;
> +
>       default: {
>         Status = EFI_NOT_FOUND;
>         DEBUG ((
> diff --git a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h
> index 771b00c31b9e..1bc242bc9d85 100644
> --- a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h
> +++ b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h
> @@ -115,7 +115,7 @@ typedef EFI_STATUS (*CM_OBJECT_HANDLER_PROC) (
>   
>   /** The number of ACPI tables to install
>   */
> -#define PLAT_ACPI_TABLE_COUNT   10
> +#define PLAT_ACPI_TABLE_COUNT   11
>   
>   /** The number of platform generic timer blocks
>   */
> @@ -172,6 +172,15 @@ typedef EFI_STATUS (*CM_OBJECT_HANDLER_PROC) (
>   */
>   #define LITTLE_CORE_RESOURCE_COUNT  2
>   
> +/** 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];
>   
> +  // 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_STATE_COUNT];
> +
> +  // Cores Low Power Idle state references (LPI)
> +  CM_ARM_OBJ_REF                        CoresLpiRef[CORES_LPI_STATE_COUNT];
> +
>     /// Juno Board Revision
>     UINT32                                JunoRevision;
>   } EDKII_PLATFORM_REPOSITORY_INFO;


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#91460): https://edk2.groups.io/g/devel/message/91460
Mute This Topic: https://groups.io/mt/90732525/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH edk2-platforms v1 1/3] Platform/ARM: Juno: Generate ASL description of CPU topology
Posted by PierreGondois 3 years, 6 months ago
Hi Sami,

On 7/18/22 15:25, Sami Mujawar wrote:
> Hi Pierre,
> 
> Thank you for this patch.
> 
> Please find my response inline marked [SAMI].
> 
> Other than the comment below, these changes looks good to me.
> 
> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
> 
> Regards,
> 
> Sami Mujawar
> 
> On 27/04/2022 03:59 pm, Pierre.Gondois@arm.com wrote:
>> From: Pierre Gondois <Pierre.Gondois@arm.com>
>>
>> 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 <Pierre.Gondois@arm.com>
>> ---
>>    .../AslTables/Dsdt.asl                        | 198 ------------------
>>    .../ConfigurationManager.c                    | 196 ++++++++++++++++-
>>    .../ConfigurationManager.h                    |  20 +-
>>    3 files changed, 206 insertions(+), 208 deletions(-)
>>

[snip]

>>    
>> @@ -549,6 +575,84 @@ EDKII_PLATFORM_REPOSITORY_INFO ArmJunoPlatformRepositoryInfo = {
>>      {
>>        { 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
> 
> [SAMI] IsInteger field is of type BOOLEAN. Therefore, the value here
> should be TRUE. Similar changes are requires at other places in this file.
> 
> If you agree, I will make the nessary changes locally before pushing the
> patch.
> 
> [/SAMI]
> 

Thanks for catching this. Yes if you can make this change it would be awesome,

Regards,
Pierre


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#91462): https://edk2.groups.io/g/devel/message/91462
Mute This Topic: https://groups.io/mt/90732525/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-