blob: 359997aaefb932bc22c18368544798fc08151409 [file] [log] [blame]
Sumit Garg007a7a32018-06-15 14:43:35 +05301/*
2 * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
Sumit Garg007a7a32018-06-15 14:43:35 +05307#include <platform_def.h>
8
Antonio Nino Diaz09d40e02018-12-14 00:18:21 +00009#include <arch.h>
10
11#include <sq_common.h>
12
Sumit Garg007a7a32018-06-15 14:43:35 +053013unsigned char sq_pd_tree_desc[PLAT_CLUSTER_COUNT + 1];
14
15int plat_core_pos_by_mpidr(u_register_t mpidr)
16{
17 unsigned int cluster_id, cpu_id;
18
19 cluster_id = (mpidr >> MPIDR_AFF1_SHIFT) & MPIDR_AFFLVL_MASK;
20 if (cluster_id >= PLAT_CLUSTER_COUNT)
21 return -1;
22
23 cpu_id = (mpidr >> MPIDR_AFF0_SHIFT) & MPIDR_AFFLVL_MASK;
24 if (cpu_id >= PLAT_MAX_CORES_PER_CLUSTER)
25 return -1;
26
27 return sq_calc_core_pos(mpidr);
28}
29
30const unsigned char *plat_get_power_domain_tree_desc(void)
31{
32 int i;
33
34 sq_pd_tree_desc[0] = PLAT_CLUSTER_COUNT;
35
36 for (i = 0; i < PLAT_CLUSTER_COUNT; i++)
37 sq_pd_tree_desc[i + 1] = PLAT_MAX_CORES_PER_CLUSTER;
38
39 return sq_pd_tree_desc;
40}