blob: ad1328512176c1f577874fed874af94f95208c49 [file] [log] [blame]
Shriram K46aa2bb2022-09-15 16:11:13 +05301/*
2 * Copyright (c) 2022, Arm Limited. All rights reserved.
3 *
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;
14} plat_cores[] = {
15 /* Cluster0: 1 core */
16 { 0, 0 },
17 /* Cluster1: 1 core */
18 { 1, 0 },
19 /* Cluster2: 1 core */
20 { 2, 0 },
21 /* Cluster3: 1 core */
22 { 3, 0 },
23 /* Cluster4: 1 core */
24 { 4, 0 },
25 /* Cluster5: 1 core */
26 { 5, 0 },
27 /* Cluster6: 1 core */
28 { 6, 0 },
29 /* Cluster7: 1 core */
30 { 7, 0 },
31 /* Cluster8: 1 core */
32 { 8, 0 },
33 /* Cluster9: 1 core */
34 { 9, 0 },
35 /* Cluster10: 1 core */
36 { 10, 0 },
37 /* Cluster11: 1 core */
38 { 11, 0 },
39 /* Cluster12: 1 core */
40 { 12, 0 },
41 /* Cluster13: 1 core */
42 { 13, 0 },
43 /* Cluster14: 1 core */
44 { 14, 0 },
45 /* Cluster15: 1 core */
46 { 15, 0 },
47};
48
49/*
50 * The power domain tree descriptor. The cluster power domains are
51 * arranged so that when the PSCI generic code creates the power domain tree,
52 * the indices of the CPU power domain nodes it allocates match the linear
53 * indices returned by plat_core_pos_by_mpidr().
54 */
55const unsigned char plat_pd_tree_desc[] = {
56 /* Number of root nodes */
57 PLAT_ARM_CLUSTER_COUNT,
58 /* Number of children for the 1st node */
59 CSS_SGI_MAX_CPUS_PER_CLUSTER,
60 /* Number of children for the 2nd node */
61 CSS_SGI_MAX_CPUS_PER_CLUSTER,
62 /* Number of children for the 3rd node */
63 CSS_SGI_MAX_CPUS_PER_CLUSTER,
64 /* Number of children for the 4th node */
65 CSS_SGI_MAX_CPUS_PER_CLUSTER,
66 /* Number of children for the 5th node */
67 CSS_SGI_MAX_CPUS_PER_CLUSTER,
68 /* Number of children for the 6th node */
69 CSS_SGI_MAX_CPUS_PER_CLUSTER,
70 /* Number of children for the 7th node */
71 CSS_SGI_MAX_CPUS_PER_CLUSTER,
72 /* Number of children for the 8th node */
73 CSS_SGI_MAX_CPUS_PER_CLUSTER,
74 /* Number of children for the 9th node */
75 CSS_SGI_MAX_CPUS_PER_CLUSTER,
76 /* Number of children for the 10th node */
77 CSS_SGI_MAX_CPUS_PER_CLUSTER,
78 /* Number of children for the 11th node */
79 CSS_SGI_MAX_CPUS_PER_CLUSTER,
80 /* Number of children for the 12th node */
81 CSS_SGI_MAX_CPUS_PER_CLUSTER,
82 /* Number of children for the 13th node */
83 CSS_SGI_MAX_CPUS_PER_CLUSTER,
84 /* Number of children for the 14th node */
85 CSS_SGI_MAX_CPUS_PER_CLUSTER,
86 /* Number of children for the 15th node */
87 CSS_SGI_MAX_CPUS_PER_CLUSTER,
88 /* Number of children for the 16th node */
89 CSS_SGI_MAX_CPUS_PER_CLUSTER
90};
91
92const unsigned char *tftf_plat_get_pwr_domain_tree_desc(void)
93{
94 return plat_pd_tree_desc;
95}
96
97uint64_t tftf_plat_get_mpidr(unsigned int core_pos)
98{
99 unsigned int mpid;
100
101 assert(core_pos < PLATFORM_CORE_COUNT);
102
103 mpid = make_mpid(plat_cores[core_pos].cluster_id,
104 plat_cores[core_pos].cpu_id);
105
106 return (uint64_t)mpid;
107}