1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-24 11:29:10 +00:00

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
This commit is contained in:
Ryan Stone 2014-04-03 22:32:12 +00:00
parent e4dbff8af6
commit c8912fcbdf
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=264091

View File

@ -3503,7 +3503,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);
@ -3515,9 +3515,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
}