blob: 8aca7449fb61c325a8285a227d3dfbeff9f42cd0 [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 Diazbd7b7402019-01-25 14:30:04 +00009#include <plat/arm/common/plat_arm.h>
Antonio Nino Diaze0f90632018-12-14 00:18:21 +000010#include <plat/common/platform.h>
11
Summer Qin93c812f2017-02-28 16:46:17 +000012#if ARM_PLAT_MT
13#pragma weak plat_arm_get_cpu_pe_count
14#endif
15
Soby Mathewfec4eb72015-07-01 16:16:20 +010016/******************************************************************************
17 * This function implements a part of the critical interface between the psci
18 * generic layer and the platform that allows the former to query the platform
19 * to convert an MPIDR to a unique linear index. An error code (-1) is
20 * returned in case the MPIDR is invalid.
21 *****************************************************************************/
22int plat_core_pos_by_mpidr(u_register_t mpidr)
23{
Vishwanatha HG64f0b6f2018-05-08 17:15:37 +053024 if (arm_check_mpidr(mpidr) == 0) {
25#if ARM_PLAT_MT
26 assert((read_mpidr_el1() & MPIDR_MT_MASK) != 0);
Nariman Poushinf67abbb2018-06-25 17:04:51 +010027
28 /*
29 * The DTB files don't provide the MT bit in the mpidr argument
30 * so set it manually before calculating core position
31 */
32 mpidr |= MPIDR_MT_MASK;
Vishwanatha HG64f0b6f2018-05-08 17:15:37 +053033#endif
Soby Mathewfec4eb72015-07-01 16:16:20 +010034 return plat_arm_calc_core_pos(mpidr);
Vishwanatha HG64f0b6f2018-05-08 17:15:37 +053035 }
Soby Mathewfec4eb72015-07-01 16:16:20 +010036 return -1;
37}
Summer Qin93c812f2017-02-28 16:46:17 +000038
39#if ARM_PLAT_MT
40/******************************************************************************
41 * This function returns the PE count within the physical cpu corresponding to
42 * `mpidr`. Now one cpu only have one thread, so just return 1.
43 *****************************************************************************/
44unsigned int plat_arm_get_cpu_pe_count(u_register_t mpidr)
45{
46 return 1;
47}
48#endif /* ARM_PLAT_MT */