Tue Feb 26 11:06:24 2013 UTC ()
Add some bugfixes and enhancement from FreeBSD:

- Workaround for BCM5906 silicon bug. When auto-negotiation results in
 half-duplex operation, excess collision on the ethernet link may cause
 internal chip delays that may result in subsequent valid frames being
 dropped due to insufficient receive buffer resources.
 (FreeBSD: r214219, r214251, r214292)

- Allow write DMA to request larger DMA burst size to get better
 performance on BCM5785.
 (FreeBSD r213333: OpenBSD 1.294)

- Enable TX MAC state machine lockup fix for both BCM5755 or higher
 and BCM5906. Publicly available data sheet just says it may happen
 due to corrupted TxMbuf.
 (FreeBSD r214216)

- Follow Broadcom datasheet:
 Delay 100 microseconds after enabling transmit MAC.
 Delay 10 microseconds after enabling receive MAC.
 (FreeBSD r241220)


(msaitoh)
diff -r1.205 -r1.206 src/sys/dev/pci/if_bge.c
diff -r1.59 -r1.60 src/sys/dev/pci/if_bgereg.h

cvs diff -r1.205 -r1.206 src/sys/dev/pci/if_bge.c (expand / switch to unified diff)

--- src/sys/dev/pci/if_bge.c 2013/02/26 11:03:17 1.205
+++ src/sys/dev/pci/if_bge.c 2013/02/26 11:06:23 1.206
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: if_bge.c,v 1.205 2013/02/26 11:03:17 msaitoh Exp $ */ 1/* $NetBSD: if_bge.c,v 1.206 2013/02/26 11:06:23 msaitoh Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2001 Wind River Systems 4 * Copyright (c) 2001 Wind River Systems
5 * Copyright (c) 1997, 1998, 1999, 2001 5 * Copyright (c) 1997, 1998, 1999, 2001
6 * Bill Paul <wpaul@windriver.com>. All rights reserved. 6 * Bill Paul <wpaul@windriver.com>. All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions 9 * modification, are permitted provided that the following conditions
10 * are met: 10 * are met:
11 * 1. Redistributions of source code must retain the above copyright 11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer. 12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright 13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the 14 * notice, this list of conditions and the following disclaimer in the
@@ -69,27 +69,27 @@ @@ -69,27 +69,27 @@
69 * does not support external SSRAM. 69 * does not support external SSRAM.
70 * 70 *
71 * Broadcom also produces a variation of the BCM5700 under the "Altima" 71 * Broadcom also produces a variation of the BCM5700 under the "Altima"
72 * brand name, which is functionally similar but lacks PCI-X support. 72 * brand name, which is functionally similar but lacks PCI-X support.
73 * 73 *
74 * Without external SSRAM, you can only have at most 4 TX rings, 74 * Without external SSRAM, you can only have at most 4 TX rings,
75 * and the use of the mini RX ring is disabled. This seems to imply 75 * and the use of the mini RX ring is disabled. This seems to imply
76 * that these features are simply not available on the BCM5701. As a 76 * that these features are simply not available on the BCM5701. As a
77 * result, this driver does not implement any support for the mini RX 77 * result, this driver does not implement any support for the mini RX
78 * ring. 78 * ring.
79 */ 79 */
80 80
81#include <sys/cdefs.h> 81#include <sys/cdefs.h>
82__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.205 2013/02/26 11:03:17 msaitoh Exp $"); 82__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.206 2013/02/26 11:06:23 msaitoh Exp $");
83 83
84#include "vlan.h" 84#include "vlan.h"
85 85
86#include <sys/param.h> 86#include <sys/param.h>
87#include <sys/systm.h> 87#include <sys/systm.h>
88#include <sys/callout.h> 88#include <sys/callout.h>
89#include <sys/sockio.h> 89#include <sys/sockio.h>
90#include <sys/mbuf.h> 90#include <sys/mbuf.h>
91#include <sys/malloc.h> 91#include <sys/malloc.h>
92#include <sys/kernel.h> 92#include <sys/kernel.h>
93#include <sys/device.h> 93#include <sys/device.h>
94#include <sys/socket.h> 94#include <sys/socket.h>
95#include <sys/sysctl.h> 95#include <sys/sysctl.h>
@@ -689,26 +689,27 @@ static const struct bge_revision { @@ -689,26 +689,27 @@ static const struct bge_revision {
689 { BGE_CHIPID_BCM5715_A3, "BCM5715 A3" }, 689 { BGE_CHIPID_BCM5715_A3, "BCM5715 A3" },
690 { BGE_CHIPID_BCM5755_A0, "BCM5755 A0" }, 690 { BGE_CHIPID_BCM5755_A0, "BCM5755 A0" },
691 { BGE_CHIPID_BCM5755_A1, "BCM5755 A1" }, 691 { BGE_CHIPID_BCM5755_A1, "BCM5755 A1" },
692 { BGE_CHIPID_BCM5755_A2, "BCM5755 A2" }, 692 { BGE_CHIPID_BCM5755_A2, "BCM5755 A2" },
693 { BGE_CHIPID_BCM5755_C0, "BCM5755 C0" }, 693 { BGE_CHIPID_BCM5755_C0, "BCM5755 C0" },
694 { BGE_CHIPID_BCM5761_A0, "BCM5761 A0" }, 694 { BGE_CHIPID_BCM5761_A0, "BCM5761 A0" },
695 { BGE_CHIPID_BCM5761_A1, "BCM5761 A1" }, 695 { BGE_CHIPID_BCM5761_A1, "BCM5761 A1" },
696 { BGE_CHIPID_BCM5784_A0, "BCM5784 A0" }, 696 { BGE_CHIPID_BCM5784_A0, "BCM5784 A0" },
697 { BGE_CHIPID_BCM5784_A1, "BCM5784 A1" }, 697 { BGE_CHIPID_BCM5784_A1, "BCM5784 A1" },
698 /* 5754 and 5787 share the same ASIC ID */ 698 /* 5754 and 5787 share the same ASIC ID */
699 { BGE_CHIPID_BCM5787_A0, "BCM5754/5787 A0" }, 699 { BGE_CHIPID_BCM5787_A0, "BCM5754/5787 A0" },
700 { BGE_CHIPID_BCM5787_A1, "BCM5754/5787 A1" }, 700 { BGE_CHIPID_BCM5787_A1, "BCM5754/5787 A1" },
701 { BGE_CHIPID_BCM5787_A2, "BCM5754/5787 A2" }, 701 { BGE_CHIPID_BCM5787_A2, "BCM5754/5787 A2" },
 702 { BGE_CHIPID_BCM5906_A0, "BCM5906 A0" },
702 { BGE_CHIPID_BCM5906_A1, "BCM5906 A1" }, 703 { BGE_CHIPID_BCM5906_A1, "BCM5906 A1" },
703 { BGE_CHIPID_BCM5906_A2, "BCM5906 A2" }, 704 { BGE_CHIPID_BCM5906_A2, "BCM5906 A2" },
704 { BGE_CHIPID_BCM57780_A0, "BCM57780 A0" }, 705 { BGE_CHIPID_BCM57780_A0, "BCM57780 A0" },
705 { BGE_CHIPID_BCM57780_A1, "BCM57780 A1" }, 706 { BGE_CHIPID_BCM57780_A1, "BCM57780 A1" },
706 707
707 { 0, NULL } 708 { 0, NULL }
708}; 709};
709 710
710/* 711/*
711 * Some defaults for major revisions, so that newer steppings 712 * Some defaults for major revisions, so that newer steppings
712 * that we don't know about have a shot at working. 713 * that we don't know about have a shot at working.
713 */ 714 */
714static const struct bge_revision bge_majorrevs[] = { 715static const struct bge_revision bge_majorrevs[] = {
@@ -2087,26 +2088,34 @@ bge_blockinit(struct bge_softc *sc) @@ -2087,26 +2088,34 @@ bge_blockinit(struct bge_softc *sc)
2087 /* Set up dummy disabled mini ring RCB */ 2088 /* Set up dummy disabled mini ring RCB */
2088 rcb = &sc->bge_rdata->bge_info.bge_mini_rx_rcb; 2089 rcb = &sc->bge_rdata->bge_info.bge_mini_rx_rcb;
2089 rcb->bge_maxlen_flags = BGE_RCB_MAXLEN_FLAGS(0, 2090 rcb->bge_maxlen_flags = BGE_RCB_MAXLEN_FLAGS(0,
2090 BGE_RCB_FLAG_RING_DISABLED); 2091 BGE_RCB_FLAG_RING_DISABLED);
2091 CSR_WRITE_4(sc, BGE_RX_MINI_RCB_MAXLEN_FLAGS, 2092 CSR_WRITE_4(sc, BGE_RX_MINI_RCB_MAXLEN_FLAGS,
2092 rcb->bge_maxlen_flags); 2093 rcb->bge_maxlen_flags);
2093 2094
2094 bus_dmamap_sync(sc->bge_dmatag, sc->bge_ring_map, 2095 bus_dmamap_sync(sc->bge_dmatag, sc->bge_ring_map,
2095 offsetof(struct bge_ring_data, bge_info), 2096 offsetof(struct bge_ring_data, bge_info),
2096 sizeof (struct bge_gib), 2097 sizeof (struct bge_gib),
2097 BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE); 2098 BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE);
2098 } 2099 }
2099 2100
 2101 /* Choose de-pipeline mode for BCM5906 A0, A1 and A2. */
 2102 if (BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5906) {
 2103 if (sc->bge_chipid == BGE_CHIPID_BCM5906_A0 ||
 2104 sc->bge_chipid == BGE_CHIPID_BCM5906_A1 ||
 2105 sc->bge_chipid == BGE_CHIPID_BCM5906_A2)
 2106 CSR_WRITE_4(sc, BGE_ISO_PKT_TX,
 2107 (CSR_READ_4(sc, BGE_ISO_PKT_TX) & ~3) | 2);
 2108 }
