]> rtime.felk.cvut.cz Git - jailhouse.git/commitdiff
inmates: Wait for idle UART before starting APIC demo
authorJan Kiszka <jan.kiszka@siemens.com>
Sun, 6 Apr 2014 09:57:55 +0000 (11:57 +0200)
committerJan Kiszka <jan.kiszka@siemens.com>
Sat, 3 May 2014 12:56:57 +0000 (14:56 +0200)
Cosmetic change to avoid unreadable output on the so far shared first
serial console. This become necessary after we moved the output of cell
start after the submission of reset signals to the cell CPUs.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
inmates/apic-demo.c

index 292c30c67789bb6101e492da184c68ecc84a34b4..71c307a9ca24c8d00b37bb2290f0b68afb71006a 100644 (file)
@@ -18,6 +18,9 @@
 #else
 #define UART_BASE              0x3f8
 #endif
+#define UART_LSR               0x5
+#define UART_LSR_THRE          0x20
+#define UART_IDLE_LOOPS                100
 
 #define NS_PER_MSEC            1000000UL
 #define NS_PER_SEC             1000000000UL
@@ -132,6 +135,11 @@ void inmate_main(void)
        unsigned int n;
 
        printk_uart_base = UART_BASE;
+       do {
+               for (n = 0; n < UART_IDLE_LOOPS; n++)
+                       if (!(inb(UART_BASE + UART_LSR) & UART_LSR_THRE))
+                               break;
+       } while (n < UART_IDLE_LOOPS);
 
        if (init_pm_timer())
                init_apic();