mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 01:37:36 +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:
parent
a411a44fda
commit
9d9d57056e
13 changed files with 27 additions and 30 deletions
|
@ -17,7 +17,7 @@ u8 read8(Address address, u32 field) { return Access::the().read8_field(address,
|
|||
u16 read16(Address address, u32 field) { return Access::the().read16_field(address, field); }
|
||||
u32 read32(Address address, u32 field) { return Access::the().read32_field(address, field); }
|
||||
|
||||
void enumerate(Function<void(Address, DeviceIdentifier const&)> callback)
|
||||
void enumerate(Function<void(DeviceIdentifier const&)> callback)
|
||||
{
|
||||
Access::the().fast_enumerate(callback);
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ u32 read32(Address address, u32 field);
|
|||
|
||||
HardwareID get_hardware_id(PCI::Address);
|
||||
bool is_io_space_enabled(Address);
|
||||
void enumerate(Function<void(Address, DeviceIdentifier const&)> callback);
|
||||
void enumerate(Function<void(DeviceIdentifier const&)> callback);
|
||||
void enable_interrupt_line(Address);
|
||||
void disable_interrupt_line(Address);
|
||||
void raw_access(Address, u32, size_t, u32);
|
||||
|
|
|
@ -425,12 +425,12 @@ UNMAP_AFTER_INIT void Access::enumerate_bus(int type, u8 bus, bool recursive)
|
|||
enumerate_device(type, bus, device, recursive);
|
||||
}
|
||||
|
||||
void Access::fast_enumerate(Function<void(Address, DeviceIdentifier const&)>& callback) const
|
||||
void Access::fast_enumerate(Function<void(DeviceIdentifier const&)>& callback) const
|
||||
{
|
||||
MutexLocker locker(m_scan_lock);
|
||||
VERIFY(!m_device_identifiers.is_empty());
|
||||
for (auto& device_identifier : m_device_identifiers) {
|
||||
callback(device_identifier.address(), device_identifier);
|
||||
callback(device_identifier);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ public:
|
|||
static bool initialize_for_memory_access(PhysicalAddress mcfg_table);
|
||||
static bool initialize_for_io_access();
|
||||
|
||||
void fast_enumerate(Function<void(Address, DeviceIdentifier const&)>&) const;
|
||||
void fast_enumerate(Function<void(DeviceIdentifier const&)>&) const;
|
||||
void rescan_hardware();
|
||||
|
||||
static Access& the();
|
||||
|
|
|
@ -56,8 +56,8 @@ UNMAP_AFTER_INIT void initialize()
|
|||
|
||||
PCI::PCIBusSysFSDirectory::initialize();
|
||||
|
||||
PCI::enumerate([&](const Address& address, DeviceIdentifier const& device_identifier) {
|
||||
dmesgln("{} {}", address, device_identifier.hardware_id());
|
||||
PCI::enumerate([&](DeviceIdentifier const& device_identifier) {
|
||||
dmesgln("{} {}", device_identifier.address(), device_identifier.hardware_id());
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -41,8 +41,8 @@ UNMAP_AFTER_INIT void PCIBusSysFSDirectory::initialize()
|
|||
UNMAP_AFTER_INIT PCIBusSysFSDirectory::PCIBusSysFSDirectory()
|
||||
: SysFSDirectory("pci", SysFSComponentRegistry::the().buses_directory())
|
||||
{
|
||||
PCI::enumerate([&](const Address& address, DeviceIdentifier const&) {
|
||||
auto pci_device = PCI::PCIDeviceSysFSDirectory::create(*this, address);
|
||||
PCI::enumerate([&](DeviceIdentifier const& device_identifier) {
|
||||
auto pci_device = PCI::PCIDeviceSysFSDirectory::create(*this, device_identifier.address());
|
||||
m_components.append(pci_device);
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue