scanning devices should work now
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4756 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -19,23 +19,34 @@ pci_scan_device(uint8 bus, uint8 dev, uint8 func)
|
|||||||
{
|
{
|
||||||
uint16 vendorID;
|
uint16 vendorID;
|
||||||
uint16 deviceID;
|
uint16 deviceID;
|
||||||
uint8 base_class, sub_class;
|
uint8 type, base_class, sub_class;
|
||||||
|
|
||||||
deviceID = pci_read_config(bus, dev, 0, PCI_device_id, 2);
|
deviceID = pci_read_config(bus, dev, func, PCI_device_id, 2);
|
||||||
if (deviceID == 0xffff)
|
if (deviceID == 0xffff)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
dprintf("PCI: pci_scan_device, bus %u, device %u, function %u\n", bus, dev, func);
|
vendorID = pci_read_config(bus, dev, func, PCI_vendor_id, 2);
|
||||||
|
|
||||||
vendorID = pci_read_config(bus, dev, 0, PCI_vendor_id, 2);
|
base_class = pci_read_config(bus, dev, func, PCI_class_base, 1);
|
||||||
|
sub_class = pci_read_config(bus, dev, func, PCI_class_sub, 1);
|
||||||
base_class = pci_read_config(bus, dev, func, PCI_class_base, 1);
|
type = pci_read_config(bus, dev, func, PCI_header_type, 1);
|
||||||
sub_class = pci_read_config(bus, dev, func, PCI_class_sub, 1);
|
|
||||||
|
|
||||||
dprintf("PCI: vendor 0x%04x, device 0x%04x, base_class 0x%02x, sub_class 0x%02x\n",
|
dprintf("PCI: bus %2u, device %2u, function %u: vendor 0x%04x, device 0x%04x, base_class 0x%02x, sub_class 0x%02x\n",
|
||||||
vendorID, deviceID, base_class, sub_class);
|
bus, dev, func, vendorID, deviceID, base_class, sub_class);
|
||||||
|
|
||||||
if (base_class == PCI_bridge) {
|
switch (type & PCI_header_type_mask) {
|
||||||
|
case 0:
|
||||||
|
// dprintf("PCI: Header type 0:\n");
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
// dprintf("PCI: Header type 1:\n");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
dprintf("PCI: Header type unknown (%d)\n", type & PCI_header_type_mask);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (base_class == PCI_bridge && sub_class == PCI_pci) {
|
||||||
uint8 secondary_bus = pci_read_config(bus, dev, func, PCI_secondary_bus, 1);
|
uint8 secondary_bus = pci_read_config(bus, dev, func, PCI_secondary_bus, 1);
|
||||||
pci_scan_bus(secondary_bus);
|
pci_scan_bus(secondary_bus);
|
||||||
}
|
}
|
||||||
@@ -58,12 +69,8 @@ pci_scan_bus(uint8 bus)
|
|||||||
|
|
||||||
deviceID = pci_read_config(bus, dev, 0, PCI_device_id, 2);
|
deviceID = pci_read_config(bus, dev, 0, PCI_device_id, 2);
|
||||||
type = pci_read_config(bus, dev, 0, PCI_header_type, 1);
|
type = pci_read_config(bus, dev, 0, PCI_header_type, 1);
|
||||||
type &= PCI_header_type_mask;
|
|
||||||
if ((type & PCI_multifunction) == 0 /*&& !pci_quirk_multifunction(vendorID, deviceID) */)
|
|
||||||
nfunc = 1;
|
|
||||||
else
|
|
||||||
nfunc = 8;
|
|
||||||
|
|
||||||
|
nfunc = (type & PCI_multifunction) ? 8 : 1;
|
||||||
for (func = 0; func < nfunc; func++)
|
for (func = 0; func < nfunc; func++)
|
||||||
pci_scan_device(bus, dev, func);
|
pci_scan_device(bus, dev, func);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user