blob: dda96eb3e7c06b31bb764915a4474bec649f9c2d [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef __ASM_SH_CACHEFLUSH_H
2#define __ASM_SH_CACHEFLUSH_H
Paul Mundte7bd34a2007-07-31 17:07:28 +09003
Linus Torvalds1da177e2005-04-16 15:20:36 -07004#ifdef __KERNEL__
5
Paul Mundt37443ef2009-08-15 12:29:49 +09006#include <linux/mm.h>
Paul Mundtf9bd71f2009-08-21 16:20:57 +09007
8/*
9 * Cache flushing:
10 *
11 * - flush_cache_all() flushes entire cache
12 * - flush_cache_mm(mm) flushes the specified mm context's cache lines
13 * - flush_cache_dup mm(mm) handles cache flushing when forking
14 * - flush_cache_page(mm, vmaddr, pfn) flushes a single page
15 * - flush_cache_range(vma, start, end) flushes a range of pages
16 *
17 * - flush_dcache_page(pg) flushes(wback&invalidates) a page for dcache
18 * - flush_icache_range(start, end) flushes(invalidates) a range for icache
19 * - flush_icache_page(vma, pg) flushes(invalidates) a page for icache
20 * - flush_cache_sigtramp(vaddr) flushes the signal trampoline
21 */
Paul Mundtf26b2a52009-08-21 17:23:14 +090022extern void (*local_flush_cache_all)(void *args);
23extern void (*local_flush_cache_mm)(void *args);
24extern void (*local_flush_cache_dup_mm)(void *args);
25extern void (*local_flush_cache_page)(void *args);
26extern void (*local_flush_cache_range)(void *args);
27extern void (*local_flush_dcache_page)(void *args);
28extern void (*local_flush_icache_range)(void *args);
29extern void (*local_flush_icache_page)(void *args);
30extern void (*local_flush_cache_sigtramp)(void *args);
31
32static inline void cache_noop(void *args) { }
Paul Mundtf9bd71f2009-08-21 16:20:57 +090033
34extern void (*__flush_wback_region)(void *start, int size);
35extern void (*__flush_purge_region)(void *start, int size);
36extern void (*__flush_invalidate_region)(void *start, int size);
Linus Torvalds1da177e2005-04-16 15:20:36 -070037
Paul Mundtf26b2a52009-08-21 17:23:14 +090038extern void flush_cache_all(void);
39extern void flush_cache_mm(struct mm_struct *mm);
40extern void flush_cache_dup_mm(struct mm_struct *mm);
41extern void flush_cache_page(struct vm_area_struct *vma,
42 unsigned long addr, unsigned long pfn);
43extern void flush_cache_range(struct vm_area_struct *vma,
44 unsigned long start, unsigned long end);
Ilya Loginov2d4dc892009-11-26 09:16:19 +010045#define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1
Paul Mundtf26b2a52009-08-21 17:23:14 +090046extern void flush_dcache_page(struct page *page);
47extern void flush_icache_range(unsigned long start, unsigned long end);
48extern void flush_icache_page(struct vm_area_struct *vma,
49 struct page *page);
50extern void flush_cache_sigtramp(unsigned long address);
51
52struct flusher_data {
53 struct vm_area_struct *vma;
54 unsigned long addr1, addr2;
55};
56
Paul Mundtc0fe4782009-08-04 16:02:43 +090057#define ARCH_HAS_FLUSH_ANON_PAGE
58extern void __flush_anon_page(struct page *page, unsigned long);
59
60static inline void flush_anon_page(struct vm_area_struct *vma,
61 struct page *page, unsigned long vmaddr)
62{
63 if (boot_cpu_data.dcache.n_aliases && PageAnon(page))
64 __flush_anon_page(page, vmaddr);
65}
Paul Mundtc0fe4782009-08-04 16:02:43 +090066
Carmelo Amoroso844b43a2008-01-07 13:50:18 +090067#define ARCH_HAS_FLUSH_KERNEL_DCACHE_PAGE
68static inline void flush_kernel_dcache_page(struct page *page)
69{
70 flush_dcache_page(page);
71}
72
Paul Mundtba1789e2007-11-05 16:18:16 +090073extern void copy_to_user_page(struct vm_area_struct *vma,
74 struct page *page, unsigned long vaddr, void *dst, const void *src,
75 unsigned long len);
Linus Torvalds1da177e2005-04-16 15:20:36 -070076
Paul Mundtba1789e2007-11-05 16:18:16 +090077extern void copy_from_user_page(struct vm_area_struct *vma,
78 struct page *page, unsigned long vaddr, void *dst, const void *src,
79 unsigned long len);
Paul Mundtba1789e2007-11-05 16:18:16 +090080
81#define flush_cache_vmap(start, end) flush_cache_all()
82#define flush_cache_vunmap(start, end) flush_cache_all()
Linus Torvalds1da177e2005-04-16 15:20:36 -070083
Paul Mundt7fbb2d32009-08-15 11:25:32 +090084#define flush_dcache_mmap_lock(mapping) do { } while (0)
85#define flush_dcache_mmap_unlock(mapping) do { } while (0)
86
Paul Mundt27397422009-08-15 09:19:19 +090087void kmap_coherent_init(void);
88void *kmap_coherent(struct page *page, unsigned long addr);
Paul Mundt0906a3a2009-09-03 17:21:10 +090089void kunmap_coherent(void *kvaddr);
Paul Mundt27397422009-08-15 09:19:19 +090090
Paul Mundtdde5e3f2009-08-15 09:49:32 +090091#define PG_dcache_dirty PG_arch_1
92
Paul Mundtecba1062009-08-15 11:05:42 +090093void cpu_cache_init(void);
94
Linus Torvalds1da177e2005-04-16 15:20:36 -070095#endif /* __KERNEL__ */
96#endif /* __ASM_SH_CACHEFLUSH_H */