diff options
author | Chris Dearman <chris@mips.com> | 2007-09-18 19:51:57 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2008-04-28 12:14:25 -0400 |
commit | bec5052743ec8ae4c5669918cf9b130bf15709a2 (patch) | |
tree | c5d01f46fa24fa22624eab3e194aad663e8ef50a /include | |
parent | 962f480e0f9024ecdcfe2ba1d216c038ee328ced (diff) |
[MIPS] Tidy up cache attributes
Signed-off-by: Chris Dearman <chris@mips.com>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-mips/pgtable-bits.h | 81 |
1 files changed, 42 insertions, 39 deletions
diff --git a/include/asm-mips/pgtable-bits.h b/include/asm-mips/pgtable-bits.h index d23f19a3240a..728fbe7b9946 100644 --- a/include/asm-mips/pgtable-bits.h +++ b/include/asm-mips/pgtable-bits.h | |||
@@ -39,7 +39,7 @@ | |||
39 | #define _PAGE_WRITE (1<<8) /* implemented in software */ | 39 | #define _PAGE_WRITE (1<<8) /* implemented in software */ |
40 | #define _PAGE_ACCESSED (1<<9) /* implemented in software */ | 40 | #define _PAGE_ACCESSED (1<<9) /* implemented in software */ |
41 | #define _PAGE_MODIFIED (1<<10) /* implemented in software */ | 41 | #define _PAGE_MODIFIED (1<<10) /* implemented in software */ |
42 | #define _PAGE_FILE (1<<10) /* set:pagecache unset:swap */ | 42 | #define _PAGE_FILE (1<<10) /* set:pagecache unset:swap */ |
43 | 43 | ||
44 | #define _PAGE_R4KBUG (1<<0) /* workaround for r4k bug */ | 44 | #define _PAGE_R4KBUG (1<<0) /* workaround for r4k bug */ |
45 | #define _PAGE_GLOBAL (1<<0) | 45 | #define _PAGE_GLOBAL (1<<0) |
@@ -47,15 +47,9 @@ | |||
47 | #define _PAGE_SILENT_READ (1<<1) /* synonym */ | 47 | #define _PAGE_SILENT_READ (1<<1) /* synonym */ |
48 | #define _PAGE_DIRTY (1<<2) /* The MIPS dirty bit */ | 48 | #define _PAGE_DIRTY (1<<2) /* The MIPS dirty bit */ |
49 | #define _PAGE_SILENT_WRITE (1<<2) | 49 | #define _PAGE_SILENT_WRITE (1<<2) |
50 | #define _CACHE_SHIFT 3 | ||
50 | #define _CACHE_MASK (7<<3) | 51 | #define _CACHE_MASK (7<<3) |
51 | 52 | ||
52 | /* MIPS32 defines only values 2 and 3. The rest are implementation | ||
53 | * dependent. | ||
54 | */ | ||
55 | #define _CACHE_UNCACHED (2<<3) | ||
56 | #define _CACHE_CACHABLE_NONCOHERENT (3<<3) | ||
57 | #define _CACHE_CACHABLE_COW (3<<3) /* Au1x */ | ||
58 | |||
59 | #else | 53 | #else |
60 | 54 | ||
61 | #define _PAGE_PRESENT (1<<0) /* implemented in software */ | 55 | #define _PAGE_PRESENT (1<<0) /* implemented in software */ |
@@ -74,55 +68,66 @@ | |||
74 | #define _PAGE_SILENT_WRITE (1<<10) | 68 | #define _PAGE_SILENT_WRITE (1<<10) |
75 | #define _CACHE_UNCACHED (1<<11) | 69 | #define _CACHE_UNCACHED (1<<11) |
76 | #define _CACHE_MASK (1<<11) | 70 | #define _CACHE_MASK (1<<11) |
77 | #define _CACHE_CACHABLE_NONCOHERENT 0 | ||
78 | 71 | ||
79 | #else | 72 | #else |
73 | |||
80 | #define _PAGE_R4KBUG (1<<5) /* workaround for r4k bug */ | 74 | #define _PAGE_R4KBUG (1<<5) /* workaround for r4k bug */ |
81 | #define _PAGE_GLOBAL (1<<6) | 75 | #define _PAGE_GLOBAL (1<<6) |
82 | #define _PAGE_VALID (1<<7) | 76 | #define _PAGE_VALID (1<<7) |
83 | #define _PAGE_SILENT_READ (1<<7) /* synonym */ | 77 | #define _PAGE_SILENT_READ (1<<7) /* synonym */ |
84 | #define _PAGE_DIRTY (1<<8) /* The MIPS dirty bit */ | 78 | #define _PAGE_DIRTY (1<<8) /* The MIPS dirty bit */ |
85 | #define _PAGE_SILENT_WRITE (1<<8) | 79 | #define _PAGE_SILENT_WRITE (1<<8) |
80 | #define _CACHE_SHIFT 9 | ||
86 | #define _CACHE_MASK (7<<9) | 81 | #define _CACHE_MASK (7<<9) |
87 | 82 | ||
88 | #ifdef CONFIG_CPU_SB1 | 83 | #endif |
84 | #endif /* defined(CONFIG_64BIT_PHYS_ADDR && defined(CONFIG_CPU_MIPS32) */ | ||
85 | |||
86 | |||
87 | /* | ||
88 | * Cache attributes | ||
89 | */ | ||
90 | #if defined(CONFIG_CPU_R3000) || defined(CONFIG_CPU_TX39XX) | ||
91 | |||
92 | #define _CACHE_CACHABLE_NONCOHERENT 0 | ||
93 | |||
94 | #elif defined(CONFIG_CPU_SB1) | ||
89 | 95 | ||
90 | /* No penalty for being coherent on the SB1, so just | 96 | /* No penalty for being coherent on the SB1, so just |
91 | use it for "noncoherent" spaces, too. Shouldn't hurt. */ | 97 | use it for "noncoherent" spaces, too. Shouldn't hurt. */ |
92 | 98 | ||
93 | #define _CACHE_UNCACHED (2<<9) | 99 | #define _CACHE_UNCACHED (2<<_CACHE_SHIFT) |
94 | #define _CACHE_CACHABLE_COW (5<<9) | 100 | #define _CACHE_CACHABLE_COW (5<<_CACHE_SHIFT) |
95 | #define _CACHE_CACHABLE_NONCOHERENT (5<<9) | 101 | #define _CACHE_CACHABLE_NONCOHERENT (5<<_CACHE_SHIFT) |
96 | #define _CACHE_UNCACHED_ACCELERATED (7<<9) | 102 | #define _CACHE_UNCACHED_ACCELERATED (7<<_CACHE_SHIFT) |
97 | 103 | ||
98 | #elif defined(CONFIG_CPU_RM9000) | 104 | #elif defined(CONFIG_CPU_RM9000) |
99 | 105 | ||
100 | #define _CACHE_WT (0 << 9) | 106 | #define _CACHE_WT (0<<_CACHE_SHIFT) |
101 | #define _CACHE_WTWA (1 << 9) | 107 | #define _CACHE_WTWA (1<<_CACHE_SHIFT) |
102 | #define _CACHE_UC_B (2 << 9) | 108 | #define _CACHE_UC_B (2<<_CACHE_SHIFT) |
103 | #define _CACHE_WB (3 << 9) | 109 | #define _CACHE_WB (3<<_CACHE_SHIFT) |
104 | #define _CACHE_CWBEA (4 << 9) | 110 | #define _CACHE_CWBEA (4<<_CACHE_SHIFT) |
105 | #define _CACHE_CWB (5 << 9) | 111 | #define _CACHE_CWB (5<<_CACHE_SHIFT) |
106 | #define _CACHE_UCNB (6 << 9) | 112 | #define _CACHE_UCNB (6<<_CACHE_SHIFT) |
107 | #define _CACHE_FPC (7 << 9) | 113 | #define _CACHE_FPC (7<<_CACHE_SHIFT) |
108 | 114 | ||
109 | #define _CACHE_UNCACHED _CACHE_UC_B | 115 | #define _CACHE_UNCACHED _CACHE_UC_B |
110 | #define _CACHE_CACHABLE_NONCOHERENT _CACHE_WB | 116 | #define _CACHE_CACHABLE_NONCOHERENT _CACHE_WB |
111 | 117 | ||
112 | #else | 118 | #else |
113 | 119 | ||
114 | #define _CACHE_CACHABLE_NO_WA (0<<9) /* R4600 only */ | 120 | #define _CACHE_CACHABLE_NO_WA (0<<_CACHE_SHIFT) /* R4600 only */ |
115 | #define _CACHE_CACHABLE_WA (1<<9) /* R4600 only */ | 121 | #define _CACHE_CACHABLE_WA (1<<_CACHE_SHIFT) /* R4600 only */ |
116 | #define _CACHE_UNCACHED (2<<9) /* R4[0246]00 */ | 122 | #define _CACHE_UNCACHED (2<<_CACHE_SHIFT) /* R4[0246]00 */ |
117 | #define _CACHE_CACHABLE_NONCOHERENT (3<<9) /* R4[0246]00 */ | 123 | #define _CACHE_CACHABLE_NONCOHERENT (3<<_CACHE_SHIFT) /* R4[0246]00 */ |
118 | #define _CACHE_CACHABLE_CE (4<<9) /* R4[04]00MC only */ | 124 | #define _CACHE_CACHABLE_CE (4<<_CACHE_SHIFT) /* R4[04]00MC only */ |
119 | #define _CACHE_CACHABLE_COW (5<<9) /* R4[04]00MC only */ | 125 | #define _CACHE_CACHABLE_COW (5<<_CACHE_SHIFT) /* R4[04]00MC only */ |
120 | #define _CACHE_CACHABLE_CUW (6<<9) /* R4[04]00MC only */ | 126 | #define _CACHE_CACHABLE_COHERENT (5<<_CACHE_SHIFT) /* MIPS32R2 CMP */ |
121 | #define _CACHE_UNCACHED_ACCELERATED (7<<9) /* R10000 only */ | 127 | #define _CACHE_CACHABLE_CUW (6<<_CACHE_SHIFT) /* R4[04]00MC only */ |
128 | #define _CACHE_UNCACHED_ACCELERATED (7<<_CACHE_SHIFT) /* R10000 only */ | ||
122 | 129 | ||
123 | #endif | 130 | #endif |
124 | #endif | ||
125 | #endif /* defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32) */ | ||
126 | 131 | ||
127 | #define __READABLE (_PAGE_READ | _PAGE_SILENT_READ | _PAGE_ACCESSED) | 132 | #define __READABLE (_PAGE_READ | _PAGE_SILENT_READ | _PAGE_ACCESSED) |
128 | #define __WRITEABLE (_PAGE_WRITE | _PAGE_SILENT_WRITE | _PAGE_MODIFIED) | 133 | #define __WRITEABLE (_PAGE_WRITE | _PAGE_SILENT_WRITE | _PAGE_MODIFIED) |
@@ -135,14 +140,12 @@ | |||
135 | #define PAGE_CACHABLE_DEFAULT _CACHE_CACHABLE_NONCOHERENT | 140 | #define PAGE_CACHABLE_DEFAULT _CACHE_CACHABLE_NONCOHERENT |
136 | #elif defined(CONFIG_CPU_RM9000) | 141 | #elif defined(CONFIG_CPU_RM9000) |
137 | #define PAGE_CACHABLE_DEFAULT _CACHE_CWB | 142 | #define PAGE_CACHABLE_DEFAULT _CACHE_CWB |
143 | #elif defined(CONFIG_SOC_AU1X00) | ||
144 | #define PAGE_CACHABLE_DEFAULT _CACHE_CACHABLE_NONCOHERENT | ||
138 | #else | 145 | #else |
139 | #define PAGE_CACHABLE_DEFAULT _CACHE_CACHABLE_COW | 146 | #define PAGE_CACHABLE_DEFAULT _CACHE_CACHABLE_COW |
140 | #endif | 147 | #endif |
141 | 148 | ||
142 | #if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32) | 149 | #define CONF_CM_DEFAULT (PAGE_CACHABLE_DEFAULT>>_CACHE_SHIFT) |
143 | #define CONF_CM_DEFAULT (PAGE_CACHABLE_DEFAULT >> 3) | ||
144 | #else | ||
145 | #define CONF_CM_DEFAULT (PAGE_CACHABLE_DEFAULT >> 9) | ||
146 | #endif | ||
147 | 150 | ||
148 | #endif /* _ASM_PGTABLE_BITS_H */ | 151 | #endif /* _ASM_PGTABLE_BITS_H */ |