]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/powerpc/kernel/udbg.c
Merge branch 'upstream-fixes' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik...
[linux-2.6-omap-h63xx.git] / arch / powerpc / kernel / udbg.c
index cc2df5e61bb068c50c0a5b2d6d71daf962d8e248..3774e80094f5393bc86395fbd0632420a1992917 100644 (file)
 #include <linux/sched.h>
 #include <linux/console.h>
 #include <asm/processor.h>
+#include <asm/udbg.h>
 
 void (*udbg_putc)(char c);
-char (*udbg_getc)(void);
+int (*udbg_getc)(void);
 int (*udbg_getc_poll)(void);
 
+/*
+ * Early debugging facilities. You can enable _one_ of these via .config,
+ * if you do so your kernel _will not boot_ on anything else. Be careful.
+ */
+void __init udbg_early_init(void)
+{
+#if defined(CONFIG_PPC_EARLY_DEBUG_LPAR)
+       /* For LPAR machines that have an HVC console on vterm 0 */
+       udbg_init_debug_lpar();
+#elif defined(CONFIG_PPC_EARLY_DEBUG_G5)
+       /* For use on Apple G5 machines */
+       udbg_init_pmac_realmode();
+#elif defined(CONFIG_PPC_EARLY_DEBUG_RTAS)
+       /* RTAS panel debug */
+       udbg_init_rtas();
+#elif defined(CONFIG_PPC_EARLY_DEBUG_MAPLE)
+       /* Maple real mode debug */
+       udbg_init_maple_realmode();
+#elif defined(CONFIG_PPC_EARLY_DEBUG_ISERIES)
+       /* For iSeries - hit Ctrl-x Ctrl-x to see the output */
+       udbg_init_iseries();
+#endif
+}
+
 /* udbg library, used by xmon et al */
 void udbg_puts(const char *s)
 {
@@ -57,8 +82,8 @@ int udbg_write(const char *s, int n)
 
 int udbg_read(char *buf, int buflen)
 {
-       char c, *p = buf;
-       int i;
+       char *p = buf;
+       int i, c;
 
        if (!udbg_getc)
                return 0;
@@ -66,8 +91,11 @@ int udbg_read(char *buf, int buflen)
        for (i = 0; i < buflen; ++i) {
                do {
                        c = udbg_getc();
+                       if (c == -1 && i == 0)
+                               return -1;
+
                } while (c == 0x11 || c == 0x13);
-               if (c == 0)
+               if (c == 0 || c == -1)
                        break;
                *p++ = c;
        }
@@ -87,6 +115,12 @@ void udbg_printf(const char *fmt, ...)
        va_end(args);
 }
 
+void __init udbg_progress(char *s, unsigned short hex)
+{
+       udbg_puts(s);
+       udbg_puts("\n");
+}
+
 /*
  * Early boot console based on udbg
  */
@@ -107,10 +141,12 @@ static int early_console_initialized;
 
 void __init disable_early_printk(void)
 {
+#if 1
        if (!early_console_initialized)
                return;
        unregister_console(&udbg_console);
        early_console_initialized = 0;
+#endif
 }
 
 /* called by setup_system */