Commit 0922abdc authored by Jeremy Fitzhardinge's avatar Jeremy Fitzhardinge Committed by Thomas Gleixner

xen: make early console also write to debug console

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: default avatarJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent 0acf10d8
...@@ -134,12 +134,27 @@ module_init(xen_init); ...@@ -134,12 +134,27 @@ module_init(xen_init);
module_exit(xen_fini); module_exit(xen_fini);
console_initcall(xen_cons_init); 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, static void xenboot_write_console(struct console *console, const char *string,
unsigned len) unsigned len)
{ {
unsigned int linelen, off = 0; unsigned int linelen, off = 0;
const char *pos; const char *pos;
raw_console_write(string, len);
while (off < len && NULL != (pos = strchr(string+off, '\n'))) { while (off < len && NULL != (pos = strchr(string+off, '\n'))) {
linelen = pos-string+off; linelen = pos-string+off;
if (off + linelen > len) if (off + linelen > len)
...@@ -155,21 +170,13 @@ static void xenboot_write_console(struct console *console, const char *string, ...@@ -155,21 +170,13 @@ static void xenboot_write_console(struct console *console, const char *string,
struct console xenboot_console = { struct console xenboot_console = {
.name = "xenboot", .name = "xenboot",
.write = xenboot_write_console, .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) void xen_raw_console_write(const char *str)
{ {
int len = strlen(str); raw_console_write(str, strlen(str));
while(len > 0) {
int rc = HYPERVISOR_console_io(CONSOLEIO_write, len, (char *)str);
if (rc <= 0)
break;
str += rc;
len -= rc;
}
} }
void xen_raw_printk(const char *fmt, ...) void xen_raw_printk(const char *fmt, ...)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment