diff options
author | Markus Armbruster <armbru@redhat.com> | 2020-06-22 11:42:17 +0200 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2020-06-23 16:07:07 +0200 |
commit | 4a27a638e718b445648de6b27c709353551d9b44 (patch) | |
tree | 4511b7a1bbaf023c708c56feee59eac342e37de1 /hw/block | |
parent | fed2c1731c3dfdcf2d69a3ba73da01a80950bcfd (diff) |
fdc: Deprecate configuring floppies with -global isa-fdc
Deprecate
-global isa-fdc.driveA=...
-global isa-fdc.driveB=...
in favour of
-device floppy,unit=0,drive=...
-device floppy,unit=1,drive=...
Same for the other floppy controller devices.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Acked-by: John Snow <jsnow@redhat.com>
Message-Id: <20200622094227.1271650-7-armbru@redhat.com>
Diffstat (limited to 'hw/block')
-rw-r--r-- | hw/block/fdc.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/hw/block/fdc.c b/hw/block/fdc.c index d1f7722cff..7e143cbab0 100644 --- a/hw/block/fdc.c +++ b/hw/block/fdc.c @@ -2528,6 +2528,7 @@ static void fdctrl_connect_drives(FDCtrl *fdctrl, DeviceState *fdc_dev, DeviceState *dev; BlockBackend *blk; Error *local_err = NULL; + const char *fdc_name, *drive_suffix; for (i = 0; i < MAX_FD; i++) { drive = &fdctrl->drives[i]; @@ -2542,10 +2543,26 @@ static void fdctrl_connect_drives(FDCtrl *fdctrl, DeviceState *fdc_dev, continue; } + fdc_name = object_get_typename(OBJECT(fdc_dev)); + drive_suffix = !strcmp(fdc_name, "SUNW,fdtwo") ? "" : i ? "B" : "A"; + warn_report("warning: property %s.drive%s is deprecated", + fdc_name, drive_suffix); + error_printf("Use -device floppy,unit=%d,drive=... instead.\n", i); + dev = qdev_new("floppy"); qdev_prop_set_uint32(dev, "unit", i); qdev_prop_set_enum(dev, "drive-type", fdctrl->qdev_for_drives[i].type); + /* + * Hack alert: we move the backend from the floppy controller + * device to the floppy device. We first need to detach the + * controller, or else floppy_create()'s qdev_prop_set_drive() + * will die when it attaches floppy device. We also need to + * take another reference so that blk_detach_dev() doesn't + * free blk while we still need it. + * + * The hack is probably a bad idea. + */ blk_ref(blk); blk_detach_dev(blk, fdc_dev); fdctrl->qdev_for_drives[i].blk = NULL; |