qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH 49/50] pckbd: switch I8042 device from update_irq() function


From: Peter Maydell
Subject: Re: [PATCH 49/50] pckbd: switch I8042 device from update_irq() function to PS2 device gpio
Date: Thu, 9 Jun 2022 13:52:57 +0100

On Sun, 22 May 2022 at 19:20, Mark Cave-Ayland
<mark.cave-ayland@ilande.co.uk> wrote:
>
> Define a new qdev input gpio for handling incoming PS2 IRQs, and then wire up 
> the
> PS2 keyboard and mouse devices to use it. At the same time set update_irq() 
> and
> update_arg to NULL in ps2_kbd_init() and ps2_mouse_init() to ensure that any
> accidental attempt to use the legacy update_irq() function will cause a NULL
> pointer dereference.
>
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> ---
>  hw/input/pckbd.c | 27 +++++++++++++++++++++++----
>  1 file changed, 23 insertions(+), 4 deletions(-)
>
> diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c
> index b2fdd1c999..f1eeab9952 100644
> --- a/hw/input/pckbd.c
> +++ b/hw/input/pckbd.c
> @@ -801,6 +801,18 @@ static const MemoryRegionOps i8042_cmd_ops = {
>      .endianness = DEVICE_LITTLE_ENDIAN,
>  };
>
> +static void i8042_set_irq(void *opaque, int n, int level)
> +{
> +    ISAKBDState *s = I8042(opaque);
> +    KBDState *ks = &s->kbd;
> +
> +    if (n) {
> +        kbd_update_aux_irq(ks, level);
> +    } else {
> +        kbd_update_kbd_irq(ks, level);
> +    }
> +}
> +
>  static void i8042_reset(DeviceState *dev)
>  {
>      ISAKBDState *s = I8042(dev);
> @@ -820,6 +832,9 @@ static void i8042_initfn(Object *obj)
>                            "i8042-cmd", 1);
>
>      qdev_init_gpio_out_named(DEVICE(obj), &s->a20_out, I8042_A20_LINE, 1);
> +
> +    qdev_init_gpio_out(DEVICE(obj), s->irqs, 2);
> +    qdev_init_gpio_in(DEVICE(obj), i8042_set_irq, 2);
>  }

named gpio inputs, otherwise
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM



reply via email to

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