1384740dcSRalf Baechle /*
2384740dcSRalf Baechle * This file is subject to the terms and conditions of the GNU General Public
3384740dcSRalf Baechle * License. See the file "COPYING" in the main directory of this archive
4384740dcSRalf Baechle * for more details.
5384740dcSRalf Baechle *
6384740dcSRalf Baechle * Inline assembly cache operations.
7384740dcSRalf Baechle *
879add627SJustin P. Mattock * Copyright (C) 1996 David S. Miller (davem@davemloft.net)
9384740dcSRalf Baechle * Copyright (C) 1997 - 2002 Ralf Baechle (ralf@gnu.org)
10384740dcSRalf Baechle * Copyright (C) 2004 Ralf Baechle (ralf@linux-mips.org)
11384740dcSRalf Baechle */
12384740dcSRalf Baechle #ifndef _ASM_R4KCACHE_H
13384740dcSRalf Baechle #define _ASM_R4KCACHE_H
14384740dcSRalf Baechle
15f6b39ae6SMarkos Chandras #include <linux/stringify.h>
16f6b39ae6SMarkos Chandras
17384740dcSRalf Baechle #include <asm/asm.h>
186baaeadaSPaul Burton #include <asm/asm-eva.h>
19384740dcSRalf Baechle #include <asm/cacheops.h>
20934c7923SMarkos Chandras #include <asm/compiler.h>
21384740dcSRalf Baechle #include <asm/cpu-features.h>
2214bd8c08SRalf Baechle #include <asm/cpu-type.h>
23384740dcSRalf Baechle #include <asm/mipsmtregs.h>
24bb53fdf3SHuacai Chen #include <asm/mmzone.h>
256baaeadaSPaul Burton #include <asm/unroll.h>
26384740dcSRalf Baechle
27d116e812SDeng-Cheng Zhu extern void (*r4k_blast_dcache)(void);
28d116e812SDeng-Cheng Zhu extern void (*r4k_blast_icache)(void);
29d116e812SDeng-Cheng Zhu
30384740dcSRalf Baechle /*
31384740dcSRalf Baechle * This macro return a properly sign-extended address suitable as base address
32384740dcSRalf Baechle * for indexed cache operations. Two issues here:
33384740dcSRalf Baechle *
34384740dcSRalf Baechle * - The MIPS32 and MIPS64 specs permit an implementation to directly derive
35384740dcSRalf Baechle * the index bits from the virtual address. This breaks with tradition
36384740dcSRalf Baechle * set by the R4000. To keep unpleasant surprises from happening we pick
37384740dcSRalf Baechle * an address in KSEG0 / CKSEG0.
38384740dcSRalf Baechle * - We need a properly sign extended address for 64-bit code. To get away
39384740dcSRalf Baechle * without ifdefs we let the compiler do it by a type cast.
40384740dcSRalf Baechle */
41384740dcSRalf Baechle #define INDEX_BASE CKSEG0
42384740dcSRalf Baechle
436baaeadaSPaul Burton #define _cache_op(insn, op, addr) \
44384740dcSRalf Baechle __asm__ __volatile__( \
45384740dcSRalf Baechle " .set push \n" \
46384740dcSRalf Baechle " .set noreorder \n" \
47934c7923SMarkos Chandras " .set "MIPS_ISA_ARCH_LEVEL" \n" \
486baaeadaSPaul Burton " " insn("%0", "%1") " \n" \
49384740dcSRalf Baechle " .set pop \n" \
50384740dcSRalf Baechle : \
51384740dcSRalf Baechle : "i" (op), "R" (*(unsigned char *)(addr)))
52384740dcSRalf Baechle
536baaeadaSPaul Burton #define cache_op(op, addr) \
546baaeadaSPaul Burton _cache_op(kernel_cache, op, addr)
556baaeadaSPaul Burton
flush_icache_line_indexed(unsigned long addr)56384740dcSRalf Baechle static inline void flush_icache_line_indexed(unsigned long addr)
57384740dcSRalf Baechle {
58384740dcSRalf Baechle cache_op(Index_Invalidate_I, addr);
59384740dcSRalf Baechle }
60384740dcSRalf Baechle
flush_dcache_line_indexed(unsigned long addr)61384740dcSRalf Baechle static inline void flush_dcache_line_indexed(unsigned long addr)
62384740dcSRalf Baechle {
63384740dcSRalf Baechle cache_op(Index_Writeback_Inv_D, addr);
64384740dcSRalf Baechle }
65384740dcSRalf Baechle
flush_scache_line_indexed(unsigned long addr)66384740dcSRalf Baechle static inline void flush_scache_line_indexed(unsigned long addr)
67384740dcSRalf Baechle {
68384740dcSRalf Baechle cache_op(Index_Writeback_Inv_SD, addr);
69384740dcSRalf Baechle }
70384740dcSRalf Baechle
flush_icache_line(unsigned long addr)71384740dcSRalf Baechle static inline void flush_icache_line(unsigned long addr)
72384740dcSRalf Baechle {
7314bd8c08SRalf Baechle switch (boot_cpu_type()) {
74268a2d60SJiaxun Yang case CPU_LOONGSON2EF:
75bad009feSHuacai Chen cache_op(Hit_Invalidate_I_Loongson2, addr);
7614bd8c08SRalf Baechle break;
7714bd8c08SRalf Baechle
7814bd8c08SRalf Baechle default:
79384740dcSRalf Baechle cache_op(Hit_Invalidate_I, addr);
8014bd8c08SRalf Baechle break;
8114bd8c08SRalf Baechle }
82384740dcSRalf Baechle }
83384740dcSRalf Baechle
flush_dcache_line(unsigned long addr)84384740dcSRalf Baechle static inline void flush_dcache_line(unsigned long addr)
85384740dcSRalf Baechle {
86384740dcSRalf Baechle cache_op(Hit_Writeback_Inv_D, addr);
87384740dcSRalf Baechle }
88384740dcSRalf Baechle
invalidate_dcache_line(unsigned long addr)89384740dcSRalf Baechle static inline void invalidate_dcache_line(unsigned long addr)
90384740dcSRalf Baechle {
91384740dcSRalf Baechle cache_op(Hit_Invalidate_D, addr);
92384740dcSRalf Baechle }
93384740dcSRalf Baechle
invalidate_scache_line(unsigned long addr)94384740dcSRalf Baechle static inline void invalidate_scache_line(unsigned long addr)
95384740dcSRalf Baechle {
96384740dcSRalf Baechle cache_op(Hit_Invalidate_SD, addr);
97384740dcSRalf Baechle }
98384740dcSRalf Baechle
flush_scache_line(unsigned long addr)99384740dcSRalf Baechle static inline void flush_scache_line(unsigned long addr)
100384740dcSRalf Baechle {
101384740dcSRalf Baechle cache_op(Hit_Writeback_Inv_SD, addr);
102384740dcSRalf Baechle }
103384740dcSRalf Baechle
104f1b0bf57SThomas Bogendoerfer #ifdef CONFIG_EVA
105f1b0bf57SThomas Bogendoerfer
106384740dcSRalf Baechle #define protected_cache_op(op, addr) \
1077170bdc7SJames Hogan ({ \
1087170bdc7SJames Hogan int __err = 0; \
109384740dcSRalf Baechle __asm__ __volatile__( \
110384740dcSRalf Baechle " .set push \n" \
111384740dcSRalf Baechle " .set noreorder \n" \
112a8053854SLeonid Yegoshin " .set mips0 \n" \
113a8053854SLeonid Yegoshin " .set eva \n" \
1147170bdc7SJames Hogan "1: cachee %1, (%2) \n" \
115f229454dSPaul Burton "2: .insn \n" \
116f229454dSPaul Burton " .set pop \n" \
1177170bdc7SJames Hogan " .section .fixup,\"ax\" \n" \
1187170bdc7SJames Hogan "3: li %0, %3 \n" \
1197170bdc7SJames Hogan " j 2b \n" \
1207170bdc7SJames Hogan " .previous \n" \
121a8053854SLeonid Yegoshin " .section __ex_table,\"a\" \n" \
122*fa62f39dSThomas Bogendoerfer " "STR(PTR_WD)" 1b, 3b \n" \
123a8053854SLeonid Yegoshin " .previous" \
1247170bdc7SJames Hogan : "+r" (__err) \
1257170bdc7SJames Hogan : "i" (op), "r" (addr), "i" (-EFAULT)); \
1267170bdc7SJames Hogan __err; \
1277170bdc7SJames Hogan })
128f1b0bf57SThomas Bogendoerfer #else
129f1b0bf57SThomas Bogendoerfer
130f1b0bf57SThomas Bogendoerfer #define protected_cache_op(op, addr) \
131f1b0bf57SThomas Bogendoerfer ({ \
132f1b0bf57SThomas Bogendoerfer int __err = 0; \
133f1b0bf57SThomas Bogendoerfer __asm__ __volatile__( \
134f1b0bf57SThomas Bogendoerfer " .set push \n" \
135f1b0bf57SThomas Bogendoerfer " .set noreorder \n" \
136f1b0bf57SThomas Bogendoerfer " .set "MIPS_ISA_ARCH_LEVEL" \n" \
137f1b0bf57SThomas Bogendoerfer "1: cache %1, (%2) \n" \
138f1b0bf57SThomas Bogendoerfer "2: .insn \n" \
139f1b0bf57SThomas Bogendoerfer " .set pop \n" \
140f1b0bf57SThomas Bogendoerfer " .section .fixup,\"ax\" \n" \
141f1b0bf57SThomas Bogendoerfer "3: li %0, %3 \n" \
142f1b0bf57SThomas Bogendoerfer " j 2b \n" \
143f1b0bf57SThomas Bogendoerfer " .previous \n" \
144f1b0bf57SThomas Bogendoerfer " .section __ex_table,\"a\" \n" \
145*fa62f39dSThomas Bogendoerfer " "STR(PTR_WD)" 1b, 3b \n" \
146f1b0bf57SThomas Bogendoerfer " .previous" \
147f1b0bf57SThomas Bogendoerfer : "+r" (__err) \
148f1b0bf57SThomas Bogendoerfer : "i" (op), "r" (addr), "i" (-EFAULT)); \
149f1b0bf57SThomas Bogendoerfer __err; \
150f1b0bf57SThomas Bogendoerfer })
151f1b0bf57SThomas Bogendoerfer #endif
152a8053854SLeonid Yegoshin
153384740dcSRalf Baechle /*
154384740dcSRalf Baechle * The next two are for badland addresses like signal trampolines.
155384740dcSRalf Baechle */
protected_flush_icache_line(unsigned long addr)1567170bdc7SJames Hogan static inline int protected_flush_icache_line(unsigned long addr)
157384740dcSRalf Baechle {
15814bd8c08SRalf Baechle switch (boot_cpu_type()) {
159268a2d60SJiaxun Yang case CPU_LOONGSON2EF:
1607170bdc7SJames Hogan return protected_cache_op(Hit_Invalidate_I_Loongson2, addr);
16114bd8c08SRalf Baechle
16214bd8c08SRalf Baechle default:
1637170bdc7SJames Hogan return protected_cache_op(Hit_Invalidate_I, addr);
16414bd8c08SRalf Baechle }
165384740dcSRalf Baechle }
166384740dcSRalf Baechle
167384740dcSRalf Baechle /*
168384740dcSRalf Baechle * R10000 / R12000 hazard - these processors don't support the Hit_Writeback_D
169384740dcSRalf Baechle * cacheop so we use Hit_Writeback_Inv_D which is supported by all R4000-style
170384740dcSRalf Baechle * caches. We're talking about one cacheline unnecessarily getting invalidated
171384740dcSRalf Baechle * here so the penalty isn't overly hard.
172384740dcSRalf Baechle */
protected_writeback_dcache_line(unsigned long addr)1737170bdc7SJames Hogan static inline int protected_writeback_dcache_line(unsigned long addr)
174384740dcSRalf Baechle {
1757170bdc7SJames Hogan return protected_cache_op(Hit_Writeback_Inv_D, addr);
176384740dcSRalf Baechle }
177384740dcSRalf Baechle
protected_writeback_scache_line(unsigned long addr)1787170bdc7SJames Hogan static inline int protected_writeback_scache_line(unsigned long addr)
179384740dcSRalf Baechle {
1807170bdc7SJames Hogan return protected_cache_op(Hit_Writeback_Inv_SD, addr);
181384740dcSRalf Baechle }
182384740dcSRalf Baechle
183384740dcSRalf Baechle /*
184384740dcSRalf Baechle * This one is RM7000-specific
185384740dcSRalf Baechle */
invalidate_tcache_page(unsigned long addr)186384740dcSRalf Baechle static inline void invalidate_tcache_page(unsigned long addr)
187384740dcSRalf Baechle {
188384740dcSRalf Baechle cache_op(Page_Invalidate_T, addr);
189384740dcSRalf Baechle }
190384740dcSRalf Baechle
1916baaeadaSPaul Burton #define cache_unroll(times, insn, op, addr, lsize) do { \
1926baaeadaSPaul Burton int i = 0; \
1936baaeadaSPaul Burton unroll(times, _cache_op, insn, op, (addr) + (i++ * (lsize))); \
1946baaeadaSPaul Burton } while (0)
195de8974e3SLeonid Yegoshin
196384740dcSRalf Baechle /* build blast_xxx, blast_xxx_page, blast_xxx_page_indexed */
19743a06847SAaro Koskinen #define __BUILD_BLAST_CACHE(pfx, desc, indexop, hitop, lsize, extra) \
19843a06847SAaro Koskinen static inline void extra##blast_##pfx##cache##lsize(void) \
199384740dcSRalf Baechle { \
200384740dcSRalf Baechle unsigned long start = INDEX_BASE; \
201384740dcSRalf Baechle unsigned long end = start + current_cpu_data.desc.waysize; \
202384740dcSRalf Baechle unsigned long ws_inc = 1UL << current_cpu_data.desc.waybit; \
203384740dcSRalf Baechle unsigned long ws_end = current_cpu_data.desc.ways << \
204384740dcSRalf Baechle current_cpu_data.desc.waybit; \
205384740dcSRalf Baechle unsigned long ws, addr; \
206384740dcSRalf Baechle \
207384740dcSRalf Baechle for (ws = 0; ws < ws_end; ws += ws_inc) \
208384740dcSRalf Baechle for (addr = start; addr < end; addr += lsize * 32) \
2096baaeadaSPaul Burton cache_unroll(32, kernel_cache, indexop, \
2106baaeadaSPaul Burton addr | ws, lsize); \
211384740dcSRalf Baechle } \
212384740dcSRalf Baechle \
21343a06847SAaro Koskinen static inline void extra##blast_##pfx##cache##lsize##_page(unsigned long page) \
214384740dcSRalf Baechle { \
215384740dcSRalf Baechle unsigned long start = page; \
216384740dcSRalf Baechle unsigned long end = page + PAGE_SIZE; \
217384740dcSRalf Baechle \
218384740dcSRalf Baechle do { \
2196baaeadaSPaul Burton cache_unroll(32, kernel_cache, hitop, start, lsize); \
220384740dcSRalf Baechle start += lsize * 32; \
221384740dcSRalf Baechle } while (start < end); \
222384740dcSRalf Baechle } \
223384740dcSRalf Baechle \
22443a06847SAaro Koskinen static inline void extra##blast_##pfx##cache##lsize##_page_indexed(unsigned long page) \
225384740dcSRalf Baechle { \
226384740dcSRalf Baechle unsigned long indexmask = current_cpu_data.desc.waysize - 1; \
227384740dcSRalf Baechle unsigned long start = INDEX_BASE + (page & indexmask); \
228384740dcSRalf Baechle unsigned long end = start + PAGE_SIZE; \
229384740dcSRalf Baechle unsigned long ws_inc = 1UL << current_cpu_data.desc.waybit; \
230384740dcSRalf Baechle unsigned long ws_end = current_cpu_data.desc.ways << \
231384740dcSRalf Baechle current_cpu_data.desc.waybit; \
232384740dcSRalf Baechle unsigned long ws, addr; \
233384740dcSRalf Baechle \
234384740dcSRalf Baechle for (ws = 0; ws < ws_end; ws += ws_inc) \
235384740dcSRalf Baechle for (addr = start; addr < end; addr += lsize * 32) \
2366baaeadaSPaul Burton cache_unroll(32, kernel_cache, indexop, \
2376baaeadaSPaul Burton addr | ws, lsize); \
238384740dcSRalf Baechle }
239384740dcSRalf Baechle
24043a06847SAaro Koskinen __BUILD_BLAST_CACHE(d, dcache, Index_Writeback_Inv_D, Hit_Writeback_Inv_D, 16, )
24143a06847SAaro Koskinen __BUILD_BLAST_CACHE(i, icache, Index_Invalidate_I, Hit_Invalidate_I, 16, )
24243a06847SAaro Koskinen __BUILD_BLAST_CACHE(s, scache, Index_Writeback_Inv_SD, Hit_Writeback_Inv_SD, 16, )
24343a06847SAaro Koskinen __BUILD_BLAST_CACHE(d, dcache, Index_Writeback_Inv_D, Hit_Writeback_Inv_D, 32, )
24443a06847SAaro Koskinen __BUILD_BLAST_CACHE(i, icache, Index_Invalidate_I, Hit_Invalidate_I, 32, )
24543a06847SAaro Koskinen __BUILD_BLAST_CACHE(i, icache, Index_Invalidate_I, Hit_Invalidate_I_Loongson2, 32, loongson2_)
24643a06847SAaro Koskinen __BUILD_BLAST_CACHE(s, scache, Index_Writeback_Inv_SD, Hit_Writeback_Inv_SD, 32, )
24743a06847SAaro Koskinen __BUILD_BLAST_CACHE(d, dcache, Index_Writeback_Inv_D, Hit_Writeback_Inv_D, 64, )
24843a06847SAaro Koskinen __BUILD_BLAST_CACHE(i, icache, Index_Invalidate_I, Hit_Invalidate_I, 64, )
24943a06847SAaro Koskinen __BUILD_BLAST_CACHE(s, scache, Index_Writeback_Inv_SD, Hit_Writeback_Inv_SD, 64, )
25018a8cd63SDavid Daney __BUILD_BLAST_CACHE(d, dcache, Index_Writeback_Inv_D, Hit_Writeback_Inv_D, 128, )
25118a8cd63SDavid Daney __BUILD_BLAST_CACHE(i, icache, Index_Invalidate_I, Hit_Invalidate_I, 128, )
25243a06847SAaro Koskinen __BUILD_BLAST_CACHE(s, scache, Index_Writeback_Inv_SD, Hit_Writeback_Inv_SD, 128, )
253384740dcSRalf Baechle
25443a06847SAaro Koskinen __BUILD_BLAST_CACHE(inv_d, dcache, Index_Writeback_Inv_D, Hit_Invalidate_D, 16, )
25543a06847SAaro Koskinen __BUILD_BLAST_CACHE(inv_d, dcache, Index_Writeback_Inv_D, Hit_Invalidate_D, 32, )
25643a06847SAaro Koskinen __BUILD_BLAST_CACHE(inv_s, scache, Index_Writeback_Inv_SD, Hit_Invalidate_SD, 16, )
25743a06847SAaro Koskinen __BUILD_BLAST_CACHE(inv_s, scache, Index_Writeback_Inv_SD, Hit_Invalidate_SD, 32, )
25843a06847SAaro Koskinen __BUILD_BLAST_CACHE(inv_s, scache, Index_Writeback_Inv_SD, Hit_Invalidate_SD, 64, )
25943a06847SAaro Koskinen __BUILD_BLAST_CACHE(inv_s, scache, Index_Writeback_Inv_SD, Hit_Invalidate_SD, 128, )
260384740dcSRalf Baechle
261de8974e3SLeonid Yegoshin #define __BUILD_BLAST_USER_CACHE(pfx, desc, indexop, hitop, lsize) \
262de8974e3SLeonid Yegoshin static inline void blast_##pfx##cache##lsize##_user_page(unsigned long page) \
263de8974e3SLeonid Yegoshin { \
264de8974e3SLeonid Yegoshin unsigned long start = page; \
265de8974e3SLeonid Yegoshin unsigned long end = page + PAGE_SIZE; \
266de8974e3SLeonid Yegoshin \
267de8974e3SLeonid Yegoshin do { \
2686baaeadaSPaul Burton cache_unroll(32, user_cache, hitop, start, lsize); \
269de8974e3SLeonid Yegoshin start += lsize * 32; \
270de8974e3SLeonid Yegoshin } while (start < end); \
271de8974e3SLeonid Yegoshin }
272de8974e3SLeonid Yegoshin
273de8974e3SLeonid Yegoshin __BUILD_BLAST_USER_CACHE(d, dcache, Index_Writeback_Inv_D, Hit_Writeback_Inv_D,
274de8974e3SLeonid Yegoshin 16)
275de8974e3SLeonid Yegoshin __BUILD_BLAST_USER_CACHE(i, icache, Index_Invalidate_I, Hit_Invalidate_I, 16)
276de8974e3SLeonid Yegoshin __BUILD_BLAST_USER_CACHE(d, dcache, Index_Writeback_Inv_D, Hit_Writeback_Inv_D,
277de8974e3SLeonid Yegoshin 32)
278de8974e3SLeonid Yegoshin __BUILD_BLAST_USER_CACHE(i, icache, Index_Invalidate_I, Hit_Invalidate_I, 32)
279de8974e3SLeonid Yegoshin __BUILD_BLAST_USER_CACHE(d, dcache, Index_Writeback_Inv_D, Hit_Writeback_Inv_D,
280de8974e3SLeonid Yegoshin 64)
281de8974e3SLeonid Yegoshin __BUILD_BLAST_USER_CACHE(i, icache, Index_Invalidate_I, Hit_Invalidate_I, 64)
282de8974e3SLeonid Yegoshin
283384740dcSRalf Baechle /* build blast_xxx_range, protected_blast_xxx_range */
28414bd8c08SRalf Baechle #define __BUILD_BLAST_CACHE_RANGE(pfx, desc, hitop, prot, extra) \
28514bd8c08SRalf Baechle static inline void prot##extra##blast_##pfx##cache##_range(unsigned long start, \
286384740dcSRalf Baechle unsigned long end) \
287384740dcSRalf Baechle { \
288384740dcSRalf Baechle unsigned long lsize = cpu_##desc##_line_size(); \
289384740dcSRalf Baechle unsigned long addr = start & ~(lsize - 1); \
290384740dcSRalf Baechle unsigned long aend = (end - 1) & ~(lsize - 1); \
291384740dcSRalf Baechle \
292384740dcSRalf Baechle while (1) { \
293384740dcSRalf Baechle prot##cache_op(hitop, addr); \
294384740dcSRalf Baechle if (addr == aend) \
295384740dcSRalf Baechle break; \
296384740dcSRalf Baechle addr += lsize; \
297384740dcSRalf Baechle } \
298384740dcSRalf Baechle }
299384740dcSRalf Baechle
30014bd8c08SRalf Baechle __BUILD_BLAST_CACHE_RANGE(d, dcache, Hit_Writeback_Inv_D, protected_, )
30114bd8c08SRalf Baechle __BUILD_BLAST_CACHE_RANGE(i, icache, Hit_Invalidate_I, protected_, )
302de8974e3SLeonid Yegoshin __BUILD_BLAST_CACHE_RANGE(s, scache, Hit_Writeback_Inv_SD, protected_, )
303bad009feSHuacai Chen __BUILD_BLAST_CACHE_RANGE(i, icache, Hit_Invalidate_I_Loongson2, \
304bad009feSHuacai Chen protected_, loongson2_)
30514bd8c08SRalf Baechle __BUILD_BLAST_CACHE_RANGE(d, dcache, Hit_Writeback_Inv_D, , )
30641e62b04SLeonid Yegoshin __BUILD_BLAST_CACHE_RANGE(i, icache, Hit_Invalidate_I, , )
30714bd8c08SRalf Baechle __BUILD_BLAST_CACHE_RANGE(s, scache, Hit_Writeback_Inv_SD, , )
308384740dcSRalf Baechle /* blast_inv_dcache_range */
30914bd8c08SRalf Baechle __BUILD_BLAST_CACHE_RANGE(inv_d, dcache, Hit_Invalidate_D, , )
31014bd8c08SRalf Baechle __BUILD_BLAST_CACHE_RANGE(inv_s, scache, Hit_Invalidate_SD, , )
311384740dcSRalf Baechle
312bb53fdf3SHuacai Chen /* Currently, this is very specific to Loongson-3 */
313bb53fdf3SHuacai Chen #define __BUILD_BLAST_CACHE_NODE(pfx, desc, indexop, hitop, lsize) \
314bb53fdf3SHuacai Chen static inline void blast_##pfx##cache##lsize##_node(long node) \
315bb53fdf3SHuacai Chen { \
316bb53fdf3SHuacai Chen unsigned long start = CAC_BASE | nid_to_addrbase(node); \
317bb53fdf3SHuacai Chen unsigned long end = start + current_cpu_data.desc.waysize; \
318bb53fdf3SHuacai Chen unsigned long ws_inc = 1UL << current_cpu_data.desc.waybit; \
319bb53fdf3SHuacai Chen unsigned long ws_end = current_cpu_data.desc.ways << \
320bb53fdf3SHuacai Chen current_cpu_data.desc.waybit; \
321bb53fdf3SHuacai Chen unsigned long ws, addr; \
322bb53fdf3SHuacai Chen \
323bb53fdf3SHuacai Chen for (ws = 0; ws < ws_end; ws += ws_inc) \
324bb53fdf3SHuacai Chen for (addr = start; addr < end; addr += lsize * 32) \
3256baaeadaSPaul Burton cache_unroll(32, kernel_cache, indexop, \
3266baaeadaSPaul Burton addr | ws, lsize); \
327bb53fdf3SHuacai Chen }
328bb53fdf3SHuacai Chen
329bb53fdf3SHuacai Chen __BUILD_BLAST_CACHE_NODE(s, scache, Index_Writeback_Inv_SD, Hit_Writeback_Inv_SD, 16)
330bb53fdf3SHuacai Chen __BUILD_BLAST_CACHE_NODE(s, scache, Index_Writeback_Inv_SD, Hit_Writeback_Inv_SD, 32)
331bb53fdf3SHuacai Chen __BUILD_BLAST_CACHE_NODE(s, scache, Index_Writeback_Inv_SD, Hit_Writeback_Inv_SD, 64)
332bb53fdf3SHuacai Chen __BUILD_BLAST_CACHE_NODE(s, scache, Index_Writeback_Inv_SD, Hit_Writeback_Inv_SD, 128)
333bb53fdf3SHuacai Chen
334384740dcSRalf Baechle #endif /* _ASM_R4KCACHE_H */
335