aboutsummaryrefslogtreecommitdiff
path: root/hw/isa/isa-superio.c
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <f4bug@amsat.org>2018-03-08 23:39:35 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2018-03-12 16:12:49 +0100
commitc16a4e1bc5e76a65cfa38266a1d9e88806b4bddf (patch)
tree51302e909603d1ba3c0b11f35284971b3cf9c854 /hw/isa/isa-superio.c
parent72d3d8f052a19abc455ddc88efef75c407ac7c8d (diff)
hw/isa/superio: Factor out the IDE code from pc87312.c
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20180308223946.26784-15-f4bug@amsat.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw/isa/isa-superio.c')
-rw-r--r--hw/isa/isa-superio.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/hw/isa/isa-superio.c b/hw/isa/isa-superio.c
index 041b47bdbf..f98711beff 100644
--- a/hw/isa/isa-superio.c
+++ b/hw/isa/isa-superio.c
@@ -146,6 +146,28 @@ static void isa_superio_realize(DeviceState *dev, Error **errp)
/* Keyboard, mouse */
sio->kbc = isa_create_simple(bus, TYPE_I8042);
+
+ /* IDE */
+ if (k->ide.count && (!k->ide.is_enabled || k->ide.is_enabled(sio, 0))) {
+ isa = isa_create(bus, "isa-ide");
+ d = DEVICE(isa);
+ if (k->ide.get_iobase) {
+ qdev_prop_set_uint32(d, "iobase", k->ide.get_iobase(sio, 0));
+ }
+ if (k->ide.get_iobase) {
+ qdev_prop_set_uint32(d, "iobase2", k->ide.get_iobase(sio, 1));
+ }
+ if (k->ide.get_irq) {
+ qdev_prop_set_uint32(d, "irq", k->ide.get_irq(sio, 0));
+ }
+ qdev_init_nofail(d);
+ sio->ide = isa;
+ trace_superio_create_ide(0,
+ k->ide.get_iobase ?
+ k->ide.get_iobase(sio, 0) : -1,
+ k->ide.get_irq ?
+ k->ide.get_irq(sio, 0) : -1);
+ }
}
static void isa_superio_class_init(ObjectClass *oc, void *data)