public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Krzysztof Koch" <krzysztof.koch@arm.com>
To: <devel@edk2.groups.io>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>,
	Leif Lindholm <leif.lindholm@linaro.org>,
	Michael D Kinney <michael.d.kinney@intel.com>,
	<Sami.Mujawar@arm.com>, <Matteo.Carlini@arm.com>,
	<Stephanie.Hughes-Fitt@arm.com>, <nd@arm.com>
Subject: [edk2-platforms PATCH v1 1/1 -resend] Platform/ARM/JunoPkg: Add support for PPTT dynamic generation
Date: Wed, 12 Jun 2019 10:31:58 +0100	[thread overview]
Message-ID: <20190612093158.36624-1-krzysztof.koch@arm.com> (raw)

Update the Platform Respository for the Juno platform
to include support for generation of the Processor Properties
Topology Table (PPTT) using the Dynamic Tables Framework.

The Platform Repository now also describes the cache and
processor topology in Juno (all revisions).

Signed-off-by: Krzysztof Koch <krzysztof.koch@arm.com>
---

Changes can be seen at: https://github.com/KrzysztofKoch1/edk2-platforms/tree/392_dynamic_pptt_juno_v1

Notes:
    v1:
    - add support for dynamic generation of PPTT [Krzysztof]

 Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c | 443 +++++++++++++++++++-
 Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h | 136 +++++-
 2 files changed, 575 insertions(+), 4 deletions(-)

diff --git a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
index 78b906ddb8bbd35c32b4be98b1ee8bd973b6b818..2ef79ba5df750e869d241fcba98fdd44b1f26002 100644
--- a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
+++ b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
@@ -96,7 +96,13 @@ EDKII_PLATFORM_REPOSITORY_INFO ArmJunoPlatformRepositoryInfo = {
       CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdSsdt),
       (EFI_ACPI_DESCRIPTION_HEADER*)ssdtuart_aml_code
     },
