diff options
author | Blue Swirl <blauwirbel@gmail.com> | 2009-08-28 20:46:21 +0000 |
---|---|---|
committer | Blue Swirl <blauwirbel@gmail.com> | 2009-08-28 20:46:21 +0000 |
commit | db3c9e08e0d6eaf83f9d7a2c87dc45af3ac8f4dd (patch) | |
tree | a7ec3041c2c785c7dca4ba744ecee301b76a1caa | |
parent | 75c497dca9bea34b2db2b11a4ecff57de9e5f2f4 (diff) |
Sparc32: port IOMMU to VMState design
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
-rw-r--r-- | hw/iommu.c | 37 |
1 files changed, 12 insertions, 25 deletions
diff --git a/hw/iommu.c b/hw/iommu.c index e15cc91ce8..20da7ab969 100644 --- a/hw/iommu.c +++ b/hw/iommu.c @@ -328,30 +328,17 @@ void sparc_iommu_memory_rw(void *opaque, target_phys_addr_t addr, } } -static void iommu_save(QEMUFile *f, void *opaque) -{ - IOMMUState *s = opaque; - int i; - - for (i = 0; i < IOMMU_NREGS; i++) - qemu_put_be32s(f, &s->regs[i]); - qemu_put_be64s(f, &s->iostart); -} - -static int iommu_load(QEMUFile *f, void *opaque, int version_id) -{ - IOMMUState *s = opaque; - int i; - - if (version_id != 2) - return -EINVAL; - - for (i = 0; i < IOMMU_NREGS; i++) - qemu_get_be32s(f, &s->regs[i]); - qemu_get_be64s(f, &s->iostart); - - return 0; -} +static const VMStateDescription vmstate_iommu = { + .name ="iommu", + .version_id = 2, + .minimum_version_id = 2, + .minimum_version_id_old = 2, + .fields = (VMStateField []) { + VMSTATE_UINT32_ARRAY(regs, IOMMUState, IOMMU_NREGS), + VMSTATE_UINT64(iostart, IOMMUState), + VMSTATE_END_OF_LIST() + } +}; static void iommu_reset(void *opaque) { @@ -376,7 +363,7 @@ static int iommu_init1(SysBusDevice *dev) io = cpu_register_io_memory(iommu_mem_read, iommu_mem_write, s); sysbus_init_mmio(dev, IOMMU_NREGS * sizeof(uint32_t), io); - register_savevm("iommu", -1, 2, iommu_save, iommu_load, s); + vmstate_register(-1, &vmstate_iommu, s); qemu_register_reset(iommu_reset, s); iommu_reset(s); return 0; |