1 /* 2 * Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 #include <arch.h> 8 #include <arch_helpers.h> 9 #include <platform.h> 10 11 const unsigned char imx_power_domain_tree_desc[] = { 12 PWR_DOMAIN_AT_MAX_LVL, 13 PLATFORM_CLUSTER_COUNT, 14 PLATFORM_CORE_COUNT, 15 }; 16 17 const unsigned char *plat_get_power_domain_tree_desc(void) 18 { 19 return imx_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 mpidr &= MPIDR_AFFINITY_MASK; 27 28 if (mpidr & ~(MPIDR_CLUSTER_MASK | MPIDR_CPU_MASK)) 29 return -1; 30 31 cluster_id = MPIDR_AFFLVL1_VAL(mpidr); 32 cpu_id = MPIDR_AFFLVL0_VAL(mpidr); 33 34 if (cluster_id > PLATFORM_CLUSTER_COUNT || 35 cpu_id > PLATFORM_MAX_CPU_PER_CLUSTER) 36 return -1; 37 38 return (cpu_id + (cluster_id * 4)); 39 } 40