PERFORCE change 113182 for review
Hans Petter Selasky
hselasky at FreeBSD.org
Fri Jan 19 22:26:30 UTC 2007
http://perforce.freebsd.org/chv.cgi?CH=113182
Change 113182 by hselasky at hselasky_mini_itx on 2007/01/19 22:25:45
Fix a data-toggle error that was introduced by change 113175.
Affected files ...
.. //depot/projects/usb/src/sys/dev/usb/ehci.c#17 edit
Differences ...
==== //depot/projects/usb/src/sys/dev/usb/ehci.c#17 (text+ko) ====
@@ -1039,8 +1039,7 @@
{
u_int32_t status = 0;
u_int32_t actlen = 0;
- uint32_t qtd_next;
- u_int16_t len;
+ u_int16_t len = 0;
ehci_qtd_t *td = xfer->td_transfer_first;
DPRINTFN(12, ("xfer=%p pipe=%p transfer done\n",
@@ -1059,51 +1058,44 @@
td = td->obj_next)
{
usbd_page_sync(td->page, BUS_DMASYNC_PREREAD);
-
status = le32toh(td->qtd_status);
- qtd_next = le32toh(td->qtd_next);
-
usbd_page_sync(td->page, BUS_DMASYNC_POSTREAD);
if (status & EHCI_QTD_ACTIVE) {
+
+ /* if there are left over TDs
+ * the toggle needs to be updated
+ */
+ xfer->pipe->toggle_next =
+ (status & EHCI_QTD_SET_TOGGLE(1)) ? 1 : 0;
break;
}
- /* halt is ok if descriptor is last, and complete */
- if((qtd_next == EHCI_LINK_TERMINATE) &&
- (EHCI_QTD_GET_BYTES(status) == 0))
- {
- status &= ~EHCI_QTD_HALTED;
- }
-
len = EHCI_QTD_GET_BYTES(status);
- if(len <= td->len)
- {
+ if (len <= td->len) {
actlen += td->len - len;
}
if (((void *)td) == xfer->td_transfer_last) {
+ if (len == 0) {
+ /* halt is ok if descriptor is last,
+ * and complete:
+ */
+ status &= ~EHCI_QTD_HALTED;
+ }
td = NULL;
break;
}
}
- /* if there are left over TDs
- * the toggle needs to be updated
- */
- if(td != NULL)
- {
- xfer->pipe->toggle_next =
- (td->qtd_status & htole32(EHCI_QTD_SET_TOGGLE(1))) ? 1 : 0;
+ if (len) {
+ /* update toggle in case of
+ * a short transfer
+ */
+ xfer->pipe->toggle_next ^= (len / xfer->max_packet_size) & 1;
}
- /* update toggle in case of
- * a short transfer
- */
- xfer->pipe->toggle_next ^= (EHCI_QTD_GET_BYTES(status) /
- xfer->max_packet_size) & 1;
-
DPRINTFN(10, ("actlen=%d\n", actlen));
xfer->actlen = actlen;
More information about the p4-projects
mailing list