mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 10:47:35 +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);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ UNMAP_AFTER_INIT void USBManagement::enumerate_controllers()
|
|||
if (kernel_command_line().disable_usb())
|
||||
return;
|
||||
|
||||
PCI::enumerate([this](PCI::Address const& address, PCI::DeviceIdentifier const& device_identifier) {
|
||||
PCI::enumerate([this](PCI::DeviceIdentifier const& device_identifier) {
|
||||
if (!(device_identifier.class_code().value() == 0xc && device_identifier.subclass_code().value() == 0x3))
|
||||
return;
|
||||
if (device_identifier.prog_if().value() == 0x0) {
|
||||
|
@ -41,21 +41,21 @@ UNMAP_AFTER_INIT void USBManagement::enumerate_controllers()
|
|||
}
|
||||
|
||||
if (device_identifier.prog_if().value() == 0x10) {
|
||||
dmesgln("USBManagement: OHCI controller found at {} is not currently supported.", address);
|
||||
dmesgln("USBManagement: OHCI controller found at {} is not currently supported.", device_identifier.address());
|
||||
return;
|
||||
}
|
||||
|
||||
if (device_identifier.prog_if().value() == 0x20) {
|
||||
dmesgln("USBManagement: EHCI controller found at {} is not currently supported.", address);
|
||||
dmesgln("USBManagement: EHCI controller found at {} is not currently supported.", device_identifier.address());
|
||||
return;
|
||||
}
|
||||
|
||||
if (device_identifier.prog_if().value() == 0x30) {
|
||||
dmesgln("USBManagement: xHCI controller found at {} is not currently supported.", address);
|
||||
dmesgln("USBManagement: xHCI controller found at {} is not currently supported.", device_identifier.address());
|
||||
return;
|
||||
}
|
||||
|
||||
dmesgln("USBManagement: Unknown/unsupported controller at {} with programming interface 0x{:02x}", address, device_identifier.prog_if().value());
|
||||
dmesgln("USBManagement: Unknown/unsupported controller at {} with programming interface 0x{:02x}", device_identifier.address(), device_identifier.prog_if().value());
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ UNMAP_AFTER_INIT void detect()
|
|||
{
|
||||
if (kernel_command_line().disable_virtio())
|
||||
return;
|
||||
PCI::enumerate([&](const PCI::Address&, PCI::DeviceIdentifier const& device_identifier) {
|
||||
PCI::enumerate([&](PCI::DeviceIdentifier const& device_identifier) {
|
||||
if (device_identifier.hardware_id().is_null())
|
||||
return;
|
||||
// TODO: We should also be checking that the device_id is in between 0x1000 - 0x107F inclusive
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue