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/hardware.h>
  13. #include <asm/page.h>
  14. #include "proc-macros.S"
  15. /*
  16. * flush_user_cache_all()
  17. *
  18. * Invalidate all cache entries in a particular address
  19. * space.
  20. *
  21. * - mm - mm_struct describing address space
  22. */
  23. ENTRY(v4_flush_user_cache_all)
  24. /* FALLTHROUGH */
  25. /*
  26. * flush_kern_cache_all()
  27. *
  28. * Clean and invalidate the entire cache.
  29. */
  30. ENTRY(v4_flush_kern_cache_all)
  31. #ifdef CPU_CP15
  32. mov r0, #0
  33. mcr p15, 0, r0, c7, c7, 0 @ flush ID cache
  34. mov pc, lr
  35. #else
  36. /* FALLTHROUGH */
  37. #endif
  38. /*
  39. * flush_user_cache_range(start, end, flags)
  40. *
  41. * Invalidate a range of cache entries in the specified
  42. * address space.
  43. *
  44. * - start - start address (may not be aligned)
  45. * - end - end address (exclusive, may not be aligned)
  46. * - flags - vma_area_struct flags describing address space
  47. */
  48. ENTRY(v4_flush_user_cache_range)
  49. #ifdef CPU_CP15
  50. mov ip, #0
  51. mcreq p15, 0, ip, c7, c7, 0 @ flush ID cache
  52. mov pc, lr
  53. #else
  54. /* FALLTHROUGH */
  55. #endif
  56. /*
  57. * coherent_kern_range(start, end)
  58. *
  59. * Ensure coherency between the Icache and the Dcache in the
  60. * region described by start. If you have non-snooping
  61. * Harvard caches, you need to implement this function.
  62. *
  63. * - start - virtual start address
  64. * - end - virtual end address
  65. */
  66. ENTRY(v4_coherent_kern_range)
  67. /* FALLTHROUGH */
  68. /*
  69. * coherent_user_range(start, end)
  70. *
  71. * Ensure coherency between the Icache and the Dcache in the
  72. * region described by start. If you have non-snooping
  73. * Harvard caches, you need to implement this function.
  74. *
  75. * - start - virtual start address
  76. * - end - virtual end address
  77. */
  78. ENTRY(v4_coherent_user_range)
  79. mov pc, lr
  80. /*
  81. * flush_kern_dcache_page(void *page)
  82. *
  83. * Ensure no D cache aliasing occurs, either with itself or
  84. * the I cache
  85. *
  86. * - addr - page aligned address
  87. */
  88. ENTRY(v4_flush_kern_dcache_page)
  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 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_page
  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