1 diff -urN linux.old/arch/mips/mm/c-r4k.c linux.dev/arch/mips/mm/c-r4k.c
2 --- linux.old/arch/mips/mm/c-r4k.c 2005-06-01 18:42:44.000000000 +0200
3 +++ linux.dev/arch/mips/mm/c-r4k.c 2005-06-01 18:49:07.000000000 +0200
6 #include <linux/bitops.h>
9 +#include "../bcm947xx/include/typedefs.h"
10 +#include "../bcm947xx/include/sbconfig.h"
11 +#include <asm/paccess.h>
14 #include <asm/bcache.h>
15 #include <asm/bootinfo.h>
16 #include <asm/cacheops.h>
18 addr = start & ~(dc_lsize - 1);
19 aend = (end - 1) & ~(dc_lsize - 1);
21 +#ifdef CONFIG_BCM4710
22 + BCM4710_FILL_TLB(addr);
23 + BCM4710_FILL_TLB(aend);
27 /* Hit_Writeback_Inv_D */
28 protected_writeback_dcache_line(addr);
31 addr = start & ~(ic_lsize - 1);
32 aend = (end - 1) & ~(ic_lsize - 1);
33 +#ifdef CONFIG_BCM4710
34 + BCM4710_FILL_TLB(addr);
35 + BCM4710_FILL_TLB(aend);
38 /* Hit_Invalidate_I */
39 protected_flush_icache_line(addr);
42 a = addr & ~(sc_lsize - 1);
43 end = (addr + size - 1) & ~(sc_lsize - 1);
44 +#ifdef CONFIG_BCM4710
45 + BCM4710_FILL_TLB(a);
46 + BCM4710_FILL_TLB(end);
49 flush_scache_line(a); /* Hit_Writeback_Inv_SD */
52 R4600_HIT_CACHEOP_WAR_IMPL;
53 a = addr & ~(dc_lsize - 1);
54 end = (addr + size - 1) & ~(dc_lsize - 1);
55 +#ifdef CONFIG_BCM4710
56 + BCM4710_FILL_TLB(a);
57 + BCM4710_FILL_TLB(end);
60 flush_dcache_line(a); /* Hit_Writeback_Inv_D */
64 a = addr & ~(sc_lsize - 1);
65 end = (addr + size - 1) & ~(sc_lsize - 1);
66 +#ifdef CONFIG_BCM4710
67 + BCM4710_FILL_TLB(a);
68 + BCM4710_FILL_TLB(end);
71 flush_scache_line(a); /* Hit_Writeback_Inv_SD */
74 unsigned long ic_lsize = current_cpu_data.icache.linesz;
75 unsigned long dc_lsize = current_cpu_data.dcache.linesz;
77 +#ifdef CONFIG_BCM4710
78 + BCM4710_PROTECTED_FILL_TLB(addr);
79 + BCM4710_PROTECTED_FILL_TLB(addr + 4);
81 R4600_HIT_CACHEOP_WAR_IMPL;
82 protected_writeback_dcache_line(addr & ~(dc_lsize - 1));
83 protected_flush_icache_line(addr & ~(ic_lsize - 1));
84 diff -urN linux.old/include/asm-mips/r4kcache.h linux.dev/include/asm-mips/r4kcache.h
85 --- linux.old/include/asm-mips/r4kcache.h 2005-06-01 18:42:43.000000000 +0200
86 +++ linux.dev/include/asm-mips/r4kcache.h 2005-06-01 19:07:11.000000000 +0200
89 #include <asm/cacheops.h>
91 +#ifdef CONFIG_BCM4710
92 +#define BCM4710_DUMMY_RREG() (((sbconfig_t *)(KSEG1ADDR(SB_ENUM_BASE + SBCONFIGOFF)))->sbimstate)
94 +#define BCM4710_FILL_TLB(addr) (*(volatile unsigned long *)(addr))
95 +#define BCM4710_PROTECTED_FILL_TLB(addr) ({ unsigned long x; get_dbe(x, (volatile unsigned long *)(addr)); })
97 +#define cache_op(op,addr) \
98 + BCM4710_DUMMY_RREG(); \
99 + __asm__ __volatile__( \
100 + " .set noreorder \n" \
101 + " .set mips3\n\t \n" \
102 + " cache %0, %1 \n" \
106 + : "i" (op), "m" (*(unsigned char *)(addr)))
110 #define cache_op(op,addr) \
111 __asm__ __volatile__( \
112 " .set noreorder \n" \
116 : "i" (op), "m" (*(unsigned char *)(addr)))
120 static inline void flush_icache_line_indexed(unsigned long addr)
124 static inline void flush_dcache_line_indexed(unsigned long addr)
126 +#ifdef CONFIG_BCM4710
127 + BCM4710_DUMMY_RREG();
129 cache_op(Index_Writeback_Inv_D, addr);
134 static inline void flush_dcache_line(unsigned long addr)
137 +#ifdef CONFIG_BCM4710
138 + BCM4710_DUMMY_RREG();
140 cache_op(Hit_Writeback_Inv_D, addr);
145 static inline void protected_writeback_dcache_line(unsigned long addr)
147 +#ifdef CONFIG_BCM4710
148 + BCM4710_DUMMY_RREG();
150 __asm__ __volatile__(
154 unsigned long ws, addr;
156 for (ws = 0; ws < ws_end; ws += ws_inc)
157 - for (addr = start; addr < end; addr += 0x200)
158 + for (addr = start; addr < end; addr += 0x200) {
159 +#ifdef CONFIG_BCM4710
160 + BCM4710_DUMMY_RREG();
162 cache16_unroll32(addr|ws,Index_Writeback_Inv_D);
166 static inline void blast_dcache16_page(unsigned long page)
168 unsigned long end = start + PAGE_SIZE;
171 +#ifdef CONFIG_BCM4710
172 + BCM4710_DUMMY_RREG();
174 cache16_unroll32(start,Hit_Writeback_Inv_D);
176 } while (start < end);
178 unsigned long ws, addr;
180 for (ws = 0; ws < ws_end; ws += ws_inc)
181 - for (addr = start; addr < end; addr += 0x200)
182 + for (addr = start; addr < end; addr += 0x200) {
183 +#ifdef CONFIG_BCM4710
184 + BCM4710_DUMMY_RREG();
186 cache16_unroll32(addr|ws,Index_Writeback_Inv_D);
190 static inline void blast_icache16(void)
192 unsigned long start = page;
193 unsigned long end = start + PAGE_SIZE;
195 +#ifdef CONFIG_BCM4710
196 + BCM4710_FILL_TLB(start);
199 +#ifdef CONFIG_BCM4710
200 + BCM4710_DUMMY_RREG();
202 cache16_unroll32(start,Hit_Invalidate_I);
204 } while (start < end);
206 unsigned long ws, addr;
208 for (ws = 0; ws < ws_end; ws += ws_inc)
209 - for (addr = start; addr < end; addr += 0x400)
210 + for (addr = start; addr < end; addr += 0x400) {
211 +#ifdef CONFIG_BCM4710
212 + BCM4710_DUMMY_RREG();
214 cache32_unroll32(addr|ws,Index_Writeback_Inv_D);
218 static inline void blast_dcache32_page(unsigned long page)
220 unsigned long start = page;
221 unsigned long end = start + PAGE_SIZE;
223 +#ifdef CONFIG_BCM4710
224 + __asm__ __volatile__("nop;nop;nop;nop");
227 +#ifdef CONFIG_BCM4710
228 + BCM4710_DUMMY_RREG();
230 cache32_unroll32(start,Hit_Writeback_Inv_D);
232 } while (start < end);
234 unsigned long start = page;
235 unsigned long end = start + PAGE_SIZE;
237 +#ifdef CONFIG_BCM4710
238 + BCM4710_FILL_TLB(start);
241 cache32_unroll32(start,Hit_Invalidate_I);
243 diff -urN linux.old/arch/mips/mm/c-r4k.c linux.dev/arch/mips/mm/c-r4k.c
244 --- linux.old/arch/mips/mm/c-r4k.c 2005-06-01 18:49:07.000000000 +0200
245 +++ linux.dev/arch/mips/mm/c-r4k.c 2005-06-03 12:11:13.000000000 +0200
247 #define cpu_is_r4600_v1_x() ((read_c0_prid() & 0xfffffff0) == 0x2010)
248 #define cpu_is_r4600_v2_x() ((read_c0_prid() & 0xfffffff0) == 0x2020)
250 +#ifndef CONFIG_BCM4710
251 #define R4600_HIT_CACHEOP_WAR_IMPL \
253 if (R4600_V2_HIT_CACHEOP_WAR && cpu_is_r4600_v2_x()) \
255 if (R4600_V1_HIT_CACHEOP_WAR) \
256 __asm__ __volatile__("nop;nop;nop;nop"); \
259 +#define R4600_HIT_CACHEOP_WAR_IMPL
262 static void (* r4k_blast_dcache_page)(unsigned long addr);
264 static inline void r4k_blast_dcache_page_dc32(unsigned long addr)
266 +#ifdef CONFIG_BCM4710
267 + BCM4710_FILL_TLB(addr);
269 R4600_HIT_CACHEOP_WAR_IMPL;
270 blast_dcache32_page(addr);
273 R4600_HIT_CACHEOP_WAR_IMPL;
274 a = addr & ~(dc_lsize - 1);
275 end = (addr + size - 1) & ~(dc_lsize - 1);
276 +#ifdef CONFIG_BCM4710
277 + BCM4710_FILL_TLB(a);
278 + BCM4710_FILL_TLB(end);
281 flush_dcache_line(a); /* Hit_Writeback_Inv_D */