cortex_a78c.S 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. /*
  2. * Copyright (c) 2021-2024, Arm Limited. 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_a78c.h>
  10. #include <cpu_macros.S>
  11. #include <plat_macros.S>
  12. #include "wa_cve_2022_23960_bhb_vector.S"
  13. /* Hardware handled coherency */
  14. #if HW_ASSISTED_COHERENCY == 0
  15. #error "cortex_a78c must be compiled with HW_ASSISTED_COHERENCY enabled"
  16. #endif
  17. #if WORKAROUND_CVE_2022_23960
  18. wa_cve_2022_23960_bhb_vector_table CORTEX_A78C_BHB_LOOP_COUNT, cortex_a78c
  19. #endif /* WORKAROUND_CVE_2022_23960 */
  20. workaround_reset_start cortex_a78c, ERRATUM(1827430), ERRATA_A78C_1827430
  21. /* Disable allocation of splintered pages in the L2 TLB */
  22. sysreg_bit_set CORTEX_A78C_CPUECTLR_EL1, CORTEX_A78C_CPUECTLR_EL1_MM_ASP_EN
  23. workaround_reset_end cortex_a78c, ERRATUM(1827430)
  24. check_erratum_ls cortex_a78c, ERRATUM(1827430), CPU_REV(0, 0)
  25. workaround_reset_start cortex_a78c, ERRATUM(1827440), ERRATA_A78C_1827440
  26. /* Force Atomic Store to WB memory be done in L1 data cache */
  27. sysreg_bit_set CORTEX_A78C_CPUACTLR2_EL1, BIT(2)
  28. workaround_reset_end cortex_a78c, ERRATUM(1827440)
  29. check_erratum_ls cortex_a78c, ERRATUM(1827440), CPU_REV(0, 0)
  30. workaround_reset_start cortex_a78c, ERRATUM(2132064), ERRATA_A78C_2132064
  31. /* --------------------------------------------------------
  32. * Place the data prefetcher in the most conservative mode
  33. * to reduce prefetches by writing the following bits to
  34. * the value indicated: ecltr[7:6], PF_MODE = 2'b11
  35. * --------------------------------------------------------
  36. */
  37. sysreg_bit_set CORTEX_A78C_CPUECTLR_EL1, (CORTEX_A78C_CPUECTLR_EL1_BIT_6 | CORTEX_A78C_CPUECTLR_EL1_BIT_7)
  38. workaround_reset_end cortex_a78c, ERRATUM(2132064)
  39. check_erratum_range cortex_a78c, ERRATUM(2132064), CPU_REV(0, 1), CPU_REV(0, 2)
  40. workaround_reset_start cortex_a78c, ERRATUM(2242638), ERRATA_A78C_2242638
  41. ldr x0, =0x5
  42. msr CORTEX_A78C_IMP_CPUPSELR_EL3, x0
  43. ldr x0, =0x10F600E000
  44. msr CORTEX_A78C_IMP_CPUPOR_EL3, x0
  45. ldr x0, =0x10FF80E000
  46. msr CORTEX_A78C_IMP_CPUPMR_EL3, x0
  47. ldr x0, =0x80000000003FF
  48. msr CORTEX_A78C_IMP_CPUPCR_EL3, x0
  49. workaround_reset_end cortex_a78c, ERRATUM(2242638)
  50. check_erratum_range cortex_a78c, ERRATUM(2242638), CPU_REV(0, 1), CPU_REV(0, 2)
  51. workaround_reset_start cortex_a78c, ERRATUM(2376749), ERRATA_A78C_2376749
  52. sysreg_bit_set CORTEX_A78C_CPUACTLR2_EL1, CORTEX_A78C_CPUACTLR2_EL1_BIT_0
  53. workaround_reset_end cortex_a78c, ERRATUM(2376749)
  54. check_erratum_range cortex_a78c, ERRATUM(2376749), CPU_REV(0, 1), CPU_REV(0, 2)
  55. workaround_reset_start cortex_a78c, ERRATUM(2395411), ERRATA_A78C_2395411
  56. sysreg_bit_set CORTEX_A78C_CPUACTLR2_EL1, CORTEX_A78C_CPUACTLR2_EL1_BIT_40
  57. workaround_reset_end cortex_a78c, ERRATUM(2395411)
  58. check_erratum_range cortex_a78c, ERRATUM(2395411), CPU_REV(0, 1), CPU_REV(0, 2)
  59. workaround_reset_start cortex_a78c, ERRATUM(2683027), ERRATA_A78C_2683027
  60. ldr x0, =0x3
  61. msr CORTEX_A78C_IMP_CPUPSELR_EL3, x0
  62. ldr x0, =0xEE010F10
  63. msr CORTEX_A78C_IMP_CPUPOR_EL3, x0
  64. ldr x0, =0xFF1F0FFE
  65. msr CORTEX_A78C_IMP_CPUPMR_EL3, x0
  66. ldr x0, =0x100000004003FF
  67. msr CORTEX_A78C_IMP_CPUPCR_EL3, x0
  68. workaround_reset_end cortex_a78c, ERRATUM(2683027)
  69. check_erratum_range cortex_a78c, ERRATUM(2683027), CPU_REV(0, 1), CPU_REV(0, 2)
  70. workaround_reset_start cortex_a78c, ERRATUM(2743232), ERRATA_A78C_2743232
  71. /* Set CPUACTLR5_EL1[56:55] to 2'b01 */
  72. sysreg_bit_set CORTEX_A78C_ACTLR5_EL1, BIT(55)
  73. sysreg_bit_clear CORTEX_A78C_ACTLR5_EL1, BIT(56)
  74. workaround_reset_end cortex_a78c, ERRATUM(2743232)
  75. check_erratum_range cortex_a78c, ERRATUM(2743232), CPU_REV(0, 1), CPU_REV(0, 2)
  76. workaround_runtime_start cortex_a78c, ERRATUM(2772121), ERRATA_A78C_2772121
  77. /* dsb before isb of power down sequence */
  78. dsb sy
  79. workaround_runtime_end cortex_a78c, ERRATUM(2772121)
  80. check_erratum_ls cortex_a78c, ERRATUM(2772121), CPU_REV(0, 2)
  81. workaround_reset_start cortex_a78c, ERRATUM(2779484), ERRATA_A78C_2779484
  82. sysreg_bit_set CORTEX_A78C_ACTLR3_EL1, BIT(47)
  83. workaround_reset_end cortex_a78c, ERRATUM(2779484)
  84. check_erratum_range cortex_a78c, ERRATUM(2779484), CPU_REV(0, 1), CPU_REV(0, 2)
  85. check_erratum_chosen cortex_a78c, CVE(2022, 23960), WORKAROUND_CVE_2022_23960
  86. workaround_reset_start cortex_a78c, CVE(2022, 23960), WORKAROUND_CVE_2022_23960
  87. #if IMAGE_BL31
  88. /*
  89. * The Cortex-A78c generic vectors are overridden to apply errata
  90. * mitigation on exception entry from lower ELs.
  91. */
  92. override_vector_table wa_cve_vbar_cortex_a78c
  93. #endif /* IMAGE_BL31 */
  94. workaround_reset_end cortex_a78c, CVE(2022, 23960)
  95. cpu_reset_func_start cortex_a78c
  96. cpu_reset_func_end cortex_a78c
  97. /* ----------------------------------------------------
  98. * HW will do the cache maintenance while powering down
  99. * ----------------------------------------------------
  100. */
  101. func cortex_a78c_core_pwr_dwn
  102. /* ---------------------------------------------------
  103. * Enable CPU power down bit in power control register
  104. * ---------------------------------------------------
  105. */
  106. sysreg_bit_set CORTEX_A78C_CPUPWRCTLR_EL1, CORTEX_A78C_CPUPWRCTLR_EL1_CORE_PWRDN_EN_BIT
  107. apply_erratum cortex_a78c, ERRATUM(2772121), ERRATA_A78C_2772121
  108. isb
  109. ret
  110. endfunc cortex_a78c_core_pwr_dwn
  111. /* ---------------------------------------------
  112. * This function provides cortex_a78c specific
  113. * register information for crash reporting.
  114. * It needs to return with x6 pointing to
  115. * a list of register names in ascii and
  116. * x8 - x15 having values of registers to be
  117. * reported.
  118. * ---------------------------------------------
  119. */
  120. .section .rodata.cortex_a78c_regs, "aS"
  121. cortex_a78c_regs: /* The ascii list of register names to be reported */
  122. .asciz "cpuectlr_el1", ""
  123. func cortex_a78c_cpu_reg_dump
  124. adr x6, cortex_a78c_regs
  125. mrs x8, CORTEX_A78C_CPUECTLR_EL1
  126. ret
  127. endfunc cortex_a78c_cpu_reg_dump
  128. declare_cpu_ops cortex_a78c, CORTEX_A78C_MIDR, \
  129. cortex_a78c_reset_func, \
  130. cortex_a78c_core_pwr_dwn