Date: Sun, 15 Apr 2012 00:04:24 +0000 (UTC) From: Adrian Chadd <adrian@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r234304 - head/sys/dev/ath Message-ID: <201204150004.q3F04O7V055797@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201204150004.q3F04O7V055797>