1 /* 2 * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 #include <arch.h> 8 #include <sq_common.h> 9 #include <platform_def.h> 10 11 unsigned char sq_pd_tree_desc[PLAT_CLUSTER_COUNT + 1]; 12 13 int plat_core_pos_by_mpidr(u_register_t mpidr) 14 { 15 unsigned int cluster_id, cpu_id; 16 17 cluster_id = (mpidr >> MPIDR_AFF1_SHIFT) & MPIDR_AFFLVL_MASK; 18 if (cluster_id >= PLAT_CLUSTER_COUNT) 19 return -1; 20 21 cpu_id = (mpidr >> MPIDR_AFF0_SHIFT) & MPIDR_AFFLVL_MASK; 22 if (cpu_id >= PLAT_MAX_CORES_PER_CLUSTER) 23 return -1; 24 25 return sq_calc_core_pos(mpidr); 26 } 27 28 const unsigned char *plat_get_power_domain_tree_desc(void) 29 { 30 int i; 31 32 sq_pd_tree_desc[0] = PLAT_CLUSTER_COUNT; 33 34 for (i = 0; i < PLAT_CLUSTER_COUNT; i++) 35 sq_pd_tree_desc[i + 1] = PLAT_MAX_CORES_PER_CLUSTER; 36 37 return sq_pd_tree_desc; 38 } 39