The following diff adds support to bge(4) for the Broadcom BCM5719 ASIC
core and chipset and a fix for the BCM57791/BCM57795 FastE controllers.
No functional change for existing supported controllers but test anyway.


Index: if_bge.c
===================================================================
RCS file: /home/cvs/src/sys/dev/pci/if_bge.c,v
retrieving revision 1.301
diff -u -p -r1.301 if_bge.c
--- if_bge.c    31 Aug 2010 17:13:44 -0000      1.301
+++ if_bge.c    6 Sep 2010 22:48:43 -0000
@@ -243,6 +243,7 @@ const struct pci_matchid bge_devices[] =
        { PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5715S },
        { PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5717 },
        { PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5718 },
+       { PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5719 },
        { PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5720 },
        { PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5721 },
        { PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM5722 },
@@ -309,6 +310,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_5717_PLUS(sc)           ((sc)->bge_flags & BGE_5717_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)
@@ -407,6 +409,7 @@ static const struct bge_revision bge_maj
        { BGE_ASICREV_BCM57780, "unknown BCM57780" },
        { BGE_ASICREV_BCM5717, "unknown BCM5717" },
        { BGE_ASICREV_BCM57765, "unknown BCM57765" },
+       { BGE_ASICREV_BCM5719, "unknown BCM5719" },
 
        { 0, NULL }
 };
@@ -1352,8 +1355,7 @@ bge_blockinit(struct bge_softc *sc)
 
        /* Configure mbuf pool watermarks */
        /* new Broadcom docs strongly recommend these: */
-       if (BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5717 ||
-           BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM57765) {
+       if (BGE_IS_5717_PLUS(sc)) {
                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);
@@ -1414,8 +1416,7 @@ 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_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5717 ||
-           BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM57765)
+       if (BGE_IS_5717_PLUS(sc))
                rcb->bge_maxlen_flags = (BGE_RCB_MAXLEN_FLAGS(512, 0) |
                                        (ETHER_MAX_DIX_LEN << 2));
        else if (BGE_IS_5705_PLUS(sc))
