KVM: PPC: Add support for FPU/Altivec/VSX
[safe/jmp/linux-2.6] / arch / powerpc / kernel / udbg.c
index 147a2d8..e39cad8 100644 (file)
@@ -18,6 +18,7 @@
 #include <asm/udbg.h>
 
 void (*udbg_putc)(char c);
+void (*udbg_flush)(void);
 int (*udbg_getc)(void);
 int (*udbg_getc_poll)(void);
 
@@ -51,6 +52,20 @@ void __init udbg_early_init(void)
        udbg_init_pas_realmode();
 #elif defined(CONFIG_BOOTX_TEXT)
        udbg_init_btext();
+#elif defined(CONFIG_PPC_EARLY_DEBUG_44x)
+       /* PPC44x debug */
+       udbg_init_44x_as1();
+#elif defined(CONFIG_PPC_EARLY_DEBUG_40x)
+       /* PPC40x debug */
+       udbg_init_40x_realmode();
+#elif defined(CONFIG_PPC_EARLY_DEBUG_CPM)
+       udbg_init_cpm();
+#elif defined(CONFIG_PPC_EARLY_DEBUG_USBGECKO)
+       udbg_init_usbgecko();
+#endif
+
+#ifdef CONFIG_PPC_EARLY_DEBUG
+       console_loglevel = 10;
 #endif
 }
 
@@ -64,6 +79,9 @@ void udbg_puts(const char *s)
                        while ((c = *s++) != '\0')
                                udbg_putc(c);
                }
+
+               if (udbg_flush)
+                       udbg_flush();
        }
 #if 0
        else {
@@ -86,6 +104,9 @@ int udbg_write(const char *s, int n)
                }
        }
 
+       if (udbg_flush)
+               udbg_flush();
+
        return n - remain;
 }
 
@@ -142,18 +163,24 @@ static void udbg_console_write(struct console *con, const char *s,
 static struct console udbg_console = {
        .name   = "udbg",
        .write  = udbg_console_write,
-       .flags  = CON_PRINTBUFFER | CON_ENABLED | CON_BOOT,
-       .index  = -1,
+       .flags  = CON_PRINTBUFFER | CON_ENABLED | CON_BOOT | CON_ANYTIME,
+       .index  = 0,
 };
 
 static int early_console_initialized;
 
-/* called by setup_system */
-void register_early_udbg_console(void)
+/*
+ * Called by setup_system after ppc_md->probe and ppc_md->early_init.
+ * Call it again after setting udbg_putc in ppc_md->setup_arch.
+ */
+void __init register_early_udbg_console(void)
 {
        if (early_console_initialized)
                return;
 
+       if (!udbg_putc)
+               return;
+
        if (strstr(boot_command_line, "udbg-immortal")) {
                printk(KERN_INFO "early console immortal !\n");
                udbg_console.flags &= ~CON_BOOT;