vmstate: port pl011

Signed-off-by: Juan Quintela <quintela@redhat.com>
This commit is contained in:
Juan Quintela 2010-12-02 01:50:33 +01:00 committed by Anthony Liguori
parent 25f5a1b7df
commit 02b6875795

View File

@ -235,56 +235,30 @@ static CPUWriteMemoryFunc * const pl011_writefn[] = {
pl011_write pl011_write
}; };
static void pl011_save(QEMUFile *f, void *opaque) static const VMStateDescription vmstate_pl011 = {
{ .name = "pl011",
pl011_state *s = (pl011_state *)opaque; .version_id = 1,
int i; .minimum_version_id = 1,
.minimum_version_id_old = 1,
qemu_put_be32(f, s->readbuff); .fields = (VMStateField[]) {
qemu_put_be32(f, s->flags); VMSTATE_UINT32(readbuff, pl011_state),
qemu_put_be32(f, s->lcr); VMSTATE_UINT32(flags, pl011_state),
qemu_put_be32(f, s->cr); VMSTATE_UINT32(lcr, pl011_state),
qemu_put_be32(f, s->dmacr); VMSTATE_UINT32(cr, pl011_state),
qemu_put_be32(f, s->int_enabled); VMSTATE_UINT32(dmacr, pl011_state),
qemu_put_be32(f, s->int_level); VMSTATE_UINT32(int_enabled, pl011_state),
for (i = 0; i < 16; i++) VMSTATE_UINT32(int_level, pl011_state),
qemu_put_be32(f, s->read_fifo[i]); VMSTATE_UINT32_ARRAY(read_fifo, pl011_state, 16),
qemu_put_be32(f, s->ilpr); VMSTATE_UINT32(ilpr, pl011_state),
qemu_put_be32(f, s->ibrd); VMSTATE_UINT32(ibrd, pl011_state),
qemu_put_be32(f, s->fbrd); VMSTATE_UINT32(fbrd, pl011_state),
qemu_put_be32(f, s->ifl); VMSTATE_UINT32(ifl, pl011_state),
qemu_put_be32(f, s->read_pos); VMSTATE_INT32(read_pos, pl011_state),
qemu_put_be32(f, s->read_count); VMSTATE_INT32(read_count, pl011_state),
qemu_put_be32(f, s->read_trigger); VMSTATE_INT32(read_trigger, pl011_state),
} VMSTATE_END_OF_LIST()
}
static int pl011_load(QEMUFile *f, void *opaque, int version_id) };
{
pl011_state *s = (pl011_state *)opaque;
int i;
if (version_id != 1)
return -EINVAL;
s->readbuff = qemu_get_be32(f);
s->flags = qemu_get_be32(f);
s->lcr = qemu_get_be32(f);
s->cr = qemu_get_be32(f);
s->dmacr = qemu_get_be32(f);
s->int_enabled = qemu_get_be32(f);
s->int_level = qemu_get_be32(f);
for (i = 0; i < 16; i++)
s->read_fifo[i] = qemu_get_be32(f);
s->ilpr = qemu_get_be32(f);
s->ibrd = qemu_get_be32(f);
s->fbrd = qemu_get_be32(f);
s->ifl = qemu_get_be32(f);
s->read_pos = qemu_get_be32(f);
s->read_count = qemu_get_be32(f);
s->read_trigger = qemu_get_be32(f);
return 0;
}
static int pl011_init(SysBusDevice *dev, const unsigned char *id) static int pl011_init(SysBusDevice *dev, const unsigned char *id)
{ {
@ -307,7 +281,7 @@ static int pl011_init(SysBusDevice *dev, const unsigned char *id)
qemu_chr_add_handlers(s->chr, pl011_can_receive, pl011_receive, qemu_chr_add_handlers(s->chr, pl011_can_receive, pl011_receive,
pl011_event, s); pl011_event, s);
} }
register_savevm(&dev->qdev, "pl011_uart", -1, 1, pl011_save, pl011_load, s); vmstate_register(&dev->qdev, -1, &vmstate_pl011, s);
return 0; return 0;
} }