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

[Xen-changelog] [xen-unstable] ns16550: adjust suspend/resume logic


  • To: xen-changelog@xxxxxxxxxxxxxxxxxxx
  • From: Xen patchbot-unstable <patchbot@xxxxxxx>
  • Date: Mon, 14 May 2012 16:32:15 +0000
  • Delivery-date: Mon, 14 May 2012 16:32:21 +0000
  • List-id: "Change log for Mercurial \(receive only\)" <xen-changelog.lists.xen.org>

# HG changeset patch
# User Jan Beulich <jbeulich@xxxxxxxx>
# Date 1336476854 -7200
# Node ID ea7c9cabd7ad9ccbdf0c2d1a71e479b69d24ea5b
# Parent  f3fd3136f7a04b8d4e9a6ef1e6787810bae198e9
ns16550: adjust suspend/resume logic

- no need to read BAR during suspend
- command register is 16-bits rather than 32
- BAR and command register must be restored before trying to access
  the device
- use ps_bdf[] for storing the device coordinates (pb_bdf[] is used to
  store the bridge's ones)

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Acked-by: Keir Fraser <keir@xxxxxxx>
---


diff -r f3fd3136f7a0 -r ea7c9cabd7ad xen/drivers/char/ns16550.c
--- a/xen/drivers/char/ns16550.c        Tue May 08 13:33:16 2012 +0200
+++ b/xen/drivers/char/ns16550.c        Tue May 08 13:34:14 2012 +0200
@@ -49,7 +49,9 @@ static struct ns16550 {
     unsigned int ps_bdf[3]; /* pci serial port BDF */
     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 */
-    int bar, cr, bar_idx;
+    u32 bar;
+    u16 cr;
+    u8 bar_idx;
 } ns16550_com[2] = { { 0 } };
 
 /* Register offsets */
@@ -324,30 +326,24 @@ static void ns16550_suspend(struct seria
     stop_timer(&uart->timer);
 
     if ( uart->bar )
-    {
-       uart->bar = pci_conf_read32(
-           0, uart->pb_bdf[0], uart->pb_bdf[1], uart->pb_bdf[2],
-           PCI_BASE_ADDRESS_0 + uart->bar_idx*4);
-       uart->cr = pci_conf_read32(
-           0, uart->pb_bdf[0], uart->pb_bdf[1], uart->pb_bdf[2],
-           PCI_COMMAND);
-    }
+       uart->cr = pci_conf_read16(0, uart->ps_bdf[0], uart->ps_bdf[1],
+                                  uart->ps_bdf[2], PCI_COMMAND);
 }
 
 static void ns16550_resume(struct serial_port *port)
 {
     struct ns16550 *uart = port->uart;
 
+    if ( uart->bar )
+    {
+       pci_conf_write32(0, uart->ps_bdf[0], uart->ps_bdf[1], uart->ps_bdf[2],
+                        PCI_BASE_ADDRESS_0 + uart->bar_idx*4, uart->bar);
+       pci_conf_write16(0, uart->ps_bdf[0], uart->ps_bdf[1], uart->ps_bdf[2],
+                        PCI_COMMAND, uart->cr);
+    }
+
     ns16550_setup_preirq(port->uart);
     ns16550_setup_postirq(port->uart);
-
-    if ( uart->bar )
-    {
-       pci_conf_write32(0, uart->pb_bdf[0], uart->pb_bdf[1], uart->pb_bdf[2],
-                        PCI_BASE_ADDRESS_0 + uart->bar_idx*4, uart->bar);
-       pci_conf_write32(0, uart->pb_bdf[0], uart->pb_bdf[1], uart->pb_bdf[2],
-                        PCI_COMMAND, uart->cr);
-    }
 }
 
 #ifdef CONFIG_X86
@@ -483,9 +479,9 @@ pci_uart_config (struct ns16550 *uart, i
                 if ( (len & 0xffff) != 0xfff9 )
                     continue;
 
-                uart->pb_bdf[0] = b;
-                uart->pb_bdf[1] = d;
-                uart->pb_bdf[2] = f;
+                uart->ps_bdf[0] = b;
+                uart->ps_bdf[1] = d;
+                uart->ps_bdf[2] = f;
                 uart->bar = bar;
                 uart->bar_idx = bar_idx;
                 uart->io_base = bar & 0xfffe;

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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