blob: 8ac223230812d99093fa79f1426e7a1428b8525c [file] [log] [blame]
Soby Mathewfec4eb72015-07-01 16:16:20 +01001/*
Roberto Vargas2b36b152018-02-12 12:36:17 +00002 * Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
Soby Mathewfec4eb72015-07-01 16:16:20 +01003 *
dp-armfa3cf0b2017-05-03 09:38:09 +01004 * SPDX-License-Identifier: BSD-3-Clause
Soby Mathewfec4eb72015-07-01 16:16:20 +01005 */
6
Vishwanatha HG64f0b6f2018-05-08 17:15:37 +05307#include <assert.h>
Soby Mathewfec4eb72015-07-01 16:16:20 +01008
Antonio Nino Diaze0f90632018-12-14 00:18:21 +00009#include <plat/common/platform.h>
10
11#include <plat_arm.h>
12
Summer Qin93c812f2017-02-28 16:46:17 +000013#if ARM_PLAT_MT
14#pragma weak plat_arm_get_cpu_pe_count
15#endif
16
Soby Mathewfec4eb72015-07-01 16:16:20 +010017/******************************************************************************
18 * This function implements a part of the critical interface between the psci
19 * generic layer and the platform that allows the former to query the platform
20 * to convert an MPIDR to a unique linear index. An error code (-1) is
21 * returned in case the MPIDR is invalid.
22 *****************************************************************************/
23int plat_core_pos_by_mpidr(u_register_t mpidr)
24{
Vishwanatha HG64f0b6f2018-05-08 17:15:37 +053025 if (arm_check_mpidr(mpidr) == 0) {
26#if ARM_PLAT_MT
27 assert((read_mpidr_el1() & MPIDR_MT_MASK) != 0);
Nariman Poushinf67abbb2018-06-25 17:04:51 +010028
29 /*
30 * The DTB files don't provide the MT bit in the mpidr argument
31 * so set it manually before calculating core position
32 */
33 mpidr |= MPIDR_MT_MASK;
Vishwanatha HG64f0b6f2018-05-08 17:15:37 +053034#endif
Soby Mathewfec4eb72015-07-01 16:16:20 +010035 return plat_arm_calc_core_pos(mpidr);
Vishwanatha HG64f0b6f2018-05-08 17:15:37 +053036 }
Soby Mathewfec4eb72015-07-01 16:16:20 +010037 return -1;
38}
Summer Qin93c812f2017-02-28 16:46:17 +000039
40#if ARM_PLAT_MT
41/******************************************************************************
42 * This function returns the PE count within the physical cpu corresponding to
43 * `mpidr`. Now one cpu only have one thread, so just return 1.
44 *****************************************************************************/
45unsigned int plat_arm_get_cpu_pe_count(u_register_t mpidr)
46{
47 return 1;
48}
49#endif /* ARM_PLAT_MT */