Kernel: Fix RTL8169 driver
This now works properly on real hardware. Main issue was a race condition with now ISR was handled in the interrupt handler. We now loop until we read back ISR as zero
This commit is contained in:
@@ -7,25 +7,25 @@ namespace Kernel
|
||||
|
||||
enum RTL8169_IO_REGS : uint16_t
|
||||
{
|
||||
RTL8169_IO_IDR0 = 0x00,
|
||||
RTL8169_IO_IDR1 = 0x01,
|
||||
RTL8169_IO_IDR2 = 0x02,
|
||||
RTL8169_IO_IDR3 = 0x03,
|
||||
RTL8169_IO_IDR4 = 0x04,
|
||||
RTL8169_IO_IDR5 = 0x05,
|
||||
RTL8169_IO_IDR0 = 0x00,
|
||||
RTL8169_IO_IDR1 = 0x01,
|
||||
RTL8169_IO_IDR2 = 0x02,
|
||||
RTL8169_IO_IDR3 = 0x03,
|
||||
RTL8169_IO_IDR4 = 0x04,
|
||||
RTL8169_IO_IDR5 = 0x05,
|
||||
|
||||
RTL8169_IO_TNPDS = 0x20,
|
||||
RTL8169_IO_CR = 0x37,
|
||||
RTL8169_IO_TPPoll = 0x38,
|
||||
RTL8169_IO_IMR = 0x3C,
|
||||
RTL8169_IO_ISR = 0x3E,
|
||||
RTL8169_IO_TCR = 0x40,
|
||||
RTL8169_IO_RCR = 0x44,
|
||||
RTL8169_IO_9346CR = 0x50,
|
||||
RTL8169_IO_PHYSts = 0x6C,
|
||||
RTL8169_IO_RMS = 0xDA,
|
||||
RTL8169_IO_RDSAR = 0xE4,
|
||||
RTL8169_IO_MTPS = 0xEC,
|
||||
RTL8169_IO_TNPDS = 0x20,
|
||||
RTL8169_IO_CR = 0x37,
|
||||
RTL8169_IO_TPPoll = 0x38,
|
||||
RTL8169_IO_IMR = 0x3C,
|
||||
RTL8169_IO_ISR = 0x3E,
|
||||
RTL8169_IO_TCR = 0x40,
|
||||
RTL8169_IO_RCR = 0x44,
|
||||
RTL8169_IO_PHYSts = 0x6C,
|
||||
RTL8169_IO_RMS = 0xDA,
|
||||
RTL8169_IO_CPlusCR = 0xE0,
|
||||
RTL8169_IO_RDSAR = 0xE4,
|
||||
RTL8169_IO_MTPS = 0xEC,
|
||||
};
|
||||
|
||||
enum RTL8169_CR : uint8_t
|
||||
|
||||
@@ -64,14 +64,17 @@ namespace Kernel
|
||||
BAN::UniqPtr<DMARegion> m_rx_descriptor_region;
|
||||
BAN::UniqPtr<DMARegion> m_tx_descriptor_region;
|
||||
|
||||
SpinLock m_lock;
|
||||
BAN::Atomic<bool> m_rx_thread_should_die { false };
|
||||
BAN::Atomic<bool> m_rx_thread_is_dead { true };
|
||||
|
||||
bool m_thread_should_die { false };
|
||||
BAN::Atomic<bool> m_thread_is_dead { true };
|
||||
ThreadBlocker m_thread_blocker;
|
||||
uint32_t m_rx_head { 0 };
|
||||
SpinLock m_rx_lock;
|
||||
ThreadBlocker m_rx_blocker;
|
||||
|
||||
uint32_t m_rx_current { 0 };
|
||||
size_t m_tx_current { 0 };
|
||||
BAN::Atomic<uint32_t> m_tx_head { 0 };
|
||||
BAN::Atomic<uint32_t> m_tx_commit { 0 };
|
||||
SpinLock m_tx_lock;
|
||||
ThreadBlocker m_tx_blocker;
|
||||
|
||||
BAN::MACAddress m_mac_address {};
|
||||
BAN::Atomic<bool> m_link_up { false };
|
||||
|
||||
Reference in New Issue
Block a user