1 /* 2 * Copyright (c) 2015-2019, ARM Limited and Contributors. All rights reserved. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 #include <arch.h> 8 #include <platform_def.h> 9 #include <stdint.h> 10 11 #include "aml_private.h" 12 13 /* The power domain tree descriptor */ 14 static unsigned char power_domain_tree_desc[] = { 15 /* Number of root nodes */ 16 PLATFORM_CLUSTER_COUNT, 17 /* Number of children for the first node */ 18 PLATFORM_CLUSTER0_CORE_COUNT 19 }; 20 21 /******************************************************************************* 22 * This function returns the ARM default topology tree information. 23 ******************************************************************************/ plat_get_power_domain_tree_desc(void)24const unsigned char *plat_get_power_domain_tree_desc(void) 25 { 26 return power_domain_tree_desc; 27 } 28 29 /******************************************************************************* 30 * This function implements a part of the critical interface between the psci 31 * generic layer and the platform that allows the former to query the platform 32 * to convert an MPIDR to a unique linear index. An error code (-1) is returned 33 * in case the MPIDR is invalid. 34 ******************************************************************************/ plat_core_pos_by_mpidr(u_register_t mpidr)35int plat_core_pos_by_mpidr(u_register_t mpidr) 36 { 37 unsigned int cluster_id, cpu_id; 38 39 mpidr &= MPIDR_AFFINITY_MASK; 40 if (mpidr & ~(MPIDR_CLUSTER_MASK | MPIDR_CPU_MASK)) 41 return -1; 42 43 cluster_id = (mpidr >> MPIDR_AFF1_SHIFT) & MPIDR_AFFLVL_MASK; 44 cpu_id = (mpidr >> MPIDR_AFF0_SHIFT) & MPIDR_AFFLVL_MASK; 45 46 if (cluster_id >= PLATFORM_CLUSTER_COUNT) 47 return -1; 48 49 if (cpu_id >= PLATFORM_MAX_CPUS_PER_CLUSTER) 50 return -1; 51 52 return plat_calc_core_pos(mpidr); 53 } 54