From owner-svn-src-releng@FreeBSD.ORG Mon Oct 6 11:05:57 2014 Return-Path: Delivered-To: svn-src-releng@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 98DF71C5; Mon, 6 Oct 2014 11:05:57 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 7AB42929; Mon, 6 Oct 2014 11:05:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s96B5vdU012318; Mon, 6 Oct 2014 11:05:57 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s96B5vQg012314; Mon, 6 Oct 2014 11:05:57 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201410061105.s96B5vQg012314@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 6 Oct 2014 11:05:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r272608 - releng/10.1/sys/dev/usb/controller X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-releng@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the release engineering / security commits to the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Oct 2014 11:05:57 -0000 Author: hselasky Date: Mon Oct 6 11:05:56 2014 New Revision: 272608 URL: https://svnweb.freebsd.org/changeset/base/272608 Log: MFC r272349, r272422 and r272479: - Fix XHCI driver for devices which have more than 15 physical root HUB ports. The current bitmap array was too small to hold more than 16 bits and would at some point toggle the context size, which then would trigger an enumeration fault and cause a fallback to the EHCI companion controller, if any. - Make sure we always set the maximum number of valid contexts. - Set default cycle state in case of early interrupts. Approved by: re, marius Modified: releng/10.1/sys/dev/usb/controller/xhci.c releng/10.1/sys/dev/usb/controller/xhci.h Directory Properties: releng/10.1/ (props changed) Modified: releng/10.1/sys/dev/usb/controller/xhci.c ============================================================================== --- releng/10.1/sys/dev/usb/controller/xhci.c Mon Oct 6 11:00:47 2014 (r272607) +++ releng/10.1/sys/dev/usb/controller/xhci.c Mon Oct 6 11:05:56 2014 (r272608) @@ -618,6 +618,10 @@ xhci_init(struct xhci_softc *sc, device_ sc->sc_bus.devices = sc->sc_devices; sc->sc_bus.devices_max = XHCI_MAX_DEVICES; + /* set default cycle state in case of early interrupts */ + sc->sc_event_ccs = 1; + sc->sc_command_ccs = 1; + /* setup command queue mutex and condition varible */ cv_init(&sc->sc_cmd_cv, "CMDQ"); sx_init(&sc->sc_cmd_sx, "CMDQ lock"); @@ -2271,14 +2275,17 @@ xhci_configure_mask(struct usb_device *u /* adjust */ x--; - /* figure out maximum */ - if (x > sc->sc_hw.devs[index].context_num) { + /* figure out the maximum number of contexts */ + if (x > sc->sc_hw.devs[index].context_num) sc->sc_hw.devs[index].context_num = x; - temp = xhci_ctx_get_le32(sc, &pinp->ctx_slot.dwSctx0); - temp &= ~XHCI_SCTX_0_CTX_NUM_SET(31); - temp |= XHCI_SCTX_0_CTX_NUM_SET(x + 1); - xhci_ctx_set_le32(sc, &pinp->ctx_slot.dwSctx0, temp); - } + else + x = sc->sc_hw.devs[index].context_num; + + /* update number of contexts */ + temp = xhci_ctx_get_le32(sc, &pinp->ctx_slot.dwSctx0); + temp &= ~XHCI_SCTX_0_CTX_NUM_SET(31); + temp |= XHCI_SCTX_0_CTX_NUM_SET(x + 1); + xhci_ctx_set_le32(sc, &pinp->ctx_slot.dwSctx0, temp); } return (0); } Modified: releng/10.1/sys/dev/usb/controller/xhci.h ============================================================================== --- releng/10.1/sys/dev/usb/controller/xhci.h Mon Oct 6 11:00:47 2014 (r272607) +++ releng/10.1/sys/dev/usb/controller/xhci.h Mon Oct 6 11:05:56 2014 (r272608) @@ -493,7 +493,8 @@ struct xhci_softc { uint8_t sc_noscratch; /* root HUB device configuration */ uint8_t sc_conf; - uint8_t sc_hub_idata[2]; + /* root HUB port event bitmap, max 256 ports */ + uint8_t sc_hub_idata[32]; /* size of context */ uint8_t sc_ctx_is_64_byte;