On Wed, Jun 12, 2019 at 10:31:58AM +0100, Krzysztof Koch wrote: > 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.k...@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 > @@ -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]);
Please replace this pattern with the ARRAY_SIZE macro from Base.h, throughout (in new or modified code, including partials). / Leif > + > + 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)' > > -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#42508): https://edk2.groups.io/g/devel/message/42508 Mute This Topic: https://groups.io/mt/32039191/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-