diff options
author | Blue Swirl <blauwirbel@gmail.com> | 2009-10-24 20:08:43 +0000 |
---|---|---|
committer | Blue Swirl <blauwirbel@gmail.com> | 2009-10-24 20:08:43 +0000 |
commit | b280fcdfdee843de8ef5a7692f5825d9c4e94cff (patch) | |
tree | a32eee2c2f220de987f7f35b13db7e4dd951dcaa /hw/sbi.c | |
parent | 9a2070d3c09b796fac8fd4f0500c2da925e7c3f6 (diff) |
sparc32: convert sbi to VMState, vmsd and vmstate reset
Also remove unused include directive.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Diffstat (limited to 'hw/sbi.c')
-rw-r--r-- | hw/sbi.c | 46 |
1 files changed, 15 insertions, 31 deletions
@@ -22,9 +22,6 @@ * THE SOFTWARE. */ -#include "hw.h" -#include "sun4m.h" -#include "console.h" #include "sysbus.h" //#define DEBUG_IRQ @@ -96,34 +93,20 @@ static CPUWriteMemoryFunc * const sbi_mem_write[3] = { sbi_mem_writel, }; -static void sbi_save(QEMUFile *f, void *opaque) -{ - SBIState *s = opaque; - unsigned int i; - - for (i = 0; i < MAX_CPUS; i++) { - qemu_put_be32s(f, &s->intreg_pending[i]); - } -} - -static int sbi_load(QEMUFile *f, void *opaque, int version_id) -{ - SBIState *s = opaque; - unsigned int i; - - if (version_id != 1) - return -EINVAL; - - for (i = 0; i < MAX_CPUS; i++) { - qemu_get_be32s(f, &s->intreg_pending[i]); +static const VMStateDescription vmstate_sbi = { + .name ="sbi", + .version_id = 1, + .minimum_version_id = 1, + .minimum_version_id_old = 1, + .fields = (VMStateField []) { + VMSTATE_UINT32_ARRAY(intreg_pending, SBIState, MAX_CPUS), + VMSTATE_END_OF_LIST() } +}; - return 0; -} - -static void sbi_reset(void *opaque) +static void sbi_reset(DeviceState *d) { - SBIState *s = opaque; + SBIState *s = container_of(d, SBIState, busdev.qdev); unsigned int i; for (i = 0; i < MAX_CPUS; i++) { @@ -145,9 +128,8 @@ static int sbi_init1(SysBusDevice *dev) sbi_io_memory = cpu_register_io_memory(sbi_mem_read, sbi_mem_write, s); sysbus_init_mmio(dev, SBI_SIZE, sbi_io_memory); - register_savevm("sbi", -1, 1, sbi_save, sbi_load, s); - qemu_register_reset(sbi_reset, s); - sbi_reset(s); + sbi_reset(&s->busdev.qdev); + return 0; } @@ -155,6 +137,8 @@ static SysBusDeviceInfo sbi_info = { .init = sbi_init1, .qdev.name = "sbi", .qdev.size = sizeof(SBIState), + .qdev.vmsd = &vmstate_sbi, + .qdev.reset = sbi_reset, }; static void sbi_register_devices(void) |