From 6394bd0e05441c363ebb73597c74c951378810e6 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Thu, 24 Jun 2010 19:58:20 +0200 Subject: 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 Signed-off-by: Kevin Wolf (cherry picked from commit c0897e0cb94e83ec1098867b81870e4f51f225b9) --- hw/ide/qdev.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'hw/ide/qdev.c') diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c index 0b84a4f1d0..a621d5eddc 100644 --- a/hw/ide/qdev.c +++ b/hw/ide/qdev.c @@ -90,6 +90,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->dinfo->bdrv : NULL; + bs[1] = bus->slave ? bus->slave->dinfo->bdrv : NULL; +} + /* --------------------------------- */ typedef struct IDEDrive { -- cgit v1.2.3