plat_topology.c 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. * Copyright (c) 2018, Renesas Electronics Corporation. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #include <platform_def.h>
  7. #include <common/debug.h>
  8. #include <lib/psci/psci.h>
  9. static const unsigned char rcar_power_domain_tree_desc[] = {
  10. 1,
  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 rcar_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 >> MPIDR_AFF1_SHIFT) & MPIDR_AFFLVL_MASK;
  26. cpu_id = (mpidr >> MPIDR_AFF0_SHIFT) & MPIDR_AFFLVL_MASK;
  27. if (cluster_id >= PLATFORM_CLUSTER_COUNT)
  28. return -1;
  29. if (cluster_id == 0 && cpu_id >= PLATFORM_CLUSTER0_CORE_COUNT)
  30. return -1;
  31. if (cluster_id == 1 && cpu_id >= PLATFORM_CLUSTER1_CORE_COUNT)
  32. return -1;
  33. return (cpu_id + cluster_id * PLATFORM_CLUSTER0_CORE_COUNT);
  34. }