mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:17:44 +00:00
Kernel/PCI: Cache more details about PCI devices when enumerating them
There's no good reason to fetch these values each time we need them.
This commit is contained in:
parent
e22d9dc360
commit
82bb08a15c
14 changed files with 85 additions and 41 deletions
|
@ -18,13 +18,13 @@ UNMAP_AFTER_INIT void detect()
|
|||
{
|
||||
if (kernel_command_line().disable_virtio())
|
||||
return;
|
||||
PCI::enumerate([&](const PCI::Address& address, PCI::ID id) {
|
||||
if (address.is_null() || id.is_null())
|
||||
PCI::enumerate([&](const PCI::Address& address, PCI::PhysicalID const& physical_id) {
|
||||
if (address.is_null() || physical_id.id().is_null())
|
||||
return;
|
||||
// TODO: We should also be checking that the device_id is in between 0x1000 - 0x107F inclusive
|
||||
if (id.vendor_id != PCI::VendorID::VirtIO)
|
||||
if (physical_id.id().vendor_id != PCI::VendorID::VirtIO)
|
||||
return;
|
||||
switch (id.device_id) {
|
||||
switch (physical_id.id().device_id) {
|
||||
case PCI::DeviceID::VirtIOConsole: {
|
||||
auto& console = Console::must_create(address).leak_ref();
|
||||
console.initialize();
|
||||
|
@ -40,7 +40,7 @@ UNMAP_AFTER_INIT void detect()
|
|||
break;
|
||||
}
|
||||
default:
|
||||
dbgln_if(VIRTIO_DEBUG, "VirtIO: Unknown VirtIO device with ID: {}", id.device_id);
|
||||
dbgln_if(VIRTIO_DEBUG, "VirtIO: Unknown VirtIO device with ID: {}", physical_id.id().device_id);
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue