This is the first step towards the common usage of a common uart driver
infrastructure.

Signed-off-by: Ralf Ramsauer <[email protected]>
---
 hypervisor/arch/arm-common/dbg-write.c        |  1 +
 hypervisor/arch/arm-common/include/asm/uart.h | 15 --------------
 hypervisor/arch/arm-common/uart-8250.c        |  2 +-
 hypervisor/arch/arm-common/uart-pl011.c       |  2 +-
 hypervisor/arch/arm-common/uart-xuartps.c     |  2 +-
 hypervisor/include/jailhouse/uart.h           | 28 +++++++++++++++++++++++++++
 6 files changed, 32 insertions(+), 18 deletions(-)
 create mode 100644 hypervisor/include/jailhouse/uart.h

diff --git a/hypervisor/arch/arm-common/dbg-write.c 
b/hypervisor/arch/arm-common/dbg-write.c
index 1c9e9dbc..2a632b52 100644
--- a/hypervisor/arch/arm-common/dbg-write.c
+++ b/hypervisor/arch/arm-common/dbg-write.c
@@ -16,6 +16,7 @@
 #include <jailhouse/entry.h>
 #include <jailhouse/printk.h>
 #include <jailhouse/processor.h>
+#include <jailhouse/uart.h>
 #include <asm/uart.h>
 
 static struct uart_chip *uart = NULL;
diff --git a/hypervisor/arch/arm-common/include/asm/uart.h 
b/hypervisor/arch/arm-common/include/asm/uart.h
index f71652e8..f3b05308 100644
--- a/hypervisor/arch/arm-common/include/asm/uart.h
+++ b/hypervisor/arch/arm-common/include/asm/uart.h
@@ -15,21 +15,6 @@
 
 #ifndef __ASSEMBLY__
 
-/* Defines the bare minimum for debug writes */
-struct uart_chip {
-       void            *virt_base;
-       void            *virt_clock_reg;
-       struct jailhouse_debug_console *debug_console;
-
-       void (*init)(struct uart_chip *chip);
-       bool (*is_busy)(struct uart_chip *chip);
-       void (*write_character)(struct uart_chip *chip, char c);
-
-       void (*reg_out)(void *address, u32 value);
-       u32 (*reg_in)(void *address);
-       unsigned int reg_dist;
-};
-
 extern struct uart_chip uart_8250_ops, uart_pl011_ops, uart_xuartps_ops;
 
 #endif /* !__ASSEMBLY__ */
diff --git a/hypervisor/arch/arm-common/uart-8250.c 
b/hypervisor/arch/arm-common/uart-8250.c
index 6be3cb7d..ca5a46eb 100644
--- a/hypervisor/arch/arm-common/uart-8250.c
+++ b/hypervisor/arch/arm-common/uart-8250.c
@@ -13,7 +13,7 @@
  */
 
 #include <jailhouse/mmio.h>
-#include <asm/uart.h>
+#include <jailhouse/uart.h>
 
 #define UART_TX                        0x0
 #define UART_DLL               0x0
diff --git a/hypervisor/arch/arm-common/uart-pl011.c 
b/hypervisor/arch/arm-common/uart-pl011.c
index df12f005..bf481477 100644
--- a/hypervisor/arch/arm-common/uart-pl011.c
+++ b/hypervisor/arch/arm-common/uart-pl011.c
@@ -11,7 +11,7 @@
  */
 
 #include <jailhouse/mmio.h>
-#include <asm/uart.h>
+#include <jailhouse/uart.h>
 
 #define UART_CLK       24000000
 
diff --git a/hypervisor/arch/arm-common/uart-xuartps.c 
b/hypervisor/arch/arm-common/uart-xuartps.c
index 92438f0b..f3da36f9 100644
--- a/hypervisor/arch/arm-common/uart-xuartps.c
+++ b/hypervisor/arch/arm-common/uart-xuartps.c
@@ -11,7 +11,7 @@
  */
 
 #include <jailhouse/mmio.h>
-#include <asm/uart.h>
+#include <jailhouse/uart.h>
 
 #define UART_SR                        0x2c
 #define  UART_SR_TXEMPTY       0x8
diff --git a/hypervisor/include/jailhouse/uart.h 
b/hypervisor/include/jailhouse/uart.h
new file mode 100644
index 00000000..2d8fffa1
--- /dev/null
+++ b/hypervisor/include/jailhouse/uart.h
@@ -0,0 +1,28 @@
+/*
+ * Jailhouse, a Linux-based partitioning hypervisor
+ *
+ * Copyright (c) OTH Regensburg, 2017
+ *
+ * Authors:
+ *  Ralf Ramsauer <[email protected]>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.  See
+ * the COPYING file in the top-level directory.
+ */
+
+struct uart_chip {
+       /* must be set by the caller */
+       void *virt_base;
+       void *virt_clock_reg;
+       struct jailhouse_debug_console *debug_console;
+
+       /* driver selects defaults, if used */
+       void (*reg_out)(void *address, u32 value);
+       u32 (*reg_in)(void *address);
+       unsigned int reg_dist;
+
+       /* set by the driver */
+       void (*init)(struct uart_chip *chip);
+       bool (*is_busy)(struct uart_chip *chip);
+       void (*write_character)(struct uart_chip *chip, char c);
+};
-- 
2.11.1

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to