qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v3 05/11] fdc: Add fallback option


From: John Snow
Subject: Re: [Qemu-devel] [PATCH v3 05/11] fdc: Add fallback option
Date: Fri, 18 Dec 2015 12:22:25 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0


On 12/18/2015 10:57 AM, Markus Armbruster wrote:
> John Snow <address@hidden> 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 <address@hidden>
>> ---
>>  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(),
>>  };



reply via email to

[Prev in Thread] Current Thread [Next in Thread]