cache-v4.S 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  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 r0, #0
  87. mov pc, lr
  88. /*
  89. * flush_kern_dcache_area(void *addr, size_t size)
  90. *
  91. * Ensure no D cache aliasing occurs, either with itself or
  92. * the I cache
  93. *
  94. * - addr - kernel address
  95. * - size - region size
  96. */
  97. ENTRY(v4_flush_kern_dcache_area)
  98. /* FALLTHROUGH */
  99. /*
  100. * dma_flush_range(start, end)
  101. *
  102. * Clean and invalidate the specified virtual address range.
  103. *
  104. * - start - virtual start address
  105. * - end - virtual end address
  106. */
  107. ENTRY(v4_dma_flush_range)
  108. #ifdef CONFIG_CPU_CP15
  109. mov r0, #0
  110. mcr p15, 0, r0, c7, c7, 0 @ flush ID cache
  111. #endif
  112. mov pc, lr
  113. /*
  114. * dma_unmap_area(start, size, dir)
  115. * - start - kernel virtual start address
  116. * - size - size of region
  117. * - dir - DMA direction
  118. */
  119. ENTRY(v4_dma_unmap_area)
  120. teq r2, #DMA_TO_DEVICE
  121. bne v4_dma_flush_range
  122. /* FALLTHROUGH */
  123. /*
  124. * dma_map_area(start, size, dir)
  125. * - start - kernel virtual start address
  126. * - size - size of region
  127. * - dir - DMA direction
  128. */
  129. ENTRY(v4_dma_map_area)
  130. mov pc, lr
  131. ENDPROC(v4_dma_unmap_area)
  132. ENDPROC(v4_dma_map_area)
  133. __INITDATA
  134. @ define struct cpu_cache_fns (see <asm/cacheflush.h> and proc-macros.S)
  135. define_cache_functions v4