imx8_topology.c 876 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. * Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #include <arch.h>
  7. #include <arch_helpers.h>
  8. #include <plat/common/platform.h>
  9. const unsigned char imx_power_domain_tree_desc[] = {
  10. PWR_DOMAIN_AT_MAX_LVL,
  11. PLATFORM_CLUSTER_COUNT,
  12. PLATFORM_CLUSTER0_CORE_COUNT,
  13. PLATFORM_CLUSTER1_CORE_COUNT,
  14. };
  15. const unsigned char *plat_get_power_domain_tree_desc(void)
  16. {
  17. return imx_power_domain_tree_desc;
  18. }
  19. int plat_core_pos_by_mpidr(u_register_t mpidr)
  20. {
  21. unsigned int cluster_id, cpu_id;
  22. mpidr &= MPIDR_AFFINITY_MASK;
  23. if (mpidr & ~(MPIDR_CLUSTER_MASK | MPIDR_CPU_MASK))
  24. return -1;
  25. cluster_id = MPIDR_AFFLVL1_VAL(mpidr);
  26. cpu_id = MPIDR_AFFLVL0_VAL(mpidr);
  27. if (cluster_id > PLATFORM_CLUSTER_COUNT ||
  28. cpu_id > PLATFORM_MAX_CPU_PER_CLUSTER)
  29. return -1;
  30. return (cpu_id + (cluster_id * 4));
  31. }