mirror of https://github.com/xqemu/xqemu.git
vga: port vga-pci to vmstate
Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
f74599c499
commit
a4f9631cee
34
hw/vga-pci.c
34
hw/vga-pci.c
|
@ -34,29 +34,17 @@ typedef struct PCIVGAState {
|
||||||
VGACommonState vga;
|
VGACommonState vga;
|
||||||
} PCIVGAState;
|
} PCIVGAState;
|
||||||
|
|
||||||
static void pci_vga_save(QEMUFile *f, void *opaque)
|
static const VMStateDescription vmstate_vga_pci = {
|
||||||
{
|
.name = "vga",
|
||||||
PCIVGAState *s = opaque;
|
.version_id = 2,
|
||||||
|
.minimum_version_id = 2,
|
||||||
pci_device_save(&s->dev, f);
|
.minimum_version_id_old = 2,
|
||||||
vga_common_save(f, &s->vga);
|
.fields = (VMStateField []) {
|
||||||
}
|
VMSTATE_PCI_DEVICE(dev, PCIVGAState),
|
||||||
|
VMSTATE_STRUCT(vga, PCIVGAState, 0, vmstate_vga_common, VGACommonState),
|
||||||
static int pci_vga_load(QEMUFile *f, void *opaque, int version_id)
|
VMSTATE_END_OF_LIST()
|
||||||
{
|
|
||||||
PCIVGAState *s = opaque;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
if (version_id > 2)
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
if (version_id >= 2) {
|
|
||||||
ret = pci_device_load(&s->dev, f);
|
|
||||||
if (ret < 0)
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
return vga_common_load(f, &s->vga, version_id);
|
};
|
||||||
}
|
|
||||||
|
|
||||||
static void vga_map(PCIDevice *pci_dev, int region_num,
|
static void vga_map(PCIDevice *pci_dev, int region_num,
|
||||||
uint32_t addr, uint32_t size, int type)
|
uint32_t addr, uint32_t size, int type)
|
||||||
|
@ -93,7 +81,7 @@ static int pci_vga_initfn(PCIDevice *dev)
|
||||||
// vga + console init
|
// vga + console init
|
||||||
vga_common_init(s, VGA_RAM_SIZE);
|
vga_common_init(s, VGA_RAM_SIZE);
|
||||||
vga_init(s);
|
vga_init(s);
|
||||||
register_savevm("vga", 0, 2, pci_vga_save, pci_vga_load, d);
|
vmstate_register(0, &vmstate_vga_pci, d);
|
||||||
|
|
||||||
s->ds = graphic_console_init(s->update, s->invalidate,
|
s->ds = graphic_console_init(s->update, s->invalidate,
|
||||||
s->screen_dump, s->text_update, s);
|
s->screen_dump, s->text_update, s);
|
||||||
|
|
Loading…
Reference in New Issue