blob: 0b5d00438374916170da594b10ab4fc374e46304 [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
David Howellsb920de12008-02-08 04:19:31 -080023extern void mn10300_icache_inv(void);
24extern void mn10300_dcache_inv(void);
25extern void mn10300_dcache_inv_page(unsigned start);
26extern void mn10300_dcache_inv_range(unsigned start, unsigned end);
27extern void mn10300_dcache_inv_range2(unsigned start, unsigned size);
28#ifdef CONFIG_MN10300_CACHE_WBACK
29extern void mn10300_dcache_flush(void);
30extern void mn10300_dcache_flush_page(unsigned start);
31extern void mn10300_dcache_flush_range(unsigned start, unsigned end);
32extern void mn10300_dcache_flush_range2(unsigned start, unsigned size);
33extern void mn10300_dcache_flush_inv(void);
34extern void mn10300_dcache_flush_inv_page(unsigned start);
35extern void mn10300_dcache_flush_inv_range(unsigned start, unsigned end);
36extern void mn10300_dcache_flush_inv_range2(unsigned start, unsigned size);
37#else
38#define mn10300_dcache_flush() do {} while (0)
39#define mn10300_dcache_flush_page(start) do {} while (0)
40#define mn10300_dcache_flush_range(start, end) do {} while (0)
41#define mn10300_dcache_flush_range2(start, size) do {} while (0)
42#define mn10300_dcache_flush_inv() mn10300_dcache_inv()
43#define mn10300_dcache_flush_inv_page(start) \
44 mn10300_dcache_inv_page((start))
45#define mn10300_dcache_flush_inv_range(start, end) \
46 mn10300_dcache_inv_range((start), (end))
47#define mn10300_dcache_flush_inv_range2(start, size) \
48 mn10300_dcache_inv_range2((start), (size))
49#endif /* CONFIG_MN10300_CACHE_WBACK */
50#else
51#define mn10300_icache_inv() do {} while (0)
52#define mn10300_dcache_inv() do {} while (0)
53#define mn10300_dcache_inv_page(start) do {} while (0)
54#define mn10300_dcache_inv_range(start, end) do {} while (0)
55#define mn10300_dcache_inv_range2(start, size) do {} while (0)
56#define mn10300_dcache_flush() do {} while (0)
57#define mn10300_dcache_flush_inv_page(start) do {} while (0)
58#define mn10300_dcache_flush_inv() do {} while (0)
59#define mn10300_dcache_flush_inv_range(start, end) do {} while (0)
60#define mn10300_dcache_flush_inv_range2(start, size) do {} while (0)
61#define mn10300_dcache_flush_page(start) do {} while (0)
62#define mn10300_dcache_flush_range(start, end) do {} while (0)
63#define mn10300_dcache_flush_range2(start, size) do {} while (0)
David Howells344af922010-10-27 17:28:42 +010064#endif /* CONFIG_MN10300_CACHE_ENABLED */
David Howellsb920de12008-02-08 04:19:31 -080065
66/*
David Howells93c10d32010-10-27 17:28:43 +010067 * Virtually-indexed cache management (our cache is physically indexed)
68 */
69#define flush_cache_all() do {} while (0)
70#define flush_cache_mm(mm) do {} while (0)
71#define flush_cache_dup_mm(mm) do {} while (0)
72#define flush_cache_range(mm, start, end) do {} while (0)
73#define flush_cache_page(vma, vmaddr, pfn) do {} while (0)
74#define flush_cache_vmap(start, end) do {} while (0)
75#define flush_cache_vunmap(start, end) do {} while (0)
76#define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 0
77#define flush_dcache_page(page) do {} while (0)
78#define flush_dcache_mmap_lock(mapping) do {} while (0)
79#define flush_dcache_mmap_unlock(mapping) do {} while (0)
80
81/*
82 * Physically-indexed cache management
83 */
84#ifdef CONFIG_MN10300_CACHE_ENABLED
85
86extern void flush_icache_range(unsigned long start, unsigned long end);
87extern void flush_icache_page(struct vm_area_struct *vma, struct page *pg);
88
89#else
90
91#define flush_icache_range(start, end) do {} while (0)
92#define flush_icache_page(vma, pg) do {} while (0)
93
94#endif
95
96#define flush_icache_user_range(vma, pg, adr, len) \
97 flush_icache_range(adr, adr + len)
98
99#define copy_to_user_page(vma, page, vaddr, dst, src, len) \
100 do { \
101 memcpy(dst, src, len); \
102 flush_icache_page(vma, page); \
103 } while (0)
104
105#define copy_from_user_page(vma, page, vaddr, dst, src, len) \
106 memcpy(dst, src, len)
107
108/*
109 * Internal debugging function
David Howellsb920de12008-02-08 04:19:31 -0800110 */
111#ifdef CONFIG_DEBUG_PAGEALLOC
112extern void kernel_map_pages(struct page *page, int numpages, int enable);
113#endif
114
115#endif /* __ASSEMBLY__ */
116
117#endif /* _ASM_CACHEFLUSH_H */