1 /*
2  * Copyright (c) 2021-2022, ARM Limited and Contributors. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #include <plat/arm/common/plat_arm.h>
8 #include <plat/common/platform.h>
9 
10 /* The corstone1000 power domain tree descriptor */
11 static unsigned char corstone1000_power_domain_tree_desc[PLAT_ARM_CLUSTER_COUNT
12 							+ 2];
13 /*******************************************************************************
14  * This function dynamically constructs the topology according to
15  * CLUSTER_COUNT and returns it.
16  ******************************************************************************/
plat_get_power_domain_tree_desc(void)17 const unsigned char *plat_get_power_domain_tree_desc(void)
18 {
19 	int i;
20 
21 	/*
22 	 * The highest level is the system level. The next level is constituted
23 	 * by clusters and then cores in clusters.
24 	 */
25 	corstone1000_power_domain_tree_desc[0] = 1;
26 	corstone1000_power_domain_tree_desc[1] = PLAT_ARM_CLUSTER_COUNT;
27 
28 	for (i = 0; i < PLAT_ARM_CLUSTER_COUNT; i++)
29 		corstone1000_power_domain_tree_desc[i + 2] = PLATFORM_CORE_COUNT;
30 
31 	return corstone1000_power_domain_tree_desc;
32 }
33 
34 /******************************************************************************
35  * This function implements a part of the critical interface between the PSCI
36  * generic layer and the platform that allows the former to query the platform
37  * to convert an MPIDR to a unique linear index. An error code (-1) is
38  * returned in case the MPIDR is invalid.
39  *****************************************************************************/
plat_core_pos_by_mpidr(u_register_t mpidr)40 int plat_core_pos_by_mpidr(u_register_t mpidr)
41 {
42 	return plat_arm_calc_core_pos(mpidr);
43 }
44