usb-uhci: Add num_ports_vmstate to UHCIState
Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
5989020bc1
commit
64e58fe5c1
|
@ -139,6 +139,7 @@ typedef struct UHCIState {
|
||||||
/* Active packets */
|
/* Active packets */
|
||||||
UHCIAsync *async_pending;
|
UHCIAsync *async_pending;
|
||||||
UHCIAsync *async_pool;
|
UHCIAsync *async_pool;
|
||||||
|
uint8_t num_ports_vmstate;
|
||||||
} UHCIState;
|
} UHCIState;
|
||||||
|
|
||||||
typedef struct UHCI_TD {
|
typedef struct UHCI_TD {
|
||||||
|
@ -353,15 +354,14 @@ static void uhci_reset(void *opaque)
|
||||||
static void uhci_save(QEMUFile *f, void *opaque)
|
static void uhci_save(QEMUFile *f, void *opaque)
|
||||||
{
|
{
|
||||||
UHCIState *s = opaque;
|
UHCIState *s = opaque;
|
||||||
uint8_t num_ports = NB_PORTS;
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
uhci_async_cancel_all(s);
|
uhci_async_cancel_all(s);
|
||||||
|
|
||||||
pci_device_save(&s->dev, f);
|
pci_device_save(&s->dev, f);
|
||||||
|
|
||||||
qemu_put_8s(f, &num_ports);
|
qemu_put_8s(f, &s->num_ports_vmstate);
|
||||||
for (i = 0; i < num_ports; ++i)
|
for (i = 0; i < s->num_ports_vmstate; ++i)
|
||||||
qemu_put_be16s(f, &s->ports[i].ctrl);
|
qemu_put_be16s(f, &s->ports[i].ctrl);
|
||||||
qemu_put_be16s(f, &s->cmd);
|
qemu_put_be16s(f, &s->cmd);
|
||||||
qemu_put_be16s(f, &s->status);
|
qemu_put_be16s(f, &s->status);
|
||||||
|
@ -376,7 +376,6 @@ static void uhci_save(QEMUFile *f, void *opaque)
|
||||||
static int uhci_load(QEMUFile *f, void *opaque, int version_id)
|
static int uhci_load(QEMUFile *f, void *opaque, int version_id)
|
||||||
{
|
{
|
||||||
UHCIState *s = opaque;
|
UHCIState *s = opaque;
|
||||||
uint8_t num_ports;
|
|
||||||
int i, ret;
|
int i, ret;
|
||||||
|
|
||||||
if (version_id > 1)
|
if (version_id > 1)
|
||||||
|
@ -386,11 +385,11 @@ static int uhci_load(QEMUFile *f, void *opaque, int version_id)
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
qemu_get_8s(f, &num_ports);
|
qemu_get_8s(f, &s->num_ports_vmstate);
|
||||||
if (num_ports != NB_PORTS)
|
if (s->num_ports_vmstate != NB_PORTS)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
for (i = 0; i < num_ports; ++i)
|
for (i = 0; i < s->num_ports_vmstate; ++i)
|
||||||
qemu_get_be16s(f, &s->ports[i].ctrl);
|
qemu_get_be16s(f, &s->ports[i].ctrl);
|
||||||
qemu_get_be16s(f, &s->cmd);
|
qemu_get_be16s(f, &s->cmd);
|
||||||
qemu_get_be16s(f, &s->status);
|
qemu_get_be16s(f, &s->status);
|
||||||
|
@ -1088,6 +1087,7 @@ static int usb_uhci_common_initfn(UHCIState *s)
|
||||||
usb_register_port(&s->bus, &s->ports[i].port, s, i, uhci_attach);
|
usb_register_port(&s->bus, &s->ports[i].port, s, i, uhci_attach);
|
||||||
}
|
}
|
||||||
s->frame_timer = qemu_new_timer(vm_clock, uhci_frame_timer, s);
|
s->frame_timer = qemu_new_timer(vm_clock, uhci_frame_timer, s);
|
||||||
|
s->num_ports_vmstate = NB_PORTS;
|
||||||
|
|
||||||
qemu_register_reset(uhci_reset, s);
|
qemu_register_reset(uhci_reset, s);
|
||||||
uhci_reset(s);
|
uhci_reset(s);
|
||||||
|
|
Loading…
Reference in a new issue