diff options
author | hselasky <hselasky@FreeBSD.org> | 2013-06-02 12:28:29 +0000 |
---|---|---|
committer | hselasky <hselasky@FreeBSD.org> | 2013-06-02 12:28:29 +0000 |
commit | 174cc36edbb7bead76d6725363366d32d54fcb98 (patch) | |
tree | f8f8c348c22465c04ff76fb7f200968eab17d995 /sys/dev/usb/controller/xhci.c | |
parent | 5aecb2fa14616d660ea3d3f53fb0c633669b4e35 (diff) | |
download | FreeBSD-src-174cc36edbb7bead76d6725363366d32d54fcb98.zip FreeBSD-src-174cc36edbb7bead76d6725363366d32d54fcb98.tar.gz |
Correct the TD size computation. npkt should reflect the number of packets
remaining after the current TRB has been executed. Refer to section 4.11.2.4
of the XHCI specification for USB.
MFC after: 1 week
Diffstat (limited to 'sys/dev/usb/controller/xhci.c')
-rw-r--r-- | sys/dev/usb/controller/xhci.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/dev/usb/controller/xhci.c b/sys/dev/usb/controller/xhci.c index 3006671..fd0e254 100644 --- a/sys/dev/usb/controller/xhci.c +++ b/sys/dev/usb/controller/xhci.c @@ -1550,6 +1550,7 @@ xhci_setup_generic_chain_sub(struct xhci_std_temp *temp) uint32_t buf_offset; uint32_t average; uint32_t len_old; + uint32_t npkt_off; uint32_t dword; uint8_t shortpkt_old; uint8_t precompute; @@ -1560,6 +1561,7 @@ xhci_setup_generic_chain_sub(struct xhci_std_temp *temp) buf_offset = 0; shortpkt_old = temp->shortpkt; len_old = temp->len; + npkt_off = 0; precompute = 1; restart: @@ -1666,7 +1668,7 @@ restart: /* fill out buffer pointers */ if (average == 0) { - npkt = 1; + npkt = 0; memset(&buf_res, 0, sizeof(buf_res)); } else { usbd_get_page(temp->pc, temp->offset + @@ -1680,8 +1682,10 @@ restart: if (buf_res.length > XHCI_TD_PAGE_SIZE) buf_res.length = XHCI_TD_PAGE_SIZE; + npkt_off += buf_res.length; + /* setup npkt */ - npkt = (average + temp->max_packet_size - 1) / + npkt = (len_old - npkt_off + temp->max_packet_size - 1) / temp->max_packet_size; if (npkt > 31) |