From c16a4e1bc5e76a65cfa38266a1d9e88806b4bddf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Thu, 8 Mar 2018 23:39:35 +0100 Subject: hw/isa/superio: Factor out the IDE code from pc87312.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20180308223946.26784-15-f4bug@amsat.org> Signed-off-by: Paolo Bonzini --- hw/isa/isa-superio.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'hw/isa/isa-superio.c') 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) -- cgit v1.2.3