xref: /rk3399_ARM-atf/plat/arm/css/common/css_topology.c (revision 8aaa8634a30ccc896178e7a47b62019187df247b)
1 /*
2  * Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #include <plat_arm.h>
8 #include <platform.h>
9 #include <assert.h>
10 
11 #if ARM_PLAT_MT
12 #pragma weak plat_arm_get_cpu_pe_count
13 #endif
14 
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 {
23 	if (arm_check_mpidr(mpidr) == 0) {
24 #if ARM_PLAT_MT
25 		assert((read_mpidr_el1() & MPIDR_MT_MASK) != 0);
26 #endif
27 		return plat_arm_calc_core_pos(mpidr);
28 	}
29 	return -1;
30 }
31 
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  *****************************************************************************/
37 unsigned int plat_arm_get_cpu_pe_count(u_register_t mpidr)
38 {
39 	return 1;
40 }
41 #endif /* ARM_PLAT_MT */
42