summary refs log tree commit diff stats
path: root/hw/fdc.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2011-10-20 16:37:26 +0200
committerKevin Wolf <kwolf@redhat.com>2011-10-21 17:34:13 +0200
commit34d4260e1846d69d7241f690534e3dd4b3e6fd5b (patch)
treee83d8de7cd4b1eee4a5a10e31e9922a78318adaf /hw/fdc.c
parent8f1efd00c4b2aa2b75fd20b5ee592ed47d33d5a7 (diff)
downloadfocaccia-qemu-34d4260e1846d69d7241f690534e3dd4b3e6fd5b.tar.gz
focaccia-qemu-34d4260e1846d69d7241f690534e3dd4b3e6fd5b.zip
pc: Fix floppy drives with if=none
Commit 63ffb564 broke floppy devices specified on the command line like
-drive file=...,if=none,id=floppy -global isa-fdc.driveA=floppy because it
relies on drive_get() which works only with -fda/-drive if=floppy.

This patch resembles what we're already doing for IDE, i.e. remember the floppy
device that was created and use that to extract the BlockDriverStates where
needed.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'hw/fdc.c')
-rw-r--r--hw/fdc.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/hw/fdc.c b/hw/fdc.c
index f8af2de2ce..ecaad0965c 100644
--- a/hw/fdc.c
+++ b/hw/fdc.c
@@ -1947,6 +1947,18 @@ static int sun4m_fdc_init1(SysBusDevice *dev)
     return fdctrl_init_common(fdctrl);
 }
 
+void fdc_get_bs(BlockDriverState *bs[], ISADevice *dev)
+{
+    FDCtrlISABus *isa = DO_UPCAST(FDCtrlISABus, busdev, dev);
+    FDCtrl *fdctrl = &isa->state;
+    int i;
+
+    for (i = 0; i < MAX_FD; i++) {
+        bs[i] = fdctrl->drives[i].bs;
+    }
+}
+
+
 static const VMStateDescription vmstate_isa_fdc ={
     .name = "fdc",
     .version_id = 2,