-
+    // PPTT Table
+    {
+      EFI_ACPI_6_3_PROCESSOR_PROPERTIES_TOPOLOGY_TABLE_STRUCTURE_SIGNATURE,
+      EFI_ACPI_6_3_PROCESSOR_PROPERTIES_TOPOLOGY_TABLE_REVISION,
+      CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdPptt),
+      NULL
+    },
     /* 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
@@ -261,6 +267,301 @@ EDKII_PLATFORM_REPOSITORY_INFO ArmJunoPlatformRepositoryInfo = {
     127,
     // SPI Base used by this frame.
     224
+  },
+
+  // Processor Hierarchy Nodes
+  {
+    // Package
+    {
+      // CM_OBJECT_TOKEN  Token
+      REFERENCE_TOKEN (ProcHierarchyInfo[0]),
+      // UINT32  Flags
+      PROC_NODE_FLAGS (
+        EFI_ACPI_6_3_PPTT_PACKAGE_PHYSICAL,
+        EFI_ACPI_6_3_PPTT_PROCESSOR_ID_INVALID,
+        EFI_ACPI_6_3_PPTT_PROCESSOR_IS_NOT_THREAD,
+        EFI_ACPI_6_3_PPTT_NODE_IS_NOT_LEAF,
+        EFI_ACPI_6_3_PPTT_IMPLEMENTATION_NOT_IDENTICAL
+      ),
+      // CM_OBJECT_TOKEN  ParentToken
+      CM_NULL_TOKEN,
+      // CM_OBJECT_TOKEN  GicCToken
+      CM_NULL_TOKEN,
+      // UINT32  NoOfPrivateResources
+      0,
+      // CM_OBJECT_TOKEN  PrivateResourcesArrayToken
+      CM_NULL_TOKEN
+    },
+    // 'big' cluster
+    {
+      // CM_OBJECT_TOKEN  Token
+      REFERENCE_TOKEN (ProcHierarchyInfo[1]),
+      // UINT32  Flags
+      PROC_NODE_FLAGS (
+        EFI_ACPI_6_3_PPTT_PACKAGE_NOT_PHYSICAL,
+        EFI_ACPI_6_3_PPTT_PROCESSOR_ID_INVALID,
+        EFI_ACPI_6_3_PPTT_PROCESSOR_IS_NOT_THREAD,
+        EFI_ACPI_6_3_PPTT_NODE_IS_NOT_LEAF,
+        EFI_ACPI_6_3_PPTT_IMPLEMENTATION_IDENTICAL
+      ),
+      // CM_OBJECT_TOKEN  ParentToken
+      REFERENCE_TOKEN (ProcHierarchyInfo[0]), // -> Package
+      // CM_OBJECT_TOKEN  GicCToken
+      CM_NULL_TOKEN,
+      // UINT32  NoOfPrivateResources
+      BIG_CLUSTER_RESOURCE_COUNT,
+      // CM_OBJECT_TOKEN  PrivateResourcesArrayToken
+      REFERENCE_TOKEN (BigClusterResources)
+    },
+    // 'LITTLE' cluster
+    {
+      // CM_OBJECT_TOKEN  Token
+      REFERENCE_TOKEN (ProcHierarchyInfo[2]),
+      // UINT32  Flags
+      PROC_NODE_FLAGS (
+        EFI_ACPI_6_3_PPTT_PACKAGE_NOT_PHYSICAL,
+        EFI_ACPI_6_3_PPTT_PROCESSOR_ID_INVALID,
+        EFI_ACPI_6_3_PPTT_PROCESSOR_IS_NOT_THREAD,
+        EFI_ACPI_6_3_PPTT_NODE_IS_NOT_LEAF,
+        EFI_ACPI_6_3_PPTT_IMPLEMENTATION_IDENTICAL
+      ),
+      // CM_OBJECT_TOKEN  ParentToken
+      REFERENCE_TOKEN (ProcHierarchyInfo[0]), // -> Package
+      // CM_OBJECT_TOKEN  GicCToken
+      CM_NULL_TOKEN,
+      // UINT32  NoOfPrivateResources
+      LITTLE_CLUSTER_RESOURCE_COUNT,
+      // CM_OBJECT_TOKEN  PrivateResourcesArrayToken
+      REFERENCE_TOKEN (LittleClusterResources)
+    },
+    // Two 'big' cores
+    {
+      // CM_OBJECT_TOKEN  Token
+      REFERENCE_TOKEN (ProcHierarchyInfo[3]),
+      // UINT32  Flags
+      PROC_NODE_FLAGS (
+        EFI_ACPI_6_3_PPTT_PACKAGE_NOT_PHYSICAL,
+        EFI_ACPI_6_3_PPTT_PROCESSOR_ID_VALID,
+        EFI_ACPI_6_3_PPTT_PROCESSOR_IS_NOT_THREAD,
+        EFI_ACPI_6_3_PPTT_NODE_IS_LEAF,
+        EFI_ACPI_6_3_PPTT_IMPLEMENTATION_NOT_IDENTICAL
+      ),
+      // CM_OBJECT_TOKEN  ParentToken
+      REFERENCE_TOKEN (ProcHierarchyInfo[1]), // -> 'big' cluster
+      // CM_OBJECT_TOKEN  GicCToken
+      REFERENCE_TOKEN (GicCInfo[0]),
+      // UINT32  NoOfPrivateResources
+      BIG_CORE_RESOURCE_COUNT,
+      // CM_OBJECT_TOKEN  PrivateResourcesArrayToken
+      REFERENCE_TOKEN (BigCoreResources)
+    },
+    {
+      // CM_OBJECT_TOKEN  Token
+      REFERENCE_TOKEN (ProcHierarchyInfo[4]),
+      // UINT32  Flags
+      PROC_NODE_FLAGS (
+        EFI_ACPI_6_3_PPTT_PACKAGE_NOT_PHYSICAL,
+        EFI_ACPI_6_3_PPTT_PROCESSOR_ID_VALID,
+        EFI_ACPI_6_3_PPTT_PROCESSOR_IS_NOT_THREAD,
+        EFI_ACPI_6_3_PPTT_NODE_IS_LEAF,
+        EFI_ACPI_6_3_PPTT_IMPLEMENTATION_NOT_IDENTICAL
+      ),
+      // CM_OBJECT_TOKEN  ParentToken
+      REFERENCE_TOKEN (ProcHierarchyInfo[1]), // -> 'big' cluster
+      // CM_OBJECT_TOKEN  GicCToken
+      REFERENCE_TOKEN (GicCInfo[1]),
+      // UINT32  NoOfPrivateResources
+      BIG_CORE_RESOURCE_COUNT,
+      // CM_OBJECT_TOKEN  PrivateResourcesArrayToken
+      REFERENCE_TOKEN (BigCoreResources)
+    },
+    // Four 'LITTLE' cores
+    {
+      // CM_OBJECT_TOKEN  Token
+      REFERENCE_TOKEN (ProcHierarchyInfo[5]),
+      // UINT32  Flags
+      PROC_NODE_FLAGS (
+        EFI_ACPI_6_3_PPTT_PACKAGE_NOT_PHYSICAL,
+        EFI_ACPI_6_3_PPTT_PROCESSOR_ID_VALID,
+        EFI_ACPI_6_3_PPTT_PROCESSOR_IS_NOT_THREAD,
+        EFI_ACPI_6_3_PPTT_NODE_IS_LEAF,
+        EFI_ACPI_6_3_PPTT_IMPLEMENTATION_NOT_IDENTICAL
+      ),
+      // CM_OBJECT_TOKEN  ParentToken
+      REFERENCE_TOKEN (ProcHierarchyInfo[2]), // -> 'LITTLE' cluster
+      // CM_OBJECT_TOKEN  GicCToken
+      REFERENCE_TOKEN (GicCInfo[2]),
+      // UINT32  NoOfPrivateResources
+      LITTLE_CORE_RESOURCE_COUNT,
+      // CM_OBJECT_TOKEN  PrivateResourcesArrayToken
+      REFERENCE_TOKEN (LittleCoreResources)
+    },
+    {
+      // CM_OBJECT_TOKEN  Token
+      REFERENCE_TOKEN (ProcHierarchyInfo[6]),
+      // UINT32  Flags
+      PROC_NODE_FLAGS (
+        EFI_ACPI_6_3_PPTT_PACKAGE_NOT_PHYSICAL,
+        EFI_ACPI_6_3_PPTT_PROCESSOR_ID_VALID,
+        EFI_ACPI_6_3_PPTT_PROCESSOR_IS_NOT_THREAD,
+        EFI_ACPI_6_3_PPTT_NODE_IS_LEAF,
+        EFI_ACPI_6_3_PPTT_IMPLEMENTATION_NOT_IDENTICAL
+      ),
+      // CM_OBJECT_TOKEN  ParentToken
+      REFERENCE_TOKEN (ProcHierarchyInfo[2]), // -> 'LITTLE' cluster
+      // CM_OBJECT_TOKEN  GicCToken
+      REFERENCE_TOKEN (GicCInfo[3]),
+      // UINT32  NoOfPrivateResources
+      LITTLE_CORE_RESOURCE_COUNT,
+      // CM_OBJECT_TOKEN  PrivateResourcesArrayToken
+      REFERENCE_TOKEN (LittleCoreResources)
+    },
+    {
+      // CM_OBJECT_TOKEN  Token
+      REFERENCE_TOKEN (ProcHierarchyInfo[7]),
+      // UINT32  Flags
+      PROC_NODE_FLAGS (
+        EFI_ACPI_6_3_PPTT_PACKAGE_NOT_PHYSICAL,
+        EFI_ACPI_6_3_PPTT_PROCESSOR_ID_VALID,
+        EFI_ACPI_6_3_PPTT_PROCESSOR_IS_NOT_THREAD,
+        EFI_ACPI_6_3_PPTT_NODE_IS_LEAF,
+        EFI_ACPI_6_3_PPTT_IMPLEMENTATION_NOT_IDENTICAL
+      ),
+      // CM_OBJECT_TOKEN  ParentToken
+      REFERENCE_TOKEN (ProcHierarchyInfo[2]), // -> 'LITTLE' cluster
+      // CM_OBJECT_TOKEN  GicCToken
+      REFERENCE_TOKEN (GicCInfo[4]),
+      // UINT32  NoOfPrivateResources
+      LITTLE_CORE_RESOURCE_COUNT,
+      // CM_OBJECT_TOKEN  PrivateResourcesArrayToken
+      REFERENCE_TOKEN (LittleCoreResources)
+    },
+    {
+      // CM_OBJECT_TOKEN  Token
+      REFERENCE_TOKEN (ProcHierarchyInfo[8]),
+      // UINT32  Flags
+      PROC_NODE_FLAGS (
+        EFI_ACPI_6_3_PPTT_PACKAGE_NOT_PHYSICAL,
+        EFI_ACPI_6_3_PPTT_PROCESSOR_ID_VALID,
+        EFI_ACPI_6_3_PPTT_PROCESSOR_IS_NOT_THREAD,
+        EFI_ACPI_6_3_PPTT_NODE_IS_LEAF,
+        EFI_ACPI_6_3_PPTT_IMPLEMENTATION_NOT_IDENTICAL
+      ),
+      // CM_OBJECT_TOKEN  ParentToken
+      REFERENCE_TOKEN (ProcHierarchyInfo[2]), // -> 'LITTLE' cluster
+      // CM_OBJECT_TOKEN  GicCToken
+      REFERENCE_TOKEN (GicCInfo[5]),
+      // UINT32  NoOfPrivateResources
+      LITTLE_CORE_RESOURCE_COUNT,
+      // CM_OBJECT_TOKEN  PrivateResourcesArrayToken
+      REFERENCE_TOKEN (LittleCoreResources)
+    }
+  },
+
+  // Cache information
+  {
+    // 'big' cluster's L2 cache
+    {
+      REFERENCE_TOKEN (CacheInfo[0]),  // CM_OBJECT_TOKEN  Token
+      CM_NULL_TOKEN,                   // CM_OBJECT_TOKEN  NextLevelOfCacheToken
+      0x200000,                        // UINT32  Size
+      2048,                            // UINT32  NumberOfSets
+      16,                              // UINT32  Associativity
+      CACHE_ATTRIBUTES (               // UINT8   Attributes
+        EFI_ACPI_6_3_CACHE_ATTRIBUTES_ALLOCATION_READ_WRITE,
+        EFI_ACPI_6_3_CACHE_ATTRIBUTES_CACHE_TYPE_UNIFIED,
+        EFI_ACPI_6_3_CACHE_ATTRIBUTES_WRITE_POLICY_WRITE_BACK
+      ),
+      64                               // UINT16  LineSize
+    },
+    // 'big' core's L1 instruction cache
+    {
+      REFERENCE_TOKEN (CacheInfo[1]),  // CM_OBJECT_TOKEN  Token
+      CM_NULL_TOKEN,                   // CM_OBJECT_TOKEN  NextLevelOfCacheToken
+      0xc000,                          // UINT32  Size
+      256,                             // UINT32  NumberOfSets
+      3,                               // UINT32  Associativity
+      CACHE_ATTRIBUTES (               // UINT8   Attributes
+        EFI_ACPI_6_3_CACHE_ATTRIBUTES_ALLOCATION_READ,
+        EFI_ACPI_6_3_CACHE_ATTRIBUTES_CACHE_TYPE_INSTRUCTION,
+        EFI_ACPI_6_3_CACHE_ATTRIBUTES_WRITE_POLICY_WRITE_BACK
+      ),
+      64                               // UINT16  LineSize
+    },
+    // 'big' core's L1 data cache
+    {
+      REFERENCE_TOKEN (CacheInfo[2]),  // CM_OBJECT_TOKEN  Token
+      CM_NULL_TOKEN,                   // CM_OBJECT_TOKEN  NextLevelOfCacheToken
+      0x8000,                          // UINT32  Size
+      256,                             // UINT32  NumberOfSets
+      2,                               // UINT32  Associativity
+      CACHE_ATTRIBUTES (               // UINT8   Attributes
+        EFI_ACPI_6_3_CACHE_ATTRIBUTES_ALLOCATION_READ_WRITE,
+        EFI_ACPI_6_3_CACHE_ATTRIBUTES_CACHE_TYPE_DATA,
+        EFI_ACPI_6_3_CACHE_ATTRIBUTES_WRITE_POLICY_WRITE_BACK
+      ),
+      64                               // UINT16  LineSize
+    },
+    // 'LITTLE' cluster's L2 cache
+    {
+      REFERENCE_TOKEN (CacheInfo[3]),  // CM_OBJECT_TOKEN  Token
+      CM_NULL_TOKEN,                   // CM_OBJECT_TOKEN  NextLevelOfCacheToken
+      0x100000,                        // UINT32  Size
+      1024,                            // UINT32  NumberOfSets
+      16,                              // UINT32  Associativity
+      CACHE_ATTRIBUTES (               // UINT8   Attributes
+        EFI_ACPI_6_3_CACHE_ATTRIBUTES_ALLOCATION_READ_WRITE,
+        EFI_ACPI_6_3_CACHE_ATTRIBUTES_CACHE_TYPE_UNIFIED,
+        EFI_ACPI_6_3_CACHE_ATTRIBUTES_WRITE_POLICY_WRITE_BACK
+      ),
+      64                               // UINT16  LineSize
+    },
+    // 'LITTLE' core's L1 instruction cache
+    {
+      REFERENCE_TOKEN (CacheInfo[4]),  // CM_OBJECT_TOKEN  Token
+      CM_NULL_TOKEN,                   // CM_OBJECT_TOKEN  NextLevelOfCacheToken
+      0x8000,                          // UINT32  Size
+      256,                             // UINT32  NumberOfSets
+      2,                               // UINT32  Associativity
+      CACHE_ATTRIBUTES (               // UINT8   Attributes
+        EFI_ACPI_6_3_CACHE_ATTRIBUTES_ALLOCATION_READ,
+        EFI_ACPI_6_3_CACHE_ATTRIBUTES_CACHE_TYPE_INSTRUCTION,
+        EFI_ACPI_6_3_CACHE_ATTRIBUTES_WRITE_POLICY_WRITE_BACK
+      ),
+      64                               // UINT16  LineSize
+    },
+    // 'LITTLE' core's L1 data cache
+    {
+      REFERENCE_TOKEN (CacheInfo[5]),  // CM_OBJECT_TOKEN  Token
+      CM_NULL_TOKEN,                   // CM_OBJECT_TOKEN  NextLevelOfCacheToken
+      0x8000,                          // UINT32  Size
+      128,                             // UINT32  NumberOfSets
+      4,                               // UINT32  Associativity
+      CACHE_ATTRIBUTES (               // UINT8   Attributes
+        EFI_ACPI_6_3_CACHE_ATTRIBUTES_ALLOCATION_READ_WRITE,
+        EFI_ACPI_6_3_CACHE_ATTRIBUTES_CACHE_TYPE_DATA,
+        EFI_ACPI_6_3_CACHE_ATTRIBUTES_WRITE_POLICY_WRITE_BACK
+      ),
+      64                               // UINT16  LineSize
+    }
+  },
+  // Resources private to the 'big' cluster (shared among cores)
+  {
+    { REFERENCE_TOKEN (CacheInfo[0]) }  // -> 'big' cluster's L2 cache
+  },
+  // Resources private to each individual 'big' core instance
+  {
+    { REFERENCE_TOKEN (CacheInfo[1]) }, // -> 'big' core's L1 I-cache
+    { REFERENCE_TOKEN (CacheInfo[2]) }  // -> 'big' core's L1 D-cache
+  },
+  // Resources private to the 'LITTLE' cluster (shared among cores)
+  {
+    { REFERENCE_TOKEN (CacheInfo[3]) }  // -> 'LITTLE' cluster's L2 cache
+  },
+  // Resources private to each individual 'LITTLE' core instance
+  {
+    { REFERENCE_TOKEN (CacheInfo[4]) }, // -> 'LITTLE' core's L1 I-cache
+    { REFERENCE_TOKEN (CacheInfo[5]) }  // -> 'LITTLE' core's L1 D-cache
   }
 };
 
@@ -329,6 +630,121 @@ GetGTBlockTimerFrameInfo (
   return EFI_SUCCESS;
 }
 
+/** Return GIC CPU Interface 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_GICC_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
+GetGicCInfo (
+  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 = sizeof (PlatformRepo->GicCInfo) /
+                    sizeof (PlatformRepo->GicCInfo[0]);
+
+  for (ObjIndex = 0; ObjIndex < TotalObjCount; ObjIndex++) {
+    if (SearchToken == (CM_OBJECT_TOKEN)&PlatformRepo->GicCInfo[ObjIndex]) {
+      CmObject->ObjectId = CmObjectId;
+      CmObject->Size = sizeof (PlatformRepo->GicCInfo[ObjIndex]);
+      CmObject->Data = (VOID*)&PlatformRepo->GicCInfo[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.
+
+  @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_OBJ_REF list.
+  @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
+GetCmObjRefs (
+  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;
+
+  if ((This == NULL) || (CmObject == NULL)) {
+    ASSERT (This != NULL);
+    ASSERT (CmObject != NULL);
+    return EFI_INVALID_PARAMETER;
+  }
+
+  PlatformRepo = This->PlatRepoInfo;
+
+  if (SearchToken == (CM_OBJECT_TOKEN)&PlatformRepo->BigClusterResources) {
+    CmObject->Size = sizeof (PlatformRepo->BigClusterResources);
+    CmObject->Data = (VOID*)&PlatformRepo->BigClusterResources;
+    CmObject->Count = sizeof (PlatformRepo->BigClusterResources) /
+                        sizeof (PlatformRepo->BigClusterResources[0]);
+    return EFI_SUCCESS;
+  }
+  if (SearchToken == (CM_OBJECT_TOKEN)&PlatformRepo->BigCoreResources) {
+    CmObject->Size = sizeof (PlatformRepo->BigCoreResources);
+    CmObject->Data = (VOID*)&PlatformRepo->BigCoreResources;
+    CmObject->Count = sizeof (PlatformRepo->BigCoreResources) /
+                        sizeof (PlatformRepo->BigCoreResources[0]);
+    return EFI_SUCCESS;
+  }
+  if (SearchToken == (CM_OBJECT_TOKEN)&PlatformRepo->LittleClusterResources) {
+    CmObject->Size = sizeof (PlatformRepo->LittleClusterResources);
+    CmObject->Data = (VOID*)&PlatformRepo->LittleClusterResources;
+    CmObject->Count = sizeof (PlatformRepo->LittleClusterResources) /
+                        sizeof (PlatformRepo->LittleClusterResources[0]);
+    return EFI_SUCCESS;
+  }
+  if (SearchToken == (CM_OBJECT_TOKEN)&PlatformRepo->LittleCoreResources) {
+    CmObject->Size = sizeof (PlatformRepo->LittleCoreResources);
+    CmObject->Data = (VOID*)&PlatformRepo->LittleCoreResources;
+    CmObject->Count = sizeof (PlatformRepo->LittleCoreResources) /
+                        sizeof (PlatformRepo->LittleCoreResources[0]);
+    return EFI_SUCCESS;
+  }
+
+  return EFI_NOT_FOUND;
+}
+
 /** Return a standard namespace object.
 
   @param [in]      This        Pointer to the Configuration Manager Protocol.
@@ -486,12 +902,14 @@ GetArmNameSpaceObject (
       Token,
       GetGTBlockTimerFrameInfo
       );
-    HANDLE_CM_OBJECT (
+    HANDLE_CM_OBJECT_REF_BY_TOKEN (
       EArmObjGicCInfo,
       CmObjectId,
       PlatformRepo->GicCInfo,
       (sizeof (PlatformRepo->GicCInfo) /
-         sizeof (PlatformRepo->GicCInfo[0]))
+         sizeof (PlatformRepo->GicCInfo[0])),
+      Token,
+      GetGicCInfo
       );
     HANDLE_CM_OBJECT (
       EArmObjGicDInfo,
@@ -518,6 +936,25 @@ GetArmNameSpaceObject (
       PlatformRepo->GicMsiFrameInfo,
       1
       );
+    HANDLE_CM_OBJECT (
+      EArmObjProcHierarchyInfo,
+      CmObjectId,
+      PlatformRepo->ProcHierarchyInfo,
+      (sizeof (PlatformRepo->ProcHierarchyInfo) /
+         sizeof (PlatformRepo->ProcHierarchyInfo[0]))
+      );
+    HANDLE_CM_OBJECT (
+      EArmObjCacheInfo,
+      CmObjectId,
+      PlatformRepo->CacheInfo,
+      sizeof (PlatformRepo->CacheInfo) / sizeof (PlatformRepo->CacheInfo[0])
+      );
+    HANDLE_CM_OBJECT_SEARCH_PLAT_REPO (
+      EArmObjCmRef,
+      CmObjectId,
+      Token,
+      GetCmObjRefs
+      );
 
     case EArmObjPciConfigSpaceInfo:
       if (PlatformRepo->JunoRevision != JUNO_REVISION_R0) {
diff --git a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h
index 060817430fe75fdf79196f8a9d31561028fb0f50..7fdf663fc6d2ad80da26ff1f1635c858d5be4e93 100644
--- a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h
+++ b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h
@@ -20,6 +20,12 @@
 */
 #define CFG_MGR_OEM_ID    { 'A', 'R', 'M', 'L', 'T', 'D' }
 
