I have this weird problem and I'm looking for ideas on what could be wrong.
I'm trying to write a driver for the RTL8139 network card which is supported in QEMU. I receive interrupts from it when data packets come in but for some reason the RX buffer that it is suppose to fill with incoming packets does not fill.
This is how I initialize the card:
Code: Select all
outb(self->io + RTL8139_CONFIG1, 0x00); // Power on
outb(self->io + RTL8139_CR, 0x10); // Send reset
while (inb(self->io + RTL8139_CR) & 0x10); // Wait for reset to complete
outw(self->io + RTL8139_IMR, RTL8139_ISR_ROK); // Unmask receive ok interrupt
outd(self->io + RTL8139_RBSTART, (unsigned int)self->rx); // Tell the nic to use the self->rx buffer (defined as a char[0x2600])
outd(self->io + RTL8139_RCR, 0xF); // Tell the nic to accept all valid packages
Code: Select all
unsigned int status = inw(driver->io + RTL8139_ISR); // Read isr status
if (status & RTL8139_ISR_ROK)
outw(driver->io + RTL8139_ISR, RTL8139_ISR_ROK);
My first idea was that perhaps the RBSTART address is just pointing to something else and fills in the data somewhere it shouldn't but I have tripple checked that and even hard-coded a physical memory address instead of using the self->rx address but that made no difference what so ever. All memory in this case is also identity mapped so the virtual addresses are the same as the physical ones.
This is the parameters I use for qemu in order to enable RTL8139 for QEMU:
Code: Select all
-net nic,model=rtl8139 -net tap,script=no,downscript=no,ifname=tap0