summaryrefslogtreecommitdiff
path: root/sys/dev
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
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')
-rw-r--r--sys/dev/pci/if_bge.c28
-rw-r--r--sys/dev/pci/if_bgereg.h4
2 files changed, 23 insertions, 9 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;
diff --git a/sys/dev/pci/if_bgereg.h b/sys/dev/pci/if_bgereg.h
index 3c5b523b470..1e40661ac10 100644
--- a/sys/dev/pci/if_bgereg.h
+++ b/sys/dev/pci/if_bgereg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_bgereg.h,v 1.100 2010/01/09 06:19:01 naddy Exp $ */
+/* $OpenBSD: if_bgereg.h,v 1.101 2010/07/09 00:04:42 sthen Exp $ */
/*
* Copyright (c) 2001 Wind River Systems
@@ -1517,6 +1517,7 @@
#define BGE_RDMAMODE_MBUF_SBD_CRPT_ATTN 0x00002000
#define BGE_RDMAMODE_FIFO_SIZE_128 0x00020000
#define BGE_RDMAMODE_FIFO_LONG_BURST 0x00030000
+#define BGE_RDMAMODE_MULT_DMA_RD_DIS 0x01000000
/* Read DMA status register */
#define BGE_RDMASTAT_PCI_TGT_ABRT_ATTN 0x00000004
@@ -1548,6 +1549,7 @@
#define BGE_WDMAMODE_ALL_ATTNS 0x000003FC
#define BGE_WDMAMODE_RX_ACCEL 0x00000400
#define BGE_WDMAMODE_STATUS_TAG_FIX 0x20000000
+#define BGE_WDMAMODE_BURST_ALL_DATA 0xc0000000
/* Write DMA status register */
#define BGE_WDMASTAT_PCI_TGT_ABRT_ATTN 0x00000004