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