blob: 389eb1dc2ed737ee932e0090a8f552539d5abf1e [file] [log] [blame]
Arunachalam Ganapathya5b17762020-04-27 14:33:00 +01001/*
Daniel Boulbyc19215a2023-05-17 13:50:36 +01002 * Copyright (c) 2020-2023, Arm Limited. All rights reserved.
Arunachalam Ganapathya5b17762020-04-27 14:33:00 +01003 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#include <assert.h>
8#include <plat_topology.h>
9#include <tftf_lib.h>
10
11static const struct {
12 unsigned int cluster_id;
13 unsigned int cpu_id;
Daniel Boulbyc19215a2023-05-17 13:50:36 +010014} tc_cores[] = {
Usama Arif6ddc37f2021-01-17 18:05:08 +000015 /* Cluster0: 8 cores*/
Arunachalam Ganapathya5b17762020-04-27 14:33:00 +010016 { 0, 0 },
17 { 0, 1 },
18 { 0, 2 },
Usama Arif6ddc37f2021-01-17 18:05:08 +000019 { 0, 3 },
20 { 0, 4 },
21 { 0, 5 },
22 { 0, 6 },
23 { 0, 7 }
Arunachalam Ganapathya5b17762020-04-27 14:33:00 +010024};
25
26/*
27 * The power domain tree descriptor. The cluster power domains are
28 * arranged so that when the PSCI generic code creates the power domain tree,
29 * the indices of the CPU power domain nodes it allocates match the linear
30 * indices returned by plat_core_pos_by_mpidr().
31 */
Daniel Boulbyc19215a2023-05-17 13:50:36 +010032const unsigned char tc_pd_tree_desc[] = {
Arunachalam Ganapathya5b17762020-04-27 14:33:00 +010033 /* Number of root nodes */
Daniel Boulbyc19215a2023-05-17 13:50:36 +010034 TC_CLUSTER_COUNT,
Arunachalam Ganapathya5b17762020-04-27 14:33:00 +010035 /* Number of children for the 1st node */
Daniel Boulbyc19215a2023-05-17 13:50:36 +010036 TC_MAX_CPUS_PER_CLUSTER,
Arunachalam Ganapathya5b17762020-04-27 14:33:00 +010037 /* Number of children for the 2nd node */
Daniel Boulbyc19215a2023-05-17 13:50:36 +010038 TC_MAX_CPUS_PER_CLUSTER
Arunachalam Ganapathya5b17762020-04-27 14:33:00 +010039};
40
41const unsigned char *tftf_plat_get_pwr_domain_tree_desc(void)
42{
Daniel Boulbyc19215a2023-05-17 13:50:36 +010043 return tc_pd_tree_desc;
Arunachalam Ganapathya5b17762020-04-27 14:33:00 +010044}
45
46uint64_t tftf_plat_get_mpidr(unsigned int core_pos)
47{
48 uint64_t mpid;
49
50 assert(core_pos < PLATFORM_CORE_COUNT);
51
Daniel Boulbyc19215a2023-05-17 13:50:36 +010052 mpid = (uint64_t)make_mpid(tc_cores[core_pos].cluster_id,
53 tc_cores[core_pos].cpu_id);
Arunachalam Ganapathya5b17762020-04-27 14:33:00 +010054
55 return mpid;
56}