diff options
author | Michal Simek <monstr@monstr.eu> | 2009-03-27 09:25:16 -0400 |
---|---|---|
committer | Michal Simek <monstr@monstr.eu> | 2009-03-27 09:25:16 -0400 |
commit | 8beb8503bfa305cd7d9efa590517a9c01e2f97b4 (patch) | |
tree | 910b5b96454482b4ad8540c528456a0a53291c0b /arch/microblaze/include/asm/cacheflush.h | |
parent | 37069abf2973f51aa12aa9dcb86c7403c9828161 (diff) |
microblaze_v8: cache support
Reviewed-by: Ingo Molnar <mingo@elte.hu>
Acked-by: Stephen Neuendorffer <stephen.neuendorffer@xilinx.com>
Acked-by: John Linn <john.linn@xilinx.com>
Acked-by: John Williams <john.williams@petalogix.com>
Signed-off-by: Michal Simek <monstr@monstr.eu>
Diffstat (limited to 'arch/microblaze/include/asm/cacheflush.h')
-rw-r--r-- | arch/microblaze/include/asm/cacheflush.h | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/arch/microblaze/include/asm/cacheflush.h b/arch/microblaze/include/asm/cacheflush.h new file mode 100644 index 000000000000..3300b785049b --- /dev/null +++ b/arch/microblaze/include/asm/cacheflush.h | |||
@@ -0,0 +1,85 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2007 PetaLogix | ||
3 | * Copyright (C) 2007 John Williams <john.williams@petalogix.com> | ||
4 | * based on v850 version which was | ||
5 | * Copyright (C) 2001,02,03 NEC Electronics Corporation | ||
6 | * Copyright (C) 2001,02,03 Miles Bader <miles@gnu.org> | ||
7 | * | ||
8 | * This file is subject to the terms and conditions of the GNU General | ||
9 | * Public License. See the file COPYING in the main directory of this | ||
10 | * archive for more details. | ||
11 | * | ||
12 | */ | ||
13 | |||
14 | #ifndef _ASM_MICROBLAZE_CACHEFLUSH_H | ||
15 | #define _ASM_MICROBLAZE_CACHEFLUSH_H | ||
16 | |||
17 | /* Somebody depends on this; sigh... */ | ||
18 | #include <linux/mm.h> | ||
19 | |||
20 | /* | ||
21 | * Cache handling functions. | ||
22 | * Microblaze has a write-through data cache, meaning that the data cache | ||
23 | * never needs to be flushed. The only flushing operations that are | ||
24 | * implemented are to invalidate the instruction cache. These are called | ||
25 | * after loading a user application into memory, we must invalidate the | ||
26 | * instruction cache to make sure we don't fetch old, bad code. | ||
27 | */ | ||
28 | |||
29 | /* FIXME for LL-temac driver */ | ||
30 | #define invalidate_dcache_range(start, end) \ | ||
31 | __invalidate_dcache_range(start, end) | ||
32 | |||
33 | #define flush_cache_all() __invalidate_cache_all() | ||
34 | #define flush_cache_mm(mm) do { } while (0) | ||
35 | #define flush_cache_range(vma, start, end) __invalidate_cache_all() | ||
36 | #define flush_cache_page(vma, vmaddr, pfn) do { } while (0) | ||
37 | |||
38 | #define flush_dcache_range(start, end) __invalidate_dcache_range(start, end) | ||
39 | #define flush_dcache_page(page) do { } while (0) | ||
40 | #define flush_dcache_mmap_lock(mapping) do { } while (0) | ||
41 | #define flush_dcache_mmap_unlock(mapping) do { } while (0) | ||
42 | |||
43 | #define flush_icache_range(start, len) __invalidate_icache_range(start, len) | ||
44 | #define flush_icache_page(vma, pg) do { } while (0) | ||
45 | |||
46 | #define flush_cache_vmap(start, end) do { } while (0) | ||
47 | #define flush_cache_vunmap(start, end) do { } while (0) | ||
48 | |||
49 | struct page; | ||
50 | struct mm_struct; | ||
51 | struct vm_area_struct; | ||
52 | |||
53 | /* see arch/microblaze/kernel/cache.c */ | ||
54 | extern void __invalidate_icache_all(void); | ||
55 | extern void __invalidate_icache_range(unsigned long start, unsigned long end); | ||
56 | extern void __invalidate_icache_page(struct vm_area_struct *vma, | ||
57 | struct page *page); | ||
58 | extern void __invalidate_icache_user_range(struct vm_area_struct *vma, | ||
59 | struct page *page, | ||
60 | unsigned long adr, int len); | ||
61 | extern void __invalidate_cache_sigtramp(unsigned long addr); | ||
62 | |||
63 | extern void __invalidate_dcache_all(void); | ||
64 | extern void __invalidate_dcache_range(unsigned long start, unsigned long end); | ||
65 | extern void __invalidate_dcache_page(struct vm_area_struct *vma, | ||
66 | struct page *page); | ||
67 | extern void __invalidate_dcache_user_range(struct vm_area_struct *vma, | ||
68 | struct page *page, | ||
69 | unsigned long adr, int len); | ||
70 | |||
71 | extern inline void __invalidate_cache_all(void) | ||
72 | { | ||
73 | __invalidate_icache_all(); | ||
74 | __invalidate_dcache_all(); | ||
75 | } | ||
76 | |||
77 | #define copy_to_user_page(vma, page, vaddr, dst, src, len) \ | ||
78 | do { memcpy((dst), (src), (len)); \ | ||
79 | flush_icache_range((unsigned) (dst), (unsigned) (dst) + (len)); \ | ||
80 | } while (0) | ||
81 | |||
82 | #define copy_from_user_page(vma, page, vaddr, dst, src, len) \ | ||
83 | memcpy((dst), (src), (len)) | ||
84 | |||
85 | #endif /* _ASM_MICROBLAZE_CACHEFLUSH_H */ | ||