diff options
Diffstat (limited to 'arch/microblaze/include/asm/cacheflush.h')
-rw-r--r-- | arch/microblaze/include/asm/cacheflush.h | 123 |
1 files changed, 64 insertions, 59 deletions
diff --git a/arch/microblaze/include/asm/cacheflush.h b/arch/microblaze/include/asm/cacheflush.h index 088076e657b3..a6edd356cd08 100644 --- a/arch/microblaze/include/asm/cacheflush.h +++ b/arch/microblaze/include/asm/cacheflush.h | |||
@@ -18,6 +18,8 @@ | |||
18 | /* Somebody depends on this; sigh... */ | 18 | /* Somebody depends on this; sigh... */ |
19 | #include <linux/mm.h> | 19 | #include <linux/mm.h> |
20 | 20 | ||
21 | /* Look at Documentation/cachetlb.txt */ | ||
22 | |||
21 | /* | 23 | /* |
22 | * Cache handling functions. | 24 | * Cache handling functions. |
23 | * Microblaze has a write-through data cache, meaning that the data cache | 25 | * Microblaze has a write-through data cache, meaning that the data cache |
@@ -27,78 +29,81 @@ | |||
27 | * instruction cache to make sure we don't fetch old, bad code. | 29 | * instruction cache to make sure we don't fetch old, bad code. |
28 | */ | 30 | */ |
29 | 31 | ||
32 | /* struct cache, d=dcache, i=icache, fl = flush, iv = invalidate, | ||
33 | * suffix r = range */ | ||
34 | struct scache { | ||
35 | /* icache */ | ||
36 | void (*ie)(void); /* enable */ | ||
37 | void (*id)(void); /* disable */ | ||
38 | void (*ifl)(void); /* flush */ | ||
39 | void (*iflr)(unsigned long a, unsigned long b); | ||
40 | void (*iin)(void); /* invalidate */ | ||
41 | void (*iinr)(unsigned long a, unsigned long b); | ||
42 | /* dcache */ | ||
43 | void (*de)(void); /* enable */ | ||
44 | void (*dd)(void); /* disable */ | ||
45 | void (*dfl)(void); /* flush */ | ||
46 | void (*dflr)(unsigned long a, unsigned long b); | ||
47 | void (*din)(void); /* invalidate */ | ||
48 | void (*dinr)(unsigned long a, unsigned long b); | ||
49 | }; | ||
50 | |||
51 | /* microblaze cache */ | ||
52 | extern struct scache *mbc; | ||
53 | |||
54 | void microblaze_cache_init(void); | ||
55 | |||
56 | #define enable_icache() mbc->ie(); | ||
57 | #define disable_icache() mbc->id(); | ||
58 | #define flush_icache() mbc->ifl(); | ||
59 | #define flush_icache_range(start, end) mbc->iflr(start, end); | ||
60 | #define invalidate_icache() mbc->iin(); | ||
61 | #define invalidate_icache_range(start, end) mbc->iinr(start, end); | ||
62 | |||
63 | |||
64 | #define flush_icache_user_range(vma, pg, adr, len) flush_icache(); | ||
65 | #define flush_icache_page(vma, pg) do { } while (0) | ||
66 | |||
67 | #define enable_dcache() mbc->de(); | ||
68 | #define disable_dcache() mbc->dd(); | ||
30 | /* FIXME for LL-temac driver */ | 69 | /* FIXME for LL-temac driver */ |
31 | #define invalidate_dcache_range(start, end) \ | 70 | #define invalidate_dcache() mbc->din(); |
32 | __invalidate_dcache_range(start, end) | 71 | #define invalidate_dcache_range(start, end) mbc->dinr(start, end); |
33 | 72 | #define flush_dcache() mbc->dfl(); | |
34 | #define flush_cache_all() __invalidate_cache_all() | 73 | #define flush_dcache_range(start, end) mbc->dflr(start, end); |
35 | #define flush_cache_mm(mm) do { } while (0) | ||
36 | #define flush_cache_range(vma, start, end) __invalidate_cache_all() | ||
37 | #define flush_cache_page(vma, vmaddr, pfn) do { } while (0) | ||
38 | 74 | ||
39 | #define flush_dcache_range(start, end) __invalidate_dcache_range(start, end) | ||
40 | #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 0 | 75 | #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 0 |
76 | /* D-cache aliasing problem can't happen - cache is between MMU and ram */ | ||
41 | #define flush_dcache_page(page) do { } while (0) | 77 | #define flush_dcache_page(page) do { } while (0) |
42 | #define flush_dcache_mmap_lock(mapping) do { } while (0) | 78 | #define flush_dcache_mmap_lock(mapping) do { } while (0) |
43 | #define flush_dcache_mmap_unlock(mapping) do { } while (0) | 79 | #define flush_dcache_mmap_unlock(mapping) do { } while (0) |
44 | 80 | ||
45 | #define flush_icache_range(start, len) __invalidate_icache_range(start, len) | ||
46 | #define flush_icache_page(vma, pg) do { } while (0) | ||
47 | |||
48 | #ifndef CONFIG_MMU | ||
49 | # define flush_icache_user_range(start, len) do { } while (0) | ||
50 | #else | ||
51 | # define flush_icache_user_range(vma, pg, adr, len) __invalidate_icache_all() | ||
52 | |||
53 | # define flush_page_to_ram(page) do { } while (0) | ||
54 | 81 | ||
55 | # define flush_icache() __invalidate_icache_all() | 82 | #define flush_cache_dup_mm(mm) do { } while (0) |
56 | # define flush_cache_sigtramp(vaddr) \ | 83 | #define flush_cache_vmap(start, end) do { } while (0) |
57 | __invalidate_icache_range(vaddr, vaddr + 8) | 84 | #define flush_cache_vunmap(start, end) do { } while (0) |
58 | 85 | #define flush_cache_mm(mm) do { } while (0) | |
59 | # define flush_dcache_mmap_lock(mapping) do { } while (0) | 86 | #define flush_cache_page(vma, vmaddr, pfn) do { } while (0) |
60 | # define flush_dcache_mmap_unlock(mapping) do { } while (0) | ||
61 | 87 | ||
62 | # define flush_cache_dup_mm(mm) do { } while (0) | 88 | /* MS: kgdb code use this macro, wrong len with FLASH */ |
89 | #if 0 | ||
90 | #define flush_cache_range(vma, start, len) { \ | ||
91 | flush_icache_range((unsigned) (start), (unsigned) (start) + (len)); \ | ||
92 | flush_dcache_range((unsigned) (start), (unsigned) (start) + (len)); \ | ||
93 | } | ||
63 | #endif | 94 | #endif |
64 | 95 | ||
65 | #define flush_cache_vmap(start, end) do { } while (0) | 96 | #define flush_cache_range(vma, start, len) do { } while (0) |
66 | #define flush_cache_vunmap(start, end) do { } while (0) | ||
67 | |||
68 | struct page; | ||
69 | struct mm_struct; | ||
70 | struct vm_area_struct; | ||
71 | |||
72 | /* see arch/microblaze/kernel/cache.c */ | ||
73 | extern void __invalidate_icache_all(void); | ||
74 | extern void __invalidate_icache_range(unsigned long start, unsigned long end); | ||
75 | extern void __invalidate_icache_page(struct vm_area_struct *vma, | ||
76 | struct page *page); | ||
77 | extern void __invalidate_icache_user_range(struct vm_area_struct *vma, | ||
78 | struct page *page, | ||
79 | unsigned long adr, int len); | ||
80 | extern void __invalidate_cache_sigtramp(unsigned long addr); | ||
81 | |||
82 | extern void __invalidate_dcache_all(void); | ||
83 | extern void __invalidate_dcache_range(unsigned long start, unsigned long end); | ||
84 | extern void __invalidate_dcache_page(struct vm_area_struct *vma, | ||
85 | struct page *page); | ||
86 | extern void __invalidate_dcache_user_range(struct vm_area_struct *vma, | ||
87 | struct page *page, | ||
88 | unsigned long adr, int len); | ||
89 | |||
90 | extern inline void __invalidate_cache_all(void) | ||
91 | { | ||
92 | __invalidate_icache_all(); | ||
93 | __invalidate_dcache_all(); | ||
94 | } | ||
95 | 97 | ||
96 | #define copy_to_user_page(vma, page, vaddr, dst, src, len) \ | 98 | #define copy_to_user_page(vma, page, vaddr, dst, src, len) \ |
97 | do { memcpy((dst), (src), (len)); \ | 99 | do { \ |
98 | flush_icache_range((unsigned) (dst), (unsigned) (dst) + (len)); \ | 100 | memcpy((dst), (src), (len)); \ |
101 | flush_icache_range((unsigned) (dst), (unsigned) (dst) + (len)); \ | ||
99 | } while (0) | 102 | } while (0) |
100 | 103 | ||
101 | #define copy_from_user_page(vma, page, vaddr, dst, src, len) \ | 104 | #define copy_from_user_page(vma, page, vaddr, dst, src, len) \ |
102 | memcpy((dst), (src), (len)) | 105 | do { \ |
106 | memcpy((dst), (src), (len)); \ | ||
107 | } while (0) | ||
103 | 108 | ||
104 | #endif /* _ASM_MICROBLAZE_CACHEFLUSH_H */ | 109 | #endif /* _ASM_MICROBLAZE_CACHEFLUSH_H */ |