Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 3 Apr 2014 22:32:13 +0000 (UTC)
From:      Ryan Stone <rstone@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r264091 - head/sys/dev/pci
Message-ID:  <201404032232.s33MWDlj029641@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rstone
Date: Thu Apr  3 22:32:12 2014
New Revision: 264091
URL: http://svnweb.freebsd.org/changeset/base/264091

Log:
  Correct a PCI enumeration bug introduced in r264011
  
  Ensure that first_func is set to 0 on every iteration of the PCI slot
  enumeration loop after the first.  There is a continue statement that would
  cause first_func to stay at 1 any PCI device where slot 0 has no functions
  until we find a slot that does have a function.  This would cause us to
  not enumerate the first PCI function on the device.
  
  Credit to markj@ for spotting the bug.
  
  X-MFC-With: r264011

Modified:
  head/sys/dev/pci/pci.c

Modified: head/sys/dev/pci/pci.c
==============================================================================
--- head/sys/dev/pci/pci.c	Thu Apr  3 22:22:10 2014	(r264090)
+++ head/sys/dev/pci/pci.c	Thu Apr  3 22:32:12 2014	(r264091)
@@ -3503,7 +3503,7 @@ pci_add_children(device_t dev, int domai
 	KASSERT(dinfo_size >= sizeof(struct pci_devinfo),
 	    ("dinfo_size too small"));
 	maxslots = PCIB_MAXSLOTS(pcib);
-	for (s = 0; s <= maxslots; s++) {
+	for (s = 0; s <= maxslots; s++, first_func = 0) {
 		pcifunchigh = 0;
 		f = 0;
 		DELAY(1);
@@ -3515,9 +3515,6 @@ pci_add_children(device_t dev, int domai
 		for (f = first_func; f <= pcifunchigh; f++)
 			pci_identify_function(pcib, dev, domain, busno, s, f,
 			    dinfo_size);
-
-		/* For slots after slot 0 we need to check for function 0. */
-		first_func = 0;
 	}
 #undef REG
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201404032232.s33MWDlj029641>