blob: faed90240dedd1f3f88ba34105a268efa1dd6fd2 [file] [log] [blame]
David Howellsb920de12008-02-08 04:19:31 -08001/* MN10300 Cache flushing
2 *
3 * Copyright (C) 2007 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 Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11#ifndef _ASM_CACHEFLUSH_H
12#define _ASM_CACHEFLUSH_H
13
14#ifndef __ASSEMBLY__
15
16/* Keep includes the same across arches. */
17#include <linux/mm.h>
18
19/*
David Howells93c10d32010-10-27 17:28:43 +010020 * Primitive routines
David Howellsb920de12008-02-08 04:19:31 -080021 */
David Howells344af922010-10-27 17:28:42 +010022#ifdef CONFIG_MN10300_CACHE_ENABLED
Akira Takeuchi0bd3eb62010-10-27 17:28:45 +010023extern void mn10300_local_icache_inv(void);
24extern void mn10300_local_icache_inv_page(unsigned long start);
25extern void mn10300_local_icache_inv_range(unsigned long start, unsigned long end);
26extern void mn10300_local_icache_inv_range2(unsigned long start, unsigned long size);
27extern void mn10300_local_dcache_inv(void);
28extern void mn10300_local_dcache_inv_page(unsigned long start);
29extern void mn10300_local_dcache_inv_range(unsigned long start, unsigned long end);
30extern void mn10300_local_dcache_inv_range2(unsigned long start, unsigned long size);
David Howellsb920de12008-02-08 04:19:31 -080031extern void mn10300_icache_inv(void);
Akira Takeuchi0bd3eb62010-10-27 17:28:45 +010032extern void mn10300_icache_inv_page(unsigned long start);
33extern void mn10300_icache_inv_range(unsigned long start, unsigned long end);
34extern void mn10300_icache_inv_range2(unsigned long start, unsigned long size);
David Howellsb920de12008-02-08 04:19:31 -080035extern void mn10300_dcache_inv(void);
Akira Takeuchi9b287bf2010-10-27 17:28:44 +010036extern void mn10300_dcache_inv_page(unsigned long start);
37extern void mn10300_dcache_inv_range(unsigned long start, unsigned long end);
38extern void mn10300_dcache_inv_range2(unsigned long start, unsigned long size);
David Howellsb920de12008-02-08 04:19:31 -080039#ifdef CONFIG_MN10300_CACHE_WBACK
Akira Takeuchi0bd3eb62010-10-27 17:28:45 +010040extern void mn10300_local_dcache_flush(void);
41extern void mn10300_local_dcache_flush_page(unsigned long start);
42extern void mn10300_local_dcache_flush_range(unsigned long start, unsigned long end);
43extern void mn10300_local_dcache_flush_range2(unsigned long start, unsigned long size);
44extern void mn10300_local_dcache_flush_inv(void);
45extern void mn10300_local_dcache_flush_inv_page(unsigned long start);
46extern void mn10300_local_dcache_flush_inv_range(unsigned long start, unsigned long end);
47extern void mn10300_local_dcache_flush_inv_range2(unsigned long start, unsigned long size);
David Howellsb920de12008-02-08 04:19:31 -080048extern void mn10300_dcache_flush(void);
Akira Takeuchi9b287bf2010-10-27 17:28:44 +010049extern void mn10300_dcache_flush_page(unsigned long start);
50extern void mn10300_dcache_flush_range(unsigned long start, unsigned long end);
51extern void mn10300_dcache_flush_range2(unsigned long start, unsigned long size);
David Howellsb920de12008-02-08 04:19:31 -080052extern void mn10300_dcache_flush_inv(void);
Akira Takeuchi9b287bf2010-10-27 17:28:44 +010053extern void mn10300_dcache_flush_inv_page(unsigned long start);
54extern void mn10300_dcache_flush_inv_range(unsigned long start, unsigned long end);
55extern void mn10300_dcache_flush_inv_range2(unsigned long start, unsigned long size);
David Howellsb920de12008-02-08 04:19:31 -080056#else
Akira Takeuchi0bd3eb62010-10-27 17:28:45 +010057#define mn10300_local_dcache_flush() do {} while (0)
58#define mn10300_local_dcache_flush_page(start) do {} while (0)
59#define mn10300_local_dcache_flush_range(start, end) do {} while (0)
60#define mn10300_local_dcache_flush_range2(start, size) do {} while (0)
61#define mn10300_local_dcache_flush_inv() \
62 mn10300_local_dcache_inv()
63#define mn10300_local_dcache_flush_inv_page(start) \
64 mn10300_local_dcache_inv_page(start)
65#define mn10300_local_dcache_flush_inv_range(start, end) \
66 mn10300_local_dcache_inv_range(start, end)
67#define mn10300_local_dcache_flush_inv_range2(start, size) \
68 mn10300_local_dcache_inv_range2(start, size)
David Howellsb920de12008-02-08 04:19:31 -080069#define mn10300_dcache_flush() do {} while (0)
70#define mn10300_dcache_flush_page(start) do {} while (0)
71#define mn10300_dcache_flush_range(start, end) do {} while (0)
72#define mn10300_dcache_flush_range2(start, size) do {} while (0)
73#define mn10300_dcache_flush_inv() mn10300_dcache_inv()
74#define mn10300_dcache_flush_inv_page(start) \
75 mn10300_dcache_inv_page((start))
76#define mn10300_dcache_flush_inv_range(start, end) \
77 mn10300_dcache_inv_range((start), (end))
78#define mn10300_dcache_flush_inv_range2(start, size) \
79 mn10300_dcache_inv_range2((start), (size))
80#endif /* CONFIG_MN10300_CACHE_WBACK */
81#else
Akira Takeuchi0bd3eb62010-10-27 17:28:45 +010082#define mn10300_local_icache_inv() do {} while (0)
83#define mn10300_local_icache_inv_page(start) do {} while (0)
84#define mn10300_local_icache_inv_range(start, end) do {} while (0)
85#define mn10300_local_icache_inv_range2(start, size) do {} while (0)
86#define mn10300_local_dcache_inv() do {} while (0)
87#define mn10300_local_dcache_inv_page(start) do {} while (0)
88#define mn10300_local_dcache_inv_range(start, end) do {} while (0)
89#define mn10300_local_dcache_inv_range2(start, size) do {} while (0)
90#define mn10300_local_dcache_flush() do {} while (0)
91#define mn10300_local_dcache_flush_inv_page(start) do {} while (0)
92#define mn10300_local_dcache_flush_inv() do {} while (0)
93#define mn10300_local_dcache_flush_inv_range(start, end)do {} while (0)
94#define mn10300_local_dcache_flush_inv_range2(start, size) do {} while (0)
95#define mn10300_local_dcache_flush_page(start) do {} while (0)
96#define mn10300_local_dcache_flush_range(start, end) do {} while (0)
97#define mn10300_local_dcache_flush_range2(start, size) do {} while (0)
David Howellsb920de12008-02-08 04:19:31 -080098#define mn10300_icache_inv() do {} while (0)
Akira Takeuchi0bd3eb62010-10-27 17:28:45 +010099#define mn10300_icache_inv_page(start) do {} while (0)
100#define mn10300_icache_inv_range(start, end) do {} while (0)
101#define mn10300_icache_inv_range2(start, size) do {} while (0)
David Howellsb920de12008-02-08 04:19:31 -0800102#define mn10300_dcache_inv() do {} while (0)
103#define mn10300_dcache_inv_page(start) do {} while (0)
104#define mn10300_dcache_inv_range(start, end) do {} while (0)
105#define mn10300_dcache_inv_range2(start, size) do {} while (0)
106#define mn10300_dcache_flush() do {} while (0)
107#define mn10300_dcache_flush_inv_page(start) do {} while (0)
108#define mn10300_dcache_flush_inv() do {} while (0)
109#define mn10300_dcache_flush_inv_range(start, end) do {} while (0)
110#define mn10300_dcache_flush_inv_range2(start, size) do {} while (0)
111#define mn10300_dcache_flush_page(start) do {} while (0)
112#define mn10300_dcache_flush_range(start, end) do {} while (0)
113#define mn10300_dcache_flush_range2(start, size) do {} while (0)
David Howells344af922010-10-27 17:28:42 +0100114#endif /* CONFIG_MN10300_CACHE_ENABLED */
David Howellsb920de12008-02-08 04:19:31 -0800115
116/*
David Howells93c10d32010-10-27 17:28:43 +0100117 * Virtually-indexed cache management (our cache is physically indexed)
118 */
119#define flush_cache_all() do {} while (0)
120#define flush_cache_mm(mm) do {} while (0)
121#define flush_cache_dup_mm(mm) do {} while (0)
122#define flush_cache_range(mm, start, end) do {} while (0)
123#define flush_cache_page(vma, vmaddr, pfn) do {} while (0)
124#define flush_cache_vmap(start, end) do {} while (0)
125#define flush_cache_vunmap(start, end) do {} while (0)
126#define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 0
127#define flush_dcache_page(page) do {} while (0)
128#define flush_dcache_mmap_lock(mapping) do {} while (0)
129#define flush_dcache_mmap_unlock(mapping) do {} while (0)
130
131/*
132 * Physically-indexed cache management
133 */
David Howellsb4784912010-10-27 17:28:46 +0100134#if defined(CONFIG_MN10300_CACHE_FLUSH_ICACHE)
135extern void flush_icache_page(struct vm_area_struct *vma, struct page *page);
David Howells93c10d32010-10-27 17:28:43 +0100136extern void flush_icache_range(unsigned long start, unsigned long end);
David Howellsb4784912010-10-27 17:28:46 +0100137#elif defined(CONFIG_MN10300_CACHE_INV_ICACHE)
138static inline void flush_icache_page(struct vm_area_struct *vma,
139 struct page *page)
140{
141 mn10300_icache_inv_page(page_to_phys(page));
142}
143extern void flush_icache_range(unsigned long start, unsigned long end);
David Howells93c10d32010-10-27 17:28:43 +0100144#else
David Howells93c10d32010-10-27 17:28:43 +0100145#define flush_icache_range(start, end) do {} while (0)
146#define flush_icache_page(vma, pg) do {} while (0)
David Howells93c10d32010-10-27 17:28:43 +0100147#endif
148
David Howellsb4784912010-10-27 17:28:46 +0100149
David Howells93c10d32010-10-27 17:28:43 +0100150#define flush_icache_user_range(vma, pg, adr, len) \
151 flush_icache_range(adr, adr + len)
152
153#define copy_to_user_page(vma, page, vaddr, dst, src, len) \
154 do { \
155 memcpy(dst, src, len); \
156 flush_icache_page(vma, page); \
157 } while (0)
158
159#define copy_from_user_page(vma, page, vaddr, dst, src, len) \
160 memcpy(dst, src, len)
161
162/*
163 * Internal debugging function
David Howellsb920de12008-02-08 04:19:31 -0800164 */
165#ifdef CONFIG_DEBUG_PAGEALLOC
166extern void kernel_map_pages(struct page *page, int numpages, int enable);
167#endif
168
169#endif /* __ASSEMBLY__ */
170
171#endif /* _ASM_CACHEFLUSH_H */