+/** A helper macro for mapping a reference token
+*/
+#define REFERENCE_TOKEN(Field)                                           \
+  (CM_OBJECT_TOKEN)((UINT8*)&ArmJunoPlatformRepositoryInfo +             \
+    OFFSET_OF (EDKII_PLATFORM_REPOSITORY_INFO, Field))
+
 /** A helper macro for populating the GIC CPU information
 */
 #define GICC_ENTRY(                                                      \
@@ -46,6 +52,36 @@
     EnergyEfficiency          /* UINT8   ProcessorPowerEfficiencyClass*/ \
     }
 
+/** A helper macro for populating the Processor Hierarchy Node flags
+*/
+#define PROC_NODE_FLAGS(                                                \
+          PhysicalPackage,                                              \
+          AcpiProcessorIdValid,                                         \
+          ProcessorIsThread,                                            \
+          NodeIsLeaf,                                                   \
+          IdenticalImplementation                                       \
+          )                                                             \
+  (                                                                     \
+    PhysicalPackage |                                                   \
+    (AcpiProcessorIdValid << 1) |                                       \
+    (ProcessorIsThread << 2) |                                          \
+    (NodeIsLeaf << 3) |                                                 \
+    (IdenticalImplementation << 4)                                      \
+  )
+
+/** A helper macro for populating the Cache Type Structure's attributes
+*/
+#define CACHE_ATTRIBUTES(                                               \
+          AllocationType,                                               \
+          CacheType,                                                    \
+          WritePolicy                                                   \
+          )                                                             \
+  (                                                                     \
+    AllocationType |                                                    \
+    (CacheType << 2) |                                                  \
+    (WritePolicy << 4)                                                  \
+  )
+
 /** A helper macro for returning configuration manager objects
 */
 #define HANDLE_CM_OBJECT(ObjId, CmObjectId, Object, ObjectCount)      \
