svn commit: r234304 - head/sys/dev/ath
Adrian Chadd
adrian at FreeBSD.org
Sun Apr 15 00:04:24 UTC 2012
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
More information about the svn-src-all
mailing list