cortex_a73.S 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. /*
  2. * Copyright (c) 2016-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 <bl_common.h>
  9. #include <cortex_a73.h>
  10. #include <cpu_macros.S>
  11. #include <plat_macros.S>
  12. /* ---------------------------------------------
  13. * Disable L1 data cache
  14. * ---------------------------------------------
  15. */
  16. func cortex_a73_disable_dcache
  17. mrs x1, sctlr_el3
  18. bic x1, x1, #SCTLR_C_BIT
  19. msr sctlr_el3, x1
  20. isb
  21. ret
  22. endfunc cortex_a73_disable_dcache
  23. /* ---------------------------------------------
  24. * Disable intra-cluster coherency
  25. * ---------------------------------------------
  26. */
  27. func cortex_a73_disable_smp
  28. mrs x0, CORTEX_A73_CPUECTLR_EL1
  29. bic x0, x0, #CORTEX_A73_CPUECTLR_SMP_BIT
  30. msr CORTEX_A73_CPUECTLR_EL1, x0
  31. isb
  32. dsb sy
  33. ret
  34. endfunc cortex_a73_disable_smp
  35. func cortex_a73_reset_func
  36. #if IMAGE_BL31 && WORKAROUND_CVE_2017_5715
  37. cpu_check_csv2 x0, 1f
  38. adr x0, workaround_bpiall_vbar0_runtime_exceptions
  39. msr vbar_el3, x0
  40. 1:
  41. #endif
  42. /* ---------------------------------------------
  43. * Enable the SMP bit.
  44. * Clobbers : x0
  45. * ---------------------------------------------
  46. */
  47. mrs x0, CORTEX_A73_CPUECTLR_EL1
  48. orr x0, x0, #CORTEX_A73_CPUECTLR_SMP_BIT
  49. msr CORTEX_A73_CPUECTLR_EL1, x0
  50. isb
  51. ret
  52. endfunc cortex_a73_reset_func
  53. func cortex_a73_core_pwr_dwn
  54. mov x18, x30
  55. /* ---------------------------------------------
  56. * Turn off caches.
  57. * ---------------------------------------------
  58. */
  59. bl cortex_a73_disable_dcache
  60. /* ---------------------------------------------
  61. * Flush L1 caches.
  62. * ---------------------------------------------
  63. */
  64. mov x0, #DCCISW
  65. bl dcsw_op_level1
  66. /* ---------------------------------------------
  67. * Come out of intra cluster coherency
  68. * ---------------------------------------------
  69. */
  70. mov x30, x18
  71. b cortex_a73_disable_smp
  72. endfunc cortex_a73_core_pwr_dwn
  73. func cortex_a73_cluster_pwr_dwn
  74. mov x18, x30
  75. /* ---------------------------------------------
  76. * Turn off caches.
  77. * ---------------------------------------------
  78. */
  79. bl cortex_a73_disable_dcache
  80. /* ---------------------------------------------
  81. * Flush L1 caches.
  82. * ---------------------------------------------
  83. */
  84. mov x0, #DCCISW
  85. bl dcsw_op_level1
  86. /* ---------------------------------------------
  87. * Disable the optional ACP.
  88. * ---------------------------------------------
  89. */
  90. bl plat_disable_acp
  91. /* ---------------------------------------------
  92. * Flush L2 caches.
  93. * ---------------------------------------------
  94. */
  95. mov x0, #DCCISW
  96. bl dcsw_op_level2
  97. /* ---------------------------------------------
  98. * Come out of intra cluster coherency
  99. * ---------------------------------------------
  100. */
  101. mov x30, x18
  102. b cortex_a73_disable_smp
  103. endfunc cortex_a73_cluster_pwr_dwn
  104. func check_errata_cve_2017_5715
  105. cpu_check_csv2 x0, 1f
  106. #if WORKAROUND_CVE_2017_5715
  107. mov x0, #ERRATA_APPLIES
  108. #else
  109. mov x0, #ERRATA_MISSING
  110. #endif
  111. ret
  112. 1:
  113. mov x0, #ERRATA_NOT_APPLIES
  114. ret
  115. endfunc check_errata_cve_2017_5715
  116. #if REPORT_ERRATA
  117. /*
  118. * Errata printing function for Cortex A75. Must follow AAPCS.
  119. */
  120. func cortex_a73_errata_report
  121. stp x8, x30, [sp, #-16]!
  122. bl cpu_get_rev_var
  123. mov x8, x0
  124. /*
  125. * Report all errata. The revision-variant information is passed to
  126. * checking functions of each errata.
  127. */
  128. report_errata WORKAROUND_CVE_2017_5715, cortex_a73, cve_2017_5715
  129. ldp x8, x30, [sp], #16
  130. ret
  131. endfunc cortex_a73_errata_report
  132. #endif
  133. /* ---------------------------------------------
  134. * This function provides cortex_a73 specific
  135. * register information for crash reporting.
  136. * It needs to return with x6 pointing to
  137. * a list of register names in ascii and
  138. * x8 - x15 having values of registers to be
  139. * reported.
  140. * ---------------------------------------------
  141. */
  142. .section .rodata.cortex_a73_regs, "aS"
  143. cortex_a73_regs: /* The ascii list of register names to be reported */
  144. .asciz "cpuectlr_el1", "l2merrsr_el1", ""
  145. func cortex_a73_cpu_reg_dump
  146. adr x6, cortex_a73_regs
  147. mrs x8, CORTEX_A73_CPUECTLR_EL1
  148. mrs x9, CORTEX_A73_L2MERRSR_EL1
  149. ret
  150. endfunc cortex_a73_cpu_reg_dump
  151. declare_cpu_ops_workaround_cve_2017_5715 cortex_a73, CORTEX_A73_MIDR, \
  152. cortex_a73_reset_func, \
  153. check_errata_cve_2017_5715, \
  154. cortex_a73_core_pwr_dwn, \
  155. cortex_a73_cluster_pwr_dwn