Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/usb/controller/xhci.c
Show First 20 Lines • Show All 2,392 Lines • ▼ Show 20 Lines | xhci_configure_endpoint(struct usb_device *udev, | ||||
max_packet_count--; | max_packet_count--; | ||||
if (mult == 0) | if (mult == 0) | ||||
return (USB_ERR_BAD_BUFSIZE); | return (USB_ERR_BAD_BUFSIZE); | ||||
/* store endpoint mode */ | /* store endpoint mode */ | ||||
pepext->trb_ep_mode = ep_mode; | pepext->trb_ep_mode = ep_mode; | ||||
/* store bMaxPacketSize for control endpoints */ | |||||
pepext->trb_ep_maxp = edesc->wMaxPacketSize[0]; | |||||
usb_pc_cpu_flush(pepext->page_cache); | usb_pc_cpu_flush(pepext->page_cache); | ||||
if (ep_mode == USB_EP_MODE_STREAMS) { | if (ep_mode == USB_EP_MODE_STREAMS) { | ||||
temp = XHCI_EPCTX_0_EPSTATE_SET(0) | | temp = XHCI_EPCTX_0_EPSTATE_SET(0) | | ||||
XHCI_EPCTX_0_MAXP_STREAMS_SET(XHCI_MAX_STREAMS_LOG - 1) | | XHCI_EPCTX_0_MAXP_STREAMS_SET(XHCI_MAX_STREAMS_LOG - 1) | | ||||
XHCI_EPCTX_0_LSA_SET(1); | XHCI_EPCTX_0_LSA_SET(1); | ||||
ring_addr += sizeof(struct xhci_trb) * | ring_addr += sizeof(struct xhci_trb) * | ||||
▲ Show 20 Lines • Show All 513 Lines • ▼ Show 20 Lines | default: | ||||
break; | break; | ||||
} | } | ||||
if (pepext->trb_used[id] >= trb_limit) { | if (pepext->trb_used[id] >= trb_limit) { | ||||
DPRINTFN(8, "Too many TDs queued.\n"); | DPRINTFN(8, "Too many TDs queued.\n"); | ||||
return (USB_ERR_NOMEM); | return (USB_ERR_NOMEM); | ||||
} | } | ||||
/* check if bMaxPacketSize changed */ | |||||
if (xfer->flags_int.control_xfr != 0 && | |||||
pepext->trb_ep_maxp != xfer->endpoint->edesc->wMaxPacketSize[0]) { | |||||
DPRINTFN(8, "Reconfigure control endpoint\n"); | |||||
/* force driver to reconfigure endpoint */ | |||||
pepext->trb_halted = 1; | |||||
pepext->trb_running = 0; | |||||
} | |||||
/* check for stopped condition, after putting transfer on interrupt queue */ | /* check for stopped condition, after putting transfer on interrupt queue */ | ||||
if (pepext->trb_running == 0) { | if (pepext->trb_running == 0) { | ||||
struct xhci_softc *sc = XHCI_BUS2SC(xfer->xroot->bus); | struct xhci_softc *sc = XHCI_BUS2SC(xfer->xroot->bus); | ||||
DPRINTFN(8, "Not running\n"); | DPRINTFN(8, "Not running\n"); | ||||
/* start configuration */ | /* start configuration */ | ||||
(void)usb_proc_msignal(USB_BUS_CONTROL_XFER_PROC(&sc->sc_bus), | (void)usb_proc_msignal(USB_BUS_CONTROL_XFER_PROC(&sc->sc_bus), | ||||
▲ Show 20 Lines • Show All 961 Lines • ▼ Show 20 Lines | xhci_configure_reset_endpoint(struct usb_xfer *xfer) | ||||
*/ | */ | ||||
mask = (1U << epno); | mask = (1U << epno); | ||||
xhci_configure_mask(udev, mask | 1U, 0); | xhci_configure_mask(udev, mask | 1U, 0); | ||||
if (!(sc->sc_hw.devs[index].ep_configured & mask)) { | if (!(sc->sc_hw.devs[index].ep_configured & mask)) { | ||||
sc->sc_hw.devs[index].ep_configured |= mask; | sc->sc_hw.devs[index].ep_configured |= mask; | ||||
err = xhci_cmd_configure_ep(sc, buf_inp.physaddr, 0, index); | err = xhci_cmd_configure_ep(sc, buf_inp.physaddr, 0, index); | ||||
} else { | } else if (epno != 1) { | ||||
err = xhci_cmd_evaluate_ctx(sc, buf_inp.physaddr, index); | err = xhci_cmd_evaluate_ctx(sc, buf_inp.physaddr, index); | ||||
} else { | |||||
err = 0; | |||||
} | } | ||||
if (err != 0) { | if (err != 0) { | ||||
DPRINTF("Could not configure " | DPRINTF("Could not configure " | ||||
"endpoint %u at slot %u.\n", epno, index); | "endpoint %u at slot %u.\n", epno, index); | ||||
} | } | ||||
XHCI_CMD_UNLOCK(sc); | XHCI_CMD_UNLOCK(sc); | ||||
▲ Show 20 Lines • Show All 469 Lines • Show Last 20 Lines |