Changeset View
Changeset View
Standalone View
Standalone View
head/usr.sbin/bhyve/pci_xhci.c
Show First 20 Lines • Show All 2,620 Lines • ▼ Show 20 Lines | |||||
{ | { | ||||
struct pci_xhci_dev_emu **devices; | struct pci_xhci_dev_emu **devices; | ||||
struct pci_xhci_dev_emu *dev; | struct pci_xhci_dev_emu *dev; | ||||
struct usb_devemu *ue; | struct usb_devemu *ue; | ||||
void *devsc; | void *devsc; | ||||
char *uopt, *xopts, *config; | char *uopt, *xopts, *config; | ||||
int usb3_port, usb2_port, i; | int usb3_port, usb2_port, i; | ||||
uopt = NULL; | |||||
usb3_port = sc->usb3_port_start - 1; | usb3_port = sc->usb3_port_start - 1; | ||||
usb2_port = sc->usb2_port_start - 1; | usb2_port = sc->usb2_port_start - 1; | ||||
devices = NULL; | devices = NULL; | ||||
if (opts == NULL) | if (opts == NULL) | ||||
goto portsfinal; | goto portsfinal; | ||||
devices = calloc(XHCI_MAX_DEVS, sizeof(struct pci_xhci_dev_emu *)); | devices = calloc(XHCI_MAX_DEVS, sizeof(struct pci_xhci_dev_emu *)); | ||||
▲ Show 20 Lines • Show All 58 Lines • ▼ Show 20 Lines | for (xopts = strtok(uopt, ","); | ||||
dev->dev_ue = ue; | dev->dev_ue = ue; | ||||
dev->dev_sc = devsc; | dev->dev_sc = devsc; | ||||
/* assign slot number to device */ | /* assign slot number to device */ | ||||
sc->slots[sc->ndevices] = dev; | sc->slots[sc->ndevices] = dev; | ||||
sc->ndevices++; | sc->ndevices++; | ||||
} | } | ||||
if (uopt != NULL) | |||||
free(uopt); | |||||
portsfinal: | portsfinal: | ||||
sc->portregs = calloc(XHCI_MAX_DEVS, sizeof(struct pci_xhci_portregs)); | sc->portregs = calloc(XHCI_MAX_DEVS, sizeof(struct pci_xhci_portregs)); | ||||
if (sc->ndevices > 0) { | if (sc->ndevices > 0) { | ||||
/* port and slot numbering start from 1 */ | /* port and slot numbering start from 1 */ | ||||
sc->devices--; | sc->devices--; | ||||
sc->portregs--; | sc->portregs--; | ||||
▲ Show 20 Lines • Show All 127 Lines • Show Last 20 Lines |