Sumit Garg | 4d4df11 | 2018-06-15 14:43:35 +0530 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
Antonio Nino Diaz | e0f9063 | 2018-12-14 00:18:21 +0000 | [diff] [blame] | 7 | #include <platform_def.h> |
| 8 | |
Sumit Garg | 4d4df11 | 2018-06-15 14:43:35 +0530 | [diff] [blame] | 9 | #include <arch.h> |
Antonio Nino Diaz | e0f9063 | 2018-12-14 00:18:21 +0000 | [diff] [blame] | 10 | |
Sumit Garg | 4d4df11 | 2018-06-15 14:43:35 +0530 | [diff] [blame] | 11 | #include <sq_common.h> |
Sumit Garg | 4d4df11 | 2018-06-15 14:43:35 +0530 | [diff] [blame] | 12 | |
| 13 | unsigned char sq_pd_tree_desc[PLAT_CLUSTER_COUNT + 1]; |
| 14 | |
| 15 | int 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 | |
| 30 | const 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 | } |