qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Mark Jonckheere <mark.jonckheere@easynet.be>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] Re: [PATCH] ne2000 and Netware 3.11 (Revised patch)
Date: Fri, 08 Apr 2005 15:56:11 +0200	[thread overview]
Message-ID: <42568D7B.8070806@easynet.be> (raw)
In-Reply-To: 425594EF.5090801@bellard.org

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	other threads:[~2005-04-08 13:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-23 12:01 [Qemu-devel] [PATCH] ne2000 and Netware 3.11 Mark Jonckheere
2005-04-07 20:15 ` Fabrice Bellard
2005-04-08 13:56   ` Mark Jonckheere [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=42568D7B.8070806@easynet.be \
    --to=mark.jonckheere@easynet.be \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).