]>
Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /* cacheflush.h: FRV cache flushing routines |
2 | * | |
3 | * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. | |
4 | * Written by David Howells (dhowells@redhat.com) | |
5 | * | |
6 | * This program is free software; you can redistribute it and/or | |
7 | * modify it under the terms of the GNU General Public License | |
8 | * as published by the Free Software Foundation; either version | |
9 | * 2 of the License, or (at your option) any later version. | |
10 | */ | |
11 | ||
12 | #ifndef _ASM_CACHEFLUSH_H | |
13 | #define _ASM_CACHEFLUSH_H | |
14 | ||
15 | /* Keep includes the same across arches. */ | |
16 | #include <linux/mm.h> | |
17 | ||
18 | /* | |
19 | * virtually-indexed cache management (our cache is physically indexed) | |
20 | */ | |
21 | #define flush_cache_all() do {} while(0) | |
22 | #define flush_cache_mm(mm) do {} while(0) | |
ec8c0446 | 23 | #define flush_cache_dup_mm(mm) do {} while(0) |
1da177e4 LT |
24 | #define flush_cache_range(mm, start, end) do {} while(0) |
25 | #define flush_cache_page(vma, vmaddr, pfn) do {} while(0) | |
26 | #define flush_cache_vmap(start, end) do {} while(0) | |
27 | #define flush_cache_vunmap(start, end) do {} while(0) | |
28 | #define flush_dcache_mmap_lock(mapping) do {} while(0) | |
29 | #define flush_dcache_mmap_unlock(mapping) do {} while(0) | |
30 | ||
31 | /* | |
62018b5b | 32 | * physically-indexed cache management |
1da177e4 LT |
33 | * - see arch/frv/lib/cache.S |
34 | */ | |
35 | extern void frv_dcache_writeback(unsigned long start, unsigned long size); | |
36 | extern void frv_cache_invalidate(unsigned long start, unsigned long size); | |
37 | extern void frv_icache_invalidate(unsigned long start, unsigned long size); | |
38 | extern void frv_cache_wback_inv(unsigned long start, unsigned long size); | |
39 | ||
40 | static inline void __flush_cache_all(void) | |
41 | { | |
42 | asm volatile(" dcef @(gr0,gr0),#1 \n" | |
43 | " icei @(gr0,gr0),#1 \n" | |
44 | " membar \n" | |
45 | : : : "memory" | |
46 | ); | |
47 | } | |
48 | ||
49 | /* dcache/icache coherency... */ | |
50 | #ifdef CONFIG_MMU | |
51 | extern void flush_dcache_page(struct page *page); | |
52 | #else | |
53 | static inline void flush_dcache_page(struct page *page) | |
54 | { | |
55 | unsigned long addr = page_to_phys(page); | |
56 | frv_dcache_writeback(addr, addr + PAGE_SIZE); | |
57 | } | |
58 | #endif | |
59 | ||
60 | static inline void flush_page_to_ram(struct page *page) | |
61 | { | |
62 | flush_dcache_page(page); | |
63 | } | |
64 | ||
65 | static inline void flush_icache(void) | |
66 | { | |
67 | __flush_cache_all(); | |
68 | } | |
69 | ||
70 | static inline void flush_icache_range(unsigned long start, unsigned long end) | |
71 | { | |
72 | frv_cache_wback_inv(start, end); | |
73 | } | |
74 | ||
75 | #ifdef CONFIG_MMU | |
76 | extern void flush_icache_user_range(struct vm_area_struct *vma, struct page *page, | |
77 | unsigned long start, unsigned long len); | |
78 | #else | |
79 | static inline void flush_icache_user_range(struct vm_area_struct *vma, struct page *page, | |
80 | unsigned long start, unsigned long len) | |
81 | { | |
82 | frv_cache_wback_inv(start, start + len); | |
83 | } | |
84 | #endif | |
85 | ||
86 | static inline void flush_icache_page(struct vm_area_struct *vma, struct page *page) | |
87 | { | |
88 | flush_icache_user_range(vma, page, page_to_phys(page), PAGE_SIZE); | |
89 | } | |
90 | ||
68f624fc DH |
91 | /* |
92 | * permit ptrace to access another process's address space through the icache | |
93 | * and the dcache | |
94 | */ | |
95 | #define copy_to_user_page(vma, page, vaddr, dst, src, len) \ | |
96 | do { \ | |
97 | memcpy((dst), (src), (len)); \ | |
98 | flush_icache_user_range((vma), (page), (vaddr), (len)); \ | |
99 | } while(0) | |
100 | ||
101 | #define copy_from_user_page(vma, page, vaddr, dst, src, len) \ | |
102 | memcpy((dst), (src), (len)) | |
1da177e4 LT |
103 | |
104 | #endif /* _ASM_CACHEFLUSH_H */ |