css_topology.c 1.45 KB
Newer Older
1
/*
Roberto Vargas's avatar
Roberto Vargas committed
2
 * Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
3
 *
dp-arm's avatar
dp-arm committed
4
 * SPDX-License-Identifier: BSD-3-Clause
5
6
7
 */

#include <plat_arm.h>
Roberto Vargas's avatar
Roberto Vargas committed
8
#include <platform.h>
9
#include <assert.h>
10

11
12
13
14
#if ARM_PLAT_MT
#pragma weak plat_arm_get_cpu_pe_count
#endif

15
16
17
18
19
20
21
22
/******************************************************************************
 * This function implements a part of the critical interface between the psci
 * generic layer and the platform that allows the former to query the platform
 * to convert an MPIDR to a unique linear index. An error code (-1) is
 * returned in case the MPIDR is invalid.
 *****************************************************************************/
int plat_core_pos_by_mpidr(u_register_t mpidr)
{
23
24
25
	if (arm_check_mpidr(mpidr) == 0) {
#if ARM_PLAT_MT
		assert((read_mpidr_el1() & MPIDR_MT_MASK) != 0);
26
27
28
29
30
31

		/*
		 * The DTB files don't provide the MT bit in the mpidr argument
		 * so set it manually before calculating core position
		 */
		mpidr |= MPIDR_MT_MASK;
32
#endif
33
		return plat_arm_calc_core_pos(mpidr);
34
	}
35
36
	return -1;
}
37
38
39
40
41
42
43
44
45
46
47

#if ARM_PLAT_MT
/******************************************************************************
 * This function returns the PE count within the physical cpu corresponding to
 * `mpidr`. Now one cpu only have one thread, so just return 1.
 *****************************************************************************/
unsigned int plat_arm_get_cpu_pe_count(u_register_t mpidr)
{
	return 1;
}
#endif /* ARM_PLAT_MT */