[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC v2 05/10] serial: Implement ISA set_state() callback
From: |
Andreas Färber |
Subject: |
[Qemu-devel] [RFC v2 05/10] serial: Implement ISA set_state() callback |
Date: |
Tue, 7 Jun 2011 17:02:53 +0200 |
Signed-off-by: Andreas Färber <address@hidden>
---
hw/serial.c | 25 +++++++++++++++++++++----
1 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/hw/serial.c b/hw/serial.c
index 0ee61dd..ec1e0a0 100644
--- a/hw/serial.c
+++ b/hw/serial.c
@@ -752,6 +752,25 @@ void serial_set_frequency(SerialState *s, uint32_t
frequency)
serial_update_parameters(s);
}
+static void serial_isa_statefn(ISADevice *dev, bool enabled)
+{
+ ISASerialState *isa = DO_UPCAST(ISASerialState, dev, dev);
+ SerialState *s = &isa->state;
+
+ if (enabled) {
+ isa_init_irq(dev, &s->irq, isa->isairq);
+
+ register_ioport_write(isa->iobase, 8, 1, serial_ioport_write, s);
+ register_ioport_read(isa->iobase, 8, 1, serial_ioport_read, s);
+ isa_init_ioport_range(dev, isa->iobase, 8);
+ } else {
+ isa_discard_irq(dev, isa->isairq);
+
+ isa_discard_ioport_range(dev, isa->iobase, 8);
+ isa_unassign_ioport(isa->iobase, 8);
+ }
+}
+
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 };
@@ -772,13 +791,10 @@ static int serial_isa_initfn(ISADevice *dev)
index++;
s->baudbase = 115200;
- isa_init_irq(dev, &s->irq, isa->isairq);
serial_init_core(s);
qdev_set_legacy_instance_id(&dev->qdev, isa->iobase, 3);
- register_ioport_write(isa->iobase, 8, 1, serial_ioport_write, s);
- register_ioport_read(isa->iobase, 8, 1, serial_ioport_read, s);
- isa_init_ioport_range(dev, isa->iobase, 8);
+ serial_isa_statefn(dev, true);
return 0;
}
@@ -962,6 +978,7 @@ static ISADeviceInfo serial_isa_info = {
.qdev.size = sizeof(ISASerialState),
.qdev.vmsd = &vmstate_isa_serial,
.init = serial_isa_initfn,
+ .set_state = serial_isa_statefn,
.qdev.props = (Property[]) {
DEFINE_PROP_UINT32("index", ISASerialState, index, -1),
DEFINE_PROP_HEX32("iobase", ISASerialState, iobase, -1),
--
1.7.5.3
Re: [Qemu-devel] [RFC 00/10] ISA reconfigurability, Gerd Hoffmann, 2011/06/07
- [Qemu-devel] [RFC v2 00/10] ISA reconfigurability v2, Andreas Färber, 2011/06/07
- [Qemu-devel] [RFC v2 01/10] isa: Provide set_state callback, Andreas Färber, 2011/06/07
- [Qemu-devel] [RFC v2 02/10] isa: Allow to un-assign I/O ports, Andreas Färber, 2011/06/07
- [Qemu-devel] [RFC v2 03/10] isa: Allow to un-associate an IRQ, Andreas Färber, 2011/06/07
- [Qemu-devel] [RFC v2 04/10] parallel: Implement ISA set_state callback, Andreas Färber, 2011/06/07
- [Qemu-devel] [RFC v2 05/10] serial: Implement ISA set_state() callback,
Andreas Färber <=
- [Qemu-devel] [PATCH v2 06/10] fdc: Parametrize ISA base, IRQ and DMA, Andreas Färber, 2011/06/07
- [Qemu-devel] [RFC v2 07/10] fdc: Implement ISA set_state() callback, Andreas Färber, 2011/06/07
- [Qemu-devel] [RFC v2 08/10] ide: Allow to discard I/O ports, Andreas Färber, 2011/06/07
- [Qemu-devel] [RFC v2 09/10] ide: Implement ISA set_state() callback, Andreas Färber, 2011/06/07
- [Qemu-devel] [RFC v2 10/10] prep: Add pc87312 Super I/O emulation, Andreas Färber, 2011/06/07
Re: [Qemu-devel] [RFC v2 00/10] ISA reconfigurability v2, Gerd Hoffmann, 2011/06/07
Re: [Qemu-devel] [RFC v2 00/10] ISA reconfigurability v2, Andreas Färber, 2011/06/07
Re: [Qemu-devel] [RFC v2 00/10] ISA reconfigurability v2, Gerd Hoffmann, 2011/06/08
[Qemu-devel] [RFC v4 00/12] ISA reconfigurability v4, Andreas Färber, 2011/06/08
[Qemu-devel] [PATCH v4 01/12] qdev: Add support for property type bool, Andreas Färber, 2011/06/08