patch-2.3.99-pre9 linux/arch/mips64/sgi-ip22/ip22-sc.c

Next file: linux/arch/mips64/sgi-ip22/ip22-setup.c
Previous file: linux/arch/mips64/sgi-ip22/ip22-rtc.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.99-pre8/linux/arch/mips64/sgi-ip22/ip22-sc.c linux/arch/mips64/sgi-ip22/ip22-sc.c
@@ -27,7 +27,6 @@
 #define SC_SIZE 0x00080000
 #define SC_LINE 32
 #define CI_MASK (SC_SIZE - SC_LINE)
-#define SC_ROUND(n) ((n) + SC_LINE - 1)
 #define SC_INDEX(n) ((n) & CI_MASK)
 
 static inline void indy_sc_wipe(unsigned long first, unsigned long last)
@@ -53,9 +52,13 @@
 #ifdef DEBUG_CACHE
 	printk("indy_sc_wback_invalidate[%08lx,%08lx]", addr, size);
 #endif
+
+	if (!size)
+		return;
+
 	/* Which lines to flush?  */
 	first_line = SC_INDEX(addr);
-	last_line = SC_INDEX(SC_ROUND(addr + size));
+	last_line = SC_INDEX(addr + size - 1);
 
 	__save_and_cli(flags);
 	if (first_line <= last_line) {
@@ -63,11 +66,8 @@
 		goto out;
 	}
 
-	/* Cache index wrap around.  Due to the way the buddy system works
-	   this case should not happen.  We're prepared to handle it,
-	   though. */
-	indy_sc_wipe(last_line, SC_SIZE);
-	indy_sc_wipe(0, first_line);
+	indy_sc_wipe(first_line, SC_SIZE - SC_LINE);
+	indy_sc_wipe(0, last_line);
 out:
 	__restore_flags(flags);
 }
@@ -159,7 +159,6 @@
 
 void __init indy_sc_init(void)
 {
-return;  /* Not for now, debugging ... */
 	if (indy_sc_probe()) {
 		indy_sc_enable();
 		bcops = &indy_sc_ops;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)