summaryrefslogtreecommitdiffstats
path: root/hw/ide/qdev.c
diff options
context:
space:
mode:
authorMarkus Armbruster2010-06-24 19:58:20 +0200
committerKevin Wolf2010-07-02 13:18:02 +0200
commitc0897e0cb94e83ec1098867b81870e4f51f225b9 (patch)
treee9476e69b210a42620ea84a8b2e24983ce521398 /hw/ide/qdev.c
parentide: Make PIIX and ISA IDE init functions return the qdev (diff)
downloadqemu-c0897e0cb94e83ec1098867b81870e4f51f225b9.tar.gz
qemu-c0897e0cb94e83ec1098867b81870e4f51f225b9.tar.xz
qemu-c0897e0cb94e83ec1098867b81870e4f51f225b9.zip
pc: Fix CMOS info for drives defined with -device
Drives defined with -drive if=ide get get created along with the IDE controller, inside machine->init(). That's before cmos_init(). Drives defined with -device get created during generic device init. That's after cmos_init(). Because of that, CMOS has no information on them (type, geometry, translation). Older versions of Windows such as XP reportedly choke on that. Split off the part of CMOS initialization that needs to know about -device devices, and turn it into a reset handler, so it runs after device creation. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'hw/ide/qdev.c')
-rw-r--r--hw/ide/qdev.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c
index b34c473336..2977a168e5 100644
--- a/hw/ide/qdev.c
+++ b/hw/ide/qdev.c
@@ -88,6 +88,13 @@ IDEDevice *ide_create_drive(IDEBus *bus, int unit, DriveInfo *drive)
return DO_UPCAST(IDEDevice, qdev, dev);
}
+void ide_get_bs(BlockDriverState *bs[], BusState *qbus)
+{
+ IDEBus *bus = DO_UPCAST(IDEBus, qbus, qbus);
+ bs[0] = bus->master ? bus->master->conf.bs : NULL;
+ bs[1] = bus->slave ? bus->slave->conf.bs : NULL;
+}
+
/* --------------------------------- */
typedef struct IDEDrive {