summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStuart Henderson <sthen@cvs.openbsd.org>2009-10-11 10:36:32 +0000
committerStuart Henderson <sthen@cvs.openbsd.org>2009-10-11 10:36:32 +0000
commit37b61279ea9136750e6c4b6b3aa1ee73e8033c4c (patch)
tree06d7d1598882fb456d96115fb60f33abb62bd822
parentc7964be422d4499e887e9ad8540ee7187b27f1f6 (diff)
Add support for the Broadcom BCM5717 ASIC and the BCM5717 / BCM5718 chipsets.
Based on info gleaned from the Linux tg3 driver. From Brad, ok naddy@
-rw-r--r--sys/dev/pci/if_bge.c39
-rw-r--r--sys/dev/pci/if_bgereg.h8
2 files changed, 39 insertions, 8 deletions
diff --git a/sys/dev/pci/if_bge.c b/sys/dev/pci/if_bge.c
index 1ed55d75a8d..badbb5df375 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.284 2009/10/07 22:05:51 sthen Exp $ */
+/* $OpenBSD: if_bge.c,v 1.285 2009/10/11 10:36:31 sthen Exp $ */
/*
* Copyright (c) 2001 Wind River Systems
@@ -240,6 +240,10 @@ const struct pci_matchid bge_devices[] = {
{ PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5714S },
{ PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5715 },
{ PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5715S },
+ { PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5717C },
+ { PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5717S },
+ { PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5718C },
+ { PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5718S },
{ PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5720 },
{ PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5721 },
{ PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5722 },
@@ -395,6 +399,7 @@ static const struct bge_revision bge_majorrevs[] = {
{ BGE_ASICREV_BCM5787, "unknown BCM5754/5787" },
{ BGE_ASICREV_BCM5906, "unknown BCM5906" },
{ BGE_ASICREV_BCM57780, "unknown BCM57780" },
+ { BGE_ASICREV_BCM5717, "unknown BCM5717" },
{ 0, NULL }
};
@@ -1340,7 +1345,8 @@ bge_blockinit(struct bge_softc *sc)
/* Configure mbuf pool watermarks */
/* new Broadcom docs strongly recommend these: */
- if (BGE_IS_5705_PLUS(sc)) {
+ if (BGE_IS_5705_PLUS(sc) &&
+ BGE_ASICREV(sc->bge_chipid) != BGE_ASICREV_BCM5717) {
CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_READDMA_LOWAT, 0x0);
if (BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5906) {
@@ -1397,7 +1403,10 @@ bge_blockinit(struct bge_softc *sc)
/* Initialize the standard RX ring control block */
rcb = &sc->bge_rdata->bge_info.bge_std_rx_rcb;
BGE_HOSTADDR(rcb->bge_hostaddr, BGE_RING_DMA_ADDR(sc, bge_rx_std_ring));
- if (BGE_IS_5705_PLUS(sc))
+ if (BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5717)
+ rcb->bge_maxlen_flags = (BGE_RCB_MAXLEN_FLAGS(512, 0) |
+ (ETHER_MAX_DIX_LEN << 2));
+ else if (BGE_IS_5705_PLUS(sc))
rcb->bge_maxlen_flags = BGE_RCB_MAXLEN_FLAGS(512, 0);
else
rcb->bge_maxlen_flags =
@@ -1456,6 +1465,11 @@ bge_blockinit(struct bge_softc *sc)
CSR_WRITE_4(sc, BGE_RBDI_STD_REPL_THRESH, 8);
CSR_WRITE_4(sc, BGE_RBDI_JUMBO_REPL_THRESH, 8);
+ if (BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5717) {
+ CSR_WRITE_4(sc, BGE_STD_REPL_LWM, 4);
+ CSR_WRITE_4(sc, BGE_JUMBO_REPL_LWM, 4);
+ }
+
/*
* Disable all unused send rings by setting the 'ring disabled'
* bit in the flags field of all the TX send ring control blocks.
@@ -1825,8 +1839,15 @@ bge_attach(struct device *parent, struct device *self, void *aux)
>> BGE_PCIMISCCTL_ASICREV_SHIFT);
if (BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_USE_PRODID_REG) {
- sc->bge_chipid = pci_conf_read(pc, pa->pa_tag,
- BGE_PCI_PRODID_ASICREV);
+ if (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_BROADCOM_BCM5717C ||
+ PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_BROADCOM_BCM5717S ||
+ PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_BROADCOM_BCM5717C ||
+ PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_BROADCOM_BCM5717S)
+ sc->bge_chipid = pci_conf_read(pc, pa->pa_tag,
+ BGE_PCI_GEN2_PRODID_ASICREV);
+ else
+ sc->bge_chipid = pci_conf_read(pc, pa->pa_tag,
+ BGE_PCI_PRODID_ASICREV);
}
printf(", ");
@@ -1878,7 +1899,8 @@ bge_attach(struct device *parent, struct device *self, void *aux)
sc->bge_flags |= BGE_5714_FAMILY;
/* Intentionally exclude BGE_ASICREV_BCM5906 */
- if (BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5755 ||
+ if (BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5717 ||
+ BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5755 ||
BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5761 ||
BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5784 ||
BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5785 ||
@@ -1958,6 +1980,7 @@ bge_attach(struct device *parent, struct device *self, void *aux)
if ((BGE_IS_5705_PLUS(sc)) &&
BGE_ASICREV(sc->bge_chipid) != BGE_ASICREV_BCM5906 &&
+ BGE_ASICREV(sc->bge_chipid) != BGE_ASICREV_BCM5717 &&
BGE_ASICREV(sc->bge_chipid) != BGE_ASICREV_BCM5785 &&
BGE_ASICREV(sc->bge_chipid) != BGE_ASICREV_BCM57780) {
if (BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5755 ||
@@ -2411,7 +2434,9 @@ bge_reset(struct bge_softc *sc)
}
if (sc->bge_flags & BGE_PCIE &&
- sc->bge_chipid != BGE_CHIPID_BCM5750_A0) {
+ sc->bge_chipid != BGE_CHIPID_BCM5750_A0 &&
+ BGE_ASICREV(sc->bge_chipid) != BGE_ASICREV_BCM5717 &&
+ BGE_ASICREV(sc->bge_chipid) != BGE_ASICREV_BCM5785) {
u_int32_t v;
/* Enable PCI Express bug fix */
diff --git a/sys/dev/pci/if_bgereg.h b/sys/dev/pci/if_bgereg.h
index f8595dc2ff3..fde4f4bfb05 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.98 2009/07/21 13:09:41 naddy Exp $ */
+/* $OpenBSD: if_bgereg.h,v 1.99 2009/10/11 10:36:31 sthen Exp $ */
/*
* Copyright (c) 2001 Wind River Systems
@@ -209,6 +209,7 @@
#define BGE_PCI_ISR_MBX_HI 0xB0
#define BGE_PCI_ISR_MBX_LO 0xB4
#define BGE_PCI_PRODID_ASICREV 0xBC
+#define BGE_PCI_GEN2_PRODID_ASICREV 0xF4
/* XXX:
* Used in PCI-Express code for 575x chips.
@@ -324,6 +325,7 @@
#define BGE_ASICREV_BCM5784 0x5784
#define BGE_ASICREV_BCM5785 0x5785
#define BGE_ASICREV_BCM57780 0x57780
+#define BGE_ASICREV_BCM5717 0x5717
/* chip revisions */
#define BGE_CHIPREV(x) ((x) >> 8)
@@ -1243,6 +1245,9 @@
#define BGE_RBDI_STD_REPL_THRESH 0x2C18
#define BGE_RBDI_JUMBO_REPL_THRESH 0x2C1C
+#define BGE_STD_REPL_LWM 0x2D00
+#define BGE_JUMBO_REPL_LWM 0x2D04
+
/* Receive BD Initiator Mode register */
#define BGE_RBDIMODE_RESET 0x00000001
#define BGE_RBDIMODE_ENABLE 0x00000002
@@ -2098,6 +2103,7 @@ struct bge_tx_bd {
#define BGE_TXBDFLAG_IP_CSUM 0x0002
#define BGE_TXBDFLAG_END 0x0004
#define BGE_TXBDFLAG_IP_FRAG 0x0008
+#define BGE_TXBDFLAG_JMB_PKT 0x0008
#define BGE_TXBDFLAG_IP_FRAG_END 0x0010
#define BGE_TXBDFLAG_VLAN_TAG 0x0040
#define BGE_TXBDFLAG_COAL_NOW 0x0080