cortex_a55.S 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. /*
  2. * Copyright (c) 2017-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_a55.h>
  10. #include <cpu_macros.S>
  11. #include <plat_macros.S>
  12. /* Hardware handled coherency */
  13. #if HW_ASSISTED_COHERENCY == 0
  14. #error "Cortex-A55 must be compiled with HW_ASSISTED_COHERENCY enabled"
  15. #endif
  16. .globl cortex_a55_reset_func
  17. .globl cortex_a55_core_pwr_dwn
  18. /* ERRATA_DSU_798953:
  19. * The errata is defined in dsu_helpers.S but applies to cortex_a55
  20. * as well. Henceforth creating symbolic names to the already existing errata
  21. * workaround functions to get them registered under the Errata Framework.
  22. */
  23. .equ check_erratum_cortex_a55_798953, check_errata_dsu_798953
  24. .equ erratum_cortex_a55_798953_wa, errata_dsu_798953_wa
  25. add_erratum_entry cortex_a55, ERRATUM(798953), ERRATA_DSU_798953, APPLY_AT_RESET
  26. /* ERRATA_DSU_936184:
  27. * The errata is defined in dsu_helpers.S but applies to cortex_a55
  28. * as well. Henceforth creating symbolic names to the already existing errata
  29. * workaround functions to get them registered under the Errata Framework.
  30. */
  31. .equ check_erratum_cortex_a55_936184, check_errata_dsu_936184
  32. .equ erratum_cortex_a55_936184_wa, errata_dsu_936184_wa
  33. add_erratum_entry cortex_a55, ERRATUM(936184), ERRATA_DSU_936184, APPLY_AT_RESET
  34. workaround_reset_start cortex_a55, ERRATUM(768277), ERRATA_A55_768277
  35. sysreg_bit_set CORTEX_A55_CPUACTLR_EL1, CORTEX_A55_CPUACTLR_EL1_DISABLE_DUAL_ISSUE
  36. workaround_reset_end cortex_a55, ERRATUM(768277)
  37. check_erratum_ls cortex_a55, ERRATUM(768277), CPU_REV(0, 0)
  38. workaround_reset_start cortex_a55, ERRATUM(778703), ERRATA_A55_778703
  39. sysreg_bit_set CORTEX_A55_CPUECTLR_EL1, CORTEX_A55_CPUECTLR_EL1_L1WSCTL
  40. sysreg_bit_set CORTEX_A55_CPUACTLR_EL1, CORTEX_A55_CPUACTLR_EL1_DISABLE_WRITE_STREAMING
  41. workaround_reset_end cortex_a55, ERRATUM(778703)
  42. check_erratum_custom_start cortex_a55, ERRATUM(778703)
  43. mov x16, x30
  44. mov x1, #0x00
  45. bl cpu_rev_var_ls
  46. /*
  47. * Check that no private L2 cache is configured
  48. */
  49. mrs x1, CORTEX_A55_CLIDR_EL1
  50. and x1, x1, CORTEX_A55_CLIDR_EL1_CTYPE3
  51. cmp x1, #0
  52. mov x2, #ERRATA_NOT_APPLIES
  53. csel x0, x0, x2, eq
  54. ret x16
  55. check_erratum_custom_end cortex_a55, ERRATUM(778703)
  56. workaround_reset_start cortex_a55, ERRATUM(798797), ERRATA_A55_798797
  57. sysreg_bit_set CORTEX_A55_CPUACTLR_EL1, CORTEX_A55_CPUACTLR_EL1_DISABLE_L1_PAGEWALKS
  58. workaround_reset_end cortex_a55, ERRATUM(798797)
  59. check_erratum_ls cortex_a55, ERRATUM(798797), CPU_REV(0, 0)
  60. workaround_reset_start cortex_a55, ERRATUM(846532), ERRATA_A55_846532
  61. sysreg_bit_set CORTEX_A55_CPUACTLR_EL1, CORTEX_A55_CPUACTLR_EL1_DISABLE_DUAL_ISSUE
  62. workaround_reset_end cortex_a55, ERRATUM(846532)
  63. check_erratum_ls cortex_a55, ERRATUM(846532), CPU_REV(0, 1)
  64. workaround_reset_start cortex_a55, ERRATUM(903758), ERRATA_A55_903758
  65. sysreg_bit_set CORTEX_A55_CPUACTLR_EL1, CORTEX_A55_CPUACTLR_EL1_DISABLE_L1_PAGEWALKS
  66. workaround_reset_end cortex_a55, ERRATUM(903758)
  67. check_erratum_ls cortex_a55, ERRATUM(903758), CPU_REV(0, 1)
  68. workaround_reset_start cortex_a55, ERRATUM(1221012), ERRATA_A55_1221012
  69. mov x0, #0x0020
  70. movk x0, #0x0850, lsl #16
  71. msr CPUPOR_EL3, x0
  72. mov x0, #0x0000
  73. movk x0, #0x1FF0, lsl #16
  74. movk x0, #0x2, lsl #32
  75. msr CPUPMR_EL3, x0
  76. mov x0, #0x03fd
  77. movk x0, #0x0110, lsl #16
  78. msr CPUPCR_EL3, x0
  79. mov x0, #0x1
  80. msr CPUPSELR_EL3, x0
  81. mov x0, #0x0040
  82. movk x0, #0x08D0, lsl #16
  83. msr CPUPOR_EL3, x0
  84. mov x0, #0x0040
  85. movk x0, #0x1FF0, lsl #16
  86. movk x0, #0x2, lsl #32
  87. msr CPUPMR_EL3, x0
  88. mov x0, #0x03fd
  89. movk x0, #0x0110, lsl #16
  90. msr CPUPCR_EL3, x0
  91. workaround_reset_end cortex_a55, ERRATUM(1221012)
  92. check_erratum_ls cortex_a55, ERRATUM(1221012), CPU_REV(1, 0)
  93. check_erratum_chosen cortex_a55, ERRATUM(1530923), ERRATA_A55_1530923
  94. /* erratum has no workaround in the cpu. Generic code must take care */
  95. add_erratum_entry cortex_a55, ERRATUM(1530923), ERRATA_A55_1530923, NO_APPLY_AT_RESET
  96. cpu_reset_func_start cortex_a55
  97. cpu_reset_func_end cortex_a55
  98. /* ---------------------------------------------
  99. * HW will do the cache maintenance while powering down
  100. * ---------------------------------------------
  101. */
  102. func cortex_a55_core_pwr_dwn
  103. sysreg_bit_set CORTEX_A55_CPUPWRCTLR_EL1, CORTEX_A55_CORE_PWRDN_EN_MASK
  104. isb
  105. ret
  106. endfunc cortex_a55_core_pwr_dwn
  107. /* ---------------------------------------------
  108. * This function provides cortex_a55 specific
  109. * register information for crash reporting.
  110. * It needs to return with x6 pointing to
  111. * a list of register names in ascii and
  112. * x8 - x15 having values of registers to be
  113. * reported.
  114. * ---------------------------------------------
  115. */
  116. .section .rodata.cortex_a55_regs, "aS"
  117. cortex_a55_regs: /* The ascii list of register names to be reported */
  118. .asciz "cpuectlr_el1", ""
  119. func cortex_a55_cpu_reg_dump
  120. adr x6, cortex_a55_regs
  121. mrs x8, CORTEX_A55_CPUECTLR_EL1
  122. ret
  123. endfunc cortex_a55_cpu_reg_dump
  124. declare_cpu_ops cortex_a55, CORTEX_A55_MIDR, \
  125. cortex_a55_reset_func, \
  126. cortex_a55_core_pwr_dwn