From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mm38S-0004UZ-3w for qemu-devel@nongnu.org; Fri, 11 Sep 2009 06:13:44 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mm38N-0004SD-GY for qemu-devel@nongnu.org; Fri, 11 Sep 2009 06:13:43 -0400 Received: from [199.232.76.173] (port=36115 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mm38N-0004Rx-0G for qemu-devel@nongnu.org; Fri, 11 Sep 2009 06:13:39 -0400 Received: from mx20.gnu.org ([199.232.41.8]:9655) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Mm38M-0001EH-Jv for qemu-devel@nongnu.org; Fri, 11 Sep 2009 06:13:38 -0400 Received: from mx1.redhat.com ([209.132.183.28]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Mm38L-0006kT-OO for qemu-devel@nongnu.org; Fri, 11 Sep 2009 06:13:38 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n8BADVHi001414 for ; Fri, 11 Sep 2009 06:13:32 -0400 From: Juan Quintela Date: Fri, 11 Sep 2009 12:10:30 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: Subject: [Qemu-devel] [PATCH 10/20] vmstate: port pxa2xx_i2c device List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Signed-off-by: Juan Quintela --- hw/pxa2xx.c | 54 ++++++++++++++++++++++++++---------------------------- 1 files changed, 26 insertions(+), 28 deletions(-) diff --git a/hw/pxa2xx.c b/hw/pxa2xx.c index e38a125..f8292e7 100644 --- a/hw/pxa2xx.c +++ b/hw/pxa2xx.c @@ -1452,33 +1452,32 @@ static CPUWriteMemoryFunc * const pxa2xx_i2c_writefn[] = { pxa2xx_i2c_write, }; -static void pxa2xx_i2c_save(QEMUFile *f, void *opaque) -{ - PXA2xxI2CState *s = (PXA2xxI2CState *) opaque; - - qemu_put_be16s(f, &s->control); - qemu_put_be16s(f, &s->status); - qemu_put_8s(f, &s->ibmr); - qemu_put_8s(f, &s->data); - - i2c_slave_save(f, &s->slave->i2c); -} - -static int pxa2xx_i2c_load(QEMUFile *f, void *opaque, int version_id) -{ - PXA2xxI2CState *s = (PXA2xxI2CState *) opaque; - - if (version_id != 1) - return -EINVAL; - - qemu_get_be16s(f, &s->control); - qemu_get_be16s(f, &s->status); - qemu_get_8s(f, &s->ibmr); - qemu_get_8s(f, &s->data); +static const VMStateDescription vmstate_pxa2xx_i2c_slave = { + .name = "pxa2xx_i2c_slave", + .version_id = 1, + .minimum_version_id = 1, + .minimum_version_id_old = 1, + .fields = (VMStateField []) { + VMSTATE_I2C_SLAVE(i2c, PXA2xxI2CSlaveState), + VMSTATE_END_OF_LIST() + } +}; - i2c_slave_load(f, &s->slave->i2c); - return 0; -} +static const VMStateDescription vmstate_pxa2xx_i2c = { + .name = "pxa2xx_i2c", + .version_id = 1, + .minimum_version_id = 1, + .minimum_version_id_old = 1, + .fields = (VMStateField []) { + VMSTATE_UINT16(control, PXA2xxI2CState), + VMSTATE_UINT16(status, PXA2xxI2CState), + VMSTATE_UINT8(ibmr, PXA2xxI2CState), + VMSTATE_UINT8(data, PXA2xxI2CState), + VMSTATE_STRUCT_POINTER(slave, PXA2xxI2CState, + vmstate_pxa2xx_i2c, PXA2xxI2CSlaveState *), + VMSTATE_END_OF_LIST() + } +}; static int pxa2xx_i2c_slave_init(i2c_slave *i2c) { @@ -1516,8 +1515,7 @@ PXA2xxI2CState *pxa2xx_i2c_init(target_phys_addr_t base, cpu_register_physical_memory(base & ~region_size, region_size + 1, iomemtype); - register_savevm("pxa2xx_i2c", base, 1, - pxa2xx_i2c_save, pxa2xx_i2c_load, s); + vmstate_register(base, &vmstate_pxa2xx_i2c, s); return s; } -- 1.6.2.5