Skip to contentSkip to conversation

patch to make ne2000 usable in Minix 2.0.4

Qemu-devel Jim C. Brown 1 participant 1 message May 25, 2004

lore
Share & tools
lore
#0 lore raw

I've managed to apply this patch to the current CVS.

I'm not sure what the exact problem with the Minix NE2000 driver is. I do know that it has something to do with the Bochs PANIC message: "tx start, dev in reset". As far as I can see, it appears that Minix is trying to send packets over the ne2k w/o initializing it properly. This prevents Minix from actually using the NIC, although it is able to detect it w/o any problems. My patch basicly forces qemu to allow Minix to work with the NIC. I should emphasize that this is a Minix bug, and my patch is a workaround for it. (However, from what I've heard real NICs work fine with the Minix driver in spite of its bug.)

Before you yell at me for trying to fix Minix's bugs in qemu, I should add that the NE2000 in Bochs works just perfectly with Minix.

Signature · 2 lines
Infinite complexity begets infinite beauty.
Infinite precision begets infinite perfection.
ne2000.c renamed from ne2000.c.old +19 -0
@@ -271,6 +271,25 @@
                 ne2000_update_irq(s);
             }
         }
+        /* this is a workaround for a bug in Minix 2.0.4net */
+        else if (val & E8390_TRANS) {
+            printf("NE2000: I quote thy Bochs: tx start, dev in reset\n");
+        /* this printf above is just to annoy the user endlessly. **
+        ** feel free to remove it if you must. */
+            s->isr &= ~ENISR_RESET;
+            /* test specific case: zero length transfert **
+            ** not sure if it is needed */
+            if ((val & (E8390_RREAD | E8390_RWRITE)) &&
+                s->rcnt == 0) {
+                s->isr |= ENISR_RDC;
+                ne2000_update_irq(s);
+            }
+            qemu_send_packet(s->nd, s->mem + (s->tpsr << 8), s->tcnt);
+            /* signal end of transfert */
+            s->tsr = ENTSR_PTX;
+            s->isr |= ENISR_TX;
+            ne2000_update_irq(s);
+        }
     } else {
         page = s->cmd >> 6;
         offset = addr | (page << 4);