| 1 |
/* |
| 2 |
* Copyright (c) 2018, Renesas Electronics Corporation. All rights reserved. |
| 3 |
* |
| 4 |
* SPDX-License-Identifier: BSD-3-Clause |
| 5 |
*/ |
| 6 |
|
| 7 |
#include <platform_def.h> |
| 8 |
|
| 9 |
#include <common/debug.h> |
| 10 |
#include <lib/psci/psci.h> |
| 11 |
|
| 12 |
static const unsigned char rcar_power_domain_tree_desc[] = { |
| 13 |
1, |
| 14 |
PLATFORM_CLUSTER_COUNT, |
| 15 |
PLATFORM_CLUSTER0_CORE_COUNT, |
| 16 |
PLATFORM_CLUSTER1_CORE_COUNT |
| 17 |
}; |
| 18 |
|
| 19 |
const unsigned char *plat_get_power_domain_tree_desc(void) |
| 20 |
{ |
| 21 |
return rcar_power_domain_tree_desc; |
| 22 |
} |
| 23 |
|
| 24 |
int plat_core_pos_by_mpidr(u_register_t mpidr) |
| 25 |
{ |
| 26 |
unsigned int cluster_id, cpu_id; |
| 27 |
|
| 28 |
mpidr &= MPIDR_AFFINITY_MASK; |
| 29 |
|
| 30 |
if (mpidr & ~(MPIDR_CLUSTER_MASK | MPIDR_CPU_MASK)) |
| 31 |
return -1; |
| 32 |
|
| 33 |
cluster_id = (mpidr >> MPIDR_AFF1_SHIFT) & MPIDR_AFFLVL_MASK; |
| 34 |
cpu_id = (mpidr >> MPIDR_AFF0_SHIFT) & MPIDR_AFFLVL_MASK; |
| 35 |
|
| 36 |
if (cluster_id >= PLATFORM_CLUSTER_COUNT) |
| 37 |
return -1; |
| 38 |
|
| 39 |
if (cluster_id == 0 && cpu_id >= PLATFORM_CLUSTER0_CORE_COUNT) |
| 40 |
return -1; |
| 41 |
|
| 42 |
if (cluster_id == 1 && cpu_id >= PLATFORM_CLUSTER1_CORE_COUNT) |
| 43 |
return -1; |
| 44 |
|
| 45 |
return (cpu_id + cluster_id * PLATFORM_CLUSTER0_CORE_COUNT); |
| 46 |
} |
| 47 |
|