Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci Add support for bcm5714 and (possibly incorrect)...



details:   https://anonhg.NetBSD.org/src/rev/547990b120ee
branches:  trunk
changeset: 586264:547990b120ee
user:      jonathan <jonathan%NetBSD.org@localhost>
date:      Mon Dec 12 00:40:44 2005 +0000

description:
Add support for bcm5714 and (possibly incorrect) support for the
bcm5715 PCI-Express dual-port NICs. Taken from the Broadcom-supplied
Linux driver, bcm-8.3.13a.

Add nascent support for the bcm5780, but (since I have no bcm5780 to
test), don't yet add an entry which allows us to match or attach to a
5780.

Change 5752 support: Follow the lead of the Broadcom-supplied Linux
driver (bcm) and the Linux tg3 driver, and treat the 5752 like a 5750.

diffstat:

 sys/dev/pci/if_bge.c    |  35 ++++++++++++++++++++++++++++++-----
 sys/dev/pci/if_bgereg.h |   4 +++-
 2 files changed, 33 insertions(+), 6 deletions(-)

diffs (96 lines):

diff -r 5faeaeaee2a1 -r 547990b120ee sys/dev/pci/if_bge.c
--- a/sys/dev/pci/if_bge.c      Sun Dec 11 23:42:33 2005 +0000
+++ b/sys/dev/pci/if_bge.c      Mon Dec 12 00:40:44 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_bge.c,v 1.98 2005/12/07 04:43:05 jonathan Exp $     */
+/*     $NetBSD: if_bge.c,v 1.99 2005/12/12 00:40:44 jonathan Exp $     */
 
 /*
  * Copyright (c) 2001 Wind River Systems
@@ -79,7 +79,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.98 2005/12/07 04:43:05 jonathan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.99 2005/12/12 00:40:44 jonathan Exp $");
 
 #include "bpfilter.h"
 #include "vlan.h"
@@ -297,8 +297,15 @@
  * how we map ASIC revision to "quirks" needs more thought.
  * (defined here until the thought is done).
  */
+#define BGE_IS_5714_FAMILY(sc) \
+       (BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5714 ||  \
+        BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5780 ||  \
+        BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5715 )
+
 #define BGE_IS_5750_OR_BEYOND(sc)  \
-       (BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5750)
+       (BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5750 || \
+        BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5752 || \
+        BGE_IS_5714_FAMILY(sc) )
 
 #define BGE_IS_5705_OR_BEYOND(sc)  \
        ( ((sc)->bge_quirks & BGE_QUIRK_5705_CORE) || \
@@ -1385,6 +1392,16 @@
                        dma_rw_ctl &=  0xfffffff0;
                        dma_rw_ctl |= BGE_PCIDMARWCTL_ONEDMA_ATONCE;
                }
+               else if (BGE_IS_5714_FAMILY(sc)) {
+                       dma_rw_ctl = BGE_PCI_READ_CMD|BGE_PCI_WRITE_CMD;
+                       dma_rw_ctl &= ~BGE_PCIDMARWCTL_ONEDMA_ATONCE; /* XXX */
+                       /* XXX magic values, Broadcom-supplied Linux driver */
+                       if (BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5780)
+                               dma_rw_ctl |= (1 << 20) | (1 << 18) |
+                                 BGE_PCIDMARWCTL_ONEDMA_ATONCE;
+                       else
+                               dma_rw_ctl |= (1<<20) | (1<<18) | (1 << 15);
+               }
        }
 
        pci_conf_write(pa->pa_pc, pa->pa_tag, BGE_PCI_DMA_RW_CTL, dma_rw_ctl);
@@ -2797,7 +2814,11 @@
 
        /* Enable memory arbiter. */
        if ((sc->bge_quirks & BGE_QUIRK_5705_CORE) == 0) {
-               CSR_WRITE_4(sc, BGE_MARB_MODE, BGE_MARBMODE_ENABLE);
+               uint32_t marbmode = 0;
+               if (BGE_IS_5714_FAMILY(sc)) {
+                       marbmode = CSR_READ_4(sc, BGE_MARBMODE_ENABLE);
+               }
+               CSR_WRITE_4(sc, BGE_MARB_MODE, BGE_MARBMODE_ENABLE | marbmode);
        }
 
        /*
@@ -2859,7 +2880,11 @@
 
        /* Enable memory arbiter. */
        if ((sc->bge_quirks & BGE_QUIRK_5705_CORE) == 0) {
-               CSR_WRITE_4(sc, BGE_MARB_MODE, BGE_MARBMODE_ENABLE);
+               uint32_t marbmode = 0;
+               if (BGE_IS_5714_FAMILY(sc)) {
+                       marbmode = CSR_READ_4(sc, BGE_MARBMODE_ENABLE);
+               }
+               CSR_WRITE_4(sc, BGE_MARB_MODE, BGE_MARBMODE_ENABLE | marbmode);
        }
 
        /* Fix up byte swapping */
diff -r 5faeaeaee2a1 -r 547990b120ee sys/dev/pci/if_bgereg.h
--- a/sys/dev/pci/if_bgereg.h   Sun Dec 11 23:42:33 2005 +0000
+++ b/sys/dev/pci/if_bgereg.h   Mon Dec 12 00:40:44 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_bgereg.h,v 1.30 2005/12/07 04:43:05 jonathan Exp $  */
+/*     $NetBSD: if_bgereg.h,v 1.31 2005/12/12 00:40:44 jonathan Exp $  */
 /*
  * Copyright (c) 2001 Wind River Systems
  * Copyright (c) 1997, 1998, 1999, 2001
@@ -271,6 +271,8 @@
 #define BGE_ASICREV_BCM5750             0x04
 #define BGE_ASICREV_BCM5714             0x05
 #define BGE_ASICREV_BCM5752             0x06
+/* ASIC revision 0x07 is the original bcm5700 */
+#define BGE_ASICREV_BCM5780             0x08
 #define BGE_ASICREV_BCM5715             0x09   /* XXX ??? */
 
 /* chip revisions */



Home | Main Index | Thread Index | Old Index