Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 19 Dec 2013 07:17:19 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r259605 - stable/8/sys/dev/usb/controller
Message-ID:  <201312190717.rBJ7HJMf096301@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Thu Dec 19 07:17:18 2013
New Revision: 259605
URL: http://svnweb.freebsd.org/changeset/base/259605

Log:
  MFC r259248 and r259462:
  Set chain bit correctly. This will fix some problems sending and
  receiving Zero Length Packets, ZLPs. See comment in code for more
  information.

Modified:
  stable/8/sys/dev/usb/controller/xhci.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/dev/   (props changed)
  stable/8/sys/dev/usb/   (props changed)

Modified: stable/8/sys/dev/usb/controller/xhci.c
==============================================================================
--- stable/8/sys/dev/usb/controller/xhci.c	Thu Dec 19 07:17:07 2013	(r259604)
+++ stable/8/sys/dev/usb/controller/xhci.c	Thu Dec 19 07:17:18 2013	(r259605)
@@ -1858,7 +1858,16 @@ restart:
 		td->td_trb[x].dwTrb2 = htole32(dword);
 
 		dword = XHCI_TRB_3_TYPE_SET(XHCI_TRB_TYPE_LINK) |
-		    XHCI_TRB_3_CYCLE_BIT | XHCI_TRB_3_IOC_BIT;
+		    XHCI_TRB_3_CYCLE_BIT | XHCI_TRB_3_IOC_BIT |
+		    /*
+		     * CHAIN-BIT: Ensure that a multi-TRB IN-endpoint
+		     * frame only receives a single short packet event
+		     * by setting the CHAIN bit in the LINK field. In
+		     * addition some XHCI controllers have problems
+		     * sending a ZLP unless the CHAIN-BIT is set in
+		     * the LINK TRB.
+		     */
+		    XHCI_TRB_3_CHAIN_BIT;
 
 		td->td_trb[x].dwTrb3 = htole32(dword);
 
@@ -1896,9 +1905,11 @@ restart:
 	}
 
 	/* clear TD SIZE to zero, hence this is the last TRB */
-	/* remove chain bit because this is the last TRB in the chain */
+	/* remove chain bit because this is the last data TRB in the chain */
 	td->td_trb[td->ntrb - 1].dwTrb2 &= ~htole32(XHCI_TRB_2_TDSZ_SET(15));
 	td->td_trb[td->ntrb - 1].dwTrb3 &= ~htole32(XHCI_TRB_3_CHAIN_BIT);
+	/* remove CHAIN-BIT from last LINK TRB */
+	td->td_trb[td->ntrb].dwTrb3 &= ~htole32(XHCI_TRB_3_CHAIN_BIT);
 
 	usb_pc_cpu_flush(td->page_cache);
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201312190717.rBJ7HJMf096301>