xen/arm: New callback in uart_driver to retrieve serial information
authorJulien Grall <julien.grall@linaro.org>
Thu, 1 Aug 2013 16:09:28 +0000 (17:09 +0100)
committerIan Campbell <ian.campbell@citrix.com>
Thu, 8 Aug 2013 11:55:12 +0000 (12:55 +0100)
There is no way to retrieve basic informations (base address, size, ....) for
an UART. This callback will be used later to partially emulate the real UART
for DOM0 on ARM.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Reviewed-by: Tim Deegan <tim@xen.org>
Acked-by: Keir Fraser <keir@xen.org>
xen/drivers/char/serial.c
xen/include/xen/serial.h

index e1c3f475afbc32c7d7c65ac86c0b8dd58d2ac3a2..cd0b86437425d3cdb02050abc21893c2bc0f4aa0 100644 (file)
@@ -497,6 +497,14 @@ const struct dt_irq __init *serial_dt_irq(int idx)
     return NULL;
 }
 
+const struct vuart_info *serial_vuart_info(int idx)
+{
+    if ( (idx >= 0) && (idx < ARRAY_SIZE(com)) &&
+         com[idx].driver && com[idx].driver->vuart_info )
+        return com[idx].driver->vuart_info(&com[idx]);
+
+    return NULL;
+}
 
 void serial_suspend(void)
 {
index 9caf776ad0c302be0278e14640f6c6bb9e0003d7..403e193d968af11ea59e0439b37d264988173d49 100644 (file)
@@ -32,6 +32,14 @@ enum serial_port_state {
     serial_initialized
 };
 
+struct vuart_info {
+    paddr_t base_addr;          /* Base address of the UART */
+    unsigned long size;         /* Size of the memory region */
+    unsigned long data_off;     /* Data register offset */
+    unsigned long status_off;   /* Status register offset */
+    unsigned long status;       /* Ready status value */
+};
+
 struct serial_port {
     /* Uart-driver parameters. */
     struct uart_driver *driver;
@@ -74,6 +82,8 @@ struct uart_driver {
     int  (*irq)(struct serial_port *);
     /* Get IRQ device node for this port's serial line: returns NULL if none. */
     const struct dt_irq *(*dt_irq_get)(struct serial_port *);
+    /* Get serial information */
+    const struct vuart_info *(*vuart_info)(struct serial_port *);
 };
 
 /* 'Serial handles' are composed from the following fields. */
@@ -127,6 +137,9 @@ int serial_irq(int idx);
 /* Return irq device node for specified serial port (identified by index). */
 const struct dt_irq *serial_dt_irq(int idx);
 
+/* Retrieve basic UART information to emulate it (base address, size...) */
+const struct vuart_info* serial_vuart_info(int idx);
+
 /* Serial suspend/resume. */
 void serial_suspend(void);
 void serial_resume(void);