vmstate: port pckbd device
Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
bcb58d9ac9
commit
3c619b5975
39
hw/pckbd.c
39
hw/pckbd.c
@ -339,28 +339,19 @@ static void kbd_reset(void *opaque)
|
|||||||
s->status = KBD_STAT_CMD | KBD_STAT_UNLOCKED;
|
s->status = KBD_STAT_CMD | KBD_STAT_UNLOCKED;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void kbd_save(QEMUFile* f, void* opaque)
|
static const VMStateDescription vmstate_kbd = {
|
||||||
{
|
.name = "pckbd",
|
||||||
KBDState *s = (KBDState*)opaque;
|
.version_id = 3,
|
||||||
|
.minimum_version_id = 3,
|
||||||
qemu_put_8s(f, &s->write_cmd);
|
.minimum_version_id_old = 3,
|
||||||
qemu_put_8s(f, &s->status);
|
.fields = (VMStateField []) {
|
||||||
qemu_put_8s(f, &s->mode);
|
VMSTATE_UINT8(write_cmd, KBDState),
|
||||||
qemu_put_8s(f, &s->pending);
|
VMSTATE_UINT8(status, KBDState),
|
||||||
}
|
VMSTATE_UINT8(mode, KBDState),
|
||||||
|
VMSTATE_UINT8(pending, KBDState),
|
||||||
static int kbd_load(QEMUFile* f, void* opaque, int version_id)
|
VMSTATE_END_OF_LIST()
|
||||||
{
|
}
|
||||||
KBDState *s = (KBDState*)opaque;
|
};
|
||||||
|
|
||||||
if (version_id != 3)
|
|
||||||
return -EINVAL;
|
|
||||||
qemu_get_8s(f, &s->write_cmd);
|
|
||||||
qemu_get_8s(f, &s->status);
|
|
||||||
qemu_get_8s(f, &s->mode);
|
|
||||||
qemu_get_8s(f, &s->pending);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Memory mapped interface */
|
/* Memory mapped interface */
|
||||||
static uint32_t kbd_mm_readb (void *opaque, target_phys_addr_t addr)
|
static uint32_t kbd_mm_readb (void *opaque, target_phys_addr_t addr)
|
||||||
@ -407,7 +398,7 @@ void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq,
|
|||||||
s->mask = mask;
|
s->mask = mask;
|
||||||
|
|
||||||
kbd_reset(s);
|
kbd_reset(s);
|
||||||
register_savevm("pckbd", 0, 3, kbd_save, kbd_load, s);
|
vmstate_register(0, &vmstate_kbd, s);
|
||||||
s_io_memory = cpu_register_io_memory(kbd_mm_read, kbd_mm_write, s);
|
s_io_memory = cpu_register_io_memory(kbd_mm_read, kbd_mm_write, s);
|
||||||
cpu_register_physical_memory(base, size, s_io_memory);
|
cpu_register_physical_memory(base, size, s_io_memory);
|
||||||
|
|
||||||
@ -432,7 +423,7 @@ static int i8042_initfn(ISADevice *dev)
|
|||||||
isa_init_irq(dev, &s->irq_mouse, 12);
|
isa_init_irq(dev, &s->irq_mouse, 12);
|
||||||
|
|
||||||
kbd_reset(s);
|
kbd_reset(s);
|
||||||
register_savevm("pckbd", 0, 3, kbd_save, kbd_load, s);
|
vmstate_register(0, &vmstate_kbd, s);
|
||||||
register_ioport_read(0x60, 1, 1, kbd_read_data, s);
|
register_ioport_read(0x60, 1, 1, kbd_read_data, s);
|
||||||
register_ioport_write(0x60, 1, 1, kbd_write_data, s);
|
register_ioport_write(0x60, 1, 1, kbd_write_data, s);
|
||||||
register_ioport_read(0x64, 1, 1, kbd_read_status, s);
|
register_ioport_read(0x64, 1, 1, kbd_read_status, s);
|
||||||
|
Loading…
Reference in New Issue
Block a user