blob: 9dfd05d0910abcafc5c474bafcbb977a93389281 [file] [log] [blame]
Abdellatif El Khlifiad9b8e52021-04-21 17:20:43 +01001/*
2 * Copyright (c) 2021, 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 diphda power domain tree descriptor */
11static unsigned char diphda_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 ******************************************************************************/
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 */
25 diphda_power_domain_tree_desc[0] = 1;
26 diphda_power_domain_tree_desc[1] = PLAT_ARM_CLUSTER_COUNT;
27
28 for (i = 0; i < PLAT_ARM_CLUSTER_COUNT; i++)
29 diphda_power_domain_tree_desc[i + 2] = PLATFORM_CORE_COUNT;
30
31 return diphda_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 *****************************************************************************/
40int plat_core_pos_by_mpidr(u_register_t mpidr)
41{
42 return plat_arm_calc_core_pos(mpidr);
43}