From 82e21b391bd315f6fe0e0b79326af8a141e9cca7 Mon Sep 17 00:00:00 2001 From: AKASHI Takahiro Date: Thu, 15 Oct 2020 13:25:16 +0900 Subject: serial: serial_xen: add DEBUG_UART support By using a hypervisor call, we can implement DEBUG_UART on xen. This will allow us to see messages even earlier than serial_init(). Signed-off-by: AKASHI Takahiro --- drivers/serial/serial_xen.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'drivers/serial/serial_xen.c') diff --git a/drivers/serial/serial_xen.c b/drivers/serial/serial_xen.c index ed191829f0..34c90ece40 100644 --- a/drivers/serial/serial_xen.c +++ b/drivers/serial/serial_xen.c @@ -5,6 +5,7 @@ */ #include #include +#include #include #include #include @@ -15,11 +16,14 @@ #include #include +#include #include #include #include #include +#include + DECLARE_GLOBAL_DATA_PTR; u32 console_evtchn; @@ -178,3 +182,19 @@ U_BOOT_DRIVER(serial_xen) = { .flags = DM_FLAG_PRE_RELOC, }; +#if defined(CONFIG_DEBUG_UART_XEN) +static inline void _debug_uart_init(void) {} + +static inline void _debug_uart_putc(int c) +{ +#if CONFIG_IS_ENABLED(ARM) + xen_debug_putc(c); +#else + /* the type cast should work on LE only */ + HYPERVISOR_console_io(CONSOLEIO_write, 1, (char *)&ch); +#endif +} + +DEBUG_UART_FUNCS + +#endif -- cgit