mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 22:57:44 +00:00
Kernel/PCI: Fix support of multiple PCI host controllers enumeration
First scan PCI bus 0. Find any device on that bus, and if it's a PCI-to-PCI bridge, recursively scan it too. Then try to handle Multiple PCI host bridges on slot 0, device 0. If we happen to miss some PCI buses because they are not reachable through recursive PCI-to-PCI bridges scanning starting from bus 0, we might find them in this scanning.
This commit is contained in:
parent
c6ffee7f18
commit
07474b4349
3 changed files with 24 additions and 11 deletions
|
@ -35,6 +35,7 @@ bool Access::is_initialized()
|
|||
}
|
||||
|
||||
UNMAP_AFTER_INIT Access::Access()
|
||||
: m_enumerated_buses(256, false)
|
||||
{
|
||||
s_access = this;
|
||||
}
|
||||
|
@ -85,10 +86,11 @@ void Access::enumerate_functions(int type, u8 bus, u8 device, u8 function, Funct
|
|||
Address address(0, bus, device, function);
|
||||
if (type == -1 || type == early_read_type(address))
|
||||
callback(address, { early_read16_field(address, PCI_VENDOR_ID), early_read16_field(address, PCI_DEVICE_ID) });
|
||||
if (early_read_type(address) == PCI_TYPE_BRIDGE && recursive) {
|
||||
if (early_read_type(address) == PCI_TYPE_BRIDGE && recursive && (!m_enumerated_buses.get(early_read8_field(address, PCI_SECONDARY_BUS)))) {
|
||||
u8 secondary_bus = early_read8_field(address, PCI_SECONDARY_BUS);
|
||||
dbgln_if(PCI_DEBUG, "PCI: Found secondary bus: {}", secondary_bus);
|
||||
VERIFY(secondary_bus != bus);
|
||||
m_enumerated_buses.set(secondary_bus, true);
|
||||
enumerate_bus(type, secondary_bus, callback, recursive);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue