summaryrefslogtreecommitdiff
path: root/hw/usb-hub.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2010-12-15 12:45:24 +0100
committerGerd Hoffmann <kraxel@redhat.com>2011-01-24 17:21:34 +0100
commitf485306e6a3d8b08dc97ae12cbaf11c018891cd7 (patch)
treeaaa52156ba14affc9db073cb58d4a324a467386c /hw/usb-hub.c
parent3f213780f834e6d2e1083a1f9036a1bf11923274 (diff)
downloadqemu-f485306e6a3d8b08dc97ae12cbaf11c018891cd7.tar.gz
qemu-f485306e6a3d8b08dc97ae12cbaf11c018891cd7.tar.bz2
qemu-f485306e6a3d8b08dc97ae12cbaf11c018891cd7.zip
usb hub: add migration support
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/usb-hub.c')
-rw-r--r--hw/usb-hub.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/hw/usb-hub.c b/hw/usb-hub.c
index 78698caf67..3dd31ba31f 100644
--- a/hw/usb-hub.c
+++ b/hw/usb-hub.c
@@ -544,11 +544,35 @@ static int usb_hub_initfn(USBDevice *dev)
return 0;
}
+static const VMStateDescription vmstate_usb_hub_port = {
+ .name = "usb-hub-port",
+ .version_id = 1,
+ .minimum_version_id = 1,
+ .fields = (VMStateField []) {
+ VMSTATE_UINT16(wPortStatus, USBHubPort),
+ VMSTATE_UINT16(wPortChange, USBHubPort),
+ VMSTATE_END_OF_LIST()
+ }
+};
+
+static const VMStateDescription vmstate_usb_hub = {
+ .name = "usb-hub",
+ .version_id = 1,
+ .minimum_version_id = 1,
+ .fields = (VMStateField []) {
+ VMSTATE_USB_DEVICE(dev, USBHubState),
+ VMSTATE_STRUCT_ARRAY(ports, USBHubState, NUM_PORTS, 0,
+ vmstate_usb_hub_port, USBHubPort),
+ VMSTATE_END_OF_LIST()
+ }
+};
+
static struct USBDeviceInfo hub_info = {
.product_desc = "QEMU USB Hub",
.qdev.name = "usb-hub",
.qdev.fw_name = "hub",
.qdev.size = sizeof(USBHubState),
+ .qdev.vmsd = &vmstate_usb_hub,
.usb_desc = &desc_hub,
.init = usb_hub_initfn,
.handle_packet = usb_hub_handle_packet,