diff options
author | Christian Weisgerber <naddy@cvs.openbsd.org> | 2009-07-21 13:09:42 +0000 |
---|---|---|
committer | Christian Weisgerber <naddy@cvs.openbsd.org> | 2009-07-21 13:09:42 +0000 |
commit | 7ca85a069ee41a122f19fb2d2d13178e1a9ff0cb (patch) | |
tree | 9aa632b7fbe5ea79ac076ada46a8c9d9581974d4 | |
parent | ebcd82b44186331bb77a8a7c558a39b299398222 (diff) |
Add a family flag for the original 5700 series chipsets. Idea from FreeBSD.
But also use the flag where it makes sense. From Brad; ok sthen@
-rw-r--r-- | sys/dev/pci/if_bge.c | 32 | ||||
-rw-r--r-- | sys/dev/pci/if_bgereg.h | 3 |
2 files changed, 21 insertions, 14 deletions
diff --git a/sys/dev/pci/if_bge.c b/sys/dev/pci/if_bge.c index 4cfefcb64f4..8512fe7bf1e 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.276 2009/06/19 21:31:54 naddy Exp $ */ +/* $OpenBSD: if_bge.c,v 1.277 2009/07/21 13:09:41 naddy Exp $ */ /* * Copyright (c) 2001 Wind River Systems @@ -298,6 +298,7 @@ const struct pci_matchid bge_devices[] = { #define BGE_IS_5705_PLUS(sc) ((sc)->bge_flags & BGE_5705_PLUS) #define BGE_IS_5750_PLUS(sc) ((sc)->bge_flags & BGE_5750_PLUS) #define BGE_IS_5755_PLUS(sc) ((sc)->bge_flags & BGE_5755_PLUS) +#define BGE_IS_5700_FAMILY(sc) ((sc)->bge_flags & BGE_5700_FAMILY) #define BGE_IS_5714_FAMILY(sc) ((sc)->bge_flags & BGE_5714_FAMILY) #define BGE_IS_JUMBO_CAPABLE(sc) ((sc)->bge_flags & BGE_JUMBO_CAPABLE) @@ -1336,7 +1337,7 @@ bge_blockinit(struct bge_softc *sc) CSR_WRITE_4(sc, BGE_PCI_MEMWIN_BASEADDR, 0); /* Configure mbuf memory pool */ - if (!(BGE_IS_5705_PLUS(sc))) { + if (BGE_IS_5700_FAMILY(sc)) { CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_BASEADDR, BGE_BUFFPOOL_1); @@ -1489,7 +1490,7 @@ bge_blockinit(struct bge_softc *sc) RCB_WRITE_4(sc, rcb_addr, bge_hostaddr.bge_addr_lo, taddr.bge_addr_lo); RCB_WRITE_4(sc, rcb_addr, bge_nicaddr, BGE_NIC_TXRING_ADDR(0, BGE_TX_RING_CNT)); - if (!(BGE_IS_5705_PLUS(sc))) + if (BGE_IS_5700_FAMILY(sc)) RCB_WRITE_4(sc, rcb_addr, bge_maxlen_flags, BGE_RCB_MAXLEN_FLAGS(BGE_TX_RING_CNT, 0)); @@ -1573,7 +1574,7 @@ bge_blockinit(struct bge_softc *sc) CSR_WRITE_4(sc, BGE_HCC_TX_COAL_TICKS, sc->bge_tx_coal_ticks); CSR_WRITE_4(sc, BGE_HCC_RX_MAX_COAL_BDS, sc->bge_rx_max_coal_bds); CSR_WRITE_4(sc, BGE_HCC_TX_MAX_COAL_BDS, sc->bge_tx_max_coal_bds); - if (!(BGE_IS_5705_PLUS(sc))) { + if (BGE_IS_5700_FAMILY(sc)) { CSR_WRITE_4(sc, BGE_HCC_RX_COAL_TICKS_INT, 0); CSR_WRITE_4(sc, BGE_HCC_TX_COAL_TICKS_INT, 0); } @@ -1581,7 +1582,7 @@ bge_blockinit(struct bge_softc *sc) CSR_WRITE_4(sc, BGE_HCC_TX_MAX_COAL_BDS_INT, 0); /* Set up address of statistics block */ - if (!(BGE_IS_5705_PLUS(sc))) { + if (BGE_IS_5700_FAMILY(sc)) { CSR_WRITE_4(sc, BGE_HCC_STATS_ADDR_HI, 0); CSR_WRITE_4(sc, BGE_HCC_STATS_ADDR_LO, BGE_RING_DMA_ADDR(sc, bge_info.bge_stats)); @@ -1610,7 +1611,7 @@ bge_blockinit(struct bge_softc *sc) CSR_WRITE_4(sc, BGE_RXLP_MODE, BGE_RXLPMODE_ENABLE); /* Turn on RX list selector state machine. */ - if (!(BGE_IS_5705_PLUS(sc))) + if (BGE_IS_5700_FAMILY(sc)) CSR_WRITE_4(sc, BGE_RXLS_MODE, BGE_RXLSMODE_ENABLE); val = BGE_MACMODE_TXDMA_ENB | BGE_MACMODE_RXDMA_ENB | @@ -1640,7 +1641,7 @@ bge_blockinit(struct bge_softc *sc) #endif /* Turn on DMA completion state machine */ - if (!(BGE_IS_5705_PLUS(sc))) + if (BGE_IS_5700_FAMILY(sc)) CSR_WRITE_4(sc, BGE_DMAC_MODE, BGE_DMACMODE_ENABLE); val = BGE_WDMAMODE_ENABLE|BGE_WDMAMODE_ALL_ATTNS; @@ -1677,7 +1678,7 @@ bge_blockinit(struct bge_softc *sc) CSR_WRITE_4(sc, BGE_RDBDI_MODE, BGE_RDBDIMODE_ENABLE); /* Turn on Mbuf cluster free state machine */ - if (!(BGE_IS_5705_PLUS(sc))) + if (BGE_IS_5700_FAMILY(sc)) CSR_WRITE_4(sc, BGE_MBCF_MODE, BGE_MBCFMODE_ENABLE); /* Turn on send BD completion state machine */ @@ -1879,6 +1880,11 @@ bge_attach(struct device *parent, struct device *self, void *aux) sizeof(name)) > 0 && strcmp(name, "network") == 0) sc->bge_flags |= BGE_NO_EEPROM; #endif + if (BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5700 || + BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5701 || + BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5703 || + BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5704) + sc->bge_flags |= BGE_5700_FAMILY; if (BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5714_A0 || BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5780 || @@ -1917,7 +1923,7 @@ bge_attach(struct device *parent, struct device *self, void *aux) sc->bge_flags & BGE_PCIX) sc->bge_flags |= BGE_RX_ALIGNBUG; - if (!(BGE_IS_5705_PLUS(sc))) + if (BGE_IS_5700_FAMILY(sc)) sc->bge_flags |= BGE_JUMBO_CAPABLE; if ((BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5700 || @@ -3473,7 +3479,7 @@ bge_stop(struct bge_softc *sc) bge_stop_block(sc, BGE_RX_MODE, BGE_RXMODE_ENABLE); bge_stop_block(sc, BGE_RBDI_MODE, BGE_RBDIMODE_ENABLE); bge_stop_block(sc, BGE_RXLP_MODE, BGE_RXLPMODE_ENABLE); - if (!(BGE_IS_5705_PLUS(sc))) + if (BGE_IS_5700_FAMILY(sc)) bge_stop_block(sc, BGE_RXLS_MODE, BGE_RXLSMODE_ENABLE); bge_stop_block(sc, BGE_RDBDI_MODE, BGE_RBDIMODE_ENABLE); bge_stop_block(sc, BGE_RDC_MODE, BGE_RDCMODE_ENABLE); @@ -3487,7 +3493,7 @@ bge_stop(struct bge_softc *sc) bge_stop_block(sc, BGE_SDI_MODE, BGE_SDIMODE_ENABLE); bge_stop_block(sc, BGE_RDMA_MODE, BGE_RDMAMODE_ENABLE); bge_stop_block(sc, BGE_SDC_MODE, BGE_SDCMODE_ENABLE); - if (!(BGE_IS_5705_PLUS(sc))) + if (BGE_IS_5700_FAMILY(sc)) bge_stop_block(sc, BGE_DMAC_MODE, BGE_DMACMODE_ENABLE); bge_stop_block(sc, BGE_SBDC_MODE, BGE_SBDCMODE_ENABLE); @@ -3497,13 +3503,13 @@ bge_stop(struct bge_softc *sc) */ bge_stop_block(sc, BGE_HCC_MODE, BGE_HCCMODE_ENABLE); bge_stop_block(sc, BGE_WDMA_MODE, BGE_WDMAMODE_ENABLE); - if (!(BGE_IS_5705_PLUS(sc))) + if (BGE_IS_5700_FAMILY(sc)) bge_stop_block(sc, BGE_MBCF_MODE, BGE_MBCFMODE_ENABLE); CSR_WRITE_4(sc, BGE_FTQ_RESET, 0xFFFFFFFF); CSR_WRITE_4(sc, BGE_FTQ_RESET, 0); - if (!(BGE_IS_5705_PLUS(sc))) { + if (BGE_IS_5700_FAMILY(sc)) { bge_stop_block(sc, BGE_BMAN_MODE, BGE_BMANMODE_ENABLE); bge_stop_block(sc, BGE_MARB_MODE, BGE_MARBMODE_ENABLE); } diff --git a/sys/dev/pci/if_bgereg.h b/sys/dev/pci/if_bgereg.h index 939ddfbd5ca..f8595dc2ff3 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.97 2009/06/19 21:31:54 naddy Exp $ */ +/* $OpenBSD: if_bgereg.h,v 1.98 2009/07/21 13:09:41 naddy Exp $ */ /* * Copyright (c) 2001 Wind River Systems @@ -2598,6 +2598,7 @@ struct bge_softc { #define BGE_5750_PLUS 0x00400000 #define BGE_5755_PLUS 0x00800000 #define BGE_5714_FAMILY 0x01000000 +#define BGE_5700_FAMILY 0x02000000 bus_dma_tag_t bge_dmatag; u_int32_t bge_chipid; |