Fix PCI enumeration
diff --git a/src/kernel/dri/pci/pci.c b/src/kernel/dri/pci/pci.c
index 39622a5..67355a0 100644
--- a/src/kernel/dri/pci/pci.c
+++ b/src/kernel/dri/pci/pci.c
@@ -14,13 +14,13 @@
struct pci_vendor *pci_check_vendor(uchar bus, uchar slot, uchar func, uint *v)
{
- uint vendor;
+ uint vendor = pci_config_readd(bus, slot, func, 0);
- if ((vendor = pci_config_readd(bus, slot, func, 0) != ~0))
+ if (v)
+ *v = vendor;
+
+ if (vendor != ~0)
{
- if (v)
- *v = vendor;
-
return pci_vendor_by_id(vendor);
}
return NULL;
diff --git a/src/kernel/main.c b/src/kernel/main.c
index 83aa9a8..55c562a 100644
--- a/src/kernel/main.c
+++ b/src/kernel/main.c
@@ -88,6 +88,7 @@
test_ata_pio();
#endif
+ kprintf("Enumerating PCI devices:\n");
for (int bus = 0; bus < 0xff; bus++)
{
for (int slot = 0; slot < 32; slot++)
@@ -100,7 +101,7 @@
if (vendor != ~0)
{
- kprintf("%d %d %d %d\n", bus, slot, func, vendor);
+ kprintf("%d %d %d --- 0x%x --- %s\n", bus, slot, func, vendor, v->name);
}
}
}