[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen staging] ns16550: gate all PCI code with CONFIG_X86



commit b00d0576723fa2155c0c8f5345a40335e0bc3912
Author:     Rahul Singh <rahul.singh@xxxxxxx>
AuthorDate: Wed Dec 2 10:09:27 2020 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Wed Dec 2 10:09:27 2020 +0100

    ns16550: gate all PCI code with CONFIG_X86
    
    The NS16550 driver is assuming that NS16550 PCI card are usable if the
    architecture supports PCI (i.e. CONFIG_HAS_PCI=y). However, the code is
    very x86 focus and will fail to build on Arm (/!\ it is not all the
    errors):
    
    ns16550.c: In function â??ns16550_init_irqâ??:
    ns16550.c:726:21: error: implicit declaration of function â??create_irqâ??;
    did you mean â??release_irqâ??? [-Werror=implicit-function-declaration]
              uart->irq = create_irq(0, false);
                          ^~~~~~~~~~
                          release_irq
    ns16550.c:726:21: error: nested extern declaration of â??create_irqâ??
    [-Werror=nested-externs]
    ns16550.c: In function â??ns16550_init_postirqâ??:
    ns16550.c:768:33: error: â??mmio_ro_rangesâ?? undeclared (first use in this
    function); did you mean â??mmio_handlerâ???
                   rangeset_add_range(mmio_ro_ranges, uart->io_base,
                                      ^~~~~~~~~~~~~~
                                      mmio_handler
    ns16550.c:768:33: note: each undeclared identifier is reported only once
    for each function it appears in
    ns16550.c:780:20: error: variable â??msiâ?? has initializer but incomplete
    type
                  struct msi_info msi = {
                         ^~~~~~~~
    
    Enabling support for NS16550 PCI card on Arm would require more plumbing
    in addition to fixing the compilation error.
    
    Arm systems tend to have platform UART available such as NS16550, PL011.
    So there are limited reasons to get NS16550 PCI support for now on Arm.
    
    Guard all remaining PCI code that is not under x86 flag with CONFIG_X86.
    
    No functional change intended.
    
    Signed-off-by: Rahul Singh <rahul.singh@xxxxxxx>
    Signed-off-by: Julien Grall <jgrall@xxxxxxxxxx>
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Acked-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@xxxxxxx>
---
 xen/drivers/char/ns16550.c | 25 +++++++++++++++++--------
 1 file changed, 17 insertions(+), 8 deletions(-)

diff --git a/xen/drivers/char/ns16550.c b/xen/drivers/char/ns16550.c
index 9235d854fe..16a73d0c0e 100644
--- a/xen/drivers/char/ns16550.c
+++ b/xen/drivers/char/ns16550.c
@@ -8,6 +8,15 @@
  * Copyright (c) 2003-2005, K A Fraser
  */
 
+/*
+ * The PCI part of the code in this file currently is only known to
+ * work on x86. Undo this hack once the logic has been suitably
+ * abstracted.
+ */
+#if defined(CONFIG_HAS_PCI) && defined(CONFIG_X86)
+# define NS16550_PCI
+#endif
+
 #include <xen/console.h>
 #include <xen/init.h>
 #include <xen/irq.h>
@@ -16,7 +25,7 @@
 #include <xen/timer.h>
 #include <xen/serial.h>
 #include <xen/iocap.h>
-#ifdef CONFIG_HAS_PCI
+#ifdef NS16550_PCI
 #include <xen/pci.h>
 #include <xen/pci_regs.h>
 #include <xen/pci_ids.h>
@@ -51,7 +60,7 @@ static struct ns16550 {
     unsigned int timeout_ms;
     bool_t intr_works;
     bool_t dw_usr_bsy;
-#ifdef CONFIG_HAS_PCI
+#ifdef NS16550_PCI
     /* PCI card parameters. */
     bool_t pb_bdf_enable;   /* if =1, pb-bdf effective, port behind bridge */
     bool_t ps_bdf_enable;   /* if =1, ps_bdf effective, port on pci card */
@@ -66,7 +75,7 @@ static struct ns16550 {
 #endif
 } ns16550_com[2] = { { 0 } };
 
-#ifdef CONFIG_HAS_PCI
+#ifdef NS16550_PCI
 struct ns16550_config {
     u16 vendor_id;
     u16 dev_id;
@@ -256,7 +265,7 @@ static int ns16550_getc(struct serial_port *port, char *pc)
 
 static void pci_serial_early_init(struct ns16550 *uart)
 {
-#ifdef CONFIG_HAS_PCI
+#ifdef NS16550_PCI
     if ( !uart->ps_bdf_enable || uart->io_base >= 0x10000 )
         return;
 
@@ -355,7 +364,7 @@ static void __init ns16550_init_preirq(struct serial_port 
*port)
 
 static void __init ns16550_init_irq(struct serial_port *port)
 {
-#ifdef CONFIG_HAS_PCI
+#ifdef NS16550_PCI
     struct ns16550 *uart = port->uart;
 
     if ( uart->msi )
@@ -397,7 +406,7 @@ static void __init ns16550_init_postirq(struct serial_port 
*port)
     uart->timeout_ms = max_t(
         unsigned int, 1, (bits * uart->fifo_size * 1000) / uart->baud);
 
-#ifdef CONFIG_HAS_PCI
+#ifdef NS16550_PCI
     if ( uart->bar || uart->ps_bdf_enable )
     {
         if ( uart->param && uart->param->mmio &&
@@ -477,7 +486,7 @@ static void ns16550_suspend(struct serial_port *port)
 
     stop_timer(&uart->timer);
 
-#ifdef CONFIG_HAS_PCI
+#ifdef NS16550_PCI
     if ( uart->bar )
        uart->cr = pci_conf_read16(PCI_SBDF(0, uart->ps_bdf[0], uart->ps_bdf[1],
                                   uart->ps_bdf[2]), PCI_COMMAND);
@@ -486,7 +495,7 @@ static void ns16550_suspend(struct serial_port *port)
 
 static void _ns16550_resume(struct serial_port *port)
 {
-#ifdef CONFIG_HAS_PCI
+#ifdef NS16550_PCI
     struct ns16550 *uart = port->uart;
 
     if ( uart->bar )
--
generated by git-patchbot for /home/xen/git/xen.git#staging



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.