versal_helpers.S 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  2. * Copyright (c) 2018, Arm Limited and Contributors. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #include <arch.h>
  7. #include <asm_macros.S>
  8. #include <drivers/arm/gicv3.h>
  9. #include <platform_def.h>
  10. .globl plat_secondary_cold_boot_setup
  11. .globl plat_is_my_cpu_primary
  12. .globl versal_calc_core_pos
  13. .globl platform_mem_init
  14. .globl plat_my_core_pos
  15. /* -----------------------------------------------------
  16. * void plat_secondary_cold_boot_setup (void);
  17. *
  18. * This function performs any platform specific actions
  19. * needed for a secondary cpu after a cold reset e.g
  20. * mark the cpu's presence, mechanism to place it in a
  21. * holding pen etc.
  22. * TODO: Should we read the PSYS register to make sure
  23. * that the request has gone through.
  24. * -----------------------------------------------------
  25. */
  26. func plat_secondary_cold_boot_setup
  27. mrs x0, mpidr_el1
  28. /*
  29. * There is no sane reason to come out of this wfi. This
  30. * cpu will be powered on and reset by the cpu_on pm api
  31. */
  32. dsb sy
  33. bl plat_panic_handler
  34. endfunc plat_secondary_cold_boot_setup
  35. func plat_is_my_cpu_primary
  36. mov x9, x30
  37. bl plat_my_core_pos
  38. cmp x0, #VERSAL_PRIMARY_CPU
  39. cset x0, eq
  40. ret x9
  41. endfunc plat_is_my_cpu_primary
  42. /* -----------------------------------------------------
  43. * unsigned int plat_my_core_pos(void)
  44. * This function uses the versal_calc_core_pos()
  45. * definition to get the index of the calling CPU.
  46. * -----------------------------------------------------
  47. */
  48. func plat_my_core_pos
  49. mrs x0, mpidr_el1
  50. b versal_calc_core_pos
  51. endfunc plat_my_core_pos
  52. func versal_calc_core_pos
  53. and x1, x0, #MPIDR_CPU_MASK
  54. and x0, x0, #MPIDR_CLUSTER_MASK
  55. add x0, x1, x0, LSR #6
  56. ret
  57. endfunc versal_calc_core_pos
  58. /* ---------------------------------------------------------------------
  59. * We don't need to carry out any memory initialization on VERSAL
  60. * platform. The Secure RAM is accessible straight away.
  61. * ---------------------------------------------------------------------
  62. */
  63. func platform_mem_init
  64. ret
  65. endfunc platform_mem_init