From owner-svn-src-head@FreeBSD.ORG Sun Apr 27 15:41:45 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9AED743F; Sun, 27 Apr 2014 15:41:45 +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 7B0691AB; Sun, 27 Apr 2014 15:41:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s3RFfjWp009483; Sun, 27 Apr 2014 15:41:45 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s3RFfika009477; Sun, 27 Apr 2014 15:41:44 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201404271541.s3RFfika009477@svn.freebsd.org> From: Hans Petter Selasky Date: Sun, 27 Apr 2014 15:41:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r265015 - head/sys/dev/usb/controller X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Apr 2014 15:41:45 -0000 Author: hselasky Date: Sun Apr 27 15:41:44 2014 New Revision: 265015 URL: http://svnweb.freebsd.org/changeset/base/265015 Log: Setting the IMOD value below 0x3F8 can cause IRQ lockups in the Intel LynxPoint USB 3.0 controllers found in MacBookPro 2013's. MFC after: 2 days Tested by: Huang Wen Hui Modified: head/sys/dev/usb/controller/xhci.c head/sys/dev/usb/controller/xhci.h head/sys/dev/usb/controller/xhci_pci.c head/sys/dev/usb/controller/xhcireg.h Modified: head/sys/dev/usb/controller/xhci.c ============================================================================== --- head/sys/dev/usb/controller/xhci.c Sun Apr 27 15:14:59 2014 (r265014) +++ head/sys/dev/usb/controller/xhci.c Sun Apr 27 15:41:44 2014 (r265015) @@ -495,8 +495,12 @@ xhci_start_controller(struct xhci_softc XWRITE4(sc, runt, XHCI_ERSTSZ(0), XHCI_ERSTS_SET(temp)); + /* Check if we should use the default IMOD value */ + if (sc->sc_imod_default == 0) + sc->sc_imod_default = XHCI_IMOD_DEFAULT; + /* Setup interrupt rate */ - XWRITE4(sc, runt, XHCI_IMOD(0), XHCI_IMOD_DEFAULT); + XWRITE4(sc, runt, XHCI_IMOD(0), sc->sc_imod_default); usbd_get_page(&sc->sc_hw.root_pc, 0, &buf_res); Modified: head/sys/dev/usb/controller/xhci.h ============================================================================== --- head/sys/dev/usb/controller/xhci.h Sun Apr 27 15:14:59 2014 (r265014) +++ head/sys/dev/usb/controller/xhci.h Sun Apr 27 15:41:44 2014 (r265015) @@ -481,6 +481,7 @@ struct xhci_softc { uint16_t sc_erst_max; uint16_t sc_event_idx; uint16_t sc_command_idx; + uint16_t sc_imod_default; uint8_t sc_event_ccs; uint8_t sc_command_ccs; Modified: head/sys/dev/usb/controller/xhci_pci.c ============================================================================== --- head/sys/dev/usb/controller/xhci_pci.c Sun Apr 27 15:14:59 2014 (r265014) +++ head/sys/dev/usb/controller/xhci_pci.c Sun Apr 27 15:41:44 2014 (r265015) @@ -242,6 +242,7 @@ xhci_pci_attach(device_t self) case 0x1e318086: /* Panther Point */ case 0x8c318086: /* Lynx Point */ sc->sc_port_route = &xhci_pci_port_route; + sc->sc_imod_default = XHCI_IMOD_DEFAULT_LP; break; default: break; Modified: head/sys/dev/usb/controller/xhcireg.h ============================================================================== --- head/sys/dev/usb/controller/xhcireg.h Sun Apr 27 15:14:59 2014 (r265014) +++ head/sys/dev/usb/controller/xhcireg.h Sun Apr 27 15:41:44 2014 (r265015) @@ -166,7 +166,8 @@ #define XHCI_IMOD_IVAL_SET(x) (((x) & 0xFFFF) << 0) /* 250ns unit */ #define XHCI_IMOD_ICNT_GET(x) (((x) >> 16) & 0xFFFF) /* 250ns unit */ #define XHCI_IMOD_ICNT_SET(x) (((x) & 0xFFFF) << 16) /* 250ns unit */ -#define XHCI_IMOD_DEFAULT 0x000001F4U /* 8000 IRQ/second */ +#define XHCI_IMOD_DEFAULT 0x000001F4U /* 8000 IRQs/second */ +#define XHCI_IMOD_DEFAULT_LP 0x000003F8U /* 4000 IRQs/second - LynxPoint */ #define XHCI_ERSTSZ(n) (0x0028 + (0x20 * (n))) /* XHCI event ring segment table size */ #define XHCI_ERSTS_GET(x) ((x) & 0xFFFF) #define XHCI_ERSTS_SET(x) ((x) & 0xFFFF)