From owner-svn-src-all@FreeBSD.ORG Sun Apr 15 00:04:24 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5C7571065670; Sun, 15 Apr 2012 00:04:24 +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 46E768FC0C; Sun, 15 Apr 2012 00:04:24 +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 q3F04Oa1055799; Sun, 15 Apr 2012 00:04:24 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q3F04O7V055797; Sun, 15 Apr 2012 00:04:24 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201204150004.q3F04O7V055797@svn.freebsd.org> From: Adrian Chadd Date: Sun, 15 Apr 2012 00:04:24 +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: r234304 - 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: Sun, 15 Apr 2012 00:04:24 -0000 Author: adrian Date: Sun Apr 15 00:04:23 2012 New Revision: 234304 URL: http://svn.freebsd.org/changeset/base/234304 Log: Override some default values to work around various issues in the deep, dirty and murky past. * Override the default cache line size to be something reasonable if it's set to 0. Some NICs initialise with '0' (eg embedded ones) and there are comments in the driver stating that various OSes (eg older Linux ones) would incorrectly program things and 0 out this register. * Just default to overriding the latency timer. Every other driver does this. * Use a default cache line size of 32 bytes. It should be "reasonable enough". Obtained from: Linux ath9k, 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 Sat Apr 14 23:59:58 2012 (r234303) +++ head/sys/dev/ath/if_ath_pci.c Sun Apr 15 00:04:23 2012 (r234304) @@ -82,13 +82,27 @@ struct ath_pci_softc { #define PCIR_RETRY_TIMEOUT 0x41 #define PCIR_CFG_PMCSR 0x48 +#define DEFAULT_CACHESIZE 32 + static void ath_pci_setup(device_t dev) { -#ifdef ATH_PCI_LATENCY_WAR + uint8_t cz; + + /* XXX TODO: need to override the _system_ saved copies of this */ + + /* + * If the cache line size is 0, force it to a reasonable + * value. + */ + cz = pci_read_config(dev, PCIR_CACHELNSZ, 1); + if (cz == 0) { + pci_write_config(dev, PCIR_CACHELNSZ, + DEFAULT_CACHESIZE / 4, 1); + } + /* Override the system latency timer */ - pci_write_config(dev, PCIR_LATTIMER, 0x80, 1); -#endif + pci_write_config(dev, PCIR_LATTIMER, 0xa8, 1); /* If a PCI NIC, force wakeup */ #ifdef ATH_PCI_WAKEUP_WAR