pci: handle setups without a host bridge?

This commit is contained in:
K. Lange 2021-06-15 21:18:14 +09:00
parent 186d44349a
commit 8b1973d31e

View File

@ -106,14 +106,24 @@ void pci_scan(pci_func_t f, int type, void * extra) {
return;
}
int hit = 0;
for (int func = 0; func < 8; ++func) {
uint32_t dev = pci_box_device(0, 0, func);
if (pci_read_field(dev, PCI_VENDOR_ID, 2) != PCI_NONE) {
hit = 1;
pci_scan_bus(f, type, func, extra);
} else {
break;
}
}
if (!hit) {
for (int bus = 0; bus < 256; ++bus) {
for (int slot = 0; slot < 32; ++slot) {
pci_scan_slot(f,type,bus,slot,extra);
}
}
}
}
/**