savevm: Port to qdev.vmsd all devices that have qdev
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
diff --git a/hw/ac97.c b/hw/ac97.c
index f2d2823..62e349a 100644
--- a/hw/ac97.c
+++ b/hw/ac97.c
@@ -1319,7 +1319,6 @@
pci_register_bar (&s->dev, 0, 256 * 4, PCI_BASE_ADDRESS_SPACE_IO,
ac97_map);
pci_register_bar (&s->dev, 1, 64 * 4, PCI_BASE_ADDRESS_SPACE_IO, ac97_map);
- vmstate_register (0, &vmstate_ac97, s);
qemu_register_reset (ac97_on_reset, s);
AUD_register_card ("ac97", &s->card);
ac97_on_reset (s);
@@ -1336,6 +1335,7 @@
.qdev.name = "AC97",
.qdev.desc = "Intel 82801AA AC97 Audio",
.qdev.size = sizeof (AC97LinkState),
+ .qdev.vmsd = &vmstate_ac97,
.init = ac97_initfn,
};
diff --git a/hw/cirrus_vga.c b/hw/cirrus_vga.c
index d76e5bb..1194b5a 100644
--- a/hw/cirrus_vga.c
+++ b/hw/cirrus_vga.c
@@ -3245,7 +3245,6 @@
pci_register_bar((PCIDevice *)d, 1, CIRRUS_PNPMMIO_SIZE,
PCI_BASE_ADDRESS_SPACE_MEMORY, cirrus_pci_mmio_map);
}
- vmstate_register(0, &vmstate_pci_cirrus_vga, d);
/* ROM BIOS */
rom_add_vga(VGABIOS_CIRRUS_FILENAME);
@@ -3260,6 +3259,7 @@
static PCIDeviceInfo cirrus_vga_info = {
.qdev.name = "Cirrus VGA",
.qdev.size = sizeof(PCICirrusVGAState),
+ .qdev.vmsd = &vmstate_pci_cirrus_vga,
.init = pci_cirrus_vga_initfn,
.config_write = pci_cirrus_write_config,
};
diff --git a/hw/cs4231a.c b/hw/cs4231a.c
index 7c29aa8..4d5ce5c 100644
--- a/hw/cs4231a.c
+++ b/hw/cs4231a.c
@@ -651,7 +651,6 @@
DMA_register_channel (s->dma, cs_dma_read, s);
- vmstate_register (0, &vmstate_cs4231a, s);
qemu_register_reset (cs_reset, s);
cs_reset (s);
@@ -669,6 +668,7 @@
.qdev.name = "cs4231a",
.qdev.desc = "Crystal Semiconductor CS4231A",
.qdev.size = sizeof (CSState),
+ .qdev.vmsd = &vmstate_cs4231a,
.init = cs4231a_initfn,
.qdev.props = (Property[]) {
DEFINE_PROP_HEX32 ("iobase", CSState, port, 0x534),
diff --git a/hw/e1000.c b/hw/e1000.c
index 683fdcc..b65a74f 100644
--- a/hw/e1000.c
+++ b/hw/e1000.c
@@ -1051,7 +1051,6 @@
cpu_unregister_io_memory(d->mmio_index);
qemu_del_vlan_client(&d->nic->nc);
- vmstate_unregister(&vmstate_e1000, d);
return 0;
}
@@ -1121,8 +1120,6 @@
qemu_format_nic_info_str(&d->nic->nc, macaddr);
- vmstate_register(-1, &vmstate_e1000, d);
-
if (!pci_dev->qdev.hotplugged) {
static int loaded = 0;
if (!loaded) {
@@ -1144,6 +1141,7 @@
.qdev.desc = "Intel Gigabit Ethernet",
.qdev.size = sizeof(E1000State),
.qdev.reset = qdev_e1000_reset,
+ .qdev.vmsd = &vmstate_e1000,
.init = pci_e1000_init,
.exit = pci_e1000_uninit,
.qdev.props = (Property[]) {
diff --git a/hw/es1370.c b/hw/es1370.c
index 4e646dc..c358253 100644
--- a/hw/es1370.c
+++ b/hw/es1370.c
@@ -1023,7 +1023,6 @@
c[0x3f] = 0x80;
pci_register_bar (&s->dev, 0, 256, PCI_BASE_ADDRESS_SPACE_IO, es1370_map);
- vmstate_register (0, &vmstate_es1370, s);
qemu_register_reset (es1370_on_reset, s);
AUD_register_card ("es1370", &s->card);
@@ -1041,6 +1040,7 @@
.qdev.name = "ES1370",
.qdev.desc = "ENSONIQ AudioPCI ES1370",
.qdev.size = sizeof (ES1370State),
+ .qdev.vmsd = &vmstate_es1370,
.init = es1370_initfn,
};
diff --git a/hw/gus.c b/hw/gus.c
index d35da0a..e9016d8 100644
--- a/hw/gus.c
+++ b/hw/gus.c
@@ -287,7 +287,6 @@
AUD_set_active_out (s->voice, 1);
- vmstate_register (0, &vmstate_gus, s);
return 0;
}
@@ -301,6 +300,7 @@
.qdev.name = "gus",
.qdev.desc = "Gravis Ultrasound GF1",
.qdev.size = sizeof (GUSState),
+ .qdev.vmsd = &vmstate_gus,
.init = gus_initfn,
.qdev.props = (Property[]) {
DEFINE_PROP_UINT32 ("freq", GUSState, freq, 44100),
diff --git a/hw/lance.c b/hw/lance.c
index 98033a4..b6b04dd 100644
--- a/hw/lance.c
+++ b/hw/lance.c
@@ -96,7 +96,6 @@
{
PCNetState *d = DO_UPCAST(NICState, nc, nc)->opaque;
- vmstate_unregister(&vmstate_pcnet, d);
pcnet_common_cleanup(d);
}
@@ -108,6 +107,17 @@
.cleanup = lance_cleanup,
};
+static const VMStateDescription vmstate_lance = {
+ .name = "pcnet",
+ .version_id = 3,
+ .minimum_version_id = 2,
+ .minimum_version_id_old = 2,
+ .fields = (VMStateField []) {
+ VMSTATE_STRUCT(state, SysBusPCNetState, 0, vmstate_pcnet, PCNetState),
+ VMSTATE_END_OF_LIST()
+ }
+};
+
static int lance_init(SysBusDevice *dev)
{
SysBusPCNetState *d = FROM_SYSBUS(SysBusPCNetState, dev);
@@ -124,8 +134,6 @@
s->phys_mem_read = ledma_memory_read;
s->phys_mem_write = ledma_memory_write;
-
- vmstate_register(-1, &vmstate_pcnet, d);
return pcnet_common_init(&dev->qdev, s, &net_lance_info);
}
@@ -141,6 +149,7 @@
.qdev.name = "lance",
.qdev.size = sizeof(SysBusPCNetState),
.qdev.reset = lance_reset,
+ .qdev.vmsd = &vmstate_lance,
.qdev.props = (Property[]) {
DEFINE_PROP_PTR("dma", SysBusPCNetState, state.dma_opaque),
DEFINE_NIC_PROPERTIES(SysBusPCNetState, state.conf),
diff --git a/hw/lm832x.c b/hw/lm832x.c
index 7e552c7..ce7dcac 100644
--- a/hw/lm832x.c
+++ b/hw/lm832x.c
@@ -471,7 +471,6 @@
lm_kbd_reset(s);
qemu_register_reset((void *) lm_kbd_reset, s);
- vmstate_register(-1, &vmstate_lm_kbd, s);
return 0;
}
@@ -498,6 +497,7 @@
static I2CSlaveInfo lm8323_info = {
.qdev.name = "lm8323",
.qdev.size = sizeof(LM823KbdState),
+ .qdev.vmsd = &vmstate_lm_kbd,
.init = lm8323_init,
.event = lm_i2c_event,
.recv = lm_i2c_rx,
diff --git a/hw/lsi53c895a.c b/hw/lsi53c895a.c
index ab0de86..9abac94 100644
--- a/hw/lsi53c895a.c
+++ b/hw/lsi53c895a.c
@@ -2148,7 +2148,6 @@
if (!dev->qdev.hotplugged) {
scsi_bus_legacy_handle_cmdline(&s->bus);
}
- vmstate_register(-1, &vmstate_lsi_scsi, s);
return 0;
}
@@ -2156,6 +2155,7 @@
.qdev.name = "lsi53c895a",
.qdev.alias = "lsi",
.qdev.size = sizeof(LSIState),
+ .qdev.vmsd = &vmstate_lsi_scsi,
.init = lsi_scsi_init,
.exit = lsi_scsi_uninit,
};
diff --git a/hw/max7310.c b/hw/max7310.c
index 0ce6ac9..c302eb6 100644
--- a/hw/max7310.c
+++ b/hw/max7310.c
@@ -184,7 +184,6 @@
max7310_reset(&s->i2c);
- vmstate_register(-1, &vmstate_max7310, s);
return 0;
}
@@ -206,6 +205,7 @@
static I2CSlaveInfo max7310_info = {
.qdev.name = "max7310",
.qdev.size = sizeof(MAX7310State),
+ .qdev.vmsd = &vmstate_max7310,
.init = max7310_init,
.event = max7310_event,
.recv = max7310_rx,
diff --git a/hw/ne2000-isa.c b/hw/ne2000-isa.c
index 0260f84..d2e9283 100644
--- a/hw/ne2000-isa.c
+++ b/hw/ne2000-isa.c
@@ -50,6 +50,17 @@
.cleanup = isa_ne2000_cleanup,
};
+const VMStateDescription vmstate_isa_ne2000 = {
+ .name = "ne2000",
+ .version_id = 2,
+ .minimum_version_id = 0,
+ .minimum_version_id_old = 0,
+ .fields = (VMStateField []) {
+ VMSTATE_STRUCT(ne2000, ISANE2000State, 0, vmstate_ne2000, NE2000State),
+ VMSTATE_END_OF_LIST()
+ }
+};
+
static int isa_ne2000_initfn(ISADevice *dev)
{
ISANE2000State *isa = DO_UPCAST(ISANE2000State, dev, dev);
@@ -75,7 +86,6 @@
dev->qdev.info->name, dev->qdev.id, s);
qemu_format_nic_info_str(&s->nic->nc, s->c.macaddr.a);
- vmstate_register(-1, &vmstate_ne2000, s);
return 0;
}
diff --git a/hw/ne2000.c b/hw/ne2000.c
index 0be189a..e0655ff 100644
--- a/hw/ne2000.c
+++ b/hw/ne2000.c
@@ -746,7 +746,6 @@
}
}
- vmstate_register(-1, &vmstate_pci_ne2000, d);
return 0;
}
@@ -755,7 +754,6 @@
PCINE2000State *d = DO_UPCAST(PCINE2000State, dev, pci_dev);
NE2000State *s = &d->ne2000;
- vmstate_unregister(&vmstate_pci_ne2000, s);
qemu_del_vlan_client(&s->nic->nc);
return 0;
}
@@ -763,6 +761,7 @@
static PCIDeviceInfo ne2000_info = {
.qdev.name = "ne2k_pci",
.qdev.size = sizeof(PCINE2000State),
+ .qdev.vmsd = &vmstate_pci_ne2000,
.init = pci_ne2000_init,
.exit = pci_ne2000_exit,
.qdev.props = (Property[]) {
diff --git a/hw/pckbd.c b/hw/pckbd.c
index a81b303..7e0d68d 100644
--- a/hw/pckbd.c
+++ b/hw/pckbd.c
@@ -414,6 +414,17 @@
KBDState kbd;
} ISAKBDState;
+const VMStateDescription vmstate_kbd_isa = {
+ .name = "pckbd",
+ .version_id = 3,
+ .minimum_version_id = 3,
+ .minimum_version_id_old = 3,
+ .fields = (VMStateField []) {
+ VMSTATE_STRUCT(kbd, ISAKBDState, 0, vmstate_kbd, KBDState),
+ VMSTATE_END_OF_LIST()
+ }
+};
+
static int i8042_initfn(ISADevice *dev)
{
KBDState *s = &(DO_UPCAST(ISAKBDState, dev, dev)->kbd);
@@ -421,7 +432,6 @@
isa_init_irq(dev, &s->irq_kbd, 1);
isa_init_irq(dev, &s->irq_mouse, 12);
- vmstate_register(0, &vmstate_kbd, s);
register_ioport_read(0x60, 1, 1, kbd_read_data, s);
register_ioport_write(0x60, 1, 1, kbd_write_data, s);
register_ioport_read(0x64, 1, 1, kbd_read_status, s);
@@ -439,6 +449,7 @@
static ISADeviceInfo i8042_info = {
.qdev.name = "i8042",
.qdev.size = sizeof(ISAKBDState),
+ .qdev.vmsd = &vmstate_kbd_isa,
.qdev.no_user = 1,
.init = i8042_initfn,
};
diff --git a/hw/pcnet.c b/hw/pcnet.c
index 195c825..138fbc6 100644
--- a/hw/pcnet.c
+++ b/hw/pcnet.c
@@ -1952,7 +1952,6 @@
PCIPCNetState *d = DO_UPCAST(PCIPCNetState, pci_dev, dev);
cpu_unregister_io_memory(d->state.mmio_index);
- vmstate_unregister(&vmstate_pci_pcnet, d);
qemu_del_timer(d->state.poll_timer);
qemu_free_timer(d->state.poll_timer);
qemu_del_vlan_client(&d->state.nic->nc);
@@ -2010,8 +2009,6 @@
s->phys_mem_read = pci_physical_memory_read;
s->phys_mem_write = pci_physical_memory_write;
- vmstate_register(-1, &vmstate_pci_pcnet, d);
-
if (!pci_dev->qdev.hotplugged) {
static int loaded = 0;
if (!loaded) {
@@ -2034,6 +2031,7 @@
.qdev.name = "pcnet",
.qdev.size = sizeof(PCIPCNetState),
.qdev.reset = pci_reset,
+ .qdev.vmsd = &vmstate_pci_pcnet,
.init = pci_pcnet_init,
.exit = pci_pcnet_uninit,
.qdev.props = (Property[]) {
diff --git a/hw/piix_pci.c b/hw/piix_pci.c
index a44f941..1b67475 100644
--- a/hw/piix_pci.c
+++ b/hw/piix_pci.c
@@ -198,7 +198,6 @@
d->dev.config[0x72] = 0x02; /* SMRAM */
- vmstate_register(0, &vmstate_i440fx, d);
return 0;
}
@@ -312,7 +311,6 @@
uint8_t *pci_conf;
isa_bus_new(&d->dev.qdev);
- vmstate_register(0, &vmstate_piix3, d);
pci_conf = d->dev.config;
pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_INTEL);
@@ -330,6 +328,7 @@
.qdev.name = "i440FX",
.qdev.desc = "Host bridge",
.qdev.size = sizeof(PCII440FXState),
+ .qdev.vmsd = &vmstate_i440fx,
.qdev.no_user = 1,
.init = i440fx_initfn,
.config_write = i440fx_write_config,
@@ -337,6 +336,7 @@
.qdev.name = "PIIX3",
.qdev.desc = "ISA bridge",
.qdev.size = sizeof(PIIX3State),
+ .qdev.vmsd = &vmstate_piix3,
.qdev.no_user = 1,
.init = piix3_initfn,
},{
diff --git a/hw/rtl8139.c b/hw/rtl8139.c
index d2a9443..9fd05a8 100644
--- a/hw/rtl8139.c
+++ b/hw/rtl8139.c
@@ -3300,7 +3300,6 @@
qemu_del_timer(s->timer);
qemu_free_timer(s->timer);
#endif
- vmstate_unregister(&vmstate_rtl8139, s);
qemu_del_vlan_client(&s->nic->nc);
return 0;
}
@@ -3348,8 +3347,6 @@
s->cplus_txbuffer_len = 0;
s->cplus_txbuffer_offset = 0;
- vmstate_register(-1, &vmstate_rtl8139, s);
-
#ifdef RTL8139_ONBOARD_TIMER
s->timer = qemu_new_timer(vm_clock, rtl8139_timer, s);
@@ -3371,6 +3368,7 @@
.qdev.name = "rtl8139",
.qdev.size = sizeof(RTL8139State),
.qdev.reset = rtl8139_reset,
+ .qdev.vmsd = &vmstate_rtl8139,
.init = pci_rtl8139_init,
.exit = pci_rtl8139_uninit,
.qdev.props = (Property[]) {
diff --git a/hw/sb16.c b/hw/sb16.c
index 4c0d682..9f4ac50 100644
--- a/hw/sb16.c
+++ b/hw/sb16.c
@@ -1381,7 +1381,6 @@
DMA_register_channel (s->dma, SB_read_DMA, s);
s->can_write = 1;
- vmstate_register (0, &vmstate_sb16, s);
AUD_register_card ("sb16", &s->card);
return 0;
}
@@ -1396,6 +1395,7 @@
.qdev.name = "sb16",
.qdev.desc = "Creative Sound Blaster 16",
.qdev.size = sizeof (SB16State),
+ .qdev.vmsd = &vmstate_sb16,
.init = sb16_initfn,
.qdev.props = (Property[]) {
DEFINE_PROP_HEX32 ("version", SB16State, ver, 0x0405), /* 4.5 */
diff --git a/hw/ssd0303.c b/hw/ssd0303.c
index f60930e..108c068 100644
--- a/hw/ssd0303.c
+++ b/hw/ssd0303.c
@@ -291,13 +291,13 @@
ssd0303_invalidate_display,
NULL, NULL, s);
qemu_console_resize(s->ds, 96 * MAGNIFY, 16 * MAGNIFY);
- vmstate_register(-1, &vmstate_ssd0303, s);
return 0;
}
static I2CSlaveInfo ssd0303_info = {
.qdev.name = "ssd0303",
.qdev.size = sizeof(ssd0303_state),
+ .qdev.vmsd = &vmstate_ssd0303,
.init = ssd0303_init,
.event = ssd0303_event,
.recv = ssd0303_recv,
diff --git a/hw/tmp105.c b/hw/tmp105.c
index 74141b3..8343aff 100644
--- a/hw/tmp105.c
+++ b/hw/tmp105.c
@@ -228,13 +228,13 @@
tmp105_reset(&s->i2c);
- vmstate_register(-1, &vmstate_tmp105, s);
return 0;
}
static I2CSlaveInfo tmp105_info = {
.qdev.name = "tmp105",
.qdev.size = sizeof(TMP105State),
+ .qdev.vmsd = &vmstate_tmp105,
.init = tmp105_init,
.event = tmp105_event,
.recv = tmp105_rx,
diff --git a/hw/twl92230.c b/hw/twl92230.c
index 93232da..b1b2ac9 100644
--- a/hw/twl92230.c
+++ b/hw/twl92230.c
@@ -855,13 +855,13 @@
menelaus_reset(&s->i2c);
- vmstate_register(-1, &vmstate_menelaus, s);
return 0;
}
static I2CSlaveInfo twl92230_info = {
.qdev.name ="twl92230",
.qdev.size = sizeof(MenelausState),
+ .qdev.vmsd = &vmstate_menelaus,
.init = twl92230_init,
.event = menelaus_event,
.recv = menelaus_rx,
diff --git a/hw/usb-uhci.c b/hw/usb-uhci.c
index 671916e..ba26a4e 100644
--- a/hw/usb-uhci.c
+++ b/hw/usb-uhci.c
@@ -1086,7 +1086,6 @@
pci_register_bar(&s->dev, 4, 0x20,
PCI_BASE_ADDRESS_SPACE_IO, uhci_map);
- vmstate_register(0, &vmstate_uhci, s);
return 0;
}
@@ -1114,10 +1113,12 @@
{
.qdev.name = "PIIX3 USB-UHCI",
.qdev.size = sizeof(UHCIState),
+ .qdev.vmsd = &vmstate_uhci,
.init = usb_uhci_piix3_initfn,
},{
.qdev.name = "PIIX4 USB-UHCI",
.qdev.size = sizeof(UHCIState),
+ .qdev.vmsd = &vmstate_uhci,
.init = usb_uhci_piix4_initfn,
},{
/* end of list */
diff --git a/hw/vga-pci.c b/hw/vga-pci.c
index a6ad46b..e8cc024 100644
--- a/hw/vga-pci.c
+++ b/hw/vga-pci.c
@@ -82,7 +82,6 @@
// vga + console init
vga_common_init(s, VGA_RAM_SIZE);
vga_init(s);
- vmstate_register(0, &vmstate_vga_pci, d);
s->ds = graphic_console_init(s->update, s->invalidate,
s->screen_dump, s->text_update, s);
@@ -134,6 +133,7 @@
static PCIDeviceInfo vga_info = {
.qdev.name = "VGA",
.qdev.size = sizeof(PCIVGAState),
+ .qdev.vmsd = &vmstate_vga_pci,
.init = pci_vga_initfn,
.config_write = pci_vga_write_config,
.qdev.props = (Property[]) {
diff --git a/hw/vmware_vga.c b/hw/vmware_vga.c
index bb34101..24ea620 100644
--- a/hw/vmware_vga.c
+++ b/hw/vmware_vga.c
@@ -1189,7 +1189,6 @@
vmsvga_init(&s->chip, VGA_RAM_SIZE);
- vmstate_register(0, &vmstate_vmware_vga, s);
return 0;
}
@@ -1201,6 +1200,7 @@
static PCIDeviceInfo vmsvga_info = {
.qdev.name = "QEMUware SVGA",
.qdev.size = sizeof(struct pci_vmsvga_state_s),
+ .qdev.vmsd = &vmstate_vmware_vga,
.init = pci_vmsvga_initfn,
};
diff --git a/hw/wdt_i6300esb.c b/hw/wdt_i6300esb.c
index 27fa09e..805b302 100644
--- a/hw/wdt_i6300esb.c
+++ b/hw/wdt_i6300esb.c
@@ -416,8 +416,6 @@
pci_register_bar(&d->dev, 0, 0x10,
PCI_BASE_ADDRESS_SPACE_MEMORY, i6300esb_map);
- vmstate_register(-1, &vmstate_i6300esb, d);
-
return 0;
}
@@ -429,6 +427,7 @@
static PCIDeviceInfo i6300esb_info = {
.qdev.name = "i6300esb",
.qdev.size = sizeof(I6300State),
+ .qdev.vmsd = &vmstate_i6300esb,
.config_read = i6300esb_config_read,
.config_write = i6300esb_config_write,
.init = i6300esb_init,
diff --git a/hw/wdt_ib700.c b/hw/wdt_ib700.c
index d67bf9e..c34687b 100644
--- a/hw/wdt_ib700.c
+++ b/hw/wdt_ib700.c
@@ -98,7 +98,6 @@
IB700State *s = DO_UPCAST(IB700State, dev, dev);
s->timer = qemu_new_timer(vm_clock, ib700_timer_expired, s);
- vmstate_register(-1, &vmstate_ib700, s);
register_ioport_write(0x441, 2, 1, ib700_write_disable_reg, s);
register_ioport_write(0x443, 2, 1, ib700_write_enable_reg, s);
@@ -113,6 +112,7 @@
static ISADeviceInfo wdt_ib700_info = {
.qdev.name = "ib700",
.qdev.size = sizeof(IB700State),
+ .qdev.vmsd = &vmstate_ib700,
.init = wdt_ib700_init,
};
diff --git a/hw/wm8750.c b/hw/wm8750.c
index e6a9c06..6064da0 100644
--- a/hw/wm8750.c
+++ b/hw/wm8750.c
@@ -622,7 +622,6 @@
AUD_register_card(CODEC, &s->card);
wm8750_reset(&s->i2c);
- vmstate_register(-1, &vmstate_wm8750, s);
return 0;
}
@@ -699,6 +698,7 @@
static I2CSlaveInfo wm8750_info = {
.qdev.name = "wm8750",
.qdev.size = sizeof(WM8750State),
+ .qdev.vmsd = &vmstate_wm8750,
.init = wm8750_init,
.event = wm8750_event,
.recv = wm8750_rx,