]> xenbits.xensource.com Git - people/iwj/xen.git/commitdiff
xen/arm: avoid lost characters with early_printk
authorJulien Grall <julien.grall@linaro.org>
Thu, 23 May 2013 14:50:11 +0000 (15:50 +0100)
committerIan Campbell <ian.campbell@citrix.com>
Thu, 30 May 2013 08:14:48 +0000 (09:14 +0100)
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>
xen/arch/arm/arm32/debug.S
xen/arch/arm/arm64/debug.S
xen/arch/arm/early_printk.c

index 1bfbfc19688b52ef557a6acd6baf114f07faa608..92f572499d444038bea03f32c50fb3a5847726d6 100644 (file)
@@ -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
index 38b7c74ff7d69a3c2b9561bb9a9b408d228de4be..c7b5e6ceeaa5864b913d8bbb781b04a9c4c53151 100644 (file)
@@ -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
index 59503231ecd5977fa904963510b4ec37bfaa171e..ca151a5b21e6d7f2076ade645f61cbfc64532903 100644 (file)
@@ -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, ...)