plat_topology.c 957 Bytes
Newer Older
Tony Xie's avatar
Tony Xie committed
1
2
3
/*
 * Copyright (c) 2013-2016, ARM Limited and Contributors. All rights reserved.
 *
dp-arm's avatar
dp-arm committed
4
 * SPDX-License-Identifier: BSD-3-Clause
Tony Xie's avatar
Tony Xie committed
5
6
 */

7
8
#include <platform_def.h>

Tony Xie's avatar
Tony Xie committed
9
#include <arch.h>
10
11
#include <lib/psci/psci.h>

Tony Xie's avatar
Tony Xie committed
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <plat_private.h>

/*******************************************************************************
 * This function returns the RockChip default topology tree information.
 ******************************************************************************/
const unsigned char *plat_get_power_domain_tree_desc(void)
{
	return rockchip_power_domain_tree_desc;
}

int plat_core_pos_by_mpidr(u_register_t mpidr)
{
	unsigned int cluster_id, cpu_id;

26
	cpu_id = mpidr & MPIDR_AFFLVL_MASK;
27
28
29
#ifdef PLAT_RK_MPIDR_CLUSTER_MASK
	cluster_id = mpidr & PLAT_RK_MPIDR_CLUSTER_MASK;
#else
30
	cluster_id = mpidr & MPIDR_CLUSTER_MASK;
31
#endif
Tony Xie's avatar
Tony Xie committed
32

33
34
35
	cpu_id += (cluster_id >> PLAT_RK_CLST_TO_CPUID_SHIFT);

	if (cpu_id >= PLATFORM_CORE_COUNT)
Tony Xie's avatar
Tony Xie committed
36
37
		return -1;

38
	return cpu_id;
Tony Xie's avatar
Tony Xie committed
39
}