2 * include/asm-xtensa/cacheflush.h
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
8 * (C) 2001 - 2006 Tensilica Inc.
11 #ifndef _XTENSA_CACHEFLUSH_H
12 #define _XTENSA_CACHEFLUSH_H
17 #include <asm/processor.h>
21 * flush and invalidate data cache, invalidate instruction cache:
23 * __flush_invalidate_cache_all()
24 * __flush_invalidate_cache_range(from,sze)
26 * invalidate data or instruction cache:
28 * __invalidate_icache_all()
29 * __invalidate_icache_page(adr)
30 * __invalidate_dcache_page(adr)
31 * __invalidate_icache_range(from,size)
32 * __invalidate_dcache_range(from,size)
36 * __flush_dcache_page(adr)
38 * flush and invalidate data cache:
40 * __flush_invalidate_dcache_all()
41 * __flush_invalidate_dcache_page(adr)
42 * __flush_invalidate_dcache_range(from,size)
45 extern void __flush_invalidate_cache_all(void);
46 extern void __flush_invalidate_cache_range(unsigned long, unsigned long);
47 extern void __flush_invalidate_dcache_all(void);
48 extern void __invalidate_icache_all(void);
50 extern void __invalidate_dcache_page(unsigned long);
51 extern void __invalidate_icache_page(unsigned long);
52 extern void __invalidate_icache_range(unsigned long, unsigned long);
53 extern void __invalidate_dcache_range(unsigned long, unsigned long);
55 #if XCHAL_DCACHE_IS_WRITEBACK
56 extern void __flush_dcache_page(unsigned long);
57 extern void __flush_invalidate_dcache_page(unsigned long);
58 extern void __flush_invalidate_dcache_range(unsigned long, unsigned long);
60 # define __flush_dcache_page(p) do { } while(0)
61 # define __flush_invalidate_dcache_page(p) do { } while(0)
62 # define __flush_invalidate_dcache_range(p,s) do { } while(0)
66 * We have physically tagged caches - nothing to do here -
67 * unless we have cache aliasing.
69 * Pages can get remapped. Because this might change the 'color' of that page,
70 * we have to flush the cache before the PTE is changed.
71 * (see also Documentation/cachetlb.txt)
74 #if (DCACHE_WAY_SIZE > PAGE_SIZE) && XCHAL_DCACHE_IS_WRITEBACK
76 #define flush_cache_all() __flush_invalidate_cache_all();
77 #define flush_cache_mm(mm) __flush_invalidate_cache_all();
78 #define flush_cache_dup_mm(mm) __flush_invalidate_cache_all();
80 #define flush_cache_vmap(start,end) __flush_invalidate_cache_all();
81 #define flush_cache_vunmap(start,end) __flush_invalidate_cache_all();
83 extern void flush_dcache_page(struct page*);
85 extern void flush_cache_range(struct vm_area_struct*, ulong, ulong);
86 extern void flush_cache_page(struct vm_area_struct*, unsigned long, unsigned long);
90 #define flush_cache_all() do { } while (0)
91 #define flush_cache_mm(mm) do { } while (0)
92 #define flush_cache_dup_mm(mm) do { } while (0)
94 #define flush_cache_vmap(start,end) do { } while (0)
95 #define flush_cache_vunmap(start,end) do { } while (0)
97 #define flush_dcache_page(page) do { } while (0)
99 #define flush_cache_page(vma,addr,pfn) do { } while (0)
100 #define flush_cache_range(vma,start,end) do { } while (0)
104 #define flush_icache_range(start,end) \
105 __invalidate_icache_range(start,(end)-(start))
107 /* This is not required, see Documentation/cachetlb.txt */
109 #define flush_icache_page(vma,page) do { } while(0)
111 #define flush_dcache_mmap_lock(mapping) do { } while (0)
112 #define flush_dcache_mmap_unlock(mapping) do { } while (0)
115 #define copy_to_user_page(vma, page, vaddr, dst, src, len) \
116 memcpy(dst, src, len)
118 #define copy_from_user_page(vma, page, vaddr, dst, src, len) \
119 memcpy(dst, src, len)
121 #endif /* __KERNEL__ */
123 #endif /* _XTENSA_CACHEFLUSH_H */