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