2100 /* 2109 /*
2101 * Set the BD ring replenish thresholds. The recommended 2110 * Set the BD ring replenish thresholds. The recommended
2102 * values are 1/8th the number of descriptors allocated to 2111 * values are 1/8th the number of descriptors allocated to
2103 * each ring. 2112 * each ring.
2104 */ 2113 */
2105 i = BGE_STD_RX_RING_CNT / 8; 2114 i = BGE_STD_RX_RING_CNT / 8;
2106 2115
2107 /* 2116 /*
2108 * Use a value of 8 for the following chips to workaround HW errata. 2117 * Use a value of 8 for the following chips to workaround HW errata.
2109 * Some of these chips have been added based on empirical 2118 * Some of these chips have been added based on empirical
2110 * evidence (they don't work unless this is done). 2119 * evidence (they don't work unless this is done).
2111 */ 2120 */
2112 if (BGE_IS_5705_PLUS(sc)) 2121 if (BGE_IS_5705_PLUS(sc))
@@ -2299,26 +2308,29 @@ bge_blockinit(struct bge_softc *sc) @@ -2299,26 +2308,29 @@ bge_blockinit(struct bge_softc *sc)
2299#endif 2308#endif
2300 CSR_WRITE_4(sc, BGE_MISC_LOCAL_CTL, sc->bge_local_ctrl_reg); 2309 CSR_WRITE_4(sc, BGE_MISC_LOCAL_CTL, sc->bge_local_ctrl_reg);
2301 2310
2302 /* Turn on DMA completion state machine */ 2311 /* Turn on DMA completion state machine */
2303 if (BGE_IS_5700_FAMILY(sc)) 2312 if (BGE_IS_5700_FAMILY(sc))
2304 CSR_WRITE_4(sc, BGE_DMAC_MODE, BGE_DMACMODE_ENABLE); 2313 CSR_WRITE_4(sc, BGE_DMAC_MODE, BGE_DMACMODE_ENABLE);
2305 2314
2306 val = BGE_WDMAMODE_ENABLE | BGE_WDMAMODE_ALL_ATTNS; 2315 val = BGE_WDMAMODE_ENABLE | BGE_WDMAMODE_ALL_ATTNS;
2307 2316
2308 /* Enable host coalescing bug fix; see Linux tg3.c */ 2317 /* Enable host coalescing bug fix; see Linux tg3.c */
2309 if (BGE_IS_5755_PLUS(sc)) 2318 if (BGE_IS_5755_PLUS(sc))
2310 val |= BGE_WDMAMODE_STATUS_TAG_FIX; 2319 val |= BGE_WDMAMODE_STATUS_TAG_FIX;
2311 2320
 2321 if (BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5785)
 2322 val |= BGE_WDMAMODE_BURST_ALL_DATA;
 2323
