cache-v4.S 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  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/assembler.h>
  13. #include <asm/page.h>
  14. #include "proc-macros.S"
  15. /*
  16. * flush_icache_all()
  17. *
  18. * Unconditionally clean and invalidate the entire icache.
  19. */
  20. ENTRY(v4_flush_icache_all)
  21. ret lr
  22. ENDPROC(v4_flush_icache_all)
  23. /*
  24. * flush_user_cache_all()
  25. *
  26. * Invalidate all cache entries in a particular address
  27. * space.
  28. *
  29. * - mm - mm_struct describing address space
  30. */
  31. ENTRY(v4_flush_user_cache_all)
  32. /* FALLTHROUGH */
  33. /*
  34. * flush_kern_cache_all()
  35. *
  36. * Clean and invalidate the entire cache.
  37. */
  38. ENTRY(v4_flush_kern_cache_all)
  39. #ifdef CONFIG_CPU_CP15
  40. mov r0, #0
  41. mcr p15, 0, r0, c7, c7, 0 @ flush ID cache
  42. ret lr
  43. #else
  44. /* FALLTHROUGH */
  45. #endif
  46. /*
  47. * flush_user_cache_range(start, end, flags)
  48. *
  49. * Invalidate a range of cache entries in the specified
  50. * address space.
  51. *
  52. * - start - start address (may not be aligned)
  53. * - end - end address (exclusive, may not be aligned)
  54. * - flags - vma_area_struct flags describing address space
  55. */
  56. ENTRY(v4_flush_user_cache_range)
  57. #ifdef CONFIG_CPU_CP15
  58. mov ip, #0
  59. mcr p15, 0, ip, c7, c7, 0 @ flush ID cache
  60. ret lr
  61. #else
  62. /* FALLTHROUGH */
  63. #endif
  64. /*
  65. * coherent_kern_range(start, end)
  66. *
  67. * Ensure coherency between the Icache and the Dcache in the
  68. * region described by start. If you have non-snooping
  69. * Harvard caches, you need to implement this function.
  70. *
  71. * - start - virtual start address
  72. * - end - virtual end address
  73. */
  74. ENTRY(v4_coherent_kern_range)
  75. /* FALLTHROUGH */
  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. ENTRY(v4_coherent_user_range)
  87. mov r0, #0
  88. ret lr
  89. /*
  90. * flush_kern_dcache_area(void *addr, size_t size)
  91. *
  92. * Ensure no D cache aliasing occurs, either with itself or
  93. * the I cache
  94. *
  95. * - addr - kernel address
  96. * - size - region size
  97. */
  98. ENTRY(v4_flush_kern_dcache_area)
  99. /* FALLTHROUGH */
  100. /*
  101. * dma_flush_range(start, end)
  102. *
  103. * Clean and invalidate the specified virtual address range.
  104. *
  105. * - start - virtual start address
  106. * - end - virtual end address
  107. */
  108. ENTRY(v4_dma_flush_range)
  109. #ifdef CONFIG_CPU_CP15
  110. mov r0, #0
  111. mcr p15, 0, r0, c7, c7, 0 @ flush ID cache
  112. #endif
  113. ret lr
  114. /*
  115. * dma_unmap_area(start, size, dir)
  116. * - start - kernel virtual start address
  117. * - size - size of region
  118. * - dir - DMA direction
  119. */
  120. ENTRY(v4_dma_unmap_area)
  121. teq r2, #DMA_TO_DEVICE
  122. bne v4_dma_flush_range
  123. /* FALLTHROUGH */
  124. /*
  125. * dma_map_area(start, size, dir)
  126. * - start - kernel virtual start address
  127. * - size - size of region
  128. * - dir - DMA direction
  129. */
  130. ENTRY(v4_dma_map_area)
  131. ret lr
  132. ENDPROC(v4_dma_unmap_area)
  133. ENDPROC(v4_dma_map_area)
  134. .globl v4_flush_kern_cache_louis
  135. .equ v4_flush_kern_cache_louis, v4_flush_kern_cache_all
  136. __INITDATA
  137. @ define struct cpu_cache_fns (see <asm/cacheflush.h> and proc-macros.S)
  138. define_cache_functions v4