• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #include <platform_def.h>
8 
9 #include <lib/psci/psci.h>
10 
11 /* The power domain tree descriptor */
12 static unsigned char power_domain_tree_desc[] = {
13 	PLATFORM_SYSTEM_COUNT,
14 	PLATFORM_CLUSTER_COUNT,
15 	K3_CLUSTER0_CORE_COUNT,
16 	K3_CLUSTER1_CORE_COUNT,
17 	K3_CLUSTER2_CORE_COUNT,
18 	K3_CLUSTER3_CORE_COUNT,
19 };
20 
plat_get_power_domain_tree_desc(void)21 const unsigned char *plat_get_power_domain_tree_desc(void)
22 {
23 	return power_domain_tree_desc;
24 }
25 
plat_core_pos_by_mpidr(u_register_t mpidr)26 int plat_core_pos_by_mpidr(u_register_t mpidr)
27 {
28 	unsigned int cluster = MPIDR_AFFLVL1_VAL(mpidr);
29 	unsigned int core = MPIDR_AFFLVL0_VAL(mpidr);
30 
31 	if (MPIDR_AFFLVL3_VAL(mpidr) > 0 ||
32 	    MPIDR_AFFLVL2_VAL(mpidr) > 0) {
33 		return -1;
34 	}
35 
36 	if (cluster > 0)
37 		core += K3_CLUSTER0_CORE_COUNT;
38 	if (cluster > 1)
39 		core += K3_CLUSTER1_CORE_COUNT;
40 	if (cluster > 2)
41 		core += K3_CLUSTER2_CORE_COUNT;
42 	if (cluster > 3)
43 		return -1;
44 
45 	return core;
46 }
47