Changeset View
Changeset View
Standalone View
Standalone View
usr.sbin/bhyve/pci_xhci.c
Show First 20 Lines • Show All 2,964 Lines • ▼ Show 20 Lines | pci_xhci_snapshot(struct vm_snapshot_meta *meta) | ||||
SNAPSHOT_VAR_OR_LEAVE(sc->hcsparams3, meta, ret, done); | SNAPSHOT_VAR_OR_LEAVE(sc->hcsparams3, meta, ret, done); | ||||
SNAPSHOT_VAR_OR_LEAVE(sc->hccparams1, meta, ret, done); | SNAPSHOT_VAR_OR_LEAVE(sc->hccparams1, meta, ret, done); | ||||
SNAPSHOT_VAR_OR_LEAVE(sc->dboff, meta, ret, done); | SNAPSHOT_VAR_OR_LEAVE(sc->dboff, meta, ret, done); | ||||
SNAPSHOT_VAR_OR_LEAVE(sc->rtsoff, meta, ret, done); | SNAPSHOT_VAR_OR_LEAVE(sc->rtsoff, meta, ret, done); | ||||
SNAPSHOT_VAR_OR_LEAVE(sc->hccparams2, meta, ret, done); | SNAPSHOT_VAR_OR_LEAVE(sc->hccparams2, meta, ret, done); | ||||
SNAPSHOT_VAR_OR_LEAVE(sc->regsend, meta, ret, done); | SNAPSHOT_VAR_OR_LEAVE(sc->regsend, meta, ret, done); | ||||
/* opregs */ | /* opregs */ | ||||
SNAPSHOT_ADD_INTERN_ARR(opregs, meta); | |||||
SNAPSHOT_VAR_OR_LEAVE(sc->opregs.usbcmd, meta, ret, done); | SNAPSHOT_VAR_OR_LEAVE(sc->opregs.usbcmd, meta, ret, done); | ||||
SNAPSHOT_VAR_OR_LEAVE(sc->opregs.usbsts, meta, ret, done); | SNAPSHOT_VAR_OR_LEAVE(sc->opregs.usbsts, meta, ret, done); | ||||
SNAPSHOT_VAR_OR_LEAVE(sc->opregs.pgsz, meta, ret, done); | SNAPSHOT_VAR_OR_LEAVE(sc->opregs.pgsz, meta, ret, done); | ||||
SNAPSHOT_VAR_OR_LEAVE(sc->opregs.dnctrl, meta, ret, done); | SNAPSHOT_VAR_OR_LEAVE(sc->opregs.dnctrl, meta, ret, done); | ||||
SNAPSHOT_VAR_OR_LEAVE(sc->opregs.crcr, meta, ret, done); | SNAPSHOT_VAR_OR_LEAVE(sc->opregs.crcr, meta, ret, done); | ||||
SNAPSHOT_VAR_OR_LEAVE(sc->opregs.dcbaap, meta, ret, done); | SNAPSHOT_VAR_OR_LEAVE(sc->opregs.dcbaap, meta, ret, done); | ||||
SNAPSHOT_VAR_OR_LEAVE(sc->opregs.config, meta, ret, done); | SNAPSHOT_VAR_OR_LEAVE(sc->opregs.config, meta, ret, done); | ||||
Show All 24 Lines | pci_xhci_snapshot(struct vm_snapshot_meta *meta) | ||||
SNAPSHOT_GUEST2HOST_ADDR_OR_LEAVE(sc->rtsregs.erst_p, | SNAPSHOT_GUEST2HOST_ADDR_OR_LEAVE(sc->rtsregs.erst_p, | ||||
XHCI_GADDR_SIZE(sc->rtsregs.erst_p), true, meta, ret, done); | XHCI_GADDR_SIZE(sc->rtsregs.erst_p), true, meta, ret, done); | ||||
SNAPSHOT_VAR_OR_LEAVE(sc->rtsregs.er_deq_seg, meta, ret, done); | SNAPSHOT_VAR_OR_LEAVE(sc->rtsregs.er_deq_seg, meta, ret, done); | ||||
SNAPSHOT_VAR_OR_LEAVE(sc->rtsregs.er_enq_idx, meta, ret, done); | SNAPSHOT_VAR_OR_LEAVE(sc->rtsregs.er_enq_idx, meta, ret, done); | ||||
SNAPSHOT_VAR_OR_LEAVE(sc->rtsregs.er_enq_seg, meta, ret, done); | SNAPSHOT_VAR_OR_LEAVE(sc->rtsregs.er_enq_seg, meta, ret, done); | ||||
SNAPSHOT_VAR_OR_LEAVE(sc->rtsregs.er_events_cnt, meta, ret, done); | SNAPSHOT_VAR_OR_LEAVE(sc->rtsregs.er_events_cnt, meta, ret, done); | ||||
SNAPSHOT_VAR_OR_LEAVE(sc->rtsregs.event_pcs, meta, ret, done); | SNAPSHOT_VAR_OR_LEAVE(sc->rtsregs.event_pcs, meta, ret, done); | ||||
SNAPSHOT_REMOVE_INTERN_ARR(opregs, meta); | |||||
/* sanity checking */ | /* sanity checking */ | ||||
SNAPSHOT_ADD_INTERN_ARR(sanity_checks, meta); | |||||
for (i = 1; i <= XHCI_MAX_DEVS; i++) { | for (i = 1; i <= XHCI_MAX_DEVS; i++) { | ||||
dev = XHCI_DEVINST_PTR(sc, i); | dev = XHCI_DEVINST_PTR(sc, i); | ||||
if (dev == NULL) | if (dev == NULL) | ||||
continue; | continue; | ||||
if (meta->op == VM_SNAPSHOT_SAVE) | if (meta->op == VM_SNAPSHOT_SAVE) | ||||
restore_idx = i; | restore_idx = i; | ||||
SNAPSHOT_VAR_OR_LEAVE(restore_idx, meta, ret, done); | SNAPSHOT_VAR_OR_LEAVE(restore_idx, meta, ret, done); | ||||
Show All 20 Lines | if (meta->op == VM_SNAPSHOT_RESTORE) { | ||||
"actual: %s, expected: %s\r\n", | "actual: %s, expected: %s\r\n", | ||||
__func__, dname, dev->dev_ue->ue_emu); | __func__, dname, dev->dev_ue->ue_emu); | ||||
ret = EINVAL; | ret = EINVAL; | ||||
goto done; | goto done; | ||||
} | } | ||||
} | } | ||||
} | } | ||||
SNAPSHOT_REMOVE_INTERN_ARR(sanity_checks, meta); | |||||
/* portregs */ | /* portregs */ | ||||
SNAPSHOT_ADD_INTERN_ARR(portregs, meta); | |||||
for (i = 1; i <= XHCI_MAX_DEVS; i++) { | for (i = 1; i <= XHCI_MAX_DEVS; i++) { | ||||
port = XHCI_PORTREG_PTR(sc, i); | port = XHCI_PORTREG_PTR(sc, i); | ||||
dev = XHCI_DEVINST_PTR(sc, i); | dev = XHCI_DEVINST_PTR(sc, i); | ||||
if (dev == NULL) | if (dev == NULL) | ||||
continue; | continue; | ||||
SNAPSHOT_VAR_OR_LEAVE(port->portsc, meta, ret, done); | SNAPSHOT_VAR_OR_LEAVE(port->portsc, meta, ret, done); | ||||
SNAPSHOT_VAR_OR_LEAVE(port->portpmsc, meta, ret, done); | SNAPSHOT_VAR_OR_LEAVE(port->portpmsc, meta, ret, done); | ||||
SNAPSHOT_VAR_OR_LEAVE(port->portli, meta, ret, done); | SNAPSHOT_VAR_OR_LEAVE(port->portli, meta, ret, done); | ||||
SNAPSHOT_VAR_OR_LEAVE(port->porthlpmc, meta, ret, done); | SNAPSHOT_VAR_OR_LEAVE(port->porthlpmc, meta, ret, done); | ||||
} | } | ||||
SNAPSHOT_REMOVE_INTERN_ARR(portregs, meta); | |||||
/* slots */ | /* slots */ | ||||
SNAPSHOT_ADD_INTERN_ARR(slots, meta); | |||||
if (meta->op == VM_SNAPSHOT_SAVE) | if (meta->op == VM_SNAPSHOT_SAVE) | ||||
pci_xhci_map_devs_slots(sc, maps); | pci_xhci_map_devs_slots(sc, maps); | ||||
for (i = 1; i <= XHCI_MAX_SLOTS; i++) { | for (i = 1; i <= XHCI_MAX_SLOTS; i++) { | ||||
SNAPSHOT_VAR_OR_LEAVE(maps[i], meta, ret, done); | SNAPSHOT_VAR_OR_LEAVE(maps[i], meta, ret, done); | ||||
if (meta->op == VM_SNAPSHOT_SAVE) { | if (meta->op == VM_SNAPSHOT_SAVE) { | ||||
dev = XHCI_SLOTDEV_PTR(sc, i); | dev = XHCI_SLOTDEV_PTR(sc, i); | ||||
Show All 28 Lines | for (i = 1; i <= XHCI_MAX_SLOTS; i++) { | ||||
/* devices[i]->dev_sc */ | /* devices[i]->dev_sc */ | ||||
dev->dev_ue->ue_snapshot(dev->dev_sc, meta); | dev->dev_ue->ue_snapshot(dev->dev_sc, meta); | ||||
/* devices[i]->hci */ | /* devices[i]->hci */ | ||||
SNAPSHOT_VAR_OR_LEAVE(dev->hci.hci_address, meta, ret, done); | SNAPSHOT_VAR_OR_LEAVE(dev->hci.hci_address, meta, ret, done); | ||||
SNAPSHOT_VAR_OR_LEAVE(dev->hci.hci_port, meta, ret, done); | SNAPSHOT_VAR_OR_LEAVE(dev->hci.hci_port, meta, ret, done); | ||||
} | } | ||||
SNAPSHOT_REMOVE_INTERN_ARR(slots, meta); | |||||
SNAPSHOT_VAR_OR_LEAVE(sc->ndevices, meta, ret, done); | SNAPSHOT_VAR_OR_LEAVE(sc->ndevices, meta, ret, done); | ||||
SNAPSHOT_VAR_OR_LEAVE(sc->usb2_port_start, meta, ret, done); | SNAPSHOT_VAR_OR_LEAVE(sc->usb2_port_start, meta, ret, done); | ||||
SNAPSHOT_VAR_OR_LEAVE(sc->usb3_port_start, meta, ret, done); | SNAPSHOT_VAR_OR_LEAVE(sc->usb3_port_start, meta, ret, done); | ||||
done: | done: | ||||
return (ret); | return (ret); | ||||
} | } | ||||
Show All 12 Lines |