root/src/linux/rt2880/linux-2.6.23/arch/mips/mm/c-r4k.c

Revision 12433, 34.0 kB (checked in by BrainSlayer, 5 months ago)

fixes usb issues with some devices

Line 
1 /*
2  * This file is subject to the terms and conditions of the GNU General Public
3  * License.  See the file "COPYING" in the main directory of this archive
4  * for more details.
5  *
6  * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
7  * Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Ralf Baechle (ralf@gnu.org)
8  * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
9  */
10 #include <linux/init.h>
11 #include <linux/kernel.h>
12 #include <linux/sched.h>
13 #include <linux/mm.h>
14 #include <linux/bitops.h>
15
16 #include <asm/bcache.h>
17 #include <asm/bootinfo.h>
18 #include <asm/cache.h>
19 #include <asm/cacheops.h>
20 #include <asm/cpu.h>
21 #include <asm/cpu-features.h>
22 #include <asm/io.h>
23 #include <asm/page.h>
24 #include <asm/pgtable.h>
25 #include <asm/r4kcache.h>
26 #include <asm/sections.h>
27 #include <asm/system.h>
28 #include <asm/mmu_context.h>
29 #include <asm/war.h>
30 #include <asm/cacheflush.h> /* for run_uncached() */
31
32
33 /*
34  * Special Variant of smp_call_function for use by cache functions:
35  *
36  *  o No return value
37  *  o collapses to normal function call on UP kernels
38  *  o collapses to normal function call on systems with a single shared
39  *    primary cache.
40  */
41 static inline void r4k_on_each_cpu(void (*func) (void *info), void *info,
42                                    int retry, int wait)
43 {
44         preempt_disable();
45
46 #if !defined(CONFIG_MIPS_MT_SMP) && !defined(CONFIG_MIPS_MT_SMTC)
47         smp_call_function(func, info, retry, wait);
48 #endif
49         func(info);
50         preempt_enable();
51 }
52
53 /*
54  * Must die.
55  */
56 static unsigned long icache_size __read_mostly;
57 static unsigned long dcache_size __read_mostly;
58 static unsigned long scache_size __read_mostly;
59
60 /*
61  * Dummy cache handling routines for machines without boardcaches
62  */
63 static void cache_noop(void) {}
64
65 static struct bcache_ops no_sc_ops = {
66         .bc_enable = (void *)cache_noop,
67         .bc_disable = (void *)cache_noop,
68         .bc_wback_inv = (void *)cache_noop,
69         .bc_inv = (void *)cache_noop
70 };
71
72 struct bcache_ops *bcops = &no_sc_ops;
73
74 #define cpu_is_r4600_v1_x()     ((read_c0_prid() & 0xfffffff0) == 0x00002010)
75 #define cpu_is_r4600_v2_x()     ((read_c0_prid() & 0xfffffff0) == 0x00002020)
76
77 #define R4600_HIT_CACHEOP_WAR_IMPL                                      \
78 do {                                                                    \
79         if (R4600_V2_HIT_CACHEOP_WAR && cpu_is_r4600_v2_x())            \
80                 *(volatile unsigned long *)CKSEG1;                      \
81         if (R4600_V1_HIT_CACHEOP_WAR)                                   \
82                 __asm__ __volatile__("nop;nop;nop;nop");                \
83 } while (0)
84
85 static void (*r4k_blast_dcache_page)(unsigned long addr);
86
87 static inline void r4k_blast_dcache_page_dc32(unsigned long addr)
88 {
89         R4600_HIT_CACHEOP_WAR_IMPL;
90         blast_dcache32_page(addr);
91 }
92
93 static void __init r4k_blast_dcache_page_setup(void)
94 {
95         unsigned long  dc_lsize = cpu_dcache_line_size();
96
97         if (dc_lsize == 0)
98                 r4k_blast_dcache_page = (void *)cache_noop;
99         else if (dc_lsize == 16)
100                 r4k_blast_dcache_page = blast_dcache16_page;
101         else if (dc_lsize == 32)
102                 r4k_blast_dcache_page = r4k_blast_dcache_page_dc32;
103 }
104
105 static void (* r4k_blast_dcache_page_indexed)(unsigned long addr);
106
107 static void __init r4k_blast_dcache_page_indexed_setup(void)
108 {
109         unsigned long dc_lsize = cpu_dcache_line_size();
110
111         if (dc_lsize == 0)
112                 r4k_blast_dcache_page_indexed = (void *)cache_noop;
113         else if (dc_lsize == 16)
114                 r4k_blast_dcache_page_indexed = blast_dcache16_page_indexed;
115         else if (dc_lsize == 32)
116                 r4k_blast_dcache_page_indexed = blast_dcache32_page_indexed;
117 }
118
119 static void (* r4k_blast_dcache)(void);
120
121 static void __init r4k_blast_dcache_setup(void)
122 {
123         unsigned long dc_lsize = cpu_dcache_line_size();
124
125         if (dc_lsize == 0)
126                 r4k_blast_dcache = (void *)cache_noop;
127         else if (dc_lsize == 16)
128                 r4k_blast_dcache = blast_dcache16;
129         else if (dc_lsize == 32)
130                 r4k_blast_dcache = blast_dcache32;
131 }
132
133 /* force code alignment (used for TX49XX_ICACHE_INDEX_INV_WAR) */
134 #define JUMP_TO_ALIGN(order) \
135         __asm__ __volatile__( \
136                 "b\t1f\n\t" \
137                 ".align\t" #order "\n\t" \
138                 "1:\n\t" \
139                 )
140 #define CACHE32_UNROLL32_ALIGN  JUMP_TO_ALIGN(10) /* 32 * 32 = 1024 */
141 #define CACHE32_UNROLL32_ALIGN2 JUMP_TO_ALIGN(11)
142
143 static inline void blast_r4600_v1_icache32(void)
144 {
145         unsigned long flags;
146
147         local_irq_save(flags);
148         blast_icache32();
149         local_irq_restore(flags);
150 }
151
152 static inline void tx49_blast_icache32(void)
153 {
154         unsigned long start = INDEX_BASE;
155         unsigned long end = start + current_cpu_data.icache.waysize;
156         unsigned long ws_inc = 1UL << current_cpu_data.icache.waybit;
157         unsigned long ws_end = current_cpu_data.icache.ways <<
158                                current_cpu_data.icache.waybit;
159         unsigned long ws, addr;
160
161         CACHE32_UNROLL32_ALIGN2;
162         /* I'm in even chunk.  blast odd chunks */
163         for (ws = 0; ws < ws_end; ws += ws_inc)
164                 for (addr = start + 0x400; addr < end; addr += 0x400 * 2)
165                         cache32_unroll32(addr|ws,Index_Invalidate_I);
166         CACHE32_UNROLL32_ALIGN;
167         /* I'm in odd chunk.  blast even chunks */
168         for (ws = 0; ws < ws_end; ws += ws_inc)
169                 for (addr = start; addr < end; addr += 0x400 * 2)
170                         cache32_unroll32(addr|ws,Index_Invalidate_I);
171 }
172
173 static inline void blast_icache32_r4600_v1_page_indexed(unsigned long page)
174 {
175         unsigned long flags;
176
177         local_irq_save(flags);
178         blast_icache32_page_indexed(page);
179         local_irq_restore(flags);
180 }
181
182 static inline void tx49_blast_icache32_page_indexed(unsigned long page)
183 {
184         unsigned long indexmask = current_cpu_data.icache.waysize - 1;
185         unsigned long start = INDEX_BASE + (page & indexmask);
186         unsigned long end = start + PAGE_SIZE;
187         unsigned long ws_inc = 1UL << current_cpu_data.icache.waybit;
188         unsigned long ws_end = current_cpu_data.icache.ways <<
189                                current_cpu_data.icache.waybit;
190         unsigned long ws, addr;
191
192         CACHE32_UNROLL32_ALIGN2;
193         /* I'm in even chunk.  blast odd chunks */
194         for (ws = 0; ws < ws_end; ws += ws_inc)
195                 for (addr = start + 0x400; addr < end; addr += 0x400 * 2)
196                         cache32_unroll32(addr|ws,Index_Invalidate_I);
197         CACHE32_UNROLL32_ALIGN;
198         /* I'm in odd chunk.  blast even chunks */
199         for (ws = 0; ws < ws_end; ws += ws_inc)
200                 for (addr = start; addr < end; addr += 0x400 * 2)
201                         cache32_unroll32(addr|ws,Index_Invalidate_I);
202 }
203
204 static void (* r4k_blast_icache_page)(unsigned long addr);
205
206 static void __init r4k_blast_icache_page_setup(void)
207 {
208         unsigned long ic_lsize = cpu_icache_line_size();
209
210         if (ic_lsize == 0)
211                 r4k_blast_icache_page = (void *)cache_noop;
212         else if (ic_lsize == 16)
213                 r4k_blast_icache_page = blast_icache16_page;
214         else if (ic_lsize == 32)
215                 r4k_blast_icache_page = blast_icache32_page;
216         else if (ic_lsize == 64)
217                 r4k_blast_icache_page = blast_icache64_page;
218 }
219
220
221 static void (* r4k_blast_icache_page_indexed)(unsigned long addr);
222
223 static void __init r4k_blast_icache_page_indexed_setup(void)
224 {
225         unsigned long ic_lsize = cpu_icache_line_size();
226
227         if (ic_lsize == 0)
228                 r4k_blast_icache_page_indexed = (void *)cache_noop;
229         else if (ic_lsize == 16)
230                 r4k_blast_icache_page_indexed = blast_icache16_page_indexed;
231         else if (ic_lsize == 32) {
232                 if (R4600_V1_INDEX_ICACHEOP_WAR && cpu_is_r4600_v1_x())
233                         r4k_blast_icache_page_indexed =
234                                 blast_icache32_r4600_v1_page_indexed;
235                 else if (TX49XX_ICACHE_INDEX_INV_WAR)
236                         r4k_blast_icache_page_indexed =
237                                 tx49_blast_icache32_page_indexed;
238                 else
239                         r4k_blast_icache_page_indexed =
240                                 blast_icache32_page_indexed;
241         } else if (ic_lsize == 64)
242                 r4k_blast_icache_page_indexed = blast_icache64_page_indexed;
243 }
244
245 static void (* r4k_blast_icache)(void);
246
247 static void __init r4k_blast_icache_setup(void)
248 {
249         unsigned long ic_lsize = cpu_icache_line_size();
250
251         if (ic_lsize == 0)
252                 r4k_blast_icache = (void *)cache_noop;
253         else if (ic_lsize == 16)
254                 r4k_blast_icache = blast_icache16;
255         else if (ic_lsize == 32) {
256                 if (R4600_V1_INDEX_ICACHEOP_WAR && cpu_is_r4600_v1_x())
257                         r4k_blast_icache = blast_r4600_v1_icache32;
258                 else if (TX49XX_ICACHE_INDEX_INV_WAR)
259                         r4k_blast_icache = tx49_blast_icache32;
260                 else
261                         r4k_blast_icache = blast_icache32;
262         } else if (ic_lsize == 64)
263                 r4k_blast_icache = blast_icache64;
264 }
265
266 static void (* r4k_blast_scache_page)(unsigned long addr);
267
268 static void __init r4k_blast_scache_page_setup(void)
269 {
270         unsigned long sc_lsize = cpu_scache_line_size();
271
272         if (scache_size == 0)
273                 r4k_blast_scache_page = (void *)cache_noop;
274         else if (sc_lsize == 16)
275                 r4k_blast_scache_page = blast_scache16_page;
276         else if (sc_lsize == 32)
277                 r4k_blast_scache_page = blast_scache32_page;
278         else if (sc_lsize == 64)
279                 r4k_blast_scache_page = blast_scache64_page;
280         else if (sc_lsize == 128)
281                 r4k_blast_scache_page = blast_scache128_page;
282 }
283
284 static void (* r4k_blast_scache_page_indexed)(unsigned long addr);
285
286 static void __init r4k_blast_scache_page_indexed_setup(void)
287 {
288         unsigned long sc_lsize = cpu_scache_line_size();
289
290         if (scache_size == 0)
291                 r4k_blast_scache_page_indexed = (void *)cache_noop;
292         else if (sc_lsize == 16)
293                 r4k_blast_scache_page_indexed = blast_scache16_page_indexed;
294         else if (sc_lsize == 32)
295                 r4k_blast_scache_page_indexed = blast_scache32_page_indexed;
296         else if (sc_lsize == 64)
297                 r4k_blast_scache_page_indexed = blast_scache64_page_indexed;
298         else if (sc_lsize == 128)
299                 r4k_blast_scache_page_indexed = blast_scache128_page_indexed;
300 }
301
302 static void (* r4k_blast_scache)(void);
303
304 static void __init r4k_blast_scache_setup(void)
305 {
306         unsigned long sc_lsize = cpu_scache_line_size();
307
308         if (scache_size == 0)
309                 r4k_blast_scache = (void *)cache_noop;
310         else if (sc_lsize == 16)
311                 r4k_blast_scache = blast_scache16;
312         else if (sc_lsize == 32)
313                 r4k_blast_scache = blast_scache32;
314         else if (sc_lsize == 64)
315                 r4k_blast_scache = blast_scache64;
316         else if (sc_lsize == 128)
317                 r4k_blast_scache = blast_scache128;
318 }
319
320 /*
321  * This is former mm's flush_cache_all() which really should be
322  * flush_cache_vunmap these days ...
323  */
324 static inline void local_r4k_flush_cache_all(void * args)
325 {
326         r4k_blast_dcache();
327 }
328
329 static void r4k_flush_cache_all(void)
330 {
331         if (!cpu_has_dc_aliases)
332                 return;
333
334         r4k_on_each_cpu(local_r4k_flush_cache_all, NULL, 1, 1);
335 }
336
337 static inline void local_r4k___flush_cache_all(void * args)
338 {
339 #if defined(CONFIG_CPU_LOONGSON2)
340         r4k_blast_scache();
341         return;
342 #endif
343         r4k_blast_dcache();
344         r4k_blast_icache();
345
346         switch (current_cpu_data.cputype) {
347         case CPU_R4000SC:
348         case CPU_R4000MC:
349         case CPU_R4400SC:
350         case CPU_R4400MC:
351         case CPU_R10000:
352         case CPU_R12000:
353         case CPU_R14000:
354                 r4k_blast_scache();
355         }
356 }
357
358 static void r4k___flush_cache_all(void)
359 {
360         r4k_on_each_cpu(local_r4k___flush_cache_all, NULL, 1, 1);
361 }
362
363 static inline int has_valid_asid(const struct mm_struct *mm)
364 {
365 #if defined(CONFIG_MIPS_MT_SMP) || defined(CONFIG_MIPS_MT_SMTC)
366         int i;
367
368         for_each_online_cpu(i)
369                 if (cpu_context(i, mm))
370                         return 1;
371
372         return 0;
373 #else
374         return cpu_context(smp_processor_id(), mm);
375 #endif
376 }
377
378 static inline void local_r4k_flush_cache_range(void * args)
379 {
380         struct vm_area_struct *vma = args;
381
382         if (!(has_valid_asid(vma->vm_mm)))
383                 return;
384
385         r4k_blast_dcache();
386 }
387
388 static void r4k_flush_cache_range(struct vm_area_struct *vma,
389         unsigned long start, unsigned long end)
390 {
391         if (!cpu_has_dc_aliases)
392                 return;
393
394         r4k_on_each_cpu(local_r4k_flush_cache_range, vma, 1, 1);
395 }
396
397 static inline void local_r4k_flush_cache_mm(void * args)
398 {
399         struct mm_struct *mm = args;
400
401         if (!has_valid_asid(mm))
402                 return;
403
404         /*
405          * Kludge alert.  For obscure reasons R4000SC and R4400SC go nuts if we
406          * only flush the primary caches but R10000 and R12000 behave sane ...
407          * R4000SC and R4400SC indexed S-cache ops also invalidate primary
408          * caches, so we can bail out early.
409          */
410         if (current_cpu_data.cputype == CPU_R4000SC ||
411             current_cpu_data.cputype == CPU_R4000MC ||
412             current_cpu_data.cputype == CPU_R4400SC ||
413             current_cpu_data.cputype == CPU_R4400MC) {
414                 r4k_blast_scache();
415                 return;
416         }
417
418         r4k_blast_dcache();
419 }
420
421 static void r4k_flush_cache_mm(struct mm_struct *mm)
422 {
423         if (!cpu_has_dc_aliases)
424                 return;
425
426         r4k_on_each_cpu(local_r4k_flush_cache_mm, mm, 1, 1);
427 }
428
429 struct flush_cache_page_args {
430         struct vm_area_struct *vma;
431         unsigned long addr;
432         unsigned long pfn;
433 };
434
435 static inline void local_r4k_flush_cache_page(void *args)
436 {
437         struct flush_cache_page_args *fcp_args = args;
438         struct vm_area_struct *vma = fcp_args->vma;
439         unsigned long addr = fcp_args->addr;
440         unsigned long paddr = fcp_args->pfn << PAGE_SHIFT;
441         int exec = vma->vm_flags & VM_EXEC;
442         struct mm_struct *mm = vma->vm_mm;
443         pgd_t *pgdp;
444         pud_t *pudp;
445         pmd_t *pmdp;
446         pte_t *ptep;
447
448         /*
449          * If ownes no valid ASID yet, cannot possibly have gotten
450          * this page into the cache.
451          */
452         if (!has_valid_asid(mm))
453                 return;
454
455         addr &= PAGE_MASK;
456         pgdp = pgd_offset(mm, addr);
457         pudp = pud_offset(pgdp, addr);
458         pmdp = pmd_offset(pudp, addr);
459         ptep = pte_offset(pmdp, addr);
460
461         /*
462          * If the page isn't marked valid, the page cannot possibly be
463          * in the cache.
464          */
465         if (!(pte_val(*ptep) & _PAGE_PRESENT))
466                 return;
467
468         /*
469          * Doing flushes for another ASID than the current one is
470          * too difficult since stupid R4k caches do a TLB translation
471          * for every cache flush operation.  So we do indexed flushes
472          * in that case, which doesn't overly flush the cache too much.
473          */
474         if ((mm == current->active_mm) && (pte_val(*ptep) & _PAGE_VALID)) {
475                 if (cpu_has_dc_aliases || (exec && !cpu_has_ic_fills_f_dc)) {
476                         r4k_blast_dcache_page(addr);
477                         if (exec && !cpu_icache_snoops_remote_store)
478                                 r4k_blast_scache_page(addr);
479                 }
480                 if (exec)
481                         r4k_blast_icache_page(addr);
482
483                 return;
484         }
485
486         /*
487          * Do indexed flush, too much work to get the (possible) TLB refills
488          * to work correctly.
489          */
490         if (cpu_has_dc_aliases || (exec && !cpu_has_ic_fills_f_dc)) {
491                 r4k_blast_dcache_page_indexed(cpu_has_pindexed_dcache ?
492                                               paddr : addr);
493                 if (exec && !cpu_icache_snoops_remote_store) {
494                         r4k_blast_scache_page_indexed(paddr);
495                 }
496         }
497         if (exec) {
498                 if (cpu_has_vtag_icache && mm == current->active_mm) {
499                         int cpu = smp_processor_id();
500
501                         if (cpu_context(cpu, mm) != 0)
502                                 drop_mmu_context(mm, cpu);
503                 } else
504                         r4k_blast_icache_page_indexed(addr);
505         }
506 }
507
508 static void r4k_flush_cache_page(struct vm_area_struct *vma,
509         unsigned long addr, unsigned long pfn)
510 {
511         struct flush_cache_page_args args;
512
513         args.vma = vma;
514         args.addr = addr;
515         args.pfn = pfn;
516
517         r4k_on_each_cpu(local_r4k_flush_cache_page, &args, 1, 1);
518 }
519
520 static inline void local_r4k_flush_data_cache_page(void * addr)
521 {
522         r4k_blast_dcache_page((unsigned long) addr);
523 }
524
525 static void r4k_flush_data_cache_page(unsigned long addr)
526 {
527         r4k_on_each_cpu(local_r4k_flush_data_cache_page, (void *) addr, 1, 1);
528 }
529
530 struct flush_icache_range_args {
531         unsigned long start;
532         unsigned long end;
533 };
534
535 static inline void local_r4k_flush_icache_range(void *args)
536 {
537         struct flush_icache_range_args *fir_args = args;
538         unsigned long start = fir_args->start;
539         unsigned long end = fir_args->end;
540
541         if (!cpu_has_ic_fills_f_dc) {
542                 if (end - start >= dcache_size) {
543                         r4k_blast_dcache();
544                 } else {
545                         R4600_HIT_CACHEOP_WAR_IMPL;
546                         protected_blast_dcache_range(start, end);
547                 }
548
549                 if (!cpu_icache_snoops_remote_store && scache_size) {
550                         if (end - start > scache_size)
551                                 r4k_blast_scache();
552                         else
553                                 protected_blast_scache_range(start, end);
554                 }
555         }
556
557         if (end - start > icache_size)
558                 r4k_blast_icache();
559         else
560                 protected_blast_icache_range(start, end);
561 }
562
563 static void r4k_flush_icache_range(unsigned long start, unsigned long end)
564 {
565         struct flush_icache_range_args args;
566
567         args.start = start;
568         args.end = end;
569
570         r4k_on_each_cpu(local_r4k_flush_icache_range, &args, 1, 1);
571         instruction_hazard();
572 }
573
574 #ifdef CONFIG_DMA_NONCOHERENT
575
576 static void r4k_dma_cache_wback_inv(unsigned long addr, unsigned long size)
577 {
578         /* Catch bad driver code */
579         BUG_ON(size == 0);
580
581         if (cpu_has_inclusive_pcaches) {
582                 if (size >= scache_size)
583                         r4k_blast_scache();
584                 else
585                         blast_scache_range(addr, addr + size);
586                 return;
587         }
588
589         /*
590          * Either no secondary cache or the available caches don't have the
591          * subset property so we have to flush the primary caches
592          * explicitly
593          */
594         if (size >= dcache_size) {
595                 r4k_blast_dcache();
596         } else {
597                 R4600_HIT_CACHEOP_WAR_IMPL;
598                 blast_dcache_range(addr, addr + size);
599         }
600
601         bc_wback_inv(addr, size);
602 }
603
604 static void r4k_dma_cache_inv(unsigned long addr, unsigned long size)
605 {
606         /* Catch bad driver code */
607         BUG_ON(size == 0);
608
609         if (cpu_has_inclusive_pcaches) {
610                 if (size >= scache_size)
611                         r4k_blast_scache();
612                 else
613                         blast_scache_range(addr, addr + size);
614                 return;
615         }
616
617         if (size >= dcache_size) {
618                 r4k_blast_dcache();
619         } else {
620                 R4600_HIT_CACHEOP_WAR_IMPL;
621                 blast_dcache_range(addr, addr + size);
622         }
623
624         bc_inv(addr, size);
625 }
626 #endif /* CONFIG_DMA_NONCOHERENT */
627
628 /*
629  * While we're protected against bad userland addresses we don't care
630  * very much about what happens in that case.  Usually a segmentation
631  * fault will dump the process later on anyway ...
632  */
633 static void local_r4k_flush_cache_sigtramp(void * arg)
634 {
635         unsigned long ic_lsize = cpu_icache_line_size();
636         unsigned long dc_lsize = cpu_dcache_line_size();
637         unsigned long sc_lsize = cpu_scache_line_size();
638         unsigned long addr = (unsigned long) arg;
639
640         R4600_HIT_CACHEOP_WAR_IMPL;
641         if (dc_lsize)
642                 protected_writeback_dcache_line(addr & ~(dc_lsize - 1));
643         if (!cpu_icache_snoops_remote_store && scache_size)
644                 protected_writeback_scache_line(addr & ~(sc_lsize - 1));
645         if (ic_lsize)
646                 protected_flush_icache_line(addr & ~(ic_lsize - 1));
647         if (MIPS4K_ICACHE_REFILL_WAR) {
648                 __asm__ __volatile__ (
649                         ".set push\n\t"
650                         ".set noat\n\t"
651                         ".set mips3\n\t"
652 #ifdef CONFIG_32BIT
653                         "la     $at,1f\n\t"
654 #endif
655 #ifdef CONFIG_64BIT
656                         "dla    $at,1f\n\t"
657 #endif
658                         "cache  %0,($at)\n\t"
659                         "nop; nop; nop\n"
660                         "1:\n\t"
661                         ".set pop"
662                         :
663                         : "i" (Hit_Invalidate_I));
664         }
665         if (MIPS_CACHE_SYNC_WAR)
666                 __asm__ __volatile__ ("sync");
667 }
668
669 static void r4k_flush_cache_sigtramp(unsigned long addr)
670 {
671         r4k_on_each_cpu(local_r4k_flush_cache_sigtramp, (void *) addr, 1, 1);
672 }
673
674 static void r4k_flush_icache_all(void)
675 {
676         if (cpu_has_vtag_icache)
677                 r4k_blast_icache();
678 }
679
680 static inline void rm7k_erratum31(void)
681 {
682         const unsigned long ic_lsize = 32;
683         unsigned long addr;
684
685         /* RM7000 erratum #31. The icache is screwed at startup. */
686         write_c0_taglo(0);
687         write_c0_taghi(0);
688
689         for (addr = INDEX_BASE; addr <= INDEX_BASE + 4096; addr += ic_lsize) {
690                 __asm__ __volatile__ (
691                         ".set push\n\t"
692                         ".set noreorder\n\t"
693                         ".set mips3\n\t"
694                         "cache\t%1, 0(%0)\n\t"
695                         "cache\t%1, 0x1000(%0)\n\t"
696                         "cache\t%1, 0x2000(%0)\n\t"
697                         "cache\t%1, 0x3000(%0)\n\t"
698                         "cache\t%2, 0(%0)\n\t"
699                         "cache\t%2, 0x1000(%0)\n\t"
700                         "cache\t%2, 0x2000(%0)\n\t"
701                         "cache\t%2, 0x3000(%0)\n\t"
702                         "cache\t%1, 0(%0)\n\t"
703                         "cache\t%1, 0x1000(%0)\n\t"
704                         "cache\t%1, 0x2000(%0)\n\t"
705                         "cache\t%1, 0x3000(%0)\n\t"
706                         ".set pop\n"
707                         :
708                         : "r" (addr), "i" (Index_Store_Tag_I), "i" (Fill));
709         }
710 }
711
712 static char *way_string[] __initdata = { NULL, "direct mapped", "2-way",
713         "3-way", "4-way", "5-way", "6-way", "7-way", "8-way"
714 };
715
716 static void __init probe_pcache(void)
717 {
718         struct cpuinfo_mips *c = &current_cpu_data;
719         unsigned int config = read_c0_config();
720         unsigned int prid = read_c0_prid();
721         unsigned long config1;
722         unsigned int lsize;
723
724         switch (c->cputype) {
725         case CPU_R4600:                 /* QED style two way caches? */
726         case CPU_R4700:
727         case CPU_R5000:
728         case CPU_NEVADA:
729                 icache_size = 1 << (12 + ((config & CONF_IC) >> 9));
730                 c->icache.linesz = 16 << ((config & CONF_IB) >> 5);
731                 c->icache.ways = 2;
732                 c->icache.waybit = __ffs(icache_size/2);
733
734                 dcache_size = 1 << (12 + ((config & CONF_DC) >> 6));
735                 c->dcache.linesz = 16 << ((config & CONF_DB) >> 4);
736                 c->dcache.ways = 2;
737                 c->dcache.waybit= __ffs(dcache_size/2);
738
739                 c->options |= MIPS_CPU_CACHE_CDEX_P;
740                 break;
741
742         case CPU_R5432:
743         case CPU_R5500:
744                 icache_size = 1 << (12 + ((config & CONF_IC) >> 9));
745                 c->icache.linesz = 16 << ((config & CONF_IB) >> 5);
746                 c->icache.ways = 2;
747                 c->icache.waybit= 0;
748
749                 dcache_size = 1 << (12 + ((config & CONF_DC) >> 6));
750                 c->dcache.linesz = 16 << ((config & CONF_DB) >> 4);
751                 c->dcache.ways = 2;
752                 c->dcache.waybit = 0;
753
754                 c->options |= MIPS_CPU_CACHE_CDEX_P;
755                 break;
756
757         case CPU_TX49XX:
758                 icache_size = 1 << (12 + ((config & CONF_IC) >> 9));
759                 c->icache.linesz = 16 << ((config & CONF_IB) >> 5);
760                 c->icache.ways = 4;
761                 c->icache.waybit= 0;
762
763                 dcache_size = 1 << (12 + ((config & CONF_DC) >> 6));
764                 c->dcache.linesz = 16 << ((config & CONF_DB) >> 4);
765                 c->dcache.ways = 4;
766                 c->dcache.waybit = 0;
767
768                 c->options |= MIPS_CPU_CACHE_CDEX_P;
769                 c->options |= MIPS_CPU_PREFETCH;
770                 break;
771
772         case CPU_R4000PC:
773         case CPU_R4000SC:
774         case CPU_R4000MC:
775         case CPU_R4400PC:
776         case CPU_R4400SC:
777         case CPU_R4400MC:
778         case CPU_R4300:
779                 icache_size = 1 << (12 + ((config & CONF_IC) >> 9));
780                 c->icache.linesz = 16 << ((config & CONF_IB) >> 5);
781                 c->icache.ways = 1;
782                 c->icache.waybit = 0;   /* doesn't matter */
783
784                 dcache_size = 1 << (12 + ((config & CONF_DC) >> 6));
785                 c->dcache.linesz = 16 << ((config & CONF_DB) >> 4);
786                 c->dcache.ways = 1;
787                 c->dcache.waybit = 0;   /* does not matter */
788
789                 c->options |= MIPS_CPU_CACHE_CDEX_P;
790                 break;
791
792         case CPU_R10000:
793         case CPU_R12000:
794         case CPU_R14000:
795                 icache_size = 1 << (12 + ((config & R10K_CONF_IC) >> 29));
796                 c->icache.linesz = 64;
797                 c->icache.ways = 2;
798                 c->icache.waybit = 0;
799
800                 dcache_size = 1 << (12 + ((config & R10K_CONF_DC) >> 26));
801                 c->dcache.linesz = 32;
802                 c->dcache.ways = 2;
803                 c->dcache.waybit = 0;
804
805                 c->options |= MIPS_CPU_PREFETCH;
806                 break;
807
808         case CPU_VR4133:
809                 write_c0_config(config & ~VR41_CONF_P4K);
810         case CPU_VR4131:
811                 /* Workaround for cache instruction bug of VR4131 */
812                 if (c->processor_id == 0x0c80U || c->processor_id == 0x0c81U ||
813                     c->processor_id == 0x0c82U) {
814                         config |= 0x00400000U;
815                         if (c->processor_id == 0x0c80U)
816                                 config |= VR41_CONF_BP;
817                         write_c0_config(config);
818                 } else
819                         c->options |= MIPS_CPU_CACHE_CDEX_P;
820
821                 icache_size = 1 << (10 + ((config & CONF_IC) >> 9));
822                 c->icache.linesz = 16 << ((config & CONF_IB) >> 5);
823                 c->icache.ways = 2;
824                 c->icache.waybit = __ffs(icache_size/2);
825
826                 dcache_size = 1 << (10 + ((config & CONF_DC) >> 6));
827                 c->dcache.linesz = 16 << ((config & CONF_DB) >> 4);
828                 c->dcache.ways = 2;
829                 c->dcache.waybit = __ffs(dcache_size/2);
830                 break;
831
832         case CPU_VR41XX:
833         case CPU_VR4111:
834         case CPU_VR4121:
835         case CPU_VR4122:
836         case CPU_VR4181:
837         case CPU_VR4181A:
838                 icache_size = 1 << (10 + ((config & CONF_IC) >> 9));
839                 c->icache.linesz = 16 << ((config & CONF_IB) >> 5);
840                 c->icache.ways = 1;
841                 c->icache.waybit = 0;   /* doesn't matter */
842
843                 dcache_size = 1 << (10 + ((config & CONF_DC) >> 6));
844                 c->dcache.linesz = 16 << ((config & CONF_DB) >> 4);
845                 c->dcache.ways = 1;
846                 c->dcache.waybit = 0;   /* does not matter */
847
848                 c->options |= MIPS_CPU_CACHE_CDEX_P;
849                 break;
850
851         case CPU_RM7000:
852                 rm7k_erratum31();
853
854         case CPU_RM9000:
855                 icache_size = 1 << (12 + ((config & CONF_IC) >> 9));
856                 c->icache.linesz = 16 << ((config & CONF_IB) >> 5);
857                 c->icache.ways = 4;
858                 c->icache.waybit = __ffs(icache_size / c->icache.ways);
859
860                 dcache_size = 1 << (12 + ((config & CONF_DC) >> 6));
861                 c->dcache.linesz = 16 << ((config & CONF_DB) >> 4);
862                 c->dcache.ways = 4;
863                 c->dcache.waybit = __ffs(dcache_size / c->dcache.ways);
864
865 #if !defined(CONFIG_SMP) || !defined(RM9000_CDEX_SMP_WAR)
866                 c->options |= MIPS_CPU_CACHE_CDEX_P;
867 #endif
868                 c->options |= MIPS_CPU_PREFETCH;
869                 break;
870
871         case CPU_LOONGSON2:
872                 icache_size = 1 << (12 + ((config & CONF_IC) >> 9));
873                 c->icache.linesz = 16 << ((config & CONF_IB) >> 5);
874                 if (prid & 0x3)
875                         c->icache.ways = 4;
876                 else
877                         c->icache.ways = 2;
878                 c->icache.waybit = 0;
879
880                 dcache_size = 1 << (12 + ((config & CONF_DC) >> 6));
881                 c->dcache.linesz = 16 << ((config & CONF_DB) >> 4);
882                 if (prid & 0x3)
883                         c->dcache.ways = 4;
884                 else
885                         c->dcache.ways = 2;
886                 c->dcache.waybit = 0;
887                 break;
888
889         default:
890                 if (!(config & MIPS_CONF_M))
891                         panic("Don't know how to probe P-caches on this cpu.");
892
893                 /*
894                  * So we seem to be a MIPS32 or MIPS64 CPU
895                  * So let's probe the I-cache ...
896                  */
897                 config1 = read_c0_config1();
898
899                 if ((lsize = ((config1 >> 19) & 7)))
900                         c->icache.linesz = 2 << lsize;
901                 else
902                         c->icache.linesz = lsize;
903                 c->icache.sets = 64 << ((config1 >> 22) & 7);
904                 c->icache.ways = 1 + ((config1 >> 16) & 7);
905
906                 icache_size = c->icache.sets *
907                               c->icache.ways *
908                               c->icache.linesz;
909                 c->icache.waybit = __ffs(icache_size/c->icache.ways);
910
911                 if (config & 0x8)               /* VI bit */
912                         c->icache.flags |= MIPS_CACHE_VTAG;
913
914                 /*
915                  * Now probe the MIPS32 / MIPS64 data cache.
916                  */
917                 c->dcache.flags = 0;
918
919                 if ((lsize = ((config1 >> 10) & 7)))
920                         c->dcache.linesz = 2 << lsize;
921                 else
922                         c->dcache.linesz= lsize;
923                 c->dcache.sets = 64 << ((config1 >> 13) & 7);
924                 c->dcache.ways = 1 + ((config1 >> 7) & 7);
925
926                 dcache_size = c->dcache.sets *
927                               c->dcache.ways *
928                               c->dcache.linesz;
929                 c->dcache.waybit = __ffs(dcache_size/c->dcache.ways);
930
931 #ifdef CONFIG_CPU_HAS_PREFETCH
932                 c->options |= MIPS_CPU_PREFETCH;
933 #endif
934                 break;
935         }
936
937         /*
938          * Processor configuration sanity check for the R4000SC erratum
939          * #5.  With page sizes larger than 32kB there is no possibility
940          * to get a VCE exception anymore so we don't care about this
941          * misconfiguration.  The case is rather theoretical anyway;
942          * presumably no vendor is shipping his hardware in the "bad"
943          * configuration.
944          */
945         if ((prid & 0xff00) == PRID_IMP_R4000 && (prid & 0xff) < 0x40 &&
946             !(config & CONF_SC) && c->icache.linesz != 16 &&
947             PAGE_SIZE <= 0x8000)
948                 panic("Improper R4000SC processor configuration detected");
949
950         /* compute a couple of other cache variables */
951         c->icache.waysize = icache_size / c->icache.ways;
952         c->dcache.waysize = dcache_size / c->dcache.ways;
953
954         c->icache.sets = c->icache.linesz ?
955                 icache_size / (c->icache.linesz * c->icache.ways) : 0;
956         c->dcache.sets = c->dcache.linesz ?
957                 dcache_size / (c->dcache.linesz * c->dcache.ways) : 0;
958
959         /*
960          * R10000 and R12000 P-caches are odd in a positive way.  They're 32kB
961          * 2-way virtually indexed so normally would suffer from aliases.  So
962          * normally they'd suffer from aliases but magic in the hardware deals
963          * with that for us so we don't need to take care ourselves.
964          */
965         switch (c->cputype) {
966         case CPU_20KC:
967         case CPU_25KF:
968                 c->dcache.flags |= MIPS_CACHE_PINDEX;
969         case CPU_R10000:
970         case CPU_R12000:
971         case CPU_R14000:
972         case CPU_SB1:
973                 break;
974         case CPU_24K:
975         case CPU_34K:
976         case CPU_74K:
977                 if ((read_c0_config7() & (1 << 16))) {
978                         /* effectively physically indexed dcache,
979                            thus no virtual aliases. */
980                         c->dcache.flags |= MIPS_CACHE_PINDEX;
981                         break;
982                 }
983         default:
984                 if (c->dcache.waysize > PAGE_SIZE)
985                         c->dcache.flags |= MIPS_CACHE_ALIASES;
986         }
987
988         switch (c->cputype) {
989         case CPU_20KC:
990                 /*
991                  * Some older 20Kc chips doesn't have the 'VI' bit in
992                  * the config register.
993                  */
994                 c->icache.flags |= MIPS_CACHE_VTAG;
995                 break;
996
997         case CPU_AU1000:
998         case CPU_AU1500:
999         case CPU_AU1100:
1000         case CPU_AU1550:
1001         case CPU_AU1200:
1002                 c->icache.flags |= MIPS_CACHE_IC_F_DC;
1003                 break;
1004         }
1005
1006 #ifdef  CONFIG_CPU_LOONGSON2
1007         /*
1008          * LOONGSON2 has 4 way icache, but when using indexed cache op,
1009          * one op will act on all 4 ways
1010          */
1011         c->icache.ways = 1;
1012 #endif
1013
1014         printk("Primary instruction cache %ldkB, %s, %s, linesize %d bytes.\n",
1015                icache_size >> 10,
1016                cpu_has_vtag_icache ? "virtually tagged" : "physically tagged",
1017                way_string[c->icache.ways], c->icache.linesz);
1018
1019         printk("Primary data cache %ldkB, %s, linesize %d bytes.\n",
1020                dcache_size >> 10, way_string[c->dcache.ways], c->dcache.linesz);
1021 }
1022
1023 /*
1024  * If you even _breathe_ on this function, look at the gcc output and make sure
1025  * it does not pop things on and off the stack for the cache sizing loop that
1026  * executes in KSEG1 space or else you will crash and burn badly.  You have
1027  * been warned.
1028  */
1029 static int __init probe_scache(void)
1030 {
1031         unsigned long flags, addr, begin, end, pow2;
1032         unsigned int config = read_c0_config();
1033         struct cpuinfo_mips *c = &current_cpu_data;
1034         int tmp;
1035
1036         if (config & CONF_SC)
1037                 return 0;
1038
1039         begin = (unsigned long) &_stext;
1040         begin &= ~((4 * 1024 * 1024) - 1);
1041         end = begin + (4 * 1024 * 1024);
1042
1043         /*
1044          * This is such a bitch, you'd think they would make it easy to do
1045          * this.  Away you daemons of stupidity!
1046          */
1047         local_irq_save(flags);
1048
1049         /* Fill each size-multiple cache line with a valid tag. */
1050         pow2 = (64 * 1024);
1051         for (addr = begin; addr < end; addr = (begin + pow2)) {
1052                 unsigned long *p = (unsigned long *) addr;
1053                 __asm__ __volatile__("nop" : : "r" (*p)); /* whee... */
1054                 pow2 <<= 1;
1055         }
1056
1057         /* Load first line with zero (therefore invalid) tag. */
1058         write_c0_taglo(0);
1059         write_c0_taghi(0);
1060         __asm__ __volatile__("nop; nop; nop; nop;"); /* avoid the hazard */
1061         cache_op(Index_Store_Tag_I, begin);
1062         cache_op(Index_Store_Tag_D, begin);
1063         cache_op(Index_Store_Tag_SD, begin);
1064
1065         /* Now search for the wrap around point. */
1066         pow2 = (128 * 1024);
1067         tmp = 0;
1068         for (addr = begin + (128 * 1024); addr < end; addr = begin + pow2) {
1069                 cache_op(Index_Load_Tag_SD, addr);
1070                 __asm__ __volatile__("nop; nop; nop; nop;"); /* hazard... */
1071                 if (!read_c0_taglo())
1072                         break;
1073                 pow2 <<= 1;
1074         }
1075         local_irq_restore(flags);
1076         addr -= begin;
1077
1078         scache_size = addr;
1079         c->scache.linesz = 16 << ((config & R4K_CONF_SB) >> 22);
1080         c->scache.ways = 1;
1081         c->dcache.waybit = 0;           /* does not matter */
1082
1083         return 1;
1084 }
1085
1086 #if defined(CONFIG_CPU_LOONGSON2)
1087 static void __init loongson2_sc_init(void)
1088 {
1089         struct cpuinfo_mips *c = &current_cpu_data;
1090
1091         scache_size = 512*1024;
1092         c->scache.linesz = 32;
1093         c->scache.ways = 4;
1094         c->scache.waybit = 0;
1095         c->scache.waysize = scache_size / (c->scache.ways);
1096         c->scache.sets = scache_size / (c->scache.linesz * c->scache.ways);
1097         pr_info("Unified secondary cache %ldkB %s, linesize %d bytes.\n",
1098                scache_size >> 10, way_string[c->scache.ways], c->scache.linesz);
1099
1100         c->options |= MIPS_CPU_INCLUSIVE_CACHES;
1101 }
1102 #endif
1103
1104 extern int r5k_sc_init(void);
1105 extern int rm7k_sc_init(void);
1106 extern int mips_sc_init(void);
1107
1108 static void __init setup_scache(void)
1109 {
1110         struct cpuinfo_mips *c = &current_cpu_data;
1111         unsigned int config = read_c0_config();
1112         int sc_present = 0;
1113
1114         /*
1115          * Do the probing thing on R4000SC and R4400SC processors.  Other
1116          * processors don't have a S-cache that would be relevant to the
1117          * Linux memory managment.
1118          */
1119         switch (c->cputype) {
1120         case CPU_R4000SC:
1121         case CPU_R4000MC:
1122         case CPU_R4400SC:
1123         case CPU_R4400MC:
1124                 sc_present = run_uncached(probe_scache);
1125                 if (sc_present)
1126                         c->options |= MIPS_CPU_CACHE_CDEX_S;
1127                 break;
1128
1129         case CPU_R10000:
1130         case CPU_R12000:
1131         case CPU_R14000:
1132                 scache_size = 0x80000 << ((config & R10K_CONF_SS) >> 16);
1133                 c->scache.linesz = 64 << ((config >> 13) & 1);
1134                 c->scache.ways = 2;
1135                 c->scache.waybit= 0;
1136                 sc_present = 1;
1137                 break;
1138
1139         case CPU_R5000:
1140         case CPU_NEVADA:
1141 #ifdef CONFIG_R5000_CPU_SCACHE
1142                 r5k_sc_init();
1143 #endif
1144                 return;
1145
1146         case CPU_RM7000:
1147         case CPU_RM9000:
1148 #ifdef CONFIG_RM7000_CPU_SCACHE
1149                 rm7k_sc_init();
1150 #endif
1151                 return;
1152
1153 #if defined(CONFIG_CPU_LOONGSON2)
1154         case CPU_LOONGSON2:
1155                 loongson2_sc_init();
1156                 return;
1157 #endif
1158
1159         default:
1160                 if (c->isa_level == MIPS_CPU_ISA_M32R1 ||
1161                     c->isa_level == MIPS_CPU_ISA_M32R2 ||
1162                     c->isa_level == MIPS_CPU_ISA_M64R1 ||
1163                     c->isa_level == MIPS_CPU_ISA_M64R2) {
1164 #ifdef CONFIG_MIPS_CPU_SCACHE
1165                         if (mips_sc_init ()) {
1166                                 scache_size = c->scache.ways * c->scache.sets * c->scache.linesz;
1167                                 printk("MIPS secondary cache %ldkB, %s, linesize %d bytes.\n",
1168                                        scache_size >> 10,
1169                                        way_string[c->scache.ways], c->scache.linesz);
1170                         }
1171 #else
1172                         if (!(c->scache.flags & MIPS_CACHE_NOT_PRESENT))
1173                                 panic("Dunno how to handle MIPS32 / MIPS64 second level cache");
1174 #endif
1175                         return;
1176                 }
1177                 sc_present = 0;
1178         }
1179
1180         if (!sc_present)
1181                 return;
1182
1183         /* compute a couple of other cache variables */
1184         c->scache.waysize = scache_size / c->scache.ways;
1185
1186         c->scache.sets = scache_size / (c->scache.linesz * c->scache.ways);
1187
1188         printk("Unified secondary cache %ldkB %s, linesize %d bytes.\n",
1189                scache_size >> 10, way_string[c->scache.ways], c->scache.linesz);
1190
1191         c->options |= MIPS_CPU_INCLUSIVE_CACHES;
1192 }
1193
1194 void au1x00_fixup_config_od(void)
1195 {
1196         /*
1197          * c0_config.od (bit 19) was write only (and read as 0)
1198          * on the early revisions of Alchemy SOCs.  It disables the bus
1199          * transaction overlapping and needs to be set to fix various errata.
1200          */
1201         switch (read_c0_prid()) {
1202         case 0x00030100: /* Au1000 DA */
1203         case 0x00030201: /* Au1000 HA */
1204         case 0x00030202: /* Au1000 HB */
1205         case 0x01030200: /* Au1500 AB */
1206         /*
1207          * Au1100 errata actually keeps silence about this bit, so we set it
1208          * just in case for those revisions that require it to be set according
1209          * to arch/mips/au1000/common/cputable.c
1210          */
1211         case 0x02030200: /* Au1100 AB */
1212         case 0x02030201: /* Au1100 BA */
1213         case 0x02030202: /* Au1100 BC */
1214                 set_c0_config(1 << 19);
1215                 break;
1216         }
1217 }
1218
1219 static void __init coherency_setup(void)
1220 {
1221         change_c0_config(CONF_CM_CMASK, CONF_CM_DEFAULT);
1222
1223         /*
1224          * c0_status.cu=0 specifies that updates by the sc instruction use
1225          * the coherency mode specified by the TLB; 1 means cachable
1226          * coherent update on write will be used.  Not all processors have
1227          * this bit and; some wire it to zero, others like Toshiba had the
1228          * silly idea of putting something else there ...
1229          */
1230         switch (current_cpu_data.cputype) {
1231         case CPU_R4000PC:
1232         case CPU_R4000SC:
1233         case CPU_R4000MC:
1234         case CPU_R4400PC:
1235         case CPU_R4400SC:
1236         case CPU_R4400MC:
1237                 clear_c0_config(CONF_CU);
1238                 break;
1239         /*
1240          * We need to catch the early Alchemy SOCs with
1241          * the write-only co_config.od bit and set it back to one...
1242          */
1243         case CPU_AU1000: /* rev. DA, HA, HB */
1244         case CPU_AU1100: /* rev. AB, BA, BC ?? */
1245         case CPU_AU1500: /* rev. AB */
1246                 au1x00_fixup_config_od();
1247                 break;
1248         }
1249 }
1250
1251 void __init r4k_cache_init(void)
1252 {
1253         extern void build_clear_page(void);
1254         extern void build_copy_page(void);
1255         extern char except_vec2_generic;
1256         struct cpuinfo_mips *c = &current_cpu_data;
1257
1258         /* Default cache error handler for R4000 and R5000 family */
1259         set_uncached_handler (0x100, &except_vec2_generic, 0x80);
1260
1261         probe_pcache();
1262         setup_scache();
1263
1264         r4k_blast_dcache_page_setup();
1265         r4k_blast_dcache_page_indexed_setup();
1266         r4k_blast_dcache_setup();
1267         r4k_blast_icache_page_setup();
1268         r4k_blast_icache_page_indexed_setup();
1269         r4k_blast_icache_setup();
1270         r4k_blast_scache_page_setup();
1271         r4k_blast_scache_page_indexed_setup();
1272         r4k_blast_scache_setup();
1273
1274         /*
1275          * Some MIPS32 and MIPS64 processors have physically indexed caches.
1276          * This code supports virtually indexed processors and will be
1277          * unnecessarily inefficient on physically indexed processors.
1278          */
1279         if (c->dcache.linesz)
1280                 shm_align_mask = max_t( unsigned long,
1281                                         c->dcache.sets * c->dcache.linesz - 1,
1282                                         PAGE_SIZE - 1);
1283         else
1284                 shm_align_mask = PAGE_SIZE-1;
1285         flush_cache_all         = r4k_flush_cache_all;
1286         __flush_cache_all       = r4k___flush_cache_all;
1287         flush_cache_mm          = r4k_flush_cache_mm;
1288         flush_cache_page        = r4k_flush_cache_page;
1289         flush_cache_range       = r4k_flush_cache_range;
1290
1291         flush_cache_sigtramp    = r4k_flush_cache_sigtramp;
1292         flush_icache_all        = r4k_flush_icache_all;
1293         local_flush_data_cache_page     = local_r4k_flush_data_cache_page;
1294         flush_data_cache_page   = r4k_flush_data_cache_page;
1295         flush_icache_range      = r4k_flush_icache_range;
1296
1297 #ifdef CONFIG_DMA_NONCOHERENT
1298         _dma_cache_wback_inv    = r4k_dma_cache_wback_inv;
1299         _dma_cache_wback        = r4k_dma_cache_wback_inv;
1300         _dma_cache_inv          = r4k_dma_cache_inv;
1301 #endif
1302
1303         build_clear_page();
1304         build_copy_page();
1305         local_r4k___flush_cache_all(NULL);
1306         coherency_setup();
1307 }
Note: See TracBrowser for help on using the browser.