blob: 42f94554dfdd19fe620f26fb62a66e3f0e1b7e85 [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
7#include <plat_arm.h>
Roberto Vargas2b36b152018-02-12 12:36:17 +00008#include <platform.h>
Vishwanatha HG64f0b6f2018-05-08 17:15:37 +05309#include <assert.h>
Soby Mathewfec4eb72015-07-01 16:16:20 +010010
Summer Qin93c812f2017-02-28 16:46:17 +000011#if ARM_PLAT_MT
12#pragma weak plat_arm_get_cpu_pe_count
13#endif
14
Soby Mathewfec4eb72015-07-01 16:16:20 +010015/******************************************************************************
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 *****************************************************************************/
21int plat_core_pos_by_mpidr(u_register_t mpidr)
22{
Vishwanatha HG64f0b6f2018-05-08 17:15:37 +053023 if (arm_check_mpidr(mpidr) == 0) {
24#if ARM_PLAT_MT
25 assert((read_mpidr_el1() & MPIDR_MT_MASK) != 0);
26#endif
Soby Mathewfec4eb72015-07-01 16:16:20 +010027 return plat_arm_calc_core_pos(mpidr);
Vishwanatha HG64f0b6f2018-05-08 17:15:37 +053028 }
Soby Mathewfec4eb72015-07-01 16:16:20 +010029 return -1;
30}
Summer Qin93c812f2017-02-28 16:46:17 +000031
32#if ARM_PLAT_MT
33/******************************************************************************
34 * This function returns the PE count within the physical cpu corresponding to
35 * `mpidr`. Now one cpu only have one thread, so just return 1.
36 *****************************************************************************/
37unsigned int plat_arm_get_cpu_pe_count(u_register_t mpidr)
38{
39 return 1;
40}
41#endif /* ARM_PLAT_MT */