svn commit: r264091 - head/sys/dev/pci

Ryan Stone rstone at FreeBSD.org
Thu Apr 3 22:32:13 UTC 2014


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
 }


More information about the svn-src-all mailing list