Benjamin Fair | 42eea87 | 2016-10-14 01:13:47 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
| 7 | #include <platform_def.h> |
Antonio Nino Diaz | e0f9063 | 2018-12-14 00:18:21 +0000 | [diff] [blame] | 8 | |
| 9 | #include <lib/psci/psci.h> |
Benjamin Fair | 42eea87 | 2016-10-14 01:13:47 +0000 | [diff] [blame] | 10 | |
| 11 | /* The power domain tree descriptor */ |
| 12 | static unsigned char power_domain_tree_desc[] = { |
Andrew F. Davis | 34d8b68 | 2018-06-25 12:10:53 -0500 | [diff] [blame] | 13 | PLATFORM_SYSTEM_COUNT, |
Benjamin Fair | 42eea87 | 2016-10-14 01:13:47 +0000 | [diff] [blame] | 14 | PLATFORM_CLUSTER_COUNT, |
| 15 | K3_CLUSTER0_CORE_COUNT, |
Benjamin Fair | 42eea87 | 2016-10-14 01:13:47 +0000 | [diff] [blame] | 16 | K3_CLUSTER1_CORE_COUNT, |
Benjamin Fair | 42eea87 | 2016-10-14 01:13:47 +0000 | [diff] [blame] | 17 | K3_CLUSTER2_CORE_COUNT, |
Benjamin Fair | 42eea87 | 2016-10-14 01:13:47 +0000 | [diff] [blame] | 18 | K3_CLUSTER3_CORE_COUNT, |
Benjamin Fair | 42eea87 | 2016-10-14 01:13:47 +0000 | [diff] [blame] | 19 | }; |
| 20 | |
| 21 | const unsigned char *plat_get_power_domain_tree_desc(void) |
| 22 | { |
| 23 | return power_domain_tree_desc; |
| 24 | } |
| 25 | |
| 26 | int plat_core_pos_by_mpidr(u_register_t mpidr) |
| 27 | { |
Andrew F. Davis | b208ae3 | 2019-03-27 09:37:10 -0500 | [diff] [blame] | 28 | unsigned int cluster = MPIDR_AFFLVL1_VAL(mpidr); |
| 29 | unsigned int core = MPIDR_AFFLVL0_VAL(mpidr); |
Benjamin Fair | 42eea87 | 2016-10-14 01:13:47 +0000 | [diff] [blame] | 30 | |
Andrew F. Davis | b208ae3 | 2019-03-27 09:37:10 -0500 | [diff] [blame] | 31 | if (MPIDR_AFFLVL3_VAL(mpidr) > 0 || |
| 32 | MPIDR_AFFLVL2_VAL(mpidr) > 0) { |
Benjamin Fair | 42eea87 | 2016-10-14 01:13:47 +0000 | [diff] [blame] | 33 | return -1; |
Andrew F. Davis | b208ae3 | 2019-03-27 09:37:10 -0500 | [diff] [blame] | 34 | } |
Benjamin Fair | 42eea87 | 2016-10-14 01:13:47 +0000 | [diff] [blame] | 35 | |
Andrew F. Davis | b208ae3 | 2019-03-27 09:37:10 -0500 | [diff] [blame] | 36 | if (cluster > 0) |
| 37 | core += K3_CLUSTER0_CORE_COUNT; |
| 38 | if (cluster > 1) |
| 39 | core += K3_CLUSTER1_CORE_COUNT; |
| 40 | if (cluster > 2) |
| 41 | core += K3_CLUSTER2_CORE_COUNT; |
| 42 | if (cluster > 3) |
Benjamin Fair | 42eea87 | 2016-10-14 01:13:47 +0000 | [diff] [blame] | 43 | return -1; |
Andrew F. Davis | b208ae3 | 2019-03-27 09:37:10 -0500 | [diff] [blame] | 44 | |
| 45 | return core; |
Benjamin Fair | 42eea87 | 2016-10-14 01:13:47 +0000 | [diff] [blame] | 46 | } |