diff options
author | Brad Smith <brad@cvs.openbsd.org> | 2008-11-07 17:38:00 +0000 |
---|---|---|
committer | Brad Smith <brad@cvs.openbsd.org> | 2008-11-07 17:38:00 +0000 |
commit | 166b40ff5481b22ea4307bcb0102d7b5014f5367 (patch) | |
tree | 0ab8e268fd2d6d4d1a9baadc5beef5804566251e /sys/dev | |
parent | e374d113d8c95a862d57eb44496cca61e2b47114 (diff) |
- According to the Apple GMAC driver, the GEM ASIC specification and
the OpenSolaris eri(7D) the TX FIFO threshold has to be set to 0x4ff
for the Gigabit variants and 0x100 for the ERI in order to avoid TX
underruns.
- Turn on workarounds for silicon bugs in the Apple GMAC variants.
This was based on information obtained from the Darwin GMAC and Linux GEM
drivers.
- Turn on "infinite" (i.e. maximum 31 * 64 bytes in length) DMA bursts.
From FreeBSD
Tested by a few users with Apple GMAC's and Sun ERI.
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/ic/gem.c | 24 | ||||
-rw-r--r-- | sys/dev/ic/gemreg.h | 8 |
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 |