| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
#include <arch.h> |
| 9 |
#include <common/debug.h> |
| 10 |
|
| 11 |
#include <platform_def.h> |
| 12 |
#include "sbsa_private.h" |
| 13 |
|
| 14 |
|
| 15 |
static unsigned char power_domain_tree_desc[PLATFORM_CLUSTER_COUNT + 1]; |
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
const unsigned char *plat_get_power_domain_tree_desc(void) |
| 21 |
{ |
| 22 |
unsigned int i; |
| 23 |
|
| 24 |
power_domain_tree_desc[0] = PLATFORM_CLUSTER_COUNT; |
| 25 |
|
| 26 |
for (i = 0U; i < PLATFORM_CLUSTER_COUNT; i++) { |
| 27 |
power_domain_tree_desc[i + 1] = PLATFORM_MAX_CPUS_PER_CLUSTER; |
| 28 |
} |
| 29 |
|
| 30 |
return power_domain_tree_desc; |
| 31 |
} |
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
int plat_core_pos_by_mpidr(u_register_t mpidr) |
| 40 |
{ |
| 41 |
unsigned int cluster_id, cpu_id; |
| 42 |
|
| 43 |
mpidr &= MPIDR_AFFINITY_MASK; |
| 44 |
if ((mpidr & ~(MPIDR_CLUSTER_MASK | MPIDR_CPU_MASK)) != 0U) { |
| 45 |
ERROR("Invalid MPIDR\n"); |
| 46 |
return -1; |
| 47 |
} |
| 48 |
|
| 49 |
cluster_id = (mpidr >> MPIDR_AFF1_SHIFT) & MPIDR_AFFLVL_MASK; |
| 50 |
cpu_id = (mpidr >> MPIDR_AFF0_SHIFT) & MPIDR_AFFLVL_MASK; |
| 51 |
|
| 52 |
if (cluster_id >= PLATFORM_CLUSTER_COUNT) { |
| 53 |
ERROR("cluster_id >= PLATFORM_CLUSTER_COUNT define\n"); |
| 54 |
return -1; |
| 55 |
} |
| 56 |
|
| 57 |
if (cpu_id >= PLATFORM_MAX_CPUS_PER_CLUSTER) { |
| 58 |
ERROR("cpu_id >= PLATFORM_MAX_CPUS_PER_CLUSTER define\n"); |
| 59 |
return -1; |
| 60 |
} |
| 61 |
|
| 62 |
return plat_qemu_calc_core_pos(mpidr); |
| 63 |
} |