2312 /* Turn on write DMA state machine */ 2324 /* Turn on write DMA state machine */
2313 CSR_WRITE_4(sc, BGE_WDMA_MODE, val); 2325 CSR_WRITE_4(sc, BGE_WDMA_MODE, val);
2314 2326
2315 val = BGE_RDMAMODE_ENABLE | BGE_RDMAMODE_ALL_ATTNS; 2327 val = BGE_RDMAMODE_ENABLE | BGE_RDMAMODE_ALL_ATTNS;
2316 if (BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5784 || 2328 if (BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5784 ||
2317 BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5785 || 2329 BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5785 ||
2318 BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM57780) 2330 BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM57780)
2319 val |= BGE_RDMAMODE_BD_SBD_CRPT_ATTN | 2331 val |= BGE_RDMAMODE_BD_SBD_CRPT_ATTN |
2320 BGE_RDMAMODE_MBUF_RBD_CRPT_ATTN | 2332 BGE_RDMAMODE_MBUF_RBD_CRPT_ATTN |
2321 BGE_RDMAMODE_MBUF_SBD_CRPT_ATTN; 2333 BGE_RDMAMODE_MBUF_SBD_CRPT_ATTN;
2322 2334
2323 if (sc->bge_flags & BGE_PCIE) 2335 if (sc->bge_flags & BGE_PCIE)
2324 val |= BGE_RDMAMODE_FIFO_LONG_BURST; 2336 val |= BGE_RDMAMODE_FIFO_LONG_BURST;
@@ -4294,26 +4306,27 @@ bge_start(struct ifnet *ifp) @@ -4294,26 +4306,27 @@ bge_start(struct ifnet *ifp)
4294 sc->bge_tx_prodidx = prodidx; 4306 sc->bge_tx_prodidx = prodidx;
4295 4307
4296 /* 4308 /*
4297 * Set a timeout in case the chip goes out to lunch. 4309 * Set a timeout in case the chip goes out to lunch.
4298 */ 4310 */
4299 ifp->if_timer = 5; 4311 ifp->if_timer = 5;
4300} 4312}
4301 4313
4302static int 4314static int
4303bge_init(struct ifnet *ifp) 4315bge_init(struct ifnet *ifp)
4304{ 4316{
4305 struct bge_softc *sc = ifp->if_softc; 4317 struct bge_softc *sc = ifp->if_softc;
4306 const uint16_t *m; 4318 const uint16_t *m;
 4319 uint32_t mode;
4307 int s, error = 0; 4320 int s, error = 0;
4308 4321
4309 s = splnet(); 4322 s = splnet();
4310 4323
4311 ifp = &sc->ethercom.ec_if; 4324 ifp = &sc->ethercom.ec_if;
4312 4325
4313 /* Cancel pending I/O and flush buffers. */ 4326 /* Cancel pending I/O and flush buffers. */
4314 bge_stop(ifp, 0); 4327 bge_stop(ifp, 0);
4315 4328
4316 bge_stop_fw(sc); 4329 bge_stop_fw(sc);
4317 bge_sig_pre_reset(sc, BGE_RESET_START); 4330 bge_sig_pre_reset(sc, BGE_RESET_START);
4318 bge_reset(sc); 4331 bge_reset(sc);
4319 bge_sig_legacy(sc, BGE_RESET_START); 4332 bge_sig_legacy(sc, BGE_RESET_START);
@@ -4374,31 +4387,39 @@ bge_init(struct ifnet *ifp) @@ -4374,31 +4387,39 @@ bge_init(struct ifnet *ifp)
4374 "5705 A0 chip failed to load RX ring\n"); 4387 "5705 A0 chip failed to load RX ring\n");
4375 } 4388 }
4376 4389
4377 /* Init jumbo RX ring. */ 4390 /* Init jumbo RX ring. */
4378 if (ifp->if_mtu > (ETHERMTU + ETHER_HDR_LEN + ETHER_CRC_LEN)) 4391 if (ifp->if_mtu > (ETHERMTU + ETHER_HDR_LEN + ETHER_CRC_LEN))
4379 bge_init_rx_ring_jumbo(sc); 4392 bge_init_rx_ring_jumbo(sc);
4380 4393
4381 /* Init our RX return ring index */ 4394 /* Init our RX return ring index */
4382 sc->bge_rx_saved_considx = 0; 4395 sc->bge_rx_saved_considx = 0;
4383 4396
4384 /* Init TX ring. */ 4397 /* Init TX ring. */
4385 bge_init_tx_ring(sc); 4398 bge_init_tx_ring(sc);
4386 4399
 4400 /* Enable TX MAC state machine lockup fix. */
 4401 mode = CSR_READ_4(sc, BGE_TX_MODE);
 4402 if (BGE_IS_5755_PLUS(sc) ||
 4403 BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5906)
 4404 mode |= BGE_TXMODE_MBUF_LOCKUP_FIX;
 4405
