aboutsummaryrefslogtreecommitdiff
path: root/hw/char/escc.c
diff options
context:
space:
mode:
authorxiaoqiang zhao <zxq_yx_007@163.com>2016-06-01 15:58:18 +0800
committerPaolo Bonzini <pbonzini@redhat.com>2016-06-06 18:57:06 +0200
commit4b3eec91b90346c57ec99694ddc806b70a54ff90 (patch)
treebd8e319309456e94d0614248814c7be781098bf3 /hw/char/escc.c
parent8156d480861e937768d7d9ac0b73c1e74c368f1d (diff)
hw/char: QOM'ify escc.c (fix)
The previous commit e7c9136977cb99c6eb52c9139f7b8d8b5fa87db9 (hw/char: QOM'ify escc.c) cause qemu-system-ppc/ppc64 OpenBIOS to freeze on startup, this commit fix it. Signed-off-by: xiaoqiang zhao <zxq_yx_007@163.com> Tested-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Message-Id: <1464767898-30526-1-git-send-email-zxq_yx_007@163.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw/char/escc.c')
-rw-r--r--hw/char/escc.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/hw/char/escc.c b/hw/char/escc.c
index 8e6a7df465..31a5f902f9 100644
--- a/hw/char/escc.c
+++ b/hw/char/escc.c
@@ -989,18 +989,13 @@ static void escc_init1(Object *obj)
SysBusDevice *dev = SYS_BUS_DEVICE(obj);
unsigned int i;
- s->chn[0].disabled = s->disabled;
- s->chn[1].disabled = s->disabled;
for (i = 0; i < 2; i++) {
sysbus_init_irq(dev, &s->chn[i].irq);
s->chn[i].chn = 1 - i;
- s->chn[i].clock = s->frequency / 2;
}
s->chn[0].otherchn = &s->chn[1];
s->chn[1].otherchn = &s->chn[0];
- memory_region_init_io(&s->mmio, obj, &escc_mem_ops, s, "escc",
- ESCC_SIZE << s->it_shift);
sysbus_init_mmio(dev, &s->mmio);
}
@@ -1009,8 +1004,15 @@ static void escc_realize(DeviceState *dev, Error **errp)
ESCCState *s = ESCC(dev);
unsigned int i;
+ s->chn[0].disabled = s->disabled;
+ s->chn[1].disabled = s->disabled;
+
+ memory_region_init_io(&s->mmio, OBJECT(dev), &escc_mem_ops, s, "escc",
+ ESCC_SIZE << s->it_shift);
+
for (i = 0; i < 2; i++) {
if (s->chn[i].chr) {
+ s->chn[i].clock = s->frequency / 2;
qemu_chr_add_handlers(s->chn[i].chr, serial_can_receive,
serial_receive1, serial_event, &s->chn[i]);
}