aboutsummaryrefslogtreecommitdiff
path: root/hw/mac_nvram.c
diff options
context:
space:
mode:
authorJuan Quintela <quintela@redhat.com>2010-12-03 01:59:09 +0100
committerAnthony Liguori <aliguori@us.ibm.com>2011-04-22 14:41:43 -0500
commit8e470f8a77f6dfb0ca4bb087010b4bcd920a1d21 (patch)
treecd4dde166495b6beb8a4f280c1dde564e3415ed6 /hw/mac_nvram.c
parent8a11f43bd5d42462c7d6a9321cefa59e78c69d51 (diff)
vmstate: port mac_nvram
Signed-off-by: Juan Quintela <quintela@redhat.com>
Diffstat (limited to 'hw/mac_nvram.c')
-rw-r--r--hw/mac_nvram.c30
1 files changed, 11 insertions, 19 deletions
diff --git a/hw/mac_nvram.c b/hw/mac_nvram.c
index 64f0192b22..61e53d28b4 100644
--- a/hw/mac_nvram.c
+++ b/hw/mac_nvram.c
@@ -105,24 +105,17 @@ static CPUReadMemoryFunc * const nvram_read[] = {
&macio_nvram_readb,
};
-static void macio_nvram_save(QEMUFile *f, void *opaque)
-{
- MacIONVRAMState *s = (MacIONVRAMState *)opaque;
-
- qemu_put_buffer(f, s->data, s->size);
-}
-
-static int macio_nvram_load(QEMUFile *f, void *opaque, int version_id)
-{
- MacIONVRAMState *s = (MacIONVRAMState *)opaque;
-
- if (version_id != 1)
- return -EINVAL;
-
- qemu_get_buffer(f, s->data, s->size);
+static const VMStateDescription vmstate_macio_nvram = {
+ .name = "macio_nvram",
+ .version_id = 1,
+ .minimum_version_id = 1,
+ .minimum_version_id_old = 1,
+ .fields = (VMStateField[]) {
+ VMSTATE_VBUFFER_UINT32(data, MacIONVRAMState, 0, NULL, 0, size),
+ VMSTATE_END_OF_LIST()
+ }
+};
- return 0;
-}
static void macio_nvram_reset(void *opaque)
{
@@ -141,8 +134,7 @@ MacIONVRAMState *macio_nvram_init (int *mem_index, target_phys_addr_t size,
s->mem_index = cpu_register_io_memory(nvram_read, nvram_write, s,
DEVICE_NATIVE_ENDIAN);
*mem_index = s->mem_index;
- register_savevm(NULL, "macio_nvram", -1, 1, macio_nvram_save,
- macio_nvram_load, s);
+ vmstate_register(NULL, -1, &vmstate_macio_nvram, s);
qemu_register_reset(macio_nvram_reset, s);
return s;