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

[Xen-changelog] [xen-unstable] PCI: bus scan adjustments


  • To: xen-changelog@xxxxxxxxxxxxxxxxxxx
  • From: Xen patchbot-unstable <patchbot@xxxxxxx>
  • Date: Fri, 14 Sep 2012 10:55:26 +0000
  • Delivery-date: Fri, 14 Sep 2012 10:55:31 +0000
  • List-id: "Change log for Mercurial \(receive only\)" <xen-changelog.lists.xen.org>

# HG changeset patch
# User Jan Beulich <jbeulich@xxxxxxxx>
# Date 1347371983 -7200
# Node ID 59b3663316db97d2e5d25501438a8b93d0cb287a
# Parent  9b5e0952ba7c9e6c57e37366f582ec0241fb378e
PCI: bus scan adjustments

As done elsewhere, the ns16550 code shouldn't look at non-zero
functions of a device if that isn't multi-function.

Also both there and in pass-through's _scan_pci_devices() skip looking
at non-zero functions when the device at function zero doesn't exist.

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


diff -r 9b5e0952ba7c -r 59b3663316db xen/drivers/char/ns16550.c
--- a/xen/drivers/char/ns16550.c        Tue Sep 11 15:57:38 2012 +0200
+++ b/xen/drivers/char/ns16550.c        Tue Sep 11 15:59:43 2012 +0200
@@ -470,21 +470,28 @@ static int
 pci_uart_config (struct ns16550 *uart, int skip_amt, int bar_idx)
 {
     uint32_t bar, len;
-    int b, d, f;
+    int b, d, f, nextf;
 
     /* NB. Start at bus 1 to avoid AMT: a plug-in card cannot be on bus 0. */
     for ( b = skip_amt ? 1 : 0; b < 0x100; b++ )
     {
         for ( d = 0; d < 0x20; d++ )
         {
-            for ( f = 0; f < 0x8; f++ )
+            for ( f = 0; f < 8; f = nextf )
             {
+                nextf = (f || (pci_conf_read16(0, b, d, f, PCI_HEADER_TYPE) &
+                               0x80)) ? f + 1 : 8;
+
                 switch ( pci_conf_read16(0, b, d, f, PCI_CLASS_DEVICE) )
                 {
                 case 0x0700: /* single port serial */
                 case 0x0702: /* multi port serial */
                 case 0x0780: /* other (e.g serial+parallel) */
                     break;
+                case 0xffff:
+                    if ( !f )
+                        nextf = 8;
+                    /* fall through */
                 default:
                     continue;
                 }
diff -r 9b5e0952ba7c -r 59b3663316db xen/drivers/passthrough/pci.c
--- a/xen/drivers/passthrough/pci.c     Tue Sep 11 15:57:38 2012 +0200
+++ b/xen/drivers/passthrough/pci.c     Tue Sep 11 15:59:43 2012 +0200
@@ -665,7 +665,11 @@ static int __init _scan_pci_devices(stru
             for ( func = 0; func < 8; func++ )
             {
                 if ( pci_device_detect(pseg->nr, bus, dev, func) == 0 )
+                {
+                    if ( !func )
+                        break;
                     continue;
+                }
 
                 pdev = alloc_pdev(pseg, bus, PCI_DEVFN(dev, func));
                 if ( !pdev )

_______________________________________________
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®.