4387 /* Turn on transmitter */ 4406 /* Turn on transmitter */
4388 BGE_SETBIT(sc, BGE_TX_MODE, BGE_TXMODE_ENABLE); 4407 CSR_WRITE_4(sc, BGE_TX_MODE, mode | BGE_TXMODE_ENABLE);
 4408 DELAY(100);
4389 4409
4390 /* Turn on receiver */ 4410 /* Turn on receiver */
4391 BGE_SETBIT(sc, BGE_RX_MODE, BGE_RXMODE_ENABLE); 4411 BGE_SETBIT(sc, BGE_RX_MODE, BGE_RXMODE_ENABLE);
 4412 DELAY(10);
4392 4413
4393 CSR_WRITE_4(sc, BGE_MAX_RX_FRAME_LOWAT, 2); 4414 CSR_WRITE_4(sc, BGE_MAX_RX_FRAME_LOWAT, 2);
4394 4415
4395 /* Tell firmware we're alive. */ 4416 /* Tell firmware we're alive. */
4396 BGE_SETBIT(sc, BGE_MODE_CTL, BGE_MODECTL_STACKUP); 4417 BGE_SETBIT(sc, BGE_MODE_CTL, BGE_MODECTL_STACKUP);
4397 4418
4398 /* Enable host interrupts. */ 4419 /* Enable host interrupts. */
4399 BGE_SETBIT(sc, BGE_PCI_MISC_CTL, BGE_PCIMISCCTL_CLEAR_INTA); 4420 BGE_SETBIT(sc, BGE_PCI_MISC_CTL, BGE_PCIMISCCTL_CLEAR_INTA);
4400 BGE_CLRBIT(sc, BGE_PCI_MISC_CTL, BGE_PCIMISCCTL_MASK_PCI_INTR); 4421 BGE_CLRBIT(sc, BGE_PCI_MISC_CTL, BGE_PCIMISCCTL_MASK_PCI_INTR);
4401 bge_writembx(sc, BGE_MBX_IRQ0_LO, 0); 4422 bge_writembx(sc, BGE_MBX_IRQ0_LO, 0);
4402 4423
4403 if ((error = bge_ifmedia_upd(ifp)) != 0) 4424 if ((error = bge_ifmedia_upd(ifp)) != 0)
4404 goto out; 4425 goto out;

