[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 09/13] vmstate: port mac_nvram
From: |
Juan Quintela |
Subject: |
[Qemu-devel] [PATCH 09/13] vmstate: port mac_nvram |
Date: |
Thu, 10 Mar 2011 12:54:26 +0100 |
Signed-off-by: Juan Quintela <address@hidden>
---
hw/mac_nvram.c | 30 +++++++++++-------------------
1 files changed, 11 insertions(+), 19 deletions(-)
diff --git a/hw/mac_nvram.c b/hw/mac_nvram.c
index 64f0192..61e53d2 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;
--
1.7.4
- [Qemu-devel] [PATCH 00/13] VMState port more devices, Juan Quintela, 2011/03/10
- [Qemu-devel] [PATCH 01/13] pxa2xx_lcd: name anonymous struct, Juan Quintela, 2011/03/10
- [Qemu-devel] [PATCH 02/13] pxa2xx_lcd: up field is used as a bool and migrated as an uint8_t, Juan Quintela, 2011/03/10
- [Qemu-devel] [PATCH 03/13] vmstate: port pxa2xx_lcd, Juan Quintela, 2011/03/10
- [Qemu-devel] [PATCH 05/13] vmstate: port max111x, Juan Quintela, 2011/03/10
- [Qemu-devel] [PATCH 04/13] max111x: input field is only used as uint8_t, Juan Quintela, 2011/03/10
- [Qemu-devel] [PATCH 07/13] vmstate: port nand, Juan Quintela, 2011/03/10
- [Qemu-devel] [PATCH 09/13] vmstate: port mac_nvram,
Juan Quintela <=
- [Qemu-devel] [PATCH 10/13] piix4: create PIIX4State, Juan Quintela, 2011/03/10
- [Qemu-devel] [PATCH 06/13] nand: pin values are uint8_t, Juan Quintela, 2011/03/10
- [Qemu-devel] [PATCH 08/13] mac_nvram: size is a size, no need to be a target dependent type, Juan Quintela, 2011/03/10
- [Qemu-devel] [PATCH 13/13] vmstate: port mac_dbdma, Juan Quintela, 2011/03/10
- [Qemu-devel] [PATCH 12/13] mac_dbdma: create DBDMAState instead of passing one array around, Juan Quintela, 2011/03/10
- [Qemu-devel] [PATCH 11/13] vmstate: port piix4, Juan Quintela, 2011/03/10