[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 2/5] hw/pcmcia/microdrive: Register machine reset handler
From: |
Peter Maydell |
Subject: |
Re: [PATCH 2/5] hw/pcmcia/microdrive: Register machine reset handler |
Date: |
Sun, 25 Apr 2021 19:36:13 +0100 |
On Sat, 24 Apr 2021 at 17:22, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>
> The abstract PCMCIA_CARD is a bus-less TYPE_DEVICE, so devices
> implementing it are not reset automatically.
> Register a reset handler so children get reset on machine reset.
>
> Note, the DSCM-1XXXX device (TYPE_DSCM1XXXX) which inherits
> TYPE_MICRODRIVE and PCMCIA_CARD reset itself when a disk is
> attached or detached, but was not resetting itself on machine
> reset.
>
> It doesn't seem to be an issue because it is that way since the
> device QDev'ifycation 8 years ago, in commit d1f2c96a81a
> ("pcmcia: QOM'ify PCMCIACardState and MicroDriveState").
> Still, correct to have a proper API usage.
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> hw/pcmcia/pcmcia.c | 25 +++++++++++++++++++++++++
> 1 file changed, 25 insertions(+)
>
> diff --git a/hw/pcmcia/pcmcia.c b/hw/pcmcia/pcmcia.c
> index 03d13e7d670..73656257227 100644
> --- a/hw/pcmcia/pcmcia.c
> +++ b/hw/pcmcia/pcmcia.c
> @@ -6,14 +6,39 @@
>
> #include "qemu/osdep.h"
> #include "qemu/module.h"
> +#include "sysemu/reset.h"
> #include "hw/pcmcia.h"
>
> +static void pcmcia_card_reset_handler(void *dev)
> +{
> + device_legacy_reset(DEVICE(dev));
> +}
> +
> +static void pcmcia_card_realize(DeviceState *dev, Error **errp)
> +{
> + qemu_register_reset(pcmcia_card_reset_handler, dev);
> +}
> +
> +static void pcmcia_card_unrealize(DeviceState *dev)
> +{
> + qemu_unregister_reset(pcmcia_card_reset_handler, dev);
> +}
Why isn't a pcmcia card something that plugs into a bus ?
-- PMM
- [PATCH 0/5] hw: Fix reset of bus-less devices, Philippe Mathieu-Daudé, 2021/04/24
- [PATCH 2/5] hw/pcmcia/microdrive: Register machine reset handler, Philippe Mathieu-Daudé, 2021/04/24
- Re: [PATCH 2/5] hw/pcmcia/microdrive: Register machine reset handler,
Peter Maydell <=
- [PATCH 3/5] hw/block/nand: Register machine reset handler, Philippe Mathieu-Daudé, 2021/04/24
- [PATCH 4/5] hw/pci-host/raven: Manually reset the OR_IRQ device, Philippe Mathieu-Daudé, 2021/04/24
- [PATCH 5/5] hw/arm/armsse: Manually reset the OR_IRQ devices, Philippe Mathieu-Daudé, 2021/04/24