cortex_a9.S 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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 <assert_macros.S>
  9. #include <cortex_a9.h>
  10. #include <cpu_macros.S>
  11. .macro assert_cache_enabled
  12. #if ENABLE_ASSERTIONS
  13. ldcopr r0, SCTLR
  14. tst r0, #SCTLR_C_BIT
  15. ASM_ASSERT(eq)
  16. #endif
  17. .endm
  18. func cortex_a9_disable_smp
  19. ldcopr r0, ACTLR
  20. bic r0, #CORTEX_A9_ACTLR_SMP_BIT
  21. stcopr r0, ACTLR
  22. isb
  23. dsb sy
  24. bx lr
  25. endfunc cortex_a9_disable_smp
  26. func cortex_a9_enable_smp
  27. ldcopr r0, ACTLR
  28. orr r0, #CORTEX_A9_ACTLR_SMP_BIT
  29. stcopr r0, ACTLR
  30. isb
  31. bx lr
  32. endfunc cortex_a9_enable_smp
  33. func check_errata_794073
  34. #if ERRATA_A9_794073
  35. mov r0, #ERRATA_APPLIES
  36. #else
  37. mov r0, #ERRATA_MISSING
  38. #endif
  39. bx lr
  40. endfunc check_errata_794073
  41. add_erratum_entry cortex_a9, ERRATUM(794073), ERRATA_A9_794073
  42. func check_errata_cve_2017_5715
  43. #if WORKAROUND_CVE_2017_5715
  44. mov r0, #ERRATA_APPLIES
  45. #else
  46. mov r0, #ERRATA_MISSING
  47. #endif
  48. bx lr
  49. endfunc check_errata_cve_2017_5715
  50. add_erratum_entry cortex_a9, CVE(2017, 5715), WORKAROUND_CVE_2017_5715
  51. func cortex_a9_reset_func
  52. #if IMAGE_BL32 && WORKAROUND_CVE_2017_5715
  53. ldr r0, =wa_cve_2017_5715_bpiall_vbar
  54. stcopr r0, VBAR
  55. stcopr r0, MVBAR
  56. /* isb will be applied in the course of the reset func */
  57. #endif
  58. b cortex_a9_enable_smp
  59. endfunc cortex_a9_reset_func
  60. func cortex_a9_core_pwr_dwn
  61. push {r12, lr}
  62. assert_cache_enabled
  63. /* Flush L1 cache */
  64. mov r0, #DC_OP_CISW
  65. bl dcsw_op_level1
  66. /* Exit cluster coherency */
  67. pop {r12, lr}
  68. b cortex_a9_disable_smp
  69. endfunc cortex_a9_core_pwr_dwn
  70. func cortex_a9_cluster_pwr_dwn
  71. push {r12, lr}
  72. assert_cache_enabled
  73. /* Flush L1 caches */
  74. mov r0, #DC_OP_CISW
  75. bl dcsw_op_level1
  76. bl plat_disable_acp
  77. /* Exit cluster coherency */
  78. pop {r12, lr}
  79. b cortex_a9_disable_smp
  80. endfunc cortex_a9_cluster_pwr_dwn
  81. declare_cpu_ops cortex_a9, CORTEX_A9_MIDR, \
  82. cortex_a9_reset_func, \
  83. cortex_a9_core_pwr_dwn, \
  84. cortex_a9_cluster_pwr_dwn