forked from Bananymous/banan-os
Kernel: Fix E1000 interrupt handling
E1000 does not support MSI-X and thus does not generate RxQ0 interrupts.
This commit is contained in:
parent
8aa4e4ff1e
commit
7f04b2c96c
|
@ -237,21 +237,28 @@ namespace Kernel
|
||||||
|
|
||||||
BAN::ErrorOr<void> E1000::enable_interrupt()
|
BAN::ErrorOr<void> E1000::enable_interrupt()
|
||||||
{
|
{
|
||||||
|
TRY(m_pci_device.reserve_interrupts(1));
|
||||||
|
|
||||||
write32(REG_ITR, 0x1000);
|
write32(REG_ITR, 0x1000);
|
||||||
|
|
||||||
write32(REG_IVAR, 1 << 3);
|
if (m_pci_device.interrupt_mechanism() == PCI::Device::InterruptMechanism::MSIX)
|
||||||
write32(REG_EITR, 0x1000);
|
{
|
||||||
|
write32(REG_IVAR, 1 << 3);
|
||||||
|
write32(REG_EITR, 0x1000);
|
||||||
|
write32(REG_IMS, IMC_RxQ0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
write32(REG_IMS, IMC_RXT0);
|
||||||
|
}
|
||||||
|
|
||||||
write32(REG_IMS, IMC_RxQ0);
|
write32(REG_ICR, 0xFFFFFFFF);
|
||||||
read32(REG_ICR);
|
|
||||||
|
|
||||||
TRY(m_pci_device.reserve_interrupts(1));
|
|
||||||
m_pci_device.enable_interrupt(0, *this);
|
m_pci_device.enable_interrupt(0, *this);
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BAN::ErrorOr<void> E1000::send_bytes(BAN::MACAddress destination, EtherType protocol, BAN::ConstByteSpan buffer)
|
BAN::ErrorOr<void> E1000::send_bytes(BAN::MACAddress destination, EtherType protocol, BAN::ConstByteSpan buffer)
|
||||||
{
|
{
|
||||||
ASSERT(buffer.size() + sizeof(EthernetHeader) <= E1000_TX_BUFFER_SIZE);
|
ASSERT(buffer.size() + sizeof(EthernetHeader) <= E1000_TX_BUFFER_SIZE);
|
||||||
|
@ -285,7 +292,7 @@ namespace Kernel
|
||||||
|
|
||||||
void E1000::handle_irq()
|
void E1000::handle_irq()
|
||||||
{
|
{
|
||||||
if (!(read32(REG_ICR) & ICR_RxQ0))
|
if (!(read32(REG_ICR) & (ICR_RxQ0 | ICR_RXT0)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SpinLockGuard _(m_lock);
|
SpinLockGuard _(m_lock);
|
||||||
|
|
Loading…
Reference in New Issue