Debian Codegraph @

plat/qti/msm8916/msm8916_topology.c

raw symbols SCIP
1 /*
2 * Copyright (c) 2022, Stephan Gerhold <[email protected]>
3 * Copyright (c) 2017-2021, ARM Limited and Contributors. All rights reserved.
4 *
5 * SPDX-License-Identifier: BSD-3-Clause
6 */
7
8 #include <arch.h>
9 #include <plat/common/platform.h>
10
11 #include <platform_def.h>
12
13 static const unsigned char plat_power_domain_tree_desc[] = {
14 PLATFORM_SYSTEM_COUNT,
15 PLATFORM_CLUSTER_COUNT,
16 PLATFORM_CPUS_PER_CLUSTER,
17 #if PLATFORM_CLUSTER_COUNT > 1
18 PLATFORM_CPUS_PER_CLUSTER,
19 #endif
20 };
21
22 int plat_core_pos_by_mpidr(u_register_t mpidr)
23 {
24 unsigned int cluster = MPIDR_AFFLVL1_VAL(mpidr);
25 unsigned int core = MPIDR_AFFLVL0_VAL(mpidr);
26
27 if (MPIDR_AFFLVL3_VAL(mpidr) > 0 ||
28 MPIDR_AFFLVL2_VAL(mpidr) > 0 ||
29 cluster >= PLATFORM_CLUSTER_COUNT ||
30 core >= PLATFORM_CPUS_PER_CLUSTER) {
31 return -1;
32 }
33 return core | (cluster << PLATFORM_CPU_PER_CLUSTER_SHIFT);
34 }
35
36 const unsigned char *plat_get_power_domain_tree_desc(void)
37 {
38 return plat_power_domain_tree_desc;
39 }