aml_helpers.S 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /*
  2. * Copyright (c) 2018-2020, 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 <assert_macros.S>
  9. #include <platform_def.h>
  10. .globl plat_crash_console_flush
  11. .globl plat_crash_console_init
  12. .globl plat_crash_console_putc
  13. .globl platform_mem_init
  14. .globl plat_is_my_cpu_primary
  15. .globl plat_my_core_pos
  16. .globl plat_reset_handler
  17. .globl plat_calc_core_pos
  18. /* -----------------------------------------------------
  19. * unsigned int plat_my_core_pos(void);
  20. * -----------------------------------------------------
  21. */
  22. func plat_my_core_pos
  23. mrs x0, mpidr_el1
  24. b plat_calc_core_pos
  25. endfunc plat_my_core_pos
  26. /* -----------------------------------------------------
  27. * unsigned int plat_calc_core_pos(u_register_t mpidr);
  28. * -----------------------------------------------------
  29. */
  30. func plat_calc_core_pos
  31. and x0, x0, #MPIDR_CPU_MASK
  32. ret
  33. endfunc plat_calc_core_pos
  34. /* -----------------------------------------------------
  35. * unsigned int plat_is_my_cpu_primary(void);
  36. * -----------------------------------------------------
  37. */
  38. func plat_is_my_cpu_primary
  39. mrs x0, mpidr_el1
  40. and x0, x0, #(MPIDR_CLUSTER_MASK | MPIDR_CPU_MASK)
  41. cmp x0, #AML_PRIMARY_CPU
  42. cset w0, eq
  43. ret
  44. endfunc plat_is_my_cpu_primary
  45. /* ---------------------------------------------
  46. * void platform_mem_init(void);
  47. * ---------------------------------------------
  48. */
  49. func platform_mem_init
  50. ret
  51. endfunc platform_mem_init
  52. /* ---------------------------------------------
  53. * int plat_crash_console_init(void)
  54. * ---------------------------------------------
  55. */
  56. func plat_crash_console_init
  57. mov_imm x0, AML_UART0_AO_BASE
  58. mov_imm x1, AML_UART0_AO_CLK_IN_HZ
  59. mov_imm x2, AML_UART_BAUDRATE
  60. b console_meson_init
  61. endfunc plat_crash_console_init
  62. /* ---------------------------------------------
  63. * int plat_crash_console_putc(int c)
  64. * Clobber list : x1, x2
  65. * ---------------------------------------------
  66. */
  67. func plat_crash_console_putc
  68. mov_imm x1, AML_UART0_AO_BASE
  69. b console_meson_core_putc
  70. endfunc plat_crash_console_putc
  71. /* ---------------------------------------------
  72. * void plat_crash_console_flush()
  73. * Out : void.
  74. * Clobber list : x0, x1
  75. * ---------------------------------------------
  76. */
  77. func plat_crash_console_flush
  78. mov_imm x0, AML_UART0_AO_BASE
  79. b console_meson_core_flush
  80. endfunc plat_crash_console_flush
  81. /* ---------------------------------------------
  82. * void plat_reset_handler(void);
  83. * ---------------------------------------------
  84. */
  85. func plat_reset_handler
  86. ret
  87. endfunc plat_reset_handler