cacheflush.h 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. /* MN10300 Cache flushing
  2. *
  3. * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
  4. * Written by David Howells (dhowells@redhat.com)
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public Licence
  8. * as published by the Free Software Foundation; either version
  9. * 2 of the Licence, or (at your option) any later version.
  10. */
  11. #ifndef _ASM_CACHEFLUSH_H
  12. #define _ASM_CACHEFLUSH_H
  13. #ifndef __ASSEMBLY__
  14. /* Keep includes the same across arches. */
  15. #include <linux/mm.h>
  16. /*
  17. * Primitive routines
  18. */
  19. #ifdef CONFIG_MN10300_CACHE_ENABLED
  20. extern void mn10300_local_icache_inv(void);
  21. extern void mn10300_local_icache_inv_page(unsigned long start);
  22. extern void mn10300_local_icache_inv_range(unsigned long start, unsigned long end);
  23. extern void mn10300_local_icache_inv_range2(unsigned long start, unsigned long size);
  24. extern void mn10300_local_dcache_inv(void);
  25. extern void mn10300_local_dcache_inv_page(unsigned long start);
  26. extern void mn10300_local_dcache_inv_range(unsigned long start, unsigned long end);
  27. extern void mn10300_local_dcache_inv_range2(unsigned long start, unsigned long size);
  28. extern void mn10300_icache_inv(void);
  29. extern void mn10300_icache_inv_page(unsigned long start);
  30. extern void mn10300_icache_inv_range(unsigned long start, unsigned long end);
  31. extern void mn10300_icache_inv_range2(unsigned long start, unsigned long size);
  32. extern void mn10300_dcache_inv(void);
  33. extern void mn10300_dcache_inv_page(unsigned long start);
  34. extern void mn10300_dcache_inv_range(unsigned long start, unsigned long end);
  35. extern void mn10300_dcache_inv_range2(unsigned long start, unsigned long size);
  36. #ifdef CONFIG_MN10300_CACHE_WBACK
  37. extern void mn10300_local_dcache_flush(void);
  38. extern void mn10300_local_dcache_flush_page(unsigned long start);
  39. extern void mn10300_local_dcache_flush_range(unsigned long start, unsigned long end);
  40. extern void mn10300_local_dcache_flush_range2(unsigned long start, unsigned long size);
  41. extern void mn10300_local_dcache_flush_inv(void);
  42. extern void mn10300_local_dcache_flush_inv_page(unsigned long start);
  43. extern void mn10300_local_dcache_flush_inv_range(unsigned long start, unsigned long end);
  44. extern void mn10300_local_dcache_flush_inv_range2(unsigned long start, unsigned long size);
  45. extern void mn10300_dcache_flush(void);
  46. extern void mn10300_dcache_flush_page(unsigned long start);
  47. extern void mn10300_dcache_flush_range(unsigned long start, unsigned long end);
  48. extern void mn10300_dcache_flush_range2(unsigned long start, unsigned long size);
  49. extern void mn10300_dcache_flush_inv(void);
  50. extern void mn10300_dcache_flush_inv_page(unsigned long start);
  51. extern void mn10300_dcache_flush_inv_range(unsigned long start, unsigned long end);
  52. extern void mn10300_dcache_flush_inv_range2(unsigned long start, unsigned long size);
  53. #else
  54. #define mn10300_local_dcache_flush() do {} while (0)
  55. #define mn10300_local_dcache_flush_page(start) do {} while (0)
  56. #define mn10300_local_dcache_flush_range(start, end) do {} while (0)
  57. #define mn10300_local_dcache_flush_range2(start, size) do {} while (0)
  58. #define mn10300_local_dcache_flush_inv() \
  59. mn10300_local_dcache_inv()
  60. #define mn10300_local_dcache_flush_inv_page(start) \
  61. mn10300_local_dcache_inv_page(start)
  62. #define mn10300_local_dcache_flush_inv_range(start, end) \
  63. mn10300_local_dcache_inv_range(start, end)
  64. #define mn10300_local_dcache_flush_inv_range2(start, size) \
  65. mn10300_local_dcache_inv_range2(start, size)
  66. #define mn10300_dcache_flush() do {} while (0)
  67. #define mn10300_dcache_flush_page(start) do {} while (0)
  68. #define mn10300_dcache_flush_range(start, end) do {} while (0)
  69. #define mn10300_dcache_flush_range2(start, size) do {} while (0)
  70. #define mn10300_dcache_flush_inv() mn10300_dcache_inv()
  71. #define mn10300_dcache_flush_inv_page(start) \
  72. mn10300_dcache_inv_page((start))
  73. #define mn10300_dcache_flush_inv_range(start, end) \
  74. mn10300_dcache_inv_range((start), (end))
  75. #define mn10300_dcache_flush_inv_range2(start, size) \
  76. mn10300_dcache_inv_range2((start), (size))
  77. #endif /* CONFIG_MN10300_CACHE_WBACK */
  78. #else
  79. #define mn10300_local_icache_inv() do {} while (0)
  80. #define mn10300_local_icache_inv_page(start) do {} while (0)
  81. #define mn10300_local_icache_inv_range(start, end) do {} while (0)
  82. #define mn10300_local_icache_inv_range2(start, size) do {} while (0)
  83. #define mn10300_local_dcache_inv() do {} while (0)
  84. #define mn10300_local_dcache_inv_page(start) do {} while (0)
  85. #define mn10300_local_dcache_inv_range(start, end) do {} while (0)
  86. #define mn10300_local_dcache_inv_range2(start, size) do {} while (0)
  87. #define mn10300_local_dcache_flush() do {} while (0)
  88. #define mn10300_local_dcache_flush_inv_page(start) do {} while (0)
  89. #define mn10300_local_dcache_flush_inv() do {} while (0)
  90. #define mn10300_local_dcache_flush_inv_range(start, end)do {} while (0)
  91. #define mn10300_local_dcache_flush_inv_range2(start, size) do {} while (0)
  92. #define mn10300_local_dcache_flush_page(start) do {} while (0)
  93. #define mn10300_local_dcache_flush_range(start, end) do {} while (0)
  94. #define mn10300_local_dcache_flush_range2(start, size) do {} while (0)
  95. #define mn10300_icache_inv() do {} while (0)
  96. #define mn10300_icache_inv_page(start) do {} while (0)
  97. #define mn10300_icache_inv_range(start, end) do {} while (0)
  98. #define mn10300_icache_inv_range2(start, size) do {} while (0)
  99. #define mn10300_dcache_inv() do {} while (0)
  100. #define mn10300_dcache_inv_page(start) do {} while (0)
  101. #define mn10300_dcache_inv_range(start, end) do {} while (0)
  102. #define mn10300_dcache_inv_range2(start, size) do {} while (0)
  103. #define mn10300_dcache_flush() do {} while (0)
  104. #define mn10300_dcache_flush_inv_page(start) do {} while (0)
  105. #define mn10300_dcache_flush_inv() do {} while (0)
  106. #define mn10300_dcache_flush_inv_range(start, end) do {} while (0)
  107. #define mn10300_dcache_flush_inv_range2(start, size) do {} while (0)
  108. #define mn10300_dcache_flush_page(start) do {} while (0)
  109. #define mn10300_dcache_flush_range(start, end) do {} while (0)
  110. #define mn10300_dcache_flush_range2(start, size) do {} while (0)
  111. #endif /* CONFIG_MN10300_CACHE_ENABLED */
  112. /*
  113. * Virtually-indexed cache management (our cache is physically indexed)
  114. */
  115. #define flush_cache_all() do {} while (0)
  116. #define flush_cache_mm(mm) do {} while (0)
  117. #define flush_cache_dup_mm(mm) do {} while (0)
  118. #define flush_cache_range(mm, start, end) do {} while (0)
  119. #define flush_cache_page(vma, vmaddr, pfn) do {} while (0)
  120. #define flush_cache_vmap(start, end) do {} while (0)
  121. #define flush_cache_vunmap(start, end) do {} while (0)
  122. #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 0
  123. #define flush_dcache_page(page) do {} while (0)
  124. #define flush_dcache_mmap_lock(mapping) do {} while (0)
  125. #define flush_dcache_mmap_unlock(mapping) do {} while (0)
  126. /*
  127. * Physically-indexed cache management
  128. */
  129. #if defined(CONFIG_MN10300_CACHE_FLUSH_ICACHE)
  130. extern void flush_icache_page(struct vm_area_struct *vma, struct page *page);
  131. extern void flush_icache_range(unsigned long start, unsigned long end);
  132. #elif defined(CONFIG_MN10300_CACHE_INV_ICACHE)
  133. static inline void flush_icache_page(struct vm_area_struct *vma,
  134. struct page *page)
  135. {
  136. mn10300_icache_inv_page(page_to_phys(page));
  137. }
  138. extern void flush_icache_range(unsigned long start, unsigned long end);
  139. #else
  140. #define flush_icache_range(start, end) do {} while (0)
  141. #define flush_icache_page(vma, pg) do {} while (0)
  142. #endif
  143. #define flush_icache_user_range(vma, pg, adr, len) \
  144. flush_icache_range(adr, adr + len)
  145. #define copy_to_user_page(vma, page, vaddr, dst, src, len) \
  146. do { \
  147. memcpy(dst, src, len); \
  148. flush_icache_page(vma, page); \
  149. } while (0)
  150. #define copy_from_user_page(vma, page, vaddr, dst, src, len) \
  151. memcpy(dst, src, len)
  152. #endif /* __ASSEMBLY__ */
  153. #endif /* _ASM_CACHEFLUSH_H */