version 1.314.2.1, 2019/06/10 22:07:16 |
version 1.314.2.2, 2020/04/08 14:08:09 |
Line 1027 bge_eeprom_getbyte(struct bge_softc *sc, |
|
Line 1027 bge_eeprom_getbyte(struct bge_softc *sc, |
|
* Enable use of auto EEPROM access so we can avoid |
* Enable use of auto EEPROM access so we can avoid |
* having to use the bitbang method. |
* having to use the bitbang method. |
*/ |
*/ |
BGE_SETBIT(sc, BGE_MISC_LOCAL_CTL, BGE_MLC_AUTO_EEPROM); |
BGE_SETBIT_FLUSH(sc, BGE_MISC_LOCAL_CTL, BGE_MLC_AUTO_EEPROM); |
|
|
/* Reset the EEPROM, load the clock period. */ |
/* Reset the EEPROM, load the clock period. */ |
CSR_WRITE_4(sc, BGE_EE_ADDR, |
CSR_WRITE_4_FLUSH(sc, BGE_EE_ADDR, |
BGE_EEADDR_RESET | BGE_EEHALFCLK(BGE_HALFCLK_384SCL)); |
BGE_EEADDR_RESET | BGE_EEHALFCLK(BGE_HALFCLK_384SCL)); |
DELAY(20); |
DELAY(20); |
|
|
Line 1113 bge_miibus_readreg(device_t dev, int phy |
|
Line 1113 bge_miibus_readreg(device_t dev, int phy |
|
if (i == BGE_TIMEOUT) { |
if (i == BGE_TIMEOUT) { |
aprint_error_dev(sc->bge_dev, "PHY read timed out\n"); |
aprint_error_dev(sc->bge_dev, "PHY read timed out\n"); |
rv = ETIMEDOUT; |
rv = ETIMEDOUT; |
} else if ((data & BGE_MICOMM_READFAIL) != 0) |
} else if ((data & BGE_MICOMM_READFAIL) != 0) { |
rv = -1; |
/* XXX This error occurs on some devices while attaching. */ |
else |
aprint_debug_dev(sc->bge_dev, "PHY read I/O error\n"); |
|
rv = EIO; |
|
} else |
*val = data & BGE_MICOMM_DATA; |
*val = data & BGE_MICOMM_DATA; |
|
|
if (autopoll & BGE_MIMODE_AUTOPOLL) { |
if (autopoll & BGE_MIMODE_AUTOPOLL) { |
|
|
bge_miibus_writereg(device_t dev, int phy, int reg, uint16_t val) |
bge_miibus_writereg(device_t dev, int phy, int reg, uint16_t val) |
{ |
{ |
struct bge_softc *sc = device_private(dev); |
struct bge_softc *sc = device_private(dev); |
uint32_t autopoll; |
uint32_t data, autopoll; |
|
int rv = 0; |
int i; |
int i; |
|
|
if (BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5906 && |
if (BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5906 && |
Line 1156 bge_miibus_writereg(device_t dev, int ph |
|
Line 1159 bge_miibus_writereg(device_t dev, int ph |
|
|
|
for (i = 0; i < BGE_TIMEOUT; i++) { |
for (i = 0; i < BGE_TIMEOUT; i++) { |
delay(10); |
delay(10); |
if (!(CSR_READ_4(sc, BGE_MI_COMM) & BGE_MICOMM_BUSY)) { |
data = CSR_READ_4(sc, BGE_MI_COMM); |
|
if (!(data & BGE_MICOMM_BUSY)) { |
delay(5); |
delay(5); |
CSR_READ_4(sc, BGE_MI_COMM); |
data = CSR_READ_4(sc, BGE_MI_COMM); |
break; |
break; |
} |
} |
} |
} |
|
|
|
if (i == BGE_TIMEOUT) { |
|
aprint_error_dev(sc->bge_dev, "PHY write timed out\n"); |
|
rv = ETIMEDOUT; |
|
} else if ((data & BGE_MICOMM_READFAIL) != 0) { |
|
aprint_error_dev(sc->bge_dev, "PHY write I/O error\n"); |
|
rv = EIO; |
|
} |
|
|
if (autopoll & BGE_MIMODE_AUTOPOLL) { |
if (autopoll & BGE_MIMODE_AUTOPOLL) { |
BGE_STS_SETBIT(sc, BGE_STS_AUTOPOLL); |
BGE_STS_SETBIT(sc, BGE_STS_AUTOPOLL); |
BGE_SETBIT_FLUSH(sc, BGE_MI_MODE, BGE_MIMODE_AUTOPOLL); |
BGE_SETBIT_FLUSH(sc, BGE_MI_MODE, BGE_MIMODE_AUTOPOLL); |
Line 1176 bge_miibus_writereg(device_t dev, int ph |
|
Line 1188 bge_miibus_writereg(device_t dev, int ph |
|
return ETIMEDOUT; |
return ETIMEDOUT; |
} |
} |
|
|
return 0; |
return rv; |
} |
} |
|
|
static void |
static void |
Line 2286 bge_chipinit(struct bge_softc *sc) |
|
Line 2298 bge_chipinit(struct bge_softc *sc) |
|
#endif |
#endif |
|
|
/* Set the timer prescaler (always 66MHz) */ |
/* Set the timer prescaler (always 66MHz) */ |
CSR_WRITE_4(sc, BGE_MISC_CFG, BGE_32BITTIME_66MHZ); |
CSR_WRITE_4_FLUSH(sc, BGE_MISC_CFG, BGE_32BITTIME_66MHZ); |
|
|
if (BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5906) { |
if (BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5906) { |
DELAY(40); /* XXX */ |
DELAY(40); /* XXX */ |
Line 3182 bge_attach(device_t parent, device_t sel |
|
Line 3194 bge_attach(device_t parent, device_t sel |
|
uint32_t command; |
uint32_t command; |
struct ifnet *ifp; |
struct ifnet *ifp; |
struct mii_data * const mii = &sc->bge_mii; |
struct mii_data * const mii = &sc->bge_mii; |
uint32_t misccfg, mimode; |
uint32_t misccfg, mimode, macmode; |
void * kva; |
void * kva; |
u_char eaddr[ETHER_ADDR_LEN]; |
u_char eaddr[ETHER_ADDR_LEN]; |
pcireg_t memtype, subid, reg; |
pcireg_t memtype, subid, reg; |
bus_addr_t memaddr; |
bus_addr_t memaddr; |
uint32_t pm_ctl; |
uint32_t pm_ctl; |
bool no_seeprom; |
bool no_seeprom; |
int capmask; |
int capmask, trys; |
int mii_flags; |
int mii_flags; |
int map_flags; |
int map_flags; |
char intrbuf[PCI_INTRSTR_LEN]; |
char intrbuf[PCI_INTRSTR_LEN]; |
Line 3433 bge_attach(device_t parent, device_t sel |
|
Line 3445 bge_attach(device_t parent, device_t sel |
|
BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM57780) |
BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM57780) |
sc->bge_flags |= BGEF_CPMU_PRESENT; |
sc->bge_flags |= BGEF_CPMU_PRESENT; |
|
|
/* Set MI_MODE */ |
|
mimode = BGE_MIMODE_PHYADDR(sc->bge_phy_addr); |
|
if ((sc->bge_flags & BGEF_CPMU_PRESENT) != 0) |
|
mimode |= BGE_MIMODE_500KHZ_CONST; |
|
else |
|
mimode |= BGE_MIMODE_BASE; |
|
CSR_WRITE_4(sc, BGE_MI_MODE, mimode); |
|
|
|
/* |
/* |
* When using the BCM5701 in PCI-X mode, data corruption has |
* When using the BCM5701 in PCI-X mode, data corruption has |
* been observed in the first few bytes of some received packets. |
* been observed in the first few bytes of some received packets. |
Line 3636 bge_attach(device_t parent, device_t sel |
|
Line 3640 bge_attach(device_t parent, device_t sel |
|
* Reset NVRAM before bge_reset(). It's required to acquire NVRAM |
* Reset NVRAM before bge_reset(). It's required to acquire NVRAM |
* lock in bge_reset(). |
* lock in bge_reset(). |
*/ |
*/ |
CSR_WRITE_4(sc, BGE_EE_ADDR, |
CSR_WRITE_4_FLUSH(sc, BGE_EE_ADDR, |
BGE_EEADDR_RESET | BGE_EEHALFCLK(BGE_HALFCLK_384SCL)); |
BGE_EEADDR_RESET | BGE_EEHALFCLK(BGE_HALFCLK_384SCL)); |
delay(1000); |
delay(1000); |
BGE_SETBIT(sc, BGE_MISC_LOCAL_CTL, BGE_MLC_AUTO_EEPROM); |
BGE_SETBIT_FLUSH(sc, BGE_MISC_LOCAL_CTL, BGE_MLC_AUTO_EEPROM); |
|
|
bge_stop_fw(sc); |
bge_stop_fw(sc); |
bge_sig_pre_reset(sc, BGE_RESET_START); |
bge_sig_pre_reset(sc, BGE_RESET_START); |
Line 3685 bge_attach(device_t parent, device_t sel |
|
Line 3689 bge_attach(device_t parent, device_t sel |
|
return; |
return; |
} |
} |
|
|
|
if (BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5700) { |
|
BGE_SETBIT_FLUSH(sc, BGE_MISC_LOCAL_CTL, |
|
BGE_MLC_MISCIO_OUT1 | BGE_MLC_MISCIO_OUTEN1); |
|
DELAY(100); |
|
} |
|
|
|
/* Set MI_MODE */ |
|
mimode = BGE_MIMODE_PHYADDR(sc->bge_phy_addr); |
|
if ((sc->bge_flags & BGEF_CPMU_PRESENT) != 0) |
|
mimode |= BGE_MIMODE_500KHZ_CONST; |
|
else |
|
mimode |= BGE_MIMODE_BASE; |
|
CSR_WRITE_4_FLUSH(sc, BGE_MI_MODE, mimode); |
|
DELAY(80); |
|
|
/* |
/* |
* Get station address from the EEPROM. |
* Get station address from the EEPROM. |
*/ |
*/ |
Line 3852 bge_attach(device_t parent, device_t sel |
|
Line 3871 bge_attach(device_t parent, device_t sel |
|
* by its PCI subsystem ID, as we do below for the SysKonnect SK-9D41. |
* by its PCI subsystem ID, as we do below for the SysKonnect SK-9D41. |
* The SysKonnect SK-9D41 is a 1000baseSX card. |
* The SysKonnect SK-9D41 is a 1000baseSX card. |
*/ |
*/ |
if (PCI_PRODUCT(pa->pa_id) == SK_SUBSYSID_9D41 || |
if (PCI_PRODUCT(subid) == SK_SUBSYSID_9D41 || |
(hwcfg & BGE_HWCFG_MEDIA) == BGE_MEDIA_FIBER) { |
(hwcfg & BGE_HWCFG_MEDIA) == BGE_MEDIA_FIBER) { |
if (BGE_IS_5705_PLUS(sc)) { |
if (BGE_IS_5705_PLUS(sc)) { |
sc->bge_flags |= BGEF_FIBER_MII; |
sc->bge_flags |= BGEF_FIBER_MII; |
Line 3870 bge_attach(device_t parent, device_t sel |
|
Line 3889 bge_attach(device_t parent, device_t sel |
|
prop_dictionary_set_uint32(dict, "phyflags", sc->bge_phy_flags); |
prop_dictionary_set_uint32(dict, "phyflags", sc->bge_phy_flags); |
prop_dictionary_set_uint32(dict, "chipid", sc->bge_chipid); |
prop_dictionary_set_uint32(dict, "chipid", sc->bge_chipid); |
|
|
|
macmode = CSR_READ_4(sc, BGE_MAC_MODE); |
|
macmode &= ~BGE_MACMODE_PORTMODE; |
/* Initialize ifmedia structures. */ |
/* Initialize ifmedia structures. */ |
if (sc->bge_flags & BGEF_FIBER_TBI) { |
if (sc->bge_flags & BGEF_FIBER_TBI) { |
|
CSR_WRITE_4_FLUSH(sc, BGE_MAC_MODE, |
|
macmode | BGE_PORTMODE_TBI); |
|
DELAY(40); |
|
|
sc->ethercom.ec_ifmedia = &sc->bge_ifmedia; |
sc->ethercom.ec_ifmedia = &sc->bge_ifmedia; |
ifmedia_init(&sc->bge_ifmedia, IFM_IMASK, bge_ifmedia_upd, |
ifmedia_init(&sc->bge_ifmedia, IFM_IMASK, bge_ifmedia_upd, |
bge_ifmedia_sts); |
bge_ifmedia_sts); |
Line 3883 bge_attach(device_t parent, device_t sel |
|
Line 3908 bge_attach(device_t parent, device_t sel |
|
/* Pretend the user requested this setting */ |
/* Pretend the user requested this setting */ |
sc->bge_ifmedia.ifm_media = sc->bge_ifmedia.ifm_cur->ifm_media; |
sc->bge_ifmedia.ifm_media = sc->bge_ifmedia.ifm_cur->ifm_media; |
} else { |
} else { |
|
uint16_t phyreg; |
|
int rv; |
/* |
/* |
* Do transceiver setup and tell the firmware the |
* Do transceiver setup and tell the firmware the |
* driver is down so we can try to get access the |
* driver is down so we can try to get access the |
Line 3890 bge_attach(device_t parent, device_t sel |
|
Line 3917 bge_attach(device_t parent, device_t sel |
|
* if we get a conflict with the ASF firmware accessing |
* if we get a conflict with the ASF firmware accessing |
* the PHY. |
* the PHY. |
*/ |
*/ |
BGE_CLRBIT(sc, BGE_MODE_CTL, BGE_MODECTL_STACKUP); |
if (sc->bge_flags & BGEF_FIBER_MII) |
bge_asf_driver_up(sc); |
macmode |= BGE_PORTMODE_GMII; |
|
else |
|
macmode |= BGE_PORTMODE_MII; |
|
CSR_WRITE_4_FLUSH(sc, BGE_MAC_MODE, macmode); |
|
DELAY(40); |
|
|
|
/* |
|
* Do transceiver setup and tell the firmware the |
|
* driver is down so we can try to get access the |
|
* probe if ASF is running. Retry a couple of times |
|
* if we get a conflict with the ASF firmware accessing |
|
* the PHY. |
|
*/ |
|
trys = 0; |
|
BGE_CLRBIT(sc, BGE_MODE_CTL, BGE_MODECTL_STACKUP); |
sc->ethercom.ec_mii = mii; |
sc->ethercom.ec_mii = mii; |
ifmedia_init(&mii->mii_media, 0, bge_ifmedia_upd, |
ifmedia_init(&mii->mii_media, 0, bge_ifmedia_upd, |
bge_ifmedia_sts); |
bge_ifmedia_sts); |
mii_flags = MIIF_DOPAUSE; |
mii_flags = MIIF_DOPAUSE; |
if (sc->bge_flags & BGEF_FIBER_MII) |
if (sc->bge_flags & BGEF_FIBER_MII) |
mii_flags |= MIIF_HAVEFIBER; |
mii_flags |= MIIF_HAVEFIBER; |
|
again: |
|
bge_asf_driver_up(sc); |
|
rv = bge_miibus_readreg(sc->bge_dev, sc->bge_phy_addr, |
|
MII_BMCR, &phyreg); |
|
if ((rv != 0) || ((phyreg & BMCR_PDOWN) != 0)) { |
|
int i; |
|
|
|
bge_miibus_writereg(sc->bge_dev, sc->bge_phy_addr, |
|
MII_BMCR, BMCR_RESET); |
|
/* Wait up to 500ms for it to complete. */ |
|
for (i = 0; i < 500; i++) { |
|
bge_miibus_readreg(sc->bge_dev, |
|
sc->bge_phy_addr, MII_BMCR, &phyreg); |
|
if ((phyreg & BMCR_RESET) == 0) |
|
break; |
|
DELAY(1000); |
|
} |
|
} |
|
|
mii_attach(sc->bge_dev, mii, capmask, sc->bge_phy_addr, |
mii_attach(sc->bge_dev, mii, capmask, sc->bge_phy_addr, |
MII_OFFSET_ANY, mii_flags); |
MII_OFFSET_ANY, mii_flags); |
|
|
|
if (LIST_EMPTY(&mii->mii_phys) && (trys++ < 4)) |
|
goto again; |
|
|
if (LIST_EMPTY(&mii->mii_phys)) { |
if (LIST_EMPTY(&mii->mii_phys)) { |
aprint_error_dev(sc->bge_dev, "no PHY found!\n"); |
aprint_error_dev(sc->bge_dev, "no PHY found!\n"); |
ifmedia_add(&mii->mii_media, IFM_ETHER | IFM_MANUAL, |
ifmedia_add(&mii->mii_media, IFM_ETHER | IFM_MANUAL, |
Line 3953 bge_attach(device_t parent, device_t sel |
|
Line 4015 bge_attach(device_t parent, device_t sel |
|
#endif /* BGE_EVENT_COUNTERS */ |
#endif /* BGE_EVENT_COUNTERS */ |
DPRINTFN(5, ("callout_init\n")); |
DPRINTFN(5, ("callout_init\n")); |
callout_init(&sc->bge_timeout, 0); |
callout_init(&sc->bge_timeout, 0); |
|
callout_setfunc(&sc->bge_timeout, bge_tick, sc); |
|
|
if (pmf_device_register(self, NULL, NULL)) |
if (pmf_device_register(self, NULL, NULL)) |
pmf_class_network_register(self, ifp); |
pmf_class_network_register(self, ifp); |
Line 3984 bge_detach(device_t self, int flags __un |
|
Line 4047 bge_detach(device_t self, int flags __un |
|
|
|
mii_detach(&sc->bge_mii, MII_PHY_ANY, MII_OFFSET_ANY); |
mii_detach(&sc->bge_mii, MII_PHY_ANY, MII_OFFSET_ANY); |
|
|
/* Delete all remaining media. */ |
|
ifmedia_delete_instance(&sc->bge_mii.mii_media, IFM_INST_ANY); |
|
|
|
ether_ifdetach(ifp); |
ether_ifdetach(ifp); |
if_detach(ifp); |
if_detach(ifp); |
|
|
|
/* Delete all remaining media. */ |
|
ifmedia_fini(&sc->bge_mii.mii_media); |
|
|
bge_release_resources(sc); |
bge_release_resources(sc); |
|
|
return 0; |
return 0; |
Line 4396 bge_rxeof(struct bge_softc *sc) |
|
Line 4459 bge_rxeof(struct bge_softc *sc) |
|
mtod(m, char *) - (char *)sc->bge_cdata.bge_jumbo_buf, |
mtod(m, char *) - (char *)sc->bge_cdata.bge_jumbo_buf, |
BGE_JLEN, BUS_DMASYNC_POSTREAD); |
BGE_JLEN, BUS_DMASYNC_POSTREAD); |
if (cur_rx->bge_flags & BGE_RXBDFLAG_ERROR) { |
if (cur_rx->bge_flags & BGE_RXBDFLAG_ERROR) { |
ifp->if_ierrors++; |
if_statinc(ifp, if_ierrors); |
bge_newbuf_jumbo(sc, sc->bge_jumbo, m); |
bge_newbuf_jumbo(sc, sc->bge_jumbo, m); |
continue; |
continue; |
} |
} |
if (bge_newbuf_jumbo(sc, sc->bge_jumbo, |
if (bge_newbuf_jumbo(sc, sc->bge_jumbo, |
NULL)== ENOBUFS) { |
NULL)== ENOBUFS) { |
ifp->if_ierrors++; |
if_statinc(ifp, if_ierrors); |
bge_newbuf_jumbo(sc, sc->bge_jumbo, m); |
bge_newbuf_jumbo(sc, sc->bge_jumbo, m); |
continue; |
continue; |
} |
} |
Line 4415 bge_rxeof(struct bge_softc *sc) |
|
Line 4478 bge_rxeof(struct bge_softc *sc) |
|
dmamap = sc->bge_cdata.bge_rx_std_map[rxidx]; |
dmamap = sc->bge_cdata.bge_rx_std_map[rxidx]; |
sc->bge_cdata.bge_rx_std_map[rxidx] = NULL; |
sc->bge_cdata.bge_rx_std_map[rxidx] = NULL; |
if (dmamap == NULL) { |
if (dmamap == NULL) { |
ifp->if_ierrors++; |
if_statinc(ifp, if_ierrors); |
bge_newbuf_std(sc, sc->bge_std, m, dmamap); |
bge_newbuf_std(sc, sc->bge_std, m, dmamap); |
continue; |
continue; |
} |
} |
Line 4423 bge_rxeof(struct bge_softc *sc) |
|
Line 4486 bge_rxeof(struct bge_softc *sc) |
|
dmamap->dm_mapsize, BUS_DMASYNC_POSTREAD); |
dmamap->dm_mapsize, BUS_DMASYNC_POSTREAD); |
bus_dmamap_unload(sc->bge_dmatag, dmamap); |
bus_dmamap_unload(sc->bge_dmatag, dmamap); |
if (cur_rx->bge_flags & BGE_RXBDFLAG_ERROR) { |
if (cur_rx->bge_flags & BGE_RXBDFLAG_ERROR) { |
ifp->if_ierrors++; |
if_statinc(ifp, if_ierrors); |
bge_newbuf_std(sc, sc->bge_std, m, dmamap); |
bge_newbuf_std(sc, sc->bge_std, m, dmamap); |
continue; |
continue; |
} |
} |
if (bge_newbuf_std(sc, sc->bge_std, |
if (bge_newbuf_std(sc, sc->bge_std, |
NULL, dmamap) == ENOBUFS) { |
NULL, dmamap) == ENOBUFS) { |
ifp->if_ierrors++; |
if_statinc(ifp, if_ierrors); |
bge_newbuf_std(sc, sc->bge_std, m, dmamap); |
bge_newbuf_std(sc, sc->bge_std, m, dmamap); |
continue; |
continue; |
} |
} |
Line 4560 bge_txeof(struct bge_softc *sc) |
|
Line 4623 bge_txeof(struct bge_softc *sc) |
|
idx = sc->bge_tx_saved_considx; |
idx = sc->bge_tx_saved_considx; |
cur_tx = &sc->bge_rdata->bge_tx_ring[idx]; |
cur_tx = &sc->bge_rdata->bge_tx_ring[idx]; |
if (cur_tx->bge_flags & BGE_TXBDFLAG_END) |
if (cur_tx->bge_flags & BGE_TXBDFLAG_END) |
ifp->if_opackets++; |
if_statinc(ifp, if_opackets); |
m = sc->bge_cdata.bge_tx_chain[idx]; |
m = sc->bge_cdata.bge_tx_chain[idx]; |
if (m != NULL) { |
if (m != NULL) { |
sc->bge_cdata.bge_tx_chain[idx] = NULL; |
sc->bge_cdata.bge_tx_chain[idx] = NULL; |
Line 4745 bge_tick(void *xsc) |
|
Line 4808 bge_tick(void *xsc) |
|
bge_asf_driver_up(sc); |
bge_asf_driver_up(sc); |
|
|
if (!sc->bge_detaching) |
if (!sc->bge_detaching) |
callout_reset(&sc->bge_timeout, hz, bge_tick, sc); |
callout_schedule(&sc->bge_timeout, hz); |
|
|
splx(s); |
splx(s); |
} |
} |
Line 4755 bge_stats_update_regs(struct bge_softc * |
|
Line 4818 bge_stats_update_regs(struct bge_softc * |
|
{ |
{ |
struct ifnet *ifp = &sc->ethercom.ec_if; |
struct ifnet *ifp = &sc->ethercom.ec_if; |
|
|
ifp->if_collisions += CSR_READ_4(sc, BGE_MAC_STATS + |
net_stat_ref_t nsr = IF_STAT_GETREF(ifp); |
offsetof(struct bge_mac_stats_regs, etherStatsCollisions)); |
|
|
if_statadd_ref(nsr, if_collisions, |
|
CSR_READ_4(sc, BGE_MAC_STATS + |
|
offsetof(struct bge_mac_stats_regs, etherStatsCollisions))); |
|
|
/* |
/* |
* On BCM5717, BCM5718, BCM5719 A0 and BCM5720 A0, |
* On BCM5717, BCM5718, BCM5719 A0 and BCM5720 A0, |
Line 4767 bge_stats_update_regs(struct bge_softc * |
|
Line 4833 bge_stats_update_regs(struct bge_softc * |
|
if (BGE_ASICREV(sc->bge_chipid) != BGE_ASICREV_BCM5717 && |
if (BGE_ASICREV(sc->bge_chipid) != BGE_ASICREV_BCM5717 && |
sc->bge_chipid != BGE_CHIPID_BCM5719_A0 && |
sc->bge_chipid != BGE_CHIPID_BCM5719_A0 && |
sc->bge_chipid != BGE_CHIPID_BCM5720_A0) { |
sc->bge_chipid != BGE_CHIPID_BCM5720_A0) { |
ifp->if_ierrors += CSR_READ_4(sc, BGE_RXLP_LOCSTAT_IFIN_DROPS); |
if_statadd_ref(nsr, if_ierrors, |
|
CSR_READ_4(sc, BGE_RXLP_LOCSTAT_IFIN_DROPS)); |
} |
} |
ifp->if_ierrors += CSR_READ_4(sc, BGE_RXLP_LOCSTAT_IFIN_ERRORS); |
if_statadd_ref(nsr, if_ierrors, |
ifp->if_ierrors += CSR_READ_4(sc, BGE_RXLP_LOCSTAT_OUT_OF_BDS); |
CSR_READ_4(sc, BGE_RXLP_LOCSTAT_IFIN_ERRORS)); |
|
if_statadd_ref(nsr, if_ierrors, |
|
CSR_READ_4(sc, BGE_RXLP_LOCSTAT_OUT_OF_BDS)); |
|
|
|
IF_STAT_PUTREF(ifp); |
|
|
if (sc->bge_flags & BGEF_RDMA_BUG) { |
if (sc->bge_flags & BGEF_RDMA_BUG) { |
uint32_t val, ucast, mcast, bcast; |
uint32_t val, ucast, mcast, bcast; |
Line 4808 bge_stats_update(struct bge_softc *sc) |
|
Line 4879 bge_stats_update(struct bge_softc *sc) |
|
#define READ_STAT(sc, stats, stat) \ |
#define READ_STAT(sc, stats, stat) \ |
CSR_READ_4(sc, stats + offsetof(struct bge_stats, stat)) |
CSR_READ_4(sc, stats + offsetof(struct bge_stats, stat)) |
|
|
ifp->if_collisions += |
uint64_t collisions = |
(READ_STAT(sc, stats, dot3StatsSingleCollisionFrames.bge_addr_lo) + |
(READ_STAT(sc, stats, dot3StatsSingleCollisionFrames.bge_addr_lo) + |
READ_STAT(sc, stats, dot3StatsMultipleCollisionFrames.bge_addr_lo) + |
READ_STAT(sc, stats, dot3StatsMultipleCollisionFrames.bge_addr_lo) + |
READ_STAT(sc, stats, dot3StatsExcessiveCollisions.bge_addr_lo) + |
READ_STAT(sc, stats, dot3StatsExcessiveCollisions.bge_addr_lo) + |
READ_STAT(sc, stats, dot3StatsLateCollisions.bge_addr_lo)) - |
READ_STAT(sc, stats, dot3StatsLateCollisions.bge_addr_lo)); |
ifp->if_collisions; |
|
|
if_statadd(ifp, if_collisions, collisions - sc->bge_if_collisions); |
|
sc->bge_if_collisions = collisions; |
|
|
|
|
BGE_EVCNT_UPD(sc->bge_ev_tx_xoff, |
BGE_EVCNT_UPD(sc->bge_ev_tx_xoff, |
READ_STAT(sc, stats, outXoffSent.bge_addr_lo)); |
READ_STAT(sc, stats, outXoffSent.bge_addr_lo)); |
Line 5625 bge_init(struct ifnet *ifp) |
|
Line 5699 bge_init(struct ifnet *ifp) |
|
ifp->if_flags |= IFF_RUNNING; |
ifp->if_flags |= IFF_RUNNING; |
ifp->if_flags &= ~IFF_OACTIVE; |
ifp->if_flags &= ~IFF_OACTIVE; |
|
|
callout_reset(&sc->bge_timeout, hz, bge_tick, sc); |
callout_schedule(&sc->bge_timeout, hz); |
|
|
out: |
out: |
sc->bge_if_flags = ifp->if_flags; |
sc->bge_if_flags = ifp->if_flags; |
Line 5675 bge_ifmedia_upd(struct ifnet *ifp) |
|
Line 5749 bge_ifmedia_upd(struct ifnet *ifp) |
|
break; |
break; |
case IFM_1000_SX: |
case IFM_1000_SX: |
if ((ifm->ifm_media & IFM_FDX) != 0) { |
if ((ifm->ifm_media & IFM_FDX) != 0) { |
BGE_CLRBIT(sc, BGE_MAC_MODE, |
BGE_CLRBIT_FLUSH(sc, BGE_MAC_MODE, |
BGE_MACMODE_HALF_DUPLEX); |
BGE_MACMODE_HALF_DUPLEX); |
} else { |
} else { |
BGE_SETBIT(sc, BGE_MAC_MODE, |
BGE_SETBIT_FLUSH(sc, BGE_MAC_MODE, |
BGE_MACMODE_HALF_DUPLEX); |
BGE_MACMODE_HALF_DUPLEX); |
} |
} |
DELAY(40); |
DELAY(40); |
Line 5885 bge_watchdog(struct ifnet *ifp) |
|
Line 5959 bge_watchdog(struct ifnet *ifp) |
|
ifp->if_flags &= ~IFF_RUNNING; |
ifp->if_flags &= ~IFF_RUNNING; |
bge_init(ifp); |
bge_init(ifp); |
|
|
ifp->if_oerrors++; |
if_statinc(ifp, if_oerrors); |
} |
} |
|
|
static void |
static void |
Line 6076 bge_link_upd(struct bge_softc *sc) |
|
Line 6150 bge_link_upd(struct bge_softc *sc) |
|
BGE_STS_SETBIT(sc, BGE_STS_LINK); |
BGE_STS_SETBIT(sc, BGE_STS_LINK); |
if (BGE_ASICREV(sc->bge_chipid) |
if (BGE_ASICREV(sc->bge_chipid) |
== BGE_ASICREV_BCM5704) { |
== BGE_ASICREV_BCM5704) { |
BGE_CLRBIT(sc, BGE_MAC_MODE, |
BGE_CLRBIT_FLUSH(sc, BGE_MAC_MODE, |
BGE_MACMODE_TBI_SEND_CFGS); |
BGE_MACMODE_TBI_SEND_CFGS); |
DELAY(40); |
DELAY(40); |
} |
} |