Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/usb/controller/xhci.c
Show First 20 Lines • Show All 3,802 Lines • ▼ Show 20 Lines | alloc_dma_set: | ||||
xfer->td_start[xfer->flags_int.curr_dma_set] = last_obj; | xfer->td_start[xfer->flags_int.curr_dma_set] = last_obj; | ||||
if (!xfer->flags_int.curr_dma_set) { | if (!xfer->flags_int.curr_dma_set) { | ||||
xfer->flags_int.curr_dma_set = 1; | xfer->flags_int.curr_dma_set = 1; | ||||
goto alloc_dma_set; | goto alloc_dma_set; | ||||
} | } | ||||
} | } | ||||
static uint8_t | |||||
xhci_get_endpoint_state(struct usb_device *udev, uint8_t epno) | |||||
{ | |||||
struct xhci_softc *sc = XHCI_BUS2SC(udev->bus); | |||||
struct usb_page_search buf_dev; | |||||
struct xhci_hw_dev *hdev; | |||||
struct xhci_dev_ctx *pdev; | |||||
uint32_t temp; | |||||
MPASS(epno != 0); | |||||
hdev = &sc->sc_hw.devs[udev->controller_slot_id]; | |||||
usbd_get_page(&hdev->device_pc, 0, &buf_dev); | |||||
pdev = buf_dev.buffer; | |||||
usb_pc_cpu_invalidate(&hdev->device_pc); | |||||
temp = xhci_ctx_get_le32(sc, &pdev->ctx_ep[epno - 1].dwEpCtx0); | |||||
return (XHCI_EPCTX_0_EPSTATE_GET(temp)); | |||||
} | |||||
static usb_error_t | static usb_error_t | ||||
xhci_configure_reset_endpoint(struct usb_xfer *xfer) | xhci_configure_reset_endpoint(struct usb_xfer *xfer) | ||||
{ | { | ||||
struct xhci_softc *sc = XHCI_BUS2SC(xfer->xroot->bus); | struct xhci_softc *sc = XHCI_BUS2SC(xfer->xroot->bus); | ||||
struct usb_page_search buf_inp; | struct usb_page_search buf_inp; | ||||
struct usb_device *udev; | struct usb_device *udev; | ||||
struct xhci_endpoint_ext *pepext; | struct xhci_endpoint_ext *pepext; | ||||
struct usb_endpoint_descriptor *edesc; | struct usb_endpoint_descriptor *edesc; | ||||
Show All 37 Lines | if (err != 0) { | ||||
XHCI_CMD_UNLOCK(sc); | XHCI_CMD_UNLOCK(sc); | ||||
return (err); | return (err); | ||||
} | } | ||||
/* | /* | ||||
* Get the endpoint into the stopped state according to the | * Get the endpoint into the stopped state according to the | ||||
* endpoint context state diagram in the XHCI specification: | * endpoint context state diagram in the XHCI specification: | ||||
*/ | */ | ||||
switch (xhci_get_endpoint_state(udev, epno)) { | |||||
err = xhci_cmd_stop_ep(sc, 0, epno, index); | case XHCI_EPCTX_0_EPSTATE_STOPPED: | ||||
break; | |||||
if (err != 0) | case XHCI_EPCTX_0_EPSTATE_HALTED: | ||||
DPRINTF("Could not stop endpoint %u\n", epno); | |||||
err = xhci_cmd_reset_ep(sc, 0, epno, index); | err = xhci_cmd_reset_ep(sc, 0, epno, index); | ||||
if (err != 0) | if (err != 0) | ||||
DPRINTF("Could not reset endpoint %u\n", epno); | DPRINTF("Could not reset endpoint %u\n", epno); | ||||
break; | |||||
default: | |||||
err = xhci_cmd_stop_ep(sc, 0, epno, index); | |||||
if (err != 0) | |||||
DPRINTF("Could not stop endpoint %u\n", epno); | |||||
break; | |||||
} | |||||
err = xhci_cmd_set_tr_dequeue_ptr(sc, | err = xhci_cmd_set_tr_dequeue_ptr(sc, | ||||
(pepext->physaddr + (stream_id * sizeof(struct xhci_trb) * | (pepext->physaddr + (stream_id * sizeof(struct xhci_trb) * | ||||
XHCI_MAX_TRANSFERS)) | XHCI_EPCTX_2_DCS_SET(1), | XHCI_MAX_TRANSFERS)) | XHCI_EPCTX_2_DCS_SET(1), | ||||
stream_id, epno, index); | stream_id, epno, index); | ||||
if (err != 0) | if (err != 0) | ||||
DPRINTF("Could not set dequeue ptr for endpoint %u\n", epno); | DPRINTF("Could not set dequeue ptr for endpoint %u\n", epno); | ||||
▲ Show 20 Lines • Show All 491 Lines • Show Last 20 Lines |