From 75c497dca9bea34b2db2b11a4ecff57de9e5f2f4 Mon Sep 17 00:00:00 2001 From: Blue Swirl Date: Fri, 28 Aug 2009 20:46:15 +0000 Subject: Sparc32: port DMA controller to VMState design Signed-off-by: Blue Swirl --- hw/sparc32_dma.c | 33 +++++++++++---------------------- 1 file changed, 11 insertions(+), 22 deletions(-) (limited to 'hw/sparc32_dma.c') diff --git a/hw/sparc32_dma.c b/hw/sparc32_dma.c index 7f3150e858..aca37706f1 100644 --- a/hw/sparc32_dma.c +++ b/hw/sparc32_dma.c @@ -222,27 +222,16 @@ static void dma_reset(void *opaque) s->dmaregs[0] = DMA_VER; } -static void dma_save(QEMUFile *f, void *opaque) -{ - DMAState *s = opaque; - unsigned int i; - - for (i = 0; i < DMA_REGS; i++) - qemu_put_be32s(f, &s->dmaregs[i]); -} - -static int dma_load(QEMUFile *f, void *opaque, int version_id) -{ - DMAState *s = opaque; - unsigned int i; - - if (version_id != 2) - return -EINVAL; - for (i = 0; i < DMA_REGS; i++) - qemu_get_be32s(f, &s->dmaregs[i]); - - return 0; -} +static const VMStateDescription vmstate_dma = { + .name ="sparc32_dma", + .version_id = 2, + .minimum_version_id = 2, + .minimum_version_id_old = 2, + .fields = (VMStateField []) { + VMSTATE_UINT32_ARRAY(dmaregs, DMAState, DMA_REGS), + VMSTATE_END_OF_LIST() + } +}; static int sparc32_dma_init1(SysBusDevice *dev) { @@ -254,7 +243,7 @@ static int sparc32_dma_init1(SysBusDevice *dev) dma_io_memory = cpu_register_io_memory(dma_mem_read, dma_mem_write, s); sysbus_init_mmio(dev, DMA_SIZE, dma_io_memory); - register_savevm("sparc32_dma", -1, 2, dma_save, dma_load, s); + vmstate_register(-1, &vmstate_dma, s); qemu_register_reset(dma_reset, s); qdev_init_gpio_in(&dev->qdev, dma_set_irq, 1); -- cgit v1.2.3