cvs diff -r1.59 -r1.60 src/sys/dev/pci/if_bgereg.h (expand / switch to unified diff)

--- src/sys/dev/pci/if_bgereg.h 2013/02/26 11:03:17 1.59
+++ src/sys/dev/pci/if_bgereg.h 2013/02/26 11:06:23 1.60
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: if_bgereg.h,v 1.59 2013/02/26 11:03:17 msaitoh Exp $ */ 1/* $NetBSD: if_bgereg.h,v 1.60 2013/02/26 11:06:23 msaitoh Exp $ */
2/* 2/*
3 * Copyright (c) 2001 Wind River Systems 3 * Copyright (c) 2001 Wind River Systems
4 * Copyright (c) 1997, 1998, 1999, 2001 4 * Copyright (c) 1997, 1998, 1999, 2001
5 * Bill Paul <wpaul@windriver.com>. All rights reserved. 5 * Bill Paul <wpaul@windriver.com>. All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -308,26 +308,27 @@ @@ -308,26 +308,27 @@
308#define BGE_CHIPID_BCM5752_A2 0x6002 308#define BGE_CHIPID_BCM5752_A2 0x6002
309#define BGE_CHIPID_BCM5714_B0 0x8000 309#define BGE_CHIPID_BCM5714_B0 0x8000
310#define BGE_CHIPID_BCM5714_B3 0x8003 310#define BGE_CHIPID_BCM5714_B3 0x8003
311#define BGE_CHIPID_BCM5715_A0 0x9000 311#define BGE_CHIPID_BCM5715_A0 0x9000
312#define BGE_CHIPID_BCM5715_A1 0x9001 312#define BGE_CHIPID_BCM5715_A1 0x9001
313#define BGE_CHIPID_BCM5715_A3 0x9003 313#define BGE_CHIPID_BCM5715_A3 0x9003
314#define BGE_CHIPID_BCM5755_A0 0xa000 314#define BGE_CHIPID_BCM5755_A0 0xa000
315#define BGE_CHIPID_BCM5755_A1 0xa001 315#define BGE_CHIPID_BCM5755_A1 0xa001
316#define BGE_CHIPID_BCM5755_A2 0xa002 316#define BGE_CHIPID_BCM5755_A2 0xa002
317#define BGE_CHIPID_BCM5755_C0 0xa200 317#define BGE_CHIPID_BCM5755_C0 0xa200
318#define BGE_CHIPID_BCM5787_A0 0xb000 318#define BGE_CHIPID_BCM5787_A0 0xb000
319#define BGE_CHIPID_BCM5787_A1 0xb001 319#define BGE_CHIPID_BCM5787_A1 0xb001
320#define BGE_CHIPID_BCM5787_A2 0xb002 320#define BGE_CHIPID_BCM5787_A2 0xb002
 321#define BGE_CHIPID_BCM5906_A0 0xc000
321#define BGE_CHIPID_BCM5906_A1 0xc001 322#define BGE_CHIPID_BCM5906_A1 0xc001
322#define BGE_CHIPID_BCM5906_A2 0xc002 323#define BGE_CHIPID_BCM5906_A2 0xc002
323#define BGE_CHIPID_BCM57762 0x57766000 324#define BGE_CHIPID_BCM57762 0x57766000
324#define BGE_CHIPID_BCM57780_A0 0x57780000 325#define BGE_CHIPID_BCM57780_A0 0x57780000
325#define BGE_CHIPID_BCM57780_A1 0x57780001 326#define BGE_CHIPID_BCM57780_A1 0x57780001
326 327
327/* shorthand one */ 328/* shorthand one */
328#define BGE_ASICREV(x) ((x) >> 12) 329#define BGE_ASICREV(x) ((x) >> 12)
329#define BGE_ASICREV_BCM5700 0x07 330#define BGE_ASICREV_BCM5700 0x07
330#define BGE_ASICREV_BCM5701 0x00 331#define BGE_ASICREV_BCM5701 0x00
331#define BGE_ASICREV_BCM5703 0x01 332#define BGE_ASICREV_BCM5703 0x01
332#define BGE_ASICREV_BCM5704 0x02 333#define BGE_ASICREV_BCM5704 0x02
333#define BGE_ASICREV_BCM5705 0x03 334#define BGE_ASICREV_BCM5705 0x03
@@ -724,26 +725,27 @@ @@ -724,26 +725,27 @@
724 725
725/* TX backoff seed register */ 726/* TX backoff seed register */
726#define BGE_TX_BACKOFF_SEED_MASK 0x3F 727#define BGE_TX_BACKOFF_SEED_MASK 0x3F
727 728
728/* Autopoll status register */ 729/* Autopoll status register */
729#define BGE_AUTOPOLLSTS_ERROR 0x00000001 730#define BGE_AUTOPOLLSTS_ERROR 0x00000001
730 731
731/* Transmit MAC mode register */ 732/* Transmit MAC mode register */
732#define BGE_TXMODE_RESET 0x00000001 733#define BGE_TXMODE_RESET 0x00000001
733#define BGE_TXMODE_ENABLE 0x00000002 734#define BGE_TXMODE_ENABLE 0x00000002
734#define BGE_TXMODE_FLOWCTL_ENABLE 0x00000010 735#define BGE_TXMODE_FLOWCTL_ENABLE 0x00000010
735#define BGE_TXMODE_BIGBACKOFF_ENABLE 0x00000020 736#define BGE_TXMODE_BIGBACKOFF_ENABLE 0x00000020
736#define BGE_TXMODE_LONGPAUSE_ENABLE 0x00000040 737#define BGE_TXMODE_LONGPAUSE_ENABLE 0x00000040
 738#define BGE_TXMODE_MBUF_LOCKUP_FIX 0x00000100
