msm8916_topology.c 964 B

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