VMState port of misc devices
cover VMState port of misc devices
Hi
This are the devices that conversion was trivial.
Series is on top of my previous series:
[PATCH 0/9] VMState infrastructure
All coments from Blue Swirl have been addressed (thanks for them). Change for PCI Device from Isazu was not implemented because I can test that it work. I like the change but would prefer it to be independent of this series
Later, Juan.
Juan Quintela (32):
vmstate: port adb_kbd
vmstate: port adb_mouse
vmstate: port ads7846
vmstate: port m48t59
vmstate: port mipsnet
vmstate: port arm sp804
vmstate: port arm_timer
vmstate: port sysborg_timer
vmstate: port pmtimer
vmstate: port syborg_rtc
vmstate: port pxa2xx_keypad
vmstate: port pl011
vmstate: port armv7m nvic
vmstate: port stellaris i2c
vmstate: port stellaris ssi bus
vmstate: port stellaris sys
vmstate: port pl022 ssp
vmstate: port heathrow_pic
vmstate: port cuda
vmstate: port stellaris gptm
vmstate: port pxa2xx_i2s
vmstate: port pxa2xx_cm
vmstate: port pxa2xx_mm
vmstate: port pxa2xx_pm
vmstate: port ppce500_pci
vmstate: port ppc4xx_pci
vmstate: port syborg_pointer
vmstate: port stellaris_adc
vmstate: port syborg_serial
vmstate: port syborg_keyboard
vmstate: port stellaris gamepad
vmstate: stellaris use unused for placeholder entries
hw/adb.c | 83 +++++--------- hw/ads7846.c | 41 +++---- hw/arm_timer.c | 66 ++++------- hw/armv7m_nvic.c | 39 ++---- hw/cuda.c | 116 +++++++----------- hw/heathrow_pic.c | 62 ++++------ hw/hw.h | 17 ++- hw/m48t59.c | 36 ++---- hw/mipsnet.c | 53 +++------ hw/pl011.c | 76 ++++-------- hw/pl022.c | 84 ++++++-------- hw/ppc4xx_pci.c | 80 ++++++------- hw/ppce500_pci.c | 87 ++++++-------- hw/ptimer.c | 59 +++------- hw/pxa2xx.c | 158 +++++++++---------------- hw/pxa2xx_keypad.c | 53 +++------ hw/stellaris.c | 323 +++++++++++++++++--------------------------------- hw/stellaris_input.c | 50 ++++---- hw/syborg_keyboard.c | 57 +++------ hw/syborg_pointer.c | 73 +++++------- hw/syborg_rtc.c | 34 ++---- hw/syborg_serial.c | 60 +++------- hw/syborg_timer.c | 46 +++----- qemu-timer.h | 2 - 24 files changed, 654 insertions(+), 1101 deletions(-)
Signature · 1 line
1.7.4
PATCH 1/32 vmstate: port adb_kbd
--- hw/adb.c | 40 ++++++++++++++-------------------------- 1 files changed, 14 insertions(+), 26 deletions(-)
hw/adb.c +14 -26
@@ -261,30 +261,19 @@ static int adb_kbd_request(ADBDevice *d, uint8_t *obuf,return olen; } -static void adb_kbd_save (QEMUFile *f,void *opaque) -{ -KBDState *s = (KBDState *)opaque; - -qemu_put_buffer (f, s->data,sizeof (s->data)); -qemu_put_sbe32s (f, &s->rptr); -qemu_put_sbe32s (f, &s->wptr); -qemu_put_sbe32s (f, &s->count); -} - -static int adb_kbd_load (QEMUFile *f,void *opaque,int version_id) -{ -KBDState *s = (KBDState *)opaque; - -if (version_id !=1 ) -return -EINVAL ; - -qemu_get_buffer (f, s->data,sizeof (s->data)); -qemu_get_sbe32s (f, &s->rptr); -qemu_get_sbe32s (f, &s->wptr); -qemu_get_sbe32s (f, &s->count); - -return 0 ; -} +static const VMStateDescription vmstate_adb_kbd = { + .name ="adb_kbd" , + .version_id =1 , + .minimum_version_id =1 , + .minimum_version_id_old =1 , + .fields = (VMStateField []) { +VMSTATE_BUFFER (data, KBDState), +VMSTATE_INT32 (rptr, KBDState), +VMSTATE_INT32 (wptr, KBDState), +VMSTATE_INT32 (count, KBDState), +VMSTATE_END_OF_LIST () + } +};static int adb_kbd_reset (ADBDevice *d) {
@@ -305,8 +294,7 @@ void adb_kbd_init(ADBBusState *bus) d =adb_register_device (bus,ADB_KEYBOARD , adb_kbd_request, adb_kbd_reset, s);qemu_add_kbd_event_handler (adb_kbd_put_keycode, d); -register_savevm (NULL ,"adb_kbd" ,-1 ,1 , adb_kbd_save, - adb_kbd_load, s); +vmstate_register (NULL ,-1 , &vmstate_adb_kbd, s); }/***************************************************************/
Signature · 1 line
1.7.4
PATCH 2/32 vmstate: port adb_mouse
In reply to Juan Quintela--- hw/adb.c | 43 +++++++++++++++---------------------------- 1 files changed, 15 insertions(+), 28 deletions(-)
hw/adb.c +15 -28
@@ -427,32 +427,20 @@ static int adb_mouse_reset(ADBDevice *d)return 0 ; } -static void adb_mouse_save (QEMUFile *f,void *opaque) -{ -MouseState *s = (MouseState *)opaque; - -qemu_put_sbe32s (f, &s->buttons_state); -qemu_put_sbe32s (f, &s->last_buttons_state); -qemu_put_sbe32s (f, &s->dx); -qemu_put_sbe32s (f, &s->dy); -qemu_put_sbe32s (f, &s->dz); -} - -static int adb_mouse_load (QEMUFile *f,void *opaque,int version_id) -{ -MouseState *s = (MouseState *)opaque; - -if (version_id !=1 ) -return -EINVAL ; - -qemu_get_sbe32s (f, &s->buttons_state); -qemu_get_sbe32s (f, &s->last_buttons_state); -qemu_get_sbe32s (f, &s->dx); -qemu_get_sbe32s (f, &s->dy); -qemu_get_sbe32s (f, &s->dz); - -return 0 ; -} +static const VMStateDescription vmstate_adb_mouse = { + .name ="adb_mouse" , + .version_id =1 , + .minimum_version_id =1 , + .minimum_version_id_old =1 , + .fields = (VMStateField []) { +VMSTATE_INT32 (buttons_state, MouseState), +VMSTATE_INT32 (last_buttons_state, MouseState), +VMSTATE_INT32 (dx, MouseState), +VMSTATE_INT32 (dy, MouseState), +VMSTATE_INT32 (dz, MouseState), +VMSTATE_END_OF_LIST () + } +};void adb_mouse_init (ADBBusState *bus) {
@@ -463,6 +451,5 @@ void adb_mouse_init(ADBBusState *bus) d =adb_register_device (bus,ADB_MOUSE , adb_mouse_request, adb_mouse_reset, s);qemu_add_mouse_event_handler (adb_mouse_event, d,0 ,"QEMU ADB Mouse" ); -register_savevm (NULL ,"adb_mouse" ,-1 ,1 , adb_mouse_save, - adb_mouse_load, s); +vmstate_register (NULL ,-1 , &vmstate_adb_mouse, s); }
Signature · 1 line
1.7.4
PATCH 3/32 vmstate: port ads7846
In reply to Juan Quintela--- hw/ads7846.c | 41 ++++++++++++++++++----------------------- 1 files changed, 18 insertions(+), 23 deletions(-)
hw/ads7846.c +18 -23
@@ -105,35 +105,30 @@ static void ads7846_ts_event(void *opaque, } } -static void ads7846_save (QEMUFile *f,void *opaque) +static int ads7856_post_load (void *opaque,int version_id) { -ADS7846State *s = (ADS7846State *) opaque; -int i; - -for (i =0 ; i <8 ; i ++) -qemu_put_be32 (f, s->input[i]); -qemu_put_be32 (f, s->noise); -qemu_put_be32 (f, s->cycle); -qemu_put_be32 (f, s->output); -} - -static int ads7846_load (QEMUFile *f,void *opaque,int version_id) -{ -ADS7846State *s = (ADS7846State *) opaque; -int i; - -for (i =0 ; i <8 ; i ++) - s->input[i] =qemu_get_be32 (f); - s->noise =qemu_get_be32 (f); - s->cycle =qemu_get_be32 (f); - s->output =qemu_get_be32 (f); +ADS7846State *s = opaque; s->pressure =0 ;ads7846_int_update (s); -return 0 ; } +static const VMStateDescription vmstate_ads7846 = { + .name ="ads7846" , + .version_id =0 , + .minimum_version_id =0 , + .minimum_version_id_old =0 , + .post_load = ads7856_post_load, + .fields = (VMStateField []) { +VMSTATE_INT32_ARRAY (input, ADS7846State,8 ), +VMSTATE_INT32 (noise, ADS7846State), +VMSTATE_INT32 (cycle, ADS7846State), +VMSTATE_INT32 (output, ADS7846State), +VMSTATE_END_OF_LIST () + } +}; +static int ads7846_init (SSISlave *dev) {ADS7846State *s =FROM_SSI_SLAVE (ADS7846State, dev);
@@ -151,7 +146,7 @@ static int ads7846_init(SSISlave *dev)ads7846_int_update (s); -register_savevm (NULL ,"ads7846" ,-1 ,0 , ads7846_save, ads7846_load, s); +vmstate_register (NULL ,-1 , &vmstate_ads7846, s);return 0 ; }
Signature · 1 line
1.7.4
PATCH 4/32 vmstate: port m48t59
In reply to Juan Quintela--- hw/m48t59.c | 36 +++++++++++++----------------------- 1 files changed, 13 insertions(+), 23 deletions(-)
hw/m48t59.c +13 -23
@@ -585,28 +585,18 @@ static CPUReadMemoryFunc * const nvram_read[] = { &nvram_readl, }; -static void m48t59_save (QEMUFile *f,void *opaque) -{ -M48t59State *s = opaque; - -qemu_put_8s (f, &s->lock); -qemu_put_be16s (f, &s->addr); -qemu_put_buffer (f, s->buffer, s->size); -} - -static int m48t59_load (QEMUFile *f,void *opaque,int version_id) -{ -M48t59State *s = opaque; - -if (version_id !=1 ) -return -EINVAL ; - -qemu_get_8s (f, &s->lock); -qemu_get_be16s (f, &s->addr); -qemu_get_buffer (f, s->buffer, s->size); - -return 0 ; -} +static const VMStateDescription vmstate_m48t59 = { + .name ="m48t59" , + .version_id =1 , + .minimum_version_id =1 , + .minimum_version_id_old =1 , + .fields = (VMStateField []) { +VMSTATE_UINT8 (lock, M48t59State), +VMSTATE_UINT16 (addr, M48t59State), +VMSTATE_VBUFFER_UINT32 (buffer, M48t59State,0 ,NULL ,0 , size), +VMSTATE_END_OF_LIST () + } +};static void m48t59_reset_common (M48t59State *NVRAM ) {
@@ -696,7 +686,7 @@ static void m48t59_init_common(M48t59State *s) }qemu_get_timedate (&s->alarm,0 ); -register_savevm (NULL ,"m48t59" ,-1 ,1 , m48t59_save, m48t59_load, s); +vmstate_register (NULL ,-1 , &vmstate_m48t59, s); }static int m48t59_init_isa1 (ISADevice *dev)
Signature · 1 line
1.7.4
PATCH 5/32 vmstate: port mipsnet
In reply to Juan Quintela--- hw/mipsnet.c | 53 +++++++++++++++++++---------------------------------- 1 files changed, 19 insertions(+), 34 deletions(-)
hw/mipsnet.c +19 -34
@@ -202,44 +202,29 @@ static void mipsnet_ioport_write(void *opaque, uint32_t addr, uint32_t val) } } -static void mipsnet_save (QEMUFile *f,void *opaque) -{ -MIPSnetState *s = opaque; - -qemu_put_be32s (f, &s->busy); -qemu_put_be32s (f, &s->rx_count); -qemu_put_be32s (f, &s->rx_read); -qemu_put_be32s (f, &s->tx_count); -qemu_put_be32s (f, &s->tx_written); -qemu_put_be32s (f, &s->intctl); -qemu_put_buffer (f, s->rx_buffer,MAX_ETH_FRAME_SIZE ); -qemu_put_buffer (f, s->tx_buffer,MAX_ETH_FRAME_SIZE ); -} - -static int mipsnet_load (QEMUFile *f,void *opaque,int version_id) -{ -MIPSnetState *s = opaque; - -if (version_id >0 ) -return -EINVAL ; - -qemu_get_be32s (f, &s->busy); -qemu_get_be32s (f, &s->rx_count); -qemu_get_be32s (f, &s->rx_read); -qemu_get_be32s (f, &s->tx_count); -qemu_get_be32s (f, &s->tx_written); -qemu_get_be32s (f, &s->intctl); -qemu_get_buffer (f, s->rx_buffer,MAX_ETH_FRAME_SIZE ); -qemu_get_buffer (f, s->tx_buffer,MAX_ETH_FRAME_SIZE ); - -return 0 ; -} +static const VMStateDescription vmstate_mipsnet = { + .name ="mipsnet" , + .version_id =0 , + .minimum_version_id =0 , + .minimum_version_id_old =0 , + .fields = (VMStateField []) { +VMSTATE_UINT32 (busy, MIPSnetState), +VMSTATE_UINT32 (rx_count, MIPSnetState), +VMSTATE_UINT32 (rx_read, MIPSnetState), +VMSTATE_UINT32 (tx_count, MIPSnetState), +VMSTATE_UINT32 (tx_written, MIPSnetState), +VMSTATE_UINT32 (intctl, MIPSnetState), +VMSTATE_BUFFER (rx_buffer, MIPSnetState), +VMSTATE_BUFFER (tx_buffer, MIPSnetState), +VMSTATE_END_OF_LIST () + } +};static void mipsnet_cleanup (VLANClientState *nc) {MIPSnetState *s =DO_UPCAST (NICState, nc, nc)->opaque; -unregister_savevm (NULL ,"mipsnet" , s); +vmstate_unregister (NULL , &vmstate_mipsnet, s);isa_unassign_ioport (s->io_base,36 );
@@ -284,5 +269,5 @@ void mipsnet_init (int base, qemu_irq irq, NICInfo *nd) }mipsnet_reset (s); -register_savevm (NULL ,"mipsnet" ,0 ,0 , mipsnet_save, mipsnet_load, s); +vmstate_register (NULL ,0 , &vmstate_mipsnet, s); }
Signature · 1 line
1.7.4
PATCH 6/32 vmstate: port arm sp804
In reply to Juan Quintela--- hw/arm_timer.c | 29 +++++++++++------------------ 1 files changed, 11 insertions(+), 18 deletions(-)
hw/arm_timer.c +11 -18
@@ -235,24 +235,17 @@ static CPUWriteMemoryFunc * const sp804_writefn[] = { sp804_write }; -static void sp804_save (QEMUFile *f,void *opaque) -{ -sp804_state *s = (sp804_state *)opaque; -qemu_put_be32 (f, s->level[0 ]); -qemu_put_be32 (f, s->level[1 ]); -} -static int sp804_load (QEMUFile *f,void *opaque,int version_id) -{ -sp804_state *s = (sp804_state *)opaque; - -if (version_id !=1 ) -return -EINVAL ; - - s->level[0 ] =qemu_get_be32 (f); - s->level[1 ] =qemu_get_be32 (f); -return 0 ; -} +static const VMStateDescription vmstate_sp804 = { + .name ="sp804" , + .version_id =1 , + .minimum_version_id =1 , + .minimum_version_id_old =1 , + .fields = (VMStateField []) { +VMSTATE_INT32_ARRAY (level, sp804_state,2 ), +VMSTATE_END_OF_LIST () + } +};static int sp804_init (SysBusDevice *dev) {
@@ -271,7 +264,7 @@ static int sp804_init(SysBusDevice *dev) iomemtype =cpu_register_io_memory (sp804_readfn, sp804_writefn, s,DEVICE_NATIVE_ENDIAN );sysbus_init_mmio (dev,0x1000 , iomemtype); -register_savevm (&dev->qdev,"sp804" ,-1 ,1 , sp804_save, sp804_load, s); +vmstate_register (&dev->qdev,-1 , &vmstate_sp804, s);return 0 ; }
Signature · 1 line
1.7.4
PATCH 7/32 vmstate: port arm_timer
In reply to Juan Quintela--- hw/arm_timer.c | 37 ++++++++++++++----------------------- 1 files changed, 14 insertions(+), 23 deletions(-)
hw/arm_timer.c +14 -23
@@ -140,28 +140,19 @@ static void arm_timer_tick(void *opaque)arm_timer_update (s); } -static void arm_timer_save (QEMUFile *f,void *opaque) -{ -arm_timer_state *s = (arm_timer_state *)opaque; -qemu_put_be32 (f, s->control); -qemu_put_be32 (f, s->limit); -qemu_put_be32 (f, s->int_level); -qemu_put_ptimer (f, s->timer); -} - -static int arm_timer_load (QEMUFile *f,void *opaque,int version_id) -{ -arm_timer_state *s = (arm_timer_state *)opaque; - -if (version_id !=1 ) -return -EINVAL ; - - s->control =qemu_get_be32 (f); - s->limit =qemu_get_be32 (f); - s->int_level =qemu_get_be32 (f); -qemu_get_ptimer (f, s->timer); -return 0 ; -} +static const VMStateDescription vmstate_arm_timer = { + .name ="arm_timer" , + .version_id =1 , + .minimum_version_id =1 , + .minimum_version_id_old =1 , + .fields = (VMStateField []) { +VMSTATE_UINT32 (control, arm_timer_state), +VMSTATE_UINT32 (limit, arm_timer_state), +VMSTATE_INT32 (int_level, arm_timer_state), +VMSTATE_PTIMER (timer, arm_timer_state), +VMSTATE_END_OF_LIST () + } +};static arm_timer_state *arm_timer_init (uint32_t freq) {
@@ -174,7 +165,7 @@ static arm_timer_state *arm_timer_init(uint32_t freq) bh =qemu_bh_new (arm_timer_tick, s); s->timer =ptimer_init (bh); -register_savevm (NULL ,"arm_timer" ,-1 ,1 , arm_timer_save, arm_timer_load, s); +vmstate_register (NULL ,-1 , &vmstate_arm_timer, s);return s; }
Signature · 1 line
1.7.4
PATCH 8/32 vmstate: port sysborg_timer
In reply to Juan Quintela--- hw/syborg_timer.c | 46 ++++++++++++++++------------------------------ 1 files changed, 16 insertions(+), 30 deletions(-)
hw/syborg_timer.c +16 -30
@@ -174,34 +174,21 @@ static CPUWriteMemoryFunc * const syborg_timer_writefn[] = { syborg_timer_write }; -static void syborg_timer_save (QEMUFile *f,void *opaque) -{ -SyborgTimerState *s = opaque; - -qemu_put_be32 (f, s->running); -qemu_put_be32 (f, s->oneshot); -qemu_put_be32 (f, s->limit); -qemu_put_be32 (f, s->int_level); -qemu_put_be32 (f, s->int_enabled); -qemu_put_ptimer (f, s->timer); -} - -static int syborg_timer_load (QEMUFile *f,void *opaque,int version_id) -{ -SyborgTimerState *s = opaque; - -if (version_id !=1 ) -return -EINVAL ; - - s->running =qemu_get_be32 (f); - s->oneshot =qemu_get_be32 (f); - s->limit =qemu_get_be32 (f); - s->int_level =qemu_get_be32 (f); - s->int_enabled =qemu_get_be32 (f); -qemu_get_ptimer (f, s->timer); - -return 0 ; -} +static const VMStateDescription vmstate_syborg_timer = { + .name ="syborg_timer" , + .version_id =1 , + .minimum_version_id =1 , + .minimum_version_id_old =1 , + .fields = (VMStateField []) { +VMSTATE_INT32 (running, SyborgTimerState), +VMSTATE_INT32 (oneshot, SyborgTimerState), +VMSTATE_UINT32 (limit, SyborgTimerState), +VMSTATE_UINT32 (int_level, SyborgTimerState), +VMSTATE_UINT32 (int_enabled, SyborgTimerState), +VMSTATE_PTIMER (timer, SyborgTimerState), +VMSTATE_END_OF_LIST () + } +};static int syborg_timer_init (SysBusDevice *dev) {
@@ -222,8 +209,7 @@ static int syborg_timer_init(SysBusDevice *dev) bh =qemu_bh_new (syborg_timer_tick, s); s->timer =ptimer_init (bh);ptimer_set_freq (s->timer, s->freq); -register_savevm (&dev->qdev,"syborg_timer" ,-1 ,1 , - syborg_timer_save, syborg_timer_load, s); +vmstate_register (&dev->qdev,-1 , &vmstate_syborg_timer, s);return 0 ; }
Signature · 1 line
1.7.4
PATCH 9/32 vmstate: port pmtimer
In reply to Juan QuintelaIt was a half conversion. Finish it.
enabled can only get values of 0, 1 or 2, was declared as an int but sent as an unint8_t, change its type.
--- hw/hw.h | 17 ++++++++++----- hw/ptimer.c | 59 +++++++++++++++------------------------------------------ qemu-timer.h | 2 - 3 files changed, 27 insertions(+), 51 deletions(-)
hw/hw.h +11 -6
@@ -630,6 +630,17 @@ extern const VMStateDescription vmstate_usb_device; .offset = vmstate_offset_macaddr(_state, _field), \ } +extern const VMStateDescription vmstate_ptimer; + +#define VMSTATE_PTIMER (_field, _state) { \ + .name = (stringify(_field)), \ + .version_id = (1), \ + .vmsd = &vmstate_ptimer, \ + .size = sizeof(ptimer_state *), \ + .flags = VMS_STRUCT|VMS_POINTER, \ + .offset = vmstate_offset_pointer(_state, _field, ptimer_state), \ +} +/* _f : field name _f_n : num of elements field_name _n : num of elements
@@ -722,12 +733,6 @@ extern const VMStateDescription vmstate_usb_device;#define VMSTATE_TIMER_ARRAY (_f, _s, _n) \ VMSTATE_ARRAY_OF_POINTER(_f, _s, _n, 0, vmstate_info_timer, QEMUTimer *) -#define VMSTATE_PTIMER_V (_f, _s, _v) \ - VMSTATE_POINTER(_f, _s, _v, vmstate_info_ptimer, ptimer_state *) - -#define VMSTATE_PTIMER (_f, _s) \ - VMSTATE_PTIMER_V(_f, _s, 0) -#define VMSTATE_BOOL_ARRAY_V (_f, _s, _n, _v) \ VMSTATE_ARRAY(_f, _s, _n, _v, vmstate_info_bool, bool)
hw/ptimer.c +16 -43
72 lines not on this page · raw message
qemu-timer.h +0 -2
@@ -118,8 +118,6 @@ uint64_t ptimer_get_count(ptimer_state *s);void ptimer_set_count (ptimer_state *s,uint64_t count);void ptimer_run (ptimer_state *s,int oneshot);void ptimer_stop (ptimer_state *s); -void qemu_put_ptimer (QEMUFile *f,ptimer_state *s); -void qemu_get_ptimer (QEMUFile *f,ptimer_state *s);/* icount */ int64_t qemu_icount_round (int64_t count);
Signature · 1 line
1.7.4
PATCH 10/32 vmstate: port syborg_rtc
In reply to Juan Quintela--- hw/syborg_rtc.c | 34 ++++++++++++---------------------- 1 files changed, 12 insertions(+), 22 deletions(-)
hw/syborg_rtc.c +12 -22
@@ -102,26 +102,17 @@ static CPUWriteMemoryFunc * const syborg_rtc_writefn[] = { syborg_rtc_write }; -static void syborg_rtc_save (QEMUFile *f,void *opaque) -{ -SyborgRTCState *s = opaque; - -qemu_put_be64 (f, s->offset); -qemu_put_be64 (f, s->data); -} - -static int syborg_rtc_load (QEMUFile *f,void *opaque,int version_id) -{ -SyborgRTCState *s = opaque; - -if (version_id !=1 ) -return -EINVAL ; - - s->offset =qemu_get_be64 (f); - s->data =qemu_get_be64 (f); - -return 0 ; -} +static const VMStateDescription vmstate_syborg_rtc = { + .name ="syborg_keyboard" , + .version_id =1 , + .minimum_version_id =1 , + .minimum_version_id_old =1 , + .fields = (VMStateField []) { +VMSTATE_INT64 (offset, SyborgRTCState), +VMSTATE_INT64 (data, SyborgRTCState), +VMSTATE_END_OF_LIST () + } +};static int syborg_rtc_init (SysBusDevice *dev) {
@@ -137,8 +128,7 @@ static int syborg_rtc_init(SysBusDevice *dev)qemu_get_timedate (&tm,0 ); s->offset = (uint64_t )mktime (&tm) *1000000000 ; -register_savevm (&dev->qdev,"syborg_rtc" ,-1 ,1 , - syborg_rtc_save, syborg_rtc_load, s); +vmstate_register (&dev->qdev,-1 , &vmstate_syborg_rtc, s);return 0 ; }
Signature · 1 line
1.7.4
PATCH 11/32 vmstate: port pxa2xx_keypad
In reply to Juan Quintela--- hw/pxa2xx_keypad.c | 53 ++++++++++++++++----------------------------------- 1 files changed, 17 insertions(+), 36 deletions(-)
hw/pxa2xx_keypad.c +17 -36
@@ -289,40 +289,22 @@ static CPUWriteMemoryFunc * const pxa2xx_keypad_writefn[] = { pxa2xx_keypad_write }; -static void pxa2xx_keypad_save (QEMUFile *f,void *opaque) -{ -PXA2xxKeyPadState *s = (PXA2xxKeyPadState *) opaque; - -qemu_put_be32s (f, &s->kpc); -qemu_put_be32s (f, &s->kpdk); -qemu_put_be32s (f, &s->kprec); -qemu_put_be32s (f, &s->kpmk); -qemu_put_be32s (f, &s->kpas); -qemu_put_be32s (f, &s->kpasmkp[0 ]); -qemu_put_be32s (f, &s->kpasmkp[1 ]); -qemu_put_be32s (f, &s->kpasmkp[2 ]); -qemu_put_be32s (f, &s->kpasmkp[3 ]); -qemu_put_be32s (f, &s->kpkdi); - -} - -static int pxa2xx_keypad_load (QEMUFile *f,void *opaque,int version_id) -{ -PXA2xxKeyPadState *s = (PXA2xxKeyPadState *) opaque; - -qemu_get_be32s (f, &s->kpc); -qemu_get_be32s (f, &s->kpdk); -qemu_get_be32s (f, &s->kprec); -qemu_get_be32s (f, &s->kpmk); -qemu_get_be32s (f, &s->kpas); -qemu_get_be32s (f, &s->kpasmkp[0 ]); -qemu_get_be32s (f, &s->kpasmkp[1 ]); -qemu_get_be32s (f, &s->kpasmkp[2 ]); -qemu_get_be32s (f, &s->kpasmkp[3 ]); -qemu_get_be32s (f, &s->kpkdi); - -return 0 ; -} +static const VMStateDescription vmstate_pxa2xx_keypad = { + .name ="pxa2xx_keypad" , + .version_id =0 , + .minimum_version_id =0 , + .minimum_version_id_old =0 , + .fields = (VMStateField []) { +VMSTATE_UINT32 (kpc, PXA2xxKeyPadState), +VMSTATE_UINT32 (kpdk, PXA2xxKeyPadState), +VMSTATE_UINT32 (kprec, PXA2xxKeyPadState), +VMSTATE_UINT32 (kpmk, PXA2xxKeyPadState), +VMSTATE_UINT32 (kpas, PXA2xxKeyPadState), +VMSTATE_UINT32_ARRAY (kpasmkp, PXA2xxKeyPadState,4 ), +VMSTATE_UINT32 (kpkdi, PXA2xxKeyPadState), +VMSTATE_END_OF_LIST () + } +};PXA2xxKeyPadState *pxa27x_keypad_init (target_phys_addr_t base,qemu_irq irq)
@@ -337,8 +319,7 @@ PXA2xxKeyPadState *pxa27x_keypad_init(target_phys_addr_t base, pxa2xx_keypad_writefn, s, DEVICE_NATIVE_ENDIAN);cpu_register_physical_memory (base,0x00100000 , iomemtype); -register_savevm (NULL ,"pxa2xx_keypad" ,0 ,0 , - pxa2xx_keypad_save, pxa2xx_keypad_load, s); +vmstate_register (NULL ,0 , &vmstate_pxa2xx_keypad, s);return s; }
Signature · 1 line
1.7.4
PATCH 12/32 vmstate: port pl011
In reply to Juan Quintela--- hw/pl011.c | 76 +++++++++++++++++++---------------------------------------- 1 files changed, 25 insertions(+), 51 deletions(-)
hw/pl011.c +25 -51
@@ -235,56 +235,30 @@ static CPUWriteMemoryFunc * const pl011_writefn[] = {pl011_write }; -static void pl011_save (QEMUFile *f,void *opaque) -{ -pl011_state *s = (pl011_state *)opaque; -int i; - -qemu_put_be32 (f, s->readbuff); -qemu_put_be32 (f, s->flags); -qemu_put_be32 (f, s->lcr); -qemu_put_be32 (f, s->cr); -qemu_put_be32 (f, s->dmacr); -qemu_put_be32 (f, s->int_enabled); -qemu_put_be32 (f, s->int_level); -for (i =0 ; i <16 ; i++) -qemu_put_be32 (f, s->read_fifo[i]); -qemu_put_be32 (f, s->ilpr); -qemu_put_be32 (f, s->ibrd); -qemu_put_be32 (f, s->fbrd); -qemu_put_be32 (f, s->ifl); -qemu_put_be32 (f, s->read_pos); -qemu_put_be32 (f, s->read_count); -qemu_put_be32 (f, s->read_trigger); -} - -static int pl011_load (QEMUFile *f,void *opaque,int version_id) -{ -pl011_state *s = (pl011_state *)opaque; -int i; - -if (version_id !=1 ) -return -EINVAL ; - - s->readbuff =qemu_get_be32 (f); - s->flags =qemu_get_be32 (f); - s->lcr =qemu_get_be32 (f); - s->cr =qemu_get_be32 (f); - s->dmacr =qemu_get_be32 (f); - s->int_enabled =qemu_get_be32 (f); - s->int_level =qemu_get_be32 (f); -for (i =0 ; i <16 ; i++) - s->read_fifo[i] =qemu_get_be32 (f); - s->ilpr =qemu_get_be32 (f); - s->ibrd =qemu_get_be32 (f); - s->fbrd =qemu_get_be32 (f); - s->ifl =qemu_get_be32 (f); - s->read_pos =qemu_get_be32 (f); - s->read_count =qemu_get_be32 (f); - s->read_trigger =qemu_get_be32 (f); - -return 0 ; -} +static const VMStateDescription vmstate_pl011 = { + .name ="pl011" , + .version_id =1 , + .minimum_version_id =1 , + .minimum_version_id_old =1 , + .fields = (VMStateField []) { +VMSTATE_UINT32 (readbuff, pl011_state), +VMSTATE_UINT32 (flags, pl011_state), +VMSTATE_UINT32 (lcr, pl011_state), +VMSTATE_UINT32 (cr, pl011_state), +VMSTATE_UINT32 (dmacr, pl011_state), +VMSTATE_UINT32 (int_enabled, pl011_state), +VMSTATE_UINT32 (int_level, pl011_state), +VMSTATE_UINT32_ARRAY (read_fifo, pl011_state,16 ), +VMSTATE_UINT32 (ilpr, pl011_state), +VMSTATE_UINT32 (ibrd, pl011_state), +VMSTATE_UINT32 (fbrd, pl011_state), +VMSTATE_UINT32 (ifl, pl011_state), +VMSTATE_INT32 (read_pos, pl011_state), +VMSTATE_INT32 (read_count, pl011_state), +VMSTATE_INT32 (read_trigger, pl011_state), +VMSTATE_END_OF_LIST () + } +};static int pl011_init (SysBusDevice *dev,const unsigned char *id) {
@@ -307,7 +281,7 @@ static int pl011_init(SysBusDevice *dev, const unsigned char *id)qemu_chr_add_handlers (s->chr, pl011_can_receive, pl011_receive, pl011_event, s); } -register_savevm (&dev->qdev,"pl011_uart" ,-1 ,1 , pl011_save, pl011_load, s); +vmstate_register (&dev->qdev,-1 , &vmstate_pl011, s);return 0 ; }
Signature · 1 line
1.7.4
PATCH 13/32 vmstate: port armv7m nvic
In reply to Juan Quintela--- hw/armv7m_nvic.c | 39 ++++++++++++++------------------------- 1 files changed, 14 insertions(+), 25 deletions(-)
hw/armv7m_nvic.c +14 -25
@@ -365,30 +365,19 @@ static void nvic_writel(void *opaque, uint32_t offset, uint32_t value) } } -static void nvic_save (QEMUFile *f,void *opaque) -{ -nvic_state *s = (nvic_state *)opaque; - -qemu_put_be32 (f, s->systick.control); -qemu_put_be32 (f, s->systick.reload); -qemu_put_be64 (f, s->systick.tick); -qemu_put_timer (f, s->systick.timer); -} - -static int nvic_load (QEMUFile *f,void *opaque,int version_id) -{ -nvic_state *s = (nvic_state *)opaque; - -if (version_id !=1 ) -return -EINVAL ; - - s->systick.control =qemu_get_be32 (f); - s->systick.reload =qemu_get_be32 (f); - s->systick.tick =qemu_get_be64 (f); -qemu_get_timer (f, s->systick.timer); - -return 0 ; -} +static const VMStateDescription vmstate_nvic = { + .name ="armv7m_nvic" , + .version_id =1 , + .minimum_version_id =1 , + .minimum_version_id_old =1 , + .fields = (VMStateField []) { +VMSTATE_UINT32 (systick.control, nvic_state), +VMSTATE_UINT32 (systick.reload, nvic_state), +VMSTATE_INT64 (systick.tick, nvic_state), +VMSTATE_TIMER (systick.timer, nvic_state), +VMSTATE_END_OF_LIST () + } +};static int armv7m_nvic_init (SysBusDevice *dev) {
@@ -397,7 +386,7 @@ static int armv7m_nvic_init(SysBusDevice *dev)gic_init (&s->gic);cpu_register_physical_memory (0xe000e000 ,0x1000 , s->gic.iomemtype); s->systick.timer =qemu_new_timer (vm_clock, systick_timer_tick, s); -register_savevm (&dev->qdev,"armv7m_nvic" ,-1 ,1 , nvic_save, nvic_load, s); +vmstate_register (&dev->qdev,-1 , &vmstate_nvic, s);return 0 ; }
Signature · 1 line
1.7.4
PATCH 14/32 vmstate: port stellaris i2c
In reply to Juan Quintela--- hw/stellaris.c | 49 +++++++++++++++++-------------------------------- 1 files changed, 17 insertions(+), 32 deletions(-)
hw/stellaris.c +17 -32
@@ -844,36 +844,22 @@ static CPUWriteMemoryFunc * const stellaris_i2c_writefn[] = { stellaris_i2c_write }; -static void stellaris_i2c_save (QEMUFile *f,void *opaque) -{ -stellaris_i2c_state *s = (stellaris_i2c_state *)opaque; - -qemu_put_be32 (f, s->msa); -qemu_put_be32 (f, s->mcs); -qemu_put_be32 (f, s->mdr); -qemu_put_be32 (f, s->mtpr); -qemu_put_be32 (f, s->mimr); -qemu_put_be32 (f, s->mris); -qemu_put_be32 (f, s->mcr); -} - -static int stellaris_i2c_load (QEMUFile *f,void *opaque,int version_id) -{ -stellaris_i2c_state *s = (stellaris_i2c_state *)opaque; - -if (version_id !=1 ) -return -EINVAL ; - - s->msa =qemu_get_be32 (f); - s->mcs =qemu_get_be32 (f); - s->mdr =qemu_get_be32 (f); - s->mtpr =qemu_get_be32 (f); - s->mimr =qemu_get_be32 (f); - s->mris =qemu_get_be32 (f); - s->mcr =qemu_get_be32 (f); - -return 0 ; -} +static const VMStateDescription vmstate_stellaris_i2c = { + .name ="stellaris_i2c" , + .version_id =1 , + .minimum_version_id =1 , + .minimum_version_id_old =1 , + .fields = (VMStateField []) { +VMSTATE_UINT32 (msa, stellaris_i2c_state), +VMSTATE_UINT32 (mcs, stellaris_i2c_state), +VMSTATE_UINT32 (mdr, stellaris_i2c_state), +VMSTATE_UINT32 (mtpr, stellaris_i2c_state), +VMSTATE_UINT32 (mimr, stellaris_i2c_state), +VMSTATE_UINT32 (mris, stellaris_i2c_state), +VMSTATE_UINT32 (mcr, stellaris_i2c_state), +VMSTATE_END_OF_LIST () + } +};static int stellaris_i2c_init (SysBusDevice * dev) {
@@ -891,8 +877,7 @@ static int stellaris_i2c_init(SysBusDevice * dev)sysbus_init_mmio (dev,0x1000 , iomemtype);/* ??? For now we only implement the master interface. */ stellaris_i2c_reset (s); -register_savevm (&dev->qdev,"stellaris_i2c" ,-1 ,1 , - stellaris_i2c_save, stellaris_i2c_load, s); +vmstate_register (&dev->qdev,-1 , &vmstate_stellaris_i2c, s);return 0 ; }
Signature · 1 line
1.7.4
PATCH 15/32 vmstate: port stellaris ssi bus
In reply to Juan Quintela--- hw/stellaris.c | 31 +++++++++++-------------------- 1 files changed, 11 insertions(+), 20 deletions(-)
hw/stellaris.c +11 -20
@@ -1219,24 +1219,16 @@ static uint32_t stellaris_ssi_bus_transfer(SSISlave *dev, uint32_t val)return ssi_transfer (s->bus[s->current_dev], val); } -static void stellaris_ssi_bus_save (QEMUFile *f,void *opaque) -{ -stellaris_ssi_bus_state *s = (stellaris_ssi_bus_state *)opaque; - -qemu_put_be32 (f, s->current_dev); -} - -static int stellaris_ssi_bus_load (QEMUFile *f,void *opaque,int version_id) -{ -stellaris_ssi_bus_state *s = (stellaris_ssi_bus_state *)opaque; - -if (version_id !=1 ) -return -EINVAL ; - - s->current_dev =qemu_get_be32 (f); - -return 0 ; -} +static const VMStateDescription vmstate_stellaris_ssi_bus = { + .name ="stellaris_ssi_bus" , + .version_id =1 , + .minimum_version_id =1 , + .minimum_version_id_old =1 , + .fields = (VMStateField []) { +VMSTATE_INT32 (current_dev, stellaris_ssi_bus_state), +VMSTATE_END_OF_LIST () + } +};static int stellaris_ssi_bus_init (SSISlave *dev) {
@@ -1246,8 +1238,7 @@ static int stellaris_ssi_bus_init(SSISlave *dev) s->bus[1 ] =ssi_create_bus (&dev->qdev,"ssi1" );qdev_init_gpio_in (&dev->qdev, stellaris_ssi_bus_select,1 ); -register_savevm (&dev->qdev,"stellaris_ssi_bus" ,-1 ,1 , - stellaris_ssi_bus_save, stellaris_ssi_bus_load, s); +vmstate_register (&dev->qdev,-1 , &vmstate_stellaris_ssi_bus, s);return 0 ; }
Signature · 1 line
1.7.4
PATCH 16/32 vmstate: port stellaris sys
In reply to Juan Quintela--- hw/stellaris.c | 71 +++++++++++++++++++------------------------------------ 1 files changed, 25 insertions(+), 46 deletions(-)
hw/stellaris.c +25 -46
@@ -605,58 +605,37 @@ static void ssys_reset(void *opaque) s->dcgc[0 ] =1 ; } -static void ssys_save (QEMUFile *f,void *opaque) +static int stellaris_sys_post_load (void *opaque,int version_id) { -ssys_state *s = (ssys_state *)opaque; - -qemu_put_be32 (f, s->pborctl); -qemu_put_be32 (f, s->ldopctl); -qemu_put_be32 (f, s->int_mask); -qemu_put_be32 (f, s->int_status); -qemu_put_be32 (f, s->resc); -qemu_put_be32 (f, s->rcc); -qemu_put_be32 (f, s->rcgc[0 ]); -qemu_put_be32 (f, s->rcgc[1 ]); -qemu_put_be32 (f, s->rcgc[2 ]); -qemu_put_be32 (f, s->scgc[0 ]); -qemu_put_be32 (f, s->scgc[1 ]); -qemu_put_be32 (f, s->scgc[2 ]); -qemu_put_be32 (f, s->dcgc[0 ]); -qemu_put_be32 (f, s->dcgc[1 ]); -qemu_put_be32 (f, s->dcgc[2 ]); -qemu_put_be32 (f, s->clkvclr); -qemu_put_be32 (f, s->ldoarst); -} - -static int ssys_load (QEMUFile *f,void *opaque,int version_id) -{ -ssys_state *s = (ssys_state *)opaque; - -if (version_id !=1 ) -return -EINVAL ; +ssys_state *s = opaque; - s->pborctl =qemu_get_be32 (f); - s->ldopctl =qemu_get_be32 (f); - s->int_mask =qemu_get_be32 (f); - s->int_status =qemu_get_be32 (f); - s->resc =qemu_get_be32 (f); - s->rcc =qemu_get_be32 (f); - s->rcgc[0 ] =qemu_get_be32 (f); - s->rcgc[1 ] =qemu_get_be32 (f); - s->rcgc[2 ] =qemu_get_be32 (f); - s->scgc[0 ] =qemu_get_be32 (f); - s->scgc[1 ] =qemu_get_be32 (f); - s->scgc[2 ] =qemu_get_be32 (f); - s->dcgc[0 ] =qemu_get_be32 (f); - s->dcgc[1 ] =qemu_get_be32 (f); - s->dcgc[2 ] =qemu_get_be32 (f); - s->clkvclr =qemu_get_be32 (f); - s->ldoarst =qemu_get_be32 (f);ssys_calculate_system_clock (s);return 0 ; } +static const VMStateDescription vmstate_stellaris_sys = { + .name ="stellaris_sys" , + .version_id =1 , + .minimum_version_id =1 , + .minimum_version_id_old =1 , + .post_load = stellaris_sys_post_load, + .fields = (VMStateField []) { +VMSTATE_UINT32 (pborctl, ssys_state), +VMSTATE_UINT32 (ldopctl, ssys_state), +VMSTATE_UINT32 (int_mask, ssys_state), +VMSTATE_UINT32 (int_status, ssys_state), +VMSTATE_UINT32 (resc, ssys_state), +VMSTATE_UINT32 (rcc, ssys_state), +VMSTATE_UINT32_ARRAY (rcgc, ssys_state,3 ), +VMSTATE_UINT32_ARRAY (scgc, ssys_state,3 ), +VMSTATE_UINT32_ARRAY (dcgc, ssys_state,3 ), +VMSTATE_UINT32 (clkvclr, ssys_state), +VMSTATE_UINT32 (ldoarst, ssys_state), +VMSTATE_END_OF_LIST () + } +}; +static int stellaris_sys_init (uint32_t base,qemu_irq irq,stellaris_board_info * board,uint8_t *macaddr)
@@ -676,7 +655,7 @@ static int stellaris_sys_init(uint32_t base, qemu_irq irq, DEVICE_NATIVE_ENDIAN);cpu_register_physical_memory (base,0x00001000 , iomemtype);ssys_reset (s); -register_savevm (NULL ,"stellaris_sys" ,-1 ,1 , ssys_save, ssys_load, s); +vmstate_register (NULL ,-1 , &vmstate_stellaris_sys, s);return 0 ; }
Signature · 1 line
1.7.4
PATCH 17/32 vmstate: port pl022 ssp
In reply to Juan Quintela--- hw/pl022.c | 84 +++++++++++++++++++++++++---------------------------------- 1 files changed, 36 insertions(+), 48 deletions(-)
hw/pl022.c +36 -48
@@ -239,54 +239,42 @@ static CPUWriteMemoryFunc * const pl022_writefn[] = {pl022_write }; -static void pl022_save (QEMUFile *f,void *opaque) -{ -pl022_state *s = (pl022_state *)opaque; -int i; - -qemu_put_be32 (f, s->cr0); -qemu_put_be32 (f, s->cr1); -qemu_put_be32 (f, s->bitmask); -qemu_put_be32 (f, s->sr); -qemu_put_be32 (f, s->cpsr); -qemu_put_be32 (f, s->is); -qemu_put_be32 (f, s->im); -qemu_put_be32 (f, s->tx_fifo_head); -qemu_put_be32 (f, s->rx_fifo_head); -qemu_put_be32 (f, s->tx_fifo_len); -qemu_put_be32 (f, s->rx_fifo_len); -for (i =0 ; i <8 ; i++) { -qemu_put_be16 (f, s->tx_fifo[i]); -qemu_put_be16 (f, s->rx_fifo[i]); - } -} - -static int pl022_load (QEMUFile *f,void *opaque,int version_id) -{ -pl022_state *s = (pl022_state *)opaque; -int i; - -if (version_id !=1 ) -return -EINVAL ; - - s->cr0 =qemu_get_be32 (f); - s->cr1 =qemu_get_be32 (f); - s->bitmask =qemu_get_be32 (f); - s->sr =qemu_get_be32 (f); - s->cpsr =qemu_get_be32 (f); - s->is =qemu_get_be32 (f); - s->im =qemu_get_be32 (f); - s->tx_fifo_head =qemu_get_be32 (f); - s->rx_fifo_head =qemu_get_be32 (f); - s->tx_fifo_len =qemu_get_be32 (f); - s->rx_fifo_len =qemu_get_be32 (f); -for (i =0 ; i <8 ; i++) { - s->tx_fifo[i] =qemu_get_be16 (f); - s->rx_fifo[i] =qemu_get_be16 (f); +static const VMStateDescription vmstate_pl022 = { + .name ="pl022_ssp" , + .version_id =1 , + .minimum_version_id =1 , + .minimum_version_id_old =1 , + .fields = (VMStateField []) { +VMSTATE_UINT32 (cr0, pl022_state), +VMSTATE_UINT32 (cr1, pl022_state), +VMSTATE_UINT32 (bitmask, pl022_state), +VMSTATE_UINT32 (sr, pl022_state), +VMSTATE_UINT32 (cpsr, pl022_state), +VMSTATE_UINT32 (is, pl022_state), +VMSTATE_UINT32 (im, pl022_state), +VMSTATE_INT32 (tx_fifo_head, pl022_state), +VMSTATE_INT32 (rx_fifo_head, pl022_state), +VMSTATE_INT32 (tx_fifo_len, pl022_state), +VMSTATE_INT32 (rx_fifo_len, pl022_state), +VMSTATE_UINT16 (tx_fifo[0 ], pl022_state), +VMSTATE_UINT16 (rx_fifo[0 ], pl022_state), +VMSTATE_UINT16 (tx_fifo[1 ], pl022_state), +VMSTATE_UINT16 (rx_fifo[1 ], pl022_state), +VMSTATE_UINT16 (tx_fifo[2 ], pl022_state), +VMSTATE_UINT16 (rx_fifo[2 ], pl022_state), +VMSTATE_UINT16 (tx_fifo[3 ], pl022_state), +VMSTATE_UINT16 (rx_fifo[3 ], pl022_state), +VMSTATE_UINT16 (tx_fifo[4 ], pl022_state), +VMSTATE_UINT16 (rx_fifo[4 ], pl022_state), +VMSTATE_UINT16 (tx_fifo[5 ], pl022_state), +VMSTATE_UINT16 (rx_fifo[5 ], pl022_state), +VMSTATE_UINT16 (tx_fifo[6 ], pl022_state), +VMSTATE_UINT16 (rx_fifo[6 ], pl022_state), +VMSTATE_UINT16 (tx_fifo[7 ], pl022_state), +VMSTATE_UINT16 (rx_fifo[7 ], pl022_state), +VMSTATE_END_OF_LIST () } - -return 0 ; -} +};static int pl022_init (SysBusDevice *dev) {
@@ -300,7 +288,7 @@ static int pl022_init(SysBusDevice *dev)sysbus_init_irq (dev, &s->irq); s->ssi =ssi_create_bus (&dev->qdev,"ssi" );pl022_reset (s); -register_savevm (&dev->qdev,"pl022_ssp" ,-1 ,1 , pl022_save, pl022_load, s); +vmstate_register (&dev->qdev,-1 , &vmstate_pl022, s);return 0 ; }
Signature · 1 line
1.7.4
PATCH 18/32 vmstate: port heathrow_pic
In reply to Juan Quintela--- hw/heathrow_pic.c | 62 +++++++++++++++++++++------------------------------- 1 files changed, 25 insertions(+), 37 deletions(-)
hw/heathrow_pic.c +25 -37
@@ -159,42 +159,31 @@ static void heathrow_pic_set_irq(void *opaque, int num, int level)heathrow_pic_update (s); } -static void heathrow_pic_save_one (QEMUFile *f,HeathrowPIC *s) -{ -qemu_put_be32s (f, &s->events); -qemu_put_be32s (f, &s->mask); -qemu_put_be32s (f, &s->levels); -qemu_put_be32s (f, &s->level_triggered); -} - -static void heathrow_pic_save (QEMUFile *f,void *opaque) -{ -HeathrowPICS *s = (HeathrowPICS *)opaque; - -heathrow_pic_save_one (f, &s->pics[0 ]); -heathrow_pic_save_one (f, &s->pics[1 ]); -} - -static void heathrow_pic_load_one (QEMUFile *f,HeathrowPIC *s) -{ -qemu_get_be32s (f, &s->events); -qemu_get_be32s (f, &s->mask); -qemu_get_be32s (f, &s->levels); -qemu_get_be32s (f, &s->level_triggered); -} - -static int heathrow_pic_load (QEMUFile *f,void *opaque,int version_id) -{ -HeathrowPICS *s = (HeathrowPICS *)opaque; - -if (version_id !=1 ) -return -EINVAL ; - -heathrow_pic_load_one (f, &s->pics[0 ]); -heathrow_pic_load_one (f, &s->pics[1 ]); +static const VMStateDescription vmstate_heathrow_pic_one = { + .name ="heathrow_pic_one" , + .version_id =0 , + .minimum_version_id =0 , + .minimum_version_id_old =0 , + .fields = (VMStateField []) { +VMSTATE_UINT32 (events, HeathrowPIC), +VMSTATE_UINT32 (mask, HeathrowPIC), +VMSTATE_UINT32 (levels, HeathrowPIC), +VMSTATE_UINT32 (level_triggered, HeathrowPIC), +VMSTATE_END_OF_LIST () + } +}; -return 0 ; -} +static const VMStateDescription vmstate_heathrow_pic = { + .name ="heathrow_pic" , + .version_id =1 , + .minimum_version_id =1 , + .minimum_version_id_old =1 , + .fields = (VMStateField []) { +VMSTATE_STRUCT_ARRAY (pics, HeathrowPICS,2 ,1 , + vmstate_heathrow_pic_one, HeathrowPIC), +VMSTATE_END_OF_LIST () + } +};static void heathrow_pic_reset_one (HeathrowPIC *s) {
@@ -223,8 +212,7 @@ qemu_irq *heathrow_pic_init(int *pmem_index, *pmem_index =cpu_register_io_memory (pic_read, pic_write, s,DEVICE_LITTLE_ENDIAN ); -register_savevm (NULL ,"heathrow_pic" ,-1 ,1 , heathrow_pic_save, - heathrow_pic_load, s); +vmstate_register (NULL ,-1 , &vmstate_heathrow_pic, s);qemu_register_reset (heathrow_pic_reset, s);return qemu_allocate_irqs (heathrow_pic_set_irq, s,64 ); }
Signature · 1 line
1.7.4
PATCH 19/32 vmstate: port cuda
In reply to Juan Quintela--- hw/cuda.c | 116 ++++++++++++++++++++++++------------------------------------- 1 files changed, 46 insertions(+), 70 deletions(-)
hw/cuda.c +46 -70
@@ -644,80 +644,56 @@ static CPUReadMemoryFunc * const cuda_read[] = { &cuda_readl, }; -static void cuda_save_timer (QEMUFile *f,CUDATimer *s) +static bool cuda_timer_exist (void *opaque,int version_id) { -qemu_put_be16s (f, &s->latch); -qemu_put_be16s (f, &s->counter_value); -qemu_put_sbe64s (f, &s->load_time); -qemu_put_sbe64s (f, &s->next_irq_time); -if (s->timer) -qemu_put_timer (f, s->timer); -} - -static void cuda_save (QEMUFile *f,void *opaque) -{ -CUDAState *s = (CUDAState *)opaque; - -qemu_put_ubyte (f, s->b); -qemu_put_ubyte (f, s->a); -qemu_put_ubyte (f, s->dirb); -qemu_put_ubyte (f, s->dira); -qemu_put_ubyte (f, s->sr); -qemu_put_ubyte (f, s->acr); -qemu_put_ubyte (f, s->pcr); -qemu_put_ubyte (f, s->ifr); -qemu_put_ubyte (f, s->ier); -qemu_put_ubyte (f, s->anh); -qemu_put_sbe32s (f, &s->data_in_size); -qemu_put_sbe32s (f, &s->data_in_index); -qemu_put_sbe32s (f, &s->data_out_index); -qemu_put_ubyte (f, s->autopoll); -qemu_put_buffer (f, s->data_in,sizeof (s->data_in)); -qemu_put_buffer (f, s->data_out,sizeof (s->data_out)); -qemu_put_be32s (f, &s->tick_offset); -cuda_save_timer (f, &s->timers[0 ]); -cuda_save_timer (f, &s->timers[1 ]); -} +CUDATimer *s = opaque; -static void cuda_load_timer (QEMUFile *f,CUDATimer *s) -{ -qemu_get_be16s (f, &s->latch); -qemu_get_be16s (f, &s->counter_value); -qemu_get_sbe64s (f, &s->load_time); -qemu_get_sbe64s (f, &s->next_irq_time); -if (s->timer) -qemu_get_timer (f, s->timer); +return s->timer !=NULL ; } -static int cuda_load (QEMUFile *f,void *opaque,int version_id) -{ -CUDAState *s = (CUDAState *)opaque; - -if (version_id !=1 ) -return -EINVAL ; - - s->b =qemu_get_ubyte (f); - s->a =qemu_get_ubyte (f); - s->dirb =qemu_get_ubyte (f); - s->dira =qemu_get_ubyte (f); - s->sr =qemu_get_ubyte (f); - s->acr =qemu_get_ubyte (f); - s->pcr =qemu_get_ubyte (f); - s->ifr =qemu_get_ubyte (f); - s->ier =qemu_get_ubyte (f); - s->anh =qemu_get_ubyte (f); -qemu_get_sbe32s (f, &s->data_in_size); -qemu_get_sbe32s (f, &s->data_in_index); -qemu_get_sbe32s (f, &s->data_out_index); - s->autopoll =qemu_get_ubyte (f); -qemu_get_buffer (f, s->data_in,sizeof (s->data_in)); -qemu_get_buffer (f, s->data_out,sizeof (s->data_out)); -qemu_get_be32s (f, &s->tick_offset); -cuda_load_timer (f, &s->timers[0 ]); -cuda_load_timer (f, &s->timers[1 ]); +static const VMStateDescription vmstate_cuda_timer = { + .name ="cuda_timer" , + .version_id =0 , + .minimum_version_id =0 , + .minimum_version_id_old =0 , + .fields = (VMStateField []) { +VMSTATE_UINT16 (latch, CUDATimer), +VMSTATE_UINT16 (counter_value, CUDATimer), +VMSTATE_INT64 (load_time, CUDATimer), +VMSTATE_INT64 (next_irq_time, CUDATimer), +VMSTATE_TIMER_TEST (timer, CUDATimer, cuda_timer_exist), +VMSTATE_END_OF_LIST () + } +}; -return 0 ; -} +static const VMStateDescription vmstate_cuda = { + .name ="cuda" , + .version_id =1 , + .minimum_version_id =1 , + .minimum_version_id_old =1 , + .fields = (VMStateField []) { +VMSTATE_UINT8 (a, CUDAState), +VMSTATE_UINT8 (b, CUDAState), +VMSTATE_UINT8 (dira, CUDAState), +VMSTATE_UINT8 (dirb, CUDAState), +VMSTATE_UINT8 (sr, CUDAState), +VMSTATE_UINT8 (acr, CUDAState), +VMSTATE_UINT8 (pcr, CUDAState), +VMSTATE_UINT8 (ifr, CUDAState), +VMSTATE_UINT8 (ier, CUDAState), +VMSTATE_UINT8 (anh, CUDAState), +VMSTATE_INT32 (data_in_size, CUDAState), +VMSTATE_INT32 (data_in_index, CUDAState), +VMSTATE_INT32 (data_out_index, CUDAState), +VMSTATE_UINT8 (autopoll, CUDAState), +VMSTATE_BUFFER (data_in, CUDAState), +VMSTATE_BUFFER (data_out, CUDAState), +VMSTATE_UINT32 (tick_offset, CUDAState), +VMSTATE_STRUCT_ARRAY (timers, CUDAState,2 ,1 , + vmstate_cuda_timer, CUDATimer), +VMSTATE_END_OF_LIST () + } +};static void cuda_reset (void *opaque) {
@@ -764,6 +740,6 @@ void cuda_init (int *cuda_mem_index, qemu_irq irq) s->adb_poll_timer =qemu_new_timer (vm_clock, cuda_adb_poll, s); *cuda_mem_index =cpu_register_io_memory (cuda_read, cuda_write, s,DEVICE_NATIVE_ENDIAN ); -register_savevm (NULL ,"cuda" ,-1 ,1 , cuda_save, cuda_load, s); +vmstate_register (NULL ,-1 , &vmstate_cuda, s);qemu_register_reset (cuda_reset, s); }
Signature · 1 line
1.7.4
PATCH 20/32 vmstate: port stellaris gptm
In reply to Juan Quintela--- hw/stellaris.c | 84 ++++++++++++++++---------------------------------------- 1 files changed, 24 insertions(+), 60 deletions(-)
hw/stellaris.c +24 -60
@@ -280,64 +280,29 @@ static CPUWriteMemoryFunc * const gptm_writefn[] = {gptm_write }; -static void gptm_save (QEMUFile *f,void *opaque) -{ -gptm_state *s = (gptm_state *)opaque; - -qemu_put_be32 (f, s->config); -qemu_put_be32 (f, s->mode[0 ]); -qemu_put_be32 (f, s->mode[1 ]); -qemu_put_be32 (f, s->control); -qemu_put_be32 (f, s->state); -qemu_put_be32 (f, s->mask); -qemu_put_be32 (f, s->mode[0 ]); -qemu_put_be32 (f, s->mode[0 ]); -qemu_put_be32 (f, s->load[0 ]); -qemu_put_be32 (f, s->load[1 ]); -qemu_put_be32 (f, s->match[0 ]); -qemu_put_be32 (f, s->match[1 ]); -qemu_put_be32 (f, s->prescale[0 ]); -qemu_put_be32 (f, s->prescale[1 ]); -qemu_put_be32 (f, s->match_prescale[0 ]); -qemu_put_be32 (f, s->match_prescale[1 ]); -qemu_put_be32 (f, s->rtc); -qemu_put_be64 (f, s->tick[0 ]); -qemu_put_be64 (f, s->tick[1 ]); -qemu_put_timer (f, s->timer[0 ]); -qemu_put_timer (f, s->timer[1 ]); -} - -static int gptm_load (QEMUFile *f,void *opaque,int version_id) -{ -gptm_state *s = (gptm_state *)opaque; - -if (version_id !=1 ) -return -EINVAL ; - - s->config =qemu_get_be32 (f); - s->mode[0 ] =qemu_get_be32 (f); - s->mode[1 ] =qemu_get_be32 (f); - s->control =qemu_get_be32 (f); - s->state =qemu_get_be32 (f); - s->mask =qemu_get_be32 (f); - s->mode[0 ] =qemu_get_be32 (f); - s->mode[0 ] =qemu_get_be32 (f); - s->load[0 ] =qemu_get_be32 (f); - s->load[1 ] =qemu_get_be32 (f); - s->match[0 ] =qemu_get_be32 (f); - s->match[1 ] =qemu_get_be32 (f); - s->prescale[0 ] =qemu_get_be32 (f); - s->prescale[1 ] =qemu_get_be32 (f); - s->match_prescale[0 ] =qemu_get_be32 (f); - s->match_prescale[1 ] =qemu_get_be32 (f); - s->rtc =qemu_get_be32 (f); - s->tick[0 ] =qemu_get_be64 (f); - s->tick[1 ] =qemu_get_be64 (f); -qemu_get_timer (f, s->timer[0 ]); -qemu_get_timer (f, s->timer[1 ]); - -return 0 ; -} +static const VMStateDescription vmstate_stellaris_gptm = { + .name ="stellaris_gptm" , + .version_id =1 , + .minimum_version_id =1 , + .minimum_version_id_old =1 , + .fields = (VMStateField []) { +VMSTATE_UINT32 (config, gptm_state), +VMSTATE_UINT32_ARRAY (mode, gptm_state,2 ), +VMSTATE_UINT32 (control, gptm_state), +VMSTATE_UINT32 (state, gptm_state), +VMSTATE_UINT32 (mask, gptm_state), +VMSTATE_UINT32 (mode[0 ], gptm_state), +VMSTATE_UINT32 (mode[0 ], gptm_state), +VMSTATE_UINT32_ARRAY (load, gptm_state,2 ), +VMSTATE_UINT32_ARRAY (match, gptm_state,2 ), +VMSTATE_UINT32_ARRAY (prescale, gptm_state,2 ), +VMSTATE_UINT32_ARRAY (match_prescale, gptm_state,2 ), +VMSTATE_UINT32 (rtc, gptm_state), +VMSTATE_INT64_ARRAY (tick, gptm_state,2 ), +VMSTATE_TIMER_ARRAY (timer, gptm_state,2 ), +VMSTATE_END_OF_LIST () + } +};static int stellaris_gptm_init (SysBusDevice *dev) {
@@ -355,8 +320,7 @@ static int stellaris_gptm_init(SysBusDevice *dev) s->opaque[0 ] = s->opaque[1 ] = s; s->timer[0 ] =qemu_new_timer (vm_clock, gptm_tick, &s->opaque[0 ]); s->timer[1 ] =qemu_new_timer (vm_clock, gptm_tick, &s->opaque[1 ]); -register_savevm (&dev->qdev,"stellaris_gptm" ,-1 ,1 , - gptm_save, gptm_load, s); +vmstate_register (&dev->qdev,-1 , &vmstate_stellaris_gptm, s);return 0 ; }
Signature · 1 line
1.7.4
PATCH 21/32 vmstate: port pxa2xx_i2s
In reply to Juan Quintela--- hw/pxa2xx.c | 53 ++++++++++++++++++----------------------------------- 1 files changed, 18 insertions(+), 35 deletions(-)
hw/pxa2xx.c +18 -35
@@ -1748,39 +1748,23 @@ static CPUWriteMemoryFunc * const pxa2xx_i2s_writefn[] = { pxa2xx_i2s_write, }; -static void pxa2xx_i2s_save (QEMUFile *f,void *opaque) -{ -PXA2xxI2SState *s = (PXA2xxI2SState *) opaque; - -qemu_put_be32s (f, &s->control[0 ]); -qemu_put_be32s (f, &s->control[1 ]); -qemu_put_be32s (f, &s->status); -qemu_put_be32s (f, &s->mask); -qemu_put_be32s (f, &s->clk); - -qemu_put_be32 (f, s->enable); -qemu_put_be32 (f, s->rx_len); -qemu_put_be32 (f, s->tx_len); -qemu_put_be32 (f, s->fifo_len); -} - -static int pxa2xx_i2s_load (QEMUFile *f,void *opaque,int version_id) -{ -PXA2xxI2SState *s = (PXA2xxI2SState *) opaque; - -qemu_get_be32s (f, &s->control[0 ]); -qemu_get_be32s (f, &s->control[1 ]); -qemu_get_be32s (f, &s->status); -qemu_get_be32s (f, &s->mask); -qemu_get_be32s (f, &s->clk); - - s->enable =qemu_get_be32 (f); - s->rx_len =qemu_get_be32 (f); - s->tx_len =qemu_get_be32 (f); - s->fifo_len =qemu_get_be32 (f); - -return 0 ; -} +static const VMStateDescription vmstate_pxa2xx_i2s = { + .name ="pxa2xx_i2s" , + .version_id =0 , + .minimum_version_id =0 , + .minimum_version_id_old =0 , + .fields = (VMStateField []) { +VMSTATE_UINT32_ARRAY (control, PXA2xxI2SState,2 ), +VMSTATE_UINT32 (status, PXA2xxI2SState), +VMSTATE_UINT32 (mask, PXA2xxI2SState), +VMSTATE_UINT32 (clk, PXA2xxI2SState), +VMSTATE_INT32 (enable, PXA2xxI2SState), +VMSTATE_INT32 (rx_len, PXA2xxI2SState), +VMSTATE_INT32 (tx_len, PXA2xxI2SState), +VMSTATE_INT32 (fifo_len, PXA2xxI2SState), +VMSTATE_END_OF_LIST () + } +};static void pxa2xx_i2s_data_req (void *opaque,int tx,int rx) {
@@ -1822,8 +1806,7 @@ static PXA2xxI2SState *pxa2xx_i2s_init(target_phys_addr_t base, pxa2xx_i2s_writefn, s, DEVICE_NATIVE_ENDIAN);cpu_register_physical_memory (base,0x100000 , iomemtype); -register_savevm (NULL ,"pxa2xx_i2s" , base,0 , - pxa2xx_i2s_save, pxa2xx_i2s_load, s); +vmstate_register (NULL , base, &vmstate_pxa2xx_i2s, s);return s; }
Signature · 1 line
1.7.4
PATCH 22/32 vmstate: port pxa2xx_cm
In reply to Juan Quintela--- hw/pxa2xx.c | 39 ++++++++++++++------------------------- 1 files changed, 14 insertions(+), 25 deletions(-)
hw/pxa2xx.c +14 -25
@@ -227,29 +227,18 @@ static CPUWriteMemoryFunc * const pxa2xx_cm_writefn[] = { pxa2xx_cm_write, }; -static void pxa2xx_cm_save (QEMUFile *f,void *opaque) -{ -PXA2xxState *s = (PXA2xxState *) opaque; -int i; - -for (i =0 ; i <4 ; i ++) -qemu_put_be32s (f, &s->cm_regs[i]); -qemu_put_be32s (f, &s->clkcfg); -qemu_put_be32s (f, &s->pmnc); -} - -static int pxa2xx_cm_load (QEMUFile *f,void *opaque,int version_id) -{ -PXA2xxState *s = (PXA2xxState *) opaque; -int i; - -for (i =0 ; i <4 ; i ++) -qemu_get_be32s (f, &s->cm_regs[i]); -qemu_get_be32s (f, &s->clkcfg); -qemu_get_be32s (f, &s->pmnc); - -return 0 ; -} +static const VMStateDescription vmstate_pxa2xx_cm = { + .name ="pxa2xx_cm" , + .version_id =0 , + .minimum_version_id =0 , + .minimum_version_id_old =0 , + .fields = (VMStateField []) { +VMSTATE_UINT32_ARRAY (cm_regs, PXA2xxState,4 ), +VMSTATE_UINT32 (clkcfg, PXA2xxState), +VMSTATE_UINT32 (pmnc, PXA2xxState), +VMSTATE_END_OF_LIST () + } +};static uint32_t pxa2xx_clkpwr_read (void *opaque,int op2,int reg,int crm) {
@@ -2171,7 +2160,7 @@ PXA2xxState *pxa270_init(unsigned int sdram_size, const char *revision) iomemtype =cpu_register_io_memory (pxa2xx_cm_readfn, pxa2xx_cm_writefn, s,DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (s->cm_base,0x1000 , iomemtype); -register_savevm (NULL ,"pxa2xx_cm" ,0 ,0 , pxa2xx_cm_save, pxa2xx_cm_load, s); +vmstate_register (NULL ,0 , &vmstate_pxa2xx_cm, s);cpu_arm_set_cp_io (s->env,14 , pxa2xx_cp14_read, pxa2xx_cp14_write, s);
@@ -2307,7 +2296,7 @@ PXA2xxState *pxa255_init(unsigned int sdram_size) iomemtype =cpu_register_io_memory (pxa2xx_cm_readfn, pxa2xx_cm_writefn, s,DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (s->cm_base,0x1000 , iomemtype); -register_savevm (NULL ,"pxa2xx_cm" ,0 ,0 , pxa2xx_cm_save, pxa2xx_cm_load, s); +vmstate_register (NULL ,0 , &vmstate_pxa2xx_cm, s);cpu_arm_set_cp_io (s->env,14 , pxa2xx_cp14_read, pxa2xx_cp14_write, s);
Signature · 1 line
1.7.4
PATCH 23/32 vmstate: port pxa2xx_mm
In reply to Juan Quintela--- hw/pxa2xx.c | 33 ++++++++++++--------------------- 1 files changed, 12 insertions(+), 21 deletions(-)
hw/pxa2xx.c +12 -21
@@ -516,25 +516,16 @@ static CPUWriteMemoryFunc * const pxa2xx_mm_writefn[] = { pxa2xx_mm_write, }; -static void pxa2xx_mm_save (QEMUFile *f,void *opaque) -{ -PXA2xxState *s = (PXA2xxState *) opaque; -int i; - -for (i =0 ; i <0x1a ; i ++) -qemu_put_be32s (f, &s->mm_regs[i]); -} - -static int pxa2xx_mm_load (QEMUFile *f,void *opaque,int version_id) -{ -PXA2xxState *s = (PXA2xxState *) opaque; -int i; - -for (i =0 ; i <0x1a ; i ++) -qemu_get_be32s (f, &s->mm_regs[i]); - -return 0 ; -} +static const VMStateDescription vmstate_pxa2xx_mm = { + .name ="pxa2xx_mm" , + .version_id =0 , + .minimum_version_id =0 , + .minimum_version_id_old =0 , + .fields = (VMStateField []) { +VMSTATE_UINT32_ARRAY (mm_regs, PXA2xxState,0x1a ), +VMSTATE_END_OF_LIST () + } +};/* Synchronous Serial Ports */ typedef struct {
@@ -2171,7 +2162,7 @@ PXA2xxState *pxa270_init(unsigned int sdram_size, const char *revision) iomemtype =cpu_register_io_memory (pxa2xx_mm_readfn, pxa2xx_mm_writefn, s,DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (s->mm_base,0x1000 , iomemtype); -register_savevm (NULL ,"pxa2xx_mm" ,0 ,0 , pxa2xx_mm_save, pxa2xx_mm_load, s); +vmstate_register (NULL ,0 , &vmstate_pxa2xx_mm, s); s->pm_base =0x40f00000 ; iomemtype = cpu_register_io_memory(pxa2xx_pm_readfn,
@@ -2307,7 +2298,7 @@ PXA2xxState *pxa255_init(unsigned int sdram_size) iomemtype =cpu_register_io_memory (pxa2xx_mm_readfn, pxa2xx_mm_writefn, s,DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (s->mm_base,0x1000 , iomemtype); -register_savevm (NULL ,"pxa2xx_mm" ,0 ,0 , pxa2xx_mm_save, pxa2xx_mm_load, s); +vmstate_register (NULL ,0 , &vmstate_pxa2xx_mm, s); s->pm_base =0x40f00000 ; iomemtype = cpu_register_io_memory(pxa2xx_pm_readfn,
Signature · 1 line
1.7.4
PATCH 24/32 vmstate: port pxa2xx_pm
In reply to Juan Quintela--- hw/pxa2xx.c | 33 ++++++++++++--------------------- 1 files changed, 12 insertions(+), 21 deletions(-)
hw/pxa2xx.c +12 -21
@@ -146,25 +146,16 @@ static CPUWriteMemoryFunc * const pxa2xx_pm_writefn[] = { pxa2xx_pm_write, }; -static void pxa2xx_pm_save (QEMUFile *f,void *opaque) -{ -PXA2xxState *s = (PXA2xxState *) opaque; -int i; - -for (i =0 ; i <0x40 ; i ++) -qemu_put_be32s (f, &s->pm_regs[i]); -} - -static int pxa2xx_pm_load (QEMUFile *f,void *opaque,int version_id) -{ -PXA2xxState *s = (PXA2xxState *) opaque; -int i; - -for (i =0 ; i <0x40 ; i ++) -qemu_get_be32s (f, &s->pm_regs[i]); - -return 0 ; -} +static const VMStateDescription vmstate_pxa2xx_pm = { + .name ="pxa2xx_pm" , + .version_id =0 , + .minimum_version_id =0 , + .minimum_version_id_old =0 , + .fields = (VMStateField []) { +VMSTATE_UINT32_ARRAY (pm_regs, PXA2xxState,0x40 ), +VMSTATE_END_OF_LIST () + } +};#define CCCR 0x00/* Core Clock Configuration register */ #define CKEN 0x04/* Clock Enable register */
@@ -2168,7 +2159,7 @@ PXA2xxState *pxa270_init(unsigned int sdram_size, const char *revision) iomemtype =cpu_register_io_memory (pxa2xx_pm_readfn, pxa2xx_pm_writefn, s,DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (s->pm_base,0x100 , iomemtype); -register_savevm (NULL ,"pxa2xx_pm" ,0 ,0 , pxa2xx_pm_save, pxa2xx_pm_load, s); +vmstate_register (NULL ,0 , &vmstate_pxa2xx_pm, s);for (i =0 ; pxa27x_ssp[i].io_base; i ++); s->ssp = (SSIBus **)qemu_mallocz (sizeof (SSIBus *) * i);
@@ -2304,7 +2295,7 @@ PXA2xxState *pxa255_init(unsigned int sdram_size) iomemtype =cpu_register_io_memory (pxa2xx_pm_readfn, pxa2xx_pm_writefn, s,DEVICE_NATIVE_ENDIAN );cpu_register_physical_memory (s->pm_base,0x100 , iomemtype); -register_savevm (NULL ,"pxa2xx_pm" ,0 ,0 , pxa2xx_pm_save, pxa2xx_pm_load, s); +vmstate_register (NULL ,0 , &vmstate_pxa2xx_pm, s);for (i =0 ; pxa255_ssp[i].io_base; i ++); s->ssp = (SSIBus **)qemu_mallocz (sizeof (SSIBus *) * i);
Signature · 1 line
1.7.4
PATCH 25/32 vmstate: port ppce500_pci
In reply to Juan Quintela--- hw/ppce500_pci.c | 87 +++++++++++++++++++++++++----------------------------- 1 files changed, 40 insertions(+), 47 deletions(-)
hw/ppce500_pci.c +40 -47
@@ -216,56 +216,49 @@ static void mpc85xx_pci_set_irq(void *opaque, int irq_num, int level)qemu_set_irq (pic[irq_num], level); } -static void ppce500_pci_save (QEMUFile *f,void *opaque) -{ -PPCE500PCIState *controller = opaque; -int i; - -pci_device_save (controller->pci_dev, f); - -for (i =0 ; i <PPCE500_PCI_NR_POBS ; i++) { -qemu_put_be32s (f, &controller->pob[i].potar); -qemu_put_be32s (f, &controller->pob[i].potear); -qemu_put_be32s (f, &controller->pob[i].powbar); -qemu_put_be32s (f, &controller->pob[i].powar); - } - -for (i =0 ; i <PPCE500_PCI_NR_PIBS ; i++) { -qemu_put_be32s (f, &controller->pib[i].pitar); -qemu_put_be32s (f, &controller->pib[i].piwbar); -qemu_put_be32s (f, &controller->pib[i].piwbear); -qemu_put_be32s (f, &controller->pib[i].piwar); +static const VMStateDescription vmstate_pci_outbound = { + .name ="pci_outbound" , + .version_id =0 , + .minimum_version_id =0 , + .minimum_version_id_old =0 , + .fields = (VMStateField []) { + VMSTATE_UINT32(potar, struct pci_outbound), + VMSTATE_UINT32(potear, struct pci_outbound), + VMSTATE_UINT32(powbar, struct pci_outbound), + VMSTATE_UINT32(powar, struct pci_outbound), +VMSTATE_END_OF_LIST () } -qemu_put_be32s (f, &controller->gasket_time); -} - -static int ppce500_pci_load (QEMUFile *f,void *opaque,int version_id) -{ -PPCE500PCIState *controller = opaque; -int i; - -if (version_id !=1 ) -return -EINVAL ; - -pci_device_load (controller->pci_dev, f); +}; -for (i =0 ; i <PPCE500_PCI_NR_POBS ; i++) { -qemu_get_be32s (f, &controller->pob[i].potar); -qemu_get_be32s (f, &controller->pob[i].potear); -qemu_get_be32s (f, &controller->pob[i].powbar); -qemu_get_be32s (f, &controller->pob[i].powar); +static const VMStateDescription vmstate_pci_inbound = { + .name ="pci_inbound" , + .version_id =0 , + .minimum_version_id =0 , + .minimum_version_id_old =0 , + .fields = (VMStateField []) { + VMSTATE_UINT32(pitar, struct pci_inbound), + VMSTATE_UINT32(piwbar, struct pci_inbound), + VMSTATE_UINT32(piwbear, struct pci_inbound), + VMSTATE_UINT32(piwar, struct pci_inbound), +VMSTATE_END_OF_LIST () } +}; -for (i =0 ; i <PPCE500_PCI_NR_PIBS ; i++) { -qemu_get_be32s (f, &controller->pib[i].pitar); -qemu_get_be32s (f, &controller->pib[i].piwbar); -qemu_get_be32s (f, &controller->pib[i].piwbear); -qemu_get_be32s (f, &controller->pib[i].piwar); +static const VMStateDescription vmstate_ppce500_pci = { + .name ="ppce500_pci" , + .version_id =1 , + .minimum_version_id =1 , + .minimum_version_id_old =1 , + .fields = (VMStateField []) { +VMSTATE_PCI_DEVICE_POINTER (pci_dev, PPCE500PCIState), +VMSTATE_STRUCT_ARRAY (pob, PPCE500PCIState,PPCE500_PCI_NR_POBS ,1 , + vmstate_pci_outbound, struct pci_outbound), +VMSTATE_STRUCT_ARRAY (pib, PPCE500PCIState,PPCE500_PCI_NR_PIBS ,1 , + vmstate_pci_outbound, struct pci_inbound), +VMSTATE_UINT32 (gasket_time, PPCE500PCIState), +VMSTATE_END_OF_LIST () } -qemu_get_be32s (f, &controller->gasket_time); - -return 0 ; -} +};PCIBus *ppce500_pci_init (qemu_irq pci_irqs[4 ],target_phys_addr_t registers) {
@@ -314,8 +307,8 @@ PCIBus *ppce500_pci_init(qemu_irq pci_irqs[4], target_phys_addr_t registers) PCIE500_REG_SIZE, index);/* XXX load/save code not tested. */ -register_savevm (&d->qdev,"ppce500_pci" , ppce500_pci_id++, -1 , ppce500_pci_save, ppce500_pci_load, controller); +vmstate_register (&d->qdev, ppce500_pci_id++, &vmstate_ppce500_pci, + controller);return controller->pci_state.bus;
Signature · 1 line
1.7.4
PATCH 26/32 vmstate: port ppc4xx_pci
In reply to Juan Quintela--- hw/ppc4xx_pci.c | 80 ++++++++++++++++++++++++++---------------------------- 1 files changed, 39 insertions(+), 41 deletions(-)
hw/ppc4xx_pci.c +39 -41
@@ -285,50 +285,48 @@ static void ppc4xx_pci_set_irq(void *opaque, int irq_num, int level)qemu_set_irq (pci_irqs[irq_num], level); } -static void ppc4xx_pci_save (QEMUFile *f,void *opaque) -{ -PPC4xxPCIState *controller = opaque; -int i; - -pci_device_save (controller->pci_dev, f); - -for (i =0 ; i < PPC4xx_PCI_NR_PMMS; i++) { -qemu_put_be32s (f, &controller->pmm[i].la); -qemu_put_be32s (f, &controller->pmm[i].ma); -qemu_put_be32s (f, &controller->pmm[i].pcila); -qemu_put_be32s (f, &controller->pmm[i].pciha); - } - -for (i =0 ; i < PPC4xx_PCI_NR_PTMS; i++) { -qemu_put_be32s (f, &controller->ptm[i].ms); -qemu_put_be32s (f, &controller->ptm[i].la); +static const VMStateDescription vmstate_pci_master_map = { + .name ="pci_master_map" , + .version_id =0 , + .minimum_version_id =0 , + .minimum_version_id_old =0 , + .fields = (VMStateField []) { + VMSTATE_UINT32(la, struct PCIMasterMap), + VMSTATE_UINT32(ma, struct PCIMasterMap), + VMSTATE_UINT32(pcila, struct PCIMasterMap), + VMSTATE_UINT32(pciha, struct PCIMasterMap), +VMSTATE_END_OF_LIST () } -} - -static int ppc4xx_pci_load (QEMUFile *f,void *opaque,int version_id) -{ -PPC4xxPCIState *controller = opaque; -int i; - -if (version_id !=1 ) -return -EINVAL ; - -pci_device_load (controller->pci_dev, f); +}; -for (i =0 ; i < PPC4xx_PCI_NR_PMMS; i++) { -qemu_get_be32s (f, &controller->pmm[i].la); -qemu_get_be32s (f, &controller->pmm[i].ma); -qemu_get_be32s (f, &controller->pmm[i].pcila); -qemu_get_be32s (f, &controller->pmm[i].pciha); +static const VMStateDescription vmstate_pci_target_map = { + .name ="pci_target_map" , + .version_id =0 , + .minimum_version_id =0 , + .minimum_version_id_old =0 , + .fields = (VMStateField []) { + VMSTATE_UINT32(ms, struct PCITargetMap), + VMSTATE_UINT32(la, struct PCITargetMap), +VMSTATE_END_OF_LIST () } +}; -for (i =0 ; i < PPC4xx_PCI_NR_PTMS; i++) { -qemu_get_be32s (f, &controller->ptm[i].ms); -qemu_get_be32s (f, &controller->ptm[i].la); +static const VMStateDescription vmstate_ppc4xx_pci = { + .name ="ppc4xx_pci" , + .version_id =1 , + .minimum_version_id =1 , + .minimum_version_id_old =1 , + .fields = (VMStateField []) { +VMSTATE_PCI_DEVICE_POINTER (pci_dev, PPC4xxPCIState), +VMSTATE_STRUCT_ARRAY (pmm, PPC4xxPCIState, PPC4xx_PCI_NR_PMMS,1 , + vmstate_pci_master_map, + struct PCIMasterMap), +VMSTATE_STRUCT_ARRAY (ptm, PPC4xxPCIState, PPC4xx_PCI_NR_PTMS,1 , + vmstate_pci_target_map, + struct PCITargetMap), +VMSTATE_END_OF_LIST () } - -return 0 ; -} +};/* XXX Interrupt acknowledge cycles not supported. */ PCIBus *ppc4xx_pci_init(CPUState *env, qemu_irq pci_irqs[4],
@@ -381,8 +379,8 @@ PCIBus *ppc4xx_pci_init(CPUState *env, qemu_irq pci_irqs[4],qemu_register_reset (ppc4xx_pci_reset, controller);/* XXX load/save code not tested. */ -register_savevm (&controller->pci_dev->qdev,"ppc4xx_pci" , ppc4xx_pci_id++, -1 , ppc4xx_pci_save, ppc4xx_pci_load, controller); +vmstate_register (&controller->pci_dev->qdev, ppc4xx_pci_id++, + &vmstate_ppc4xx_pci, controller);return controller->pci_state.bus;
Signature · 1 line
1.7.4
PATCH 27/32 vmstate: port syborg_pointer
In reply to Juan Quintela--- hw/syborg_pointer.c | 73 +++++++++++++++++++------------------------------- 1 files changed, 28 insertions(+), 45 deletions(-)
hw/syborg_pointer.c +28 -45
@@ -152,52 +152,36 @@ static void syborg_pointer_event(void *opaque, int dx, int dy, int dz,syborg_pointer_update (s); } -static void syborg_pointer_save (QEMUFile *f,void *opaque) -{ -SyborgPointerState *s = (SyborgPointerState *)opaque; -int i; - -qemu_put_be32 (f, s->fifo_size); -qemu_put_be32 (f, s->absolute); -qemu_put_be32 (f, s->int_enabled); -qemu_put_be32 (f, s->read_pos); -qemu_put_be32 (f, s->read_count); -for (i =0 ; i < s->fifo_size; i++) { -qemu_put_be32 (f, s->event_fifo[i].x); -qemu_put_be32 (f, s->event_fifo[i].y); -qemu_put_be32 (f, s->event_fifo[i].z); -qemu_put_be32 (f, s->event_fifo[i].pointer_buttons); +static const VMStateDescription vmstate_event_data = { + .name ="dbma_channel" , + .version_id =0 , + .minimum_version_id =0 , + .minimum_version_id_old =0 , + .fields = (VMStateField []) { +VMSTATE_INT32 (x, event_data), +VMSTATE_INT32 (y, event_data), +VMSTATE_INT32 (z, event_data), +VMSTATE_INT32 (pointer_buttons, event_data), +VMSTATE_END_OF_LIST () } -} +}; -static int syborg_pointer_load (QEMUFile *f,void *opaque,int version_id) -{ -SyborgPointerState *s = (SyborgPointerState *)opaque; -uint32_t val; -int i; - -if (version_id !=1 ) -return -EINVAL ; - - val =qemu_get_be32 (f); -if (val != s->fifo_size) -return -EINVAL ; - - val =qemu_get_be32 (f); -if (val != s->absolute) -return -EINVAL ; - - s->int_enabled =qemu_get_be32 (f); - s->read_pos =qemu_get_be32 (f); - s->read_count =qemu_get_be32 (f); -for (i =0 ; i < s->fifo_size; i++) { - s->event_fifo[i].x =qemu_get_be32 (f); - s->event_fifo[i].y =qemu_get_be32 (f); - s->event_fifo[i].z =qemu_get_be32 (f); - s->event_fifo[i].pointer_buttons =qemu_get_be32 (f); +static const VMStateDescription vmstate_syborg_pointer = { + .name ="syborg_pointer" , + .version_id =1 , + .minimum_version_id =1 , + .minimum_version_id_old =1 , + .fields = (VMStateField []) { +VMSTATE_UINT32_EQUAL (fifo_size, SyborgPointerState), +VMSTATE_UINT32_EQUAL (absolute, SyborgPointerState), +VMSTATE_INT32 (int_enabled, SyborgPointerState), +VMSTATE_INT32 (read_pos, SyborgPointerState), +VMSTATE_INT32 (read_count, SyborgPointerState), +VMSTATE_STRUCT_VARRAY_UINT32 (event_fifo, SyborgPointerState, fifo_size, +1 , vmstate_event_data, event_data), +VMSTATE_END_OF_LIST () } -return 0 ; -} +};static int syborg_pointer_init (SysBusDevice *dev) {
@@ -219,8 +203,7 @@ static int syborg_pointer_init(SysBusDevice *dev)qemu_add_mouse_event_handler (syborg_pointer_event, s, s->absolute,"Syborg Pointer" ); -register_savevm (&dev->qdev,"syborg_pointer" ,-1 ,1 , - syborg_pointer_save, syborg_pointer_load, s); +vmstate_register (&dev->qdev,-1 , &vmstate_syborg_pointer, s);return 0 ; }
Signature · 1 line
1.7.4
PATCH 28/32 vmstate: port stellaris_adc
In reply to Juan Quintela--- hw/stellaris.c | 89 +++++++++++++++++++++---------------------------------- 1 files changed, 34 insertions(+), 55 deletions(-)
hw/stellaris.c +34 -55
@@ -1058,60 +1058,40 @@ static CPUWriteMemoryFunc * const stellaris_adc_writefn[] = {stellaris_adc_write }; -static void stellaris_adc_save (QEMUFile *f,void *opaque) -{ -stellaris_adc_state *s = (stellaris_adc_state *)opaque; -int i; -int j; - -qemu_put_be32 (f, s->actss); -qemu_put_be32 (f, s->ris); -qemu_put_be32 (f, s->im); -qemu_put_be32 (f, s->emux); -qemu_put_be32 (f, s->ostat); -qemu_put_be32 (f, s->ustat); -qemu_put_be32 (f, s->sspri); -qemu_put_be32 (f, s->sac); -for (i =0 ; i <4 ; i++) { -qemu_put_be32 (f, s->fifo[i].state); -for (j =0 ; j <16 ; j++) { -qemu_put_be32 (f, s->fifo[i].data[j]); - } -qemu_put_be32 (f, s->ssmux[i]); -qemu_put_be32 (f, s->ssctl[i]); - } -qemu_put_be32 (f, s->noise); -} - -static int stellaris_adc_load (QEMUFile *f,void *opaque,int version_id) -{ -stellaris_adc_state *s = (stellaris_adc_state *)opaque; -int i; -int j; - -if (version_id !=1 ) -return -EINVAL ; - - s->actss =qemu_get_be32 (f); - s->ris =qemu_get_be32 (f); - s->im =qemu_get_be32 (f); - s->emux =qemu_get_be32 (f); - s->ostat =qemu_get_be32 (f); - s->ustat =qemu_get_be32 (f); - s->sspri =qemu_get_be32 (f); - s->sac =qemu_get_be32 (f); -for (i =0 ; i <4 ; i++) { - s->fifo[i].state =qemu_get_be32 (f); -for (j =0 ; j <16 ; j++) { - s->fifo[i].data[j] =qemu_get_be32 (f); - } - s->ssmux[i] =qemu_get_be32 (f); - s->ssctl[i] =qemu_get_be32 (f); +static const VMStateDescription vmstate_stellaris_adc = { + .name ="stellaris_adc" , + .version_id =1 , + .minimum_version_id =1 , + .minimum_version_id_old =1 , + .fields = (VMStateField []) { +VMSTATE_UINT32 (actss, stellaris_adc_state), +VMSTATE_UINT32 (ris, stellaris_adc_state), +VMSTATE_UINT32 (im, stellaris_adc_state), +VMSTATE_UINT32 (emux, stellaris_adc_state), +VMSTATE_UINT32 (ostat, stellaris_adc_state), +VMSTATE_UINT32 (ustat, stellaris_adc_state), +VMSTATE_UINT32 (sspri, stellaris_adc_state), +VMSTATE_UINT32 (sac, stellaris_adc_state), +VMSTATE_UINT32 (fifo[0 ].state, stellaris_adc_state), +VMSTATE_UINT32_ARRAY (fifo[0 ].data, stellaris_adc_state,16 ), +VMSTATE_UINT32 (ssmux[0 ], stellaris_adc_state), +VMSTATE_UINT32 (ssctl[0 ], stellaris_adc_state), +VMSTATE_UINT32 (fifo[1 ].state, stellaris_adc_state), +VMSTATE_UINT32_ARRAY (fifo[1 ].data, stellaris_adc_state,16 ), +VMSTATE_UINT32 (ssmux[1 ], stellaris_adc_state), +VMSTATE_UINT32 (ssctl[1 ], stellaris_adc_state), +VMSTATE_UINT32 (fifo[2 ].state, stellaris_adc_state), +VMSTATE_UINT32_ARRAY (fifo[2 ].data, stellaris_adc_state,16 ), +VMSTATE_UINT32 (ssmux[2 ], stellaris_adc_state), +VMSTATE_UINT32 (ssctl[2 ], stellaris_adc_state), +VMSTATE_UINT32 (fifo[3 ].state, stellaris_adc_state), +VMSTATE_UINT32_ARRAY (fifo[3 ].data, stellaris_adc_state,16 ), +VMSTATE_UINT32 (ssmux[3 ], stellaris_adc_state), +VMSTATE_UINT32 (ssctl[3 ], stellaris_adc_state), +VMSTATE_UINT32 (noise, stellaris_adc_state), +VMSTATE_END_OF_LIST () } - s->noise =qemu_get_be32 (f); - -return 0 ; -} +};static int stellaris_adc_init (SysBusDevice *dev) {
@@ -1129,8 +1109,7 @@ static int stellaris_adc_init(SysBusDevice *dev)sysbus_init_mmio (dev,0x1000 , iomemtype);stellaris_adc_reset (s);qdev_init_gpio_in (&dev->qdev, stellaris_adc_trigger,1 ); -register_savevm (&dev->qdev,"stellaris_adc" ,-1 ,1 , - stellaris_adc_save, stellaris_adc_load, s); +vmstate_register (&dev->qdev,-1 , &vmstate_stellaris_adc, s);return 0 ; }
Signature · 1 line
1.7.4
PATCH 29/32 vmstate: port syborg_serial
In reply to Juan Quintela--- hw/syborg_serial.c | 60 +++++++++++++++------------------------------------ 1 files changed, 18 insertions(+), 42 deletions(-)
hw/syborg_serial.c +18 -42
@@ -273,47 +273,24 @@ static CPUWriteMemoryFunc * const syborg_serial_writefn[] = { syborg_serial_write }; -static void syborg_serial_save (QEMUFile *f,void *opaque) -{ -SyborgSerialState *s = opaque; -int i; - -qemu_put_be32 (f, s->fifo_size); -qemu_put_be32 (f, s->int_enable); -qemu_put_be32 (f, s->read_pos); -qemu_put_be32 (f, s->read_count); -qemu_put_be32 (f, s->dma_tx_ptr); -qemu_put_be32 (f, s->dma_rx_ptr); -qemu_put_be32 (f, s->dma_rx_size); -for (i =0 ; i < s->fifo_size; i++) { -qemu_put_be32 (f, s->read_fifo[i]); - } -} - -static int syborg_serial_load (QEMUFile *f,void *opaque,int version_id) -{ -SyborgSerialState *s = opaque; -int i; - -if (version_id !=1 ) -return -EINVAL ; - - i =qemu_get_be32 (f); -if (s->fifo_size != i) -return -EINVAL ; - - s->int_enable =qemu_get_be32 (f); - s->read_pos =qemu_get_be32 (f); - s->read_count =qemu_get_be32 (f); - s->dma_tx_ptr =qemu_get_be32 (f); - s->dma_rx_ptr =qemu_get_be32 (f); - s->dma_rx_size =qemu_get_be32 (f); -for (i =0 ; i < s->fifo_size; i++) { - s->read_fifo[i] =qemu_get_be32 (f); +static const VMStateDescription vmstate_syborg_serial = { + .name ="syborg_serial" , + .version_id =1 , + .minimum_version_id =1 , + .minimum_version_id_old =1 , + .fields = (VMStateField []) { +VMSTATE_UINT32_EQUAL (fifo_size, SyborgSerialState), +VMSTATE_UINT32 (int_enable, SyborgSerialState), +VMSTATE_INT32 (read_pos, SyborgSerialState), +VMSTATE_INT32 (read_count, SyborgSerialState), +VMSTATE_UINT32 (dma_tx_ptr, SyborgSerialState), +VMSTATE_UINT32 (dma_rx_ptr, SyborgSerialState), +VMSTATE_UINT32 (dma_rx_size, SyborgSerialState), +VMSTATE_VARRAY_UINT32 (read_fifo, SyborgSerialState, fifo_size,1 , + vmstate_info_uint32, uint32), +VMSTATE_END_OF_LIST () } - -return 0 ; -} +};static int syborg_serial_init (SysBusDevice *dev) {
@@ -336,8 +313,6 @@ static int syborg_serial_init(SysBusDevice *dev) } s->read_fifo =qemu_mallocz (s->fifo_size *sizeof (s->read_fifo[0 ])); -register_savevm (&dev->qdev,"syborg_serial" ,-1 ,1 , - syborg_serial_save, syborg_serial_load, s);return 0 ; }
@@ -345,6 +320,7 @@ static SysBusDeviceInfo syborg_serial_info = { .init = syborg_serial_init, .qdev.name = "syborg,serial", .qdev.size = sizeof(SyborgSerialState), + .qdev.vmsd = &vmstate_syborg_serial, .qdev.props = (Property []) {DEFINE_PROP_UINT32 ("fifo-size" , SyborgSerialState, fifo_size,16 ),DEFINE_PROP_END_OF_LIST (),
Signature · 1 line
1.7.4
PATCH 30/32 vmstate: port syborg_keyboard
In reply to Juan Quintela--- hw/syborg_keyboard.c | 57 +++++++++++++++----------------------------------- 1 files changed, 17 insertions(+), 40 deletions(-)
hw/syborg_keyboard.c +17 -40
@@ -51,11 +51,11 @@ enum {typedef struct {SysBusDevice busdev; -int int_enabled; +uint32_t int_enabled;int extension_bit;uint32_t fifo_size;uint32_t *key_fifo; -int read_pos, read_count; +uint32_t read_pos, read_count;qemu_irq irq; }SyborgKeyboardState ;
@@ -165,43 +165,21 @@ static void syborg_keyboard_event(void *opaque, int keycode)syborg_keyboard_update (s); } -static void syborg_keyboard_save (QEMUFile *f,void *opaque) -{ -SyborgKeyboardState *s = (SyborgKeyboardState *)opaque; -int i; - -qemu_put_be32 (f, s->fifo_size); -qemu_put_be32 (f, s->int_enabled); -qemu_put_be32 (f, s->extension_bit); -qemu_put_be32 (f, s->read_pos); -qemu_put_be32 (f, s->read_count); -for (i =0 ; i < s->fifo_size; i++) { -qemu_put_be32 (f, s->key_fifo[i]); - } -} - -static int syborg_keyboard_load (QEMUFile *f,void *opaque,int version_id) -{ -SyborgKeyboardState *s = (SyborgKeyboardState *)opaque; -uint32_t val; -int i; - -if (version_id !=1 ) -return -EINVAL ; - - val =qemu_get_be32 (f); -if (val != s->fifo_size) -return -EINVAL ; - - s->int_enabled =qemu_get_be32 (f); - s->extension_bit =qemu_get_be32 (f); - s->read_pos =qemu_get_be32 (f); - s->read_count =qemu_get_be32 (f); -for (i =0 ; i < s->fifo_size; i++) { - s->key_fifo[i] =qemu_get_be32 (f); +static const VMStateDescription vmstate_syborg_keyboard = { + .name ="syborg_keyboard" , + .version_id =1 , + .minimum_version_id =1 , + .minimum_version_id_old =1 , + .fields = (VMStateField []) { +VMSTATE_UINT32_EQUAL (fifo_size, SyborgKeyboardState), +VMSTATE_UINT32 (int_enabled, SyborgKeyboardState), +VMSTATE_UINT32 (read_pos, SyborgKeyboardState), +VMSTATE_UINT32 (read_count, SyborgKeyboardState), +VMSTATE_VARRAY_UINT32 (key_fifo, SyborgKeyboardState, fifo_size,1 , + vmstate_info_uint32, uint32), +VMSTATE_END_OF_LIST () } -return 0 ; -} +};static int syborg_keyboard_init (SysBusDevice *dev) {
@@ -221,8 +199,7 @@ static int syborg_keyboard_init(SysBusDevice *dev)qemu_add_kbd_event_handler (syborg_keyboard_event, s); -register_savevm (&dev->qdev,"syborg_keyboard" ,-1 ,1 , - syborg_keyboard_save, syborg_keyboard_load, s); +vmstate_register (&dev->qdev,-1 , &vmstate_syborg_keyboard, s);return 0 ; }
Signature · 1 line
1.7.4
PATCH 31/32 vmstate: port stellaris gamepad
In reply to Juan Quintela--- hw/stellaris_input.c | 50 ++++++++++++++++++++++++-------------------------- 1 files changed, 24 insertions(+), 26 deletions(-)
hw/stellaris_input.c +24 -26
@@ -13,7 +13,7 @@typedef struct {qemu_irq irq;int keycode; -int pressed; +uint8_t pressed; }gamepad_button ; typedef struct {
@@ -47,30 +47,29 @@ static void stellaris_gamepad_put_key(void * opaque, int keycode) s->extension =0 ; } -static void stellaris_gamepad_save (QEMUFile *f,void *opaque) -{ -gamepad_state *s = (gamepad_state *)opaque; -int i; - -qemu_put_be32 (f, s->extension); -for (i =0 ; i < s->num_buttons; i++) -qemu_put_byte (f, s->buttons[i].pressed); -} - -static int stellaris_gamepad_load (QEMUFile *f,void *opaque,int version_id) -{ -gamepad_state *s = (gamepad_state *)opaque; -int i; - -if (version_id !=1 ) -return -EINVAL ; - - s->extension =qemu_get_be32 (f); -for (i =0 ; i < s->num_buttons; i++) - s->buttons[i].pressed =qemu_get_byte (f); +static const VMStateDescription vmstate_stellaris_button = { + .name ="stellaris_button" , + .version_id =0 , + .minimum_version_id =0 , + .minimum_version_id_old =0 , + .fields = (VMStateField []) { +VMSTATE_UINT8 (pressed, gamepad_button), +VMSTATE_END_OF_LIST () + } +}; -return 0 ; -} +static const VMStateDescription vmstate_stellaris_gamepad = { + .name ="stellaris_gamepad" , + .version_id =1 , + .minimum_version_id =1 , + .minimum_version_id_old =1 , + .fields = (VMStateField []) { +VMSTATE_INT32 (extension, gamepad_state), +VMSTATE_STRUCT_VARRAY_INT32 (buttons, gamepad_state, num_buttons,0 , + vmstate_stellaris_button, gamepad_button), +VMSTATE_END_OF_LIST () + } +};/* Returns an array 5 ouput slots. */ void stellaris_gamepad_init (int n,qemu_irq *irq,const int *keycode)
@@ -86,6 +85,5 @@ void stellaris_gamepad_init(int n, qemu_irq *irq, const int *keycode) } s->num_buttons = n;qemu_add_kbd_event_handler (stellaris_gamepad_put_key, s); -register_savevm (NULL ,"stellaris_gamepad" ,-1 ,1 , - stellaris_gamepad_save, stellaris_gamepad_load, s); +vmstate_register (NULL ,-1 , &vmstate_stellaris_gamepad, s); }
Signature · 1 line
1.7.4
PATCH 32/32 vmstate: stellaris use unused for placeholder entries
In reply to Juan Quintela--- hw/stellaris.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-)
hw/stellaris.c +1 -2
@@ -291,8 +291,7 @@ static const VMStateDescription vmstate_stellaris_gptm = {VMSTATE_UINT32 (control, gptm_state),VMSTATE_UINT32 (state, gptm_state),VMSTATE_UINT32 (mask, gptm_state), -VMSTATE_UINT32 (mode[0 ], gptm_state), -VMSTATE_UINT32 (mode[0 ], gptm_state), +VMSTATE_UNUSED (8 ),VMSTATE_UINT32_ARRAY (load, gptm_state,2 ),VMSTATE_UINT32_ARRAY (match, gptm_state,2 ), VMSTATE_UINT32_ARRAY(prescale, gptm_state, 2),
Signature · 1 line
1.7.4