@@ -102,13 +138,46 @@
     break;                                                                  \
   }
 
+/** A helper macro for returning configuration manager objects referenced
+    by token when the entire platform repository is in scope and the
+    CM_NULL_TOKEN value is not allowed.
+*/
+#define HANDLE_CM_OBJECT_SEARCH_PLAT_REPO(                                  \
+          ObjId,                                                            \
+          CmObjectId,                                                       \
+          Token,                                                            \
+          HandlerProc                                                       \
+          )                                                                 \
+  case ObjId: {                                                             \
+    CmObject->ObjectId = CmObjectId;                                        \
+    if (Token == CM_NULL_TOKEN) {                                           \
+      Status = EFI_INVALID_PARAMETER;                                       \
+      DEBUG ((                                                              \
+        DEBUG_ERROR,                                                        \
+        #ObjId ": CM_NULL_TOKEN value is not allowed when searching"        \
+        " the entire platform repository.\n"                                \
+        ));                                                                 \
+    } else {                                                                \
+      Status = HandlerProc (This, CmObjectId, Token, CmObject);             \
+      DEBUG ((                                                              \
+        DEBUG_INFO,                                                         \
+        #ObjId ": Token = 0x%p, Ptr = 0x%p, Size = %d, Count = %d\n",       \
+        (VOID*)Token,                                                       \
+        CmObject->Data,                                                     \
+        CmObject->Size,                                                     \
+        CmObject->Count                                                     \
+        ));                                                                 \
+    }                                                                       \
+    break;                                                                  \
+  }
+
 /** The number of CPUs
 */
 #define PLAT_CPU_COUNT          6
 
 /** 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
 */
