No functional change intended:

- Use "do {} while (/*CONSTCOND*/false)" for null DPRINTF().
- Reduce indent level of wm_linkintr_gmii().
This commit is contained in:
msaitoh 2019-01-24 04:50:04 +00:00
parent 8b9c2e1032
commit 383c964987
1 changed files with 132 additions and 139 deletions

View File

@ -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.
@ -83,7 +83,7 @@
*/
#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
#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
#else
#define DPRINTF(x, y) /* nothing */
#define DPRINTF(x, y) do { } while (/*CONSTCOND*/false)
#endif /* WM_DEBUG */
#ifdef NET_MPSAFE
@ -3975,10 +3975,9 @@ wm_get_cfg_done(struct wm_softc *sc)
break;
delay(1000);
}
if (i >= WM_PHY_CFG_TIMEOUT) {
if (i >= WM_PHY_CFG_TIMEOUT)
DPRINTF(WM_DEBUG_GMII, ("%s: %s failed\n",
device_xname(sc->sc_dev), __func__));
}
break;
case WM_T_ICH8:
case WM_T_ICH9:
@ -4091,12 +4090,11 @@ wm_write_smbus_addr(struct wm_softc *sc)
HV_SMB_ADDR_FREQ_LOW);
phy_data |= __SHIFTIN((freq & 0x02) != 0,
HV_SMB_ADDR_FREQ_HIGH);
} else {
} else
DPRINTF(WM_DEBUG_INIT,
("%s: %s Unsupported SMB frequency in PHY\n",
device_xname(sc->sc_dev), __func__));
}
}
return wm_gmii_hv_writereg_locked(sc->sc_dev, 2, HV_SMB_ADDR,
phy_data);
@ -8955,26 +8953,32 @@ wm_rxeof(struct wm_rxqueue *rxq, u_int limit)
static void
wm_linkintr_gmii(struct wm_softc *sc, uint32_t icr)
{
uint32_t status, reg;
bool link;
KASSERT(WM_CORE_LOCKED(sc));
DPRINTF(WM_DEBUG_LINK, ("%s: %s:\n", device_xname(sc->sc_dev),
__func__));
if (icr & ICR_LSC) {
uint32_t status = CSR_READ(sc, WMREG_STATUS);
uint32_t reg;
bool link;
if ((icr & ICR_LSC) == 0) {
if (icr & ICR_RXSEQ)
DPRINTF(WM_DEBUG_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;
if (link) {
if (link)
DPRINTF(WM_DEBUG_LINK, ("%s: LINK: LSC -> up %s\n",
device_xname(sc->sc_dev),
(status & STATUS_FD) ? "FDX" : "HDX"));
} else {
else
DPRINTF(WM_DEBUG_LINK, ("%s: LINK: LSC -> down\n",
device_xname(sc->sc_dev)));
}
if ((sc->sc_type == WM_T_ICH8) && (link == false))
wm_gig_downshift_workaround_ich8lan(sc);
@ -9060,8 +9064,7 @@ wm_linkintr_gmii(struct wm_softc *sc, uint32_t icr)
/* FEXTNVM6 K1-off workaround */
if (sc->sc_type == WM_T_PCH_SPT) {
reg = CSR_READ(sc, WMREG_FEXTNVM6);
if (CSR_READ(sc, WMREG_PCIEANACFG)
& FEXTNVM6_K1_OFF_ENABLE)
if (CSR_READ(sc, WMREG_PCIEANACFG) & FEXTNVM6_K1_OFF_ENABLE)
reg |= FEXTNVM6_K1_OFF_ENABLE;
else
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 */
if (sc->sc_phytype > WMPHY_82579)
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,10 +9141,9 @@ wm_linkintr_tbi(struct wm_softc *sc, uint32_t icr)
}
/* Update LED */
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",
device_xname(sc->sc_dev)));
}
}
/*
@ -9219,10 +9216,9 @@ wm_linkintr_serdes(struct wm_softc *sc, uint32_t icr)
}
/* Update LED */
wm_tbi_serdes_set_linkled(sc);
} else {
} else
DPRINTF(WM_DEBUG_LINK, ("%s: LINK: Receive sequence error\n",
device_xname(sc->sc_dev)));
}
}
/*
@ -9264,10 +9260,9 @@ wm_intr_legacy(void *arg)
icr = CSR_READ(sc, WMREG_ICR);
if ((icr & sc->sc_icr) == 0)
break;
if (handled == 0) {
if (handled == 0)
DPRINTF(WM_DEBUG_TX,
("%s: INTx: got intr\n",device_xname(sc->sc_dev)));
}
if (rndval == 0)
rndval = icr;
@ -11888,14 +11883,13 @@ wm_check_for_link(struct wm_softc *sc)
__func__));
CSR_WRITE(sc, WMREG_TXCW, sc->sc_txcw);
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/",
device_xname(sc->sc_dev), __func__));
} else {
else
DPRINTF(WM_DEBUG_LINK, ("%s: %s: linkup %08x,%08x,%08x\n",
device_xname(sc->sc_dev), __func__, rxcw, ctrl,
status));
}
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)) {
/* XXX PCH_SPT? */
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,
("%s: NVM need to be updated (%04x != %04x)\n",
device_xname(sc->sc_dev), eeprom_data,
valid_checksum));
}
}
if ((wm_debug & WM_DEBUG_NVM) != 0) {
printf("%s: NVM dump:\n", device_xname(sc->sc_dev));