mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:37:35 +00:00
Kernel: Detect devices when enumerating the PCI bus
Instead of making each driver to enumerate the PCI bus itself, PCI::Initializer will call detect_devices() to do one enumeration of the bus.
This commit is contained in:
parent
60715695b2
commit
583e9ad372
10 changed files with 64 additions and 50 deletions
|
@ -77,6 +77,11 @@ void PCI::Access::enumerate_slot(int type, u8 bus, u8 slot, Function<void(Addres
|
|||
}
|
||||
}
|
||||
|
||||
PCI::ID PCI::Access::get_id(Address address)
|
||||
{
|
||||
return { read16_field(address, PCI_VENDOR_ID), read16_field(address, PCI_DEVICE_ID) };
|
||||
}
|
||||
|
||||
void PCI::Access::enumerate_bus(int type, u8 bus, Function<void(Address, ID)>& callback)
|
||||
{
|
||||
for (u8 slot = 0; slot < 32; ++slot)
|
||||
|
@ -105,6 +110,11 @@ void enumerate_all(Function<void(Address, ID)> callback)
|
|||
PCI::Access::the().enumerate_all(callback);
|
||||
}
|
||||
|
||||
ID get_id(Address address)
|
||||
{
|
||||
return PCI::Access::the().get_id(address);
|
||||
}
|
||||
|
||||
u8 get_interrupt_line(Address address)
|
||||
{
|
||||
return PCI::Access::the().get_interrupt_line(address);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue