summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/ic/gem.c24
-rw-r--r--sys/dev/ic/gemreg.h8
2 files changed, 27 insertions, 5 deletions
diff --git a/sys/dev/ic/gem.c b/sys/dev/ic/gem.c
index 231eebcf580..35f7fb181df 100644
--- a/sys/dev/ic/gem.c
+++ b/sys/dev/ic/gem.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: gem.c,v 1.79 2008/10/02 20:21:13 brad Exp $ */
+/* $OpenBSD: gem.c,v 1.80 2008/11/07 17:37:59 brad Exp $ */
/* $NetBSD: gem.c,v 1.1 2001/09/16 00:11:43 eeh Exp $ */
/*
@@ -772,9 +772,9 @@ gem_init(struct ifnet *ifp)
/* Enable DMA */
v = gem_ringsize(GEM_NTXDESC /*XXX*/);
- bus_space_write_4(t, h, GEM_TX_CONFIG,
- v|GEM_TX_CONFIG_TXDMA_EN|
- ((0x4ff<<10)&GEM_TX_CONFIG_TXFIFO_TH));
+ v |= ((sc->sc_variant == GEM_SUN_ERI ? 0x100 : 0x04ff) << 10) &
+ GEM_TX_CONFIG_TXFIFO_TH;
+ bus_space_write_4(t, h, GEM_TX_CONFIG, v | GEM_TX_CONFIG_TXDMA_EN);
bus_space_write_4(t, h, GEM_TX_KICK, 0);
/* step 10. ERX Configuration */
@@ -891,6 +891,22 @@ gem_init_regs(struct gem_softc *sc)
bus_space_write_4(t, h, GEM_MAC_SEND_PAUSE_CMD, 0);
/*
+ * Set the internal arbitration to "infinite" bursts of the
+ * maximum length of 31 * 64 bytes so DMA transfers aren't
+ * split up in cache line size chunks. This greatly improves
+ * especially RX performance.
+ * Enable silicon bug workarounds for the Apple variants.
+ */
+ v = GEM_CONFIG_TXDMA_LIMIT | GEM_CONFIG_RXDMA_LIMIT;
+ if (sc->sc_pci)
+ v |= GEM_CONFIG_BURST_INF;
+ else
+ v |= GEM_CONFIG_BURST_64;
+ if (sc->sc_variant != GEM_SUN_GEM && sc->sc_variant != GEM_SUN_ERI)
+ v |= GEM_CONFIG_RONPAULBIT | GEM_CONFIG_BUG2FIX;
+ bus_space_write_4(t, h, GEM_CONFIG, v);
+
+ /*
* Set the station address.
*/
bus_space_write_4(t, h, GEM_MAC_ADDR0,
diff --git a/sys/dev/ic/gemreg.h b/sys/dev/ic/gemreg.h
index f4611b9de8e..6af92380c84 100644
--- a/sys/dev/ic/gemreg.h
+++ b/sys/dev/ic/gemreg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: gemreg.h,v 1.13 2007/05/18 02:18:28 dlg Exp $ */
+/* $OpenBSD: gemreg.h,v 1.14 2008/11/07 17:37:59 brad Exp $ */
/* $NetBSD: gemreg.h,v 1.1 2001/09/16 00:11:43 eeh Exp $ */
/*
@@ -76,6 +76,12 @@
#define GEM_CONFIG_BURST_INF 0x000000001 /* 0->infinity, 1->64KB */
#define GEM_CONFIG_TXDMA_LIMIT 0x00000003e
#define GEM_CONFIG_RXDMA_LIMIT 0x0000007c0
+/* GEM_CONFIG_RONPAULBIT and GEM_CONFIG_BUG2FIX are Apple only. */
+#define GEM_CONFIG_RONPAULBIT 0x000000800 /* after infinite burst use
+ * memory read multiple for
+ * PCI commands */
+#define GEM_CONFIG_BUG2FIX 0x000001000 /* fix RX hang after overflow */
+
#define GEM_CONFIG_TXDMA_LIMIT_SHIFT 1
#define GEM_CONFIG_RXDMA_LIMIT_SHIFT 6