cache-v4.S 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  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_page(void *page)
  81. *
  82. * Ensure no D cache aliasing occurs, either with itself or
  83. * the I cache
  84. *
  85. * - addr - page aligned address
  86. */
  87. ENTRY(v4_flush_kern_dcache_page)
  88. /* FALLTHROUGH */
  89. /*
  90. * dma_inv_range(start, end)
  91. *
  92. * Invalidate (discard) the specified virtual address range.
  93. * May not write back any entries. If 'start' or 'end'
  94. * are not cache line aligned, those lines must be written
  95. * back.
  96. *
  97. * - start - virtual start address
  98. * - end - virtual end address
  99. */
  100. ENTRY(v4_dma_inv_range)
  101. /* FALLTHROUGH */
  102. /*
  103. * dma_flush_range(start, end)
  104. *
  105. * Clean and invalidate the specified virtual address range.
  106. *
  107. * - start - virtual start address
  108. * - end - virtual end address
  109. */
  110. ENTRY(v4_dma_flush_range)
  111. #ifdef CONFIG_CPU_CP15
  112. mov r0, #0
  113. mcr p15, 0, r0, c7, c7, 0 @ flush ID cache
  114. #endif
  115. /* FALLTHROUGH */
  116. /*
  117. * dma_clean_range(start, end)
  118. *
  119. * Clean (write back) the specified virtual address range.
  120. *
  121. * - start - virtual start address
  122. * - end - virtual end address
  123. */
  124. ENTRY(v4_dma_clean_range)
  125. mov pc, lr
  126. __INITDATA
  127. .type v4_cache_fns, #object
  128. ENTRY(v4_cache_fns)
  129. .long v4_flush_kern_cache_all
  130. .long v4_flush_user_cache_all
  131. .long v4_flush_user_cache_range
  132. .long v4_coherent_kern_range
  133. .long v4_coherent_user_range
  134. .long v4_flush_kern_dcache_page
  135. .long v4_dma_inv_range
  136. .long v4_dma_clean_range
  137. .long v4_dma_flush_range
  138. .size v4_cache_fns, . - v4_cache_fns