cache-v4.S 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. /*
  2. * linux/arch/arm/mm/cache-v4.S
  3. *
  4. * Copyright (C) 1997-2002 Russell king
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * published by the Free Software Foundation.
  9. */
  10. #include <linux/linkage.h>
  11. #include <linux/init.h>
  12. #include <asm/page.h>
  13. #include "proc-macros.S"
  14. /*
  15. * flush_icache_all()
  16. *
  17. * Unconditionally clean and invalidate the entire icache.
  18. */
  19. ENTRY(v4_flush_icache_all)
  20. mov pc, lr
  21. ENDPROC(v4_flush_icache_all)
  22. /*
  23. * flush_user_cache_all()
  24. *
  25. * Invalidate all cache entries in a particular address
  26. * space.
  27. *
  28. * - mm - mm_struct describing address space
  29. */
  30. ENTRY(v4_flush_user_cache_all)
  31. /* FALLTHROUGH */
  32. /*
  33. * flush_kern_cache_all()
  34. *
  35. * Clean and invalidate the entire cache.
  36. */
  37. ENTRY(v4_flush_kern_cache_all)
  38. #ifdef CONFIG_CPU_CP15
  39. mov r0, #0
  40. mcr p15, 0, r0, c7, c7, 0 @ flush ID cache
  41. mov pc, lr
  42. #else
  43. /* FALLTHROUGH */
  44. #endif
  45. /*
  46. * flush_user_cache_range(start, end, flags)
  47. *
  48. * Invalidate a range of cache entries in the specified
  49. * address space.
  50. *
  51. * - start - start address (may not be aligned)
  52. * - end - end address (exclusive, may not be aligned)
  53. * - flags - vma_area_struct flags describing address space
  54. */
  55. ENTRY(v4_flush_user_cache_range)
  56. #ifdef CONFIG_CPU_CP15
  57. mov ip, #0
  58. mcreq p15, 0, ip, c7, c7, 0 @ flush ID cache
  59. mov pc, lr
  60. #else
  61. /* FALLTHROUGH */
  62. #endif
  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. ENTRY(v4_coherent_kern_range)
  74. /* FALLTHROUGH */
  75. /*
  76. * coherent_user_range(start, end)
  77. *
  78. * Ensure coherency between the Icache and the Dcache in the
  79. * region described by start. If you have non-snooping
  80. * Harvard caches, you need to implement this function.
  81. *
  82. * - start - virtual start address
  83. * - end - virtual end address
  84. */
  85. ENTRY(v4_coherent_user_range)
  86. mov pc, lr
  87. /*
  88. * flush_kern_dcache_area(void *addr, size_t size)
  89. *
  90. * Ensure no D cache aliasing occurs, either with itself or
  91. * the I cache
  92. *
  93. * - addr - kernel address
  94. * - size - region size
  95. */
  96. ENTRY(v4_flush_kern_dcache_area)
  97. /* FALLTHROUGH */
  98. /*
  99. * dma_flush_range(start, end)
  100. *
  101. * Clean and invalidate the specified virtual address range.
  102. *
  103. * - start - virtual start address
  104. * - end - virtual end address
  105. */
  106. ENTRY(v4_dma_flush_range)
  107. #ifdef CONFIG_CPU_CP15
  108. mov r0, #0
  109. mcr p15, 0, r0, c7, c7, 0 @ flush ID cache
  110. #endif
  111. mov pc, lr
  112. /*
  113. * dma_unmap_area(start, size, dir)
  114. * - start - kernel virtual start address
  115. * - size - size of region
  116. * - dir - DMA direction
  117. */
  118. ENTRY(v4_dma_unmap_area)
  119. teq r2, #DMA_TO_DEVICE
  120. bne v4_dma_flush_range
  121. /* FALLTHROUGH */
  122. /*
  123. * dma_map_area(start, size, dir)
  124. * - start - kernel virtual start address
  125. * - size - size of region
  126. * - dir - DMA direction
  127. */
  128. ENTRY(v4_dma_map_area)
  129. mov pc, lr
  130. ENDPROC(v4_dma_unmap_area)
  131. ENDPROC(v4_dma_map_area)
  132. .globl v4_flush_kern_cache_louis
  133. .equ v4_flush_kern_cache_louis, v4_flush_kern_cache_all
  134. __INITDATA
  135. @ define struct cpu_cache_fns (see <asm/cacheflush.h> and proc-macros.S)
  136. define_cache_functions v4