diff options
author | Liav A <liavalb@gmail.com> | 2021-09-23 09:05:34 +0300 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-09-29 11:24:33 +0200 |
commit | 82bb08a15cbe447b5b0deeac16cccc22bf1c1c57 (patch) | |
tree | ecb5dc7c013c1f11516fb8c74561be10179fa7d2 /Kernel/Bus/VirtIO | |
parent | e22d9dc360d123b5b3c847a9ec882da220dc8e66 (diff) | |
download | serenity-82bb08a15cbe447b5b0deeac16cccc22bf1c1c57.zip |
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.
Diffstat (limited to 'Kernel/Bus/VirtIO')
-rw-r--r-- | Kernel/Bus/VirtIO/Device.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Kernel/Bus/VirtIO/Device.cpp b/Kernel/Bus/VirtIO/Device.cpp index 3a24986a1f..e47cf07912 100644 --- a/Kernel/Bus/VirtIO/Device.cpp +++ b/Kernel/Bus/VirtIO/Device.cpp @@ -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; } }); |