mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 11:28:12 +00:00
Kernel/PCI: Cache interrupt line and interrupt pin of a device
This allows us to remove the PCI::get_interrupt_line API function. As a result, this removes a bunch of not so great patterns that we used to cache PCI interrupt line in many IRQHandler derived classes instead of just using interrupt_number method of IRQHandler class.
This commit is contained in:
parent
057f5a12c2
commit
a411a44fda
17 changed files with 43 additions and 39 deletions
|
@ -65,7 +65,7 @@ static constexpr u16 UHCI_NUMBER_OF_FRAMES = 1024;
|
|||
KResultOr<NonnullRefPtr<UHCIController>> UHCIController::try_to_initialize(PCI::DeviceIdentifier const& pci_device_identifier)
|
||||
{
|
||||
// NOTE: This assumes that address is pointing to a valid UHCI controller.
|
||||
auto controller = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) UHCIController(pci_device_identifier.address())));
|
||||
auto controller = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) UHCIController(pci_device_identifier)));
|
||||
TRY(controller->initialize());
|
||||
return controller;
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ KResult UHCIController::initialize()
|
|||
{
|
||||
dmesgln("UHCI: Controller found {} @ {}", PCI::get_hardware_id(pci_address()), pci_address());
|
||||
dmesgln("UHCI: I/O base {}", m_io_base);
|
||||
dmesgln("UHCI: Interrupt line: {}", PCI::get_interrupt_line(pci_address()));
|
||||
dmesgln("UHCI: Interrupt line: {}", interrupt_number());
|
||||
|
||||
spawn_port_proc();
|
||||
|
||||
|
@ -82,9 +82,9 @@ KResult UHCIController::initialize()
|
|||
return start();
|
||||
}
|
||||
|
||||
UNMAP_AFTER_INIT UHCIController::UHCIController(PCI::Address address)
|
||||
: PCI::Device(address)
|
||||
, IRQHandler(PCI::get_interrupt_line(address))
|
||||
UNMAP_AFTER_INIT UHCIController::UHCIController(PCI::DeviceIdentifier const& pci_device_identifier)
|
||||
: PCI::Device(pci_device_identifier.address())
|
||||
, IRQHandler(pci_device_identifier.interrupt_line().value())
|
||||
, m_io_base(PCI::get_BAR4(pci_address()) & ~1)
|
||||
{
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue