diff mbox

[RFC,04/10] parallel: Allow to reconfigure ISA IRQ

Message ID 1307377259-41434-5-git-send-email-andreas.faerber@web.de
State New
Headers show

Commit Message

Andreas Färber June 6, 2011, 4:20 p.m. UTC
Signed-off-by: Andreas Färber <andreas.faerber@web.de>
---
 hw/isa.h      |    1 +
 hw/parallel.c |   13 +++++++++++++
 2 files changed, 14 insertions(+), 0 deletions(-)
diff mbox

Patch

diff --git a/hw/isa.h b/hw/isa.h
index 2bd8c82..54698b5 100644
--- a/hw/isa.h
+++ b/hw/isa.h
@@ -43,6 +43,7 @@  void isa_mmio_init(target_phys_addr_t base, target_phys_addr_t size);
 
 /* parallel.c */
 void parallel_isa_reconfigure_iobase(ISADevice *dev, uint32_t base);
+void parallel_isa_reconfigure_irq(ISADevice *dev, uint32_t isairq);
 
 /* dma.c */
 int DMA_get_channel_mode (int nchan);
diff --git a/hw/parallel.c b/hw/parallel.c
index 5cb3856..a64e7c5 100644
--- a/hw/parallel.c
+++ b/hw/parallel.c
@@ -493,6 +493,18 @@  void parallel_isa_reconfigure_iobase(ISADevice *dev, uint32_t base)
     }
 }
 
+void parallel_isa_reconfigure_irq(ISADevice *dev, uint32_t isairq)
+{
+    ISAParallelState *isa = DO_UPCAST(ISAParallelState, dev, dev);
+    ParallelState *s = &isa->state;
+
+    if (isairq != isa->isairq) {
+        isa_discard_irq(dev, isa->isairq);
+        isa->isairq = isairq;
+        isa_init_irq(dev, &s->irq, isa->isairq);
+    }
+}
+
 static const int isa_parallel_io[MAX_PARALLEL_PORTS] = { 0x378, 0x278, 0x3bc };
 
 static int parallel_isa_initfn(ISADevice *dev)
@@ -516,6 +528,7 @@  static int parallel_isa_initfn(ISADevice *dev)
     index++;
 
     isa_init_irq(dev, &s->irq, isa->isairq);
+
     qemu_register_reset(parallel_reset, s);
 
     if (qemu_chr_ioctl(s->chr, CHR_IOCTL_PP_READ_STATUS, &dummy) == 0) {