summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorBrad Smith <brad@cvs.openbsd.org>2008-09-23 00:27:19 +0000
committerBrad Smith <brad@cvs.openbsd.org>2008-09-23 00:27:19 +0000
commitd4a96941d2e6d5820329eed10d4ab55b2d22c201 (patch)
tree91158d83665e6b28df74e7ebaa42057c2ae42073 /sys
parent8a68ca413b39f6ea18c3edf66166d9a31999c165 (diff)
Rewrite two small sections of code in bge_blockinit() to simplify the
code. No functional change. ok krw@
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/pci/if_bge.c37
1 files changed, 17 insertions, 20 deletions
diff --git a/sys/dev/pci/if_bge.c b/sys/dev/pci/if_bge.c
index 943ddcce938..ece8c2fca30 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.244 2008/09/18 15:16:30 naddy Exp $ */
+/* $OpenBSD: if_bge.c,v 1.245 2008/09/23 00:27:18 brad Exp $ */
/*
* Copyright (c) 2001 Wind River Systems
@@ -1353,17 +1353,19 @@ bge_blockinit(struct bge_softc *sc)
/* Configure mbuf pool watermarks */
/* new Broadcom docs strongly recommend these: */
- if (!(BGE_IS_5705_OR_BEYOND(sc))) {
- CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_READDMA_LOWAT, 0x50);
- CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_MACRX_LOWAT, 0x20);
- CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_HIWAT, 0x60);
- } else if (BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5906) {
+ if (BGE_IS_5705_OR_BEYOND(sc)) {
CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_READDMA_LOWAT, 0x0);
- CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_MACRX_LOWAT, 0x04);
- CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_HIWAT, 0x10);
+
+ if (BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5906) {
+ CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_MACRX_LOWAT, 0x04);
+ CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_HIWAT, 0x10);
+ } else {
+ CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_MACRX_LOWAT, 0x10);
+ CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_HIWAT, 0x60);
+ }
} else {
- CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_READDMA_LOWAT, 0x0);
- CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_MACRX_LOWAT, 0x10);
+ CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_READDMA_LOWAT, 0x50);
+ CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_MACRX_LOWAT, 0x20);
CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_HIWAT, 0x60);
}
@@ -1663,18 +1665,13 @@ bge_blockinit(struct bge_softc *sc)
/* Turn on write DMA state machine */
CSR_WRITE_4(sc, BGE_WDMA_MODE, val);
- /* Turn on read DMA state machine */
- {
- uint32_t dma_read_modebits;
+ val = BGE_RDMAMODE_ENABLE|BGE_RDMAMODE_ALL_ATTNS;
- dma_read_modebits =
- BGE_RDMAMODE_ENABLE | BGE_RDMAMODE_ALL_ATTNS;
+ if (sc->bge_flags & BGE_PCIE)
+ val |= BGE_RDMAMODE_FIFO_LONG_BURST;
- if (sc->bge_flags & BGE_PCIE)
- dma_read_modebits |= BGE_RDMAMODE_FIFO_LONG_BURST;
-
- CSR_WRITE_4(sc, BGE_RDMA_MODE, dma_read_modebits);
- }
+ /* Turn on read DMA state machine */
+ CSR_WRITE_4(sc, BGE_RDMA_MODE, val);
/* Turn on RX data completion state machine */
CSR_WRITE_4(sc, BGE_RDC_MODE, BGE_RDCMODE_ENABLE);