Soby Mathew | fec4eb7 | 2015-07-01 16:16:20 +0100 | [diff] [blame] | 1 | /* |
Roberto Vargas | 2b36b15 | 2018-02-12 12:36:17 +0000 | [diff] [blame] | 2 | * Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved. |
Soby Mathew | fec4eb7 | 2015-07-01 16:16:20 +0100 | [diff] [blame] | 3 | * |
dp-arm | fa3cf0b | 2017-05-03 09:38:09 +0100 | [diff] [blame] | 4 | * SPDX-License-Identifier: BSD-3-Clause |
Soby Mathew | fec4eb7 | 2015-07-01 16:16:20 +0100 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #include <plat_arm.h> |
Roberto Vargas | 2b36b15 | 2018-02-12 12:36:17 +0000 | [diff] [blame] | 8 | #include <platform.h> |
Vishwanatha HG | 64f0b6f | 2018-05-08 17:15:37 +0530 | [diff] [blame] | 9 | #include <assert.h> |
Soby Mathew | fec4eb7 | 2015-07-01 16:16:20 +0100 | [diff] [blame] | 10 | |
Summer Qin | 93c812f | 2017-02-28 16:46:17 +0000 | [diff] [blame] | 11 | #if ARM_PLAT_MT |
| 12 | #pragma weak plat_arm_get_cpu_pe_count |
| 13 | #endif |
| 14 | |
Soby Mathew | fec4eb7 | 2015-07-01 16:16:20 +0100 | [diff] [blame] | 15 | /****************************************************************************** |
| 16 | * This function implements a part of the critical interface between the psci |
| 17 | * generic layer and the platform that allows the former to query the platform |
| 18 | * to convert an MPIDR to a unique linear index. An error code (-1) is |
| 19 | * returned in case the MPIDR is invalid. |
| 20 | *****************************************************************************/ |
| 21 | int plat_core_pos_by_mpidr(u_register_t mpidr) |
| 22 | { |
Vishwanatha HG | 64f0b6f | 2018-05-08 17:15:37 +0530 | [diff] [blame] | 23 | if (arm_check_mpidr(mpidr) == 0) { |
| 24 | #if ARM_PLAT_MT |
| 25 | assert((read_mpidr_el1() & MPIDR_MT_MASK) != 0); |
Nariman Poushin | f67abbb | 2018-06-25 17:04:51 +0100 | [diff] [blame] | 26 | |
| 27 | /* |
| 28 | * The DTB files don't provide the MT bit in the mpidr argument |
| 29 | * so set it manually before calculating core position |
| 30 | */ |
| 31 | mpidr |= MPIDR_MT_MASK; |
Vishwanatha HG | 64f0b6f | 2018-05-08 17:15:37 +0530 | [diff] [blame] | 32 | #endif |
Soby Mathew | fec4eb7 | 2015-07-01 16:16:20 +0100 | [diff] [blame] | 33 | return plat_arm_calc_core_pos(mpidr); |
Vishwanatha HG | 64f0b6f | 2018-05-08 17:15:37 +0530 | [diff] [blame] | 34 | } |
Soby Mathew | fec4eb7 | 2015-07-01 16:16:20 +0100 | [diff] [blame] | 35 | return -1; |
| 36 | } |
Summer Qin | 93c812f | 2017-02-28 16:46:17 +0000 | [diff] [blame] | 37 | |
| 38 | #if ARM_PLAT_MT |
| 39 | /****************************************************************************** |
| 40 | * This function returns the PE count within the physical cpu corresponding to |
| 41 | * `mpidr`. Now one cpu only have one thread, so just return 1. |
| 42 | *****************************************************************************/ |
| 43 | unsigned int plat_arm_get_cpu_pe_count(u_register_t mpidr) |
| 44 | { |
| 45 | return 1; |
| 46 | } |
| 47 | #endif /* ARM_PLAT_MT */ |