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

Kernel: Update Network adapter classes to use the PCI::Device class

Those classes will inherit from the PCI::Device class, thus,
they can still implement IRQ handling.
This commit is contained in:
Liav A 2020-02-22 19:45:32 +02:00 committed by Andreas Kling
parent 73a7e5875e
commit d83a3eff1f
4 changed files with 20 additions and 25 deletions

View file

@ -138,17 +138,16 @@ void RTL8139NetworkAdapter::detect(const PCI::Address& address)
}
RTL8139NetworkAdapter::RTL8139NetworkAdapter(PCI::Address pci_address, u8 irq)
: IRQHandler(irq)
, m_pci_address(pci_address)
: PCI::Device(pci_address, irq)
{
set_interface_name("rtl8139");
kprintf("RTL8139: Found at PCI address %b:%b:%b\n", pci_address.bus(), pci_address.slot(), pci_address.function());
kprintf("RTL8139: Found at PCI address %b:%b:%b\n", get_pci_address().bus(), get_pci_address().slot(), get_pci_address().function());
enable_bus_mastering(m_pci_address);
enable_bus_mastering(get_pci_address());
m_io_base = PCI::get_BAR0(m_pci_address) & ~1;
m_interrupt_line = PCI::get_interrupt_line(m_pci_address);
m_io_base = PCI::get_BAR0(get_pci_address()) & ~1;
m_interrupt_line = PCI::get_interrupt_line(get_pci_address());
kprintf("RTL8139: IO port base: %w\n", m_io_base);
kprintf("RTL8139: Interrupt line: %u\n", m_interrupt_line);
@ -179,7 +178,7 @@ RTL8139NetworkAdapter::~RTL8139NetworkAdapter()
{
}
void RTL8139NetworkAdapter::handle_irq()
void RTL8139NetworkAdapter::handle_irq(RegisterState&)
{
for (;;) {
int status = in16(REG_ISR);