From owner-svn-src-all@FreeBSD.ORG Tue Oct 18 03:32:18 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A9ADB106566C; Tue, 18 Oct 2011 03:32:18 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 99A308FC15; Tue, 18 Oct 2011 03:32:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p9I3WIR3054312; Tue, 18 Oct 2011 03:32:18 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p9I3WI3U054310; Tue, 18 Oct 2011 03:32:18 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201110180332.p9I3WI3U054310@svn.freebsd.org> From: Adrian Chadd Date: Tue, 18 Oct 2011 03:32:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r226491 - head/sys/dev/ath X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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, 18 Oct 2011 03:32:18 -0000 Author: adrian Date: Tue Oct 18 03:32:18 2011 New Revision: 226491 URL: http://svn.freebsd.org/changeset/base/226491 Log: Add in a currently-disabled WAR for PCI NICs. Some earlier series (~AR5212?) play badly with BIOSes. In these instances, they may require a forced reset (by transitioning the NIC through D0 -> D3 -> D0) before they probe/attach correctly. This is currently disabled because: * I haven't figured out the "right" code to ensure this only happens for PCI NICs (not PCIe or Cardbus); * I haven't at all done wide scale testing for this, and I'm not yet ready for said wide-scale testing. I'm documenting this primarily so users with misbehaving NICs have something to tinker with. Obtained from: Atheros Modified: head/sys/dev/ath/if_ath_pci.c Modified: head/sys/dev/ath/if_ath_pci.c ============================================================================== --- head/sys/dev/ath/if_ath_pci.c Tue Oct 18 03:24:17 2011 (r226490) +++ head/sys/dev/ath/if_ath_pci.c Tue Oct 18 03:32:18 2011 (r226491) @@ -73,10 +73,27 @@ struct ath_pci_softc { #define BS_BAR 0x10 #define PCIR_RETRY_TIMEOUT 0x41 +#define PCIR_CFG_PMCSR 0x48 static void ath_pci_setup(device_t dev) { + /* Override the system latency timer */ + pci_write_config(dev, PCIR_LATTIMER, 0x80, 1); + + /* If a PCI NIC, force wakeup */ +#ifdef ATH_PCI_WAKEUP_WAR + /* XXX TODO: don't do this for non-PCI (ie, PCIe, Cardbus!) */ + if (1) { + uint16_t pmcsr; + pmcsr = pci_read_config(dev, PCIR_CFG_PMCSR, 2); + pmcsr |= 3; + pci_write_config(dev, PCIR_CFG_PMCSR, pmcsr, 2); + pmcsr &= ~3; + pci_write_config(dev, PCIR_CFG_PMCSR, pmcsr, 2); + } +#endif + /* * Disable retry timeout to keep PCI Tx retries from * interfering with C3 CPU state.