vmstate: port pxa2xx_i2c device

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
Juan Quintela 2009-09-29 22:48:34 +02:00 committed by Anthony Liguori
parent 840e9cef84
commit 0211364d37
1 changed files with 26 additions and 28 deletions

View File

@ -1452,33 +1452,32 @@ static CPUWriteMemoryFunc * const pxa2xx_i2c_writefn[] = {
pxa2xx_i2c_write, pxa2xx_i2c_write,
}; };
static void pxa2xx_i2c_save(QEMUFile *f, void *opaque) static const VMStateDescription vmstate_pxa2xx_i2c_slave = {
{ .name = "pxa2xx_i2c_slave",
PXA2xxI2CState *s = (PXA2xxI2CState *) opaque; .version_id = 1,
.minimum_version_id = 1,
.minimum_version_id_old = 1,
.fields = (VMStateField []) {
VMSTATE_I2C_SLAVE(i2c, PXA2xxI2CSlaveState),
VMSTATE_END_OF_LIST()
}
};
qemu_put_be16s(f, &s->control); static const VMStateDescription vmstate_pxa2xx_i2c = {
qemu_put_be16s(f, &s->status); .name = "pxa2xx_i2c",
qemu_put_8s(f, &s->ibmr); .version_id = 1,
qemu_put_8s(f, &s->data); .minimum_version_id = 1,
.minimum_version_id_old = 1,
i2c_slave_save(f, &s->slave->i2c); .fields = (VMStateField []) {
} VMSTATE_UINT16(control, PXA2xxI2CState),
VMSTATE_UINT16(status, PXA2xxI2CState),
static int pxa2xx_i2c_load(QEMUFile *f, void *opaque, int version_id) VMSTATE_UINT8(ibmr, PXA2xxI2CState),
{ VMSTATE_UINT8(data, PXA2xxI2CState),
PXA2xxI2CState *s = (PXA2xxI2CState *) opaque; VMSTATE_STRUCT_POINTER(slave, PXA2xxI2CState,
vmstate_pxa2xx_i2c, PXA2xxI2CSlaveState *),
if (version_id != 1) VMSTATE_END_OF_LIST()
return -EINVAL; }
};
qemu_get_be16s(f, &s->control);
qemu_get_be16s(f, &s->status);
qemu_get_8s(f, &s->ibmr);
qemu_get_8s(f, &s->data);
i2c_slave_load(f, &s->slave->i2c);
return 0;
}
static int pxa2xx_i2c_slave_init(i2c_slave *i2c) static int pxa2xx_i2c_slave_init(i2c_slave *i2c)
{ {
@ -1516,8 +1515,7 @@ PXA2xxI2CState *pxa2xx_i2c_init(target_phys_addr_t base,
cpu_register_physical_memory(base & ~region_size, cpu_register_physical_memory(base & ~region_size,
region_size + 1, iomemtype); region_size + 1, iomemtype);
register_savevm("pxa2xx_i2c", base, 1, vmstate_register(base, &vmstate_pxa2xx_i2c, s);
pxa2xx_i2c_save, pxa2xx_i2c_load, s);
return s; return s;
} }