qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] smc91x irq patch


From: Thorsten Zitterell
Subject: [Qemu-devel] smc91x irq patch
Date: Tue, 18 Jul 2006 19:03:12 +0200
User-agent: Thunderbird 1.5.0.4 (X11/20060627)

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

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 via email to

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