if_bge.c (92739) | if_bge.c (92934) |
---|---|
1/* 2 * Copyright (c) 2001 Wind River Systems 3 * Copyright (c) 1997, 1998, 1999, 2001 4 * Bill Paul <wpaul@windriver.com>. All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 16 unchanged lines hidden (view full) --- 25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 * THE POSSIBILITY OF SUCH DAMAGE. 32 * | 1/* 2 * Copyright (c) 2001 Wind River Systems 3 * Copyright (c) 1997, 1998, 1999, 2001 4 * Bill Paul <wpaul@windriver.com>. All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 16 unchanged lines hidden (view full) --- 25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 * THE POSSIBILITY OF SUCH DAMAGE. 32 * |
33 * $FreeBSD: head/sys/dev/bge/if_bge.c 92739 2002-03-20 02:08:01Z alfred $ | 33 * $FreeBSD: head/sys/dev/bge/if_bge.c 92934 2002-03-22 06:45:40Z wpaul $ |
34 */ 35 36/* 37 * Broadcom BCM570x family gigabit ethernet driver for FreeBSD. 38 * 39 * Written by Bill Paul <wpaul@windriver.com> 40 * Senior Engineer, Wind River Systems 41 */ --- 10 unchanged lines hidden (view full) --- 52 * of value-added firmware updates. Unlike the Tigon I and Tigon II, 53 * firmware images can be stored in hardware and need not be compiled 54 * into the driver. 55 * 56 * The BCM5700 supports the PCI v2.2 and PCI-X v1.0 standards, and will 57 * function in a 32-bit/64-bit 33/66Mhz bus, or a 64-bit/133Mhz bus. 58 * 59 * The BCM5701 is a single-chip solution incorporating both the BCM5700 | 34 */ 35 36/* 37 * Broadcom BCM570x family gigabit ethernet driver for FreeBSD. 38 * 39 * Written by Bill Paul <wpaul@windriver.com> 40 * Senior Engineer, Wind River Systems 41 */ --- 10 unchanged lines hidden (view full) --- 52 * of value-added firmware updates. Unlike the Tigon I and Tigon II, 53 * firmware images can be stored in hardware and need not be compiled 54 * into the driver. 55 * 56 * The BCM5700 supports the PCI v2.2 and PCI-X v1.0 standards, and will 57 * function in a 32-bit/64-bit 33/66Mhz bus, or a 64-bit/133Mhz bus. 58 * 59 * The BCM5701 is a single-chip solution incorporating both the BCM5700 |
60 * MAC and a BCM5401 10/100/1000 PHY. Unlike the BCM5700, the BCM5700 | 60 * MAC and a BCM5401 10/100/1000 PHY. Unlike the BCM5700, the BCM5701 |
61 * does not support external SSRAM. 62 * 63 * Broadcom also produces a variation of the BCM5700 under the "Altima" 64 * brand name, which is functionally similar but lacks PCI-X support. 65 * 66 * Without external SSRAM, you can only have at most 4 TX rings, 67 * and the use of the mini RX ring is disabled. This seems to imply 68 * that these features are simply not available on the BCM5701. As a --- 48 unchanged lines hidden (view full) --- 117 118MODULE_DEPEND(bge, miibus, 1, 1, 1); 119 120/* "controller miibus0" required. See GENERIC if you get errors here. */ 121#include "miibus_if.h" 122 123#if !defined(lint) 124static const char rcsid[] = | 61 * does not support external SSRAM. 62 * 63 * Broadcom also produces a variation of the BCM5700 under the "Altima" 64 * brand name, which is functionally similar but lacks PCI-X support. 65 * 66 * Without external SSRAM, you can only have at most 4 TX rings, 67 * and the use of the mini RX ring is disabled. This seems to imply 68 * that these features are simply not available on the BCM5701. As a --- 48 unchanged lines hidden (view full) --- 117 118MODULE_DEPEND(bge, miibus, 1, 1, 1); 119 120/* "controller miibus0" required. See GENERIC if you get errors here. */ 121#include "miibus_if.h" 122 123#if !defined(lint) 124static const char rcsid[] = |
125 "$FreeBSD: head/sys/dev/bge/if_bge.c 92739 2002-03-20 02:08:01Z alfred $"; | 125 "$FreeBSD: head/sys/dev/bge/if_bge.c 92934 2002-03-22 06:45:40Z wpaul $"; |
126#endif 127 128/* 129 * Various supported device vendors/types and their names. Note: the 130 * spec seems to indicate that the hardware still has Alteon's vendor 131 * ID burned into it, though it will always be overriden by the vendor 132 * ID in the EEPROM. Just to be safe, we cover all possibilities. 133 */ --- 340 unchanged lines hidden (view full) --- 474 struct bge_softc *sc; 475 struct ifnet *ifp; 476 u_int32_t val; 477 int i; 478 479 sc = device_get_softc(dev); 480 ifp = &sc->arpcom.ac_if; 481 | 126#endif 127 128/* 129 * Various supported device vendors/types and their names. Note: the 130 * spec seems to indicate that the hardware still has Alteon's vendor 131 * ID burned into it, though it will always be overriden by the vendor 132 * ID in the EEPROM. Just to be safe, we cover all possibilities. 133 */ --- 340 unchanged lines hidden (view full) --- 474 struct bge_softc *sc; 475 struct ifnet *ifp; 476 u_int32_t val; 477 int i; 478 479 sc = device_get_softc(dev); 480 ifp = &sc->arpcom.ac_if; 481 |
482 if (sc->bge_asicrev == BGE_ASICREV_BCM5701_B5 && phy != 1) 483 return(0); 484 |
|
482 if (ifp->if_flags & IFF_RUNNING) 483 BGE_CLRBIT(sc, BGE_MI_MODE, BGE_MIMODE_AUTOPOLL); 484 485 CSR_WRITE_4(sc, BGE_MI_COMM, BGE_MICMD_READ|BGE_MICOMM_BUSY| 486 BGE_MIPHY(phy)|BGE_MIREG(reg)); 487 488 for (i = 0; i < BGE_TIMEOUT; i++) { 489 val = CSR_READ_4(sc, BGE_MI_COMM); --- 1128 unchanged lines hidden (view full) --- 1618 ifp->if_watchdog = bge_watchdog; 1619 ifp->if_init = bge_init; 1620 ifp->if_mtu = ETHERMTU; 1621 ifp->if_snd.ifq_maxlen = BGE_TX_RING_CNT - 1; 1622 ifp->if_hwassist = BGE_CSUM_FEATURES; 1623 ifp->if_capabilities = IFCAP_HWCSUM; 1624 ifp->if_capenable = ifp->if_capabilities; 1625 | 485 if (ifp->if_flags & IFF_RUNNING) 486 BGE_CLRBIT(sc, BGE_MI_MODE, BGE_MIMODE_AUTOPOLL); 487 488 CSR_WRITE_4(sc, BGE_MI_COMM, BGE_MICMD_READ|BGE_MICOMM_BUSY| 489 BGE_MIPHY(phy)|BGE_MIREG(reg)); 490 491 for (i = 0; i < BGE_TIMEOUT; i++) { 492 val = CSR_READ_4(sc, BGE_MI_COMM); --- 1128 unchanged lines hidden (view full) --- 1621 ifp->if_watchdog = bge_watchdog; 1622 ifp->if_init = bge_init; 1623 ifp->if_mtu = ETHERMTU; 1624 ifp->if_snd.ifq_maxlen = BGE_TX_RING_CNT - 1; 1625 ifp->if_hwassist = BGE_CSUM_FEATURES; 1626 ifp->if_capabilities = IFCAP_HWCSUM; 1627 ifp->if_capenable = ifp->if_capabilities; 1628 |
1629 /* Save ASIC rev. */ 1630 1631 sc->bge_asicrev = 1632 pci_read_config(dev, BGE_PCI_MISC_CTL, 4) & 1633 BGE_PCIMISCCTL_ASICREV; 1634 |
|
1626 /* The SysKonnect SK-9D41 is a 1000baseSX card. */ 1627 if ((pci_read_config(dev, BGE_PCI_SUBSYS, 4) >> 16) == SK_SUBSYSID_9D41) 1628 sc->bge_tbi = 1; 1629 1630 if (sc->bge_tbi) { 1631 ifmedia_init(&sc->bge_ifmedia, IFM_IMASK, 1632 bge_ifmedia_upd, bge_ifmedia_sts); 1633 ifmedia_add(&sc->bge_ifmedia, IFM_ETHER|IFM_1000_SX, 0, NULL); --- 342 unchanged lines hidden (view full) --- 1976 return; 1977#endif 1978 /* Ack interrupt and stop others from occuring. */ 1979 CSR_WRITE_4(sc, BGE_MBX_IRQ0_LO, 1); 1980 1981 /* Process link state changes. */ 1982 if (sc->bge_rdata->bge_status_block.bge_status & 1983 BGE_STATFLAG_LINKSTATE_CHANGED) { | 1635 /* The SysKonnect SK-9D41 is a 1000baseSX card. */ 1636 if ((pci_read_config(dev, BGE_PCI_SUBSYS, 4) >> 16) == SK_SUBSYSID_9D41) 1637 sc->bge_tbi = 1; 1638 1639 if (sc->bge_tbi) { 1640 ifmedia_init(&sc->bge_ifmedia, IFM_IMASK, 1641 bge_ifmedia_upd, bge_ifmedia_sts); 1642 ifmedia_add(&sc->bge_ifmedia, IFM_ETHER|IFM_1000_SX, 0, NULL); --- 342 unchanged lines hidden (view full) --- 1985 return; 1986#endif 1987 /* Ack interrupt and stop others from occuring. */ 1988 CSR_WRITE_4(sc, BGE_MBX_IRQ0_LO, 1); 1989 1990 /* Process link state changes. */ 1991 if (sc->bge_rdata->bge_status_block.bge_status & 1992 BGE_STATFLAG_LINKSTATE_CHANGED) { |
1984 sc->bge_link = 0; 1985 untimeout(bge_tick, sc, sc->bge_stat_ch); 1986 bge_tick(sc); | 1993 if (sc->bge_asicrev != BGE_ASICREV_BCM5701_B5) { 1994 sc->bge_link = 0; 1995 untimeout(bge_tick, sc, sc->bge_stat_ch); 1996 bge_tick(sc); 1997 } |
1987 /* ack the event to clear/reset it */ 1988 CSR_WRITE_4(sc, BGE_MAC_STS, BGE_MACSTAT_SYNC_CHANGED| 1989 BGE_MACSTAT_CFG_CHANGED); 1990 CSR_WRITE_4(sc, BGE_MI_STS, 0); 1991 } 1992 1993 if (ifp->if_flags & IFF_RUNNING) { 1994 /* Check RX return ring producer/consumer */ --- 699 unchanged lines hidden --- | 1998 /* ack the event to clear/reset it */ 1999 CSR_WRITE_4(sc, BGE_MAC_STS, BGE_MACSTAT_SYNC_CHANGED| 2000 BGE_MACSTAT_CFG_CHANGED); 2001 CSR_WRITE_4(sc, BGE_MI_STS, 0); 2002 } 2003 2004 if (ifp->if_flags & IFF_RUNNING) { 2005 /* Check RX return ring producer/consumer */ --- 699 unchanged lines hidden --- |