xref: /rk3399_ARM-atf/plat/rockchip/common/plat_topology.c (revision c948f77136c42a92d0bb660543a3600c36dcf7f1)
1 /*
2  * Copyright (c) 2013-2016, ARM Limited and Contributors. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #include <platform_def.h>
8 
9 #include <arch.h>
10 #include <lib/psci/psci.h>
11 
12 #include <plat_private.h>
13 
14 /*******************************************************************************
15  * This function returns the RockChip default topology tree information.
16  ******************************************************************************/
17 const unsigned char *plat_get_power_domain_tree_desc(void)
18 {
19 	return rockchip_power_domain_tree_desc;
20 }
21 
22 int plat_core_pos_by_mpidr(u_register_t mpidr)
23 {
24 	unsigned int cluster_id, cpu_id;
25 
26 	cpu_id = mpidr & MPIDR_AFFLVL_MASK;
27 	cluster_id = mpidr & MPIDR_CLUSTER_MASK;
28 
29 	cpu_id += (cluster_id >> PLAT_RK_CLST_TO_CPUID_SHIFT);
30 
31 	if (cpu_id >= PLATFORM_CORE_COUNT)
32 		return -1;
33 
34 	return cpu_id;
35 }
36