From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44587) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9yjl-0007j8-3p for qemu-devel@nongnu.org; Fri, 18 Dec 2015 12:22:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a9yjk-0007jm-0X for qemu-devel@nongnu.org; Fri, 18 Dec 2015 12:22:37 -0500 References: <1450304177-3935-1-git-send-email-jsnow@redhat.com> <1450304177-3935-6-git-send-email-jsnow@redhat.com> <87lh8r4umw.fsf@blackfin.pond.sub.org> From: John Snow Message-ID: <567440D1.7070104@redhat.com> Date: Fri, 18 Dec 2015 12:22:25 -0500 MIME-Version: 1.0 In-Reply-To: <87lh8r4umw.fsf@blackfin.pond.sub.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v3 05/11] fdc: Add fallback option List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: kwolf@redhat.com, qemu-devel@nongnu.org, qemu-block@nongnu.org On 12/18/2015 10:57 AM, Markus Armbruster wrote: > John Snow writes: > >> Add the fallback drive type as an option so we can control >> the behavior as a function of the QEMU machine version. > > What's a "fallback drive type", and what does (or will) it do? > I assume you mean "Make your commit messages better." The fallback type accompanies the "auto" drive type as the fallback drive type that gets selected if there is an issue auto-guessing from the diskette. It comes into play in two places: (1) There's simply no diskette, or (2) We couldn't figure out what kind of diskette it was. The legacy behavior is implicitly type=auto,fallback=144. It is now explicitly so, and the new behavior (at patch 11) is type=auto,fallback=288. >> >> Signed-off-by: John Snow >> --- >> hw/block/fdc.c | 23 +++++++++++++++++++++++ >> 1 file changed, 23 insertions(+) >> >> diff --git a/hw/block/fdc.c b/hw/block/fdc.c >> index ad0e052..b587de8 100644 >> --- a/hw/block/fdc.c >> +++ b/hw/block/fdc.c >> @@ -155,6 +155,9 @@ typedef struct FDrive { >> bool media_inserted; /* Is there a medium in the tray */ >> } FDrive; >> >> + >> +static FloppyDriveType get_fallback_drive_type(FDrive *drv); >> + >> static void fd_init(FDrive *drv) >> { >> /* Drive */ >> @@ -570,8 +573,15 @@ struct FDCtrl { >> uint8_t timer0; >> uint8_t timer1; >> >> + FloppyDriveType fallback; >> }; >> >> +__attribute__((__unused__)) >> +static FloppyDriveType get_fallback_drive_type(FDrive *drv) >> +{ >> + return drv->fdctrl->fallback; >> +} >> + >> #define TYPE_SYSBUS_FDC "base-sysbus-fdc" >> #define SYSBUS_FDC(obj) OBJECT_CHECK(FDCtrlSysBus, (obj), TYPE_SYSBUS_FDC) >> >> @@ -2302,6 +2312,10 @@ static void fdctrl_realize_common(FDCtrl *fdctrl, Error **errp) >> int i, j; >> static int command_tables_inited = 0; >> >> + if (fdctrl->fallback == FLOPPY_DRIVE_TYPE_AUTO) { >> + error_setg(errp, "Cannot choose a fallback FDrive type of 'auto'"); >> + } >> + >> /* Fill 'command_to_handler' lookup table */ >> if (!command_tables_inited) { >> command_tables_inited = 1; >> @@ -2433,6 +2447,9 @@ static Property isa_fdc_properties[] = { >> DEFINE_PROP_DEFAULT("fdtypeB", FDCtrlISABus, state.drives[1].drive, >> FDRIVE_DEFAULT, qdev_prop_fdc_drive_type, >> FloppyDriveType), >> + DEFINE_PROP_DEFAULT("fallback", FDCtrlISABus, state.fallback, >> + FLOPPY_DRIVE_TYPE_144, qdev_prop_fdc_drive_type, >> + FloppyDriveType), >> DEFINE_PROP_END_OF_LIST(), >> }; >> >> @@ -2487,6 +2504,9 @@ static Property sysbus_fdc_properties[] = { >> DEFINE_PROP_DEFAULT("fdtypeB", FDCtrlSysBus, state.drives[1].drive, >> FDRIVE_DEFAULT, qdev_prop_fdc_drive_type, >> FloppyDriveType), >> + DEFINE_PROP_DEFAULT("fallback", FDCtrlISABus, state.fallback, >> + FLOPPY_DRIVE_TYPE_144, qdev_prop_fdc_drive_type, >> + FloppyDriveType), >> DEFINE_PROP_END_OF_LIST(), >> }; >> >> @@ -2510,6 +2530,9 @@ static Property sun4m_fdc_properties[] = { >> DEFINE_PROP_DEFAULT("fdtype", FDCtrlSysBus, state.drives[0].drive, >> FDRIVE_DEFAULT, qdev_prop_fdc_drive_type, >> FloppyDriveType), >> + DEFINE_PROP_DEFAULT("fallback", FDCtrlISABus, state.fallback, >> + FLOPPY_DRIVE_TYPE_144, qdev_prop_fdc_drive_type, >> + FloppyDriveType), >> DEFINE_PROP_END_OF_LIST(), >> };