1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 02:37:42 +00:00

Kernel/PCI: Remove Address from enumeration callback

If we need that address, we can always get it from the DeviceIdentifier.
This commit is contained in:
Liav A 2021-09-23 11:05:00 +03:00 committed by Andreas Kling
parent a411a44fda
commit 9d9d57056e
13 changed files with 27 additions and 30 deletions

View file

@ -15,15 +15,12 @@ static SerialDevice* s_the = nullptr;
UNMAP_AFTER_INIT void PCISerialDevice::detect()
{
size_t current_device_minor = 68;
PCI::enumerate([&](const PCI::Address& address, PCI::DeviceIdentifier const& device_identifier) {
if (address.is_null())
return;
PCI::enumerate([&](PCI::DeviceIdentifier const& device_identifier) {
for (auto& board_definition : board_definitions) {
if (board_definition.device_id != device_identifier.hardware_id())
continue;
auto bar_base = PCI::get_BAR(address, board_definition.pci_bar) & ~1;
auto bar_base = PCI::get_BAR(device_identifier.address(), board_definition.pci_bar) & ~1;
auto port_base = IOAddress(bar_base + board_definition.first_offset);
for (size_t i = 0; i < board_definition.port_count; i++) {
auto serial_device = new SerialDevice(port_base.offset(board_definition.port_size * i), current_device_minor++);
@ -36,7 +33,7 @@ UNMAP_AFTER_INIT void PCISerialDevice::detect()
// NOTE: We intentionally leak the reference to serial_device here, as it is eternal
}
dmesgln("PCISerialDevice: Found {} @ {}", board_definition.name, address);
dmesgln("PCISerialDevice: Found {} @ {}", board_definition.name, device_identifier.address());
return;
}
});