diff options
author | xiaoqiang zhao <zxq_yx_007@163.com> | 2016-05-25 14:39:01 +0800 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2016-05-29 09:11:10 +0200 |
commit | 8290de92b83e843390571b36dc9e09a9fb75abf0 (patch) | |
tree | e25fba7797263e26826fe084b3b414ba0abd9c75 /include/hw | |
parent | e7c9136977cb99c6eb52c9139f7b8d8b5fa87db9 (diff) |
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/hw')
-rw-r--r-- | include/hw/cris/etraxfs.h | 16 |
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 |