blob: 5351896e36d7365a656373c1adb5f1f084743011 [file] [log] [blame]
Abdellatif El Khlifiad9b8e52021-04-21 17:20:43 +01001/*
Vishnu Banavath2b651ea2022-01-19 18:43:12 +00002 * Copyright (c) 2021-2022, ARM Limited and Contributors. All rights reserved.
Abdellatif El Khlifiad9b8e52021-04-21 17:20:43 +01003 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#include <plat/arm/common/plat_arm.h>
8#include <plat/common/platform.h>
9
Vishnu Banavath2b651ea2022-01-19 18:43:12 +000010/* The corstone1000 power domain tree descriptor */
11static unsigned char corstone1000_power_domain_tree_desc[PLAT_ARM_CLUSTER_COUNT
Abdellatif El Khlifiad9b8e52021-04-21 17:20:43 +010012 + 2];
13/*******************************************************************************
14 * This function dynamically constructs the topology according to
15 * CLUSTER_COUNT and returns it.
16 ******************************************************************************/
17const 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 */
Vishnu Banavath2b651ea2022-01-19 18:43:12 +000025 corstone1000_power_domain_tree_desc[0] = 1;
26 corstone1000_power_domain_tree_desc[1] = PLAT_ARM_CLUSTER_COUNT;
Abdellatif El Khlifiad9b8e52021-04-21 17:20:43 +010027
28 for (i = 0; i < PLAT_ARM_CLUSTER_COUNT; i++)
Vishnu Banavath2b651ea2022-01-19 18:43:12 +000029 corstone1000_power_domain_tree_desc[i + 2] = PLATFORM_CORE_COUNT;
Abdellatif El Khlifiad9b8e52021-04-21 17:20:43 +010030
Vishnu Banavath2b651ea2022-01-19 18:43:12 +000031 return corstone1000_power_domain_tree_desc;
Abdellatif El Khlifiad9b8e52021-04-21 17:20:43 +010032}
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 *****************************************************************************/
40int plat_core_pos_by_mpidr(u_register_t mpidr)
41{
42 return plat_arm_calc_core_pos(mpidr);
43}