No functional change intended:
- Use "do {} while (/*CONSTCOND*/false)" for null DPRINTF(). - Reduce indent level of wm_linkintr_gmii().
This commit is contained in:
parent
8b9c2e1032
commit
383c964987
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: if_wm.c,v 1.617 2019/01/22 03:42:27 msaitoh Exp $ */
|
/* $NetBSD: if_wm.c,v 1.618 2019/01/24 04:50:04 msaitoh Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
|
* Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
|
||||||
|
@ -83,7 +83,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.617 2019/01/22 03:42:27 msaitoh Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.618 2019/01/24 04:50:04 msaitoh Exp $");
|
||||||
|
|
||||||
#ifdef _KERNEL_OPT
|
#ifdef _KERNEL_OPT
|
||||||
#include "opt_net_mpsafe.h"
|
#include "opt_net_mpsafe.h"
|
||||||
|
@ -160,7 +160,7 @@ int wm_debug = WM_DEBUG_TX | WM_DEBUG_RX | WM_DEBUG_LINK | WM_DEBUG_GMII
|
||||||
|
|
||||||
#define DPRINTF(x, y) if (wm_debug & (x)) printf y
|
#define DPRINTF(x, y) if (wm_debug & (x)) printf y
|
||||||
#else
|
#else
|
||||||
#define DPRINTF(x, y) /* nothing */
|
#define DPRINTF(x, y) do { } while (/*CONSTCOND*/false)
|
||||||
#endif /* WM_DEBUG */
|
#endif /* WM_DEBUG */
|
||||||
|
|
||||||
#ifdef NET_MPSAFE
|
#ifdef NET_MPSAFE
|
||||||
|
@ -3975,10 +3975,9 @@ wm_get_cfg_done(struct wm_softc *sc)
|
||||||
break;
|
break;
|
||||||
delay(1000);
|
delay(1000);
|
||||||
}
|
}
|
||||||
if (i >= WM_PHY_CFG_TIMEOUT) {
|
if (i >= WM_PHY_CFG_TIMEOUT)
|
||||||
DPRINTF(WM_DEBUG_GMII, ("%s: %s failed\n",
|
DPRINTF(WM_DEBUG_GMII, ("%s: %s failed\n",
|
||||||
device_xname(sc->sc_dev), __func__));
|
device_xname(sc->sc_dev), __func__));
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case WM_T_ICH8:
|
case WM_T_ICH8:
|
||||||
case WM_T_ICH9:
|
case WM_T_ICH9:
|
||||||
|
@ -4091,12 +4090,11 @@ wm_write_smbus_addr(struct wm_softc *sc)
|
||||||
HV_SMB_ADDR_FREQ_LOW);
|
HV_SMB_ADDR_FREQ_LOW);
|
||||||
phy_data |= __SHIFTIN((freq & 0x02) != 0,
|
phy_data |= __SHIFTIN((freq & 0x02) != 0,
|
||||||
HV_SMB_ADDR_FREQ_HIGH);
|
HV_SMB_ADDR_FREQ_HIGH);
|
||||||
} else {
|
} else
|
||||||
DPRINTF(WM_DEBUG_INIT,
|
DPRINTF(WM_DEBUG_INIT,
|
||||||
("%s: %s Unsupported SMB frequency in PHY\n",
|
("%s: %s Unsupported SMB frequency in PHY\n",
|
||||||
device_xname(sc->sc_dev), __func__));
|
device_xname(sc->sc_dev), __func__));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return wm_gmii_hv_writereg_locked(sc->sc_dev, 2, HV_SMB_ADDR,
|
return wm_gmii_hv_writereg_locked(sc->sc_dev, 2, HV_SMB_ADDR,
|
||||||
phy_data);
|
phy_data);
|
||||||
|
@ -8955,26 +8953,32 @@ wm_rxeof(struct wm_rxqueue *rxq, u_int limit)
|
||||||
static void
|
static void
|
||||||
wm_linkintr_gmii(struct wm_softc *sc, uint32_t icr)
|
wm_linkintr_gmii(struct wm_softc *sc, uint32_t icr)
|
||||||
{
|
{
|
||||||
|
uint32_t status, reg;
|
||||||
|
bool link;
|
||||||
|
|
||||||
KASSERT(WM_CORE_LOCKED(sc));
|
KASSERT(WM_CORE_LOCKED(sc));
|
||||||
|
|
||||||
DPRINTF(WM_DEBUG_LINK, ("%s: %s:\n", device_xname(sc->sc_dev),
|
DPRINTF(WM_DEBUG_LINK, ("%s: %s:\n", device_xname(sc->sc_dev),
|
||||||
__func__));
|
__func__));
|
||||||
|
|
||||||
if (icr & ICR_LSC) {
|
if ((icr & ICR_LSC) == 0) {
|
||||||
uint32_t status = CSR_READ(sc, WMREG_STATUS);
|
if (icr & ICR_RXSEQ)
|
||||||
uint32_t reg;
|
DPRINTF(WM_DEBUG_LINK,
|
||||||
bool link;
|
("%s: LINK Receive sequence error\n",
|
||||||
|
device_xname(sc->sc_dev)));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Link status changed */
|
||||||
|
status = CSR_READ(sc, WMREG_STATUS);
|
||||||
link = status & STATUS_LU;
|
link = status & STATUS_LU;
|
||||||
if (link) {
|
if (link)
|
||||||
DPRINTF(WM_DEBUG_LINK, ("%s: LINK: LSC -> up %s\n",
|
DPRINTF(WM_DEBUG_LINK, ("%s: LINK: LSC -> up %s\n",
|
||||||
device_xname(sc->sc_dev),
|
device_xname(sc->sc_dev),
|
||||||
(status & STATUS_FD) ? "FDX" : "HDX"));
|
(status & STATUS_FD) ? "FDX" : "HDX"));
|
||||||
} else {
|
else
|
||||||
DPRINTF(WM_DEBUG_LINK, ("%s: LINK: LSC -> down\n",
|
DPRINTF(WM_DEBUG_LINK, ("%s: LINK: LSC -> down\n",
|
||||||
device_xname(sc->sc_dev)));
|
device_xname(sc->sc_dev)));
|
||||||
}
|
|
||||||
if ((sc->sc_type == WM_T_ICH8) && (link == false))
|
if ((sc->sc_type == WM_T_ICH8) && (link == false))
|
||||||
wm_gig_downshift_workaround_ich8lan(sc);
|
wm_gig_downshift_workaround_ich8lan(sc);
|
||||||
|
|
||||||
|
@ -9060,8 +9064,7 @@ wm_linkintr_gmii(struct wm_softc *sc, uint32_t icr)
|
||||||
/* FEXTNVM6 K1-off workaround */
|
/* FEXTNVM6 K1-off workaround */
|
||||||
if (sc->sc_type == WM_T_PCH_SPT) {
|
if (sc->sc_type == WM_T_PCH_SPT) {
|
||||||
reg = CSR_READ(sc, WMREG_FEXTNVM6);
|
reg = CSR_READ(sc, WMREG_FEXTNVM6);
|
||||||
if (CSR_READ(sc, WMREG_PCIEANACFG)
|
if (CSR_READ(sc, WMREG_PCIEANACFG) & FEXTNVM6_K1_OFF_ENABLE)
|
||||||
& FEXTNVM6_K1_OFF_ENABLE)
|
|
||||||
reg |= FEXTNVM6_K1_OFF_ENABLE;
|
reg |= FEXTNVM6_K1_OFF_ENABLE;
|
||||||
else
|
else
|
||||||
reg &= ~FEXTNVM6_K1_OFF_ENABLE;
|
reg &= ~FEXTNVM6_K1_OFF_ENABLE;
|
||||||
|
@ -9086,11 +9089,6 @@ wm_linkintr_gmii(struct wm_softc *sc, uint32_t icr)
|
||||||
/* Enable/Disable EEE after link up */
|
/* Enable/Disable EEE after link up */
|
||||||
if (sc->sc_phytype > WMPHY_82579)
|
if (sc->sc_phytype > WMPHY_82579)
|
||||||
wm_set_eee_pchlan(sc);
|
wm_set_eee_pchlan(sc);
|
||||||
|
|
||||||
} else if (icr & ICR_RXSEQ) {
|
|
||||||
DPRINTF(WM_DEBUG_LINK, ("%s: LINK Receive sequence error\n",
|
|
||||||
device_xname(sc->sc_dev)));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -9143,11 +9141,10 @@ wm_linkintr_tbi(struct wm_softc *sc, uint32_t icr)
|
||||||
}
|
}
|
||||||
/* Update LED */
|
/* Update LED */
|
||||||
wm_tbi_serdes_set_linkled(sc);
|
wm_tbi_serdes_set_linkled(sc);
|
||||||
} else if (icr & ICR_RXSEQ) {
|
} else if (icr & ICR_RXSEQ)
|
||||||
DPRINTF(WM_DEBUG_LINK, ("%s: LINK: Receive sequence error\n",
|
DPRINTF(WM_DEBUG_LINK, ("%s: LINK: Receive sequence error\n",
|
||||||
device_xname(sc->sc_dev)));
|
device_xname(sc->sc_dev)));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* wm_linkintr_serdes:
|
* wm_linkintr_serdes:
|
||||||
|
@ -9219,11 +9216,10 @@ wm_linkintr_serdes(struct wm_softc *sc, uint32_t icr)
|
||||||
}
|
}
|
||||||
/* Update LED */
|
/* Update LED */
|
||||||
wm_tbi_serdes_set_linkled(sc);
|
wm_tbi_serdes_set_linkled(sc);
|
||||||
} else {
|
} else
|
||||||
DPRINTF(WM_DEBUG_LINK, ("%s: LINK: Receive sequence error\n",
|
DPRINTF(WM_DEBUG_LINK, ("%s: LINK: Receive sequence error\n",
|
||||||
device_xname(sc->sc_dev)));
|
device_xname(sc->sc_dev)));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* wm_linkintr:
|
* wm_linkintr:
|
||||||
|
@ -9264,10 +9260,9 @@ wm_intr_legacy(void *arg)
|
||||||
icr = CSR_READ(sc, WMREG_ICR);
|
icr = CSR_READ(sc, WMREG_ICR);
|
||||||
if ((icr & sc->sc_icr) == 0)
|
if ((icr & sc->sc_icr) == 0)
|
||||||
break;
|
break;
|
||||||
if (handled == 0) {
|
if (handled == 0)
|
||||||
DPRINTF(WM_DEBUG_TX,
|
DPRINTF(WM_DEBUG_TX,
|
||||||
("%s: INTx: got intr\n",device_xname(sc->sc_dev)));
|
("%s: INTx: got intr\n",device_xname(sc->sc_dev)));
|
||||||
}
|
|
||||||
if (rndval == 0)
|
if (rndval == 0)
|
||||||
rndval = icr;
|
rndval = icr;
|
||||||
|
|
||||||
|
@ -11888,14 +11883,13 @@ wm_check_for_link(struct wm_softc *sc)
|
||||||
__func__));
|
__func__));
|
||||||
CSR_WRITE(sc, WMREG_TXCW, sc->sc_txcw);
|
CSR_WRITE(sc, WMREG_TXCW, sc->sc_txcw);
|
||||||
CSR_WRITE(sc, WMREG_CTRL, (ctrl & ~CTRL_SLU));
|
CSR_WRITE(sc, WMREG_CTRL, (ctrl & ~CTRL_SLU));
|
||||||
} else if (signal && ((rxcw & RXCW_C) != 0)) {
|
} else if (signal && ((rxcw & RXCW_C) != 0))
|
||||||
DPRINTF(WM_DEBUG_LINK, ("%s: %s: /C/",
|
DPRINTF(WM_DEBUG_LINK, ("%s: %s: /C/",
|
||||||
device_xname(sc->sc_dev), __func__));
|
device_xname(sc->sc_dev), __func__));
|
||||||
} else {
|
else
|
||||||
DPRINTF(WM_DEBUG_LINK, ("%s: %s: linkup %08x,%08x,%08x\n",
|
DPRINTF(WM_DEBUG_LINK, ("%s: %s: linkup %08x,%08x,%08x\n",
|
||||||
device_xname(sc->sc_dev), __func__, rxcw, ctrl,
|
device_xname(sc->sc_dev), __func__, rxcw, ctrl,
|
||||||
status));
|
status));
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -13275,13 +13269,12 @@ wm_nvm_validate_checksum(struct wm_softc *sc)
|
||||||
|| (sc->sc_type == WM_T_PCH2) || (sc->sc_type == WM_T_PCH_LPT)) {
|
|| (sc->sc_type == WM_T_PCH2) || (sc->sc_type == WM_T_PCH_LPT)) {
|
||||||
/* XXX PCH_SPT? */
|
/* XXX PCH_SPT? */
|
||||||
wm_nvm_read(sc, csum_wordaddr, 1, &eeprom_data);
|
wm_nvm_read(sc, csum_wordaddr, 1, &eeprom_data);
|
||||||
if ((eeprom_data & valid_checksum) == 0) {
|
if ((eeprom_data & valid_checksum) == 0)
|
||||||
DPRINTF(WM_DEBUG_NVM,
|
DPRINTF(WM_DEBUG_NVM,
|
||||||
("%s: NVM need to be updated (%04x != %04x)\n",
|
("%s: NVM need to be updated (%04x != %04x)\n",
|
||||||
device_xname(sc->sc_dev), eeprom_data,
|
device_xname(sc->sc_dev), eeprom_data,
|
||||||
valid_checksum));
|
valid_checksum));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if ((wm_debug & WM_DEBUG_NVM) != 0) {
|
if ((wm_debug & WM_DEBUG_NVM) != 0) {
|
||||||
printf("%s: NVM dump:\n", device_xname(sc->sc_dev));
|
printf("%s: NVM dump:\n", device_xname(sc->sc_dev));
|
||||||
|
|
Loading…
Reference in New Issue