[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 35/40] pckbd: introduce new vmstate_kbd_mmio VMStateDescription f
From: |
Mark Cave-Ayland |
Subject: |
[PATCH 35/40] pckbd: introduce new vmstate_kbd_mmio VMStateDescription for the I8042_MMIO device |
Date: |
Wed, 29 Jun 2022 13:40:21 +0100 |
This enables us to register the VMStateDescription using the DeviceClass vmsd
property rather than having to call vmstate_register() from
i8042_mmio_realize().
Note that this is a migration break for the MIPS jazz machine which is the only
user of the I8042_MMIO device.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
hw/input/pckbd.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c
index 9184411c3e..195a64f520 100644
--- a/hw/input/pckbd.c
+++ b/hw/input/pckbd.c
@@ -699,9 +699,6 @@ static void i8042_mmio_realize(DeviceState *dev, Error
**errp)
sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->region);
- /* Note we can't use dc->vmsd without breaking migration compatibility */
- vmstate_register(NULL, 0, &vmstate_kbd, ks);
-
ks->kbd = ps2_kbd_init();
qdev_connect_gpio_out(DEVICE(ks->kbd), PS2_DEVICE_IRQ,
qdev_get_gpio_in_named(dev, "ps2-kbd-input-irq",
@@ -732,12 +729,23 @@ static Property i8042_mmio_properties[] = {
DEFINE_PROP_END_OF_LIST(),
};
+static const VMStateDescription vmstate_kbd_mmio = {
+ .name = "pckbd-mmio",
+ .version_id = 1,
+ .minimum_version_id = 1,
+ .fields = (VMStateField[]) {
+ VMSTATE_STRUCT(kbd, MMIOKBDState, 0, vmstate_kbd, KBDState),
+ VMSTATE_END_OF_LIST()
+ }
+};
+
static void i8042_mmio_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
dc->realize = i8042_mmio_realize;
dc->reset = i8042_mmio_reset;
+ dc->vmsd = &vmstate_kbd_mmio;
device_class_set_props(dc, i8042_mmio_properties);
set_bit(DEVICE_CATEGORY_INPUT, dc->categories);
}
--
2.30.2
- [PATCH 22/40] lasips2: introduce lasips2_mouse_port_class_init() and lasips2_mouse_port_realize(), (continued)
- [PATCH 22/40] lasips2: introduce lasips2_mouse_port_class_init() and lasips2_mouse_port_realize(), Mark Cave-Ayland, 2022/06/29
- [PATCH 25/40] lasips2: introduce LASIPS2PortDeviceClass for the LASIPS2_PORT device, Mark Cave-Ayland, 2022/06/29
- [PATCH 24/40] lasips2: introduce port IRQ and new lasips2_port_init() function, Mark Cave-Ayland, 2022/06/29
- [PATCH 26/40] lasips2: add named input gpio to port for downstream PS2 device IRQ, Mark Cave-Ayland, 2022/06/29
- [PATCH 28/40] lasips2: switch to using port-based IRQs, Mark Cave-Ayland, 2022/06/29
- [PATCH 27/40] lasips2: add named input gpio to handle incoming port IRQs, Mark Cave-Ayland, 2022/06/29
- [PATCH 30/40] lasips2: standardise on lp name for LASIPS2Port variables, Mark Cave-Ayland, 2022/06/29
- [PATCH 29/40] lasips2: rename LASIPS2Port parent pointer to lasips2, Mark Cave-Ayland, 2022/06/29
- [PATCH 32/40] lasips2: don't use legacy ps2_kbd_init() function, Mark Cave-Ayland, 2022/06/29
- [PATCH 31/40] lasips2: switch register memory region to DEVICE_BIG_ENDIAN, Mark Cave-Ayland, 2022/06/29
- [PATCH 35/40] pckbd: introduce new vmstate_kbd_mmio VMStateDescription for the I8042_MMIO device,
Mark Cave-Ayland <=
- [PATCH 34/40] lasips2: update VMStateDescription for LASIPS2 device, Mark Cave-Ayland, 2022/06/29
- [PATCH 36/40] pckbd: don't use legacy ps2_kbd_init() function, Mark Cave-Ayland, 2022/06/29
- [PATCH 33/40] lasips2: don't use legacy ps2_mouse_init() function, Mark Cave-Ayland, 2022/06/29
- [PATCH 37/40] ps2: remove unused legacy ps2_kbd_init() function, Mark Cave-Ayland, 2022/06/29
- [PATCH 38/40] pckbd: don't use legacy ps2_mouse_init() function, Mark Cave-Ayland, 2022/06/29
- [PATCH 39/40] ps2: remove unused legacy ps2_mouse_init() function, Mark Cave-Ayland, 2022/06/29
- [PATCH 40/40] pckbd: remove legacy i8042_mm_init() function, Mark Cave-Ayland, 2022/06/29