Tony Xie | f6118cc | 2016-01-15 17:17:32 +0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2013-2016, ARM Limited and Contributors. All rights reserved. |
| 3 | * |
dp-arm | fa3cf0b | 2017-05-03 09:38:09 +0100 | [diff] [blame] | 4 | * SPDX-License-Identifier: BSD-3-Clause |
Tony Xie | f6118cc | 2016-01-15 17:17:32 +0800 | [diff] [blame] | 5 | */ |
| 6 | |
Antonio Nino Diaz | e0f9063 | 2018-12-14 00:18:21 +0000 | [diff] [blame] | 7 | #include <platform_def.h> |
| 8 | |
Tony Xie | f6118cc | 2016-01-15 17:17:32 +0800 | [diff] [blame] | 9 | #include <arch.h> |
Antonio Nino Diaz | e0f9063 | 2018-12-14 00:18:21 +0000 | [diff] [blame] | 10 | #include <lib/psci/psci.h> |
| 11 | |
Tony Xie | f6118cc | 2016-01-15 17:17:32 +0800 | [diff] [blame] | 12 | #include <plat_private.h> |
Tony Xie | f6118cc | 2016-01-15 17:17:32 +0800 | [diff] [blame] | 13 | |
| 14 | /******************************************************************************* |
| 15 | * This function returns the RockChip default topology tree information. |
| 16 | ******************************************************************************/ |
| 17 | const unsigned char *plat_get_power_domain_tree_desc(void) |
| 18 | { |
| 19 | return rockchip_power_domain_tree_desc; |
| 20 | } |
| 21 | |
| 22 | int plat_core_pos_by_mpidr(u_register_t mpidr) |
| 23 | { |
| 24 | unsigned int cluster_id, cpu_id; |
| 25 | |
Tony Xie | 42e113e | 2016-07-16 11:16:51 +0800 | [diff] [blame] | 26 | cpu_id = mpidr & MPIDR_AFFLVL_MASK; |
Heiko Stuebner | 9dc2833 | 2019-03-14 22:11:34 +0100 | [diff] [blame] | 27 | #ifdef PLAT_RK_MPIDR_CLUSTER_MASK |
| 28 | cluster_id = mpidr & PLAT_RK_MPIDR_CLUSTER_MASK; |
| 29 | #else |
Tony Xie | 42e113e | 2016-07-16 11:16:51 +0800 | [diff] [blame] | 30 | cluster_id = mpidr & MPIDR_CLUSTER_MASK; |
Heiko Stuebner | 9dc2833 | 2019-03-14 22:11:34 +0100 | [diff] [blame] | 31 | #endif |
Tony Xie | f6118cc | 2016-01-15 17:17:32 +0800 | [diff] [blame] | 32 | |
Tony Xie | 42e113e | 2016-07-16 11:16:51 +0800 | [diff] [blame] | 33 | cpu_id += (cluster_id >> PLAT_RK_CLST_TO_CPUID_SHIFT); |
| 34 | |
| 35 | if (cpu_id >= PLATFORM_CORE_COUNT) |
Tony Xie | f6118cc | 2016-01-15 17:17:32 +0800 | [diff] [blame] | 36 | return -1; |
| 37 | |
Tony Xie | 42e113e | 2016-07-16 11:16:51 +0800 | [diff] [blame] | 38 | return cpu_id; |
Tony Xie | f6118cc | 2016-01-15 17:17:32 +0800 | [diff] [blame] | 39 | } |