From owner-svn-src-user@FreeBSD.ORG Tue Jun 22 18:56:10 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 51C9C1065673; Tue, 22 Jun 2010 18:56:10 +0000 (UTC) (envelope-from jmallett@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 413B68FC1A; Tue, 22 Jun 2010 18:56:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o5MIuAGh029102; Tue, 22 Jun 2010 18:56:10 GMT (envelope-from jmallett@svn.freebsd.org) Received: (from jmallett@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o5MIuAH8029100; Tue, 22 Jun 2010 18:56:10 GMT (envelope-from jmallett@svn.freebsd.org) Message-Id: <201006221856.o5MIuAH8029100@svn.freebsd.org> From: Juli Mallett Date: Tue, 22 Jun 2010 18:56:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r209436 - user/jmallett/octeon/sys/mips/cavium/usb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Jun 2010 18:56:10 -0000 Author: jmallett Date: Tue Jun 22 18:56:09 2010 New Revision: 209436 URL: http://svn.freebsd.org/changeset/base/209436 Log: Merge latest from hps@. Modified: user/jmallett/octeon/sys/mips/cavium/usb/octusb.c Modified: user/jmallett/octeon/sys/mips/cavium/usb/octusb.c ============================================================================== --- user/jmallett/octeon/sys/mips/cavium/usb/octusb.c Tue Jun 22 18:54:06 2010 (r209435) +++ user/jmallett/octeon/sys/mips/cavium/usb/octusb.c Tue Jun 22 18:56:09 2010 (r209436) @@ -282,14 +282,14 @@ octusb_host_control_header_tx(struct oct 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) { @@ -304,7 +304,7 @@ octusb_host_control_header_tx(struct oct 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) { @@ -340,7 +340,8 @@ octusb_host_control_data_tx(struct octus 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; @@ -363,12 +364,13 @@ octusb_host_control_data_rx(struct octus 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; @@ -411,7 +413,7 @@ octusb_host_control_status_tx(struct oct 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 */ @@ -1122,18 +1124,23 @@ octusb_setup_standard_chain(struct usb_x 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); }