summaryrefslogtreecommitdiffstats
path: root/drivers/serial/serial_xen.c
diff options
context:
space:
mode:
authorAKASHI Takahiro <takahiro.akashi@linaro.org>2020-10-15 13:25:16 +0900
committerTom Rini <trini@konsulko.com>2020-10-22 11:26:14 -0400
commit82e21b391bd315f6fe0e0b79326af8a141e9cca7 (patch)
treea1eb885f673470b914bff57bbcc56074df15ec4b /drivers/serial/serial_xen.c
parent16389a74c516470c8f0fd8c712e1638f80384b92 (diff)
downloadu-boot-82e21b391bd315f6fe0e0b79326af8a141e9cca7.tar.gz
u-boot-82e21b391bd315f6fe0e0b79326af8a141e9cca7.tar.xz
u-boot-82e21b391bd315f6fe0e0b79326af8a141e9cca7.zip
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 <takahiro.akashi@linaro.org>
Diffstat (limited to 'drivers/serial/serial_xen.c')
-rw-r--r--drivers/serial/serial_xen.c20
1 files changed, 20 insertions, 0 deletions
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 <common.h>
#include <cpu_func.h>
+#include <debug_uart.h>
#include <dm.h>
#include <serial.h>
#include <watchdog.h>
@@ -15,11 +16,14 @@
#include <xen/events.h>
#include <xen/interface/sched.h>
+#include <xen/interface/xen.h>
#include <xen/interface/hvm/hvm_op.h>
#include <xen/interface/hvm/params.h>
#include <xen/interface/io/console.h>
#include <xen/interface/io/ring.h>
+#include <asm/xen/hypercall.h>
+
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