include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit...
[safe/jmp/linux-2.6] / arch / mips / kernel / cpu-bugs64.c
index ac04f0a..408d0a0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2003, 2004  Maciej W. Rozycki
+ * Copyright (C) 2003, 2004, 2007  Maciej W. Rozycki
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
 #include <asm/mipsregs.h>
 #include <asm/system.h>
 
+static char bug64hit[] __initdata =
+       "reliable operation impossible!\n%s";
+static char nowar[] __initdata =
+       "Please report to <linux-mips@linux-mips.org>.";
+static char r4kwar[] __initdata =
+       "Enable CPU_R4000_WORKAROUNDS to rectify.";
+static char daddiwar[] __initdata =
+       "Enable CPU_DADDI_WORKAROUNDS to rectify.";
+
 static inline void align_mod(const int align, const int mod)
 {
        asm volatile(
@@ -29,7 +38,7 @@ static inline void align_mod(const int align, const int mod)
                ".endr\n\t"
                ".set   pop"
                :
-               : "rn" (align), "rn" (mod));
+               : GCC_IMM_ASM() (align), GCC_IMM_ASM() (mod));
 }
 
 static inline void mult_sh_align_mod(long *v1, long *v2, long *w,
@@ -155,16 +164,10 @@ static inline void check_mult_sh(void)
        }
 
        printk("no.\n");
-       panic("Reliable operation impossible!\n"
-#ifndef CONFIG_CPU_R4000
-             "Configure for R4000 to enable the workaround."
-#else
-             "Please report to <linux-mips@linux-mips.org>."
-#endif
-             );
+       panic(bug64hit, !R4000_WAR ? r4kwar : nowar);
 }
 
-static volatile int daddi_ov __initdata = 0;
+static volatile int daddi_ov __cpuinitdata;
 
 asmlinkage void __init do_daddi_ov(struct pt_regs *regs)
 {
@@ -233,15 +236,11 @@ static inline void check_daddi(void)
        }
 
        printk("no.\n");
-       panic("Reliable operation impossible!\n"
-#if !defined(CONFIG_CPU_R4000) && !defined(CONFIG_CPU_R4400)
-             "Configure for R4000 or R4400 to enable the workaround."
-#else
-             "Please report to <linux-mips@linux-mips.org>."
-#endif
-             );
+       panic(bug64hit, !DADDI_WAR ? daddiwar : nowar);
 }
 
+int daddiu_bug __cpuinitdata = -1;
+
 static inline void check_daddiu(void)
 {
        long v, w, tmp;
@@ -281,7 +280,9 @@ static inline void check_daddiu(void)
                : "=&r" (v), "=&r" (w), "=&r" (tmp)
                : "I" (0xffffffffffffdb9aUL), "I" (0x1234));
 
-       if (v == w) {
+       daddiu_bug = v != w;
+
+       if (!daddiu_bug) {
                printk("no.\n");
                return;
        }
@@ -303,18 +304,16 @@ static inline void check_daddiu(void)
        }
 
        printk("no.\n");
-       panic("Reliable operation impossible!\n"
-#if !defined(CONFIG_CPU_R4000) && !defined(CONFIG_CPU_R4400)
-             "Configure for R4000 or R4400 to enable the workaround."
-#else
-             "Please report to <linux-mips@linux-mips.org>."
-#endif
-             );
+       panic(bug64hit, !DADDI_WAR ? daddiwar : nowar);
 }
 
-void __init check_bugs64(void)
+void __init check_bugs64_early(void)
 {
        check_mult_sh();
-       check_daddi();
        check_daddiu();
 }
+
+void __init check_bugs64(void)
+{
+       check_daddi();
+}