From owner-svn-src-stable-7@FreeBSD.ORG Thu Aug 5 20:45:47 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0F0FC1065677; Thu, 5 Aug 2010 20:45:47 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F0ADB8FC0C; Thu, 5 Aug 2010 20:45:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o75KjkaZ001350; Thu, 5 Aug 2010 20:45:46 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o75Kjkhj001348; Thu, 5 Aug 2010 20:45:46 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201008052045.o75Kjkhj001348@svn.freebsd.org> From: John Baldwin Date: Thu, 5 Aug 2010 20:45:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r210896 - stable/7/sys/dev/cxgb X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2010 20:45:47 -0000 Author: jhb Date: Thu Aug 5 20:45:46 2010 New Revision: 210896 URL: http://svn.freebsd.org/changeset/base/210896 Log: MFC 210505: - Change the warning about PCI-e links narrower than x8 to only apply to 10G cards. 1G cards are x4 only. - Use constants from pcireg.h for reading the current link width. - Use pci_set_max_read_req() rather than implementing it by hand. Modified: stable/7/sys/dev/cxgb/cxgb_main.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/cxgb/cxgb_main.c ============================================================================== --- stable/7/sys/dev/cxgb/cxgb_main.c Thu Aug 5 20:40:13 2010 (r210895) +++ stable/7/sys/dev/cxgb/cxgb_main.c Thu Aug 5 20:45:46 2010 (r210896) @@ -461,20 +461,18 @@ cxgb_controller_attach(device_t dev) #ifdef MSI_SUPPORTED /* find the PCIe link width and set max read request to 4KB*/ if (pci_find_extcap(dev, PCIY_EXPRESS, ®) == 0) { - uint16_t lnk, pectl; - lnk = pci_read_config(dev, reg + 0x12, 2); - sc->link_width = (lnk >> 4) & 0x3f; - - pectl = pci_read_config(dev, reg + 0x8, 2); - pectl = (pectl & ~0x7000) | (5 << 12); - pci_write_config(dev, reg + 0x8, pectl, 2); - } + uint16_t lnk; + + lnk = pci_read_config(dev, reg + PCIR_EXPRESS_LINK_STA, 2); + sc->link_width = (lnk & PCIM_LINK_STA_WIDTH) >> 4; + if (sc->link_width < 8 && + (ai->caps & SUPPORTED_10000baseT_Full)) { + device_printf(sc->dev, + "PCIe x%d Link, expect reduced performance\n", + sc->link_width); + } - if (sc->link_width != 0 && sc->link_width <= 4 && - (ai->nports0 + ai->nports1) <= 2) { - device_printf(sc->dev, - "PCIe x%d Link, expect reduced performance\n", - sc->link_width); + pci_set_max_read_req(dev, 4096); } #endif touch_bars(dev);