mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 08:13:54 -06:00
pckbd: introduce new vmstate_kbd_mmio VMStateDescription for the I8042_MMIO device
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 magnum machine which is the only user of the I8042_MMIO device. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Tested-by: Helge Deller <deller@gmx.de> Acked-by: Helge Deller <deller@gmx.de> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-Id: <20220712215251.7944-36-mark.cave-ayland@ilande.co.uk> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
This commit is contained in:
parent
1b7bd0abe9
commit
abcacb20f7
1 changed files with 11 additions and 3 deletions
|
@ -699,9 +699,6 @@ static void i8042_mmio_realize(DeviceState *dev, Error **errp)
|
||||||
|
|
||||||
sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->region);
|
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();
|
ks->kbd = ps2_kbd_init();
|
||||||
qdev_connect_gpio_out(DEVICE(ks->kbd), PS2_DEVICE_IRQ,
|
qdev_connect_gpio_out(DEVICE(ks->kbd), PS2_DEVICE_IRQ,
|
||||||
qdev_get_gpio_in_named(dev, "ps2-kbd-input-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(),
|
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)
|
static void i8042_mmio_class_init(ObjectClass *klass, void *data)
|
||||||
{
|
{
|
||||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||||
|
|
||||||
dc->realize = i8042_mmio_realize;
|
dc->realize = i8042_mmio_realize;
|
||||||
dc->reset = i8042_mmio_reset;
|
dc->reset = i8042_mmio_reset;
|
||||||
|
dc->vmsd = &vmstate_kbd_mmio;
|
||||||
device_class_set_props(dc, i8042_mmio_properties);
|
device_class_set_props(dc, i8042_mmio_properties);
|
||||||
set_bit(DEVICE_CATEGORY_INPUT, dc->categories);
|
set_bit(DEVICE_CATEGORY_INPUT, dc->categories);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue