From 9316ff6b707ac6a7146daed2609edd1734792dcc Mon Sep 17 00:00:00 2001 From: Rostislav Lisovy Date: Fri, 3 Feb 2012 17:33:26 +0100 Subject: [PATCH] apohw: Added VM state descriptions. --- hw/apohw.c | 42 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 3 deletions(-) diff --git a/hw/apohw.c b/hw/apohw.c index 29c6149e1..ff85df903 100644 --- a/hw/apohw.c +++ b/hw/apohw.c @@ -16,14 +16,22 @@ #define PCI_VENDOR_ID_ALTERA 0x1172 #define PCI_DEVICE_ID_ALTERA_CORPORATION_DEVICE 0x1f32 +typedef struct apohw_state_t { + uint8_t emul_bus_ctrl; + uint8_t emul_bus_data_out; + uint8_t emul_bus_data_in; +} apohw_state_t; typedef struct { PCIDevice dev; -} apohw_state_t; + apohw_state_t apohw; +} apohw_pci_state_t; +/* ------------------------------------------------------------------------- */ static int pci_apohw_init(PCIDevice *pci_dev) { + printf("apohw started\n"); return 0; } @@ -32,6 +40,34 @@ static int pci_apohw_exit(PCIDevice *pci_dev) return 0; } +const VMStateDescription apohw_vmsd = { + .name = "apohw", + .version_id = 2, // Wut? + .minimum_version_id = 0, + .minimum_version_id_old = 0, + .fields = (VMStateField []) { + VMSTATE_UNUSED(0x8040), + VMSTATE_UINT8(emul_bus_ctrl, apohw_state_t), + VMSTATE_UNUSED(0x20), + VMSTATE_UINT8(emul_bus_data_out, apohw_state_t), + VMSTATE_UNUSED(0x20), + VMSTATE_UINT8(emul_bus_data_in, apohw_state_t), + VMSTATE_END_OF_LIST() + } +}; + +static const VMStateDescription apohw_pci_vmsd = { + .name = "apohw", + .version_id = 3, // Wat? + .minimum_version_id = 3, + .minimum_version_id_old = 3, + .fields = (VMStateField[]) { + VMSTATE_PCI_DEVICE(dev, apohw_pci_state_t), + VMSTATE_STRUCT(apohw, apohw_pci_state_t, 0, apohw_vmsd, apohw_state_t), + VMSTATE_END_OF_LIST() + } +}; + static void apohw_class_init(ObjectClass *klass, void *data) { PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); @@ -45,8 +81,8 @@ static void apohw_class_init(ObjectClass *klass, void *data) static DeviceInfo apohw_info = { .name = "apohw", - .size = sizeof(apohw_state_t), -// .vmsd = apohw_vmsd, + .size = sizeof(apohw_pci_state_t), + .vmsd = &apohw_pci_vmsd, .class_init = apohw_class_init, }; -- 2.39.2