Chandni Cherukuri | 33f1774 | 2019-01-07 14:17:52 +0530 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2019, 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 | |
| 11 | static const struct { |
| 12 | unsigned int cluster_id; |
| 13 | unsigned int cpu_id; |
| 14 | } plat_cores[] = { |
| 15 | /* Cluster0: 4 cores*/ |
| 16 | { 0, 0 }, |
| 17 | { 0, 1 }, |
| 18 | { 0, 2 }, |
| 19 | { 0, 3 }, |
| 20 | /* Cluster1: 4 cores */ |
| 21 | { 1, 0 }, |
| 22 | { 1, 1 }, |
| 23 | { 1, 2 }, |
| 24 | { 1, 3 }, |
| 25 | }; |
| 26 | |
| 27 | /* |
| 28 | * The power domain tree descriptor. The cluster power domains are |
| 29 | * arranged so that when the PSCI generic code creates the power domain tree, |
| 30 | * the indices of the CPU power domain nodes it allocates match the linear |
| 31 | * indices returned by plat_core_pos_by_mpidr(). |
| 32 | */ |
| 33 | const unsigned char plat_pd_tree_desc[] = { |
| 34 | /* Number of root nodes */ |
Shriram K | e10a508 | 2021-08-12 20:09:22 +0530 | [diff] [blame^] | 35 | PLAT_ARM_CLUSTER_COUNT, |
Chandni Cherukuri | 33f1774 | 2019-01-07 14:17:52 +0530 | [diff] [blame] | 36 | /* Number of children for the 1st node */ |
Shriram K | e10a508 | 2021-08-12 20:09:22 +0530 | [diff] [blame^] | 37 | CSS_SGI_MAX_CPUS_PER_CLUSTER, |
Chandni Cherukuri | 33f1774 | 2019-01-07 14:17:52 +0530 | [diff] [blame] | 38 | /* Number of children for the 2nd node */ |
Shriram K | e10a508 | 2021-08-12 20:09:22 +0530 | [diff] [blame^] | 39 | CSS_SGI_MAX_CPUS_PER_CLUSTER |
Chandni Cherukuri | 33f1774 | 2019-01-07 14:17:52 +0530 | [diff] [blame] | 40 | }; |
| 41 | |
| 42 | const unsigned char *tftf_plat_get_pwr_domain_tree_desc(void) |
| 43 | { |
| 44 | return plat_pd_tree_desc; |
| 45 | } |
| 46 | |
| 47 | uint64_t tftf_plat_get_mpidr(unsigned int core_pos) |
| 48 | { |
| 49 | unsigned int mpid; |
| 50 | |
| 51 | assert(core_pos < PLATFORM_CORE_COUNT); |
| 52 | |
| 53 | mpid = make_mpid( |
| 54 | plat_cores[core_pos].cluster_id, |
| 55 | plat_cores[core_pos].cpu_id); |
| 56 | |
| 57 | return mpid; |
| 58 | } |