From owner-svn-src-all@FreeBSD.ORG Tue Apr 22 13:58:40 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 44F4B9A6; Tue, 22 Apr 2014 13:58:40 +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 2529E1908; Tue, 22 Apr 2014 13:58:40 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s3MDweq8053286; Tue, 22 Apr 2014 13:58:40 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s3MDwd7c053284; Tue, 22 Apr 2014 13:58:39 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201404221358.s3MDwd7c053284@svn.freebsd.org> From: Marius Strobl Date: Tue, 22 Apr 2014 13:58:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r264764 - stable/8/sys/dev/usb/controller X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Apr 2014 13:58:40 -0000 Author: marius Date: Tue Apr 22 13:58:39 2014 New Revision: 264764 URL: http://svnweb.freebsd.org/changeset/base/264764 Log: MFC: r249336 Add ID for ASMedia ASM1042 USB 3.0 controller. MFC: r253094 Use MSI for xhci(4), if supported. MFC: r253398 Add a tunable to force disable MSI use for xhci(4). Modified: stable/8/sys/dev/usb/controller/xhci.h stable/8/sys/dev/usb/controller/xhci_pci.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.h ============================================================================== --- stable/8/sys/dev/usb/controller/xhci.h Tue Apr 22 13:02:12 2014 (r264763) +++ stable/8/sys/dev/usb/controller/xhci.h Tue Apr 22 13:58:39 2014 (r264764) @@ -441,6 +441,7 @@ struct xhci_softc { struct usb_device *sc_devices[XHCI_MAX_DEVICES]; struct resource *sc_io_res; + int sc_irq_rid; struct resource *sc_irq_res; void *sc_intr_hdl; Modified: stable/8/sys/dev/usb/controller/xhci_pci.c ============================================================================== --- stable/8/sys/dev/usb/controller/xhci_pci.c Tue Apr 22 13:02:12 2014 (r264763) +++ stable/8/sys/dev/usb/controller/xhci_pci.c Tue Apr 22 13:58:39 2014 (r264764) @@ -99,6 +99,9 @@ xhci_pci_match(device_t self) case 0x01941033: return ("NEC uPD720200 USB 3.0 controller"); + case 0x10421b21: + return ("ASMedia ASM1042 USB 3.0 controller"); + case 0x9c318086: case 0x1e318086: return ("Intel Panther Point USB 3.0 controller"); @@ -130,6 +133,9 @@ xhci_pci_probe(device_t self) } } +static int xhci_use_msi = 1; +TUNABLE_INT("hw.usb.xhci.msi", &xhci_use_msi); + static int xhci_pci_port_route(device_t self, uint32_t set, uint32_t clear) { @@ -153,8 +159,7 @@ static int xhci_pci_attach(device_t self) { struct xhci_softc *sc = device_get_softc(self); - int err; - int rid; + int count, err, rid; /* XXX check for 64-bit capability */ @@ -176,9 +181,20 @@ xhci_pci_attach(device_t self) sc->sc_io_hdl = rman_get_bushandle(sc->sc_io_res); sc->sc_io_size = rman_get_size(sc->sc_io_res); - rid = 0; - sc->sc_irq_res = bus_alloc_resource_any(self, SYS_RES_IRQ, &rid, - RF_SHAREABLE | RF_ACTIVE); + sc->sc_irq_rid = 0; + if (xhci_use_msi) { + count = pci_msi_count(self); + if (count >= 1) { + count = 1; + if (pci_alloc_msi(self, &count) == 0) { + if (bootverbose) + device_printf(self, "MSI enabled\n"); + sc->sc_irq_rid = 1; + } + } + } + sc->sc_irq_res = bus_alloc_resource_any(self, SYS_RES_IRQ, + &sc->sc_irq_rid, RF_SHAREABLE | RF_ACTIVE); if (sc->sc_irq_res == NULL) { device_printf(self, "Could not allocate IRQ\n"); goto error; @@ -260,7 +276,10 @@ xhci_pci_detach(device_t self) sc->sc_intr_hdl = NULL; } if (sc->sc_irq_res) { - bus_release_resource(self, SYS_RES_IRQ, 0, sc->sc_irq_res); + if (sc->sc_irq_rid == 1) + pci_release_msi(self); + bus_release_resource(self, SYS_RES_IRQ, sc->sc_irq_rid, + sc->sc_irq_res); sc->sc_irq_res = NULL; } if (sc->sc_io_res) {