@@ -118,6 +187,53 @@
 */
 #define PLAT_GTFRAME_COUNT          2
 
+/** For all Juno revisions, the cache and processor topology is identical.
+
+  Terms 'big' and 'LITTLE' are used in favour of A72, A57 or A53 to take into
+  account that Juno r2 uses Cortex-A72 as 'big' cores, whereas Juno r0 and r1
+  have Cortex-A57 as 'big' cores.
+*/
+
+/** The number of Processor Hierarchy Nodes
+    - one package node
+    - two cluster nodes ('big' + 'LITTLE')
+    - two 'big' cores
+    - four 'LITTLE' cores
+*/
+#define PLAT_PROC_HIERARCHY_NODE_COUNT  9
+
+/** The number of unique cache structures:
+    - 'big' core L1 instruction cache
+    - 'big' core L1 data cache
+    - 'big' core L2 cache
+    - 'LITTLE' core L1 instruction cache
+    - 'LITTLE' core L1 data cache
+    - 'LITTLE' core L2 cache
+*/
+#define PLAT_CACHE_COUNT                6
+
+/** The number of resources private to the entire 'big' cluster
+    - L2 cache
+*/
+#define BIG_CLUSTER_RESOURCE_COUNT  1
+
+/** The number of resources private to 'big' core instance
+    - L1 data cache
+    - L1 instruction cache
+*/
+#define BIG_CORE_RESOURCE_COUNT  2
+
+/** The number of resources private to the entire 'LITTLE' cluster
+    - L2 cache
+*/
+#define LITTLE_CLUSTER_RESOURCE_COUNT  1
+
+/** The number of resources private to each 'LITTLE' core instance
+    - L1 data cache
+    - L1 instruction cache
+*/
+#define LITTLE_CORE_RESOURCE_COUNT  2
+
 /** A structure describing the platform configuration
     manager repository information
 */
