From owner-svn-src-stable@freebsd.org Mon Mar 7 09:42:18 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 73E2BA953B5; Mon, 7 Mar 2016 09:42:18 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2B409AF4; Mon, 7 Mar 2016 09:42:18 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u279gHAw060034; Mon, 7 Mar 2016 09:42:17 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u279gHk3060032; Mon, 7 Mar 2016 09:42:17 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201603070942.u279gHk3060032@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 7 Mar 2016 09:42:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r296446 - stable/10/sys/dev/usb/controller X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Mar 2016 09:42:18 -0000 Author: hselasky Date: Mon Mar 7 09:42:16 2016 New Revision: 296446 URL: https://svnweb.freebsd.org/changeset/base/296446 Log: MFC r295928: Configure the correct bMaxPacketSize for control endpoints before requesting the initial complete device descriptor and not as part of the subsequent babble error recovery. Babble means that the received USB packet was bigger than than configured maximum packet size. This only affects enumeration of FULL speed USB devices which use a bMaxPacketSize different from 8 bytes. This patch might help fix enumeration of USB devices which exhibit USB I/O errors in dmesg during boot. Modified: stable/10/sys/dev/usb/controller/xhci.c stable/10/sys/dev/usb/controller/xhci.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/usb/controller/xhci.c ============================================================================== --- stable/10/sys/dev/usb/controller/xhci.c Mon Mar 7 09:39:35 2016 (r296445) +++ stable/10/sys/dev/usb/controller/xhci.c Mon Mar 7 09:42:16 2016 (r296446) @@ -2363,6 +2363,8 @@ xhci_configure_endpoint(struct usb_devic /* store endpoint mode */ pepext->trb_ep_mode = ep_mode; + /* store bMaxPacketSize for control endpoints */ + pepext->trb_ep_maxp = edesc->wMaxPacketSize[0]; usb_pc_cpu_flush(pepext->page_cache); if (ep_mode == USB_EP_MODE_STREAMS) { @@ -2909,6 +2911,17 @@ xhci_transfer_insert(struct usb_xfer *xf return (USB_ERR_NOMEM); } + /* check if bMaxPacketSize changed */ + if (xfer->flags_int.control_xfr != 0 && + pepext->trb_ep_maxp != xfer->endpoint->edesc->wMaxPacketSize[0]) { + + DPRINTFN(8, "Reconfigure control endpoint\n"); + + /* force driver to reconfigure endpoint */ + pepext->trb_halted = 1; + pepext->trb_running = 0; + } + /* check for stopped condition, after putting transfer on interrupt queue */ if (pepext->trb_running == 0) { struct xhci_softc *sc = XHCI_BUS2SC(xfer->xroot->bus); Modified: stable/10/sys/dev/usb/controller/xhci.h ============================================================================== --- stable/10/sys/dev/usb/controller/xhci.h Mon Mar 7 09:39:35 2016 (r296445) +++ stable/10/sys/dev/usb/controller/xhci.h Mon Mar 7 09:42:16 2016 (r296446) @@ -383,6 +383,7 @@ struct xhci_endpoint_ext { uint8_t trb_halted; uint8_t trb_running; uint8_t trb_ep_mode; + uint8_t trb_ep_maxp; }; enum {