qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] Re: [PATCH] ne2000 and Netware 3.11 (Revised patch)


From: Mark Jonckheere
Subject: [Qemu-devel] Re: [PATCH] ne2000 and Netware 3.11 (Revised patch)
Date: Fri, 08 Apr 2005 15:56:11 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.9) Gecko/20020408

Fabrice Bellard wrote:

This patch is not correct: it limits the memory to 16K, not 32K because the memory starts at a 16K offset. A possible solution could be to wrap to 16K only if (tpsr << 8) >= 48K. Moreover, it should be done in the packet transmit code.

The patch worked because standard drivers know that an original ne2000
card only has 16K RAM. I wonder if Netware works with a 32K ne2000-clone.

I include two possible revised patches:

The first one is just a more consistent rewrite of the previous patch:

++8<++cut+here++>8++
--- ne2000.c    Sun Oct  3 15:56:00 2004
+++ ne2000-p1.c Fri Apr  8 15:05:52 2005
@@ -103,7 +103,7 @@
 #define ENTSR_CDH 0x40 /* The collision detect "heartbeat" signal was lost. */
 #define ENTSR_OWC 0x80  /* There was an out-of-window collision. */

-#define NE2000_PMEM_SIZE    (32*1024)
+#define NE2000_PMEM_SIZE    (16*1024)
 #define NE2000_PMEM_START   (16*1024)
 #define NE2000_PMEM_END     (NE2000_PMEM_SIZE+NE2000_PMEM_START)
 #define NE2000_MEM_SIZE     NE2000_PMEM_END
@@ -268,6 +268,7 @@
                 /* signal end of transfert */
                 s->tsr = ENTSR_PTX;
                 s->isr |= ENISR_TX;
+                s->cmd &= ~E8390_TRANS;
                 ne2000_update_irq(s);
             }
         }
@@ -289,7 +290,8 @@
             ne2000_update_irq(s);
             break;
         case EN0_TPSR:
-            s->tpsr = val;
+            /* XXX: only 16K memory available, ignore bit 8 */
+            s->tpsr = val & 0x7f;
             break;
         case EN0_TCNTLO:
             s->tcnt = (s->tcnt & 0xff00) | val;
++8<++cut+here++>8++

in the second one the correction is in the packet transmit code as you asked

++8<++cut+here++>8++
--- ne2000.c    Sun Oct  3 15:56:00 2004
+++ ne2000-p2.c Fri Apr  8 15:06:01 2005
@@ -247,6 +247,7 @@
 {
     NE2000State *s = opaque;
     int offset, page;
+    int index;

     addr &= 0xf;
 #ifdef DEBUG_NE2000
@@ -264,10 +265,15 @@
                 ne2000_update_irq(s);
             }
             if (val & E8390_TRANS) {
-                qemu_send_packet(s->nd, s->mem + (s->tpsr << 8), s->tcnt);
+                /* XXX: next 3 lines are a hack to make netware 3.11 work */
+                index = s->tpsr << 8;
+                if (index >= NE2000_PMEM_END)
+                    index -= NE2000_PMEM_SIZE;
+                qemu_send_packet(s->nd, s->mem + index, s->tcnt);
                 /* signal end of transfert */
                 s->tsr = ENTSR_PTX;
                 s->isr |= ENISR_TX;
+                s->cmd &= ~E8390_TRANS;
                 ne2000_update_irq(s);
             }
         }
++8<++cut+here++>8++

greetings
Mark.
--
:wq








reply via email to

[Prev in Thread] Current Thread [Next in Thread]