1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 18:57:45 +00:00

Kernel: Keep records of PCI::Address & PCI::ID pairs for enumeration

This commit is contained in:
Liav A 2020-04-10 20:25:03 +03:00 committed by Andreas Kling
parent 688dd9ea66
commit 65f939b55c
12 changed files with 49 additions and 13 deletions

View file

@ -39,6 +39,9 @@ void IOAccess::initialize()
IOAccess::IOAccess()
{
klog() << "PCI: Using I/O instructions for PCI configuration space access";
enumerate_hardware([&](const Address& address, ID id) {
m_physical_ids.append({ address, id });
});
}
u8 IOAccess::read8_field(Address address, u32 field)
@ -75,7 +78,7 @@ void IOAccess::write32_field(Address address, u32 field, u32 value)
IO::out32(PCI_VALUE_PORT, value);
}
void IOAccess::enumerate_all(Function<void(Address, ID)>& callback)
void IOAccess::enumerate_hardware(Function<void(Address, ID)> callback)
{
// Single PCI host controller.
if ((read8_field(Address(), PCI_HEADER_TYPE) & 0x80) == 0) {