aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulien Grall <julien.grall@linaro.org>2013-05-23 15:50:11 +0100
committerIan Campbell <ian.campbell@citrix.com>2013-05-30 09:14:48 +0100
commitcafdceb66e154f1ac204be935f9030959827bd1f (patch)
tree99e3b01483853eb6fda2461ca72cdaf1093fd13d
parent121dac93afd2f600485618d9b493892e2fca8fa8 (diff)
downloadxen-cafdceb66e154f1ac204be935f9030959827bd1f.tar.gz
xen-cafdceb66e154f1ac204be935f9030959827bd1f.tar.bz2
xen-cafdceb66e154f1ac204be935f9030959827bd1f.zip
xen/arm: avoid lost characters with early_printk
Introduce the function early_flush to wait until the UART has finished to transfer the character. When early printk is enabled, it's possible to loose the last characters if: - the UART is initialized by the UART driver - Xen hang This is result to a truncated message. To be sure that the message is fully transfered by early_printk, add a call to early_flush. This will avoid lost characters. Signed-off-by: Julien Grall <julien.grall@linaro.org> Acked-by: Ian Campbell <ian.campbell@citrix.com>
-rw-r--r--xen/arch/arm/arm32/debug.S7
-rw-r--r--xen/arch/arm/arm64/debug.S7
-rw-r--r--xen/arch/arm/early_printk.c7
3 files changed, 21 insertions, 0 deletions
diff --git a/xen/arch/arm/arm32/debug.S b/xen/arch/arm/arm32/debug.S
index 1bfbfc1968..92f572499d 100644
--- a/xen/arch/arm/arm32/debug.S
+++ b/xen/arch/arm/arm32/debug.S
@@ -32,6 +32,13 @@ early_putch:
early_uart_transmit r1, r0
mov pc, lr
+.globl early_flush
+/* Flush the UART - this function is called by C */
+early_flush:
+ ldr r1, =FIXMAP_ADDR(FIXMAP_CONSOLE) /* r1 := VA UART base address */
+ early_uart_ready r1, r2
+ mov pc, lr
+
/*
* Local variables:
* mode: ASM
diff --git a/xen/arch/arm/arm64/debug.S b/xen/arch/arm/arm64/debug.S
index 38b7c74ff7..c7b5e6ceea 100644
--- a/xen/arch/arm/arm64/debug.S
+++ b/xen/arch/arm/arm64/debug.S
@@ -32,6 +32,13 @@ early_putch:
early_uart_transmit x15, w0
ret
+.globl early_flush
+/* Flush the UART - this function is called by C */
+early_flush:
+ ldr x15, =FIXMAP_ADDR(FIXMAP_CONSOLE) /* x15 := VA UART base address */
+ early_uart_ready x15, 1
+ ret
+
/*
* Local variables:
* mode: ASM
diff --git a/xen/arch/arm/early_printk.c b/xen/arch/arm/early_printk.c
index 59503231ec..ca151a5b21 100644
--- a/xen/arch/arm/early_printk.c
+++ b/xen/arch/arm/early_printk.c
@@ -16,6 +16,7 @@
#include <asm/early_printk.h>
void early_putch(char c);
+void early_flush(void);
/* Early printk buffer */
static char __initdata buf[512];
@@ -34,6 +35,12 @@ static void __init early_vprintk(const char *fmt, va_list args)
{
vsnprintf(buf, sizeof(buf), fmt, args);
early_puts(buf);
+
+ /*
+ * Wait the UART has finished to transfer all characters before
+ * to continue. This will avoid lost characters if Xen abort.
+ */
+ early_flush();
}
void __init early_printk(const char *fmt, ...)