cache-v4.S 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  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. mov r0, #0
  32. mcr p15, 0, r0, c7, c7, 0 @ flush ID cache
  33. mov pc, lr
  34. /*
  35. * flush_user_cache_range(start, end, flags)
  36. *
  37. * Invalidate a range of cache entries in the specified
  38. * address space.
  39. *
  40. * - start - start address (may not be aligned)
  41. * - end - end address (exclusive, may not be aligned)
  42. * - flags - vma_area_struct flags describing address space
  43. */
  44. ENTRY(v4_flush_user_cache_range)
  45. mov ip, #0
  46. mcreq p15, 0, ip, c7, c7, 0 @ flush ID cache
  47. mov pc, lr
  48. /*
  49. * coherent_kern_range(start, end)
  50. *
  51. * Ensure coherency between the Icache and the Dcache in the
  52. * region described by start. If you have non-snooping
  53. * Harvard caches, you need to implement this function.
  54. *
  55. * - start - virtual start address
  56. * - end - virtual end address
  57. */
  58. ENTRY(v4_coherent_kern_range)
  59. /* FALLTHROUGH */
  60. /*
  61. * coherent_user_range(start, end)
  62. *
  63. * Ensure coherency between the Icache and the Dcache in the
  64. * region described by start. If you have non-snooping
  65. * Harvard caches, you need to implement this function.
  66. *
  67. * - start - virtual start address
  68. * - end - virtual end address
  69. */
  70. ENTRY(v4_coherent_user_range)
  71. mov pc, lr
  72. /*
  73. * flush_kern_dcache_page(void *page)
  74. *
  75. * Ensure no D cache aliasing occurs, either with itself or
  76. * the I cache
  77. *
  78. * - addr - page aligned address
  79. */
  80. ENTRY(v4_flush_kern_dcache_page)
  81. /* FALLTHROUGH */
  82. /*
  83. * dma_inv_range(start, end)
  84. *
  85. * Invalidate (discard) the specified virtual address range.
  86. * May not write back any entries. If 'start' or 'end'
  87. * are not cache line aligned, those lines must be written
  88. * back.
  89. *
  90. * - start - virtual start address
  91. * - end - virtual end address
  92. */
  93. ENTRY(v4_dma_inv_range)
  94. /* FALLTHROUGH */
  95. /*
  96. * dma_flush_range(start, end)
  97. *
  98. * Clean and invalidate the specified virtual address range.
  99. *
  100. * - start - virtual start address
  101. * - end - virtual end address
  102. */
  103. ENTRY(v4_dma_flush_range)
  104. mov r0, #0
  105. mcr p15, 0, r0, c7, c7, 0 @ flush ID cache
  106. /* FALLTHROUGH */
  107. /*
  108. * dma_clean_range(start, end)
  109. *
  110. * Clean (write back) the specified virtual address range.
  111. *
  112. * - start - virtual start address
  113. * - end - virtual end address
  114. */
  115. ENTRY(v4_dma_clean_range)
  116. mov pc, lr
  117. __INITDATA
  118. .type v4_cache_fns, #object
  119. ENTRY(v4_cache_fns)
  120. .long v4_flush_kern_cache_all
  121. .long v4_flush_user_cache_all
  122. .long v4_flush_user_cache_range
  123. .long v4_coherent_kern_range
  124. .long v4_coherent_user_range
  125. .long v4_flush_kern_dcache_page
  126. .long v4_dma_inv_range
  127. .long v4_dma_clean_range
  128. .long v4_dma_flush_range
  129. .size v4_cache_fns, . - v4_cache_fns