qemu-block
[Top][All Lists]
Advanced

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

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


From: Markus Armbruster
Subject: Re: [Qemu-block] [Qemu-devel] [PATCH v3 05/11] fdc: Add fallback option
Date: Fri, 18 Dec 2015 16:57:27 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

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?

>
> 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]