Merge branch 'rio.b19' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/bird
[sfrench/cifs-2.6.git] / include / asm-sparc64 / cacheflush.h
1 #ifndef _SPARC64_CACHEFLUSH_H
2 #define _SPARC64_CACHEFLUSH_H
3
4 #include <asm/page.h>
5
6 #ifndef __ASSEMBLY__
7
8 #include <linux/mm.h>
9
10 /* Cache flush operations. */
11
12 /* These are the same regardless of whether this is an SMP kernel or not. */
13 #define flush_cache_mm(__mm) \
14         do { if ((__mm) == current->mm) flushw_user(); } while(0)
15 #define flush_cache_range(vma, start, end) \
16         flush_cache_mm((vma)->vm_mm)
17 #define flush_cache_page(vma, page, pfn) \
18         flush_cache_mm((vma)->vm_mm)
19
20 /* 
21  * On spitfire, the icache doesn't snoop local stores and we don't
22  * use block commit stores (which invalidate icache lines) during
23  * module load, so we need this.
24  */
25 extern void flush_icache_range(unsigned long start, unsigned long end);
26 extern void __flush_icache_page(unsigned long);
27
28 extern void __flush_dcache_page(void *addr, int flush_icache);
29 extern void flush_dcache_page_impl(struct page *page);
30 #ifdef CONFIG_SMP
31 extern void smp_flush_dcache_page_impl(struct page *page, int cpu);
32 extern void flush_dcache_page_all(struct mm_struct *mm, struct page *page);
33 #else
34 #define smp_flush_dcache_page_impl(page,cpu) flush_dcache_page_impl(page)
35 #define flush_dcache_page_all(mm,page) flush_dcache_page_impl(page)
36 #endif
37
38 extern void __flush_dcache_range(unsigned long start, unsigned long end);
39 extern void flush_dcache_page(struct page *page);
40
41 #define flush_icache_page(vma, pg)      do { } while(0)
42 #define flush_icache_user_range(vma,pg,adr,len) do { } while (0)
43
44 extern void flush_ptrace_access(struct vm_area_struct *, struct page *,
45                                 unsigned long uaddr, void *kaddr,
46                                 unsigned long len, int write);
47
48 #define copy_to_user_page(vma, page, vaddr, dst, src, len)              \
49         do {                                                            \
50                 flush_cache_page(vma, vaddr, page_to_pfn(page));        \
51                 memcpy(dst, src, len);                                  \
52                 flush_ptrace_access(vma, page, vaddr, src, len, 0);     \
53         } while (0)
54
55 #define copy_from_user_page(vma, page, vaddr, dst, src, len)            \
56         do {                                                            \
57                 flush_cache_page(vma, vaddr, page_to_pfn(page));        \
58                 memcpy(dst, src, len);                                  \
59                 flush_ptrace_access(vma, page, vaddr, dst, len, 1);     \
60         } while (0)
61
62 #define flush_dcache_mmap_lock(mapping)         do { } while (0)
63 #define flush_dcache_mmap_unlock(mapping)       do { } while (0)
64
65 #define flush_cache_vmap(start, end)            do { } while (0)
66 #define flush_cache_vunmap(start, end)          do { } while (0)
67
68 #ifdef CONFIG_DEBUG_PAGEALLOC
69 /* internal debugging function */
70 void kernel_map_pages(struct page *page, int numpages, int enable);
71 #endif
72
73 #endif /* !__ASSEMBLY__ */
74
75 #endif /* _SPARC64_CACHEFLUSH_H */