Anson Huang | 4c28fc3 | 2018-06-05 16:12:27 +0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
| 7 | #include <arch.h> |
| 8 | #include <arch_helpers.h> |
| 9 | #include <platform.h> |
| 10 | |
| 11 | const unsigned char imx_power_domain_tree_desc[] = { |
| 12 | PWR_DOMAIN_AT_MAX_LVL, |
| 13 | PLATFORM_CLUSTER_COUNT, |
Anson Huang | e25ab61 | 2018-07-12 14:30:52 +0800 | [diff] [blame] | 14 | PLATFORM_CLUSTER0_CORE_COUNT, |
| 15 | PLATFORM_CLUSTER1_CORE_COUNT, |
Anson Huang | 4c28fc3 | 2018-06-05 16:12:27 +0800 | [diff] [blame] | 16 | }; |
| 17 | |
| 18 | const unsigned char *plat_get_power_domain_tree_desc(void) |
| 19 | { |
| 20 | return imx_power_domain_tree_desc; |
| 21 | } |
| 22 | |
| 23 | int plat_core_pos_by_mpidr(u_register_t mpidr) |
| 24 | { |
| 25 | unsigned int cluster_id, cpu_id; |
| 26 | |
| 27 | mpidr &= MPIDR_AFFINITY_MASK; |
| 28 | |
| 29 | if (mpidr & ~(MPIDR_CLUSTER_MASK | MPIDR_CPU_MASK)) |
| 30 | return -1; |
| 31 | |
| 32 | cluster_id = MPIDR_AFFLVL1_VAL(mpidr); |
| 33 | cpu_id = MPIDR_AFFLVL0_VAL(mpidr); |
| 34 | |
| 35 | if (cluster_id > PLATFORM_CLUSTER_COUNT || |
| 36 | cpu_id > PLATFORM_MAX_CPU_PER_CLUSTER) |
| 37 | return -1; |
| 38 | |
| 39 | return (cpu_id + (cluster_id * 4)); |
| 40 | } |