Date: Mon, 26 Jul 2010 17:31:15 +0000 (UTC) From: John Baldwin <jhb@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r210505 - head/sys/dev/cxgb Message-ID: <201007261731.o6QHVFUt037056@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jhb Date: Mon Jul 26 17:31:15 2010 New Revision: 210505 URL: http://svn.freebsd.org/changeset/base/210505 Log: - 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. Reviewed by: np MFC after: 1 week Modified: head/sys/dev/cxgb/cxgb_main.c Modified: head/sys/dev/cxgb/cxgb_main.c ============================================================================== --- head/sys/dev/cxgb/cxgb_main.c Mon Jul 26 16:26:26 2010 (r210504) +++ head/sys/dev/cxgb/cxgb_main.c Mon Jul 26 17:31:15 2010 (r210505) @@ -459,20 +459,18 @@ cxgb_controller_attach(device_t dev) /* 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); } touch_bars(dev);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201007261731.o6QHVFUt037056>