@@ -45,6 +45,9 @@ void isa_mmio_init(target_phys_addr_t base, target_phys_addr_t size);
void parallel_isa_reconfigure_iobase(ISADevice *dev, uint32_t base);
void parallel_isa_reconfigure_irq(ISADevice *dev, uint32_t isairq);
+/* serial.c */
+void serial_isa_reconfigure_iobase(ISADevice *dev, uint32_t base);
+
/* dma.c */
int DMA_get_channel_mode (int nchan);
int DMA_read_memory (int nchan, void *buf, int pos, int size);
@@ -752,6 +752,25 @@ void serial_set_frequency(SerialState *s, uint32_t frequency)
serial_update_parameters(s);
}
+static void serial_isa_init_iobase(ISASerialState *isa)
+{
+ SerialState *s = &isa->state;
+
+ 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(&isa->dev, isa->iobase, 8);
+}
+
+void serial_isa_reconfigure_iobase(ISADevice *dev, uint32_t iobase)
+{
+ ISASerialState *isa = DO_UPCAST(ISASerialState, dev, dev);
+
+ if (iobase != isa->iobase) {
+ isa->iobase = iobase;
+ serial_isa_init_iobase(isa);
+ }
+}
+
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 };
@@ -776,9 +795,7 @@ static int serial_isa_initfn(ISADevice *dev)
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_init_iobase(isa);
return 0;
}
Signed-off-by: Andreas Färber <andreas.faerber@web.de> --- hw/isa.h | 3 +++ hw/serial.c | 23 ++++++++++++++++++++--- 2 files changed, 23 insertions(+), 3 deletions(-)