xref: /rk3399_ARM-atf/plat/rockchip/common/plat_topology.c (revision 61f72a34250d063da67f4fc2b0eb8c3fda3376be)
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 <arch.h>
8 #include <plat_private.h>
9 #include <platform_def.h>
10 #include <psci.h>
11 
12 /*******************************************************************************
13  * This function returns the RockChip default topology tree information.
14  ******************************************************************************/
15 const unsigned char *plat_get_power_domain_tree_desc(void)
16 {
17 	return rockchip_power_domain_tree_desc;
18 }
19 
20 int plat_core_pos_by_mpidr(u_register_t mpidr)
21 {
22 	unsigned int cluster_id, cpu_id;
23 
24 	cpu_id = mpidr & MPIDR_AFFLVL_MASK;
25 	cluster_id = mpidr & MPIDR_CLUSTER_MASK;
26 
27 	cpu_id += (cluster_id >> PLAT_RK_CLST_TO_CPUID_SHIFT);
28 
29 	if (cpu_id >= PLATFORM_CORE_COUNT)
30 		return -1;
31 
32 	return cpu_id;
33 }
34