ps2: add gpio for output IRQ and optionally use it in ps2_raise_irq() and ps2_lower_irq()

Define the gpio for the PS2 output IRQ in ps2_init() and add logic to optionally
use it in ps2_raise_irq() and ps2_lower_irq() if the gpio is connected. If the
gpio is not connected then call the legacy update_irq() function as before.

This allows the incremental conversion of devices from the legacy update_irq()
function to use gpios instead.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Acked-by: Helge Deller <deller@gmx.de>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20220624134109.881989-35-mark.cave-ayland@ilande.co.uk>
This commit is contained in:
Mark Cave-Ayland 2022-06-24 14:40:49 +01:00
parent 5cb6e55622
commit 6beb79e11a
2 changed files with 23 additions and 2 deletions

View file

@ -50,11 +50,15 @@ typedef struct {
int rptr, wptr, cwptr, count;
} PS2Queue;
/* Output IRQ */
#define PS2_DEVICE_IRQ 0
struct PS2State {
SysBusDevice parent_obj;
PS2Queue queue;
int32_t write_cmd;
qemu_irq irq;
void (*update_irq)(void *, int);
void *update_arg;
};