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

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,
qemu_put_be16s(f, &s->control); .minimum_version_id_old = 1,
qemu_put_be16s(f, &s->status); .fields = (VMStateField []) {
qemu_put_8s(f, &s->ibmr); VMSTATE_I2C_SLAVE(i2c, PXA2xxI2CSlaveState),
qemu_put_8s(f, &s->data); VMSTATE_END_OF_LIST()
i2c_slave_save(f, &s->slave->i2c);
} }
};
static int pxa2xx_i2c_load(QEMUFile *f, void *opaque, int version_id) static const VMStateDescription vmstate_pxa2xx_i2c = {
{ .name = "pxa2xx_i2c",
PXA2xxI2CState *s = (PXA2xxI2CState *) opaque; .version_id = 1,
.minimum_version_id = 1,
if (version_id != 1) .minimum_version_id_old = 1,
return -EINVAL; .fields = (VMStateField []) {
VMSTATE_UINT16(control, PXA2xxI2CState),
qemu_get_be16s(f, &s->control); VMSTATE_UINT16(status, PXA2xxI2CState),
qemu_get_be16s(f, &s->status); VMSTATE_UINT8(ibmr, PXA2xxI2CState),
qemu_get_8s(f, &s->ibmr); VMSTATE_UINT8(data, PXA2xxI2CState),
qemu_get_8s(f, &s->data); VMSTATE_STRUCT_POINTER(slave, PXA2xxI2CState,
vmstate_pxa2xx_i2c, PXA2xxI2CSlaveState *),
i2c_slave_load(f, &s->slave->i2c); VMSTATE_END_OF_LIST()
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;
} }