xref: /rk3399_ARM-atf/plat/arm/css/common/css_topology.c (revision 8aaa8634a30ccc896178e7a47b62019187df247b)
138dce70fSSoby Mathew /*
2fd116b9fSRoberto Vargas  * Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
338dce70fSSoby Mathew  *
482cb2c1aSdp-arm  * SPDX-License-Identifier: BSD-3-Clause
538dce70fSSoby Mathew  */
638dce70fSSoby Mathew 
738dce70fSSoby Mathew #include <plat_arm.h>
8fd116b9fSRoberto Vargas #include <platform.h>
9*8aaa8634SVishwanatha HG #include <assert.h>
1038dce70fSSoby Mathew 
11d8d6cf24SSummer Qin #if ARM_PLAT_MT
12d8d6cf24SSummer Qin #pragma weak plat_arm_get_cpu_pe_count
13d8d6cf24SSummer Qin #endif
14d8d6cf24SSummer Qin 
1538dce70fSSoby Mathew /******************************************************************************
1638dce70fSSoby Mathew  * This function implements a part of the critical interface between the psci
1738dce70fSSoby Mathew  * generic layer and the platform that allows the former to query the platform
1838dce70fSSoby Mathew  * to convert an MPIDR to a unique linear index. An error code (-1) is
1938dce70fSSoby Mathew  * returned in case the MPIDR is invalid.
2038dce70fSSoby Mathew  *****************************************************************************/
2138dce70fSSoby Mathew int plat_core_pos_by_mpidr(u_register_t mpidr)
2238dce70fSSoby Mathew {
23*8aaa8634SVishwanatha HG 	if (arm_check_mpidr(mpidr) == 0) {
24*8aaa8634SVishwanatha HG #if ARM_PLAT_MT
25*8aaa8634SVishwanatha HG 		assert((read_mpidr_el1() & MPIDR_MT_MASK) != 0);
26*8aaa8634SVishwanatha HG #endif
2738dce70fSSoby Mathew 		return plat_arm_calc_core_pos(mpidr);
28*8aaa8634SVishwanatha HG 	}
2938dce70fSSoby Mathew 	return -1;
3038dce70fSSoby Mathew }
31d8d6cf24SSummer Qin 
32d8d6cf24SSummer Qin #if ARM_PLAT_MT
33d8d6cf24SSummer Qin /******************************************************************************
34d8d6cf24SSummer Qin  * This function returns the PE count within the physical cpu corresponding to
35d8d6cf24SSummer Qin  * `mpidr`. Now one cpu only have one thread, so just return 1.
36d8d6cf24SSummer Qin  *****************************************************************************/
37d8d6cf24SSummer Qin unsigned int plat_arm_get_cpu_pe_count(u_register_t mpidr)
38d8d6cf24SSummer Qin {
39d8d6cf24SSummer Qin 	return 1;
40d8d6cf24SSummer Qin }
41d8d6cf24SSummer Qin #endif /* ARM_PLAT_MT */
42