8 #include <linux/kernel.h>
9 #include <linux/sched.h>
14 #include <asm/pgtable.h>
15 #include <asm/bootinfo.h>
24 #define SC_SIZE 0x00080000
26 #define CI_MASK (SC_SIZE - SC_LINE)
27 #define SC_INDEX(n) ((n) & CI_MASK)
29 static inline void indy_sc_wipe(
unsigned long first,
unsigned long last)
34 ".set\tpush\t\t\t# indy_sc_wipe\n\t"
39 "li\t$1, 0x80\t\t\t# Go 64 bit\n\t"
42 "dli\t$1, 0x9000000080000000\n\t"
43 "or\t%0, $1\t\t\t# first line to flush\n\t"
44 "or\t%1, $1\t\t\t# last line to flush\n\t"
47 "1:\tsw\t$0, 0(%0)\n\t"
51 "mtc0\t%2, $12\t\t\t# Back to 32 bit\n\t"
52 "nop; nop; nop; nop;\n\t"
54 :
"=r" (first),
"=r" (last),
"=&r" (tmp)
55 :
"0" (first),
"1" (last));
58 static void indy_sc_wback_invalidate(
unsigned long addr,
unsigned long size)
60 unsigned long first_line, last_line;
64 printk(
"indy_sc_wback_invalidate[%08lx,%08lx]", addr, size);
72 last_line =
SC_INDEX(addr + size - 1);
75 if (first_line <= last_line) {
76 indy_sc_wipe(first_line, last_line);
81 indy_sc_wipe(0, last_line);
86 static void indy_sc_enable(
void)
92 printk(
"Enabling R4600 SCACHE\n");
99 "nop; nop; nop; nop;\n\t"
102 "nop; nop; nop; nop;\n\t"
105 "lui\t%1, 0x9000\n\t"
110 "nop; nop; nop; nop;\n\t"
112 "nop; nop; nop; nop;\n\t"
114 :
"=r" (tmp1),
"=r" (tmp2),
"=r" (addr));
117 static void indy_sc_disable(
void)
119 unsigned long tmp1, tmp2, tmp3;
122 printk(
"Disabling R4600 SCACHE\n");
126 ".set\tnoreorder\n\t"
130 "lui\t%1, 0x9000\n\t"
134 "nop; nop; nop; nop\n\t"
137 "nop; nop; nop; nop\n\t"
140 "nop; nop; nop; nop\n\t"
142 "nop; nop; nop; nop\n\t"
144 :
"=r" (tmp1),
"=r" (tmp2),
"=r" (tmp3));
147 static inline int __init indy_sc_probe(
void)
164 .bc_enable = indy_sc_enable,
165 .bc_disable = indy_sc_disable,
166 .bc_wback_inv = indy_sc_wback_invalidate,
167 .bc_inv = indy_sc_wback_invalidate
172 if (indy_sc_probe()) {
174 bcops = &indy_sc_ops;