blob: 4d0ed8fcc206b27b675b08fd2cf42ae38f0d2bb7 [file] [log] [blame]
Stephan Gerhold14fdf072021-12-01 20:01:11 +01001/*
2 * Copyright (c) 2017-2021, ARM Limited and Contributors. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#include <arch.h>
8#include <plat/common/platform.h>
9
10#include <platform_def.h>
11
12static const unsigned char plat_power_domain_tree_desc[PLAT_MAX_PWR_LVL + 1] = {
13 PLATFORM_SYSTEM_COUNT,
14 PLATFORM_CLUSTER_COUNT,
15 PLATFORM_MAX_CPUS_PER_CLUSTER,
16};
17
18int plat_core_pos_by_mpidr(u_register_t mpidr)
19{
20 unsigned int core = MPIDR_AFFLVL0_VAL(mpidr);
21
22 if (MPIDR_AFFLVL3_VAL(mpidr) > 0 ||
23 MPIDR_AFFLVL2_VAL(mpidr) > 0 ||
24 MPIDR_AFFLVL1_VAL(mpidr) > 0 ||
25 core >= PLATFORM_MAX_CPUS_PER_CLUSTER) {
26 return -1;
27 }
28
29 return core;
30}
31
32const unsigned char *plat_get_power_domain_tree_desc(void)
33{
34 return plat_power_domain_tree_desc;
35}