summaryrefslogtreecommitdiff
path: root/sys/dev/pci/if_bge.c
diff options
context:
space:
mode:
authorStuart Henderson <sthen@cvs.openbsd.org>2010-07-09 00:04:43 +0000
committerStuart Henderson <sthen@cvs.openbsd.org>2010-07-09 00:04:43 +0000
commit8d91ff6a6ad4b3838d6a684fbe7927505636a609 (patch)
tree2e755143e35346d04021a4fc7502e60fa6f3035b /sys/dev/pci/if_bge.c
parent2b2bb92735e1bc2a0f341794b9f1c81f3656b8c0 (diff)
- Setup proper mbuf pool watermarks for BCM5717 / BCM57765 chipsets.
- Disable initiation of multiple DMA reads for BCM5717 chipset to workaround errata. - Performance tweak for BCM5785 chipset. - Correct the return ring count used for BCM5717 / BCM57765 chipsets. - Fix fiber media detection for BCM5717 chipsets as they use a MII-based fiber PHY. From Brad, based on info gleaned from the Linux tg3 driver. Should only affect the new chipsets, but tested for regressions anyway (on BCM5701, BCM5703, BCM5704C, BCM5705M Alt, BCM5722, BCM5751, BCM5751M, BCM5780) by Brad, weerd@, myself and Denis Doroshenko.
Diffstat (limited to 'sys/dev/pci/if_bge.c')
-rw-r--r--sys/dev/pci/if_bge.c28
1 files changed, 20 insertions, 8 deletions
diff --git a/sys/dev/pci/if_bge.c b/sys/dev/pci/if_bge.c
index 1bfa06f1c6a..79bf3cbe74b 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.293 2010/04/06 15:27:51 naddy Exp $ */
+/* $OpenBSD: if_bge.c,v 1.294 2010/07/09 00:04:42 sthen Exp $ */
/*
* Copyright (c) 2001 Wind River Systems
@@ -1352,9 +1352,12 @@ bge_blockinit(struct bge_softc *sc)
/* Configure mbuf pool watermarks */
/* new Broadcom docs strongly recommend these: */
- if (BGE_IS_5705_PLUS(sc) &&
- BGE_ASICREV(sc->bge_chipid) != BGE_ASICREV_BCM5717 &&
- BGE_ASICREV(sc->bge_chipid) != BGE_ASICREV_BCM57765) {
+ if (BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5717 ||
+ BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM57765) {
+ CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_READDMA_LOWAT, 0x0);
+ CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_MACRX_LOWAT, 0x2a);
+ CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_HIWAT, 0xa0);
+ } else if (BGE_IS_5705_PLUS(sc)) {
CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_READDMA_LOWAT, 0x0);
if (BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5906) {
@@ -1660,11 +1663,17 @@ bge_blockinit(struct bge_softc *sc)
if (BGE_IS_5755_PLUS(sc))
val |= BGE_WDMAMODE_STATUS_TAG_FIX;
+ if (BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5785)
+ val |= BGE_WDMAMODE_BURST_ALL_DATA;
+
/* Turn on write DMA state machine */
CSR_WRITE_4(sc, BGE_WDMA_MODE, val);
val = BGE_RDMAMODE_ENABLE|BGE_RDMAMODE_ALL_ATTNS;
+ if (BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5717)
+ val |= BGE_RDMAMODE_MULT_DMA_RD_DIS;
+
if (BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5784 ||
BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5785 ||
BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM57780)
@@ -2116,10 +2125,12 @@ bge_attach(struct device *parent, struct device *self, void *aux)
sc->bge_tx_max_coal_bds = 400;
/* 5705 limits RX return ring to 512 entries. */
- if (BGE_IS_5705_PLUS(sc))
- sc->bge_return_ring_cnt = BGE_RETURN_RING_CNT_5705;
- else
+ if (BGE_IS_5700_FAMILY(sc) ||
+ BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5717 ||
+ BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM57765)
sc->bge_return_ring_cnt = BGE_RETURN_RING_CNT;
+ else
+ sc->bge_return_ring_cnt = BGE_RETURN_RING_CNT_5705;
/* Set up ifnet structure */
ifp = &sc->arpcom.ac_if;
@@ -2188,7 +2199,8 @@ bge_attach(struct device *parent, struct device *self, void *aux)
/* The SysKonnect SK-9D41 is a 1000baseSX card. */
if (PCI_PRODUCT(subid) == SK_SUBSYSID_9D41 ||
(hwcfg & BGE_HWCFG_MEDIA) == BGE_MEDIA_FIBER) {
- if (BGE_IS_5714_FAMILY(sc))
+ if (BGE_IS_5714_FAMILY(sc) ||
+ BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5717)
sc->bge_flags |= BGE_PHY_FIBER_MII;
else
sc->bge_flags |= BGE_PHY_FIBER_TBI;