@@ -1477,8 +1478,7 @@ 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 ||
-           BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM57765) {
+       if (BGE_IS_5717_PLUS(sc)) {
                CSR_WRITE_4(sc, BGE_STD_REPL_LWM, 4);
                CSR_WRITE_4(sc, BGE_JUMBO_REPL_LWM, 4);
        }
@@ -1671,7 +1671,8 @@ bge_blockinit(struct bge_softc *sc)
 
        val = BGE_RDMAMODE_ENABLE|BGE_RDMAMODE_ALL_ATTNS;
 
-       if (BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5717)
+       if (BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5717 ||
+           BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5719)
                val |= BGE_RDMAMODE_MULT_DMA_RD_DIS;
 
        if (BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5784 ||
@@ -1860,6 +1861,7 @@ bge_attach(struct device *parent, struct
        if (BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_USE_PRODID_REG) {
                if (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_BROADCOM_BCM5717 ||
                    PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_BROADCOM_BCM5718 ||
+                   PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_BROADCOM_BCM5719 ||
                    PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_BROADCOM_BCM5724)
                        sc->bge_chipid = pci_conf_read(pc, pa->pa_tag,
                            BGE_PCI_GEN2_PRODID_ASICREV);
@@ -1922,15 +1924,19 @@ bge_attach(struct device *parent, struct
            BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5714)
                sc->bge_flags |= BGE_5714_FAMILY;
 
-       /* Intentionally exclude BGE_ASICREV_BCM5906 */
        if (BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5717 ||
-           BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5755 ||
+           BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5719 ||
+           BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM57765)
+               sc->bge_flags |= BGE_5717_PLUS;
+
+       /* Intentionally exclude BGE_ASICREV_BCM5906 */
+       if (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 ||
            BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5787 ||
-           BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM57765 ||
-           BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM57780)
+           BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM57780 ||
+           BGE_IS_5717_PLUS(sc))
                sc->bge_flags |= BGE_5755_PLUS;
 
        if (BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5750 ||
@@ -1984,6 +1990,8 @@ bge_attach(struct device *parent, struct
              PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_BROADCOM_BCM5753F ||
              PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_BROADCOM_BCM5787F)) ||
            PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_BROADCOM_BCM57790 ||
+           PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_BROADCOM_BCM57791 ||
+           PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_BROADCOM_BCM57795 ||
            BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5906)
                sc->bge_flags |= BGE_10_100_ONLY;
 
@@ -2005,10 +2013,9 @@ bge_attach(struct device *parent, struct
 
        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_BCM57765 &&
-           BGE_ASICREV(sc->bge_chipid) != BGE_ASICREV_BCM57780) {
+           BGE_ASICREV(sc->bge_chipid) != BGE_ASICREV_BCM57780 &&
+           !BGE_IS_5717_PLUS(sc)) {
                if (BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5755 ||
                    BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5761 ||
                    BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5784 ||
@@ -2124,10 +2131,8 @@ bge_attach(struct device *parent, struct
        sc->bge_tx_coal_ticks = 300;
        sc->bge_tx_max_coal_bds = 400;
 
-       /* 5705 limits RX return ring to 512 entries. */
-       if (BGE_IS_5700_FAMILY(sc) ||
-           BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5717 ||
-           BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM57765)
+       /* BCM5705 limits RX return ring to 512 entries. */
+       if (BGE_IS_5700_FAMILY(sc) || BGE_IS_5717_PLUS(sc))
                sc->bge_return_ring_cnt = BGE_RETURN_RING_CNT;
        else
                sc->bge_return_ring_cnt = BGE_RETURN_RING_CNT_5705;
@@ -2199,11 +2204,10 @@ bge_attach(struct device *parent, struct
        /* 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) ||
-                   BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5717)
-                   sc->bge_flags |= BGE_PHY_FIBER_MII;
-               else
+               if (BGE_IS_5700_FAMILY(sc))
                    sc->bge_flags |= BGE_PHY_FIBER_TBI;
+               else
+                   sc->bge_flags |= BGE_PHY_FIBER_MII;
        }
 
        /* Hookup IRQ last. */
@@ -2489,9 +2493,8 @@ bge_reset(struct bge_softc *sc)
 
        if (sc->bge_flags & BGE_PCIE &&
            sc->bge_chipid != BGE_CHIPID_BCM5750_A0 &&
-           BGE_ASICREV(sc->bge_chipid) != BGE_ASICREV_BCM5717 &&
            BGE_ASICREV(sc->bge_chipid) != BGE_ASICREV_BCM5785 &&
-           BGE_ASICREV(sc->bge_chipid) != BGE_ASICREV_BCM57765) {
+           !BGE_IS_5717_PLUS(sc)) {
                u_int32_t v;
 
                /* Enable PCI Express bug fix */
Index: if_bgereg.h
===================================================================
RCS file: /home/cvs/src/sys/dev/pci/if_bgereg.h,v
retrieving revision 1.101
diff -u -p -r1.101 if_bgereg.h
--- if_bgereg.h 9 Jul 2010 00:04:42 -0000       1.101
+++ if_bgereg.h 25 Aug 2010 18:20:46 -0000
@@ -328,6 +328,7 @@
 #define BGE_ASICREV_BCM57780           0x57780
 #define BGE_ASICREV_BCM5717            0x5717
 #define BGE_ASICREV_BCM57765           0x57785
+#define BGE_ASICREV_BCM5719            0x5719
 
 /* chip revisions */
 #define BGE_CHIPREV(x)                 ((x) >> 8)
@@ -2607,8 +2608,9 @@ struct bge_softc {
 #define BGE_5705_PLUS          0x00200000
 #define BGE_5750_PLUS          0x00400000
 #define BGE_5755_PLUS          0x00800000
-#define BGE_5714_FAMILY                0x01000000
-#define BGE_5700_FAMILY                0x02000000
+#define BGE_5717_PLUS          0x01000000
+#define BGE_5714_FAMILY                0x02000000
+#define BGE_5700_FAMILY                0x04000000
 
        bus_dma_tag_t           bge_dmatag;
        u_int32_t               bge_chipid;

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

Reply via email to