cacheflush.h 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. #ifndef __ASM_SH_CACHEFLUSH_H
  2. #define __ASM_SH_CACHEFLUSH_H
  3. #ifdef __KERNEL__
  4. #include <linux/mm.h>
  5. /*
  6. * Cache flushing:
  7. *
  8. * - flush_cache_all() flushes entire cache
  9. * - flush_cache_mm(mm) flushes the specified mm context's cache lines
  10. * - flush_cache_dup mm(mm) handles cache flushing when forking
  11. * - flush_cache_page(mm, vmaddr, pfn) flushes a single page
  12. * - flush_cache_range(vma, start, end) flushes a range of pages
  13. *
  14. * - flush_dcache_page(pg) flushes(wback&invalidates) a page for dcache
  15. * - flush_icache_range(start, end) flushes(invalidates) a range for icache
  16. * - flush_icache_page(vma, pg) flushes(invalidates) a page for icache
  17. * - flush_cache_sigtramp(vaddr) flushes the signal trampoline
  18. */
  19. extern void (*local_flush_cache_all)(void *args);
  20. extern void (*local_flush_cache_mm)(void *args);
  21. extern void (*local_flush_cache_dup_mm)(void *args);
  22. extern void (*local_flush_cache_page)(void *args);
  23. extern void (*local_flush_cache_range)(void *args);
  24. extern void (*local_flush_dcache_page)(void *args);
  25. extern void (*local_flush_icache_range)(void *args);
  26. extern void (*local_flush_icache_page)(void *args);
  27. extern void (*local_flush_cache_sigtramp)(void *args);
  28. static inline void cache_noop(void *args) { }
  29. extern void (*__flush_wback_region)(void *start, int size);
  30. extern void (*__flush_purge_region)(void *start, int size);
  31. extern void (*__flush_invalidate_region)(void *start, int size);
  32. extern void flush_cache_all(void);
  33. extern void flush_cache_mm(struct mm_struct *mm);
  34. extern void flush_cache_dup_mm(struct mm_struct *mm);
  35. extern void flush_cache_page(struct vm_area_struct *vma,
  36. unsigned long addr, unsigned long pfn);
  37. extern void flush_cache_range(struct vm_area_struct *vma,
  38. unsigned long start, unsigned long end);
  39. extern void flush_dcache_page(struct page *page);
  40. extern void flush_icache_range(unsigned long start, unsigned long end);
  41. extern void flush_icache_page(struct vm_area_struct *vma,
  42. struct page *page);
  43. extern void flush_cache_sigtramp(unsigned long address);
  44. struct flusher_data {
  45. struct vm_area_struct *vma;
  46. unsigned long addr1, addr2;
  47. };
  48. #define ARCH_HAS_FLUSH_ANON_PAGE
  49. extern void __flush_anon_page(struct page *page, unsigned long);
  50. static inline void flush_anon_page(struct vm_area_struct *vma,
  51. struct page *page, unsigned long vmaddr)
  52. {
  53. if (boot_cpu_data.dcache.n_aliases && PageAnon(page))
  54. __flush_anon_page(page, vmaddr);
  55. }
  56. #define ARCH_HAS_FLUSH_KERNEL_DCACHE_PAGE
  57. static inline void flush_kernel_dcache_page(struct page *page)
  58. {
  59. flush_dcache_page(page);
  60. }
  61. extern void copy_to_user_page(struct vm_area_struct *vma,
  62. struct page *page, unsigned long vaddr, void *dst, const void *src,
  63. unsigned long len);
  64. extern void copy_from_user_page(struct vm_area_struct *vma,
  65. struct page *page, unsigned long vaddr, void *dst, const void *src,
  66. unsigned long len);
  67. #define flush_cache_vmap(start, end) flush_cache_all()
  68. #define flush_cache_vunmap(start, end) flush_cache_all()
  69. #define flush_dcache_mmap_lock(mapping) do { } while (0)
  70. #define flush_dcache_mmap_unlock(mapping) do { } while (0)
  71. void kmap_coherent_init(void);
  72. void *kmap_coherent(struct page *page, unsigned long addr);
  73. void kunmap_coherent(void *kvaddr);
  74. #define PG_dcache_dirty PG_arch_1
  75. void cpu_cache_init(void);
  76. #endif /* __KERNEL__ */
  77. #endif /* __ASM_SH_CACHEFLUSH_H */