diff options
author | Chris Dearman <chris@mips.com> | 2007-09-18 19:58:24 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2008-04-28 12:14:25 -0400 |
commit | 351336929ccf222ae38ff0cb7a8dd5fd5c6236a0 (patch) | |
tree | d9e9253bd30cf011d248ad3b63761a9a725e5cb0 /include/asm-mips | |
parent | bec5052743ec8ae4c5669918cf9b130bf15709a2 (diff) |
[MIPS] Allow setting of the cache attribute at run time.
Slightly tacky, but there is a precedent in the sparc archirecture code.
Signed-off-by: Chris Dearman <chris@mips.com>
Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'include/asm-mips')
-rw-r--r-- | include/asm-mips/io.h | 2 | ||||
-rw-r--r-- | include/asm-mips/pgtable-bits.h | 12 | ||||
-rw-r--r-- | include/asm-mips/pgtable.h | 51 |
3 files changed, 30 insertions, 35 deletions
diff --git a/include/asm-mips/io.h b/include/asm-mips/io.h index e62058b0d28c..f18d2816cbec 100644 --- a/include/asm-mips/io.h +++ b/include/asm-mips/io.h | |||
@@ -273,7 +273,7 @@ static inline void __iomem * __ioremap_mode(phys_t offset, unsigned long size, | |||
273 | * memory-like regions on I/O busses. | 273 | * memory-like regions on I/O busses. |
274 | */ | 274 | */ |
275 | #define ioremap_cachable(offset, size) \ | 275 | #define ioremap_cachable(offset, size) \ |
276 | __ioremap_mode((offset), (size), PAGE_CACHABLE_DEFAULT) | 276 | __ioremap_mode((offset), (size), _page_cachable_default) |
277 | 277 | ||
278 | /* | 278 | /* |
279 | * These two are MIPS specific ioremap variant. ioremap_cacheable_cow | 279 | * These two are MIPS specific ioremap variant. ioremap_cacheable_cow |
diff --git a/include/asm-mips/pgtable-bits.h b/include/asm-mips/pgtable-bits.h index 728fbe7b9946..60e2f9338fcd 100644 --- a/include/asm-mips/pgtable-bits.h +++ b/include/asm-mips/pgtable-bits.h | |||
@@ -134,18 +134,6 @@ | |||
134 | 134 | ||
135 | #define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_MODIFIED | _CACHE_MASK) | 135 | #define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_MODIFIED | _CACHE_MASK) |
136 | 136 | ||
137 | #ifdef CONFIG_MIPS_UNCACHED | ||
138 | #define PAGE_CACHABLE_DEFAULT _CACHE_UNCACHED | ||
139 | #elif defined(CONFIG_DMA_NONCOHERENT) | ||
140 | #define PAGE_CACHABLE_DEFAULT _CACHE_CACHABLE_NONCOHERENT | ||
141 | #elif defined(CONFIG_CPU_RM9000) | ||
142 | #define PAGE_CACHABLE_DEFAULT _CACHE_CWB | ||
143 | #elif defined(CONFIG_SOC_AU1X00) | ||
144 | #define PAGE_CACHABLE_DEFAULT _CACHE_CACHABLE_NONCOHERENT | ||
145 | #else | ||
146 | #define PAGE_CACHABLE_DEFAULT _CACHE_CACHABLE_COW | ||
147 | #endif | ||
148 | |||
149 | #define CONF_CM_DEFAULT (PAGE_CACHABLE_DEFAULT>>_CACHE_SHIFT) | 137 | #define CONF_CM_DEFAULT (PAGE_CACHABLE_DEFAULT>>_CACHE_SHIFT) |
150 | 138 | ||
151 | #endif /* _ASM_PGTABLE_BITS_H */ | 139 | #endif /* _ASM_PGTABLE_BITS_H */ |
diff --git a/include/asm-mips/pgtable.h b/include/asm-mips/pgtable.h index 009b7b14231f..582f56f42f0e 100644 --- a/include/asm-mips/pgtable.h +++ b/include/asm-mips/pgtable.h | |||
@@ -23,15 +23,15 @@ struct vm_area_struct; | |||
23 | 23 | ||
24 | #define PAGE_NONE __pgprot(_PAGE_PRESENT | _CACHE_CACHABLE_NONCOHERENT) | 24 | #define PAGE_NONE __pgprot(_PAGE_PRESENT | _CACHE_CACHABLE_NONCOHERENT) |
25 | #define PAGE_SHARED __pgprot(_PAGE_PRESENT | _PAGE_READ | _PAGE_WRITE | \ | 25 | #define PAGE_SHARED __pgprot(_PAGE_PRESENT | _PAGE_READ | _PAGE_WRITE | \ |
26 | PAGE_CACHABLE_DEFAULT) | 26 | _page_cachable_default) |
27 | #define PAGE_COPY __pgprot(_PAGE_PRESENT | _PAGE_READ | \ | 27 | #define PAGE_COPY __pgprot(_PAGE_PRESENT | _PAGE_READ | \ |
28 | PAGE_CACHABLE_DEFAULT) | 28 | _page_cachable_default) |
29 | #define PAGE_READONLY __pgprot(_PAGE_PRESENT | _PAGE_READ | \ | 29 | #define PAGE_READONLY __pgprot(_PAGE_PRESENT | _PAGE_READ | \ |
30 | PAGE_CACHABLE_DEFAULT) | 30 | _page_cachable_default) |
31 | #define PAGE_KERNEL __pgprot(_PAGE_PRESENT | __READABLE | __WRITEABLE | \ | 31 | #define PAGE_KERNEL __pgprot(_PAGE_PRESENT | __READABLE | __WRITEABLE | \ |
32 | _PAGE_GLOBAL | PAGE_CACHABLE_DEFAULT) | 32 | _PAGE_GLOBAL | _page_cachable_default) |
33 | #define PAGE_USERIO __pgprot(_PAGE_PRESENT | _PAGE_READ | _PAGE_WRITE | \ | 33 | #define PAGE_USERIO __pgprot(_PAGE_PRESENT | _PAGE_READ | _PAGE_WRITE | \ |
34 | PAGE_CACHABLE_DEFAULT) | 34 | _page_cachable_default) |
35 | #define PAGE_KERNEL_UNCACHED __pgprot(_PAGE_PRESENT | __READABLE | \ | 35 | #define PAGE_KERNEL_UNCACHED __pgprot(_PAGE_PRESENT | __READABLE | \ |
36 | __WRITEABLE | _PAGE_GLOBAL | _CACHE_UNCACHED) | 36 | __WRITEABLE | _PAGE_GLOBAL | _CACHE_UNCACHED) |
37 | 37 | ||
@@ -40,23 +40,30 @@ struct vm_area_struct; | |||
40 | * read. Also, write permissions imply read permissions. This is the closest | 40 | * read. Also, write permissions imply read permissions. This is the closest |
41 | * we can get by reasonable means.. | 41 | * we can get by reasonable means.. |
42 | */ | 42 | */ |
43 | #define __P000 PAGE_NONE | 43 | |
44 | #define __P001 PAGE_READONLY | 44 | /* |
45 | #define __P010 PAGE_COPY | 45 | * Dummy values to fill the table in mmap.c |
46 | #define __P011 PAGE_COPY | 46 | * The real values will be generated at runtime |
47 | #define __P100 PAGE_READONLY | 47 | */ |
48 | #define __P101 PAGE_READONLY | 48 | #define __P000 __pgprot(0) |
49 | #define __P110 PAGE_COPY | 49 | #define __P001 __pgprot(0) |
50 | #define __P111 PAGE_COPY | 50 | #define __P010 __pgprot(0) |
51 | 51 | #define __P011 __pgprot(0) | |
52 | #define __S000 PAGE_NONE | 52 | #define __P100 __pgprot(0) |
53 | #define __S001 PAGE_READONLY | 53 | #define __P101 __pgprot(0) |
54 | #define __S010 PAGE_SHARED | 54 | #define __P110 __pgprot(0) |
55 | #define __S011 PAGE_SHARED | 55 | #define __P111 __pgprot(0) |
56 | #define __S100 PAGE_READONLY | 56 | |
57 | #define __S101 PAGE_READONLY | 57 | #define __S000 __pgprot(0) |
58 | #define __S110 PAGE_SHARED | 58 | #define __S001 __pgprot(0) |
59 | #define __S111 PAGE_SHARED | 59 | #define __S010 __pgprot(0) |
60 | #define __S011 __pgprot(0) | ||
61 | #define __S100 __pgprot(0) | ||
62 | #define __S101 __pgprot(0) | ||
63 | #define __S110 __pgprot(0) | ||
64 | #define __S111 __pgprot(0) | ||
65 | |||
66 | extern unsigned long _page_cachable_default; | ||
60 | 67 | ||
61 | /* | 68 | /* |
62 | * ZERO_PAGE is a global shared page that is always zero; used | 69 | * ZERO_PAGE is a global shared page that is always zero; used |