Revision db895a1e hw/char/debugcon.c
b/hw/char/debugcon.c | ||
---|---|---|
81 | 81 |
.endianness = DEVICE_LITTLE_ENDIAN, |
82 | 82 |
}; |
83 | 83 |
|
84 |
static void debugcon_init_core(DebugconState *s)
|
|
84 |
static void debugcon_realize_core(DebugconState *s, Error **errp)
|
|
85 | 85 |
{ |
86 | 86 |
if (!s->chr) { |
87 |
fprintf(stderr, "Can't create debugcon device, empty char device\n");
|
|
88 |
exit(1);
|
|
87 |
error_setg(errp, "Can't create debugcon device, empty char device");
|
|
88 |
return;
|
|
89 | 89 |
} |
90 | 90 |
|
91 | 91 |
qemu_chr_add_handlers(s->chr, NULL, NULL, NULL, s); |
92 | 92 |
} |
93 | 93 |
|
94 |
static int debugcon_isa_initfn(ISADevice *dev)
|
|
94 |
static void debugcon_isa_realizefn(DeviceState *dev, Error **errp)
|
|
95 | 95 |
{ |
96 |
ISADevice *d = ISA_DEVICE(dev); |
|
96 | 97 |
ISADebugconState *isa = ISA_DEBUGCON_DEVICE(dev); |
97 | 98 |
DebugconState *s = &isa->state; |
99 |
Error *err = NULL; |
|
98 | 100 |
|
99 |
debugcon_init_core(s); |
|
101 |
debugcon_realize_core(s, &err); |
|
102 |
if (err != NULL) { |
|
103 |
error_propagate(errp, err); |
|
104 |
return; |
|
105 |
} |
|
100 | 106 |
memory_region_init_io(&s->io, &debugcon_ops, s, |
101 | 107 |
TYPE_ISA_DEBUGCON_DEVICE, 1); |
102 |
memory_region_add_subregion(isa_address_space_io(dev),
|
|
108 |
memory_region_add_subregion(isa_address_space_io(d), |
|
103 | 109 |
isa->iobase, &s->io); |
104 |
return 0; |
|
105 | 110 |
} |
106 | 111 |
|
107 | 112 |
static Property debugcon_isa_properties[] = { |
... | ... | |
114 | 119 |
static void debugcon_isa_class_initfn(ObjectClass *klass, void *data) |
115 | 120 |
{ |
116 | 121 |
DeviceClass *dc = DEVICE_CLASS(klass); |
117 |
ISADeviceClass *ic = ISA_DEVICE_CLASS(klass); |
|
118 |
ic->init = debugcon_isa_initfn;
|
|
122 |
|
|
123 |
dc->realize = debugcon_isa_realizefn;
|
|
119 | 124 |
dc->props = debugcon_isa_properties; |
120 | 125 |
} |
121 | 126 |
|
Also available in: Unified diff