tc_topology.c 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  2. * Copyright (c) 2020-2024, Arm Limited and Contributors. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #include <plat/arm/common/plat_arm.h>
  7. #include <plat/arm/css/common/css_pm.h>
  8. #include <platform_def.h>
  9. /******************************************************************************
  10. * The power domain tree descriptor.
  11. ******************************************************************************/
  12. const unsigned char tc_pd_tree_desc[] = {
  13. PLAT_ARM_CLUSTER_COUNT,
  14. PLAT_MAX_CPUS_PER_CLUSTER,
  15. };
  16. /*******************************************************************************
  17. * This function returns the topology tree information.
  18. ******************************************************************************/
  19. const unsigned char *plat_get_power_domain_tree_desc(void)
  20. {
  21. return tc_pd_tree_desc;
  22. }
  23. /*******************************************************************************
  24. * The array mapping platform core position (implemented by plat_my_core_pos())
  25. * to the SCMI power domain ID implemented by SCP.
  26. ******************************************************************************/
  27. const uint32_t plat_css_core_pos_to_scmi_dmn_id_map[] = {
  28. (SET_SCMI_CHANNEL_ID(0x0) | SET_SCMI_DOMAIN_ID(0x0)),
  29. (SET_SCMI_CHANNEL_ID(0x0) | SET_SCMI_DOMAIN_ID(0x1)),
  30. (SET_SCMI_CHANNEL_ID(0x0) | SET_SCMI_DOMAIN_ID(0x2)),
  31. (SET_SCMI_CHANNEL_ID(0x0) | SET_SCMI_DOMAIN_ID(0x3)),
  32. (SET_SCMI_CHANNEL_ID(0x0) | SET_SCMI_DOMAIN_ID(0x4)),
  33. (SET_SCMI_CHANNEL_ID(0x0) | SET_SCMI_DOMAIN_ID(0x5)),
  34. (SET_SCMI_CHANNEL_ID(0x0) | SET_SCMI_DOMAIN_ID(0x6)),
  35. (SET_SCMI_CHANNEL_ID(0x0) | SET_SCMI_DOMAIN_ID(0x7)),
  36. #if PLATFORM_CORE_COUNT == 14
  37. (SET_SCMI_CHANNEL_ID(0x0) | SET_SCMI_DOMAIN_ID(0x8)),
  38. (SET_SCMI_CHANNEL_ID(0x0) | SET_SCMI_DOMAIN_ID(0x9)),
  39. (SET_SCMI_CHANNEL_ID(0x0) | SET_SCMI_DOMAIN_ID(0xA)),
  40. (SET_SCMI_CHANNEL_ID(0x0) | SET_SCMI_DOMAIN_ID(0xB)),
  41. (SET_SCMI_CHANNEL_ID(0x0) | SET_SCMI_DOMAIN_ID(0xC)),
  42. (SET_SCMI_CHANNEL_ID(0x0) | SET_SCMI_DOMAIN_ID(0xD)),
  43. #endif /* PLATFORM_CORE_COUNT == 14 */
  44. };
  45. /*******************************************************************************
  46. * This function returns the core count within the cluster corresponding to
  47. * `mpidr`.
  48. ******************************************************************************/
  49. unsigned int plat_arm_get_cluster_core_count(u_register_t mpidr)
  50. {
  51. return PLAT_MAX_CPUS_PER_CLUSTER;
  52. }
  53. #if ARM_PLAT_MT
  54. /******************************************************************************
  55. * Return the number of PE's supported by the CPU.
  56. *****************************************************************************/
  57. unsigned int plat_arm_get_cpu_pe_count(u_register_t mpidr)
  58. {
  59. return PLAT_MAX_PE_PER_CPU;
  60. }
  61. #endif
  62. /******************************************************************************
  63. * Return the cluster ID of current CPU
  64. *****************************************************************************/
  65. unsigned int plat_cluster_id_by_mpidr(u_register_t mpidr)
  66. {
  67. return MPIDR_AFFLVL2_VAL(mpidr);
  68. }