From: Daniel Jacobowitz <drow@false.org>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] ARM ethernet fixes
Date: Wed, 14 Dec 2005 17:17:05 -0500 [thread overview]
Message-ID: <20051214221705.GA21427@nevyn.them.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 430 bytes --]
This is enough to let me use apt-get within qemu-system-arm :-)
What it doesn't have, today, is a hard drive. I have some truly
hideous qemu patches, and a Linux block driver that Paul wrote, that
use ARM "semihosting" traps to simulate a block device using a host
file. Ideally someone'll get around to emulating the Integrator/AP,
which has a PCI bus, and then we can do it normally.
--
Daniel Jacobowitz
CodeSourcery, LLC
[-- Attachment #2: qemu-arm-ethernet.patch --]
[-- Type: text/plain, Size: 2478 bytes --]
Index: qemu/hw/smc91c111.c
===================================================================
--- qemu.orig/hw/smc91c111.c 2005-12-13 19:31:38.000000000 -0800
+++ qemu/hw/smc91c111.c 2005-12-13 19:32:29.000000000 -0800
@@ -35,8 +35,10 @@ typedef struct {
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];
@@ -128,6 +130,18 @@ static void smc91c111_pop_rx_fifo(smc91c
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 +198,15 @@ static void smc91c111_do_tx(smc91c111_st
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;
+ s->tx_fifo_len = 0;
smc91c111_update(s);
}
@@ -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;
case 13: /* Interrupt mask. */
@@ -473,10 +492,10 @@ static uint32_t smc91c111_readb(void *op
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 reply other threads:[~2005-12-14 22:17 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-12-14 22:17 Daniel Jacobowitz [this message]
2005-12-15 0:00 ` [Qemu-devel] ARM ethernet fixes Paul Brook
2005-12-18 16:51 ` Paul Brook
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=20051214221705.GA21427@nevyn.them.org \
--to=drow@false.org \
--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).