737 739
738/* Transmit MAC status register */ 740/* Transmit MAC status register */
739#define BGE_TXSTAT_RX_XOFFED 0x00000001 741#define BGE_TXSTAT_RX_XOFFED 0x00000001
740#define BGE_TXSTAT_SENT_XOFF 0x00000002 742#define BGE_TXSTAT_SENT_XOFF 0x00000002
741#define BGE_TXSTAT_SENT_XON 0x00000004 743#define BGE_TXSTAT_SENT_XON 0x00000004
742#define BGE_TXSTAT_LINK_UP 0x00000008 744#define BGE_TXSTAT_LINK_UP 0x00000008
743#define BGE_TXSTAT_ODI_UFLOW 0x00000010 745#define BGE_TXSTAT_ODI_UFLOW 0x00000010
744#define BGE_TXSTAT_ODI_OFLOW 0x00000020 746#define BGE_TXSTAT_ODI_OFLOW 0x00000020
745 747
746/* Transmit MAC lengths register */ 748/* Transmit MAC lengths register */
747#define BGE_TXLEN_SLOTTIME 0x000000FF 749#define BGE_TXLEN_SLOTTIME 0x000000FF
748#define BGE_TXLEN_IPG 0x00000F00 750#define BGE_TXLEN_IPG 0x00000F00
749#define BGE_TXLEN_CRS 0x00003000 751#define BGE_TXLEN_CRS 0x00003000
@@ -810,26 +812,27 @@ @@ -810,26 +812,27 @@
810#define BGE_MIMODE_SHORTPREAMBLE 0x00000002 812#define BGE_MIMODE_SHORTPREAMBLE 0x00000002
811#define BGE_MIMODE_AUTOPOLL 0x00000010 813#define BGE_MIMODE_AUTOPOLL 0x00000010
812#define BGE_MIMODE_CLKCNT 0x001F0000 814#define BGE_MIMODE_CLKCNT 0x001F0000
813 815
814 816
815/* 817/*
816 * Send data initiator control registers. 818 * Send data initiator control registers.
817 */ 819 */
818#define BGE_SDI_MODE 0x0C00 820#define BGE_SDI_MODE 0x0C00
819#define BGE_SDI_STATUS 0x0C04 821#define BGE_SDI_STATUS 0x0C04
820#define BGE_SDI_STATS_CTL 0x0C08 822#define BGE_SDI_STATS_CTL 0x0C08
821#define BGE_SDI_STATS_ENABLE_MASK 0x0C0C 823#define BGE_SDI_STATS_ENABLE_MASK 0x0C0C
822#define BGE_SDI_STATS_INCREMENT_MASK 0x0C10 824#define BGE_SDI_STATS_INCREMENT_MASK 0x0C10
 825#define BGE_ISO_PKT_TX 0x0C20
