blob: 745d1ab6037196863cd5c1d03be99f15a0588fa2 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef _SPARC64_CACHEFLUSH_H
2#define _SPARC64_CACHEFLUSH_H
3
Linus Torvalds1da177e2005-04-16 15:20:36 -07004#include <asm/page.h>
5
Linus Torvalds1da177e2005-04-16 15:20:36 -07006#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 */
25extern void flush_icache_range(unsigned long start, unsigned long end);
26extern void __flush_icache_page(unsigned long);
27
28extern void __flush_dcache_page(void *addr, int flush_icache);
29extern void flush_dcache_page_impl(struct page *page);
30#ifdef CONFIG_SMP
31extern void smp_flush_dcache_page_impl(struct page *page, int cpu);
32extern 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
38extern void __flush_dcache_range(unsigned long start, unsigned long end);
39extern 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
David S. Millerdadeafd2005-04-17 18:03:11 -070044extern 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); \
Linus Torvalds1da177e2005-04-16 15:20:36 -070053 } while (0)
54
David S. Millerdadeafd2005-04-17 18:03:11 -070055#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); \
Linus Torvalds1da177e2005-04-16 15:20:36 -070060 } 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
David S. Miller56425302005-09-25 16:46:57 -070068#ifdef CONFIG_DEBUG_PAGEALLOC
69/* internal debugging function */
70void kernel_map_pages(struct page *page, int numpages, int enable);
71#endif
72
Linus Torvalds1da177e2005-04-16 15:20:36 -070073#endif /* !__ASSEMBLY__ */
74
75#endif /* _SPARC64_CACHEFLUSH_H */