cache-v4.S 3.3 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_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_inv_range(start, end)
  92. *
  93. * Invalidate (discard) the specified virtual address range.
  94. * May not write back any entries. If 'start' or 'end'
  95. * are not cache line aligned, those lines must be written
  96. * back.
  97. *
  98. * - start - virtual start address
  99. * - end - virtual end address
  100. */
  101. ENTRY(v4_dma_inv_range)
  102. /* FALLTHROUGH */
  103. /*
  104. * dma_flush_range(start, end)
  105. *
  106. * Clean and invalidate the specified virtual address range.
  107. *
  108. * - start - virtual start address
  109. * - end - virtual end address
  110. */
  111. ENTRY(v4_dma_flush_range)
  112. #ifdef CONFIG_CPU_CP15
  113. mov r0, #0
  114. mcr p15, 0, r0, c7, c7, 0 @ flush ID cache
  115. #endif
  116. /* FALLTHROUGH */
  117. /*
  118. * dma_clean_range(start, end)
  119. *
  120. * Clean (write back) the specified virtual address range.
  121. *
  122. * - start - virtual start address
  123. * - end - virtual end address
  124. */
  125. ENTRY(v4_dma_clean_range)
  126. mov pc, lr
  127. __INITDATA
  128. .type v4_cache_fns, #object
  129. ENTRY(v4_cache_fns)
  130. .long v4_flush_kern_cache_all
  131. .long v4_flush_user_cache_all
  132. .long v4_flush_user_cache_range
  133. .long v4_coherent_kern_range
  134. .long v4_coherent_user_range
  135. .long v4_flush_kern_dcache_area
  136. .long v4_dma_inv_range
  137. .long v4_dma_clean_range
  138. .long v4_dma_flush_range
  139. .size v4_cache_fns, . - v4_cache_fns