Arunachalam Ganapathy | a5b1776 | 2020-04-27 14:33:00 +0100 | [diff] [blame] | 1 | /* |
Daniel Boulby | c19215a | 2023-05-17 13:50:36 +0100 | [diff] [blame] | 2 | * Copyright (c) 2020-2023, Arm Limited. All rights reserved. |
Arunachalam Ganapathy | a5b1776 | 2020-04-27 14:33:00 +0100 | [diff] [blame] | 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 | |
| 11 | static const struct { |
| 12 | unsigned int cluster_id; |
| 13 | unsigned int cpu_id; |
Daniel Boulby | c19215a | 2023-05-17 13:50:36 +0100 | [diff] [blame] | 14 | } tc_cores[] = { |
Usama Arif | 6ddc37f | 2021-01-17 18:05:08 +0000 | [diff] [blame] | 15 | /* Cluster0: 8 cores*/ |
Arunachalam Ganapathy | a5b1776 | 2020-04-27 14:33:00 +0100 | [diff] [blame] | 16 | { 0, 0 }, |
| 17 | { 0, 1 }, |
| 18 | { 0, 2 }, |
Usama Arif | 6ddc37f | 2021-01-17 18:05:08 +0000 | [diff] [blame] | 19 | { 0, 3 }, |
| 20 | { 0, 4 }, |
| 21 | { 0, 5 }, |
| 22 | { 0, 6 }, |
| 23 | { 0, 7 } |
Arunachalam Ganapathy | a5b1776 | 2020-04-27 14:33:00 +0100 | [diff] [blame] | 24 | }; |
| 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 Boulby | c19215a | 2023-05-17 13:50:36 +0100 | [diff] [blame] | 32 | const unsigned char tc_pd_tree_desc[] = { |
Arunachalam Ganapathy | a5b1776 | 2020-04-27 14:33:00 +0100 | [diff] [blame] | 33 | /* Number of root nodes */ |
Daniel Boulby | c19215a | 2023-05-17 13:50:36 +0100 | [diff] [blame] | 34 | TC_CLUSTER_COUNT, |
Arunachalam Ganapathy | a5b1776 | 2020-04-27 14:33:00 +0100 | [diff] [blame] | 35 | /* Number of children for the 1st node */ |
Daniel Boulby | c19215a | 2023-05-17 13:50:36 +0100 | [diff] [blame] | 36 | TC_MAX_CPUS_PER_CLUSTER, |
Arunachalam Ganapathy | a5b1776 | 2020-04-27 14:33:00 +0100 | [diff] [blame] | 37 | /* Number of children for the 2nd node */ |
Daniel Boulby | c19215a | 2023-05-17 13:50:36 +0100 | [diff] [blame] | 38 | TC_MAX_CPUS_PER_CLUSTER |
Arunachalam Ganapathy | a5b1776 | 2020-04-27 14:33:00 +0100 | [diff] [blame] | 39 | }; |
| 40 | |
| 41 | const unsigned char *tftf_plat_get_pwr_domain_tree_desc(void) |
| 42 | { |
Daniel Boulby | c19215a | 2023-05-17 13:50:36 +0100 | [diff] [blame] | 43 | return tc_pd_tree_desc; |
Arunachalam Ganapathy | a5b1776 | 2020-04-27 14:33:00 +0100 | [diff] [blame] | 44 | } |
| 45 | |
| 46 | uint64_t tftf_plat_get_mpidr(unsigned int core_pos) |
| 47 | { |
| 48 | uint64_t mpid; |
| 49 | |
| 50 | assert(core_pos < PLATFORM_CORE_COUNT); |
| 51 | |
Daniel Boulby | c19215a | 2023-05-17 13:50:36 +0100 | [diff] [blame] | 52 | mpid = (uint64_t)make_mpid(tc_cores[core_pos].cluster_id, |
| 53 | tc_cores[core_pos].cpu_id); |
Arunachalam Ganapathy | a5b1776 | 2020-04-27 14:33:00 +0100 | [diff] [blame] | 54 | |
| 55 | return mpid; |
| 56 | } |