xen: make early console also write to debug console
authorJeremy Fitzhardinge <jeremy@goop.org>
Mon, 26 May 2008 22:31:00 +0000 (23:31 +0100)
committerThomas Gleixner <tglx@linutronix.de>
Tue, 27 May 2008 08:11:35 +0000 (10:11 +0200)
When using "earlyprintk=xen", also write the console output to the raw
debug console.  This will appear on dom0's console if the hypervisor
has been compiled to allow it.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
drivers/char/hvc_xen.c

index e97d9d1683255d64add3dc4d529d642deee57681..2413af342a81e18c269945acf72a27120c526d3a 100644 (file)
@@ -134,12 +134,27 @@ module_init(xen_init);
 module_exit(xen_fini);
 console_initcall(xen_cons_init);
 
+static void raw_console_write(const char *str, int len)
+{
+       while(len > 0) {
+               int rc = HYPERVISOR_console_io(CONSOLEIO_write, len, (char *)str);
+               if (rc <= 0)
+                       break;
+
+               str += rc;
+               len -= rc;
+       }
+}
+
+#ifdef CONFIG_EARLY_PRINTK
 static void xenboot_write_console(struct console *console, const char *string,
                                  unsigned len)
 {
        unsigned int linelen, off = 0;
        const char *pos;
 
+       raw_console_write(string, len);
+
        while (off < len && NULL != (pos = strchr(string+off, '\n'))) {
                linelen = pos-string+off;
                if (off + linelen > len)
@@ -155,21 +170,13 @@ static void xenboot_write_console(struct console *console, const char *string,
 struct console xenboot_console = {
        .name           = "xenboot",
        .write          = xenboot_write_console,
-       .flags          = CON_PRINTBUFFER | CON_BOOT,
+       .flags          = CON_PRINTBUFFER | CON_BOOT | CON_ANYTIME,
 };
+#endif /* CONFIG_EARLY_PRINTK */
 
 void xen_raw_console_write(const char *str)
 {
-       int len = strlen(str);
-
-       while(len > 0) {
-               int rc = HYPERVISOR_console_io(CONSOLEIO_write, len, (char *)str);
-               if (rc <= 0)
-                       break;
-
-               str += rc;
-               len -= rc;
-       }
+       raw_console_write(str, strlen(str));
 }
 
 void xen_raw_printk(const char *fmt, ...)