aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernhard Beschow <shentey@gmail.com>2024-01-14 13:39:08 +0100
committerMichael S. Tsirkin <mst@redhat.com>2024-02-14 06:09:32 -0500
commit7812dbc54c72f71df2644d0cec52a1e8d6b19584 (patch)
tree719fd10fc2b90928f0d799fc581d47d408136f75
parent8c4d239139e93268884f9d385a0966ef40db422f (diff)
downloadqemu-7812dbc54c72f71df2644d0cec52a1e8d6b19584.zip
qemu-7812dbc54c72f71df2644d0cec52a1e8d6b19584.tar.gz
qemu-7812dbc54c72f71df2644d0cec52a1e8d6b19584.tar.bz2
hw/char/serial-isa: Implement relocation and enabling/disabling for TYPE_ISA_SERIAL
The real SuperI/O chips emulated by QEMU allow for relocating and enabling or disabling their SuperI/O functions via software. So far this is not implemented. Prepare for that by adding isa_serial_set_{enabled,iobase}. Signed-off-by: Bernhard Beschow <shentey@gmail.com> Message-Id: <20240114123911.4877-9-shentey@gmail.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
-rw-r--r--hw/char/serial-isa.c14
-rw-r--r--include/hw/char/serial.h2
2 files changed, 16 insertions, 0 deletions
diff --git a/hw/char/serial-isa.c b/hw/char/serial-isa.c
index 1c793b2..329b352 100644
--- a/hw/char/serial-isa.c
+++ b/hw/char/serial-isa.c
@@ -184,3 +184,17 @@ void serial_hds_isa_init(ISABus *bus, int from, int to)
}
}
}
+
+void isa_serial_set_iobase(ISADevice *serial, hwaddr iobase)
+{
+ ISASerialState *s = ISA_SERIAL(serial);
+
+ serial->ioport_id = iobase;
+ s->iobase = iobase;
+ memory_region_set_address(&s->state.io, s->iobase);
+}
+
+void isa_serial_set_enabled(ISADevice *serial, bool enabled)
+{
+ memory_region_set_enabled(&ISA_SERIAL(serial)->state.io, enabled);
+}
diff --git a/include/hw/char/serial.h b/include/hw/char/serial.h
index 8ba7eca..6e14099 100644
--- a/include/hw/char/serial.h
+++ b/include/hw/char/serial.h
@@ -112,5 +112,7 @@ SerialMM *serial_mm_init(MemoryRegion *address_space,
#define TYPE_ISA_SERIAL "isa-serial"
void serial_hds_isa_init(ISABus *bus, int from, int to);
+void isa_serial_set_iobase(ISADevice *serial, hwaddr iobase);
+void isa_serial_set_enabled(ISADevice *serial, bool enabled);
#endif