cache-v4.S 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * linux/arch/arm/mm/cache-v4.S
  4. *
  5. * Copyright (C) 1997-2002 Russell king
  6. */
  7. #include <linux/linkage.h>
  8. #include <linux/init.h>
  9. #include <linux/cfi_types.h>
  10. #include <asm/assembler.h>
  11. #include <asm/page.h>
  12. #include "proc-macros.S"
  13. /*
  14. * flush_icache_all()
  15. *
  16. * Unconditionally clean and invalidate the entire icache.
  17. */
  18. SYM_TYPED_FUNC_START(v4_flush_icache_all)
  19. ret lr
  20. SYM_FUNC_END(v4_flush_icache_all)
  21. /*
  22. * flush_user_cache_all()
  23. *
  24. * Invalidate all cache entries in a particular address
  25. * space.
  26. *
  27. * - mm - mm_struct describing address space
  28. */
  29. SYM_FUNC_ALIAS(v4_flush_user_cache_all, v4_flush_kern_cache_all)
  30. /*
  31. * flush_kern_cache_all()
  32. *
  33. * Clean and invalidate the entire cache.
  34. */
  35. SYM_TYPED_FUNC_START(v4_flush_kern_cache_all)
  36. #ifdef CONFIG_CPU_CP15
  37. mov r0, #0
  38. mcr p15, 0, r0, c7, c7, 0 @ flush ID cache
  39. ret lr
  40. #else
  41. ret lr
  42. #endif
  43. SYM_FUNC_END(v4_flush_kern_cache_all)
  44. /*
  45. * flush_user_cache_range(start, end, flags)
  46. *
  47. * Invalidate a range of cache entries in the specified
  48. * address space.
  49. *
  50. * - start - start address (may not be aligned)
  51. * - end - end address (exclusive, may not be aligned)
  52. * - flags - vma_area_struct flags describing address space
  53. */
  54. SYM_TYPED_FUNC_START(v4_flush_user_cache_range)
  55. #ifdef CONFIG_CPU_CP15
  56. mov ip, #0
  57. mcr p15, 0, ip, c7, c7, 0 @ flush ID cache
  58. ret lr
  59. #else
  60. ret lr
  61. #endif
  62. SYM_FUNC_END(v4_flush_user_cache_range)
  63. /*
  64. * coherent_kern_range(start, end)
  65. *
  66. * Ensure coherency between the Icache and the Dcache in the
  67. * region described by start. If you have non-snooping
  68. * Harvard caches, you need to implement this function.
  69. *
  70. * - start - virtual start address
  71. * - end - virtual end address
  72. */
  73. SYM_TYPED_FUNC_START(v4_coherent_kern_range)
  74. ret lr
  75. SYM_FUNC_END(v4_coherent_kern_range)
  76. /*
  77. * coherent_user_range(start, end)
  78. *
  79. * Ensure coherency between the Icache and the Dcache in the
  80. * region described by start. If you have non-snooping
  81. * Harvard caches, you need to implement this function.
  82. *
  83. * - start - virtual start address
  84. * - end - virtual end address
  85. */
  86. SYM_TYPED_FUNC_START(v4_coherent_user_range)
  87. mov r0, #0
  88. ret lr
  89. SYM_FUNC_END(v4_coherent_user_range)
  90. /*
  91. * flush_kern_dcache_area(void *addr, size_t size)
  92. *
  93. * Ensure no D cache aliasing occurs, either with itself or
  94. * the I cache
  95. *
  96. * - addr - kernel address
  97. * - size - region size
  98. */
  99. SYM_TYPED_FUNC_START(v4_flush_kern_dcache_area)
  100. #ifdef CONFIG_CFI /* Fallthrough if !CFI */
  101. b v4_dma_flush_range
  102. #endif
  103. SYM_FUNC_END(v4_flush_kern_dcache_area)
  104. /*
  105. * dma_flush_range(start, end)
  106. *
  107. * Clean and invalidate the specified virtual address range.
  108. *
  109. * - start - virtual start address
  110. * - end - virtual end address
  111. */
  112. SYM_TYPED_FUNC_START(v4_dma_flush_range)
  113. #ifdef CONFIG_CPU_CP15
  114. mov r0, #0
  115. mcr p15, 0, r0, c7, c7, 0 @ flush ID cache
  116. #endif
  117. ret lr
  118. SYM_FUNC_END(v4_dma_flush_range)
  119. /*
  120. * dma_unmap_area(start, size, dir)
  121. * - start - kernel virtual start address
  122. * - size - size of region
  123. * - dir - DMA direction
  124. */
  125. SYM_TYPED_FUNC_START(v4_dma_unmap_area)
  126. teq r2, #DMA_TO_DEVICE
  127. bne v4_dma_flush_range
  128. ret lr
  129. SYM_FUNC_END(v4_dma_unmap_area)
  130. /*
  131. * dma_map_area(start, size, dir)
  132. * - start - kernel virtual start address
  133. * - size - size of region
  134. * - dir - DMA direction
  135. */
  136. SYM_TYPED_FUNC_START(v4_dma_map_area)
  137. ret lr
  138. SYM_FUNC_END(v4_dma_map_area)