public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "PierreGondois" <pierre.gondois@arm.com>
To: devel@edk2.groups.io
Cc: Sami Mujawar <sami.mujawar@arm.com>,
	Leif Lindholm <quic_llindhol@quicinc.com>,
	Ard Biesheuvel <ardb+tianocore@kernel.org>,
	Thomas Abraham <thomas.abraham@arm.com>
Subject: [edk2-devel] [PATCH v4 2/3] Platform/ARM: Juno: Generate _PSD objects
Date: Tue, 12 Dec 2023 10:30:55 +0100	[thread overview]
Message-ID: <20231212093056.1255191-3-Pierre.Gondois@arm.com> (raw)
In-Reply-To: <20231212093056.1255191-1-Pierre.Gondois@arm.com>

From: Pierre Gondois <pierre.gondois@arm.com>

The SsdtCpuTopologyGenerator can generate _PSD objects.
Add _PSD information and handling to the Configuration Manager
to generate them.

Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
---
 .../ConfigurationManager.c                    | 98 +++++++++++++++++--
 .../ConfigurationManager.h                    | 24 ++++-
 2 files changed, 113 insertions(+), 9 deletions(-)

diff --git a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
index 2fdb15cc4caf..15292f810a28 100644
--- a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
+++ b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
@@ -129,12 +129,12 @@ EDKII_PLATFORM_REPOSITORY_INFO ArmJunoPlatformRepositoryInfo = {
      GIC_ENTRY (CPUInterfaceNumber, Mpidr, PmuIrq, VGicIrq, EnergyEfficiency)
   */
   {
-    GICC_ENTRY (0, GET_MPID (0, 0), 34, 25, 1),
-    GICC_ENTRY (1, GET_MPID (0, 1), 38, 25, 1),
-    GICC_ENTRY (2, GET_MPID (1, 0), 50, 25, 0),
-    GICC_ENTRY (3, GET_MPID (1, 1), 54, 25, 0),
-    GICC_ENTRY (4, GET_MPID (1, 2), 58, 25, 0),
-    GICC_ENTRY (5, GET_MPID (1, 3), 62, 25, 0)
+    GICC_ENTRY (0, GET_MPID (0, 0), 34, 25, 1, REFERENCE_TOKEN (PsdInfo[PSD_BIG_DOMAIN_ID])),
+    GICC_ENTRY (1, GET_MPID (0, 1), 38, 25, 1, REFERENCE_TOKEN (PsdInfo[PSD_BIG_DOMAIN_ID])),
+    GICC_ENTRY (2, GET_MPID (1, 0), 50, 25, 0, REFERENCE_TOKEN (PsdInfo[PSD_LITTLE_DOMAIN_ID])),
+    GICC_ENTRY (3, GET_MPID (1, 1), 54, 25, 0, REFERENCE_TOKEN (PsdInfo[PSD_LITTLE_DOMAIN_ID])),
+    GICC_ENTRY (4, GET_MPID (1, 2), 58, 25, 0, REFERENCE_TOKEN (PsdInfo[PSD_LITTLE_DOMAIN_ID])),
+    GICC_ENTRY (5, GET_MPID (1, 3), 62, 25, 0, REFERENCE_TOKEN (PsdInfo[PSD_LITTLE_DOMAIN_ID])),
   },
 
   // GIC Distributor Info
@@ -733,7 +733,29 @@ EDKII_PLATFORM_REPOSITORY_INFO ArmJunoPlatformRepositoryInfo = {
   {
     { REFERENCE_TOKEN (LpiInfo[1]) },
     { REFERENCE_TOKEN (LpiInfo[2]) },
-  }
+  },
+  { // Power domains
+    { // 0: big cores
+      // Revision
+      EFI_ACPI_6_5_AML_PSD_REVISION,
+      // Domain
+      PSD_BIG_DOMAIN_ID,
+      // CoordType
+      ACPI_AML_COORD_TYPE_SW_ANY,
+      // NumProc
+      2,
+    },
+    { // 1: little cores
+      // Revision
+      EFI_ACPI_6_5_AML_PSD_REVISION,
+      // Domain
+      PSD_LITTLE_DOMAIN_ID,
+      // CoordType
+      ACPI_AML_COORD_TYPE_SW_ANY,
+      // NumProc
+      4,
+    },
+  },
 };
 
 /** A helper function for returning the Configuration Manager Objects.
@@ -1141,6 +1163,55 @@ GetPciInterruptMapInfo (
   return EFI_NOT_FOUND;
 }
 
+/** Return Psd Info.
+
+  @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_PCI_INTERRUPT_MAP_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
+GetPsdInfo (
+  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->PsdInfo);
+
+  for (ObjIndex = 0; ObjIndex < TotalObjCount; ObjIndex++) {
+    if (SearchToken == (CM_OBJECT_TOKEN)&PlatformRepo->PsdInfo[ObjIndex]) {
+      CmObject->ObjectId = CmObjectId;
+      CmObject->Size = sizeof (PlatformRepo->PsdInfo[ObjIndex]);
+      CmObject->Data = (VOID*)&PlatformRepo->PsdInfo[ObjIndex];
+      CmObject->Count = 1;
+      return EFI_SUCCESS;
+    }
+  }
+
+  return EFI_SUCCESS;
+}
+
 /** Return a list of Configuration Manager object references pointed to by the
     given input token.
 
@@ -1549,6 +1620,19 @@ GetArmNameSpaceObject (
                  );
       break;
 
+    case EArmObjPsdInfo:
+      Status = HandleCmObjectRefByToken (
+                 This,
+                 CmObjectId,
+                 PlatformRepo->PsdInfo,
+                 sizeof (PlatformRepo->PsdInfo),
+                 ARRAY_SIZE (PlatformRepo->PsdInfo),
+                 Token,
+                 GetPsdInfo,
+                 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 5b5e62427f2b..e58e9cbecb23 100644
--- a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h
+++ b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h
@@ -41,7 +41,8 @@ extern CHAR8  ssdtpci_aml_code[];
           Mpidr,                                                         \
           PmuIrq,                                                        \
           VGicIrq,                                                       \
-          EnergyEfficiency                                               \
+          EnergyEfficiency,                                              \
+          PsdToken                                                       \
           ) {                                                            \
     CPUInterfaceNumber,       /* UINT32  CPUInterfaceNumber           */ \
     CPUInterfaceNumber,       /* UINT32  AcpiProcessorUid             */ \
