summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkrw <krw@openbsd.org>2007-01-19 01:16:14 +0000
committerkrw <krw@openbsd.org>2007-01-19 01:16:14 +0000
commit7209f7a909f366d16beb0e5a11bcfdb577ba628a (patch)
tree7a40ec4970bcbe7e2a7cad2a7877be5919981864
parentextra safety check for NULL value. (diff)
downloadwireguard-openbsd-7209f7a909f366d16beb0e5a11bcfdb577ba628a.tar.xz
wireguard-openbsd-7209f7a909f366d16beb0e5a11bcfdb577ba628a.zip
Workarounds for DMA HW errata on pci express chips. Based on FreeBSD
changes but with the more conservative (i.e. specific) chip matching logic of Linux's tg3. No change except to pci express chips. From Brad. Tested by brad & thib@ (BCM5750) and pedro la peu (BCM5752).
-rw-r--r--sys/dev/pci/if_bge.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/sys/dev/pci/if_bge.c b/sys/dev/pci/if_bge.c
index 105815e299f..4f9d0afd33a 100644
--- a/sys/dev/pci/if_bge.c
+++ b/sys/dev/pci/if_bge.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_bge.c,v 1.203 2007/01/10 23:04:53 kettenis Exp $ */
+/* $OpenBSD: if_bge.c,v 1.204 2007/01/19 01:16:14 krw Exp $ */
/*
* Copyright (c) 2001 Wind River Systems
@@ -1248,6 +1248,7 @@ bge_blockinit(struct bge_softc *sc)
vaddr_t rcb_addr;
int i;
bge_hostaddr taddr;
+ u_int32_t val;
/*
* Initialize the memory window pointer register so that
@@ -1380,8 +1381,16 @@ bge_blockinit(struct bge_softc *sc)
* values are 1/8th the number of descriptors allocated to
* each ring.
*/
- CSR_WRITE_4(sc, BGE_RBDI_STD_REPL_THRESH, BGE_STD_RX_RING_CNT/8);
- CSR_WRITE_4(sc, BGE_RBDI_JUMBO_REPL_THRESH, BGE_JUMBO_RX_RING_CNT/8);
+ i = BGE_STD_RX_RING_CNT / 8;
+
+ /* Use a value of 8 for these chips to workaround HW errata */
+ if (BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5750 ||
+ BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5752 ||
+ BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5755)
+ i = 8;
+
+ CSR_WRITE_4(sc, BGE_RBDI_STD_REPL_THRESH, i);
+ CSR_WRITE_4(sc, BGE_RBDI_JUMBO_REPL_THRESH, BGE_JUMBO_RX_RING_CNT / 8);
/*
* Disable all unused send rings by setting the 'ring disabled'
@@ -1549,9 +1558,15 @@ bge_blockinit(struct bge_softc *sc)
if (!(BGE_IS_5705_OR_BEYOND(sc)))
CSR_WRITE_4(sc, BGE_DMAC_MODE, BGE_DMACMODE_ENABLE);
+ val = BGE_WDMAMODE_ENABLE|BGE_WDMAMODE_ALL_ATTNS;
+
+ /* Enable host coalescing bug fix. */
+ if (BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5755 ||
+ BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5787)
+ val |= (1 << 29);
+
/* Turn on write DMA state machine */
- CSR_WRITE_4(sc, BGE_WDMA_MODE,
- BGE_WDMAMODE_ENABLE|BGE_WDMAMODE_ALL_ATTNS);
+ CSR_WRITE_4(sc, BGE_WDMA_MODE, val);
/* Turn on read DMA state machine */
{