1f15cbe6fSPaul Mundt #ifndef __ASM_SH_CACHEFLUSH_H 2f15cbe6fSPaul Mundt #define __ASM_SH_CACHEFLUSH_H 3f15cbe6fSPaul Mundt 4f15cbe6fSPaul Mundt #ifdef __KERNEL__ 5f15cbe6fSPaul Mundt 637443ef3SPaul Mundt #include <linux/mm.h> 7f9bd71f2SPaul Mundt 8f9bd71f2SPaul Mundt /* 9f9bd71f2SPaul Mundt * Cache flushing: 10f9bd71f2SPaul Mundt * 11f9bd71f2SPaul Mundt * - flush_cache_all() flushes entire cache 12f9bd71f2SPaul Mundt * - flush_cache_mm(mm) flushes the specified mm context's cache lines 13f9bd71f2SPaul Mundt * - flush_cache_dup mm(mm) handles cache flushing when forking 14f9bd71f2SPaul Mundt * - flush_cache_page(mm, vmaddr, pfn) flushes a single page 15f9bd71f2SPaul Mundt * - flush_cache_range(vma, start, end) flushes a range of pages 16f9bd71f2SPaul Mundt * 17f9bd71f2SPaul Mundt * - flush_dcache_page(pg) flushes(wback&invalidates) a page for dcache 18f9bd71f2SPaul Mundt * - flush_icache_range(start, end) flushes(invalidates) a range for icache 19f9bd71f2SPaul Mundt * - flush_icache_page(vma, pg) flushes(invalidates) a page for icache 20f9bd71f2SPaul Mundt * - flush_cache_sigtramp(vaddr) flushes the signal trampoline 21f9bd71f2SPaul Mundt */ 22f26b2a56SPaul Mundt extern void (*local_flush_cache_all)(void *args); 23f26b2a56SPaul Mundt extern void (*local_flush_cache_mm)(void *args); 24f26b2a56SPaul Mundt extern void (*local_flush_cache_dup_mm)(void *args); 25f26b2a56SPaul Mundt extern void (*local_flush_cache_page)(void *args); 26f26b2a56SPaul Mundt extern void (*local_flush_cache_range)(void *args); 27f26b2a56SPaul Mundt extern void (*local_flush_dcache_page)(void *args); 28f26b2a56SPaul Mundt extern void (*local_flush_icache_range)(void *args); 29f26b2a56SPaul Mundt extern void (*local_flush_icache_page)(void *args); 30f26b2a56SPaul Mundt extern void (*local_flush_cache_sigtramp)(void *args); 31f26b2a56SPaul Mundt 32f26b2a56SPaul Mundt static inline void cache_noop(void *args) { } 33f9bd71f2SPaul Mundt 34f9bd71f2SPaul Mundt extern void (*__flush_wback_region)(void *start, int size); 35f9bd71f2SPaul Mundt extern void (*__flush_purge_region)(void *start, int size); 36f9bd71f2SPaul Mundt extern void (*__flush_invalidate_region)(void *start, int size); 37f15cbe6fSPaul Mundt 38f26b2a56SPaul Mundt extern void flush_cache_all(void); 39f26b2a56SPaul Mundt extern void flush_cache_mm(struct mm_struct *mm); 40f26b2a56SPaul Mundt extern void flush_cache_dup_mm(struct mm_struct *mm); 41f26b2a56SPaul Mundt extern void flush_cache_page(struct vm_area_struct *vma, 42f26b2a56SPaul Mundt unsigned long addr, unsigned long pfn); 43f26b2a56SPaul Mundt extern void flush_cache_range(struct vm_area_struct *vma, 44f26b2a56SPaul Mundt unsigned long start, unsigned long end); 452d4dc890SIlya Loginov #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1 46f26b2a56SPaul Mundt extern void flush_dcache_page(struct page *page); 47f26b2a56SPaul Mundt extern void flush_icache_range(unsigned long start, unsigned long end); 48f26b2a56SPaul Mundt extern void flush_icache_page(struct vm_area_struct *vma, 49f26b2a56SPaul Mundt struct page *page); 50f26b2a56SPaul Mundt extern void flush_cache_sigtramp(unsigned long address); 51f26b2a56SPaul Mundt 52f26b2a56SPaul Mundt struct flusher_data { 53f26b2a56SPaul Mundt struct vm_area_struct *vma; 54f26b2a56SPaul Mundt unsigned long addr1, addr2; 55f26b2a56SPaul Mundt }; 56f26b2a56SPaul Mundt 57c0fe478dSPaul Mundt #define ARCH_HAS_FLUSH_ANON_PAGE 58c0fe478dSPaul Mundt extern void __flush_anon_page(struct page *page, unsigned long); 59c0fe478dSPaul Mundt 60c0fe478dSPaul Mundt static inline void flush_anon_page(struct vm_area_struct *vma, 61c0fe478dSPaul Mundt struct page *page, unsigned long vmaddr) 62c0fe478dSPaul Mundt { 63c0fe478dSPaul Mundt if (boot_cpu_data.dcache.n_aliases && PageAnon(page)) 64c0fe478dSPaul Mundt __flush_anon_page(page, vmaddr); 65c0fe478dSPaul Mundt } 66c9334f60SJames Bottomley static inline void flush_kernel_vmap_range(void *addr, int size) 67c9334f60SJames Bottomley { 68c9334f60SJames Bottomley __flush_wback_region(addr, size); 69c9334f60SJames Bottomley } 70c9334f60SJames Bottomley static inline void invalidate_kernel_vmap_range(void *addr, int size) 71c9334f60SJames Bottomley { 72c9334f60SJames Bottomley __flush_invalidate_region(addr, size); 73c9334f60SJames Bottomley } 74c0fe478dSPaul Mundt 75f15cbe6fSPaul Mundt #define ARCH_HAS_FLUSH_KERNEL_DCACHE_PAGE 76f15cbe6fSPaul Mundt static inline void flush_kernel_dcache_page(struct page *page) 77f15cbe6fSPaul Mundt { 78f15cbe6fSPaul Mundt flush_dcache_page(page); 79f15cbe6fSPaul Mundt } 80f15cbe6fSPaul Mundt 81f15cbe6fSPaul Mundt extern void copy_to_user_page(struct vm_area_struct *vma, 82f15cbe6fSPaul Mundt struct page *page, unsigned long vaddr, void *dst, const void *src, 83f15cbe6fSPaul Mundt unsigned long len); 84f15cbe6fSPaul Mundt 85f15cbe6fSPaul Mundt extern void copy_from_user_page(struct vm_area_struct *vma, 86f15cbe6fSPaul Mundt struct page *page, unsigned long vaddr, void *dst, const void *src, 87f15cbe6fSPaul Mundt unsigned long len); 88f15cbe6fSPaul Mundt 89*b07f6b32SPaul Mundt #define flush_cache_vmap(start, end) local_flush_cache_all(NULL) 90*b07f6b32SPaul Mundt #define flush_cache_vunmap(start, end) local_flush_cache_all(NULL) 91f15cbe6fSPaul Mundt 927fbb2d3bSPaul Mundt #define flush_dcache_mmap_lock(mapping) do { } while (0) 937fbb2d3bSPaul Mundt #define flush_dcache_mmap_unlock(mapping) do { } while (0) 947fbb2d3bSPaul Mundt 952739742cSPaul Mundt void kmap_coherent_init(void); 962739742cSPaul Mundt void *kmap_coherent(struct page *page, unsigned long addr); 970906a3adSPaul Mundt void kunmap_coherent(void *kvaddr); 982739742cSPaul Mundt 99dde5e3ffSPaul Mundt #define PG_dcache_dirty PG_arch_1 100dde5e3ffSPaul Mundt 101ecba1060SPaul Mundt void cpu_cache_init(void); 102ecba1060SPaul Mundt 103f15cbe6fSPaul Mundt #endif /* __KERNEL__ */ 104f15cbe6fSPaul Mundt #endif /* __ASM_SH_CACHEFLUSH_H */ 105