823#define BGE_LOCSTATS_COS0 0x0C80 826#define BGE_LOCSTATS_COS0 0x0C80
824#define BGE_LOCSTATS_COS1 0x0C84 827#define BGE_LOCSTATS_COS1 0x0C84
825#define BGE_LOCSTATS_COS2 0x0C88 828#define BGE_LOCSTATS_COS2 0x0C88
826#define BGE_LOCSTATS_COS3 0x0C8C 829#define BGE_LOCSTATS_COS3 0x0C8C
827#define BGE_LOCSTATS_COS4 0x0C90 830#define BGE_LOCSTATS_COS4 0x0C90
828#define BGE_LOCSTATS_COS5 0x0C84 831#define BGE_LOCSTATS_COS5 0x0C84
829#define BGE_LOCSTATS_COS6 0x0C98 832#define BGE_LOCSTATS_COS6 0x0C98
830#define BGE_LOCSTATS_COS7 0x0C9C 833#define BGE_LOCSTATS_COS7 0x0C9C
831#define BGE_LOCSTATS_COS8 0x0CA0 834#define BGE_LOCSTATS_COS8 0x0CA0
832#define BGE_LOCSTATS_COS9 0x0CA4 835#define BGE_LOCSTATS_COS9 0x0CA4
833#define BGE_LOCSTATS_COS10 0x0CA8 836#define BGE_LOCSTATS_COS10 0x0CA8
834#define BGE_LOCSTATS_COS11 0x0CAC 837#define BGE_LOCSTATS_COS11 0x0CAC
835#define BGE_LOCSTATS_COS12 0x0CB0 838#define BGE_LOCSTATS_COS12 0x0CB0
@@ -1425,26 +1428,27 @@ @@ -1425,26 +1428,27 @@
1425/* Write DMA mode register */ 1428/* Write DMA mode register */
1426#define BGE_WDMAMODE_RESET 0x00000001 1429#define BGE_WDMAMODE_RESET 0x00000001
1427#define BGE_WDMAMODE_ENABLE 0x00000002 1430#define BGE_WDMAMODE_ENABLE 0x00000002
1428#define BGE_WDMAMODE_PCI_TGT_ABRT_ATTN 0x00000004 1431#define BGE_WDMAMODE_PCI_TGT_ABRT_ATTN 0x00000004
1429#define BGE_WDMAMODE_PCI_MSTR_ABRT_ATTN 0x00000008 1432#define BGE_WDMAMODE_PCI_MSTR_ABRT_ATTN 0x00000008
1430#define BGE_WDMAMODE_PCI_PERR_ATTN 0x00000010 1433#define BGE_WDMAMODE_PCI_PERR_ATTN 0x00000010
1431#define BGE_WDMAMODE_PCI_ADDROFLOW_ATTN 0x00000020 1434#define BGE_WDMAMODE_PCI_ADDROFLOW_ATTN 0x00000020
1432#define BGE_WDMAMODE_PCI_FIFOOFLOW_ATTN 0x00000040 1435#define BGE_WDMAMODE_PCI_FIFOOFLOW_ATTN 0x00000040
1433#define BGE_WDMAMODE_PCI_FIFOUFLOW_ATTN 0x00000080 1436#define BGE_WDMAMODE_PCI_FIFOUFLOW_ATTN 0x00000080
1434#define BGE_WDMAMODE_PCI_FIFOOREAD_ATTN 0x00000100 1437#define BGE_WDMAMODE_PCI_FIFOOREAD_ATTN 0x00000100
1435#define BGE_WDMAMODE_LOCREAD_TOOBIG 0x00000200 1438#define BGE_WDMAMODE_LOCREAD_TOOBIG 0x00000200
1436#define BGE_WDMAMODE_ALL_ATTNS 0x000003FC 1439#define BGE_WDMAMODE_ALL_ATTNS 0x000003FC
1437#define BGE_WDMAMODE_STATUS_TAG_FIX 0x20000000 1440#define BGE_WDMAMODE_STATUS_TAG_FIX 0x20000000
 1441#define BGE_WDMAMODE_BURST_ALL_DATA 0xC0000000
