Patchwork [RFC,06/10] serial: Allow to reconfigure ISA IRQ

login
register
mail settings
Submitter Andreas Färber
Date June 6, 2011, 4:20 p.m.
Message ID <1307377259-41434-7-git-send-email-andreas.faerber@web.de>
Download mbox | patch
Permalink /patch/98986/
State New
Headers show

Comments

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

Patch

diff --git a/hw/isa.h b/hw/isa.h
index 8bd082a..b577fe3 100644
--- a/hw/isa.h
+++ b/hw/isa.h
@@ -47,6 +47,7 @@  void parallel_isa_reconfigure_irq(ISADevice *dev, uint32_t isairq);
 
 /* serial.c */
 void serial_isa_reconfigure_iobase(ISADevice *dev, uint32_t base);
+void serial_isa_reconfigure_irq(ISADevice *dev, uint32_t isairq);
 
 /* dma.c */
 int DMA_get_channel_mode (int nchan);
diff --git a/hw/serial.c b/hw/serial.c
index dd91272..714e5b2 100644
--- a/hw/serial.c
+++ b/hw/serial.c
@@ -771,6 +771,17 @@  void serial_isa_reconfigure_iobase(ISADevice *dev, uint32_t iobase)
     }
 }
 
+void serial_isa_reconfigure_irq(ISADevice *dev, uint32_t isairq)
+{
+    ISASerialState *isa = DO_UPCAST(ISASerialState, dev, dev);
+
+    if (isairq != isa->isairq) {
+        isa_discard_irq(dev, isa->isairq);
+        isa->isairq = isairq;
+        isa_init_irq(dev, &isa->state.irq, isa->isairq);
+    }
+}
+
 static const int isa_serial_io[MAX_SERIAL_PORTS] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8 };
 static const int isa_serial_irq[MAX_SERIAL_PORTS] = { 4, 3, 4, 3 };