@@ -57,7 +58,15 @@ extern CHAR8  ssdtpci_aml_code[];
     VGicIrq,                  /* UINT32  VGICMaintenanceInterrupt     */ \
     0,                        /* UINT64  GICRBaseAddress              */ \
     Mpidr,                    /* UINT64  MPIDR                        */ \
-    EnergyEfficiency          /* UINT8   ProcessorPowerEfficiencyClass*/ \
+    EnergyEfficiency,         /* UINT8   ProcessorPowerEfficiencyClass*/ \
+    0,                        /* UINT16  SpeOverflowInterrupt         */ \
+    0,                        /* UINT32  ProximityDomain              */ \
+    0,                        /* UINT32  ClockDomain                  */ \
+    0,                        /* UINT32  AffinityFlags                */ \
+    CM_NULL_TOKEN,            /* CM_OBJECT_TOKEN CpcToken             */ \
+    0,                        /* UINT16 TrbeInterrupt                 */ \
+    CM_NULL_TOKEN,            /* CM_OBJECT_TOKEN EtToken              */ \
+    PsdToken,                 /* CM_OBJECT_TOKEN PsdToken             */ \
     }
 
 /** A helper macro for populating the Processor Hierarchy Node flags
@@ -196,6 +205,14 @@ typedef EFI_STATUS (*CM_OBJECT_HANDLER_PROC) (
 #define LPI_STATE_COUNT                 (CORES_LPI_STATE_COUNT +              \
                                          CLUSTERS_LPI_STATE_COUNT)
 
+/** Psd domains:
+    - 0: big cores
+    - 1: little cores
+*/
+#define PSD_BIG_DOMAIN_ID       0
+#define PSD_LITTLE_DOMAIN_ID    1
+#define PSD_DOMAIN_COUNT        2
+
 /** A structure describing the platform configuration
     manager repository information
 */
@@ -283,6 +300,9 @@ typedef struct PlatformRepositoryInfo {
   // Cores Low Power Idle state references (LPI)
   CM_ARM_OBJ_REF                        CoresLpiRef[CORES_LPI_STATE_COUNT];
 
+  // Power domains
+  CM_ARM_PSD_INFO                       PsdInfo[PSD_DOMAIN_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 (#112380): https://edk2.groups.io/g/devel/message/112380
Mute This Topic: https://groups.io/mt/103127067/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



  parent reply	other threads:[~2023-12-12  9:31 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-12  9:30 [edk2-devel] [PATCH v4 0/3] Platform/ARM: Enable _CPC/_PSD generation on Juno-r2 PierreGondois
2023-12-12  9:30 ` [edk2-devel] [PATCH v4 1/3] Platform/ARM: Juno: Fix typo PierreGondois
2024-01-25 11:24   ` Sami Mujawar
2023-12-12  9:30 ` PierreGondois [this message]
2024-01-25 11:31   ` [edk2-devel] [PATCH v4 2/3] Platform/ARM: Juno: Generate _PSD objects Sami Mujawar
2024-01-25 12:48     ` PierreGondois
2024-01-25 13:59       ` Sami Mujawar
2023-12-12  9:30 ` [edk2-devel] [PATCH v4 3/3] Platform/ARM: Juno: Generate _CPC objects for JunoR2 PierreGondois
2024-01-25 11:47   ` Sami Mujawar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231212093056.1255191-3-Pierre.Gondois@arm.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox