[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 07/36] hw/input/ps2: Convert TYPE_PS2_DEVICE to 3-phase reset
From: |
Peter Maydell |
Subject: |
[PULL 07/36] hw/input/ps2: Convert TYPE_PS2_DEVICE to 3-phase reset |
Date: |
Fri, 16 Dec 2022 21:42:15 +0000 |
Convert the parent class TYPE_PS2_DEVICE to 3-phase reset. Note that
we need an 'exit' phase function as well as the usual 'hold' phase
function, because changing outbound IRQ line state is only permitted
in 'exit'. (Strictly speaking it's not supposed to be done in a
legacy reset handler either, but you can often get away with it.)
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20221109170009.3498451-2-peter.maydell@linaro.org
---
hw/input/ps2.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/hw/input/ps2.c b/hw/input/ps2.c
index 05cf7111e31..47a5d68e300 100644
--- a/hw/input/ps2.c
+++ b/hw/input/ps2.c
@@ -1001,12 +1001,18 @@ void ps2_write_mouse(PS2MouseState *s, int val)
}
}
-static void ps2_reset(DeviceState *dev)
+static void ps2_reset_hold(Object *obj)
{
- PS2State *s = PS2_DEVICE(dev);
+ PS2State *s = PS2_DEVICE(obj);
s->write_cmd = -1;
ps2_reset_queue(s);
+}
+
+static void ps2_reset_exit(Object *obj)
+{
+ PS2State *s = PS2_DEVICE(obj);
+
ps2_lower_irq(s);
}
@@ -1281,8 +1287,10 @@ static void ps2_init(Object *obj)
static void ps2_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
+ ResettableClass *rc = RESETTABLE_CLASS(klass);
- dc->reset = ps2_reset;
+ rc->phases.hold = ps2_reset_hold;
+ rc->phases.exit = ps2_reset_exit;
set_bit(DEVICE_CATEGORY_INPUT, dc->categories);
}
--
2.25.1
- [PULL 00/36] reset refactoring patches, Peter Maydell, 2022/12/16
- [PULL 01/36] hw/s390x/s390-pci-inst.c: Use device_cold_reset() to reset PCI devices, Peter Maydell, 2022/12/16
- [PULL 02/36] pci: Use device_cold_reset() and bus_cold_reset(), Peter Maydell, 2022/12/16
- [PULL 03/36] hw/hyperv/vmbus: Use device_cold_reset() and bus_cold_reset(), Peter Maydell, 2022/12/16
- [PULL 13/36] target/avr: Convert to 3-phase reset, Peter Maydell, 2022/12/16
- [PULL 20/36] target/mips: Convert to 3-phase reset, Peter Maydell, 2022/12/16
- [PULL 19/36] target/microblaze: Convert to 3-phase reset, Peter Maydell, 2022/12/16
- [PULL 22/36] target/openrisc: Convert to 3-phase reset, Peter Maydell, 2022/12/16
- [PULL 09/36] hw/misc/mos6522: Convert TYPE_MOS6522 to 3-phase reset, Peter Maydell, 2022/12/16
- [PULL 07/36] hw/input/ps2: Convert TYPE_PS2_DEVICE to 3-phase reset,
Peter Maydell <=
- [PULL 12/36] target/arm: Convert to 3-phase reset, Peter Maydell, 2022/12/16
- [PULL 04/36] Replace use of qdev_reset_all() with device_cold_reset(), Peter Maydell, 2022/12/16
- [PULL 05/36] qdev: Remove qdev_reset_all() and qbus_reset_all(), Peter Maydell, 2022/12/16
- [PULL 06/36] hw: Remove device_legacy_reset(), Peter Maydell, 2022/12/16
- [PULL 14/36] target/cris: Convert to 3-phase reset, Peter Maydell, 2022/12/16
- [PULL 08/36] hw/input/ps2.c: Convert TYPE_PS2_{KBD, MOUSE}_DEVICE to 3-phase reset, Peter Maydell, 2022/12/16
- [PULL 10/36] hw/misc: Convert TYPE_MOS6522 subclasses to 3-phase reset, Peter Maydell, 2022/12/16
- [PULL 11/36] hw/core/cpu-common: Convert TYPE_CPU class to 3-phase reset, Peter Maydell, 2022/12/16
- [PULL 15/36] target/hexagon: Convert to 3-phase reset, Peter Maydell, 2022/12/16
- [PULL 16/36] target/i386: Convert to 3-phase reset, Peter Maydell, 2022/12/16