cortex_a73.S 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. /*
  2. * Copyright (c) 2016-2024, 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 <common/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. sysreg_bit_clear sctlr_el3, SCTLR_C_BIT
  18. isb
  19. ret
  20. endfunc cortex_a73_disable_dcache
  21. /* ---------------------------------------------
  22. * Disable intra-cluster coherency
  23. * ---------------------------------------------
  24. */
  25. func cortex_a73_disable_smp
  26. sysreg_bit_clear CORTEX_A73_CPUECTLR_EL1, CORTEX_A73_CPUECTLR_SMP_BIT
  27. isb
  28. dsb sy
  29. ret
  30. endfunc cortex_a73_disable_smp
  31. func check_smccc_arch_workaround_3
  32. mov x0, #ERRATA_APPLIES
  33. ret
  34. endfunc check_smccc_arch_workaround_3
  35. workaround_reset_start cortex_a73, ERRATUM(852427), ERRATA_A73_852427
  36. sysreg_bit_set CORTEX_A73_DIAGNOSTIC_REGISTER, BIT(12)
  37. workaround_reset_end cortex_a73, ERRATUM(852427)
  38. check_erratum_ls cortex_a73, ERRATUM(852427), CPU_REV(0, 0)
  39. workaround_reset_start cortex_a73, ERRATUM(855423), ERRATA_A73_855423
  40. sysreg_bit_set CORTEX_A73_IMP_DEF_REG2, BIT(7)
  41. workaround_reset_end cortex_a73, ERRATUM(855423)
  42. check_erratum_ls cortex_a73, ERRATUM(855423), CPU_REV(0, 1)
  43. workaround_reset_start cortex_a73, CVE(2017, 5715), WORKAROUND_CVE_2017_5715
  44. #if IMAGE_BL31
  45. override_vector_table wa_cve_2017_5715_bpiall_vbar
  46. #endif /* IMAGE_BL31 */
  47. workaround_reset_end cortex_a73, CVE(2017, 5715)
  48. check_erratum_custom_start cortex_a73, CVE(2017, 5715)
  49. cpu_check_csv2 x0, 1f
  50. #if WORKAROUND_CVE_2017_5715
  51. mov x0, #ERRATA_APPLIES
  52. #else
  53. mov x0, #ERRATA_MISSING
  54. #endif
  55. ret
  56. 1:
  57. mov x0, #ERRATA_NOT_APPLIES
  58. ret
  59. check_erratum_custom_end cortex_a73, CVE(2017, 5715)
  60. workaround_reset_start cortex_a73, CVE(2018, 3639), WORKAROUND_CVE_2018_3639
  61. sysreg_bit_set CORTEX_A73_IMP_DEF_REG1, CORTEX_A73_IMP_DEF_REG1_DISABLE_LOAD_PASS_STORE
  62. workaround_reset_end cortex_a73, CVE(2018, 3639)
  63. check_erratum_chosen cortex_a73, CVE(2018, 3639), WORKAROUND_CVE_2018_3639
  64. workaround_reset_start cortex_a73, CVE(2022, 23960), WORKAROUND_CVE_2022_23960
  65. #if IMAGE_BL31
  66. /* Skip installing vector table again for CVE_2022_23960 */
  67. adr x0, wa_cve_2017_5715_bpiall_vbar
  68. mrs x1, vbar_el3
  69. cmp x0, x1
  70. b.eq 1f
  71. msr vbar_el3, x0
  72. 1:
  73. #endif /* IMAGE_BL31 */
  74. workaround_reset_end cortex_a73, CVE(2022, 23960)
  75. check_erratum_custom_start cortex_a73, CVE(2022, 23960)
  76. #if WORKAROUND_CVE_2017_5715 || WORKAROUND_CVE_2022_23960
  77. cpu_check_csv2 x0, 1f
  78. mov x0, #ERRATA_APPLIES
  79. ret
  80. 1:
  81. #if WORKAROUND_CVE_2022_23960
  82. mov x0, #ERRATA_APPLIES
  83. #else
  84. mov x0, #ERRATA_MISSING
  85. #endif /* WORKAROUND_CVE_2022_23960 */
  86. ret
  87. #endif /* WORKAROUND_CVE_2017_5715 || WORKAROUND_CVE_2022_23960 */
  88. mov x0, #ERRATA_MISSING
  89. ret
  90. check_erratum_custom_end cortex_a73, CVE(2022, 23960)
  91. /* -------------------------------------------------
  92. * The CPU Ops reset function for Cortex-A73.
  93. * -------------------------------------------------
  94. */
  95. cpu_reset_func_start cortex_a73
  96. /* ---------------------------------------------
  97. * Enable the SMP bit.
  98. * Clobbers : x0
  99. * ---------------------------------------------
  100. */
  101. sysreg_bit_set CORTEX_A73_CPUECTLR_EL1, CORTEX_A73_CPUECTLR_SMP_BIT
  102. cpu_reset_func_end cortex_a73
  103. func cortex_a73_core_pwr_dwn
  104. mov x18, x30
  105. /* ---------------------------------------------
  106. * Turn off caches.
  107. * ---------------------------------------------
  108. */
  109. bl cortex_a73_disable_dcache
  110. /* ---------------------------------------------
  111. * Flush L1 caches.
  112. * ---------------------------------------------
  113. */
  114. mov x0, #DCCISW
  115. bl dcsw_op_level1
  116. /* ---------------------------------------------
  117. * Come out of intra cluster coherency
  118. * ---------------------------------------------
  119. */
  120. mov x30, x18
  121. b cortex_a73_disable_smp
  122. endfunc cortex_a73_core_pwr_dwn
  123. func cortex_a73_cluster_pwr_dwn
  124. mov x18, x30
  125. /* ---------------------------------------------
  126. * Turn off caches.
  127. * ---------------------------------------------
  128. */
  129. bl cortex_a73_disable_dcache
  130. /* ---------------------------------------------
  131. * Flush L1 caches.
  132. * ---------------------------------------------
  133. */
  134. mov x0, #DCCISW
  135. bl dcsw_op_level1
  136. /* ---------------------------------------------
  137. * Disable the optional ACP.
  138. * ---------------------------------------------
  139. */
  140. bl plat_disable_acp
  141. /* ---------------------------------------------
  142. * Flush L2 caches.
  143. * ---------------------------------------------
  144. */
  145. mov x0, #DCCISW
  146. bl dcsw_op_level2
  147. /* ---------------------------------------------
  148. * Come out of intra cluster coherency
  149. * ---------------------------------------------
  150. */
  151. mov x30, x18
  152. b cortex_a73_disable_smp
  153. endfunc cortex_a73_cluster_pwr_dwn
  154. /* ---------------------------------------------
  155. * This function provides cortex_a73 specific
  156. * register information for crash reporting.
  157. * It needs to return with x6 pointing to
  158. * a list of register names in ascii and
  159. * x8 - x15 having values of registers to be
  160. * reported.
  161. * ---------------------------------------------
  162. */
  163. .section .rodata.cortex_a73_regs, "aS"
  164. cortex_a73_regs: /* The ascii list of register names to be reported */
  165. .asciz "cpuectlr_el1", "l2merrsr_el1", ""
  166. func cortex_a73_cpu_reg_dump
  167. adr x6, cortex_a73_regs
  168. mrs x8, CORTEX_A73_CPUECTLR_EL1
  169. mrs x9, CORTEX_A73_L2MERRSR_EL1
  170. ret
  171. endfunc cortex_a73_cpu_reg_dump
  172. declare_cpu_ops_wa cortex_a73, CORTEX_A73_MIDR, \
  173. cortex_a73_reset_func, \
  174. check_erratum_cortex_a73_5715, \
  175. CPU_NO_EXTRA2_FUNC, \
  176. check_smccc_arch_workaround_3, \
  177. cortex_a73_core_pwr_dwn, \
  178. cortex_a73_cluster_pwr_dwn