aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/include
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2009-08-14 23:29:49 -0400
committerPaul Mundt <lethal@linux-sh.org>2009-08-14 23:29:49 -0400
commit37443ef3f0406e855e169c87ae3f4ffb4b6ff635 (patch)
treedd57e6fe91e6058b45660b6e4629249a50bc448e /arch/sh/include
parent916e97834e023f89b31f796b53cc9c7956e7fe17 (diff)
sh: Migrate SH-4 cacheflush ops to function pointers.
This paves the way for allowing individual CPUs to overload the individual flushing routines that they care about without having to depend on weak aliases. SH-4 is converted over initially, as it wires up pretty much everything. The majority of the other CPUs will simply use the default no-op implementation with their own region flushers wired up. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/include')
-rw-r--r--arch/sh/include/asm/cacheflush.h37
-rw-r--r--arch/sh/include/cpu-common/cpu/cacheflush.h37
-rw-r--r--arch/sh/include/cpu-sh4/cpu/cacheflush.h31
-rw-r--r--arch/sh/include/cpu-sh5/cpu/cacheflush.h10
4 files changed, 26 insertions, 89 deletions
diff --git a/arch/sh/include/asm/cacheflush.h b/arch/sh/include/asm/cacheflush.h
index b1cf30f423af..25b7f46494de 100644
--- a/arch/sh/include/asm/cacheflush.h
+++ b/arch/sh/include/asm/cacheflush.h
@@ -1,46 +1,11 @@
1#ifndef __ASM_SH_CACHEFLUSH_H 1#ifndef __ASM_SH_CACHEFLUSH_H
2#define __ASM_SH_CACHEFLUSH_H 2#define __ASM_SH_CACHEFLUSH_H
3 3
4#include <linux/mm.h>
5
6#ifdef __KERNEL__ 4#ifdef __KERNEL__
7 5
8#ifdef CONFIG_CACHE_OFF 6#include <linux/mm.h>
9/*
10 * Nothing to do when the cache is disabled, initial flush and explicit
11 * disabling is handled at CPU init time.
12 *
13 * See arch/sh/kernel/cpu/init.c:cache_init().
14 */
15#define flush_cache_all() do { } while (0)
16#define flush_cache_mm(mm) do { } while (0)
17#define flush_cache_dup_mm(mm) do { } while (0)
18#define flush_cache_range(vma, start, end) do { } while (0)
19#define flush_cache_page(vma, vmaddr, pfn) do { } while (0)
20#define flush_dcache_page(page) do { } while (0)
21#define flush_icache_range(start, end) do { } while (0)
22#define flush_icache_page(vma,pg) do { } while (0)
23#define flush_cache_sigtramp(vaddr) do { } while (0)
24#define __flush_wback_region(start, size) do { (void)(start); } while (0)
25#define __flush_purge_region(start, size) do { (void)(start); } while (0)
26#define __flush_invalidate_region(start, size) do { (void)(start); } while (0)
27#else
28#include <cpu/cacheflush.h> 7#include <cpu/cacheflush.h>
29 8
30/*
31 * Consistent DMA requires that the __flush_xxx() primitives must be set
32 * for any of the enabled non-coherent caches (most of the UP CPUs),
33 * regardless of PIPT or VIPT cache configurations.
34 */
35
36/* Flush (write-back only) a region (smaller than a page) */
37extern void __flush_wback_region(void *start, int size);
38/* Flush (write-back & invalidate) a region (smaller than a page) */
39extern void __flush_purge_region(void *start, int size);
40/* Flush (invalidate only) a region (smaller than a page) */
41extern void __flush_invalidate_region(void *start, int size);
42#endif
43
44#define ARCH_HAS_FLUSH_ANON_PAGE 9#define ARCH_HAS_FLUSH_ANON_PAGE
45extern void __flush_anon_page(struct page *page, unsigned long); 10extern void __flush_anon_page(struct page *page, unsigned long);
46 11
diff --git a/arch/sh/include/cpu-common/cpu/cacheflush.h b/arch/sh/include/cpu-common/cpu/cacheflush.h
index 5dc3736218e7..8189dbd68f8f 100644
--- a/arch/sh/include/cpu-common/cpu/cacheflush.h
+++ b/arch/sh/include/cpu-common/cpu/cacheflush.h
@@ -1,14 +1,12 @@
1/* 1/*
2 * include/asm-sh/cpu-sh2/cacheflush.h
3 *
4 * Copyright (C) 2003 Paul Mundt 2 * Copyright (C) 2003 Paul Mundt
5 * 3 *
6 * This file is subject to the terms and conditions of the GNU General Public 4 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive 5 * License. See the file "COPYING" in the main directory of this archive
8 * for more details. 6 * for more details.
9 */ 7 */
10#ifndef __ASM_CPU_SH2_CACHEFLUSH_H 8#ifndef __ASM_CPU_SH_CACHEFLUSH_H
11#define __ASM_CPU_SH2_CACHEFLUSH_H 9#define __ASM_CPU_SH_CACHEFLUSH_H
12 10
13/* 11/*
14 * Cache flushing: 12 * Cache flushing:
@@ -22,18 +20,23 @@
22 * - flush_dcache_page(pg) flushes(wback&invalidates) a page for dcache 20 * - flush_dcache_page(pg) flushes(wback&invalidates) a page for dcache
23 * - flush_icache_range(start, end) flushes(invalidates) a range for icache 21 * - flush_icache_range(start, end) flushes(invalidates) a range for icache
24 * - flush_icache_page(vma, pg) flushes(invalidates) a page for icache 22 * - flush_icache_page(vma, pg) flushes(invalidates) a page for icache
25 * 23 * - flush_cache_sigtramp(vaddr) flushes the signal trampoline
26 * Caches are indexed (effectively) by physical address on SH-2, so
27 * we don't need them.
28 */ 24 */
29#define flush_cache_all() do { } while (0) 25extern void (*flush_cache_all)(void);
30#define flush_cache_mm(mm) do { } while (0) 26extern void (*flush_cache_mm)(struct mm_struct *mm);
31#define flush_cache_dup_mm(mm) do { } while (0) 27extern void (*flush_cache_dup_mm)(struct mm_struct *mm);
32#define flush_cache_range(vma, start, end) do { } while (0) 28extern void (*flush_cache_page)(struct vm_area_struct *vma,
33#define flush_cache_page(vma, vmaddr, pfn) do { } while (0) 29 unsigned long addr, unsigned long pfn);
34#define flush_dcache_page(page) do { } while (0) 30extern void (*flush_cache_range)(struct vm_area_struct *vma,
35#define flush_icache_range(start, end) do { } while (0) 31 unsigned long start, unsigned long end);
36#define flush_icache_page(vma,pg) do { } while (0) 32extern void (*flush_dcache_page)(struct page *page);
37#define flush_cache_sigtramp(vaddr) do { } while (0) 33extern void (*flush_icache_range)(unsigned long start, unsigned long end);
34extern void (*flush_icache_page)(struct vm_area_struct *vma,
35 struct page *page);
36extern void (*flush_cache_sigtramp)(unsigned long address);
37
38extern void (*__flush_wback_region)(void *start, int size);
39extern void (*__flush_purge_region)(void *start, int size);
40extern void (*__flush_invalidate_region)(void *start, int size);
38 41
39#endif /* __ASM_CPU_SH2_CACHEFLUSH_H */ 42#endif /* __ASM_CPU_SH_CACHEFLUSH_H */
diff --git a/arch/sh/include/cpu-sh4/cpu/cacheflush.h b/arch/sh/include/cpu-sh4/cpu/cacheflush.h
deleted file mode 100644
index d6bd396d7dfb..000000000000
--- a/arch/sh/include/cpu-sh4/cpu/cacheflush.h
+++ /dev/null
@@ -1,31 +0,0 @@
1/*
2 * include/asm-sh/cpu-sh4/cacheflush.h
3 *
4 * Copyright (C) 1999 Niibe Yutaka
5 * Copyright (C) 2003 Paul Mundt
6 *
7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file "COPYING" in the main directory of this archive
9 * for more details.
10 */
11#ifndef __ASM_CPU_SH4_CACHEFLUSH_H
12#define __ASM_CPU_SH4_CACHEFLUSH_H
13
14/*
15 * Caches are broken on SH-4 (unless we use write-through
16 * caching; in which case they're only semi-broken),
17 * so we need them.
18 */
19void flush_cache_all(void);
20void flush_cache_mm(struct mm_struct *mm);
21#define flush_cache_dup_mm(mm) flush_cache_mm(mm)
22void flush_cache_range(struct vm_area_struct *vma, unsigned long start,
23 unsigned long end);
24void flush_cache_page(struct vm_area_struct *vma, unsigned long addr,
25 unsigned long pfn);
26void flush_dcache_page(struct page *pg);
27void flush_icache_range(unsigned long start, unsigned long end);
28
29#define flush_icache_page(vma,pg) do { } while (0)
30
31#endif /* __ASM_CPU_SH4_CACHEFLUSH_H */
diff --git a/arch/sh/include/cpu-sh5/cpu/cacheflush.h b/arch/sh/include/cpu-sh5/cpu/cacheflush.h
index 740d10a316ef..202f637a0e17 100644
--- a/arch/sh/include/cpu-sh5/cpu/cacheflush.h
+++ b/arch/sh/include/cpu-sh5/cpu/cacheflush.h
@@ -3,10 +3,6 @@
3 3
4#ifndef __ASSEMBLY__ 4#ifndef __ASSEMBLY__
5 5
6struct vm_area_struct;
7struct page;
8struct mm_struct;
9
10extern void flush_cache_all(void); 6extern void flush_cache_all(void);
11extern void flush_cache_mm(struct mm_struct *mm); 7extern void flush_cache_mm(struct mm_struct *mm);
12extern void flush_cache_sigtramp(unsigned long vaddr); 8extern void flush_cache_sigtramp(unsigned long vaddr);
@@ -16,10 +12,14 @@ extern void flush_cache_page(struct vm_area_struct *vma, unsigned long addr, uns
16extern void flush_dcache_page(struct page *pg); 12extern void flush_dcache_page(struct page *pg);
17extern void flush_icache_range(unsigned long start, unsigned long end); 13extern void flush_icache_range(unsigned long start, unsigned long end);
18 14
15/* XXX .. */
16extern void (*__flush_wback_region)(void *start, int size);
17extern void (*__flush_purge_region)(void *start, int size);
18extern void (*__flush_invalidate_region)(void *start, int size);
19
19#define flush_cache_dup_mm(mm) flush_cache_mm(mm) 20#define flush_cache_dup_mm(mm) flush_cache_mm(mm)
20#define flush_icache_page(vma, page) do { } while (0) 21#define flush_icache_page(vma, page) do { } while (0)
21 22
22#endif /* __ASSEMBLY__ */ 23#endif /* __ASSEMBLY__ */
23 24
24#endif /* __ASM_SH_CPU_SH5_CACHEFLUSH_H */ 25#endif /* __ASM_SH_CPU_SH5_CACHEFLUSH_H */
25