css_topology.c 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #include <assert.h>
  7. #include <plat/arm/common/plat_arm.h>
  8. #include <plat/common/platform.h>
  9. #if ARM_PLAT_MT
  10. #pragma weak plat_arm_get_cpu_pe_count
  11. #endif
  12. /******************************************************************************
  13. * This function implements a part of the critical interface between the psci
  14. * generic layer and the platform that allows the former to query the platform
  15. * to convert an MPIDR to a unique linear index. An error code (-1) is
  16. * returned in case the MPIDR is invalid.
  17. *****************************************************************************/
  18. int plat_core_pos_by_mpidr(u_register_t mpidr)
  19. {
  20. if (arm_check_mpidr(mpidr) == 0) {
  21. #if ARM_PLAT_MT
  22. assert((read_mpidr_el1() & MPIDR_MT_MASK) != 0);
  23. /*
  24. * The DTB files don't provide the MT bit in the mpidr argument
  25. * so set it manually before calculating core position
  26. */
  27. mpidr |= MPIDR_MT_MASK;
  28. #endif
  29. return plat_arm_calc_core_pos(mpidr);
  30. }
  31. return -1;
  32. }
  33. #if ARM_PLAT_MT
  34. /******************************************************************************
  35. * This function returns the PE count within the physical cpu corresponding to
  36. * `mpidr`. Now one cpu only have one thread, so just return 1.
  37. *****************************************************************************/
  38. unsigned int plat_arm_get_cpu_pe_count(u_register_t mpidr)
  39. {
  40. return 1;
  41. }
  42. #endif /* ARM_PLAT_MT */