@@ -166,6 +282,24 @@ typedef struct PlatformRepositoryInfo {
   /// GIC MSI Frame information
   CM_ARM_GIC_MSI_FRAME_INFO             GicMsiFrameInfo;
 
+  // Processor topology information
+  CM_ARM_PROC_HIERARCHY_INFO            ProcHierarchyInfo[PLAT_PROC_HIERARCHY_NODE_COUNT];
+
+  // Cache information
+  CM_ARM_CACHE_INFO                     CacheInfo[PLAT_CACHE_COUNT];
+
+  // 'big' cluster private resources
+  CM_ARM_OBJ_REF                        BigClusterResources[BIG_CLUSTER_RESOURCE_COUNT];
+
+  // 'big' core private resources
+  CM_ARM_OBJ_REF                        BigCoreResources[BIG_CORE_RESOURCE_COUNT];
+
+  // 'LITTLE' cluster private resources
+  CM_ARM_OBJ_REF                        LittleClusterResources[LITTLE_CLUSTER_RESOURCE_COUNT];
+
+  // 'LITTLE' core private resources
+  CM_ARM_OBJ_REF                        LittleCoreResources[LITTLE_CORE_RESOURCE_COUNT];
+
   /// Juno Board Revision
   UINT32                                JunoRevision;
 } EDKII_PLATFORM_REPOSITORY_INFO;
--
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'



             reply	other threads:[~2019-06-12  9:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-12  9:31 Krzysztof Koch [this message]
2019-06-12  9:35 ` [edk2-devel] [edk2-platforms PATCH v1 1/1 -resend] Platform/ARM/JunoPkg: Add support for PPTT dynamic generation Alexei Fedorov
2019-06-14 16:38 ` Sami Mujawar
2019-06-17 11:40 ` Leif Lindholm

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=20190612093158.36624-1-krzysztof.koch@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