summaryrefslogtreecommitdiffstats
path: root/sys/dev/pci
diff options
context:
space:
mode:
authorrstone <rstone@FreeBSD.org>2015-03-01 04:26:47 +0000
committerrstone <rstone@FreeBSD.org>2015-03-01 04:26:47 +0000
commitd495e9b4cfbc6d39d704d75ef0f271fe9335f2d1 (patch)
tree8cfce0cb9f6e43e9b1a23798887e1cf43edfdf3a /sys/dev/pci
parent0b55a8c80a8931d02374a071f01ad9db0ef81d38 (diff)
downloadFreeBSD-src-d495e9b4cfbc6d39d704d75ef0f271fe9335f2d1.zip
FreeBSD-src-d495e9b4cfbc6d39d704d75ef0f271fe9335f2d1.tar.gz
MFC r264091
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
Diffstat (limited to 'sys/dev/pci')
-rw-r--r--sys/dev/pci/pci.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c
index db2a6cc..68028b5 100644
--- a/sys/dev/pci/pci.c
+++ b/sys/dev/pci/pci.c
@@ -3344,7 +3344,7 @@ pci_add_children(device_t dev, int domain, int busno, size_t dinfo_size)
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);
@@ -3356,9 +3356,6 @@ pci_add_children(device_t dev, int domain, int busno, size_t dinfo_size)
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
}
OpenPOWER on IntegriCloud