summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorxiaoqiang zhao2016-05-25 08:39:01 +0200
committerPaolo Bonzini2016-05-29 09:11:10 +0200
commit8290de92b83e843390571b36dc9e09a9fb75abf0 (patch)
treee25fba7797263e26826fe084b3b414ba0abd9c75 /include
parenthw/char: QOM'ify escc.c (diff)
downloadqemu-8290de92b83e843390571b36dc9e09a9fb75abf0.tar.gz
qemu-8290de92b83e843390571b36dc9e09a9fb75abf0.tar.xz
qemu-8290de92b83e843390571b36dc9e09a9fb75abf0.zip
hw/char: QOM'ify etraxfs_ser.c
* Drop the old SysBus init function and use instance_init * Call qemu_chr_add_handlers in the realize callback * Use qdev chardev prop instead of qemu_char_get_next_serial * Add etraxfs_ser_create function to create etraxfs serial device Signed-off-by: xiaoqiang zhao <zxq_yx_007@163.com> Message-Id: <1464158344-12266-3-git-send-email-zxq_yx_007@163.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/hw/cris/etraxfs.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/hw/cris/etraxfs.h b/include/hw/cris/etraxfs.h
index 73a6134c1e..eb664181e7 100644
--- a/include/hw/cris/etraxfs.h
+++ b/include/hw/cris/etraxfs.h
@@ -46,4 +46,20 @@ etraxfs_eth_init(NICInfo *nd, hwaddr base, int phyaddr,
return dev;
}
+static inline DeviceState *etraxfs_ser_create(hwaddr addr,
+ qemu_irq irq,
+ CharDriverState *chr)
+{
+ DeviceState *dev;
+ SysBusDevice *s;
+
+ dev = qdev_create(NULL, "etraxfs,serial");
+ s = SYS_BUS_DEVICE(dev);
+ qdev_prop_set_chr(dev, "chardev", chr);
+ qdev_init_nofail(dev);
+ sysbus_mmio_map(s, 0, addr);
+ sysbus_connect_irq(s, 0, irq);
+ return dev;
+}
+
#endif