qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Thorsten Zitterell <the.real.hik@gmx.net>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] smc91x irq patch
Date: Tue, 18 Jul 2006 19:03:12 +0200	[thread overview]
Message-ID: <44BD1450.6040002@gmx.net> (raw)
In-Reply-To: <44BCD9E8.6060108@nomovok.com>

[-- Attachment #1: Type: text/plain, Size: 906 bytes --]

Hi,

I am working on a Gumstix system [1] emulation for QEMU which is based
on a Intel XScale processor. The board has an expansion card for network
support which is a smc91x compatible NIC. However, the irq line is not
directly connected to the processor's interrupt controller but to an
GPIO which triggers an irq when a level edge is detected.

The attached patch allows to give an arbitrary function as irq handler
for the smc91c111 driver - in my case a function which sets the
corresponding GPIO line.

Btw, I already put a preliminary version of the Gumstix system emulation
online [2] - many components are only partly implemented (DMA, GPIO,
PIC, flash ...). However, I can boot a flash image and log into the
Linux system.

Could you apply this patch? I have seen that other functions allow
giving an irq handler, too.

Thanks,

Thorsten

[1] www.gumstix.com
[2] http://www.bitmux.org/qemu.html


[-- Attachment #2: patch-smc_irq-2006-06-18 --]
[-- Type: text/plain, Size: 2984 bytes --]

diff -upr qemu.orig/hw/integratorcp.c qemu.patches/hw/integratorcp.c
--- qemu.orig/hw/integratorcp.c	2006-07-18 18:13:25.361172000 +0200
+++ qemu.patches/hw/integratorcp.c	2006-07-18 18:31:18.151219000 +0200
@@ -501,7 +501,7 @@ static void integratorcp_init(int ram_si
     if (nd_table[0].vlan) {
         if (nd_table[0].model == NULL
             || strcmp(nd_table[0].model, "smc91c111") == 0) {
-            smc91c111_init(&nd_table[0], 0xc8000000, pic, 27);
+            smc91c111_init(&pic_set_irq_new,&nd_table[0], 0xc8000000, pic, 27);
         } else {
             fprintf(stderr, "qemu: Unsupported NIC: %s\n", nd_table[0].model);
             exit (1);
diff -upr qemu.orig/hw/smc91c111.c qemu.patches/hw/smc91c111.c
--- qemu.orig/hw/smc91c111.c	2006-07-18 18:13:25.982420000 +0200
+++ qemu.patches/hw/smc91c111.c	2006-07-18 18:33:13.130230000 +0200
@@ -26,6 +26,7 @@ typedef struct {
     uint16_t ercv;
     void *pic;
     int irq;
+    SetIRQFunc *set_irq;
     int bank;
     int packet_num;
     int tx_alloc;
@@ -86,7 +87,7 @@ static void smc91c111_update(smc91c111_s
     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);
+    (*s->set_irq)(s->pic, s->irq, level);
 }
 
 /* Try to allocate a packet.  Returns 0x80 on failure.  */
@@ -692,7 +693,7 @@ static CPUWriteMemoryFunc *smc91c111_wri
     smc91c111_writel
 };
 
-void smc91c111_init(NICInfo *nd, uint32_t base, void *pic, int irq)
+void smc91c111_init(SetIRQFunc *set_irq, NICInfo *nd, uint32_t base, void *pic, int irq)
 {
     smc91c111_state *s;
     int iomemtype;
@@ -704,6 +705,8 @@ void smc91c111_init(NICInfo *nd, uint32_
     s->base = base;
     s->pic = pic;
     s->irq = irq;
+    s->set_irq = set_irq;
+
     memcpy(s->macaddr, nd->macaddr, 6);
 
     smc91c111_reset(s);
diff -upr qemu.orig/hw/versatilepb.c qemu.patches/hw/versatilepb.c
--- qemu.orig/hw/versatilepb.c	2006-07-18 18:13:26.170931000 +0200
+++ qemu.patches/hw/versatilepb.c	2006-07-18 18:31:06.742434000 +0200
@@ -370,7 +370,7 @@ static void versatile_init(int ram_size,
         if (!nd->model)
             nd->model = done_smc ? "rtl8139" : "smc91c111";
         if (strcmp(nd->model, "smc91c111") == 0) {
-            smc91c111_init(nd, 0x10010000, sic, 25);
+            smc91c111_init(&pic_set_irq_new,nd, 0x10010000, sic, 25);
         } else {
             pci_nic_init(pci_bus, nd);
         }
diff -upr qemu.orig/vl.h qemu.patches/vl.h
--- qemu.orig/vl.h	2006-07-18 18:13:24.653227000 +0200
+++ qemu.patches/vl.h	2006-07-18 18:32:46.190286000 +0200
@@ -1094,7 +1094,7 @@ void ps2_queue(void *, int b);
 void ps2_keyboard_set_translation(void *opaque, int mode);
 
 /* smc91c111.c */
-void smc91c111_init(NICInfo *, uint32_t, void *, int);
+void smc91c111_init(SetIRQFunc *set_irq, NICInfo *, uint32_t, void *, int);
 
 /* pl110.c */
 void *pl110_init(DisplayState *ds, uint32_t base, void *pic, int irq, int);


  reply	other threads:[~2006-07-19  2:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-18 12:54 [Qemu-devel] Small note about qemu/target-sh4/op.c Pablo Virolainen
2006-07-18 17:03 ` Thorsten Zitterell [this message]
2006-07-19  3:29   ` [Qemu-devel] smc91x irq patch Paul Brook
2006-07-19 17:53     ` Fabrice Bellard
2006-07-19 18:15       ` Paul Brook

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=44BD1450.6040002@gmx.net \
    --to=the.real.hik@gmx.net \
    --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).