2 * Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
4 * SPDX-License-Identifier: BSD-3-Clause
8 #include <platform_def.h>
11 #include "rpi3_private.h"
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
,
21 /*******************************************************************************
22 * This function returns the ARM default topology tree information.
23 ******************************************************************************/
24 const unsigned char *plat_get_power_domain_tree_desc(void)
26 return power_domain_tree_desc
;
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 ******************************************************************************/
35 int plat_core_pos_by_mpidr(u_register_t mpidr
)
37 unsigned int cluster_id
, cpu_id
;
39 mpidr
&= MPIDR_AFFINITY_MASK
;
40 if (mpidr
& ~(MPIDR_CLUSTER_MASK
| MPIDR_CPU_MASK
)) {
44 cluster_id
= (mpidr
>> MPIDR_AFF1_SHIFT
) & MPIDR_AFFLVL_MASK
;
45 cpu_id
= (mpidr
>> MPIDR_AFF0_SHIFT
) & MPIDR_AFFLVL_MASK
;
47 if (cluster_id
>= PLATFORM_CLUSTER_COUNT
) {
51 if (cpu_id
>= PLATFORM_MAX_CPUS_PER_CLUSTER
) {
55 return plat_rpi3_calc_core_pos(mpidr
);