Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #ifndef _SPARC64_CACHEFLUSH_H |
| 2 | #define _SPARC64_CACHEFLUSH_H |
| 3 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4 | #include <asm/page.h> |
| 5 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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) |
Ralf Baechle | ec8c044 | 2006-12-12 17:14:57 +0000 | [diff] [blame] | 15 | #define flush_cache_dup_mm(mm) flush_cache_mm(mm) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16 | #define flush_cache_range(vma, start, end) \ |
| 17 | flush_cache_mm((vma)->vm_mm) |
| 18 | #define flush_cache_page(vma, page, pfn) \ |
| 19 | flush_cache_mm((vma)->vm_mm) |
| 20 | |
| 21 | /* |
| 22 | * On spitfire, the icache doesn't snoop local stores and we don't |
| 23 | * use block commit stores (which invalidate icache lines) during |
| 24 | * module load, so we need this. |
| 25 | */ |
| 26 | extern void flush_icache_range(unsigned long start, unsigned long end); |
| 27 | extern void __flush_icache_page(unsigned long); |
| 28 | |
| 29 | extern void __flush_dcache_page(void *addr, int flush_icache); |
| 30 | extern void flush_dcache_page_impl(struct page *page); |
| 31 | #ifdef CONFIG_SMP |
| 32 | extern void smp_flush_dcache_page_impl(struct page *page, int cpu); |
| 33 | extern void flush_dcache_page_all(struct mm_struct *mm, struct page *page); |
| 34 | #else |
| 35 | #define smp_flush_dcache_page_impl(page,cpu) flush_dcache_page_impl(page) |
| 36 | #define flush_dcache_page_all(mm,page) flush_dcache_page_impl(page) |
| 37 | #endif |
| 38 | |
| 39 | extern void __flush_dcache_range(unsigned long start, unsigned long end); |
| 40 | extern void flush_dcache_page(struct page *page); |
| 41 | |
| 42 | #define flush_icache_page(vma, pg) do { } while(0) |
| 43 | #define flush_icache_user_range(vma,pg,adr,len) do { } while (0) |
| 44 | |
David S. Miller | dadeafd | 2005-04-17 18:03:11 -0700 | [diff] [blame] | 45 | extern void flush_ptrace_access(struct vm_area_struct *, struct page *, |
| 46 | unsigned long uaddr, void *kaddr, |
| 47 | unsigned long len, int write); |
| 48 | |
| 49 | #define copy_to_user_page(vma, page, vaddr, dst, src, len) \ |
| 50 | do { \ |
| 51 | flush_cache_page(vma, vaddr, page_to_pfn(page)); \ |
| 52 | memcpy(dst, src, len); \ |
| 53 | flush_ptrace_access(vma, page, vaddr, src, len, 0); \ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 54 | } while (0) |
| 55 | |
David S. Miller | dadeafd | 2005-04-17 18:03:11 -0700 | [diff] [blame] | 56 | #define copy_from_user_page(vma, page, vaddr, dst, src, len) \ |
| 57 | do { \ |
| 58 | flush_cache_page(vma, vaddr, page_to_pfn(page)); \ |
| 59 | memcpy(dst, src, len); \ |
| 60 | flush_ptrace_access(vma, page, vaddr, dst, len, 1); \ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 61 | } while (0) |
| 62 | |
| 63 | #define flush_dcache_mmap_lock(mapping) do { } while (0) |
| 64 | #define flush_dcache_mmap_unlock(mapping) do { } while (0) |
| 65 | |
| 66 | #define flush_cache_vmap(start, end) do { } while (0) |
| 67 | #define flush_cache_vunmap(start, end) do { } while (0) |
| 68 | |
David S. Miller | 5642530 | 2005-09-25 16:46:57 -0700 | [diff] [blame] | 69 | #ifdef CONFIG_DEBUG_PAGEALLOC |
| 70 | /* internal debugging function */ |
| 71 | void kernel_map_pages(struct page *page, int numpages, int enable); |
| 72 | #endif |
| 73 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 74 | #endif /* !__ASSEMBLY__ */ |
| 75 | |
| 76 | #endif /* _SPARC64_CACHEFLUSH_H */ |