Lines Matching refs:xfer
688 xhci_generic_done_sub(struct usb_xfer *xfer) in xhci_generic_done_sub() argument
695 td = xfer->td_transfer_cache; in xhci_generic_done_sub()
698 if (xfer->aframes != xfer->nframes) in xhci_generic_done_sub()
699 usbd_xfer_set_frame_len(xfer, xfer->aframes, 0); in xhci_generic_done_sub()
709 xfer, (unsigned int)xfer->aframes, in xhci_generic_done_sub()
710 (unsigned int)xfer->nframes, in xhci_generic_done_sub()
723 } else if (xfer->aframes != xfer->nframes) { in xhci_generic_done_sub()
724 xfer->frlengths[xfer->aframes] += td->len - len; in xhci_generic_done_sub()
727 if (((void *)td) == xfer->td_transfer_last) { in xhci_generic_done_sub()
740 if (xfer->flags_int.short_frames_ok || in xhci_generic_done_sub()
741 xfer->flags_int.isochronous_xfr || in xhci_generic_done_sub()
742 xfer->flags_int.control_xfr) { in xhci_generic_done_sub()
761 xfer->td_transfer_cache = td; in xhci_generic_done_sub()
770 xhci_generic_done(struct usb_xfer *xfer) in xhci_generic_done() argument
775 xfer, xfer->endpoint); in xhci_generic_done()
779 xfer->td_transfer_cache = xfer->td_transfer_first; in xhci_generic_done()
781 if (xfer->flags_int.control_xfr) { in xhci_generic_done()
783 if (xfer->flags_int.control_hdr) in xhci_generic_done()
784 err = xhci_generic_done_sub(xfer); in xhci_generic_done()
786 xfer->aframes = 1; in xhci_generic_done()
788 if (xfer->td_transfer_cache == NULL) in xhci_generic_done()
792 while (xfer->aframes != xfer->nframes) { in xhci_generic_done()
794 err = xhci_generic_done_sub(xfer); in xhci_generic_done()
795 xfer->aframes++; in xhci_generic_done()
797 if (xfer->td_transfer_cache == NULL) in xhci_generic_done()
801 if (xfer->flags_int.control_xfr && in xhci_generic_done()
802 !xfer->flags_int.control_act) in xhci_generic_done()
803 err = xhci_generic_done_sub(xfer); in xhci_generic_done()
806 xhci_device_done(xfer, err); in xhci_generic_done()
810 xhci_activate_transfer(struct usb_xfer *xfer) in xhci_activate_transfer() argument
814 td = xfer->td_transfer_cache; in xhci_activate_transfer()
823 xhci_endpoint_doorbell(xfer); in xhci_activate_transfer()
828 xhci_skip_transfer(struct usb_xfer *xfer) in xhci_skip_transfer() argument
833 td = xfer->td_transfer_cache; in xhci_skip_transfer()
834 td_last = xfer->td_transfer_last; in xhci_skip_transfer()
852 xhci_endpoint_doorbell(xfer); in xhci_skip_transfer()
906 struct usb_xfer *xfer; in xhci_check_transfer() local
918 xfer = pepext->xfer[i + (XHCI_MAX_TRANSFERS * stream_id)]; in xhci_check_transfer()
919 if (xfer == NULL) in xhci_check_transfer()
922 td = xfer->td_transfer_cache; in xhci_check_transfer()
958 if (xfer->flags_int.isochronous_xfr) { in xhci_check_transfer()
976 if (((void *)td) == xfer->td_transfer_last) { in xhci_check_transfer()
978 xhci_generic_done(xfer); in xhci_check_transfer()
988 xhci_generic_done(xfer); in xhci_check_transfer()
1000 xhci_generic_done(xfer); in xhci_check_transfer()
1004 if (xfer->flags_int.short_frames_ok || in xhci_check_transfer()
1005 xfer->flags_int.isochronous_xfr || in xhci_check_transfer()
1006 xfer->flags_int.control_xfr) { in xhci_check_transfer()
1008 xfer->td_transfer_cache = td->alt_next; in xhci_check_transfer()
1009 xhci_activate_transfer(xfer); in xhci_check_transfer()
1012 xhci_skip_transfer(xfer); in xhci_check_transfer()
1013 xhci_generic_done(xfer); in xhci_check_transfer()
1021 xfer->td_transfer_cache = td->obj_next; in xhci_check_transfer()
1022 xhci_activate_transfer(xfer); in xhci_check_transfer()
1651 struct usb_xfer *xfer = arg; in xhci_timeout() local
1653 DPRINTF("xfer=%p\n", xfer); in xhci_timeout()
1655 USB_BUS_LOCK_ASSERT(xfer->xroot->bus, MA_OWNED); in xhci_timeout()
1658 xhci_device_done(xfer, USB_ERR_TIMEOUT); in xhci_timeout()
1979 xhci_setup_generic_chain(struct usb_xfer *xfer) in xhci_setup_generic_chain() argument
1991 temp.average = xfer->max_hc_frame_size; in xhci_setup_generic_chain()
1992 temp.max_packet_size = xfer->max_packet_size; in xhci_setup_generic_chain()
1993 temp.sc = XHCI_BUS2SC(xfer->xroot->bus); in xhci_setup_generic_chain()
1997 temp.multishort = xfer->flags_int.isochronous_xfr || in xhci_setup_generic_chain()
1998 xfer->flags_int.control_xfr || in xhci_setup_generic_chain()
1999 xfer->flags_int.short_frames_ok; in xhci_setup_generic_chain()
2002 xfer->flags_int.curr_dma_set ^= 1; in xhci_setup_generic_chain()
2005 td = xfer->td_start[xfer->flags_int.curr_dma_set]; in xhci_setup_generic_chain()
2010 xfer->td_transfer_first = td; in xhci_setup_generic_chain()
2011 xfer->td_transfer_cache = td; in xhci_setup_generic_chain()
2013 if (xfer->flags_int.isochronous_xfr) { in xhci_setup_generic_chain()
2017 mult = xfer->endpoint->ecomp ? in xhci_setup_generic_chain()
2018 UE_GET_SS_ISO_MULT(xfer->endpoint->ecomp->bmAttributes) in xhci_setup_generic_chain()
2022 mult = (xfer->endpoint->edesc-> in xhci_setup_generic_chain()
2035 switch (usbd_get_speed(xfer->xroot->udev)) { in xhci_setup_generic_chain()
2043 shift = usbd_xfer_get_fps_shift(xfer); in xhci_setup_generic_chain()
2048 x += xfer->endpoint->usb_uframe; in xhci_setup_generic_chain()
2052 y = XHCI_MFINDEX_GET(x - xfer->endpoint->isoc_next); in xhci_setup_generic_chain()
2054 if ((xfer->endpoint->is_synced == 0) || in xhci_setup_generic_chain()
2055 (y < (xfer->nframes << shift)) || in xhci_setup_generic_chain()
2064 xfer->endpoint->isoc_next = XHCI_MFINDEX_GET(x + (3 * 8)); in xhci_setup_generic_chain()
2065 xfer->endpoint->is_synced = 1; in xhci_setup_generic_chain()
2068 DPRINTFN(3, "start next=%d\n", xfer->endpoint->isoc_next); in xhci_setup_generic_chain()
2073 y = XHCI_MFINDEX_GET(xfer->endpoint->isoc_next - (x & ~7)); in xhci_setup_generic_chain()
2075 xfer->isoc_time_complete = in xhci_setup_generic_chain()
2077 (y / 8) + (((xfer->nframes << shift) + 7) / 8); in xhci_setup_generic_chain()
2080 temp.isoc_frame = xfer->endpoint->isoc_next; in xhci_setup_generic_chain()
2083 xfer->endpoint->isoc_next += xfer->nframes << shift; in xhci_setup_generic_chain()
2085 } else if (xfer->flags_int.control_xfr) { in xhci_setup_generic_chain()
2089 if (xfer->flags_int.control_hdr) { in xhci_setup_generic_chain()
2091 temp.len = xfer->frlengths[0]; in xhci_setup_generic_chain()
2092 temp.pc = xfer->frbuffers + 0; in xhci_setup_generic_chain()
2098 if (xfer->nframes == 1) { in xhci_setup_generic_chain()
2100 if (xfer->flags_int.control_act) in xhci_setup_generic_chain()
2110 temp.trb_type = xfer->flags_int.control_did_data ? in xhci_setup_generic_chain()
2120 if (x != xfer->nframes) { in xhci_setup_generic_chain()
2122 temp.pc = xfer->frbuffers + x; in xhci_setup_generic_chain()
2124 temp.direction = UE_GET_DIR(xfer->endpointno); in xhci_setup_generic_chain()
2127 while (x != xfer->nframes) { in xhci_setup_generic_chain()
2131 temp.len = xfer->frlengths[x]; in xhci_setup_generic_chain()
2132 temp.step_td = ((xfer->endpointno & UE_DIR_IN) && in xhci_setup_generic_chain()
2137 if (x == xfer->nframes) { in xhci_setup_generic_chain()
2138 if (xfer->flags_int.control_xfr) { in xhci_setup_generic_chain()
2140 if (xfer->flags_int.control_act) in xhci_setup_generic_chain()
2155 } else if (xfer->flags_int.isochronous_xfr) { in xhci_setup_generic_chain()
2168 if (temp.len > xfer->max_frame_size) in xhci_setup_generic_chain()
2169 temp.len = xfer->max_frame_size; in xhci_setup_generic_chain()
2172 tdpc = (temp.len + xfer->max_packet_size - 1) / in xhci_setup_generic_chain()
2173 xfer->max_packet_size; in xhci_setup_generic_chain()
2186 temp.shortpkt = xfer->flags.force_short_xfer ? 0 : 1; in xhci_setup_generic_chain()
2191 if (xfer->flags_int.isochronous_xfr) { in xhci_setup_generic_chain()
2192 temp.offset += xfer->frlengths[x - 1]; in xhci_setup_generic_chain()
2196 temp.pc = xfer->frbuffers + x; in xhci_setup_generic_chain()
2202 if (xfer->flags_int.control_xfr && in xhci_setup_generic_chain()
2203 !xfer->flags_int.control_act) { in xhci_setup_generic_chain()
2216 temp.step_td = (xfer->nframes != 0); in xhci_setup_generic_chain()
2220 temp.direction = UE_GET_DIR(xfer->endpointno) ^ UE_DIR_IN; in xhci_setup_generic_chain()
2234 xfer->td_transfer_last = td; in xhci_setup_generic_chain()
2236 DPRINTF("first=%p last=%p\n", xfer->td_transfer_first, td); in xhci_setup_generic_chain()
2472 xhci_configure_endpoint_by_xfer(struct usb_xfer *xfer) in xhci_configure_endpoint_by_xfer() argument
2478 pepext = xhci_get_endpoint_ext(xfer->xroot->udev, in xhci_configure_endpoint_by_xfer()
2479 xfer->endpoint->edesc); in xhci_configure_endpoint_by_xfer()
2481 ecomp = xfer->endpoint->ecomp; in xhci_configure_endpoint_by_xfer()
2506 return (xhci_configure_endpoint(xfer->xroot->udev, in xhci_configure_endpoint_by_xfer()
2507 xfer->endpoint->edesc, pepext, in xhci_configure_endpoint_by_xfer()
2508 xfer->interval, xfer->max_packet_count, in xhci_configure_endpoint_by_xfer()
2510 usbd_xfer_get_fps_shift(xfer), xfer->max_packet_size, in xhci_configure_endpoint_by_xfer()
2511 xfer->max_frame_size, xfer->endpoint->ep_mode)); in xhci_configure_endpoint_by_xfer()
2815 xhci_endpoint_doorbell(struct usb_xfer *xfer) in xhci_endpoint_doorbell() argument
2817 struct xhci_softc *sc = XHCI_BUS2SC(xfer->xroot->bus); in xhci_endpoint_doorbell()
2821 epno = xfer->endpointno; in xhci_endpoint_doorbell()
2822 if (xfer->flags_int.control_xfr) in xhci_endpoint_doorbell()
2826 index = xfer->xroot->udev->controller_slot_id; in xhci_endpoint_doorbell()
2828 if (xfer->xroot->udev->flags.self_suspended == 0) { in xhci_endpoint_doorbell()
2830 epno | XHCI_DB_SID_SET(xfer->stream_id)); in xhci_endpoint_doorbell()
2835 xhci_transfer_remove(struct usb_xfer *xfer, usb_error_t error) in xhci_transfer_remove() argument
2839 if (xfer->flags_int.bandwidth_reclaimed) { in xhci_transfer_remove()
2840 xfer->flags_int.bandwidth_reclaimed = 0; in xhci_transfer_remove()
2842 pepext = xhci_get_endpoint_ext(xfer->xroot->udev, in xhci_transfer_remove()
2843 xfer->endpoint->edesc); in xhci_transfer_remove()
2845 pepext->trb_used[xfer->stream_id]--; in xhci_transfer_remove()
2847 pepext->xfer[xfer->qh_pos] = NULL; in xhci_transfer_remove()
2857 xhci_transfer_insert(struct usb_xfer *xfer) in xhci_transfer_insert() argument
2871 id = xfer->stream_id; in xhci_transfer_insert()
2874 if (xfer->flags_int.bandwidth_reclaimed) { in xhci_transfer_insert()
2879 pepext = xhci_get_endpoint_ext(xfer->xroot->udev, in xhci_transfer_insert()
2880 xfer->endpoint->edesc); in xhci_transfer_insert()
2882 td_first = xfer->td_transfer_first; in xhci_transfer_insert()
2883 td_last = xfer->td_transfer_last; in xhci_transfer_insert()
2886 switch (xfer->endpoint->edesc->bmAttributes & UE_XFERTYPE) { in xhci_transfer_insert()
2904 if (xfer->flags_int.control_xfr != 0 && in xhci_transfer_insert()
2905 pepext->trb_ep_maxp != xfer->endpoint->edesc->wMaxPacketSize[0]) { in xhci_transfer_insert()
2916 struct xhci_softc *sc = XHCI_BUS2SC(xfer->xroot->bus); in xhci_transfer_insert()
2988 pepext->xfer[i] = xfer; in xhci_transfer_insert()
2990 xfer->qh_pos = i; in xhci_transfer_insert()
2992 xfer->flags_int.bandwidth_reclaimed = 1; in xhci_transfer_insert()
2994 xhci_endpoint_doorbell(xfer); in xhci_transfer_insert()
3031 xhci_device_done(struct usb_xfer *xfer, usb_error_t error) in xhci_device_done() argument
3034 xfer, xfer->endpoint, error); in xhci_device_done()
3037 xhci_transfer_remove(xfer, error); in xhci_device_done()
3040 usbd_transfer_done(xfer, error); in xhci_device_done()
3047 xhci_device_generic_open(struct usb_xfer *xfer) in xhci_device_generic_open() argument
3049 if (xfer->flags_int.isochronous_xfr) { in xhci_device_generic_open()
3050 switch (xfer->xroot->udev->speed) { in xhci_device_generic_open()
3054 usb_hs_bandwidth_alloc(xfer); in xhci_device_generic_open()
3061 xhci_device_generic_close(struct usb_xfer *xfer) in xhci_device_generic_close() argument
3065 xhci_device_done(xfer, USB_ERR_CANCELLED); in xhci_device_generic_close()
3067 if (xfer->flags_int.isochronous_xfr) { in xhci_device_generic_close()
3068 switch (xfer->xroot->udev->speed) { in xhci_device_generic_close()
3072 usb_hs_bandwidth_free(xfer); in xhci_device_generic_close()
3082 struct usb_xfer *xfer; in xhci_device_generic_multi_enter() local
3085 xfer = ep->endpoint_q[stream_id].curr; in xhci_device_generic_multi_enter()
3086 if (xfer == NULL) in xhci_device_generic_multi_enter()
3094 if (!xfer->flags_int.bandwidth_reclaimed) in xhci_device_generic_multi_enter()
3097 xfer = TAILQ_FIRST(&ep->endpoint_q[stream_id].head); in xhci_device_generic_multi_enter()
3098 if (xfer == NULL) { in xhci_device_generic_multi_enter()
3104 xfer = enter_xfer; in xhci_device_generic_multi_enter()
3106 if (xfer == NULL) in xhci_device_generic_multi_enter()
3111 (void)xhci_transfer_insert(xfer); in xhci_device_generic_multi_enter()
3115 xhci_device_generic_enter(struct usb_xfer *xfer) in xhci_device_generic_enter() argument
3120 xhci_setup_generic_chain(xfer); in xhci_device_generic_enter()
3122 xhci_device_generic_multi_enter(xfer->endpoint, in xhci_device_generic_enter()
3123 xfer->stream_id, xfer); in xhci_device_generic_enter()
3127 xhci_device_generic_start(struct usb_xfer *xfer) in xhci_device_generic_start() argument
3132 (void)xhci_transfer_insert(xfer); in xhci_device_generic_start()
3135 xhci_device_generic_multi_enter(xfer->endpoint, in xhci_device_generic_start()
3136 xfer->stream_id, NULL); in xhci_device_generic_start()
3139 usbd_transfer_enqueue(&xfer->xroot->bus->intr_q, xfer); in xhci_device_generic_start()
3142 if (xfer->timeout != 0) in xhci_device_generic_start()
3143 usbd_transfer_timeout_ms(xfer, &xhci_timeout, xfer->timeout); in xhci_device_generic_start()
3687 struct usb_xfer *xfer; in xhci_xfer_setup() local
3692 xfer = parm->curr_xfer; in xhci_xfer_setup()
3726 xfer->flags_int.bdma_enable = 1; in xhci_xfer_setup()
3730 if (xfer->flags_int.isochronous_xfr) { in xhci_xfer_setup()
3731 ntd = ((1 * xfer->nframes) in xhci_xfer_setup()
3732 + (xfer->max_data_length / xfer->max_hc_frame_size)); in xhci_xfer_setup()
3733 } else if (xfer->flags_int.control_xfr) { in xhci_xfer_setup()
3734 ntd = ((2 * xfer->nframes) + 1 /* STATUS */ in xhci_xfer_setup()
3735 + (xfer->max_data_length / xfer->max_hc_frame_size)); in xhci_xfer_setup()
3737 ntd = ((2 * xfer->nframes) in xhci_xfer_setup()
3738 + (xfer->max_data_length / xfer->max_hc_frame_size)); in xhci_xfer_setup()
3775 xfer->td_start[xfer->flags_int.curr_dma_set] = last_obj; in xhci_xfer_setup()
3777 if (!xfer->flags_int.curr_dma_set) { in xhci_xfer_setup()
3778 xfer->flags_int.curr_dma_set = 1; in xhci_xfer_setup()
3784 xhci_configure_reset_endpoint(struct usb_xfer *xfer) in xhci_configure_reset_endpoint() argument
3786 struct xhci_softc *sc = XHCI_BUS2SC(xfer->xroot->bus); in xhci_configure_reset_endpoint()
3797 pepext = xhci_get_endpoint_ext(xfer->xroot->udev, in xhci_configure_reset_endpoint()
3798 xfer->endpoint->edesc); in xhci_configure_reset_endpoint()
3800 udev = xfer->xroot->udev; in xhci_configure_reset_endpoint()
3807 edesc = xfer->endpoint->edesc; in xhci_configure_reset_endpoint()
3810 stream_id = xfer->stream_id; in xhci_configure_reset_endpoint()
3824 err = xhci_configure_endpoint_by_xfer(xfer); in xhci_configure_reset_endpoint()
3875 xhci_xfer_unsetup(struct usb_xfer *xfer) in xhci_xfer_unsetup() argument
3881 xhci_start_dma_delay(struct usb_xfer *xfer) in xhci_start_dma_delay() argument
3883 struct xhci_softc *sc = XHCI_BUS2SC(xfer->xroot->bus); in xhci_start_dma_delay()
3886 usbd_transfer_enqueue(&sc->sc_bus.intr_q, xfer); in xhci_start_dma_delay()
3897 struct usb_xfer *xfer; in xhci_configure_msg() local
3902 TAILQ_FOREACH(xfer, &sc->sc_bus.intr_q.head, wait_entry) { in xhci_configure_msg()
3904 pepext = xhci_get_endpoint_ext(xfer->xroot->udev, in xhci_configure_msg()
3905 xfer->endpoint->edesc); in xhci_configure_msg()
3926 if (pepext->xfer[i] != NULL) { in xhci_configure_msg()
3927 xhci_device_done(pepext->xfer[i], in xhci_configure_msg()
3939 (void)xhci_configure_reset_endpoint(xfer); in xhci_configure_msg()
3952 if (xfer->flags_int.did_dma_delay) { in xhci_configure_msg()
3955 usbd_transfer_dequeue(xfer); in xhci_configure_msg()
3958 usb_dma_delay_done_cb(xfer); in xhci_configure_msg()
3965 TAILQ_FOREACH(xfer, &sc->sc_bus.intr_q.head, wait_entry) { in xhci_configure_msg()
3968 (void)xhci_transfer_insert(xfer); in xhci_configure_msg()
3971 xhci_device_generic_multi_enter(xfer->endpoint, in xhci_configure_msg()
3972 xfer->stream_id, NULL); in xhci_configure_msg()