]> xenbits.xensource.com Git - people/liuw/xen.git/commitdiff
arm/acpi: Initialize serial port from ACPI SPCR table colo-prep-v8-base
authorShannon Zhao <shannon.zhao@linaro.org>
Fri, 26 Feb 2016 11:37:50 +0000 (12:37 +0100)
committerJan Beulich <jbeulich@suse.com>
Fri, 26 Feb 2016 11:39:29 +0000 (12:39 +0100)
Parse ACPI SPCR (Serial Port Console Redirection table) table and
initialize the serial port pl011.

Signed-off-by: Parth Dixit <parth.dixit@linaro.org>
Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Fix build.

Acked-by: Jan Beulich <jbeulich@suse.com>
xen/drivers/char/pl011.c
xen/include/acpi/actbl2.h

index 7e16294c7cf2f6f6fd15aacbd3088d145cae34b8..fa22edf4035c590678cfefca9568d815ae1a1db5 100644 (file)
@@ -308,6 +308,44 @@ DT_DEVICE_START(pl011, "PL011 UART", DEVICE_SERIAL)
         .init = pl011_dt_uart_init,
 DT_DEVICE_END
 
+#ifdef CONFIG_ACPI
+#include <xen/acpi.h>
+
+static int __init pl011_acpi_uart_init(const void *data)
+{
+    acpi_status status;
+    struct acpi_table_spcr *spcr = NULL;
+    int res;
+
+    status = acpi_get_table(ACPI_SIG_SPCR, 0,
+                            (struct acpi_table_header **)&spcr);
+
+    if ( ACPI_FAILURE(status) )
+    {
+        printk("pl011: Failed to get SPCR table\n");
+        return -EINVAL;
+    }
+
+    /* trigger/polarity information is not available in spcr */
+    irq_set_type(spcr->interrupt, IRQ_TYPE_EDGE_BOTH);
+
+    res = pl011_uart_init(spcr->interrupt, spcr->serial_port.address,
+                          PAGE_SIZE);
+    if ( res < 0 )
+    {
+        printk("pl011: Unable to initialize\n");
+        return res;
+    }
+
+    return 0;
+}
+
+ACPI_DEVICE_START(apl011, "PL011 UART", DEVICE_SERIAL)
+        .class_type = ACPI_DBG2_PL011,
+        .init = pl011_acpi_uart_init,
+ACPI_DEVICE_END
+#endif
+
 /*
  * Local variables:
  * mode: C
index 1ad67f8c4ac10068a56a38d0553e87c12296b72f..4341a30d846648a1f448e300fda4f5e1eb61f86b 100644 (file)
@@ -281,6 +281,11 @@ struct acpi_dbg2_device {
 
 #define ACPI_DBG2_16550_COMPATIBLE  0x0000
 #define ACPI_DBG2_16550_SUBSET      0x0001
+#define ACPI_DBG2_PL011             0x0003
+#define ACPI_DBG2_SBSA_32           0x000d
+#define ACPI_DBG2_SBSA              0x000e
+#define ACPI_DBG2_DCC               0x000f
+#define ACPI_DBG2_BCM2835           0x0010
 
 #define ACPI_DBG2_1394_STANDARD     0x0000