1 /*
2  * printk() for use before the final page tables are setup.
3  *
4  * Copyright (C) 2012 Citrix Systems, Inc.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  */
10 
11 #include <xen/init.h>
12 #include <xen/lib.h>
13 #include <xen/stdarg.h>
14 #include <xen/string.h>
15 #include <xen/early_printk.h>
16 
17 void early_putch(char c);
18 void early_flush(void);
19 
early_puts(const char * s,size_t nr)20 void early_puts(const char *s, size_t nr)
21 {
22     while ( nr-- > 0 )
23     {
24         if (*s == '\n')
25             early_putch('\r');
26         early_putch(*s);
27         s++;
28     }
29 
30     /*
31      * Wait the UART has finished to transfer all characters before
32      * to continue. This will avoid lost characters if Xen abort.
33      */
34     early_flush();
35 }
36