David Howells | b920de1 | 2008-02-08 04:19:31 -0800 | [diff] [blame] | 1 | /* 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 Howells | 93c10d3 | 2010-10-27 17:28:43 +0100 | [diff] [blame] | 20 | * Primitive routines |
David Howells | b920de1 | 2008-02-08 04:19:31 -0800 | [diff] [blame] | 21 | */ |
David Howells | 344af92 | 2010-10-27 17:28:42 +0100 | [diff] [blame] | 22 | #ifdef CONFIG_MN10300_CACHE_ENABLED |
David Howells | b920de1 | 2008-02-08 04:19:31 -0800 | [diff] [blame] | 23 | extern void mn10300_icache_inv(void); |
| 24 | extern void mn10300_dcache_inv(void); |
Akira Takeuchi | 9b287bf | 2010-10-27 17:28:44 +0100 | [diff] [blame^] | 25 | extern void mn10300_dcache_inv_page(unsigned long start); |
| 26 | extern void mn10300_dcache_inv_range(unsigned long start, unsigned long end); |
| 27 | extern void mn10300_dcache_inv_range2(unsigned long start, unsigned long size); |
David Howells | b920de1 | 2008-02-08 04:19:31 -0800 | [diff] [blame] | 28 | #ifdef CONFIG_MN10300_CACHE_WBACK |
| 29 | extern void mn10300_dcache_flush(void); |
Akira Takeuchi | 9b287bf | 2010-10-27 17:28:44 +0100 | [diff] [blame^] | 30 | extern void mn10300_dcache_flush_page(unsigned long start); |
| 31 | extern void mn10300_dcache_flush_range(unsigned long start, unsigned long end); |
| 32 | extern void mn10300_dcache_flush_range2(unsigned long start, unsigned long size); |
David Howells | b920de1 | 2008-02-08 04:19:31 -0800 | [diff] [blame] | 33 | extern void mn10300_dcache_flush_inv(void); |
Akira Takeuchi | 9b287bf | 2010-10-27 17:28:44 +0100 | [diff] [blame^] | 34 | extern void mn10300_dcache_flush_inv_page(unsigned long start); |
| 35 | extern void mn10300_dcache_flush_inv_range(unsigned long start, unsigned long end); |
| 36 | extern void mn10300_dcache_flush_inv_range2(unsigned long start, unsigned long size); |
David Howells | b920de1 | 2008-02-08 04:19:31 -0800 | [diff] [blame] | 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 Howells | 344af92 | 2010-10-27 17:28:42 +0100 | [diff] [blame] | 64 | #endif /* CONFIG_MN10300_CACHE_ENABLED */ |
David Howells | b920de1 | 2008-02-08 04:19:31 -0800 | [diff] [blame] | 65 | |
| 66 | /* |
David Howells | 93c10d3 | 2010-10-27 17:28:43 +0100 | [diff] [blame] | 67 | * 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 | |
| 86 | extern void flush_icache_range(unsigned long start, unsigned long end); |
| 87 | extern 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 Howells | b920de1 | 2008-02-08 04:19:31 -0800 | [diff] [blame] | 110 | */ |
| 111 | #ifdef CONFIG_DEBUG_PAGEALLOC |
| 112 | extern void kernel_map_pages(struct page *page, int numpages, int enable); |
| 113 | #endif |
| 114 | |
| 115 | #endif /* __ASSEMBLY__ */ |
| 116 | |
| 117 | #endif /* _ASM_CACHEFLUSH_H */ |