aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2019-10-23 17:50:06 +0200
committerMarc-André Lureau <marcandre.lureau@redhat.com>2020-01-07 17:23:30 +0400
commit490a9d9b36bfa22a6b46b27e6e9e84e1bac44c68 (patch)
tree43f06f0768176835bf5eff8911687c9721e3fb1e /include
parentb9975000a008c5b0801e3d24ed113a1bd2767ed5 (diff)
serial: start making SerialMM a sysbus device
Memory mapped serial device is in fact a sysbus device. The following patches will make use of sysbus facilities for resource and registration. In particular, "serial-mm: use sysbus facilities" will move internal serial realization to serial_mm_realize callback to follow qdev best practices. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'include')
-rw-r--r--include/hw/char/serial.h20
1 files changed, 15 insertions, 5 deletions
diff --git a/include/hw/char/serial.h b/include/hw/char/serial.h
index 548944b06a..730165347c 100644
--- a/include/hw/char/serial.h
+++ b/include/hw/char/serial.h
@@ -57,7 +57,6 @@ typedef struct SerialState {
qemu_irq irq;
CharBackend chr;
int last_break_enable;
- int it_shift;
uint32_t baudbase;
uint32_t tsr_retry;
guint watch_tag;
@@ -80,6 +79,14 @@ typedef struct SerialState {
MemoryRegion io;
} SerialState;
+typedef struct SerialMM {
+ SysBusDevice parent;
+
+ SerialState serial;
+
+ int it_shift;
+} SerialMM;
+
extern const VMStateDescription vmstate_serial;
extern const MemoryRegionOps serial_io_ops;
@@ -88,12 +95,15 @@ void serial_set_frequency(SerialState *s, uint32_t frequency);
#define TYPE_SERIAL "serial"
#define SERIAL(s) OBJECT_CHECK(SerialState, (s), TYPE_SERIAL)
+#define TYPE_SERIAL_MM "serial-mm"
+#define SERIAL_MM(s) OBJECT_CHECK(SerialMM, (s), TYPE_SERIAL_MM)
+
SerialState *serial_init(int base, qemu_irq irq, int baudbase,
Chardev *chr, MemoryRegion *system_io);
-SerialState *serial_mm_init(MemoryRegion *address_space,
- hwaddr base, int it_shift,
- qemu_irq irq, int baudbase,
- Chardev *chr, enum device_endian end);
+SerialMM *serial_mm_init(MemoryRegion *address_space,
+ hwaddr base, int it_shift,
+ qemu_irq irq, int baudbase,
+ Chardev *chr, enum device_endian end);
/* serial-isa.c */