Skip to content

Commit

Permalink
vmstate: port mac_nvram
Browse files Browse the repository at this point in the history
Signed-off-by: Juan Quintela <[email protected]>
  • Loading branch information
Juan Quintela authored and Anthony Liguori committed Apr 22, 2011
1 parent 8a11f43 commit 8e470f8
Showing 1 changed file with 11 additions and 19 deletions.
30 changes: 11 additions & 19 deletions hw/mac_nvram.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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;
Expand Down

0 comments on commit 8e470f8

Please sign in to comment.