summaryrefslogtreecommitdiff
path: root/drivers/serial/serial_xen.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/serial/serial_xen.c')
-rw-r--r--drivers/serial/serial_xen.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/drivers/serial/serial_xen.c b/drivers/serial/serial_xen.c
index ba6504b9479..34c90ece40f 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;
@@ -175,8 +179,22 @@ U_BOOT_DRIVER(serial_xen) = {
.priv_auto_alloc_size = sizeof(struct xen_uart_priv),
.probe = xen_serial_probe,
.ops = &xen_serial_ops,
-#if !CONFIG_IS_ENABLED(OF_CONTROL)
.flags = DM_FLAG_PRE_RELOC,
-#endif
};
+#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