- Consistently use if_printf() only in interface methods: if_start(),

if_watchdog, etc., or in functions used only in these methods.
  In all other functions in the driver use device_printf().
- Use __func__ instead of typing function name.

Submitted by:	Alex Lyashkov <umka sevcity.net>
This commit is contained in:
glebius 2006-09-15 15:16:12 +00:00
parent 22cf0fa876
commit c9a02b4657
17 changed files with 203 additions and 180 deletions

View File

@ -591,7 +591,7 @@ bge_miibus_readreg(device_t dev, int phy, int reg)
}
if (i == BGE_TIMEOUT) {
if_printf(sc->bge_ifp, "PHY read timed out\n");
device_printf(sc->bge_dev, "PHY read timed out\n");
val = 0;
goto done;
}
@ -640,7 +640,7 @@ bge_miibus_writereg(device_t dev, int phy, int reg, int val)
}
if (i == BGE_TIMEOUT) {
if_printf(sc->bge_ifp, "PHY read timed out\n");
device_printf(sc->bge_dev, "PHY read timed out\n");
return (0);
}

View File

@ -198,7 +198,7 @@ cs_duplex_auto(struct cs_softc *sc)
RE_NEG_NOW | ALLOW_FDX | AUTO_NEG_ENABLE);
for (i=0; cs_readreg(sc, PP_AutoNegST) & AUTO_NEG_BUSY; i++) {
if (i > 40000) {
if_printf(sc->ifp,
device_printf(sc->dev,
"full/half duplex auto negotiation timeout\n");
error = ETIMEDOUT;
break;
@ -218,7 +218,7 @@ enable_tp(struct cs_softc *sc)
DELAY( 150000 );
if ((cs_readreg(sc, PP_LineST) & LINK_OK)==0) {
if_printf(sc->ifp, "failed to enable TP\n");
device_printf(sc->dev, "failed to enable TP\n");
return (EINVAL);
}
@ -279,7 +279,7 @@ enable_aui(struct cs_softc *sc)
(sc->line_ctl & ~AUTO_AUI_10BASET) | AUI_ONLY);
if (!send_test_pkt(sc)) {
if_printf(sc->ifp, "failed to enable AUI\n");
device_printf(sc->dev, "failed to enable AUI\n");
return (EINVAL);
}
return (0);
@ -297,7 +297,7 @@ enable_bnc(struct cs_softc *sc)
(sc->line_ctl & ~AUTO_AUI_10BASET) | AUI_ONLY);
if (!send_test_pkt(sc)) {
if_printf(sc->ifp, "failed to enable BNC\n");
device_printf(sc->dev, "failed to enable BNC\n");
return (EINVAL);
}
return (0);
@ -586,6 +586,8 @@ cs_attach(device_t dev)
struct cs_softc *sc = device_get_softc(dev);;
struct ifnet *ifp;
sc->dev = dev;
ifp = sc->ifp = if_alloc(IFT_ETHER);
if (ifp == NULL) {
device_printf(dev, "can not if_alloc()\n");
@ -630,7 +632,7 @@ cs_attach(device_t dev)
sc->buffer=malloc(ETHER_MAX_LEN-ETHER_CRC_LEN,M_DEVBUF,M_NOWAIT);
if (sc->buffer == NULL) {
if_printf(ifp, "Couldn't allocate memory for NIC\n");
device_printf(sc->dev, "Couldn't allocate memory for NIC\n");
return(0);
}
@ -665,7 +667,7 @@ cs_attach(device_t dev)
case A_CNF_MEDIA_10B_2: media = IFM_ETHER|IFM_10_2; break;
case A_CNF_MEDIA_AUI: media = IFM_ETHER|IFM_10_5; break;
default:
if_printf(ifp, "no media, assuming 10baseT\n");
device_printf(sc->dev, "no media, assuming 10baseT\n");
sc->adapter_cnf |= A_CNF_10B_T;
ifmedia_add(&sc->media, IFM_ETHER|IFM_10_T, 0, NULL);
if (sc->chip_type != CS8900) {
@ -799,13 +801,13 @@ cs_get_packet(struct cs_softc *sc)
length = cs_inw(sc, RX_FRAME_PORT);
#ifdef CS_DEBUG
if_printf(ifp, "rcvd: stat %x, len %d\n",
device_printf(sc->dev, "rcvd: stat %x, len %d\n",
status, length);
#endif
if (!(status & RX_OK)) {
#ifdef CS_DEBUG
if_printf(ifp, "bad pkt stat %x\n", status);
device_printf(sc->dev, "bad pkt stat %x\n", status);
#endif
ifp->if_ierrors++;
return (-1);
@ -864,13 +866,13 @@ csintr(void *arg)
int status;
#ifdef CS_DEBUG
if_printf(ifp, "Interrupt.\n");
device_printf(sc->dev, "Interrupt.\n");
#endif
while ((status=cs_inw(sc, ISQ_PORT))) {
#ifdef CS_DEBUG
if_printf(ifp, "from ISQ: %04x\n", status);
device_printf(sc->dev, "from ISQ: %04x\n", status);
#endif
switch (status & ISQ_EVENT_MASK) {
@ -1138,7 +1140,7 @@ cs_ioctl(register struct ifnet *ifp, u_long command, caddr_t data)
int s,error=0;
#ifdef CS_DEBUG
if_printf(ifp, "ioctl(%lx)\n", command);
if_printf(ifp, "%s command=%lx\n", __func__, command);
#endif
s=splimp();
@ -1266,7 +1268,7 @@ cs_mediaset(struct cs_softc *sc, int media)
~(SERIAL_RX_ON | SERIAL_TX_ON));
#ifdef CS_DEBUG
if_printf(sc->ifp, "cs_setmedia(%x)\n", media);
device_printf(sc->dev, "%s media=%x\n", __func__, media);
#endif
switch (IFM_SUBTYPE(media)) {

View File

@ -37,6 +37,7 @@
struct cs_softc {
/* Ethernet common code */
struct ifnet *ifp;
device_t dev;
/* Configuration words from EEPROM */
int auto_neg_cnf; /* AutoNegotitation configuration */

View File

@ -1395,7 +1395,7 @@ dc_setcfg(struct dc_softc *sc, int media)
}
if (i == DC_TIMEOUT)
if_printf(sc->dc_ifp,
device_printf(sc->dc_dev,
"failed to force tx and rx to idle state\n");
}
@ -1536,7 +1536,7 @@ dc_reset(struct dc_softc *sc)
}
if (i == DC_TIMEOUT)
if_printf(sc->dc_ifp, "reset never completed!\n");
device_printf(sc->dc_dev, "reset never completed!\n");
/* Wait a little while for the chip to get its brains in order. */
DELAY(1000);
@ -1815,6 +1815,7 @@ dc_attach(device_t dev)
u_int8_t *mac;
sc = device_get_softc(dev);
sc->dc_dev = dev;
mtx_init(&sc->dc_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK,
MTX_DEF);
@ -2968,13 +2969,13 @@ dc_tx_underrun(struct dc_softc *sc)
DELAY(10);
}
if (i == DC_TIMEOUT) {
if_printf(sc->dc_ifp,
device_printf(sc->dc_dev,
"failed to force tx to idle state\n");
dc_init_locked(sc);
}
}
if_printf(sc->dc_ifp, "TX underrun -- ");
device_printf(sc->dc_dev, "TX underrun -- ");
sc->dc_txthresh += DC_TXTHRESH_INC;
if (sc->dc_txthresh > DC_TXTHRESH_MAX) {
printf("using store and forward mode\n");
@ -3040,7 +3041,7 @@ dc_poll(struct ifnet *ifp, enum poll_cmd cmd, int count)
dc_tx_underrun(sc);
if (status & DC_ISR_BUS_ERR) {
if_printf(ifp, "dc_poll: bus error\n");
if_printf(ifp, "%s: bus error\n", __func__);
dc_reset(sc);
dc_init_locked(sc);
}
@ -3446,7 +3447,7 @@ dc_init_locked(struct dc_softc *sc)
/* Init circular RX list. */
if (dc_list_rx_init(sc) == ENOBUFS) {
if_printf(ifp,
device_printf(sc->dc_dev,
"initialization failed: no memory for rx buffers\n");
dc_stop(sc);
return;

View File

@ -717,6 +717,7 @@ struct dc_mii_frame {
struct dc_softc {
struct ifnet *dc_ifp; /* interface info */
device_t dc_dev; /* device info */
bus_space_handle_t dc_bhandle; /* bus space handle */
bus_space_tag_t dc_btag; /* bus space tag */
bus_dma_tag_t dc_ltag; /* tag for descriptor ring */

View File

@ -436,17 +436,16 @@ tulip_linkup(tulip_softc_t * const sc, tulip_media_t media)
static void
tulip_media_print(tulip_softc_t * const sc)
{
struct ifnet *ifp = sc->tulip_ifp;
TULIP_LOCK_ASSERT(sc);
if ((sc->tulip_flags & TULIP_LINKUP) == 0)
return;
if (sc->tulip_flags & TULIP_PRINTMEDIA) {
if_printf(ifp, "enabling %s port\n",
tulip_mediums[sc->tulip_media]);
device_printf(sc->tulip_dev, "enabling %s port\n",
tulip_mediums[sc->tulip_media]);
sc->tulip_flags &= ~(TULIP_PRINTMEDIA|TULIP_PRINTLINKUP);
} else if (sc->tulip_flags & TULIP_PRINTLINKUP) {
if_printf(ifp, "link up\n");
device_printf(sc->tulip_dev, "link up\n");
sc->tulip_flags &= ~TULIP_PRINTLINKUP;
}
}
@ -495,10 +494,9 @@ tulip_21140_gpr_media_sense(tulip_softc_t * const sc)
continue;
#if defined(TULIP_DEBUG)
if_printf(ifp, "gpr_media_sense: %s: 0x%02x & 0x%02x == 0x%02x\n",
tulip_mediums[media],
TULIP_CSR_READ(sc, csr_gp) & 0xFF,
mi->mi_actmask, mi->mi_actdata);
device_printf(sc->tulip_dev, "%s: %s: 0x%02x & 0x%02x == 0x%02x\n",
__func__, tulip_mediums[media], TULIP_CSR_READ(sc, csr_gp) & 0xFF,
mi->mi_actmask, mi->mi_actdata);
#endif
/*
* It does! If this is the first media we detected, then
@ -519,7 +517,6 @@ tulip_21140_gpr_media_sense(tulip_softc_t * const sc)
static tulip_link_status_t
tulip_media_link_monitor(tulip_softc_t * const sc)
{
struct ifnet *ifp = sc->tulip_ifp;
const tulip_media_info_t * const mi = sc->tulip_mediums[sc->tulip_media];
tulip_link_status_t linkup = TULIP_LINK_DOWN;
@ -603,7 +600,7 @@ tulip_media_link_monitor(tulip_softc_t * const sc)
linkup = TULIP_LINK_UP;
#if defined(TULIP_DEBUG)
if (sc->tulip_probe_timeout <= 0)
if_printf(ifp, "sia status = 0x%08x\n",
device_printf(sc->tulip_dev, "sia status = 0x%08x\n",
TULIP_CSR_READ(sc, csr_sia_status));
#endif
} else if (mi->mi_type == TULIP_MEDIAINFO_SYM) {
@ -619,7 +616,7 @@ tulip_media_link_monitor(tulip_softc_t * const sc)
return TULIP_LINK_UP;
sc->tulip_flags &= ~TULIP_LINKUP;
if_printf(ifp, "link down: cable problem?\n");
device_printf(sc->tulip_dev, "link down: cable problem?\n");
}
#if defined(TULIP_DEBUG)
sc->tulip_dbg.dbg_link_downed++;
@ -630,7 +627,6 @@ tulip_media_link_monitor(tulip_softc_t * const sc)
static void
tulip_media_poll(tulip_softc_t * const sc, tulip_mediapoll_event_t event)
{
struct ifnet *ifp = sc->tulip_ifp;
TULIP_LOCK_ASSERT(sc);
#if defined(TULIP_DEBUG)
@ -751,7 +747,7 @@ tulip_media_poll(tulip_softc_t * const sc, tulip_mediapoll_event_t event)
if (sc->tulip_probe_timeout > 0) {
tulip_media_t new_probe_media = tulip_21140_gpr_media_sense(sc);
#if defined(TULIP_DEBUG)
if_printf(ifp, "media_poll: gpr sensing = %s\n",
device_printf(sc->tulip_dev, "%s: gpr sensing = %s\n", __func__,
tulip_mediums[new_probe_media]);
#endif
if (new_probe_media != TULIP_MEDIA_UNKNOWN) {
@ -838,7 +834,7 @@ tulip_media_poll(tulip_softc_t * const sc, tulip_mediapoll_event_t event)
if (/* event == TULIP_MEDIAPOLL_TXPROBE_FAILED || */ sc->tulip_probe_timeout <= 0) {
#if defined(TULIP_DEBUG)
if (sc->tulip_probe_media == TULIP_MEDIA_UNKNOWN) {
if_printf(ifp, "poll media unknown!\n");
device_printf(sc->tulip_dev, "poll media unknown!\n");
sc->tulip_probe_media = TULIP_MEDIA_MAX;
}
#endif
@ -850,7 +846,8 @@ tulip_media_poll(tulip_softc_t * const sc, tulip_mediapoll_event_t event)
sc->tulip_probe_media -= 1;
if (sc->tulip_probe_media == TULIP_MEDIA_UNKNOWN) {
if (++sc->tulip_probe_passes == 3) {
if_printf(ifp, "autosense failed: cable problem?\n");
device_printf(sc->tulip_dev,
"autosense failed: cable problem?\n");
if ((sc->tulip_ifp->if_flags & IFF_UP) == 0) {
sc->tulip_ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
sc->tulip_probe_state = TULIP_PROBE_INACTIVE;
@ -866,7 +863,7 @@ tulip_media_poll(tulip_softc_t * const sc, tulip_mediapoll_event_t event)
|| TULIP_IS_MEDIA_FD(sc->tulip_probe_media));
#if defined(TULIP_DEBUG)
if_printf(ifp, "%s: probing %s\n",
device_printf(sc->tulip_dev, "%s: probing %s\n",
event == TULIP_MEDIAPOLL_TXPROBE_FAILED ? "txprobe failed" : "timeout",
tulip_mediums[sc->tulip_probe_media]);
#endif
@ -1194,7 +1191,7 @@ tulip_21041_media_poll(tulip_softc_t * const sc,
sc->tulip_flags &= ~TULIP_WANTRXACT;
sc->tulip_probe_timeout = TULIP_21041_PROBE_AUIBNC_TIMEOUT;
} else {
if_printf(sc->tulip_ifp,
device_printf(sc->tulip_dev,
"autosense failed: cable problem?\n");
if ((sc->tulip_ifp->if_flags & IFF_UP) == 0) {
sc->tulip_ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
@ -1512,7 +1509,7 @@ tulip_2114x_media_preset(tulip_softc_t * const sc)
}
#if defined(TULIP_DEBUG)
} else {
if_printf(sc->tulip_ifp, "preset: bad media %d!\n", media);
device_printf(sc->tulip_dev, "preset: bad media %d!\n", media);
}
#endif
}
@ -1565,7 +1562,7 @@ tulip_null_media_poll(tulip_softc_t * const sc, tulip_mediapoll_event_t event)
sc->tulip_dbg.dbg_events[event]++;
#endif
#if defined(DIAGNOSTIC)
if_printf(sc->tulip_ifp, "botch(media_poll) at line %d\n", __LINE__);
device_printf(sc->tulip_dev, "botch(media_poll) at line %d\n", __LINE__);
#endif
}
@ -2300,7 +2297,7 @@ tulip_identify_asante_nic(tulip_softc_t * const sc)
mi->mi_phyaddr = tulip_mii_get_phyaddr(sc, 0);
}
if (mi->mi_phyaddr == TULIP_MII_NOPHY) {
if_printf(sc->tulip_ifp, "can't find phy 0\n");
device_printf(sc->tulip_dev, "can't find phy 0\n");
return;
}
@ -2553,7 +2550,7 @@ tulip_srom_decode(tulip_softc_t * const sc)
}
if (mi->mi_phyaddr == TULIP_MII_NOPHY) {
#if defined(TULIP_DEBUG)
if_printf(sc->tulip_ifp, "can't find phy %d\n",
device_printf(sc->tulip_dev, "can't find phy %d\n",
phyno);
#endif
break;
@ -2654,7 +2651,7 @@ tulip_srom_decode(tulip_softc_t * const sc)
}
if (mi->mi_phyaddr == TULIP_MII_NOPHY) {
#if defined(TULIP_DEBUG)
if_printf(sc->tulip_ifp, "can't find phy %d\n",
device_printf(sc->tulip_dev, "can't find phy %d\n",
phyno);
#endif
break;
@ -3239,7 +3236,7 @@ tulip_reset(tulip_softc_t * const sc)
(*sc->tulip_boardsw->bd_media_select)(sc);
#if defined(TULIP_DEBUG)
if ((sc->tulip_flags & TULIP_NEEDRESET) == TULIP_NEEDRESET)
if_printf(sc->tulip_ifp,
device_printf(sc->tulip_dev,
"tulip_reset: additional reset needed?!?\n");
#endif
if (bootverbose)
@ -3466,7 +3463,7 @@ tulip_rx_intr(tulip_softc_t * const sc)
}
#if defined(TULIP_VERBOSE)
if (error != NULL && (sc->tulip_flags & TULIP_NOMESSAGES) == 0) {
if_printf(sc->tulip_ifp, "receive: %6D: %s\n",
device_printf(sc->tulip_dev, "receive: %6D: %s\n",
mtod(ms, u_char *) + 6, ":",
error);
sc->tulip_flags |= TULIP_NOMESSAGES;
@ -3560,7 +3557,7 @@ tulip_rx_intr(tulip_softc_t * const sc)
error = bus_dmamap_load_mbuf(ri->ri_data_tag, *nextout->di_map, ms,
tulip_dma_map_rxbuf, nextout->di_desc, BUS_DMA_NOWAIT);
if (error) {
if_printf(sc->tulip_ifp,
device_printf(sc->tulip_dev,
"unable to load rx map, error = %d\n", error);
panic("tulip_rx_intr"); /* XXX */
}
@ -3649,7 +3646,7 @@ tulip_tx_intr(tulip_softc_t * const sc)
m_freem(m);
#if defined(TULIP_DEBUG)
} else {
if_printf(sc->tulip_ifp,
device_printf(sc->tulip_dev,
"tx_intr: failed to dequeue mbuf?!?\n");
#endif
}
@ -3744,7 +3741,7 @@ tulip_print_abnormal_interrupt(tulip_softc_t * const sc, u_int32_t csr)
TULIP_LOCK_ASSERT(sc);
csr &= (1 << (sizeof(tulip_status_bits)/sizeof(tulip_status_bits[0]))) - 1;
if_printf(sc->tulip_ifp, "abnormal interrupt:");
device_printf(sc->tulip_dev, "abnormal interrupt:");
for (sep = " ", mask = 1; mask <= csr; mask <<= 1, msgp++) {
if ((csr & mask) && *msgp != NULL) {
printf("%s%s", sep, *msgp);
@ -3779,7 +3776,7 @@ tulip_intr_handler(tulip_softc_t * const sc)
if (sc->tulip_flags & TULIP_NOMESSAGES) {
sc->tulip_flags |= TULIP_SYSTEMERROR;
} else {
if_printf(sc->tulip_ifp, "system error: %s\n",
device_printf(sc->tulip_dev, "system error: %s\n",
tulip_system_errors[sc->tulip_last_system_error]);
}
sc->tulip_flags |= TULIP_NEEDRESET;
@ -3904,7 +3901,7 @@ tulip_txput(tulip_softc_t * const sc, struct mbuf *m)
TULIP_LOCK_ASSERT(sc);
#if defined(TULIP_DEBUG)
if ((sc->tulip_cmdmode & TULIP_CMD_TXRUN) == 0) {
if_printf(sc->tulip_ifp, "txput%s: tx not running\n",
device_printf(sc->tulip_dev, "txput%s: tx not running\n",
(sc->tulip_flags & TULIP_TXPROBE_ACTIVE) ? "(probe)" : "");
sc->tulip_flags |= TULIP_WANTTXSTART;
sc->tulip_dbg.dbg_txput_finishes[0]++;
@ -3983,7 +3980,7 @@ tulip_txput(tulip_softc_t * const sc, struct mbuf *m)
segs, &nsegs, BUS_DMA_NOWAIT);
}
if (error != 0) {
if_printf(sc->tulip_ifp,
device_printf(sc->tulip_dev,
"unable to load tx map, error = %d\n", error);
#if defined(TULIP_DEBUG)
sc->tulip_dbg.dbg_txput_finishes[3]++;
@ -4162,7 +4159,7 @@ tulip_txput_setup(tulip_softc_t * const sc)
#if defined(TULIP_DEBUG)
if ((sc->tulip_cmdmode & TULIP_CMD_TXRUN) == 0) {
if_printf(sc->tulip_ifp, "txput_setup: tx not running\n");
device_printf(sc->tulip_dev, "txput_setup: tx not running\n");
sc->tulip_flags |= TULIP_WANTTXSTART;
return;
}
@ -4427,7 +4424,7 @@ tulip_attach(tulip_softc_t * const sc)
ifp->if_snd.ifq_drv_maxlen = ifqmaxlen;
IFQ_SET_READY(&ifp->if_snd);
if_printf(ifp, "%s%s pass %d.%d%s\n",
device_printf(sc->tulip_dev, "%s%s pass %d.%d%s\n",
sc->tulip_boardid,
tulip_chipdescs[sc->tulip_chipid],
(sc->tulip_revinfo & 0xF0) >> 4,
@ -4789,6 +4786,7 @@ tulip_pci_attach(device_t dev)
}
sc = device_get_softc(dev);
sc->tulip_dev = dev;
sc->tulip_pci_busno = pci_get_bus(dev);
sc->tulip_pci_devno = pci_get_slot(dev);
sc->tulip_chipid = chipid;

View File

@ -507,6 +507,7 @@ struct tulip_perfstat {
* Per-driver-instance state.
*/
struct tulip_softc {
device_t tulip_dev;
struct ifmedia tulip_ifmedia;
int tulip_unit;
struct ifnet *tulip_ifp;

View File

@ -150,8 +150,8 @@ adp_busreset(void *v)
dummy = bus_space_read_4(sc->en_memt, sc->en_base, ADP_PCIREG);
if ((dummy & (ADP_PCIREG_SWAP_WORD | ADP_PCIREG_SWAP_DMA)) !=
ADP_PCIREG_SWAP_DMA)
if_printf(sc->ifp, "adp_busreset: Adaptec ATM did "
"NOT reset!\n");
device_printf(sc->dev, "%s: Adaptec ATM did NOT reset!\n",
__func__);
}
/***********************************************************************/
@ -197,6 +197,7 @@ en_pci_attach(device_t dev)
sc = device_get_softc(dev);
scp = (struct en_pci_softc *)sc;
sc->dev = dev;
sc->ifp = if_alloc(IFT_ATM);
if (sc->ifp == NULL) {
device_printf(dev, "can not if_alloc()\n");
@ -225,7 +226,6 @@ en_pci_attach(device_t dev)
goto fail;
}
sc->dev = dev;
sc->en_memt = rman_get_bustag(scp->res);
sc->en_base = rman_get_bushandle(scp->res);
@ -308,7 +308,7 @@ en_pci_detach(device_t dev)
* Stop DMA and drop transmit queue.
*/
if ((sc->ifp->if_drv_flags & IFF_DRV_RUNNING)) {
if_printf(sc->ifp, "still running\n");
device_printf(sc->dev, "still running\n");
sc->ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
}

View File

@ -90,7 +90,7 @@ __FBSDID("$FreeBSD$");
*/
#define DBG(SC, FL, PRINT) do { \
if ((SC)->debug & DBG_##FL) { \
if_printf((SC)->ifp, "%s: "#FL": ", __func__); \
device_printf((SC)->dev, "%s: "#FL": ", __func__); \
printf PRINT; \
printf("\n"); \
} \
@ -395,7 +395,7 @@ en_dump_packet(struct en_softc *sc, struct mbuf *m)
int len;
u_char *ptr;
if_printf(sc->ifp, "packet len=%d", plen);
device_printf(sc->dev, "packet len=%d", plen);
while (m != NULL) {
totlen += m->m_len;
ptr = mtod(m, u_char *);
@ -445,7 +445,7 @@ en_map_ctor(void *mem, int size, void *arg, int flags)
err = bus_dmamap_create(sc->txtag, 0, &map->map);
if (err != 0) {
if_printf(sc->ifp, "cannot create DMA map %d\n", err);
device_printf(sc->dev, "cannot create DMA map %d\n", err);
return (err);
}
map->flags = ENMAP_ALLOC;
@ -754,7 +754,7 @@ en_txdma(struct en_softc *sc, struct en_txslot *slot)
lastm->m_next = NULL;
if (error != 0) {
if_printf(sc->ifp, "loading TX map failed %d\n",
device_printf(sc->dev, "loading TX map failed %d\n",
error);
goto dequeue_drop;
}
@ -1349,7 +1349,7 @@ en_reset_ul(struct en_softc *sc)
struct en_rxslot *rx;
int lcv;
if_printf(sc->ifp, "reset\n");
device_printf(sc->dev, "reset\n");
sc->ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
if (sc->en_busreset)
@ -2252,13 +2252,13 @@ en_service(struct en_softc *sc)
if (MID_RBD_CNT(rbd) * MID_ATMDATASZ <
MID_PDU_LEN(pdu)) {
if_printf(sc->ifp, "invalid AAL5 length\n");
device_printf(sc->dev, "invalid AAL5 length\n");
rx.post_skip = MID_RBD_CNT(rbd) * MID_ATMDATASZ;
mlen = 0;
sc->ifp->if_ierrors++;
} else if (rbd & MID_RBD_CRCERR) {
if_printf(sc->ifp, "CRC error\n");
device_printf(sc->dev, "CRC error\n");
rx.post_skip = MID_RBD_CNT(rbd) * MID_ATMDATASZ;
mlen = 0;
sc->ifp->if_ierrors++;
@ -2336,7 +2336,7 @@ en_service(struct en_softc *sc)
en_rxdma_load, &rx, BUS_DMA_NOWAIT);
if (error != 0) {
if_printf(sc->ifp, "loading RX map failed "
device_printf(sc->dev, "loading RX map failed "
"%d\n", error);
uma_zfree(sc->map_zone, map);
m_freem(m);
@ -2432,7 +2432,7 @@ en_intr(void *arg)
* unexpected errors that need a reset
*/
if ((reg & (MID_INT_IDENT | MID_INT_LERR | MID_INT_DMA_ERR)) != 0) {
if_printf(sc->ifp, "unexpected interrupt=0x%b, "
device_printf(sc->dev, "unexpected interrupt=0x%b, "
"resetting\n", reg, MID_INTBITS);
#ifdef EN_DEBUG
kdb_enter("en: unexpected error");
@ -2855,7 +2855,7 @@ en_attach(struct en_softc *sc)
reg = en_read(sc, MID_RESID);
if_printf(sc->ifp, "ATM midway v%d, board IDs %d.%d, %s%s%s, "
device_printf(sc->dev, "ATM midway v%d, board IDs %d.%d, %s%s%s, "
"%ldKB on-board RAM\n", MID_VER(reg), MID_MID(reg), MID_DID(reg),
(MID_IS_SABRE(reg)) ? "sabre controller, " : "",
(MID_IS_SUNI(reg)) ? "SUNI" : "Utopia",
@ -2881,15 +2881,15 @@ en_attach(struct en_softc *sc)
if (sc->is_adaptec) {
IFP2IFATM(sc->ifp)->mib.device = ATM_DEVICE_ADP155P;
if (sc->bestburstlen == 64 && sc->alburst == 0)
if_printf(sc->ifp,
device_printf(sc->dev,
"passed 64 byte DMA test\n");
else
if_printf(sc->ifp, "FAILED DMA TEST: "
device_printf(sc->dev, "FAILED DMA TEST: "
"burst=%d, alburst=%d\n", sc->bestburstlen,
sc->alburst);
} else {
IFP2IFATM(sc->ifp)->mib.device = ATM_DEVICE_ENI155P;
if_printf(sc->ifp, "maximum DMA burst length = %d "
device_printf(sc->dev, "maximum DMA burst length = %d "
"bytes%s\n", sc->bestburstlen, sc->alburst ?
sc->noalbursts ? " (no large bursts)" : " (must align)" :
"");
@ -2963,7 +2963,7 @@ en_attach(struct en_softc *sc)
ptr = roundup(ptr, EN_TXSZ * 1024); /* align */
sz = sz - (ptr - sav);
if (EN_TXSZ*1024 * EN_NTX > sz) {
if_printf(sc->ifp, "EN_NTX/EN_TXSZ too big\n");
device_printf(sc->dev, "EN_NTX/EN_TXSZ too big\n");
goto fail;
}
for (lcv = 0 ;lcv < EN_NTX ;lcv++) {
@ -2982,7 +2982,7 @@ en_attach(struct en_softc *sc)
sz = sz - (ptr - sav);
sc->en_nrx = sz / (EN_RXSZ * 1024);
if (sc->en_nrx <= 0) {
if_printf(sc->ifp, "EN_NTX/EN_TXSZ/EN_RXSZ too big\n");
device_printf(sc->dev, "EN_NTX/EN_TXSZ/EN_RXSZ too big\n");
goto fail;
}
@ -3013,9 +3013,9 @@ en_attach(struct en_softc *sc)
sc->rxslot[lcv].mode));
}
if_printf(sc->ifp, "%d %dKB receive buffers, %d %dKB transmit "
device_printf(sc->dev, "%d %dKB receive buffers, %d %dKB transmit "
"buffers\n", sc->en_nrx, EN_RXSZ, EN_NTX, EN_TXSZ);
if_printf(sc->ifp, "end station identifier (mac address) "
device_printf(sc->dev, "end station identifier (mac address) "
"%6D\n", IFP2IFATM(sc->ifp)->mib.esi, ":");
/*
@ -3305,7 +3305,7 @@ en_dump(int unit, int level)
if (unit != -1 && unit != lcv)
continue;
if_printf(sc->ifp, "dumping device at level 0x%b\n",
device_printf(sc->dev, "dumping device at level 0x%b\n",
level, END_BITS);
if (sc->dtq_us == 0) {

View File

@ -230,7 +230,7 @@ lge_eeprom_getword(sc, addr, dest)
break;
if (i == LGE_TIMEOUT) {
if_printf(sc->lge_ifp, "EEPROM read timed out\n");
device_printf(sc->lge_dev, "EEPROM read timed out\n");
return;
}
@ -295,7 +295,7 @@ lge_miibus_readreg(dev, phy, reg)
break;
if (i == LGE_TIMEOUT) {
if_printf(sc->lge_ifp, "PHY read timed out\n");
device_printf(sc->lge_dev, "PHY read timed out\n");
return(0);
}
@ -320,7 +320,7 @@ lge_miibus_writereg(dev, phy, reg, data)
break;
if (i == LGE_TIMEOUT) {
if_printf(sc->lge_ifp, "PHY write timed out\n");
device_printf(sc->lge_dev, "PHY write timed out\n");
return(0);
}
@ -426,7 +426,7 @@ lge_reset(sc)
}
if (i == LGE_TIMEOUT)
if_printf(sc->lge_ifp, "reset never completed\n");
device_printf(sc->lge_dev, "reset never completed\n");
/* Wait a little while for the chip to get its brains in order. */
DELAY(1000);
@ -472,6 +472,8 @@ lge_attach(dev)
int error = 0, rid;
sc = device_get_softc(dev);
sc->lge_dev = dev;
mtx_init(&sc->lge_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK,
MTX_DEF);
callout_init_mtx(&sc->lge_stat_callout, &sc->lge_mtx, 0);
@ -698,7 +700,7 @@ lge_newbuf(sc, c, m)
if (m == NULL) {
MGETHDR(m_new, M_DONTWAIT, MT_DATA);
if (m_new == NULL) {
if_printf(sc->lge_ifp, "no memory for rx list "
device_printf(sc->lge_dev, "no memory for rx list "
"-- packet dropped!\n");
return(ENOBUFS);
}
@ -707,7 +709,7 @@ lge_newbuf(sc, c, m)
buf = lge_jalloc(sc);
if (buf == NULL) {
#ifdef LGE_VERBOSE
if_printf(sc->lge_ifp, "jumbo allocation failed "
device_printf(sc->lge_dev, "jumbo allocation failed "
"-- packet dropped!\n");
#endif
m_freem(m_new);
@ -768,7 +770,7 @@ lge_alloc_jumbo_mem(sc)
M_NOWAIT, 0, 0xffffffff, PAGE_SIZE, 0);
if (sc->lge_cdata.lge_jumbo_buf == NULL) {
if_printf(sc->lge_ifp, "no memory for jumbo buffers!\n");
device_printf(sc->lge_dev, "no memory for jumbo buffers!\n");
return(ENOBUFS);
}
@ -786,7 +788,7 @@ lge_alloc_jumbo_mem(sc)
entry = malloc(sizeof(struct lge_jpool_entry),
M_DEVBUF, M_NOWAIT);
if (entry == NULL) {
if_printf(sc->lge_ifp, "no memory for jumbo "
device_printf(sc->lge_dev, "no memory for jumbo "
"buffer queue!\n");
return(ENOBUFS);
}
@ -829,7 +831,7 @@ lge_jalloc(sc)
if (entry == NULL) {
#ifdef LGE_VERBOSE
if_printf(sc->lge_ifp, "no free jumbo buffers\n");
device_printf(sc->lge_dev, "no free jumbo buffers\n");
#endif
return(NULL);
}
@ -925,7 +927,7 @@ lge_rxeof(sc, cnt)
ifp, NULL);
lge_newbuf(sc, &LGE_RXTAIL(sc), m);
if (m0 == NULL) {
if_printf(ifp, "no receive buffers "
device_printf(sc->lge_dev, "no receive buffers "
"available -- packet dropped!\n");
ifp->if_ierrors++;
continue;
@ -1048,7 +1050,7 @@ lge_tick(xsc)
if (bootverbose &&
(IFM_SUBTYPE(mii->mii_media_active) == IFM_1000_SX||
IFM_SUBTYPE(mii->mii_media_active) == IFM_1000_T))
if_printf(ifp, "gigabit link up\n");
device_printf(sc->lge_dev, "gigabit link up\n");
if (ifp->if_snd.ifq_head != NULL)
lge_start_locked(ifp);
}
@ -1267,7 +1269,7 @@ lge_init_locked(sc)
/* Init circular RX list. */
if (lge_list_rx_init(sc) == ENOBUFS) {
if_printf(ifp, "initialization failed: no "
device_printf(sc->lge_dev, "initialization failed: no "
"memory for rx buffers\n");
lge_stop(sc);
return;

View File

@ -523,6 +523,7 @@ struct lge_ring_data {
struct lge_softc {
struct ifnet *lge_ifp;
device_t lge_dev;
bus_space_handle_t lge_bhandle;
bus_space_tag_t lge_btag;
struct resource *lge_res;

View File

@ -414,7 +414,8 @@ my_autoneg_mii(struct my_softc * sc, int flag, int verbose)
phy_sts = my_phy_readreg(sc, PHY_BMSR);
if (!(phy_sts & PHY_BMSR_CANAUTONEG)) {
if (verbose)
if_printf(ifp, "autonegotiation not supported\n");
device_printf(sc->my_dev,
"autonegotiation not supported\n");
ifm->ifm_media = IFM_ETHER | IFM_10_T | IFM_HDX;
return;
}
@ -452,17 +453,17 @@ my_autoneg_mii(struct my_softc * sc, int flag, int verbose)
sc->my_autoneg = 0;
break;
default:
if_printf(ifp, "invalid autoneg flag: %d\n", flag);
device_printf(sc->my_dev, "invalid autoneg flag: %d\n", flag);
return;
}
if (my_phy_readreg(sc, PHY_BMSR) & PHY_BMSR_AUTONEGCOMP) {
if (verbose)
if_printf(ifp, "autoneg complete, ");
device_printf(sc->my_dev, "autoneg complete, ");
phy_sts = my_phy_readreg(sc, PHY_BMSR);
} else {
if (verbose)
if_printf(ifp, "autoneg not complete, ");
device_printf(sc->my_dev, "autoneg not complete, ");
}
media = my_phy_readreg(sc, PHY_BMCR);
@ -470,7 +471,7 @@ my_autoneg_mii(struct my_softc * sc, int flag, int verbose)
/* Link is good. Report modes and set duplex mode. */
if (my_phy_readreg(sc, PHY_BMSR) & PHY_BMSR_LINKSTAT) {
if (verbose)
if_printf(ifp, "link status good. ");
device_printf(sc->my_dev, "link status good. ");
advert = my_phy_readreg(sc, PHY_ANAR);
ability = my_phy_readreg(sc, PHY_LPAR);
if ((sc->my_pinfo->my_vid == MarvellPHYID0) ||
@ -540,7 +541,7 @@ my_autoneg_mii(struct my_softc * sc, int flag, int verbose)
my_setcfg(sc, media);
} else {
if (verbose)
if_printf(ifp, "no carrier\n");
device_printf(sc->my_dev, "no carrier\n");
}
my_init_locked(sc);
@ -565,21 +566,23 @@ my_getmode_mii(struct my_softc * sc)
ifp = sc->my_ifp;
bmsr = my_phy_readreg(sc, PHY_BMSR);
if (bootverbose)
if_printf(ifp, "PHY status word: %x\n", bmsr);
device_printf(sc->my_dev, "PHY status word: %x\n", bmsr);
/* fallback */
sc->ifmedia.ifm_media = IFM_ETHER | IFM_10_T | IFM_HDX;
if (bmsr & PHY_BMSR_10BTHALF) {
if (bootverbose)
if_printf(ifp, "10Mbps half-duplex mode supported\n");
device_printf(sc->my_dev,
"10Mbps half-duplex mode supported\n");
ifmedia_add(&sc->ifmedia, IFM_ETHER | IFM_10_T | IFM_HDX,
0, NULL);
ifmedia_add(&sc->ifmedia, IFM_ETHER | IFM_10_T, 0, NULL);
}
if (bmsr & PHY_BMSR_10BTFULL) {
if (bootverbose)
if_printf(ifp, "10Mbps full-duplex mode supported\n");
device_printf(sc->my_dev,
"10Mbps full-duplex mode supported\n");
ifmedia_add(&sc->ifmedia, IFM_ETHER | IFM_10_T | IFM_FDX,
0, NULL);
@ -587,7 +590,8 @@ my_getmode_mii(struct my_softc * sc)
}
if (bmsr & PHY_BMSR_100BTXHALF) {
if (bootverbose)
if_printf(ifp, "100Mbps half-duplex mode supported\n");
device_printf(sc->my_dev,
"100Mbps half-duplex mode supported\n");
ifp->if_baudrate = 100000000;
ifmedia_add(&sc->ifmedia, IFM_ETHER | IFM_100_TX, 0, NULL);
ifmedia_add(&sc->ifmedia, IFM_ETHER | IFM_100_TX | IFM_HDX,
@ -596,7 +600,8 @@ my_getmode_mii(struct my_softc * sc)
}
if (bmsr & PHY_BMSR_100BTXFULL) {
if (bootverbose)
if_printf(ifp, "100Mbps full-duplex mode supported\n");
device_printf(sc->my_dev,
"100Mbps full-duplex mode supported\n");
ifp->if_baudrate = 100000000;
ifmedia_add(&sc->ifmedia, IFM_ETHER | IFM_100_TX | IFM_FDX,
0, NULL);
@ -605,13 +610,14 @@ my_getmode_mii(struct my_softc * sc)
/* Some also support 100BaseT4. */
if (bmsr & PHY_BMSR_100BT4) {
if (bootverbose)
if_printf(ifp, "100baseT4 mode supported\n");
device_printf(sc->my_dev, "100baseT4 mode supported\n");
ifp->if_baudrate = 100000000;
ifmedia_add(&sc->ifmedia, IFM_ETHER | IFM_100_T4, 0, NULL);
sc->ifmedia.ifm_media = IFM_ETHER | IFM_100_T4;
#ifdef FORCE_AUTONEG_TFOUR
if (bootverbose)
if_printf(ifp, "forcing on autoneg support for BT4\n");
device_printf(sc->my_dev,
"forcing on autoneg support for BT4\n");
ifmedia_add(&sc->ifmedia, IFM_ETHER | IFM_AUTO, 0 NULL):
sc->ifmedia.ifm_media = IFM_ETHER | IFM_AUTO;
#endif
@ -619,14 +625,16 @@ my_getmode_mii(struct my_softc * sc)
#if 0 /* this version did not support 1000M, */
if (sc->my_pinfo->my_vid == MarvellPHYID0) {
if (bootverbose)
if_printf(ifp, "1000Mbps half-duplex mode supported\n");
device_printf(sc->my_dev,
"1000Mbps half-duplex mode supported\n");
ifp->if_baudrate = 1000000000;
ifmedia_add(&sc->ifmedia, IFM_ETHER | IFM_1000_T, 0, NULL);
ifmedia_add(&sc->ifmedia, IFM_ETHER | IFM_1000_T | IFM_HDX,
0, NULL);
if (bootverbose)
if_printf(ifp, "1000Mbps full-duplex mode supported\n");
device_printf(sc->my_dev,
"1000Mbps full-duplex mode supported\n");
ifp->if_baudrate = 1000000000;
ifmedia_add(&sc->ifmedia, IFM_ETHER | IFM_1000_T | IFM_FDX,
0, NULL);
@ -635,7 +643,7 @@ my_getmode_mii(struct my_softc * sc)
#endif
if (bmsr & PHY_BMSR_CANAUTONEG) {
if (bootverbose)
if_printf(ifp, "autoneg supported\n");
device_printf(sc->my_dev, "autoneg supported\n");
ifmedia_add(&sc->ifmedia, IFM_ETHER | IFM_AUTO, 0, NULL);
sc->ifmedia.ifm_media = IFM_ETHER | IFM_AUTO;
}
@ -657,13 +665,13 @@ my_setmode_mii(struct my_softc * sc, int media)
* If an autoneg session is in progress, stop it.
*/
if (sc->my_autoneg) {
if_printf(ifp, "canceling autoneg session\n");
device_printf(sc->my_dev, "canceling autoneg session\n");
ifp->if_timer = sc->my_autoneg = sc->my_want_auto = 0;
bmcr = my_phy_readreg(sc, PHY_BMCR);
bmcr &= ~PHY_BMCR_AUTONEGENBL;
my_phy_writereg(sc, PHY_BMCR, bmcr);
}
if_printf(ifp, "selecting MII, ");
device_printf(sc->my_dev, "selecting MII, ");
bmcr = my_phy_readreg(sc, PHY_BMCR);
bmcr &= ~(PHY_BMCR_AUTONEGENBL | PHY_BMCR_SPEEDSEL | PHY_BMCR_1000 |
PHY_BMCR_DUPLEX | PHY_BMCR_LOOPBK);
@ -722,7 +730,7 @@ my_setcfg(struct my_softc * sc, int bmcr)
break;
}
if (i == MY_TIMEOUT)
if_printf(sc->my_ifp,
device_printf(sc->my_dev,
"failed to force tx and rx to idle \n");
}
MY_CLRBIT(sc, MY_TCRRCR, MY_PS1000);
@ -753,7 +761,7 @@ my_reset(struct my_softc * sc)
break;
}
if (i == MY_TIMEOUT)
if_printf(sc->my_ifp, "reset never completed!\n");
device_printf(sc->my_dev, "reset never completed!\n");
/* Wait a little while for the chip to get its brains in order. */
DELAY(1000);
@ -802,6 +810,7 @@ my_attach(device_t dev)
int rid, error = 0;
sc = device_get_softc(dev);
sc->my_dev = dev;
mtx_init(&sc->my_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK,
MTX_DEF);
@ -1070,13 +1079,13 @@ my_newbuf(struct my_softc * sc, struct my_chain_onefrag * c)
MY_LOCK_ASSERT(sc);
MGETHDR(m_new, M_DONTWAIT, MT_DATA);
if (m_new == NULL) {
if_printf(sc->my_ifp,
device_printf(sc->my_dev,
"no memory for rx list -- packet dropped!\n");
return (ENOBUFS);
}
MCLGET(m_new, M_DONTWAIT);
if (!(m_new->m_flags & M_EXT)) {
if_printf(sc->my_ifp,
device_printf(sc->my_dev,
"no memory for rx list -- packet dropped!\n");
m_freem(m_new);
return (ENOBUFS);
@ -1337,14 +1346,14 @@ my_encap(struct my_softc * sc, struct my_chain * c, struct mbuf * m_head)
m = m_head;
MGETHDR(m_new, M_DONTWAIT, MT_DATA);
if (m_new == NULL) {
if_printf(sc->my_ifp, "no memory for tx list");
device_printf(sc->my_dev, "no memory for tx list");
return (1);
}
if (m_head->m_pkthdr.len > MHLEN) {
MCLGET(m_new, M_DONTWAIT);
if (!(m_new->m_flags & M_EXT)) {
m_freem(m_new);
if_printf(sc->my_ifp, "no memory for tx list");
device_printf(sc->my_dev, "no memory for tx list");
return (1);
}
}
@ -1502,7 +1511,7 @@ my_init_locked(struct my_softc *sc)
my_setcfg(sc, phy_bmcr);
/* Init circular RX list. */
if (my_list_rx_init(sc) == ENOBUFS) {
if_printf(ifp, "init failed: no memory for rx buffers\n");
device_printf(sc->my_dev, "init failed: no memory for rx buffers\n");
my_stop(sc);
return;
}

View File

@ -351,6 +351,7 @@ struct my_type {
struct my_softc {
struct ifnet *my_ifp;
device_t my_dev;
struct ifmedia ifmedia; /* media info */
bus_space_handle_t my_bhandle;
bus_space_tag_t my_btag;

View File

@ -741,7 +741,7 @@ nge_reset(sc)
}
if (i == NGE_TIMEOUT)
if_printf(sc->nge_ifp, "reset never completed\n");
device_printf(sc->nge_dev, "reset never completed\n");
/* Wait a little while for the chip to get its brains in order. */
DELAY(1000);
@ -794,6 +794,7 @@ nge_attach(dev)
int error = 0, rid;
sc = device_get_softc(dev);
sc->nge_dev = dev;
NGE_LOCK_INIT(sc, device_get_nameunit(dev));
callout_init_mtx(&sc->nge_stat_ch, &sc->nge_mtx, 0);
@ -1321,7 +1322,7 @@ nge_tick(xsc)
if (CSR_READ_4(sc, NGE_TBI_BMSR)
& NGE_TBIBMSR_ANEG_DONE) {
if (bootverbose)
if_printf(sc->nge_ifp,
device_printf(sc->nge_dev,
"gigabit link up\n");
nge_miibus_statchg(sc->nge_miibus);
sc->nge_link++;
@ -1339,7 +1340,7 @@ nge_tick(xsc)
sc->nge_link++;
if (IFM_SUBTYPE(mii->mii_media_active)
== IFM_1000_T && bootverbose)
if_printf(sc->nge_ifp,
device_printf(sc->nge_dev,
"gigabit link up\n");
if (ifp->if_snd.ifq_head != NULL)
nge_start_locked(ifp);
@ -1678,7 +1679,7 @@ nge_init_locked(sc)
/* Init circular RX list. */
if (nge_list_rx_init(sc) == ENOBUFS) {
if_printf(sc->nge_ifp, "initialization failed: no "
device_printf(sc->nge_dev, "initialization failed: no "
"memory for rx buffers\n");
nge_stop(sc);
return;
@ -2079,7 +2080,7 @@ nge_watchdog(ifp)
sc = ifp->if_softc;
ifp->if_oerrors++;
if_printf(sc->nge_ifp, "watchdog timeout\n");
if_printf(ifp, "watchdog timeout\n");
NGE_LOCK(sc);
nge_stop(sc);

View File

@ -649,6 +649,7 @@ struct nge_ring_data {
struct nge_softc {
struct ifnet *nge_ifp;
device_t nge_dev;
bus_space_handle_t nge_bhandle;
bus_space_tag_t nge_btag;
struct resource *nge_res;

View File

@ -451,7 +451,7 @@ re_gmii_readreg(dev, phy, reg)
}
if (i == RL_TIMEOUT) {
if_printf(sc->rl_ifp, "PHY read failed\n");
device_printf(sc->rl_dev, "PHY read failed\n");
return (0);
}
@ -481,7 +481,7 @@ re_gmii_writereg(dev, phy, reg, data)
}
if (i == RL_TIMEOUT) {
if_printf(sc->rl_ifp, "PHY write failed\n");
device_printf(sc->rl_dev, "PHY write failed\n");
return (0);
}
@ -537,7 +537,7 @@ re_miibus_readreg(dev, phy, reg)
rval = CSR_READ_1(sc, RL_MEDIASTAT);
return (rval);
default:
if_printf(sc->rl_ifp, "bad phy register\n");
device_printf(sc->rl_dev, "bad phy register\n");
return (0);
}
rval = CSR_READ_2(sc, re8139_reg);
@ -593,7 +593,7 @@ re_miibus_writereg(dev, phy, reg, data)
return (0);
break;
default:
if_printf(sc->rl_ifp, "bad phy register\n");
device_printf(sc->rl_dev, "bad phy register\n");
return (0);
}
CSR_WRITE_2(sc, re8139_reg, data);
@ -680,7 +680,7 @@ re_reset(sc)
break;
}
if (i == RL_TIMEOUT)
if_printf(sc->rl_ifp, "reset never completed!\n");
device_printf(sc->rl_dev, "reset never completed!\n");
CSR_WRITE_1(sc, 0x82, 1);
}
@ -792,8 +792,9 @@ re_diag(sc)
}
if (i == RL_TIMEOUT) {
if_printf(ifp, "diagnostic failed, failed to receive packet "
"in loopback mode\n");
device_printf(sc->rl_dev,
"diagnostic failed, failed to receive packet in"
" loopback mode\n");
error = EIO;
goto done;
}
@ -821,7 +822,8 @@ re_diag(sc)
rxstat = le32toh(cur_rx->rl_cmdstat);
if (total_len != ETHER_MIN_LEN) {
if_printf(ifp, "diagnostic failed, received short packet\n");
device_printf(sc->rl_dev,
"diagnostic failed, received short packet\n");
error = EIO;
goto done;
}
@ -831,17 +833,18 @@ re_diag(sc)
if (bcmp((char *)&eh->ether_dhost, (char *)&dst, ETHER_ADDR_LEN) ||
bcmp((char *)&eh->ether_shost, (char *)&src, ETHER_ADDR_LEN) ||
ntohs(eh->ether_type) != ETHERTYPE_IP) {
if_printf(ifp, "WARNING, DMA FAILURE!\n");
if_printf(ifp, "expected TX data: %6D/%6D/0x%x\n",
device_printf(sc->rl_dev, "WARNING, DMA FAILURE!\n");
device_printf(sc->rl_dev, "expected TX data: %6D/%6D/0x%x\n",
dst, ":", src, ":", ETHERTYPE_IP);
if_printf(ifp, "received RX data: %6D/%6D/0x%x\n",
device_printf(sc->rl_dev, "received RX data: %6D/%6D/0x%x\n",
eh->ether_dhost, ":", eh->ether_shost, ":",
ntohs(eh->ether_type));
if_printf(ifp, "You may have a defective 32-bit NIC plugged "
"into a 64-bit PCI slot.\n");
if_printf(ifp, "Please re-install the NIC in a 32-bit slot "
"for proper operation.\n");
if_printf(ifp, "Read the re(4) man page for more details.\n");
device_printf(sc->rl_dev, "You may have a defective 32-bit "
"NIC plugged into a 64-bit PCI slot.\n");
device_printf(sc->rl_dev, "Please re-install the NIC in a "
"32-bit slot for proper operation.\n");
device_printf(sc->rl_dev, "Read the re(4) man page for more "
"details.\n");
error = EIO;
}
@ -2058,7 +2061,7 @@ re_encap(sc, m_head, idx)
*m_head, re_dma_map_desc, &arg, BUS_DMA_NOWAIT);
if (error && error != EFBIG) {
if_printf(sc->rl_ifp, "can't map mbuf (error %d)\n", error);
device_printf(sc->rl_dev, "can't map mbuf (error %d)\n", error);
return (ENOBUFS);
}
@ -2092,7 +2095,7 @@ re_encap(sc, m_head, idx)
error = bus_dmamap_load_mbuf(sc->rl_ldata.rl_mtag, map,
*m_head, re_dma_map_desc, &arg, BUS_DMA_NOWAIT);
if (error) {
if_printf(sc->rl_ifp, "can't map mbuf (error %d)\n",
device_printf(sc->rl_dev, "can't map mbuf (error %d)\n",
error);
return (EFBIG);
}

View File

@ -330,7 +330,7 @@ static u_int8_t ti_eeprom_getbyte(sc, addr, dest)
* Send write control code to EEPROM.
*/
if (ti_eeprom_putbyte(sc, EEPROM_CTL_WRITE)) {
if_printf(sc->ti_ifp,
device_printf(sc->ti_dev,
"failed to send write command, status: %x\n",
CSR_READ_4(sc, TI_MISC_LOCAL_CTL));
return (1);
@ -340,7 +340,7 @@ static u_int8_t ti_eeprom_getbyte(sc, addr, dest)
* Send first byte of address of byte we want to read.
*/
if (ti_eeprom_putbyte(sc, (addr >> 8) & 0xFF)) {
if_printf(sc->ti_ifp, "failed to send address, status: %x\n",
device_printf(sc->ti_dev, "failed to send address, status: %x\n",
CSR_READ_4(sc, TI_MISC_LOCAL_CTL));
return (1);
}
@ -348,7 +348,7 @@ static u_int8_t ti_eeprom_getbyte(sc, addr, dest)
* Send second byte address of byte we want to read.
*/
if (ti_eeprom_putbyte(sc, addr & 0xFF)) {
if_printf(sc->ti_ifp, "failed to send address, status: %x\n",
device_printf(sc->ti_dev, "failed to send address, status: %x\n",
CSR_READ_4(sc, TI_MISC_LOCAL_CTL));
return (1);
}
@ -359,7 +359,7 @@ static u_int8_t ti_eeprom_getbyte(sc, addr, dest)
* Send read control code to EEPROM.
*/
if (ti_eeprom_putbyte(sc, EEPROM_CTL_READ)) {
if_printf(sc->ti_ifp,
device_printf(sc->ti_dev,
"failed to send read command, status: %x\n",
CSR_READ_4(sc, TI_MISC_LOCAL_CTL));
return (1);
@ -526,10 +526,10 @@ ti_copy_mem(sc, tigon_addr, len, buf, useraddr, readdata)
*/
if ((readdata == 0)
&& (tigon_addr & 0x3)) {
if_printf(sc->ti_ifp, "ti_copy_mem: tigon address %#x isn't "
"word-aligned\n", tigon_addr);
if_printf(sc->ti_ifp, "ti_copy_mem: unaligned writes aren't "
"yet supported\n");
device_printf(sc->ti_dev, "%s: tigon address %#x isn't "
"word-aligned\n", __func__, tigon_addr);
device_printf(sc->ti_dev, "%s: unaligned writes aren't "
"yet supported\n", __func__);
return (EINVAL);
}
@ -723,14 +723,14 @@ ti_copy_scratch(sc, tigon_addr, len, buf, useraddr, readdata, cpu)
* If this proves to be a problem, it will be fixed.
*/
if (tigon_addr & 0x3) {
if_printf(sc->ti_ifp, "ti_copy_scratch: tigon address %#x "
"isn't word-aligned\n", tigon_addr);
device_printf(sc->ti_dev, "%s: tigon address %#x "
"isn't word-aligned\n", __func__, tigon_addr);
return (EINVAL);
}
if (len & 0x3) {
if_printf(sc->ti_ifp, "ti_copy_scratch: transfer length %d "
"isn't word-aligned\n", len);
device_printf(sc->ti_dev, "%s: transfer length %d "
"isn't word-aligned\n", __func__, len);
return (EINVAL);
}
@ -771,12 +771,12 @@ ti_copy_scratch(sc, tigon_addr, len, buf, useraddr, readdata, cpu)
*/
if (tmpval2 == 0xc0017c)
if_printf(sc->ti_ifp, "found 0xc0017c at %#x "
"(tmpval2)\n", segptr);
device_printf(sc->ti_dev, "found 0xc0017c at "
"%#x (tmpval2)\n", segptr);
if (tmpval == 0xc0017c)
if_printf(sc->ti_ifp, "found 0xc0017c at %#x "
"(tmpval)\n", segptr);
device_printf(sc->ti_dev, "found 0xc0017c at "
"%#x (tmpval)\n", segptr);
if (useraddr)
copyout(&tmpval, ptr, 4);
@ -855,7 +855,7 @@ ti_loadfw(sc)
if (tigonFwReleaseMajor != TI_FIRMWARE_MAJOR ||
tigonFwReleaseMinor != TI_FIRMWARE_MINOR ||
tigonFwReleaseFix != TI_FIRMWARE_FIX) {
if_printf(sc->ti_ifp, "firmware revision mismatch; "
device_printf(sc->ti_dev, "firmware revision mismatch; "
"want %d.%d.%d, got %d.%d.%d\n",
TI_FIRMWARE_MAJOR, TI_FIRMWARE_MINOR,
TI_FIRMWARE_FIX, tigonFwReleaseMajor,
@ -874,7 +874,7 @@ ti_loadfw(sc)
if (tigon2FwReleaseMajor != TI_FIRMWARE_MAJOR ||
tigon2FwReleaseMinor != TI_FIRMWARE_MINOR ||
tigon2FwReleaseFix != TI_FIRMWARE_FIX) {
if_printf(sc->ti_ifp, "firmware revision mismatch; "
device_printf(sc->ti_dev, "firmware revision mismatch; "
"want %d.%d.%d, got %d.%d.%d\n",
TI_FIRMWARE_MAJOR, TI_FIRMWARE_MINOR,
TI_FIRMWARE_FIX, tigon2FwReleaseMajor,
@ -892,7 +892,7 @@ ti_loadfw(sc)
CSR_WRITE_4(sc, TI_CPU_PROGRAM_COUNTER, tigon2FwStartAddr);
break;
default:
if_printf(sc->ti_ifp,
device_printf(sc->ti_dev,
"can't load firmware: unknown hardware rev\n");
break;
}
@ -959,19 +959,19 @@ ti_handle_events(sc)
case TI_EV_LINKSTAT_CHANGED:
sc->ti_linkstat = TI_EVENT_CODE(e);
if (sc->ti_linkstat == TI_EV_CODE_LINK_UP)
if_printf(sc->ti_ifp, "10/100 link up\n");
device_printf(sc->ti_dev, "10/100 link up\n");
else if (sc->ti_linkstat == TI_EV_CODE_GIG_LINK_UP)
if_printf(sc->ti_ifp, "gigabit link up\n");
device_printf(sc->ti_dev, "gigabit link up\n");
else if (sc->ti_linkstat == TI_EV_CODE_LINK_DOWN)
if_printf(sc->ti_ifp, "link down\n");
device_printf(sc->ti_dev, "link down\n");
break;
case TI_EV_ERROR:
if (TI_EVENT_CODE(e) == TI_EV_CODE_ERR_INVAL_CMD)
if_printf(sc->ti_ifp, "invalid command\n");
device_printf(sc->ti_dev, "invalid command\n");
else if (TI_EVENT_CODE(e) == TI_EV_CODE_ERR_UNIMP_CMD)
if_printf(sc->ti_ifp, "unknown command\n");
device_printf(sc->ti_dev, "unknown command\n");
else if (TI_EVENT_CODE(e) == TI_EV_CODE_ERR_BADCFG)
if_printf(sc->ti_ifp, "bad config data\n");
device_printf(sc->ti_dev, "bad config data\n");
break;
case TI_EV_FIRMWARE_UP:
ti_init2(sc);
@ -984,7 +984,7 @@ ti_handle_events(sc)
/* Who cares. */
break;
default:
if_printf(sc->ti_ifp, "unknown event: %d\n",
device_printf(sc->ti_dev, "unknown event: %d\n",
TI_EVENT_EVENT(e));
break;
}
@ -1159,7 +1159,7 @@ static void *ti_jalloc(sc)
entry = SLIST_FIRST(&sc->ti_jfree_listhead);
if (entry == NULL) {
if_printf(sc->ti_ifp, "no free jumbo buffers\n");
device_printf(sc->ti_dev, "no free jumbo buffers\n");
return (NULL);
}
@ -1367,7 +1367,7 @@ ti_newbuf_jumbo(sc, i, m)
buf = ti_jalloc(sc);
if (buf == NULL) {
m_freem(m_new);
if_printf(sc->ti_ifp, "jumbo allocation failed "
device_printf(sc->ti_dev, "jumbo allocation failed "
"-- packet dropped!\n");
return (ENOBUFS);
}
@ -1452,19 +1452,19 @@ ti_newbuf_jumbo(sc, idx, m_old)
/* Allocate the mbufs. */
MGETHDR(m_new, M_DONTWAIT, MT_DATA);
if (m_new == NULL) {
if_printf(sc->ti_ifp, "mbuf allocation failed "
device_printf(sc->ti_dev, "mbuf allocation failed "
"-- packet dropped!\n");
goto nobufs;
}
MGET(m[NPAYLOAD], M_DONTWAIT, MT_DATA);
if (m[NPAYLOAD] == NULL) {
if_printf(sc->ti_ifp, "cluster mbuf allocation failed "
"-- packet dropped!\n");
device_printf(sc->ti_dev, "cluster mbuf allocation "
"failed -- packet dropped!\n");
goto nobufs;
}
MCLGET(m[NPAYLOAD], M_DONTWAIT);
if ((m[NPAYLOAD]->m_flags & M_EXT) == 0) {
if_printf(sc->ti_ifp, "mbuf allocation failed "
device_printf(sc->ti_dev, "mbuf allocation failed "
"-- packet dropped!\n");
goto nobufs;
}
@ -1473,15 +1473,15 @@ ti_newbuf_jumbo(sc, idx, m_old)
for (i = 0; i < NPAYLOAD; i++){
MGET(m[i], M_DONTWAIT, MT_DATA);
if (m[i] == NULL) {
if_printf(sc->ti_ifp, "mbuf allocation failed "
"-- packet dropped!\n");
device_printf(sc->ti_dev, "mbuf allocation "
"failed -- packet dropped!\n");
goto nobufs;
}
frame = vm_page_alloc(NULL, color++,
VM_ALLOC_INTERRUPT | VM_ALLOC_NOOBJ |
VM_ALLOC_WIRED);
if (frame == NULL) {
if_printf(sc->ti_ifp, "buffer allocation "
device_printf(sc->ti_dev, "buffer allocation "
"failed -- packet dropped!\n");
printf(" index %d page %d\n", idx, i);
goto nobufs;
@ -1492,7 +1492,7 @@ ti_newbuf_jumbo(sc, idx, m_old)
vm_page_unwire(frame, 0);
vm_page_free(frame);
vm_page_unlock_queues();
if_printf(sc->ti_ifp, "buffer allocation "
device_printf(sc->ti_dev, "buffer allocation "
"failed -- packet dropped!\n");
printf(" index %d page %d\n", idx, i);
goto nobufs;
@ -1769,7 +1769,7 @@ ti_add_mcast(sc, addr)
TI_DO_CMD_EXT(TI_CMD_EXT_ADD_MCAST, 0, 0, (caddr_t)&ext, 2);
break;
default:
if_printf(sc->ti_ifp, "unknown hwrev\n");
device_printf(sc->ti_dev, "unknown hwrev\n");
break;
}
}
@ -1797,7 +1797,7 @@ ti_del_mcast(sc, addr)
TI_DO_CMD_EXT(TI_CMD_EXT_DEL_MCAST, 0, 0, (caddr_t)&ext, 2);
break;
default:
if_printf(sc->ti_ifp, "unknown hwrev\n");
device_printf(sc->ti_dev, "unknown hwrev\n");
break;
}
}
@ -1856,7 +1856,8 @@ ti_setmulti(sc)
continue;
mc = malloc(sizeof(struct ti_mc_entry), M_DEVBUF, M_NOWAIT);
if (mc == NULL) {
if_printf(ifp, "no memory for mcast filter entry\n");
device_printf(sc->ti_dev,
"no memory for mcast filter entry\n");
continue;
}
bcopy(LLADDR((struct sockaddr_dl *)ifma->ifma_addr),
@ -1928,7 +1929,7 @@ ti_chipinit(sc)
/* Check the ROM failed bit to see if self-tests passed. */
if (CSR_READ_4(sc, TI_CPU_STATE) & TI_CPUSTATE_ROMFAIL) {
if_printf(sc->ti_ifp, "board self-diagnostics failed!\n");
device_printf(sc->ti_dev, "board self-diagnostics failed!\n");
return (ENODEV);
}
@ -1944,7 +1945,7 @@ ti_chipinit(sc)
sc->ti_hwrev = TI_HWREV_TIGON_II;
break;
default:
if_printf(sc->ti_ifp, "unsupported chip revision\n");
device_printf(sc->ti_dev, "unsupported chip revision\n");
return (ENODEV);
}
@ -1963,7 +1964,7 @@ ti_chipinit(sc)
if (sc->ti_hwrev != TI_HWREV_TIGON)
sc->ti_hdrsplit = 1;
else
if_printf(sc->ti_ifp,
device_printf(sc->ti_dev,
"can't do header splitting on a Tigon I board\n");
#endif /* TI_JUMBO_HDRSPLIT */
@ -1998,8 +1999,8 @@ ti_chipinit(sc)
default:
/* Disable PCI memory write and invalidate. */
if (bootverbose)
if_printf(sc->ti_ifp, "cache line size %d not "
"supported; disabling PCI MWI\n",
device_printf(sc->ti_dev, "cache line size %d"
" not supported; disabling PCI MWI\n",
cacheline);
CSR_WRITE_4(sc, TI_PCI_CMDSTAT, CSR_READ_4(sc,
TI_PCI_CMDSTAT) & ~PCIM_CMD_MWIEN);
@ -2054,7 +2055,7 @@ ti_chipinit(sc)
CSR_WRITE_4(sc, TI_GCR_DMA_READCFG, TI_DMA_STATE_THRESH_8W);
if (ti_64bitslot_war(sc)) {
if_printf(sc->ti_ifp, "bios thinks we're in a 64 bit slot, "
device_printf(sc->ti_dev, "bios thinks we're in a 64 bit slot, "
"but we aren't");
return (EINVAL);
}
@ -3159,7 +3160,7 @@ ti_init_locked(xsc)
/* Init the gen info block, ring control blocks and firmware. */
if (ti_gibinit(sc)) {
if_printf(sc->ti_ifp, "initialization failure\n");
device_printf(sc->ti_dev, "initialization failure\n");
return;
}
}