[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 15/54] pl050: split pl050_update_irq() into separate pl050_set
From: |
Mark Cave-Ayland |
Subject: |
[PATCH v2 15/54] pl050: split pl050_update_irq() into separate pl050_set_irq() and pl050_update_irq() functions |
Date: |
Fri, 24 Jun 2022 14:40:30 +0100 |
This will soon allow pl050_set_irq() to be used as a GPIO input function.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Acked-by: Helge Deller <deller@gmx.de>
---
hw/input/pl050.c | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/hw/input/pl050.c b/hw/input/pl050.c
index 889a0674d3..66f8c20d9f 100644
--- a/hw/input/pl050.c
+++ b/hw/input/pl050.c
@@ -57,15 +57,20 @@ static const unsigned char pl050_id[] = {
0x50, 0x10, 0x04, 0x00, 0x0d, 0xf0, 0x05, 0xb1
};
-static void pl050_update(void *opaque, int level)
+static void pl050_update_irq(PL050State *s)
+{
+ int level = (s->pending && (s->cr & 0x10) != 0)
+ || (s->cr & 0x08) != 0;
+
+ qemu_set_irq(s->irq, level);
+}
+
+static void pl050_set_irq(void *opaque, int level)
{
PL050State *s = (PL050State *)opaque;
- int raise;
s->pending = level;
- raise = (s->pending && (s->cr & 0x10) != 0)
- || (s->cr & 0x08) != 0;
- qemu_set_irq(s->irq, raise);
+ pl050_update_irq(s);
}
static uint64_t pl050_read(void *opaque, hwaddr offset,
@@ -124,7 +129,7 @@ static void pl050_write(void *opaque, hwaddr offset,
switch (offset >> 2) {
case 0: /* KMICR */
s->cr = value;
- pl050_update(s, s->pending);
+ pl050_update_irq(s);
/* ??? Need to implement the enable/disable bit. */
break;
case 2: /* KMIDATA */
@@ -159,9 +164,9 @@ static void pl050_realize(DeviceState *dev, Error **errp)
sysbus_init_mmio(sbd, &s->iomem);
sysbus_init_irq(sbd, &s->irq);
if (s->is_mouse) {
- s->dev = ps2_mouse_init(pl050_update, s);
+ s->dev = ps2_mouse_init(pl050_set_irq, s);
} else {
- s->dev = ps2_kbd_init(pl050_update, s);
+ s->dev = ps2_kbd_init(pl050_set_irq, s);
}
}
--
2.30.2
- [PATCH v2 05/54] ps2: move QOM type definitions from ps2.c to ps2.h, (continued)
- [PATCH v2 05/54] ps2: move QOM type definitions from ps2.c to ps2.h, Mark Cave-Ayland, 2022/06/24
- [PATCH v2 06/54] ps2: improve function prototypes in ps2.c and ps2.h, Mark Cave-Ayland, 2022/06/24
- [PATCH v2 07/54] ps2: introduce PS2DeviceClass, Mark Cave-Ayland, 2022/06/24
- [PATCH v2 08/54] ps2: implement ps2_reset() for the PS2_DEVICE QOM type based upon ps2_common_reset(), Mark Cave-Ayland, 2022/06/24
- [PATCH v2 09/54] ps2: remove duplicate setting of scancode_set in ps2_kbd_init(), Mark Cave-Ayland, 2022/06/24
- [PATCH v2 11/54] ps2: implement ps2_mouse_realize() and use it to register ps2_mouse_handler, Mark Cave-Ayland, 2022/06/24
- [PATCH v2 10/54] ps2: implement ps2_kbd_realize() and use it to register ps2_keyboard_handler, Mark Cave-Ayland, 2022/06/24
- [PATCH v2 12/54] ps2: don't use vmstate_register() in ps2_kbd_init(), Mark Cave-Ayland, 2022/06/24
- [PATCH v2 13/54] ps2: don't use vmstate_register() in ps2_mouse_init(), Mark Cave-Ayland, 2022/06/24
- [PATCH v2 14/54] pl050: checkpatch fixes, Mark Cave-Ayland, 2022/06/24
- [PATCH v2 15/54] pl050: split pl050_update_irq() into separate pl050_set_irq() and pl050_update_irq() functions,
Mark Cave-Ayland <=
- [PATCH v2 16/54] lasips2: spacing fixes, Mark Cave-Ayland, 2022/06/24
- [PATCH v2 17/54] lasips2: rename ps2dev_update_irq() to lasips2_port_set_irq(), Mark Cave-Ayland, 2022/06/24
- [PATCH v2 18/54] pckbd: checkpatch fixes, Mark Cave-Ayland, 2022/06/24
- [PATCH v2 19/54] pckbd: move KBDState from pckbd.c to i8042.h, Mark Cave-Ayland, 2022/06/24
- [PATCH v2 20/54] pckbd: move ISAKBDState from pckbd.c to i8042.h, Mark Cave-Ayland, 2022/06/24
- [PATCH v2 22/54] pckbd: implement i8042_mmio_reset() for I8042_MMIO device, Mark Cave-Ayland, 2022/06/24
- [PATCH v2 23/54] pckbd: add mask qdev property to I8042_MMIO device, Mark Cave-Ayland, 2022/06/24
- [PATCH v2 21/54] pckbd: introduce new I8042_MMIO QOM type, Mark Cave-Ayland, 2022/06/24
- [PATCH v2 24/54] pckbd: add size qdev property to I8042_MMIO device, Mark Cave-Ayland, 2022/06/24