From: Paul Brook <paul@codesourcery.com>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] ARM ethernet fixes
Date: Sun, 18 Dec 2005 16:51:02 +0000 [thread overview]
Message-ID: <200512181651.02705.paul@codesourcery.com> (raw)
In-Reply-To: <200512150000.07159.paul@codesourcery.com>
[-- Attachment #1: Type: text/plain, Size: 991 bytes --]
On Thursday 15 December 2005 00:00, Paul Brook wrote:
> On Wednesday 14 December 2005 22:17, Daniel Jacobowitz wrote:
> > This is enough to let me use apt-get within qemu-system-arm :-)
>
> I'd totally missed that there were _two_ TX FIFOs.
>
> > @@ -364,6 +381,8 @@ static void smc91c111_writeb(void *opaqu
> > return;
> > case 12: /* Interrupt ACK. */
> > s->int_level &= ~(value & 0xd6);
> > + if (value & INT_TX)
> > + smc91c111_pop_tx_fifo_done(s);
> > smc91c111_update(s);
> > return;
>
> I'm fairly sure this is still wrong. We should only clear INT_TX if the tx
> completion fifo is empty. Maybe have smc91c111_update set the INT_TX bit if
> tx_fifo_done_len != 0.
>
> You also need to make smc91c111_reset, smc91c111_writeb: bank 2 offset 0
> cmd 2 (Reset MMU) and smc91c111_writeb: bank 2 offset 0 cmd 7 (Reset TX
> FIFO) set s->tx_fifo_done_len = 0.
Something like the attached patch.
Paul
[-- Attachment #2: patch --]
[-- Type: text/x-diff, Size: 3115 bytes --]
=== hw/smc91c111.c
==================================================================
--- hw/smc91c111.c (revision 1912)
+++ hw/smc91c111.c (local)
@@ -35,8 +35,10 @@
int tx_fifo[NUM_PACKETS];
int rx_fifo_len;
int rx_fifo[NUM_PACKETS];
+ int tx_fifo_done_len;
+ int tx_fifo_done[NUM_PACKETS];
/* Packet buffer memory. */
- uint8_t data[2048][NUM_PACKETS];
+ uint8_t data[NUM_PACKETS][2048];
uint8_t int_level;
uint8_t int_mask;
uint8_t macaddr[6];
@@ -81,6 +83,8 @@
if (s->tx_fifo_len == 0)
s->int_level |= INT_TX_EMPTY;
+ if (s->tx_fifo_done_len != 0)
+ s->int_level |= INT_TX;
level = (s->int_level & s->int_mask) != 0;
pic_set_irq_new(s->pic, s->irq, level);
}
@@ -128,6 +132,18 @@
smc91c111_update(s);
}
+/* Remove an item from the TX completion FIFO. */
+static void smc91c111_pop_tx_fifo_done(smc91c111_state *s)
+{
+ int i;
+
+ if (s->tx_fifo_done_len == 0)
+ return;
+ s->tx_fifo_done_len--;
+ for (i = 0; i < s->tx_fifo_done_len; i++)
+ s->tx_fifo_done[i] = s->tx_fifo_done[i + 1];
+}
+
/* Release the memory allocated to a packet. */
static void smc91c111_release_packet(smc91c111_state *s, int packet)
{
@@ -184,12 +200,13 @@
add_crc = 0;
#endif
if (s->ctr & CTR_AUTO_RELEASE)
+ /* Race? */
smc91c111_release_packet(s, packetnum);
+ else if (s->tx_fifo_done_len < NUM_PACKETS)
+ s->tx_fifo_done[s->tx_fifo_done_len++] = packetnum;
qemu_send_packet(s->vc, p, len);
}
s->tx_fifo_len = 0;
- if ((s->ctr & CTR_AUTO_RELEASE) == 0)
- s->int_level |= INT_TX;
smc91c111_update(s);
}
@@ -206,6 +223,7 @@
{
s->bank = 0;
s->tx_fifo_len = 0;
+ s->tx_fifo_done_len = 0;
s->rx_fifo_len = 0;
s->allocated = 0;
s->packet_num = 0;
@@ -306,6 +324,7 @@
case 2: /* Reset MMU. */
s->allocated = 0;
s->tx_fifo_len = 0;
+ s->tx_fifo_done_len = 0;
s->rx_fifo_len = 0;
s->tx_alloc = 0;
break;
@@ -326,6 +345,7 @@
break;
case 7: /* Reset TX FIFO. */
s->tx_fifo_len = 0;
+ s->tx_fifo_done_len = 0;
break;
}
return;
@@ -364,6 +384,8 @@
return;
case 12: /* Interrupt ACK. */
s->int_level &= ~(value & 0xd6);
+ if (value & INT_TX)
+ smc91c111_pop_tx_fifo_done(s);
smc91c111_update(s);
return;
case 13: /* Interrupt mask. */
@@ -473,10 +495,10 @@
case 3: /* Allocation Result. */
return s->tx_alloc;
case 4: /* TX FIFO */
- if (s->tx_fifo_len == 0)
+ if (s->tx_fifo_done_len == 0)
return 0x80;
else
- return s->tx_fifo[0];
+ return s->tx_fifo_done[0];
case 5: /* RX FIFO */
if (s->rx_fifo_len == 0)
return 0x80;
next prev parent reply other threads:[~2005-12-18 16:52 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-12-14 22:17 [Qemu-devel] ARM ethernet fixes Daniel Jacobowitz
2005-12-15 0:00 ` Paul Brook
2005-12-18 16:51 ` Paul Brook [this message]
2005-12-18 17:25 ` Daniel Jacobowitz
2005-12-18 17:42 ` M. Warner Losh
2005-12-18 17:53 ` Paul Brook
2005-12-18 20:31 ` M. Warner Losh
2005-12-18 17:54 ` Daniel Jacobowitz
2005-12-18 18:50 ` Dave Feustel
2005-12-18 21:57 ` [Qemu-devel] " Antti P Miettinen
2005-12-18 22:29 ` [Qemu-devel] ARM page crossing inside insn? (Re: ARM ethernet fixes) Antti P Miettinen
2005-12-19 9:40 ` [Qemu-devel] " Antti P Miettinen
2005-12-19 15:24 ` Antti P Miettinen
2005-12-19 16:53 ` Daniel Jacobowitz
2005-12-19 19:25 ` Antti P Miettinen
2005-12-26 2:30 ` Antti P Miettinen
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=200512181651.02705.paul@codesourcery.com \
--to=paul@codesourcery.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.