1438 1442
1439/* Write DMA status register */ 1443/* Write DMA status register */
1440#define BGE_WDMASTAT_PCI_TGT_ABRT_ATTN 0x00000004 1444#define BGE_WDMASTAT_PCI_TGT_ABRT_ATTN 0x00000004
1441#define BGE_WDMASTAT_PCI_MSTR_ABRT_ATTN 0x00000008 1445#define BGE_WDMASTAT_PCI_MSTR_ABRT_ATTN 0x00000008
1442#define BGE_WDMASTAT_PCI_PERR_ATTN 0x00000010 1446#define BGE_WDMASTAT_PCI_PERR_ATTN 0x00000010
1443#define BGE_WDMASTAT_PCI_ADDROFLOW_ATTN 0x00000020 1447#define BGE_WDMASTAT_PCI_ADDROFLOW_ATTN 0x00000020
1444#define BGE_WDMASTAT_PCI_FIFOOFLOW_ATTN 0x00000040 1448#define BGE_WDMASTAT_PCI_FIFOOFLOW_ATTN 0x00000040
1445#define BGE_WDMASTAT_PCI_FIFOUFLOW_ATTN 0x00000080 1449#define BGE_WDMASTAT_PCI_FIFOUFLOW_ATTN 0x00000080
1446#define BGE_WDMASTAT_PCI_FIFOOREAD_ATTN 0x00000100 1450#define BGE_WDMASTAT_PCI_FIFOOREAD_ATTN 0x00000100
1447#define BGE_WDMASTAT_LOCREAD_TOOBIG 0x00000200 1451#define BGE_WDMASTAT_LOCREAD_TOOBIG 0x00000200
1448 1452
1449 1453
1450/* 1454/*