Date: Mon, 21 Jun 2010 16:37:11 GMT From: Hans Petter Selasky <hselasky@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 180041 for review Message-ID: <201006211637.o5LGbBGV039699@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@180041?ac=10 Change 180041 by hselasky@hselasky_laptop001 on 2010/06/21 16:36:49 USB controller (OCTUSB): - fix bug regarding control endpoint - update Makefile to not compile removed file Affected files ... .. //depot/projects/usb/src/sys/dev/usb/controller/octusb.c#4 edit .. //depot/projects/usb/src/sys/modules/usb/octusb/Makefile#2 edit Differences ... ==== //depot/projects/usb/src/sys/dev/usb/controller/octusb.c#4 (text+ko) ==== @@ -279,14 +279,14 @@ td->offset += 8; td->remainder -= 8; + /* setup data length and offset */ td->qh->fixup_len = UGETW(td->qh->fixup_buf + 6); + td->qh->fixup_off = 0; + if (td->qh->fixup_len > (OCTUSB_MAX_FIXUP - 8)) { td->error_any = 1; return (0); /* done */ } - td->qh->fixup_len += 8; - td->qh->fixup_off = 8; - /* do control IN request */ if (td->qh->fixup_buf[0] & UE_DIR_IN) { @@ -301,7 +301,7 @@ status = cvmx_usb_submit_control( &sc->sc_port[td->qh->port_index].state, td->qh->ep_handle, td->qh->fixup_phys, - td->qh->fixup_phys + 8ULL, td->qh->fixup_len - 8, + td->qh->fixup_phys + 8, td->qh->fixup_len, &octusb_complete_cb, td); /* check status */ if (status < 0) { @@ -337,7 +337,8 @@ DPRINTFN(1, "Excess setup transmit data\n"); return (0); /* done */ } - usbd_copy_out(td->pc, td->offset, td->qh->fixup_buf + td->qh->fixup_off, td->remainder); + usbd_copy_out(td->pc, td->offset, td->qh->fixup_buf + + td->qh->fixup_off + 8, td->remainder); td->offset += td->remainder; td->qh->fixup_off += td->remainder; @@ -360,12 +361,13 @@ return (0); /* done */ /* copy data from buffer */ - rem = 8 + td->qh->fixup_actlen - td->qh->fixup_off; + rem = td->qh->fixup_actlen - td->qh->fixup_off; if (rem > td->remainder) rem = td->remainder; - usbd_copy_in(td->pc, td->offset, td->qh->fixup_buf + td->qh->fixup_off, rem); + usbd_copy_in(td->pc, td->offset, td->qh->fixup_buf + + td->qh->fixup_off + 8, rem); td->offset += rem; td->remainder -= rem; @@ -408,7 +410,7 @@ status = cvmx_usb_submit_control( &sc->sc_port[td->qh->port_index].state, td->qh->ep_handle, td->qh->fixup_phys, - td->qh->fixup_phys + 8ULL, td->qh->fixup_len - 8, + td->qh->fixup_phys + 8, td->qh->fixup_len, &octusb_complete_cb, td); /* check status */ @@ -1119,18 +1121,23 @@ static void octusb_device_done(struct usb_xfer *xfer, usb_error_t error) { - struct octusb_td *td; - USB_BUS_LOCK_ASSERT(xfer->xroot->bus, MA_OWNED); DPRINTFN(2, "xfer=%p, endpoint=%p, error=%d\n", xfer, xfer->endpoint, error); - td = xfer->td_start[0]; + /* + * 1) Free any endpoints. + * 2) Control transfers can be split and we should not re-open + * the data pipe between transactions unless there is an error. + */ + if ((xfer->flags_int.control_act == 0) || (error != 0)) { + struct octusb_td *td; - /* free any endpoints */ - octusb_host_free_endpoint(td); + td = xfer->td_start[0]; + octusb_host_free_endpoint(td); + } /* dequeue transfer and start next transfer */ usbd_transfer_done(xfer, error); } ==== //depot/projects/usb/src/sys/modules/usb/octusb/Makefile#2 (text+ko) ==== @@ -32,6 +32,6 @@ KMOD= octusb SRCS= bus_if.h device_if.h usb_if.h \ opt_bus.h opt_usb.h \ - octusb_mips.c octusb.c octusb.h + octusb.c octusb.h .include <bsd.kmod.mk>
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201006211637.o5LGbBGV039699>