From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail05.groups.io (mail05.groups.io [45.79.224.7]) by spool.mail.gandi.net (Postfix) with ESMTPS id 7E2417803CE for ; Fri, 5 Jul 2024 13:22:42 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=MRrFpRgGaD8hJWDufh6qGrcNofZrcnxZIMBJO6ENeU4=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Resent-From:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20240206; t=1720185762; v=1; b=MNOEuZUke7/agS974begNDaV/5DdFf7VvFdCwfmbmUMRWgGvPq/1DoRGX/IEDxme6q85haqQ Ic/xT1BEwXaC0A7b8+5yLk1CDCiNkV2Ia2LNnNKWLO27GNjSHMWvhpQqhmTYuAW8Jv+EYIFyu+I 9DyoPmx81LU2/p/+cqeE0QvQP9mKrQHZx44h6KhNPUhezIM4QW618MoLlGM9lmYAOsWg6tXT7rw cBHSIcALuWtNUapsVqFKYGOGvM2Yfzr6gS6NIUy0TmNJ13lXC1l5MAepCuxmVK3uITLUFrKV0R5 MX0eXgLdQi7LSI9tfxMswynZ5vyUwegOihbGpDAsjhtQA== X-Received: by 127.0.0.2 with SMTP id nTtCYY7687511xMUSjJWcHcz; Fri, 05 Jul 2024 06:22:41 -0700 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web11.17061.1720185760343577421 for ; Fri, 05 Jul 2024 06:22:40 -0700 X-Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 223B1367; Fri, 5 Jul 2024 06:23:05 -0700 (PDT) X-Received: from e129823.cambridge.arm.com (e129823.arm.com [10.1.197.6]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id C808A3F762; Fri, 5 Jul 2024 06:22:38 -0700 (PDT) From: "levi.yun" To: devel@edk2.groups.io Cc: yeoreum.yun@arm.com, sami.mujawar@arm.com, pierre.gondois@arm.com, nd@arm.com, thomas.abraham@arm.com Subject: [edk2-devel] [PATCH v1 edk2-platform 2/2] VExpressPkg/ConfigurationManger: Add PPTT generation. Date: Fri, 5 Jul 2024 14:22:31 +0100 Message-Id: <20240705132231.1574767-3-yeoreum.yun@arm.com> In-Reply-To: <20240705132231.1574767-2-yeoreum.yun@arm.com> References: <20240705132231.1574767-1-yeoreum.yun@arm.com> <20240705132231.1574767-2-yeoreum.yun@arm.com> MIME-Version: 1.0 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Resent-Date: Fri, 05 Jul 2024 06:22:40 -0700 Resent-From: yeoreum.yun@arm.com Reply-To: devel@edk2.groups.io,yeoreum.yun@arm.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: wb9oBXHArNPIuDcUUoDDvYYsx7686176AA= Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b=MNOEuZUk; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=arm.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 45.79.224.7 as permitted sender) smtp.mailfrom=bounce@groups.io From: "Levi Yun" Add PPTT generation information for Base FVP platform. The Base FVP platform can configure cache size/line size/ways. PPTT cache description can be modified at build time through PCDs to match the FVP setup. Also, whether model is RevC or not, Base FVP use multi thread compatible = or not. Change static definition of hierarchy node information to generate it dynamically and allocate cache information & private resource dynamically too. Signed-off-by: Levi Yun --- Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/Co= nfigurationManagerDxe.inf | 14 + Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/Co= nfigurationManager.h | 154 ++- Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/Co= nfigurationManager.c | 987 +++++++++++++++++++- 3 files changed, 1147 insertions(+), 8 deletions(-) diff --git a/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationM= anagerDxe/ConfigurationManagerDxe.inf b/Platform/ARM/VExpressPkg/Configur= ationManager/ConfigurationManagerDxe/ConfigurationManagerDxe.inf index dd08f8597768d4de62941c5fd74e329c431582b0..c4adb60fd30cbba61fa0b14a0= 7cc6c03b30df533 100644 --- a/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerD= xe/ConfigurationManagerDxe.inf +++ b/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerD= xe/ConfigurationManagerDxe.inf @@ -77,6 +77,20 @@ [FixedPcd] gArmTokenSpaceGuid.PcdPciBusMin gArmTokenSpaceGuid.PcdPciBusMax =20 + gArmPlatformTokenSpaceGuid.PcdCoreCount + gArmPlatformTokenSpaceGuid.PcdClusterCount + + gArmVExpressTokenSpaceGuid.PcdL1DcacheSize + gArmVExpressTokenSpaceGuid.PcdL1DcacheWays + gArmVExpressTokenSpaceGuid.PcdL1DcacheLineSize + gArmVExpressTokenSpaceGuid.PcdL1IcacheSize + gArmVExpressTokenSpaceGuid.PcdL1IcacheWays + gArmVExpressTokenSpaceGuid.PcdL1IcacheLineSize + gArmVExpressTokenSpaceGuid.PcdL2CacheSize + gArmVExpressTokenSpaceGuid.PcdL2CacheWays + gArmVExpressTokenSpaceGuid.PcdL3CacheSize + gArmVExpressTokenSpaceGuid.PcdL3CacheWays + [Pcd] =20 [Depex] diff --git a/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationM= anagerDxe/ConfigurationManager.h b/Platform/ARM/VExpressPkg/Configuration= Manager/ConfigurationManagerDxe/ConfigurationManager.h index be2b512911f897dc57328673ae4f4a2014ec20fb..b37273edc5d39be8aa211cd78= 247322c03ffb706 100644 --- a/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerD= xe/ConfigurationManager.h +++ b/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerD= xe/ConfigurationManager.h @@ -19,6 +19,14 @@ extern CHAR8 dsdt_aml_code[]; extern CHAR8 ssdtpci_aml_code[]; =20 +// Cache type identifier used to calculate unique cache ID for PPTT +typedef enum { + L1DataCache =3D 1, + L1InstructionCache, + L2Cache, + L3Cache, +} CACHE_TYPE; + /** The configuration manager version. */ #define CONFIGURATION_MANAGER_REVISION CREATE_REVISION (1, 0) @@ -83,13 +91,38 @@ typedef EFI_STATUS (*CM_OBJECT_HANDLER_PROC) ( #define GET_MPID_MT(Cluster, Core, Thread) \ (((Cluster) << 16) | ((Core) << 8) | (Thread)) =20 +/** The number of Packages +*/ +#define PLAT_PACKAGE_COUNT 1 + +/** The number of Cluster per Package +*/ +#define PLAT_CLUSTER_COUNT FixedPcdGet32 (PcdClusterCount) + +/** The number of Core per Cluster +*/ +#define PLAT_CORE_COUNT FixedPcdGet32 (PcdCoreCount) + +/** The number of Thread per Core (If RevC model) +*/ +#define PLAT_THREAD_COUNT 1 + /** The number of CPUs */ -#define PLAT_CPU_COUNT 8 +#define PLAT_CPU_COUNT \ + (PLAT_PACKAGE_COUNT * PLAT_CLUSTER_COUNT * PLAT_CORE_COUNT) + +/** The number of Processor Hierarchy Nodes + - one package node + - two cluster nodes + - four cores in each cluster +*/ +#define PLAT_PROC_HIERARCHY_NODE_COUNT \ + (PLAT_PACKAGE_COUNT + PLAT_CLUSTER_COUNT + PLAT_CPU_COUNT) =20 /** The number of ACPI tables to install */ -#define PLAT_ACPI_TABLE_COUNT 10 +#define PLAT_ACPI_TABLE_COUNT 11 =20 /** The number of platform generic timer blocks */ @@ -99,6 +132,106 @@ typedef EFI_STATUS (*CM_OBJECT_HANDLER_PROC) ( */ #define PLAT_GTFRAME_COUNT 2 =20 +/** A helper macro for populating the Cache Type Structure's attributes +*/ +#define CACHE_ATTRIBUTES( = \ + AllocationType, = \ + CacheType, = \ + WritePolicy = \ + ) = \ + ( = \ + AllocationType | = \ + (CacheType << 2) | = \ + (WritePolicy << 4) = \ + ) + +#define CACHE_ID(ClusterId, CoreId, CacheType) = \ + ( = \ + (((ClusterId) & 0xFF) << 12) | = \ + (((CoreId) & 0xFF) << 4) | = \ + ((CacheType) & 0xF) = \ + ) + +/** 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) = \ + ) + +#define PPTT_PROCESSOR_PACKAGE_FLAGS = \ + PROC_NODE_FLAGS ( = \ + EFI_ACPI_6_4_PPTT_PACKAGE_PHYSICAL, = \ + EFI_ACPI_6_4_PPTT_PROCESSOR_ID_INVALID, = \ + EFI_ACPI_6_4_PPTT_PROCESSOR_IS_NOT_THREAD, = \ + EFI_ACPI_6_4_PPTT_NODE_IS_NOT_LEAF, = \ + EFI_ACPI_6_4_PPTT_IMPLEMENTATION_IDENTICAL = \ + ) = \ + +#define PPTT_PROCESSOR_CLUSTER_FLAGS = \ + PROC_NODE_FLAGS ( = \ + EFI_ACPI_6_4_PPTT_PACKAGE_NOT_PHYSICAL, = \ + EFI_ACPI_6_4_PPTT_PROCESSOR_ID_INVALID, = \ + EFI_ACPI_6_4_PPTT_PROCESSOR_IS_NOT_THREAD, = \ + EFI_ACPI_6_4_PPTT_NODE_IS_NOT_LEAF, = \ + EFI_ACPI_6_4_PPTT_IMPLEMENTATION_IDENTICAL = \ + ) + +#define PPTT_PROCESSOR_CORE_FLAGS = \ + PROC_NODE_FLAGS ( = \ + EFI_ACPI_6_4_PPTT_PACKAGE_NOT_PHYSICAL, = \ + EFI_ACPI_6_4_PPTT_PROCESSOR_ID_VALID, = \ + EFI_ACPI_6_4_PPTT_PROCESSOR_IS_NOT_THREAD, = \ + EFI_ACPI_6_4_PPTT_NODE_IS_LEAF, = \ + EFI_ACPI_6_4_PPTT_IMPLEMENTATION_NOT_IDENTICAL = \ + ) + +#define PPTT_PROCESSOR_CORE_THREADED_FLAGS = \ + PROC_NODE_FLAGS ( = \ + EFI_ACPI_6_4_PPTT_PACKAGE_NOT_PHYSICAL, = \ + EFI_ACPI_6_4_PPTT_PROCESSOR_ID_INVALID, = \ + EFI_ACPI_6_4_PPTT_PROCESSOR_IS_NOT_THREAD, = \ + EFI_ACPI_6_4_PPTT_NODE_IS_NOT_LEAF, = \ + EFI_ACPI_6_4_PPTT_IMPLEMENTATION_IDENTICAL = \ + ) + +#define PPTT_PROCESSOR_THREAD_FLAGS = \ + PROC_NODE_FLAGS ( = \ + EFI_ACPI_6_4_PPTT_PACKAGE_NOT_PHYSICAL, = \ + EFI_ACPI_6_4_PPTT_PROCESSOR_ID_VALID, = \ + EFI_ACPI_6_4_PPTT_PROCESSOR_IS_THREAD, = \ + EFI_ACPI_6_4_PPTT_NODE_IS_LEAF, = \ + EFI_ACPI_6_4_PPTT_IMPLEMENTATION_NOT_IDENTICAL = \ + ) + +#define GET_PACKAGE_HNODE(PackageId) = \ + (&VExpressPlatRepositoryInfo.ProcHierarchyInfo[PackageId]) + +#define GET_CLUSTER_HNODE(ClusterId) = \ + (&VExpressPlatRepositoryInfo.ProcHierarchyInfo[ = \ + (PLAT_PACKAGE_COUNT + ClusterId)]) + +#define GET_CORE_HNODE(ClusterId, CoreId) = \ + (&VExpressPlatRepositoryInfo.ProcHierarchyInfo[ = \ + (PLAT_PACKAGE_COUNT + PLAT_CLUSTER_COUNT + = \ + (ClusterId * (PLAT_CORE_COUNT)) + = \ + (CoreId))]) + +#define L1_DCACHE_PRESENT (FixedPcdGet32 (PcdL1DcacheSize) !=3D 0) +#define L1_ICACHE_PRESENT (FixedPcdGet32 (PcdL1IcacheSize) !=3D 0) +#define L2_CACHE_PRESENT (FixedPcdGet32 (PcdL2CacheSize) !=3D 0) +#define L3_CACHE_PRESENT (FixedPcdGet32 (PcdL3CacheSize) !=3D 0) + /** A structure describing the platform configuration manager repository information */ @@ -175,6 +308,23 @@ typedef struct PlatformRepositoryInfo { =20 /// System ID UINT32 SysId; + + /// Processor topology information + CM_ARM_PROC_HIERARCHY_INFO *ProcHierarchyInfo; + UINT32 ProcNodeCount; + + /// Cache information + CM_ARM_CACHE_INFO *CacheInfo; + UINT32 CacheInfoCount; + + /// Cluster private resources + CM_ARM_OBJ_REF **ClusterResources; + UINT32 PerCluResCnt; + + /// Core private resources + CM_ARM_OBJ_REF **CoreResources; + UINT32 PerCoreResCnt; + } EDKII_PLATFORM_REPOSITORY_INFO; =20 #endif // CONFIGURATION_MANAGER_H__ diff --git a/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationM= anagerDxe/ConfigurationManager.c b/Platform/ARM/VExpressPkg/Configuration= Manager/ConfigurationManagerDxe/ConfigurationManager.c index 5b5d1f9d04c0f27bf32cca62f51c259152e16711..ee6936cb9f0f4b755c0564634= d60d2b25f758e56 100644 --- a/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerD= xe/ConfigurationManager.c +++ b/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerD= xe/ConfigurationManager.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -26,6 +27,8 @@ #include "ConfigurationManager.h" #include "Platform.h" =20 +STATIC BOOLEAN mIsThreaded =3D FALSE; + /** The platform configuration repository information. */ STATIC @@ -106,6 +109,13 @@ EDKII_PLATFORM_REPOSITORY_INFO VExpressPlatRepositor= yInfo =3D { CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdSsdt), (EFI_ACPI_DESCRIPTION_HEADER*)ssdtpci_aml_code }, + /// PPTT Tabale + { + EFI_ACPI_6_4_PROCESSOR_PROPERTIES_TOPOLOGY_TABLE_STRUCTURE_SIGNATU= RE, + EFI_ACPI_6_4_PROCESSOR_PROPERTIES_TOPOLOGY_TABLE_REVISION, + CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdPptt), + NULL, + }, }, =20 // Boot architecture information @@ -369,7 +379,7 @@ EDKII_PLATFORM_REPOSITORY_INFO VExpressPlatRepository= Info =3D { // Embedded Trace device info { ArmEtTypeEte - } + }, }; =20 /** A helper function for returning the Configuration Manager Objects. @@ -442,6 +452,7 @@ HandleCmObjectRefByToken ( ) { EFI_STATUS Status; + CmObjectDesc->ObjectId =3D CmObjectId; if (Token =3D=3D CM_NULL_TOKEN) { CmObjectDesc->Size =3D ObjectSize; @@ -464,6 +475,736 @@ HandleCmObjectRefByToken ( return Status; } =20 +/** A helper function for returning Configuration Manager Object(s) refe= renced + by token when the entire platform repository is in scope and the + CM_NULL_TOKEN value is not allowed. + + @param [in] This Pointer to the Configuration Manager P= rotocol. + @param [in] CmObjectId The Configuration Manager Object ID. + @param [in] Token A token identifying the object. + @param [in] HandlerProc A handler function to search the objec= t(s) + referenced by the token. + @param [in, out] CmObjectDesc Pointer to the Configuration Manager O= bject + descriptor describing the requested Ob= ject. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER A parameter is invalid. + @retval EFI_NOT_FOUND The required object information is not f= ound. +**/ +STATIC +EFI_STATUS +EFIAPI +HandleCmObjectSearchPlatformRepo ( + IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST This, + IN CONST CM_OBJECT_ID CmObjectId, + IN CONST CM_OBJECT_TOKEN Token, + IN CONST CM_OBJECT_HANDLER_PROC HandlerProc, + IN OUT CM_OBJ_DESCRIPTOR *CONST CmObjectDesc + ) +{ + EFI_STATUS Status; + + CmObjectDesc->ObjectId =3D CmObjectId; + + if (Token =3D=3D CM_NULL_TOKEN) { + DEBUG (( + DEBUG_ERROR, + "ERROR: CM_NULL_TOKEN value is not allowed when searching" + " the entire platform repository.\n" + )); + + return EFI_INVALID_PARAMETER; + } + + Status =3D HandlerProc (This, CmObjectId, Token, CmObjectDesc); + DEBUG (( + DEBUG_INFO, + "INFO: Token =3D 0x%p, CmObjectId =3D %x, Ptr =3D 0x%p, Size =3D %d,= Count =3D %d\n", + CmObjectId, + (VOID*)Token, + CmObjectDesc->Data, + CmObjectDesc->Size, + CmObjectDesc->Count + )); + + return Status; +} + +/** Get matched GicC Token with Mpidr information. + + @param [in] PlatformRepo Pointer to Platform Repository. + @param [in] PackageId Package Id. + @param [in] ClusterId Cluster Id. + @param [in] CoreId Core Id. + @param [in] ThreadId Thread Id. + + @retval CM_NULL_TOKEN There's no macthed Gicc entry. + @retval Others Matched Gicc entry. +**/ +STATIC +CM_OBJECT_TOKEN +EFIAPI +GetGicCToken ( + IN EDKII_PLATFORM_REPOSITORY_INFO *PlatformRepo, + IN INTN PackageId, + IN INTN ClusterId, + IN INTN CoreId, + IN INTN ThreadId + ) +{ + UINT64 MpIdr; + INTN Idx; + CM_ARM_GICC_INFO *GicCInfo; + + if (mIsThreaded =3D=3D TRUE) { + MpIdr =3D GET_MPID_MT (ClusterId, CoreId, ThreadId); + } else { + MpIdr =3D GET_MPID (ClusterId, CoreId); + } + + for (Idx =3D 0; Idx < PLAT_CPU_COUNT; Idx++) { + GicCInfo =3D &PlatformRepo->GicCInfo[Idx]; + + if (GicCInfo->MPIDR =3D=3D MpIdr) { + return (CM_OBJECT_TOKEN) GicCInfo; + } + } + + return CM_NULL_TOKEN; +} + +/** Populate Cluster Hierarchy Info used for generating PPTT. + + @param [in] PlatformRepo Pointer to Platform Repository. + @param [in] StartIdx Start Index in PlatformRepo->Hierarc= hyInfo + for generated Thread Hierarchy Info. + @param [in] PackageId Package Id. + @param [out] NextIdx Index used to generate next Hierarch= y Info + information. +**/ +STATIC +VOID +EFIAPI +PopulatePackageNodes ( + IN EDKII_PLATFORM_REPOSITORY_INFO *PlatformRepo, + IN INTN StartIdx, + OUT INTN *NextIdx + ) +{ + INTN Idx; + CM_ARM_PROC_HIERARCHY_INFO *PackageNode; + + for (Idx =3D StartIdx; Idx < StartIdx + PLAT_PACKAGE_COUNT; Idx++) { + PackageNode =3D &PlatformRepo->ProcHierarchyInfo[Idx]; + + PackageNode->Token =3D (CM_OBJECT_TOKEN) PackageNode; + PackageNode->Flags =3D PPTT_PROCESSOR_PACKAGE_FLAGS; + PackageNode->ParentToken =3D CM_NULL_TOKEN; + PackageNode->GicCToken =3D CM_NULL_TOKEN; + } + + *NextIdx =3D Idx; +} + +/** Populate Cluster Hierarchy Info used for generating PPTT. + + @param [in] PlatformRepo Pointer to Platform Repository. + @param [in] StartIdx Start Index in PlatformRepo->Hierarc= hyInfo + for generated Thread Hierarchy Info. + @param [in] PackageId Package Id. + @param [out] NextIdx Index used to generate next Hierarch= y Info + information. +**/ +STATIC +VOID +EFIAPI +PopulateClusterNodes ( + IN EDKII_PLATFORM_REPOSITORY_INFO *PlatformRepo, + IN INTN StartIdx, + IN INTN PackageId, + OUT INTN *NextIdx + ) +{ + INTN Idx; + CM_ARM_PROC_HIERARCHY_INFO *ClusterNode; + + for (Idx =3D StartIdx; Idx < StartIdx + PLAT_CLUSTER_COUNT; Idx++) { + ClusterNode =3D &PlatformRepo->ProcHierarchyInfo[Idx]; + + ClusterNode->Token =3D (CM_OBJECT_TOKEN) ClusterNode; + ClusterNode->Flags =3D PPTT_PROCESSOR_CLUSTER_FLAGS; + ClusterNode->ParentToken =3D (CM_OBJECT_TOKEN) GET_PACKAGE_HNODE(Pac= kageId); + ClusterNode->GicCToken =3D CM_NULL_TOKEN; + } + + *NextIdx =3D Idx; +} + +/** Populate Core Hierarchy Info used for generating PPTT. + + @param [in] PlatformRepo Pointer to Platform Repository. + @param [in] StartIdx Start Index in PlatformRepo->Hierarc= hyInfo + for generated Thread Hierarchy Info. + @param [in] PackageId Package Id. + @param [in] ClusterId Cluster Id. + @param [out] NextIdx Index used to generate next Hierarch= y Info + information. +**/ +STATIC +VOID +EFIAPI +PopulateCoreNodes ( + IN EDKII_PLATFORM_REPOSITORY_INFO *PlatformRepo, + IN INTN StartIdx, + IN INTN PackageId, + IN INTN ClusterId, + OUT INTN *NextIdx + ) +{ + INTN Idx; + CM_ARM_PROC_HIERARCHY_INFO *CoreNode; + + for (Idx =3D StartIdx; Idx < StartIdx + PLAT_CORE_COUNT; Idx++) { + CoreNode =3D &PlatformRepo->ProcHierarchyInfo[Idx]; + + CoreNode->Token =3D (CM_OBJECT_TOKEN) CoreNode; + CoreNode->ParentToken =3D (CM_OBJECT_TOKEN) GET_CLUSTER_HNODE(Cluste= rId); + + if (mIsThreaded =3D=3D TRUE) { + CoreNode->Flags =3D PPTT_PROCESSOR_CORE_THREADED_FLAGS; + CoreNode->GicCToken =3D CM_NULL_TOKEN; + } else { + CoreNode->Flags =3D PPTT_PROCESSOR_CORE_FLAGS; + CoreNode->GicCToken =3D GetGicCToken (PlatformRepo, + PackageId, ClusterId, Idx - StartIdx, 0); + + ASSERT (CoreNode->GicCToken !=3D CM_NULL_TOKEN); + } + } + + *NextIdx =3D Idx; +} + +/** Populate Thread Hierarchy Info used for generating PPTT. + + @param [in] PlatformRepo Pointer to Platform Repository. + @param [in] StartIdx Start Index in PlatformRepo->Hierarc= hyInfo + for generated Thread Hierarchy Info. + @param [in] PackageId Package Id. + @param [in] ClusterId Cluster Id. + @param [in] CoreId Core Id. + @param [out] NextIdx Index used to generate next Hierarch= y Info + information. +**/ +STATIC +VOID +EFIAPI +PopulateThreadNodes ( + IN EDKII_PLATFORM_REPOSITORY_INFO *PlatformRepo, + IN INTN StartIdx, + IN INTN PackageId, + IN INTN ClusterId, + IN INTN CoreId, + OUT INTN *NextIdx + ) +{ + INTN Idx; + CM_ARM_PROC_HIERARCHY_INFO *ThreadNode; + + for (Idx =3D StartIdx; Idx < StartIdx + PLAT_THREAD_COUNT; Idx++) { + ThreadNode =3D &PlatformRepo->ProcHierarchyInfo[Idx]; + + ThreadNode->Token =3D (CM_OBJECT_TOKEN) ThreadNode; + ThreadNode->ParentToken =3D (CM_OBJECT_TOKEN) GET_CORE_HNODE(Cluster= Id, CoreId); + ThreadNode->Flags =3D PPTT_PROCESSOR_THREAD_FLAGS; + ThreadNode->GicCToken =3D GetGicCToken (PlatformRepo, + PackageId, ClusterId, CoreId, Idx - StartIdx); + + ASSERT (ThreadNode->GicCToken !=3D CM_NULL_TOKEN); + } + + *NextIdx =3D Idx; +} + +/** Populate Hierarchy Info used for generating PPTT. + + @param [in] PlatformRepo Pointer to Platform Repository. + + @retval EFI_SUCCESS Success. + @retval EFI_OUT_OF_RESOURCES Out of memory. +**/ +STATIC +EFI_STATUS +EFIAPI +PopulateHierarchyInfo ( + IN EDKII_PLATFORM_REPOSITORY_INFO *PlatformRepo + ) +{ + INTN StartIdx; + INTN NextIdx; + INTN Idx; + INTN PackageCount; + INTN ClusterCount; + INTN CoreCount; + INTN ThreadCount; + + PackageCount =3D PLAT_PACKAGE_COUNT; + ClusterCount =3D PackageCount * PLAT_CLUSTER_COUNT; + CoreCount =3D ClusterCount * PLAT_CORE_COUNT; + ThreadCount =3D mIsThreaded =3D=3D TRUE ? CoreCount * PLAT_THREAD_COUN= T : 0; + PlatformRepo->ProcNodeCount =3D PackageCount + ClusterCount + CoreCoun= t + ThreadCount; + + PlatformRepo->ProcHierarchyInfo =3D AllocateZeroPool ( + sizeof (CM_ARM_PROC_HIERARCHY_INFO) * PlatformRepo->ProcNodeCount)= ; + if (PlatformRepo->ProcHierarchyInfo =3D=3D NULL) { + return EFI_OUT_OF_RESOURCES; + } + + StartIdx =3D 0; + PopulatePackageNodes (PlatformRepo, StartIdx, &NextIdx); + + for (Idx =3D 0; Idx < PackageCount; Idx++) { + StartIdx =3D NextIdx; + PopulateClusterNodes (PlatformRepo, StartIdx, Idx, &NextIdx); + } + + for (Idx =3D 0; Idx < ClusterCount; Idx++) { + StartIdx =3D NextIdx; + PopulateCoreNodes (PlatformRepo, StartIdx, + Idx / PLAT_CLUSTER_COUNT, + Idx % PLAT_CLUSTER_COUNT, + &NextIdx); + } + + if (mIsThreaded =3D=3D TRUE) { + for (Idx =3D 0; Idx < CoreCount; Idx++) { + StartIdx =3D NextIdx; + PopulateThreadNodes (PlatformRepo, StartIdx, + (Idx / PLAT_CORE_COUNT) / PLAT_CLUSTER_COUNT, + (Idx / PLAT_CORE_COUNT) % PLAT_CLUSTER_COUNT, + Idx % PLAT_CORE_COUNT, + &NextIdx); + } + } + + ASSERT (NextIdx =3D=3D PlatformRepo->ProcNodeCount); + + return EFI_SUCCESS; +} + +/** Populate CacheInfo entry used for generating PPTT based on CacheType= . + + @param [in] PlatformRepo Pointer to Platform Repository. + @param [in] StartIdx Start Index in PlatformRepo->CacheIn= fo + for generated CacheInfo. + @param [in] CacheType Type of Cache. + @param [out] NextIdx Index used to generate next cache ty= pe + information. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER Invalid Cache Information. +**/ +STATIC +EFI_STATUS +EFIAPI +PopulateCacheInfoEntry ( + IN EDKII_PLATFORM_REPOSITORY_INFO *PlatformRepo, + IN INTN StartIdx, + IN CACHE_TYPE CacheType, + OUT INTN *NextIdx + ) +{ + INTN Idx; + UINT32 Attributes; + UINT32 Size; + UINT32 LineSize; + UINT32 NumberOfSets; + UINT32 Associativity; + UINTN Count; + UINT32 ClusterId; + UINT32 CoreId; + + Attributes =3D CACHE_ATTRIBUTES ( + EFI_ACPI_6_4_CACHE_ATTRIBUTES_ALLOCATION_READ_WRITE, + EFI_ACPI_6_4_CACHE_ATTRIBUTES_CACHE_TYPE_UNIFIED, + EFI_ACPI_6_4_CACHE_ATTRIBUTES_WRITE_POLICY_WRITE_BACK + ); + LineSize =3D MAX ( + FixedPcdGet32 (PcdL1DcacheLineSize), + FixedPcdGet32 (PcdL1IcacheLineSize) + ); + Count =3D PLAT_CLUSTER_COUNT; + + switch (CacheType) { + case L1DataCache: + Count =3D PLAT_CPU_COUNT; + Size =3D FixedPcdGet32 (PcdL1DcacheSize); + LineSize =3D FixedPcdGet32 (PcdL1DcacheLineSize); + Associativity =3D FixedPcdGet32 (PcdL1DcacheWays); + Attributes =3D CACHE_ATTRIBUTES ( + EFI_ACPI_6_4_CACHE_ATTRIBUTES_ALLOCATION_READ_WR= ITE, + EFI_ACPI_6_4_CACHE_ATTRIBUTES_CACHE_TYPE_DATA, + EFI_ACPI_6_4_CACHE_ATTRIBUTES_WRITE_POLICY_WRITE= _BACK + ); + break; + case L1InstructionCache: + Count =3D PLAT_CPU_COUNT; + Size =3D FixedPcdGet32 (PcdL1IcacheSize); + LineSize =3D FixedPcdGet32 (PcdL1IcacheLineSize); + Associativity =3D FixedPcdGet32 (PcdL1IcacheWays); + Attributes =3D CACHE_ATTRIBUTES ( + EFI_ACPI_6_4_CACHE_ATTRIBUTES_ALLOCATION_READ, + EFI_ACPI_6_4_CACHE_ATTRIBUTES_CACHE_TYPE_INSTRUC= TION, + EFI_ACPI_6_4_CACHE_ATTRIBUTES_WRITE_POLICY_WRITE= _BACK + ); + break; + case L2Cache: + Size =3D FixedPcdGet32 (PcdL2CacheSize); + Associativity =3D FixedPcdGet32 (PcdL2CacheWays); + break; + case L3Cache: + Size =3D FixedPcdGet32 (PcdL3CacheSize); + Associativity =3D FixedPcdGet32 (PcdL3CacheWays); + break; + default: + return EFI_INVALID_PARAMETER; + } + + if (Size =3D=3D 0) { + *NextIdx =3D StartIdx; + + return EFI_NOT_FOUND; + } else if ((Associativity =3D=3D 0) || (LineSize =3D=3D 0)) { + return EFI_INVALID_PARAMETER; + } + + NumberOfSets =3D (Size / (LineSize * Associativity)); + + for (Idx =3D StartIdx; Idx < StartIdx + Count; Idx++) { + PlatformRepo->CacheInfo[Idx].Token =3D + (CM_OBJECT_TOKEN)&PlatformRepo->CacheInfo[Idx]; + + if ((CacheType =3D=3D L2Cache) && L3_CACHE_PRESENT) { + PlatformRepo->CacheInfo[Idx].NextLevelOfCacheToken =3D + (CM_OBJECT_TOKEN)&PlatformRepo->CacheInfo[Idx - PLAT_CLUSTER_COU= NT]; + } else { + PlatformRepo->CacheInfo[Idx].NextLevelOfCacheToken =3D CM_NULL_TOK= EN; + } + + PlatformRepo->CacheInfo[Idx].Size =3D Size; + PlatformRepo->CacheInfo[Idx].NumberOfSets =3D NumberOfSets; + PlatformRepo->CacheInfo[Idx].LineSize =3D LineSize; + PlatformRepo->CacheInfo[Idx].Associativity =3D Associativity; + PlatformRepo->CacheInfo[Idx].Attributes =3D Attributes; + + if (Count =3D=3D PLAT_CLUSTER_COUNT) { + ClusterId =3D Idx - StartIdx; + CoreId =3D 0; + } else { + ClusterId =3D (Idx - StartIdx) / PLAT_CORE_COUNT; + CoreId =3D (Idx - StartIdx) % PLAT_CORE_COUNT; + } + + PlatformRepo->CacheInfo[Idx].CacheId =3D CACHE_ID (ClusterId, CoreId= , CacheType); + } + + *NextIdx =3D Idx; + + return EFI_SUCCESS; +} + +/** Populate CacheInfo field used for generating PPTT. + + @param [in] PlatformRepo Pointer to Platform Repository. + @param [out] L1DStartIdx L1 dcache info start index in + PlatformRepo->CacheInfo Array. + @param [out] L1IStartIdx L1 icache info start index in + PlatformRepo->CacheInfo Array. + @param [out] L2StartIdx L2 cache info start index in + PlatformRepo->CacheInfo Array. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER Invalid Cache Information. + @retval EFI_OUT_OF_RESOURCES Out of memory. +**/ +STATIC +EFI_STATUS +EFIAPI +PopulateCacheInfo ( + IN EDKII_PLATFORM_REPOSITORY_INFO *PlatformRepo, + OUT INTN *L1DStartIdx, + OUT INTN *L1IStartIdx, + OUT INTN *L2StartIdx + ) +{ + EFI_STATUS Status; + UINT32 CacheCnt; + INTN StartIdx; + INTN NextIdx; + + CacheCnt =3D 0; + + if (L1_DCACHE_PRESENT) { + CacheCnt +=3D PLAT_CPU_COUNT; + } + + if (L1_ICACHE_PRESENT) { + CacheCnt +=3D PLAT_CPU_COUNT; + } + + if (L2_CACHE_PRESENT) { + CacheCnt +=3D PLAT_CLUSTER_COUNT; + } + + if (L3_CACHE_PRESENT) { + CacheCnt +=3D PLAT_CLUSTER_COUNT; + } + + if (CacheCnt =3D=3D 0) { + return EFI_SUCCESS; + } + + PlatformRepo->CacheInfo =3D AllocateZeroPool (sizeof (CM_ARM_CACHE_INF= O) * CacheCnt); + if (PlatformRepo->CacheInfo =3D=3D NULL) { + Status =3D EFI_OUT_OF_RESOURCES; + + goto err_handler; + } + + StartIdx =3D 0; + Status =3D PopulateCacheInfoEntry (PlatformRepo, StartIdx, L3Cache, = &NextIdx); + if (EFI_ERROR (Status) && (Status !=3D EFI_NOT_FOUND)) { + goto err_handler; + } + + StartIdx =3D NextIdx; + Status =3D PopulateCacheInfoEntry (PlatformRepo, StartIdx, L2Cache, = &NextIdx); + if (EFI_ERROR (Status)) { + *L2StartIdx =3D -1; + + if (Status !=3D EFI_NOT_FOUND) { + goto err_handler; + } + } else { + *L2StartIdx =3D StartIdx; + } + + StartIdx =3D NextIdx; + Status =3D PopulateCacheInfoEntry (PlatformRepo, StartIdx, L1DataCac= he, &NextIdx); + if (EFI_ERROR (Status)) { + *L1DStartIdx =3D -1; + + if (Status !=3D EFI_NOT_FOUND) { + goto err_handler; + } + } else { + *L1DStartIdx =3D StartIdx; + } + + StartIdx =3D NextIdx; + Status =3D PopulateCacheInfoEntry (PlatformRepo, StartIdx, L1Instruc= tionCache, &NextIdx); + if (EFI_ERROR (Status)) { + *L1IStartIdx =3D -1; + + if (Status !=3D EFI_NOT_FOUND) { + goto err_handler; + } + } else { + *L1IStartIdx =3D StartIdx; + } + + ASSERT (NextIdx =3D=3D CacheCnt); + + PlatformRepo->CacheInfoCount =3D CacheCnt; + + return EFI_SUCCESS; + +err_handler: + if (EFI_ERROR (Status)) { + PlatformRepo->CacheInfoCount =3D 0; + + if (PlatformRepo->CacheInfo) { + FreePool (PlatformRepo->CacheInfo); + PlatformRepo->CacheInfo =3D NULL; + } + } + + return Status; +} + +/** Populate Clusters Resources field used for generating PPTT. + + @param [in] PlatformRepo Pointer to Platform Repository. + @param [in] L2StartIdx L2 cache info start index in + PlatformRepo->CacheInfo Array. + + @retval EFI_SUCCESS Success. + @retval EFI_OUT_OF_RESOURCES Out of memory. +**/ +STATIC +EFI_STATUS +EFIAPI +PopulateClusterResources ( + IN EDKII_PLATFORM_REPOSITORY_INFO *PlatformRepo, + IN INTN L2StartIdx + ) +{ + INTN CluIdx; + INTN Idx; + CM_ARM_PROC_HIERARCHY_INFO *Node; + CM_ARM_OBJ_REF *ClusterResource; + + if (L2StartIdx < 0) { + PlatformRepo->ClusterResources =3D NULL; + PlatformRepo->PerCluResCnt =3D 0; + + return EFI_SUCCESS; + } + + PlatformRepo->PerCluResCnt =3D 1; + + PlatformRepo->ClusterResources =3D AllocateZeroPool ( + sizeof (CM_ARM_OBJ_REF *) * + PLAT_CLUSTER_COUNT + ); + if (PlatformRepo->ClusterResources =3D=3D NULL) { + return EFI_OUT_OF_RESOURCES; + } + + for (CluIdx =3D 0; CluIdx < PLAT_CLUSTER_COUNT; CluIdx++) { + ClusterResource =3D AllocateZeroPool (sizeof (CM_ARM_OBJ_REF)); + if (ClusterResource =3D=3D NULL) { + goto fail_to_alloc; + } + + ClusterResource[0].ReferenceToken =3D + (CM_OBJECT_TOKEN)&PlatformRepo->CacheInfo[CluIdx + L2StartIdx]; + + PlatformRepo->ClusterResources[CluIdx] =3D ClusterResource; + + Node =3D GET_CLUSTER_HNODE (CluIdx); + Node->NoOfPrivateResources =3D 1; + Node->PrivateResourcesArrayToken =3D (CM_OBJECT_TOKEN) ClusterResour= ce; + } + + return EFI_SUCCESS; + +fail_to_alloc: + for (Idx =3D 0; Idx < CluIdx; Idx++) { + FreePool (PlatformRepo->ClusterResources[Idx]); + } + + FreePool (PlatformRepo->ClusterResources); + PlatformRepo->ClusterResources =3D NULL; + PlatformRepo->PerCluResCnt =3D 0; + + return EFI_OUT_OF_RESOURCES; +} + +/** Populate Core Resources field used for generating PPTT. + + @param [in] PlatformRepo Pointer to Platform Repository. + @param [in] L1DStartIdx L1 dcache info start index in + PlatformRepo->CacheInfo Array. + @param [in] L1IStartIdx L1 icache info start index in + PlatformRepo->CacheInfo Array. + + @retval EFI_SUCCESS Success. + @retval EFI_OUT_OF_RESOURCES Out of memory. +**/ +STATIC +EFI_STATUS +EFIAPI +PopulateCoreResources ( + IN EDKII_PLATFORM_REPOSITORY_INFO *PlatformRepo, + IN INTN L1DStartIdx, + IN INTN L1IStartIdx + ) +{ + INTN CpuIdx; + INTN Idx; + CM_ARM_PROC_HIERARCHY_INFO *Node; + UINTN ResCnt; + INTN ClusterId; + INTN CoreId; + INTN CacheIdx; + CM_ARM_OBJ_REF *CoreResource; + + ResCnt =3D 0; + + if (L1DStartIdx >=3D 0) { + ResCnt++; + } + + if (L1IStartIdx >=3D 0) { + ResCnt++; + } + + if (ResCnt =3D=3D 0) { + PlatformRepo->CoreResources =3D NULL; + + return EFI_SUCCESS; + } + + PlatformRepo->PerCoreResCnt =3D ResCnt; + + PlatformRepo->CoreResources =3D AllocateZeroPool ( + sizeof (CM_ARM_OBJ_REF *) * + PLAT_CPU_COUNT + ); + if (PlatformRepo->CoreResources =3D=3D NULL) { + return EFI_OUT_OF_RESOURCES; + } + + for (CpuIdx =3D 0; CpuIdx < PLAT_CPU_COUNT; CpuIdx++) { + CoreResource =3D AllocateZeroPool (sizeof (CM_ARM_OBJ_REF) * ResCnt)= ; + if (CoreResource =3D=3D NULL) { + goto fail_to_alloc; + } + + Idx =3D 0; + ClusterId =3D CpuIdx / PLAT_CORE_COUNT; + CoreId =3D CpuIdx % PLAT_CORE_COUNT; + + if (L1DStartIdx >=3D 0) { + CacheIdx =3D L1DStartIdx + (ClusterId * PLAT_CORE_COUNT) + CoreId; + + CoreResource[Idx].ReferenceToken =3D + (CM_OBJECT_TOKEN) &PlatformRepo->CacheInfo[CacheIdx]; + Idx++; + } + + if (L1IStartIdx >=3D 0) { + CacheIdx =3D L1IStartIdx + (ClusterId * PLAT_CORE_COUNT) + CoreId; + + CoreResource[Idx].ReferenceToken =3D + (CM_OBJECT_TOKEN) &PlatformRepo->CacheInfo[CacheIdx]; + Idx++; + } + + ASSERT (Idx =3D=3D ResCnt); + + PlatformRepo->CoreResources[CpuIdx] =3D CoreResource; + + Node =3D GET_CORE_HNODE (ClusterId, Core= Id); + Node->NoOfPrivateResources =3D ResCnt; + Node->PrivateResourcesArrayToken =3D (CM_OBJECT_TOKEN) CoreResource; + } + + return EFI_SUCCESS; + +fail_to_alloc: + for (Idx =3D 0; Idx < CpuIdx; Idx++) { + FreePool (PlatformRepo->CoreResources[Idx]); + } + + FreePool (PlatformRepo->CoreResources); + PlatformRepo->CoreResources =3D NULL; + PlatformRepo->PerCoreResCnt =3D 0; + + return EFI_OUT_OF_RESOURCES; +} + /** Initialize the platform configuration repository. =20 @param [in] This Pointer to the Configuration Manager Protocol= . @@ -479,9 +1220,13 @@ InitializePlatformRepository ( ) { EDKII_PLATFORM_REPOSITORY_INFO * PlatformRepo; - UINTN Index; - UINT16 TrbeInterrupt; - CM_OBJECT_TOKEN EtToken; + EFI_STATUS Status; + UINTN Index; + UINT16 TrbeInterrupt; + CM_OBJECT_TOKEN EtToken; + INTN L1DStartIdx; + INTN L1IStartIdx; + INTN L2StartIdx; =20 PlatformRepo =3D This->PlatRepoInfo; =20 @@ -498,10 +1243,12 @@ InitializePlatformRepository ( PlatformRepo->GicCInfo[5].MPIDR =3D GET_MPID_MT (1, 1, 0); PlatformRepo->GicCInfo[6].MPIDR =3D GET_MPID_MT (1, 2, 0); PlatformRepo->GicCInfo[7].MPIDR =3D GET_MPID_MT (1, 3, 0); + + mIsThreaded =3D TRUE; } =20 TrbeInterrupt =3D 0; - EtToken =3D CM_NULL_TOKEN; + EtToken =3D CM_NULL_TOKEN; =20 // The ID_AA64DFR0_EL1.TraceBuffer field identifies support for FEAT_T= RBE. if (ArmHasTrbe ()) { @@ -519,7 +1266,86 @@ InitializePlatformRepository ( PlatformRepo->GicCInfo[Index].EtToken =3D EtToken; } =20 + Status =3D PopulateHierarchyInfo (PlatformRepo); + if (EFI_ERROR (Status)) { + DEBUG (( + DEBUG_ERROR, + "ERROR: Failed to populate hierarchy Info: %r\n", + Status + )); + + goto fail_to_populate; + } + + Status =3D PopulateCacheInfo (PlatformRepo, &L1DStartIdx, &L1IStartIdx= , &L2StartIdx); + if (EFI_ERROR (Status)) { + DEBUG (( + DEBUG_ERROR, + "ERROR: Failed to populate cache Info: %r\n", + Status + )); + + goto fail_to_populate; + } + + Status =3D PopulateClusterResources (PlatformRepo, L2StartIdx); + if (EFI_ERROR (Status)) { + DEBUG (( + DEBUG_ERROR, + "ERROR: Failed to populate cluster resource Info: %r\n", + Status + )); + + goto fail_to_populate; + } + + Status =3D PopulateCoreResources (PlatformRepo, L1DStartIdx, L1IStartI= dx); + if (EFI_ERROR (Status)) { + DEBUG (( + DEBUG_ERROR, + "ERROR: Failed to populate core resource Info: %r\n", + Status + )); + + goto fail_to_populate; + } + return EFI_SUCCESS; + +fail_to_populate: + if (PlatformRepo->CoreResources !=3D NULL) { + for (Index =3D 0; Index < PLAT_CPU_COUNT; Index++) { + FreePool (PlatformRepo->CoreResources[Index]); + } + + FreePool (PlatformRepo->CoreResources); + PlatformRepo->CoreResources =3D NULL; + PlatformRepo->PerCoreResCnt =3D 0; + } + + if (PlatformRepo->ClusterResources !=3D NULL) { + for (Index =3D 0; Index < PLAT_CLUSTER_COUNT; Index++) { + FreePool (PlatformRepo->ClusterResources[Index]); + } + + FreePool (PlatformRepo->ClusterResources); + PlatformRepo->ClusterResources =3D NULL; + PlatformRepo->PerCluResCnt =3D 0; + } + + if (PlatformRepo->CacheInfo !=3D NULL) { + FreePool (PlatformRepo->CacheInfo); + PlatformRepo->CacheInfo =3D NULL; + PlatformRepo->CacheInfoCount =3D 0; + } + + if (PlatformRepo->ProcHierarchyInfo !=3D NULL) { + FreePool (PlatformRepo->ProcHierarchyInfo); + PlatformRepo->ProcHierarchyInfo =3D NULL; + PlatformRepo->ProcNodeCount =3D 0; + } + + return Status; } =20 /** Return a GT Block timer frame info list. @@ -650,6 +1476,118 @@ GetDeviceIdMappingArray ( return EFI_SUCCESS; } =20 +/** Return GIC CPU Interface Info. + + @param [in] This Pointer to the Configuration Manager P= rotocol. + @param [in] CmObjectId The Object ID of the CM object request= ed + @param [in] SearchToken A unique token for identifying the req= uested + CM_ARM_GICC_INFO object. + @param [in, out] CmObject Pointer to the Configuration Manager O= bject + descriptor describing the requested Ob= ject. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER A parameter is invalid. + @retval EFI_NOT_FOUND The required object information is not= found. +**/ +EFI_STATUS +EFIAPI +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 =3D=3D NULL) || (CmObject =3D=3D NULL)) { + ASSERT (This !=3D NULL); + ASSERT (CmObject !=3D NULL); + return EFI_INVALID_PARAMETER; + } + + PlatformRepo =3D This->PlatRepoInfo; + + TotalObjCount =3D ARRAY_SIZE (PlatformRepo->GicCInfo); + + for (ObjIndex =3D 0; ObjIndex < TotalObjCount; ObjIndex++) { + if (SearchToken =3D=3D (CM_OBJECT_TOKEN)&PlatformRepo->GicCInfo[ObjI= ndex]) { + CmObject->ObjectId =3D CmObjectId; + CmObject->Size =3D sizeof (PlatformRepo->GicCInfo[ObjIndex]); + CmObject->Data =3D (VOID*)&PlatformRepo->GicCInfo[ObjIndex]; + CmObject->Count =3D 1; + return EFI_SUCCESS; + } + } + + return EFI_NOT_FOUND; +} + +/** Return a list of Configuration Manager object references pointed to = by the + given input token. + + @param [in] This Pointer to the Configuration Manager P= rotocol. + @param [in] CmObjectId The Object ID of the CM object request= ed + @param [in] Token A unique token for identifying the req= uested + CM_ARM_OBJ_REF list. + @param [in, out] CmObject Pointer to the Configuration Manager O= bject + descriptor describing the requested Ob= ject. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER A parameter is invalid. + @retval EFI_NOT_FOUND The required object information is not= found. +**/ +STATIC +EFI_STATUS +EFIAPI +GetCmObjRefs ( + IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST This, + IN CONST CM_OBJECT_ID CmObjectId, + IN CONST CM_OBJECT_TOKEN Token, + IN OUT CM_OBJ_DESCRIPTOR *CONST CmObject + ) +{ + UINTN Idx; + EDKII_PLATFORM_REPOSITORY_INFO *PlatformRepo; + + if ((This =3D=3D NULL) || (CmObject =3D=3D NULL)) { + ASSERT (This !=3D NULL); + ASSERT (CmObject !=3D NULL); + + return EFI_INVALID_PARAMETER; + } + + PlatformRepo =3D This->PlatRepoInfo; + + if (PlatformRepo->ClusterResources !=3D NULL) { + for (Idx =3D 0; Idx < PLAT_CLUSTER_COUNT; Idx++) { + if (Token =3D=3D (CM_OBJECT_TOKEN)PlatformRepo->ClusterResources[I= dx]) { + CmObject->Count =3D PlatformRepo->PerCluResCnt; + CmObject->Size =3D sizeof (CM_ARM_OBJ_REF) * CmObject->Count; + CmObject->Data =3D (VOID *)PlatformRepo->ClusterResources[Idx]; + + return EFI_SUCCESS; + } + } + } + + if (PlatformRepo->CoreResources !=3D NULL) { + for (Idx =3D 0; Idx < PLAT_CPU_COUNT; Idx++) { + if (Token =3D=3D (CM_OBJECT_TOKEN)PlatformRepo->CoreResources[Idx]= ) { + CmObject->Count =3D PlatformRepo->PerCoreResCnt; + CmObject->Size =3D sizeof (CM_ARM_OBJ_REF) * CmObject->Count; + CmObject->Data =3D (VOID *)PlatformRepo->CoreResources[Idx]; + + return EFI_SUCCESS; + } + } + } + + return EFI_NOT_FOUND; +} + /** Return a standard namespace object. =20 @param [in] This Pointer to the Configuration Manager Prot= ocol. @@ -863,11 +1801,14 @@ GetArmNameSpaceObject ( break; =20 case EArmObjGicCInfo: - Status =3D HandleCmObject ( + Status =3D HandleCmObjectRefByToken ( + This, CmObjectId, PlatformRepo->GicCInfo, sizeof (PlatformRepo->GicCInfo), ARRAY_SIZE (PlatformRepo->GicCInfo), + Token, + GetGicCInfo, CmObject ); break; @@ -1000,6 +1941,40 @@ GetArmNameSpaceObject ( } break; =20 + case EArmObjProcHierarchyInfo: + Status =3D HandleCmObject ( + CmObjectId, + PlatformRepo->ProcHierarchyInfo, + sizeof (CM_ARM_PROC_HIERARCHY_INFO) * PlatformRepo->Pro= cNodeCount, + PlatformRepo->ProcNodeCount, + CmObject + ); + break; + + case EArmObjCacheInfo: + if (PlatformRepo->CacheInfoCount =3D=3D 0) { + Status =3D EFI_NOT_FOUND; + } else { + Status =3D HandleCmObject ( + CmObjectId, + PlatformRepo->CacheInfo, + sizeof (CM_ARM_CACHE_INFO) * PlatformRepo->CacheInfoC= ount, + PlatformRepo->CacheInfoCount, + CmObject + ); + } + break; + + case EArmObjCmRef: + Status =3D HandleCmObjectSearchPlatformRepo ( + This, + CmObjectId, + Token, + GetCmObjRefs, + CmObject + ); + break; + default: { Status =3D EFI_NOT_FOUND; DEBUG (( -- Guid("CE165669-3EF3-493F-B85D-6190EE5B9759") -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#119805): https://edk2.groups.io/g/devel/message/119805 Mute This Topic: https://groups.io/mt/107053449/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-