Lines Matching refs:urb
412 struct urb *urb) in xhci_urb_to_transfer_ring() argument
414 return xhci_triad_to_transfer_ring(xhci, urb->dev->slot_id, in xhci_urb_to_transfer_ring()
415 xhci_get_endpoint_index(&urb->ep->desc), urb->stream_id); in xhci_urb_to_transfer_ring()
600 struct urb *urb; in xhci_giveback_urb_in_irq() local
603 urb = cur_td->urb; in xhci_giveback_urb_in_irq()
604 urb_priv = urb->hcpriv; in xhci_giveback_urb_in_irq()
606 hcd = bus_to_hcd(urb->dev->bus); in xhci_giveback_urb_in_irq()
610 if (usb_pipetype(urb->pipe) == PIPE_ISOCHRONOUS) { in xhci_giveback_urb_in_irq()
617 usb_hcd_unlink_urb_from_ep(hcd, urb); in xhci_giveback_urb_in_irq()
620 usb_hcd_giveback_urb(hcd, urb, status); in xhci_giveback_urb_in_irq()
678 ep_ring = xhci_urb_to_transfer_ring(xhci, cur_td->urb); in xhci_handle_cmd_stop_ep()
693 cur_td->urb, in xhci_handle_cmd_stop_ep()
694 cur_td->urb->stream_id); in xhci_handle_cmd_stop_ep()
703 cur_td->urb->stream_id, in xhci_handle_cmd_stop_ep()
721 ep->stopped_td->urb->stream_id, &deq_state); in xhci_handle_cmd_stop_ep()
1809 struct urb *urb = NULL; in finish_td() local
1854 urb = td->urb; in finish_td()
1855 urb_priv = urb->hcpriv; in finish_td()
1862 if (urb->actual_length > urb->transfer_buffer_length) { in finish_td()
1864 urb->transfer_buffer_length, in finish_td()
1865 urb->actual_length); in finish_td()
1866 urb->actual_length = 0; in finish_td()
1867 if (td->urb->transfer_flags & URB_SHORT_NOT_OK) in finish_td()
1881 if (usb_pipetype(urb->pipe) == PIPE_ISOCHRONOUS) { in finish_td()
1929 if (td->urb->transfer_flags & URB_SHORT_NOT_OK) in process_ctrl_td()
1938 td->urb->actual_length = in process_ctrl_td()
1945 td->urb->actual_length = in process_ctrl_td()
1946 td->urb->transfer_buffer_length - in process_ctrl_td()
1963 td->urb->actual_length = in process_ctrl_td()
1964 td->urb->transfer_buffer_length - in process_ctrl_td()
1967 td->urb->actual_length = 0; in process_ctrl_td()
1982 (td->urb->transfer_flags in process_ctrl_td()
1988 td->urb->actual_length = in process_ctrl_td()
1989 td->urb->transfer_buffer_length; in process_ctrl_td()
1999 td->urb->actual_length = in process_ctrl_td()
2000 td->urb->transfer_buffer_length - in process_ctrl_td()
2030 urb_priv = td->urb->hcpriv; in process_isoc_td()
2032 frame = &td->urb->iso_frame_desc[idx]; in process_isoc_td()
2046 frame->status = td->urb->transfer_flags & URB_SHORT_NOT_OK ? in process_isoc_td()
2079 td->urb->actual_length += frame->length; in process_isoc_td()
2083 td->urb->actual_length += frame->actual_length; in process_isoc_td()
2097 td->urb->actual_length += len; in process_isoc_td()
2114 urb_priv = td->urb->hcpriv; in skip_isoc_td()
2116 frame = &td->urb->iso_frame_desc[idx]; in skip_isoc_td()
2154 if (td->urb->transfer_flags & URB_SHORT_NOT_OK) in process_bulk_intr_td()
2166 if (td->urb->transfer_flags & URB_SHORT_NOT_OK) in process_bulk_intr_td()
2178 td->urb->ep->desc.bEndpointAddress, in process_bulk_intr_td()
2179 td->urb->transfer_buffer_length, in process_bulk_intr_td()
2183 td->urb->actual_length = in process_bulk_intr_td()
2186 if (td->urb->transfer_buffer_length < in process_bulk_intr_td()
2187 td->urb->actual_length) { in process_bulk_intr_td()
2190 td->urb->actual_length = 0; in process_bulk_intr_td()
2196 td->urb->actual_length = in process_bulk_intr_td()
2197 td->urb->transfer_buffer_length - in process_bulk_intr_td()
2199 if (td->urb->transfer_buffer_length < in process_bulk_intr_td()
2200 td->urb->actual_length) { in process_bulk_intr_td()
2204 td->urb->actual_length = 0; in process_bulk_intr_td()
2205 if (td->urb->transfer_flags & URB_SHORT_NOT_OK) in process_bulk_intr_td()
2212 if (td->urb->transfer_flags & URB_SHORT_NOT_OK) in process_bulk_intr_td()
2218 td->urb->actual_length = in process_bulk_intr_td()
2219 td->urb->transfer_buffer_length; in process_bulk_intr_td()
2230 td->urb->actual_length = 0; in process_bulk_intr_td()
2236 td->urb->actual_length += in process_bulk_intr_td()
2243 td->urb->actual_length += in process_bulk_intr_td()
2270 struct urb *urb = NULL; in handle_tx_event() local
2491 !usb_endpoint_xfer_isoc(&td->urb->ep->desc)) { in handle_tx_event()
2544 if (usb_endpoint_xfer_control(&td->urb->ep->desc)) in handle_tx_event()
2547 else if (usb_endpoint_xfer_isoc(&td->urb->ep->desc)) in handle_tx_event()
2569 urb = td->urb; in handle_tx_event()
2570 urb_priv = urb->hcpriv; in handle_tx_event()
2574 usb_hcd_unlink_urb_from_ep(bus_to_hcd(urb->dev->bus), urb); in handle_tx_event()
2575 if ((urb->actual_length != urb->transfer_buffer_length && in handle_tx_event()
2576 (urb->transfer_flags & in handle_tx_event()
2579 !usb_endpoint_xfer_isoc(&urb->ep->desc))) in handle_tx_event()
2582 urb, urb->actual_length, in handle_tx_event()
2583 urb->transfer_buffer_length, in handle_tx_event()
2589 if (usb_pipetype(urb->pipe) == PIPE_ISOCHRONOUS) in handle_tx_event()
2591 usb_hcd_giveback_urb(bus_to_hcd(urb->dev->bus), urb, status); in handle_tx_event()
2894 struct urb *urb, in prepare_transfer() argument
2917 urb_priv = urb->hcpriv; in prepare_transfer()
2924 ret = usb_hcd_link_urb_to_ep(bus_to_hcd(urb->dev->bus), urb); in prepare_transfer()
2929 td->urb = urb; in prepare_transfer()
2940 static unsigned int count_sg_trbs_needed(struct xhci_hcd *xhci, struct urb *urb) in count_sg_trbs_needed() argument
2946 num_sgs = urb->num_mapped_sgs; in count_sg_trbs_needed()
2947 temp = urb->transfer_buffer_length; in count_sg_trbs_needed()
2950 for_each_sg(urb->sg, sg, num_sgs, i) { in count_sg_trbs_needed()
2973 static void check_trb_math(struct urb *urb, int num_trbs, int running_total) in check_trb_math() argument
2976 dev_err(&urb->dev->dev, "%s - ep %#x - Miscalculated number of " in check_trb_math()
2978 urb->ep->desc.bEndpointAddress, num_trbs); in check_trb_math()
2979 if (running_total != urb->transfer_buffer_length) in check_trb_math()
2980 dev_err(&urb->dev->dev, "%s - ep %#x - Miscalculated tx length, " in check_trb_math()
2983 urb->ep->desc.bEndpointAddress, in check_trb_math()
2985 urb->transfer_buffer_length, in check_trb_math()
2986 urb->transfer_buffer_length); in check_trb_math()
3012 struct urb *urb, int slot_id, unsigned int ep_index) in xhci_queue_intr_tx() argument
3020 ep_interval = urb->interval; in xhci_queue_intr_tx()
3022 if (urb->dev->speed == USB_SPEED_LOW || in xhci_queue_intr_tx()
3023 urb->dev->speed == USB_SPEED_FULL) in xhci_queue_intr_tx()
3029 dev_dbg_ratelimited(&urb->dev->dev, in xhci_queue_intr_tx()
3033 urb->interval = xhci_interval; in xhci_queue_intr_tx()
3035 if (urb->dev->speed == USB_SPEED_LOW || in xhci_queue_intr_tx()
3036 urb->dev->speed == USB_SPEED_FULL) in xhci_queue_intr_tx()
3037 urb->interval /= 8; in xhci_queue_intr_tx()
3039 return xhci_queue_bulk_tx(xhci, mem_flags, urb, slot_id, ep_index); in xhci_queue_intr_tx()
3064 struct urb *urb, unsigned int num_trbs_left) in xhci_td_remainder() argument
3071 maxp = GET_MAX_PACKET(usb_endpoint_maxp(&urb->ep->desc)); in xhci_td_remainder()
3085 struct urb *urb, int slot_id, unsigned int ep_index) in queue_bulk_sg_tx() argument
3104 ep_ring = xhci_urb_to_transfer_ring(xhci, urb); in queue_bulk_sg_tx()
3108 num_trbs = count_sg_trbs_needed(xhci, urb); in queue_bulk_sg_tx()
3109 num_sgs = urb->num_mapped_sgs; in queue_bulk_sg_tx()
3110 total_packet_count = DIV_ROUND_UP(urb->transfer_buffer_length, in queue_bulk_sg_tx()
3111 usb_endpoint_maxp(&urb->ep->desc)); in queue_bulk_sg_tx()
3114 ep_index, urb->stream_id, in queue_bulk_sg_tx()
3115 num_trbs, urb, 0, mem_flags); in queue_bulk_sg_tx()
3119 urb_priv = urb->hcpriv; in queue_bulk_sg_tx()
3122 zero_length_needed = urb->transfer_flags & URB_ZERO_PACKET && in queue_bulk_sg_tx()
3128 ep_index, urb->stream_id, in queue_bulk_sg_tx()
3129 1, urb, 1, mem_flags); in queue_bulk_sg_tx()
3154 sg = urb->sg; in queue_bulk_sg_tx()
3159 if (trb_buff_len > urb->transfer_buffer_length) in queue_bulk_sg_tx()
3160 trb_buff_len = urb->transfer_buffer_length; in queue_bulk_sg_tx()
3193 if (usb_urb_dir_in(urb)) in queue_bulk_sg_tx()
3206 urb->transfer_buffer_length, in queue_bulk_sg_tx()
3207 urb, num_trbs - 1); in queue_bulk_sg_tx()
3243 if (running_total + trb_buff_len > urb->transfer_buffer_length) in queue_bulk_sg_tx()
3245 urb->transfer_buffer_length - running_total; in queue_bulk_sg_tx()
3248 check_trb_math(urb, num_trbs, running_total); in queue_bulk_sg_tx()
3249 giveback_first_trb(xhci, slot_id, ep_index, urb->stream_id, in queue_bulk_sg_tx()
3256 struct urb *urb, int slot_id, unsigned int ep_index) in xhci_queue_bulk_tx() argument
3274 if (urb->num_sgs) in xhci_queue_bulk_tx()
3275 return queue_bulk_sg_tx(xhci, mem_flags, urb, slot_id, ep_index); in xhci_queue_bulk_tx()
3277 ep_ring = xhci_urb_to_transfer_ring(xhci, urb); in xhci_queue_bulk_tx()
3284 (urb->transfer_dma & (TRB_MAX_BUFF_SIZE - 1)); in xhci_queue_bulk_tx()
3290 if (running_total != 0 || urb->transfer_buffer_length == 0) in xhci_queue_bulk_tx()
3293 while (running_total < urb->transfer_buffer_length) { in xhci_queue_bulk_tx()
3299 ep_index, urb->stream_id, in xhci_queue_bulk_tx()
3300 num_trbs, urb, 0, mem_flags); in xhci_queue_bulk_tx()
3304 urb_priv = urb->hcpriv; in xhci_queue_bulk_tx()
3307 zero_length_needed = urb->transfer_flags & URB_ZERO_PACKET && in xhci_queue_bulk_tx()
3313 ep_index, urb->stream_id, in xhci_queue_bulk_tx()
3314 1, urb, 1, mem_flags); in xhci_queue_bulk_tx()
3330 total_packet_count = DIV_ROUND_UP(urb->transfer_buffer_length, in xhci_queue_bulk_tx()
3331 usb_endpoint_maxp(&urb->ep->desc)); in xhci_queue_bulk_tx()
3333 addr = (u64) urb->transfer_dma; in xhci_queue_bulk_tx()
3335 (urb->transfer_dma & (TRB_MAX_BUFF_SIZE - 1)); in xhci_queue_bulk_tx()
3336 if (trb_buff_len > urb->transfer_buffer_length) in xhci_queue_bulk_tx()
3337 trb_buff_len = urb->transfer_buffer_length; in xhci_queue_bulk_tx()
3369 if (usb_urb_dir_in(urb)) in xhci_queue_bulk_tx()
3374 urb->transfer_buffer_length, in xhci_queue_bulk_tx()
3375 urb, num_trbs - 1); in xhci_queue_bulk_tx()
3395 trb_buff_len = urb->transfer_buffer_length - running_total; in xhci_queue_bulk_tx()
3400 check_trb_math(urb, num_trbs, running_total); in xhci_queue_bulk_tx()
3401 giveback_first_trb(xhci, slot_id, ep_index, urb->stream_id, in xhci_queue_bulk_tx()
3408 struct urb *urb, int slot_id, unsigned int ep_index) in xhci_queue_ctrl_tx() argument
3420 ep_ring = xhci_urb_to_transfer_ring(xhci, urb); in xhci_queue_ctrl_tx()
3428 if (!urb->setup_packet) in xhci_queue_ctrl_tx()
3438 if (urb->transfer_buffer_length > 0) in xhci_queue_ctrl_tx()
3441 ep_index, urb->stream_id, in xhci_queue_ctrl_tx()
3442 num_trbs, urb, 0, mem_flags); in xhci_queue_ctrl_tx()
3446 urb_priv = urb->hcpriv; in xhci_queue_ctrl_tx()
3459 setup = (struct usb_ctrlrequest *) urb->setup_packet; in xhci_queue_ctrl_tx()
3467 if (urb->transfer_buffer_length > 0) { in xhci_queue_ctrl_tx()
3484 if (usb_urb_dir_in(urb)) in xhci_queue_ctrl_tx()
3490 urb->transfer_buffer_length, in xhci_queue_ctrl_tx()
3491 urb->transfer_buffer_length, in xhci_queue_ctrl_tx()
3492 urb, 1); in xhci_queue_ctrl_tx()
3494 length_field = TRB_LEN(urb->transfer_buffer_length) | in xhci_queue_ctrl_tx()
3498 if (urb->transfer_buffer_length > 0) { in xhci_queue_ctrl_tx()
3502 lower_32_bits(urb->transfer_dma), in xhci_queue_ctrl_tx()
3503 upper_32_bits(urb->transfer_dma), in xhci_queue_ctrl_tx()
3513 if (urb->transfer_buffer_length > 0 && setup->bRequestType & USB_DIR_IN) in xhci_queue_ctrl_tx()
3530 struct urb *urb, int i) in count_isoc_trbs_needed() argument
3535 addr = (u64) (urb->transfer_dma + urb->iso_frame_desc[i].offset); in count_isoc_trbs_needed()
3536 td_len = urb->iso_frame_desc[i].length; in count_isoc_trbs_needed()
3556 struct urb *urb, unsigned int total_packet_count) in xhci_get_burst_count() argument
3563 max_burst = urb->ep->ss_ep_comp.bMaxBurst; in xhci_get_burst_count()
3577 struct urb *urb, unsigned int total_packet_count) in xhci_get_last_burst_packet_count() argument
3588 max_burst = urb->ep->ss_ep_comp.bMaxBurst; in xhci_get_last_burst_packet_count()
3611 struct urb *urb, int index) in xhci_get_isoc_frame_id() argument
3616 if (urb->dev->speed == USB_SPEED_LOW || in xhci_get_isoc_frame_id()
3617 urb->dev->speed == USB_SPEED_FULL) in xhci_get_isoc_frame_id()
3618 start_frame = urb->start_frame + index * urb->interval; in xhci_get_isoc_frame_id()
3620 start_frame = (urb->start_frame + index * urb->interval) >> 3; in xhci_get_isoc_frame_id()
3674 if (urb->dev->speed == USB_SPEED_LOW || in xhci_get_isoc_frame_id()
3675 urb->dev->speed == USB_SPEED_FULL) in xhci_get_isoc_frame_id()
3676 urb->start_frame = start_frame; in xhci_get_isoc_frame_id()
3678 urb->start_frame = start_frame << 3; in xhci_get_isoc_frame_id()
3696 struct urb *urb, int slot_id, unsigned int ep_index) in xhci_queue_isoc_tx() argument
3715 num_tds = urb->number_of_packets; in xhci_queue_isoc_tx()
3721 start_addr = (u64) urb->transfer_dma; in xhci_queue_isoc_tx()
3725 urb_priv = urb->hcpriv; in xhci_queue_isoc_tx()
3734 addr = start_addr + urb->iso_frame_desc[i].offset; in xhci_queue_isoc_tx()
3735 td_len = urb->iso_frame_desc[i].length; in xhci_queue_isoc_tx()
3739 usb_endpoint_maxp(&urb->ep->desc))); in xhci_queue_isoc_tx()
3743 burst_count = xhci_get_burst_count(xhci, urb->dev, urb, in xhci_queue_isoc_tx()
3746 urb->dev, urb, total_packet_count); in xhci_queue_isoc_tx()
3748 trbs_per_td = count_isoc_trbs_needed(xhci, urb, i); in xhci_queue_isoc_tx()
3751 urb->stream_id, trbs_per_td, urb, i, mem_flags); in xhci_queue_isoc_tx()
3771 if (!(urb->transfer_flags & URB_ISO_ASAP) && in xhci_queue_isoc_tx()
3774 urb, in xhci_queue_isoc_tx()
3796 if (usb_urb_dir_in(urb)) in xhci_queue_isoc_tx()
3828 urb, trbs_per_td - j - 1); in xhci_queue_isoc_tx()
3855 xep->next_frame_id = urb->start_frame + num_tds * urb->interval; in xhci_queue_isoc_tx()
3863 giveback_first_trb(xhci, slot_id, ep_index, urb->stream_id, in xhci_queue_isoc_tx()
3886 usb_hcd_unlink_urb_from_ep(bus_to_hcd(urb->dev->bus), urb); in xhci_queue_isoc_tx()
3898 struct urb *urb, int slot_id, unsigned int ep_index) in xhci_queue_isoc_tx_prepare() argument
3917 num_tds = urb->number_of_packets; in xhci_queue_isoc_tx_prepare()
3919 num_trbs += count_isoc_trbs_needed(xhci, urb, i); in xhci_queue_isoc_tx_prepare()
3934 ep_interval = urb->interval; in xhci_queue_isoc_tx_prepare()
3936 if (urb->dev->speed == USB_SPEED_LOW || in xhci_queue_isoc_tx_prepare()
3937 urb->dev->speed == USB_SPEED_FULL) in xhci_queue_isoc_tx_prepare()
3943 dev_dbg_ratelimited(&urb->dev->dev, in xhci_queue_isoc_tx_prepare()
3947 urb->interval = xhci_interval; in xhci_queue_isoc_tx_prepare()
3949 if (urb->dev->speed == USB_SPEED_LOW || in xhci_queue_isoc_tx_prepare()
3950 urb->dev->speed == USB_SPEED_FULL) in xhci_queue_isoc_tx_prepare()
3951 urb->interval /= 8; in xhci_queue_isoc_tx_prepare()
3958 urb->start_frame = xep->next_frame_id; in xhci_queue_isoc_tx_prepare()
3979 if (urb->dev->speed == USB_SPEED_LOW || in xhci_queue_isoc_tx_prepare()
3980 urb->dev->speed == USB_SPEED_FULL) { in xhci_queue_isoc_tx_prepare()
3981 start_frame = roundup(start_frame, urb->interval << 3); in xhci_queue_isoc_tx_prepare()
3982 urb->start_frame = start_frame >> 3; in xhci_queue_isoc_tx_prepare()
3984 start_frame = roundup(start_frame, urb->interval); in xhci_queue_isoc_tx_prepare()
3985 urb->start_frame = start_frame; in xhci_queue_isoc_tx_prepare()
3991 return xhci_queue_isoc_tx(xhci, mem_flags, urb, slot_id, ep_index); in xhci_queue_isoc_tx_prepare()