xref: /rk3399_ARM-atf/plat/arm/board/juno/juno_topology.c (revision 40111d4473043a823eb0d2bdcac093a3ffc9df2b)
10108047aSSoby Mathew /*
20108047aSSoby Mathew  * Copyright (c) 2016, ARM Limited and Contributors. All rights reserved.
30108047aSSoby Mathew  *
482cb2c1aSdp-arm  * SPDX-License-Identifier: BSD-3-Clause
50108047aSSoby Mathew  */
60108047aSSoby Mathew 
70108047aSSoby Mathew #include <arm_def.h>
80108047aSSoby Mathew #include <plat_arm.h>
90108047aSSoby Mathew #include "juno_def.h"
100108047aSSoby Mathew 
110108047aSSoby Mathew /*
120108047aSSoby Mathew  * On Juno, the system power level is the highest power level.
130108047aSSoby Mathew  * The first entry in the power domain descriptor specifies the
140108047aSSoby Mathew  * number of system power domains i.e. 1.
150108047aSSoby Mathew  */
160108047aSSoby Mathew #define JUNO_PWR_DOMAINS_AT_MAX_PWR_LVL	 ARM_SYSTEM_COUNT
170108047aSSoby Mathew 
180108047aSSoby Mathew /*
190108047aSSoby Mathew  * The Juno power domain tree descriptor. The cluster power domains
200108047aSSoby Mathew  * are arranged so that when the PSCI generic code creates the power
210108047aSSoby Mathew  * domain tree, the indices of the CPU power domain nodes it allocates
220108047aSSoby Mathew  * match the linear indices returned by plat_core_pos_by_mpidr()
230108047aSSoby Mathew  * i.e. CLUSTER1 CPUs are allocated indices from 0 to 3 and the higher
240108047aSSoby Mathew  * indices for CLUSTER0 CPUs.
250108047aSSoby Mathew  */
260108047aSSoby Mathew const unsigned char juno_power_domain_tree_desc[] = {
270108047aSSoby Mathew 	/* No of root nodes */
280108047aSSoby Mathew 	JUNO_PWR_DOMAINS_AT_MAX_PWR_LVL,
290108047aSSoby Mathew 	/* No of children for the root node */
300108047aSSoby Mathew 	JUNO_CLUSTER_COUNT,
310108047aSSoby Mathew 	/* No of children for the first cluster node */
320108047aSSoby Mathew 	JUNO_CLUSTER1_CORE_COUNT,
330108047aSSoby Mathew 	/* No of children for the second cluster node */
340108047aSSoby Mathew 	JUNO_CLUSTER0_CORE_COUNT
350108047aSSoby Mathew };
360108047aSSoby Mathew 
370108047aSSoby Mathew /*******************************************************************************
380108047aSSoby Mathew  * This function returns the Juno topology tree information.
390108047aSSoby Mathew  ******************************************************************************/
400108047aSSoby Mathew const unsigned char *plat_get_power_domain_tree_desc(void)
410108047aSSoby Mathew {
420108047aSSoby Mathew 	return juno_power_domain_tree_desc;
430108047aSSoby Mathew }
440108047aSSoby Mathew 
450108047aSSoby Mathew /*******************************************************************************
460108047aSSoby Mathew  * This function returns the core count within the cluster corresponding to
470108047aSSoby Mathew  * `mpidr`.
480108047aSSoby Mathew  ******************************************************************************/
490108047aSSoby Mathew unsigned int plat_arm_get_cluster_core_count(u_register_t mpidr)
500108047aSSoby Mathew {
510108047aSSoby Mathew 	return (((mpidr) & 0x100) ? JUNO_CLUSTER1_CORE_COUNT :\
520108047aSSoby Mathew 				JUNO_CLUSTER0_CORE_COUNT);
530108047aSSoby Mathew }
54*40111d44SSoby Mathew 
55*40111d44SSoby Mathew /*
56*40111d44SSoby Mathew  * The array mapping platform core position (implemented by plat_my_core_pos())
57*40111d44SSoby Mathew  * to the SCMI power domain ID implemented by SCP.
58*40111d44SSoby Mathew  */
59*40111d44SSoby Mathew const uint32_t plat_css_core_pos_to_scmi_dmn_id_map[PLATFORM_CORE_COUNT] = {
60*40111d44SSoby Mathew 			2, 3, 4, 5, 0, 1 };
61