summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/dev/sf/if_sf.c7
-rw-r--r--sys/dev/sf/if_sfreg.h1
-rw-r--r--sys/dev/vr/if_vr.c20
-rw-r--r--sys/dev/vr/if_vrreg.h1
-rw-r--r--sys/pci/if_rl.c9
-rw-r--r--sys/pci/if_sf.c7
-rw-r--r--sys/pci/if_sfreg.h1
-rw-r--r--sys/pci/if_sis.c12
-rw-r--r--sys/pci/if_sisreg.h2
-rw-r--r--sys/pci/if_ste.c16
-rw-r--r--sys/pci/if_tl.c23
-rw-r--r--sys/pci/if_tlreg.h1
-rw-r--r--sys/pci/if_vr.c20
-rw-r--r--sys/pci/if_vrreg.h1
-rw-r--r--sys/pci/if_wb.c12
-rw-r--r--sys/pci/if_wbreg.h1
-rw-r--r--sys/pci/if_xl.c61
-rw-r--r--sys/pci/if_xlreg.h1
18 files changed, 107 insertions, 89 deletions
diff --git a/sys/dev/sf/if_sf.c b/sys/dev/sf/if_sf.c
index 498aba3..a308e40 100644
--- a/sys/dev/sf/if_sf.c
+++ b/sys/dev/sf/if_sf.c
@@ -616,7 +616,7 @@ sf_reset(sc)
}
if (i == SF_TIMEOUT)
- if_printf(sc->sf_ifp, "reset never completed!\n");
+ device_printf(sc->sf_dev, "reset never completed!\n");
/* Wait a little while for the chip to get its brains in order. */
DELAY(1000);
@@ -690,6 +690,7 @@ sf_attach(dev)
u_char eaddr[6];
sc = device_get_softc(dev);
+ sc->sf_dev = dev;
mtx_init(&sc->sf_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK,
MTX_DEF);
@@ -1081,7 +1082,7 @@ sf_txthresh_adjust(sc)
txfctl &= ~SF_TXFRMCTL_TXTHRESH;
txfctl |= txthresh;
#ifdef DIAGNOSTIC
- if_printf(sc->sf_ifp, "tx underrun, increasing "
+ device_printf(sc->sf_dev, "tx underrun, increasing "
"tx threshold to %d bytes\n",
txthresh * 4);
#endif
@@ -1243,7 +1244,7 @@ sf_init_locked(sc)
sf_setperf(sc, 0, IF_LLADDR(sc->sf_ifp));
if (sf_init_rx_ring(sc) == ENOBUFS) {
- if_printf(sc->sf_ifp,
+ device_printf(sc->sf_dev,
"initialization failed: no memory for rx buffers\n");
return;
}
diff --git a/sys/dev/sf/if_sfreg.h b/sys/dev/sf/if_sfreg.h
index 9b3826d..1f6618d 100644
--- a/sys/dev/sf/if_sfreg.h
+++ b/sys/dev/sf/if_sfreg.h
@@ -1032,6 +1032,7 @@ struct sf_list_data {
struct sf_softc {
struct ifnet *sf_ifp; /* interface info */
+ device_t sf_dev; /* device info */
bus_space_handle_t sf_bhandle; /* bus space handle */
bus_space_tag_t sf_btag; /* bus space tag */
void *sf_intrhand; /* interrupt handler cookie */
diff --git a/sys/dev/vr/if_vr.c b/sys/dev/vr/if_vr.c
index 18de6f1..be38015 100644
--- a/sys/dev/vr/if_vr.c
+++ b/sys/dev/vr/if_vr.c
@@ -603,10 +603,10 @@ vr_reset(struct vr_softc *sc)
}
if (i == VR_TIMEOUT) {
if (sc->vr_revid < REV_ID_VT3065_A)
- if_printf(sc->vr_ifp, "reset never completed!\n");
+ device_printf(sc->vr_dev, "reset never completed!\n");
else {
/* Use newer force reset command */
- if_printf(sc->vr_ifp, "Using force reset command.\n");
+ device_printf(sc->vr_dev, "Using force reset command.\n");
VR_SETBIT(sc, VR_MISC_CR1, VR_MISCCR1_FORSRST);
}
}
@@ -651,6 +651,7 @@ vr_attach(dev)
int unit, error = 0, rid;
sc = device_get_softc(dev);
+ sc->vr_dev = dev;
unit = device_get_unit(dev);
mtx_init(&sc->vr_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK,
@@ -973,7 +974,8 @@ vr_rxeof(struct vr_softc *sc)
*/
if (rxstat & VR_RXSTAT_RXERR) {
ifp->if_ierrors++;
- if_printf(ifp, "rx error (%02x):", rxstat & 0x000000ff);
+ device_printf(sc->vr_dev,
+ "rx error (%02x):", rxstat & 0x000000ff);
if (rxstat & VR_RXSTAT_CRCERR)
printf(" crc error");
if (rxstat & VR_RXSTAT_FRAMEALIGNERR)
@@ -1042,7 +1044,7 @@ vr_rxeoc(struct vr_softc *sc)
}
if (!i) {
- if_printf(ifp, "rx shutdown error!\n");
+ device_printf(sc->vr_dev, "rx shutdown error!\n");
sc->vr_flags |= VR_F_RESTART;
return;
}
@@ -1084,7 +1086,7 @@ vr_txeof(struct vr_softc *sc)
i--)
; /* Wait for chip to shutdown */
if (!i) {
- if_printf(ifp, "tx shutdown timeout\n");
+ device_printf(sc->vr_dev, "tx shutdown timeout\n");
sc->vr_flags |= VR_F_RESTART;
break;
}
@@ -1127,7 +1129,7 @@ vr_tick(void *xsc)
VR_LOCK_ASSERT(sc);
if (sc->vr_flags & VR_F_RESTART) {
- if_printf(sc->vr_ifp, "restarting\n");
+ device_printf(sc->vr_dev, "restarting\n");
vr_stop(sc);
vr_reset(sc);
vr_init_locked(sc);
@@ -1261,13 +1263,13 @@ vr_intr(void *arg)
vr_rxeof(sc);
if (status & VR_ISR_RX_DROPPED) {
- if_printf(ifp, "rx packet lost\n");
+ device_printf(sc->vr_dev, "rx packet lost\n");
ifp->if_ierrors++;
}
if ((status & VR_ISR_RX_ERR) || (status & VR_ISR_RX_NOBUF) ||
(status & VR_ISR_RX_NOBUF) || (status & VR_ISR_RX_OFLOW)) {
- if_printf(ifp, "receive error (%04x)", status);
+ device_printf(sc->vr_dev, "receive error (%04x)", status);
if (status & VR_ISR_RX_NOBUF)
printf(" no buffers");
if (status & VR_ISR_RX_OFLOW)
@@ -1469,7 +1471,7 @@ vr_init_locked(struct vr_softc *sc)
/* Init circular RX list. */
if (vr_list_rx_init(sc) == ENOBUFS) {
- if_printf(ifp,
+ device_printf(sc->vr_dev,
"initialization failed: no memory for rx buffers\n");
vr_stop(sc);
return;
diff --git a/sys/dev/vr/if_vrreg.h b/sys/dev/vr/if_vrreg.h
index 7caab56..d5a1023 100644
--- a/sys/dev/vr/if_vrreg.h
+++ b/sys/dev/vr/if_vrreg.h
@@ -453,6 +453,7 @@ struct vr_mii_frame {
struct vr_softc {
struct ifnet *vr_ifp; /* interface info */
+ device_t vr_dev;
bus_space_handle_t vr_bhandle; /* bus space handle */
bus_space_tag_t vr_btag; /* bus space tag */
struct resource *vr_res;
diff --git a/sys/pci/if_rl.c b/sys/pci/if_rl.c
index 0fae3dd..87189a8 100644
--- a/sys/pci/if_rl.c
+++ b/sys/pci/if_rl.c
@@ -578,7 +578,7 @@ rl_miibus_readreg(device_t dev, int phy, int 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, rl8139_reg);
@@ -628,7 +628,7 @@ rl_miibus_writereg(device_t dev, int phy, int reg, int 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, rl8139_reg, data);
@@ -718,7 +718,7 @@ rl_reset(struct rl_softc *sc)
break;
}
if (i == RL_TIMEOUT)
- if_printf(sc->rl_ifp, "reset never completed!\n");
+ device_printf(sc->rl_dev, "reset never completed!\n");
}
/*
@@ -793,6 +793,7 @@ rl_attach(device_t dev)
sc = device_get_softc(dev);
unit = device_get_unit(dev);
+ sc->rl_dev = dev;
mtx_init(&sc->rl_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK,
MTX_DEF);
@@ -974,7 +975,7 @@ rl_attach(device_t dev)
error = bus_setup_intr(dev, sc->rl_irq, INTR_TYPE_NET | INTR_MPSAFE,
rl_intr, sc, &sc->rl_intrhand);
if (error) {
- if_printf(ifp, "couldn't set up irq\n");
+ device_printf(sc->rl_dev, "couldn't set up irq\n");
ether_ifdetach(ifp);
}
diff --git a/sys/pci/if_sf.c b/sys/pci/if_sf.c
index 498aba3..a308e40 100644
--- a/sys/pci/if_sf.c
+++ b/sys/pci/if_sf.c
@@ -616,7 +616,7 @@ sf_reset(sc)
}
if (i == SF_TIMEOUT)
- if_printf(sc->sf_ifp, "reset never completed!\n");
+ device_printf(sc->sf_dev, "reset never completed!\n");
/* Wait a little while for the chip to get its brains in order. */
DELAY(1000);
@@ -690,6 +690,7 @@ sf_attach(dev)
u_char eaddr[6];
sc = device_get_softc(dev);
+ sc->sf_dev = dev;
mtx_init(&sc->sf_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK,
MTX_DEF);
@@ -1081,7 +1082,7 @@ sf_txthresh_adjust(sc)
txfctl &= ~SF_TXFRMCTL_TXTHRESH;
txfctl |= txthresh;
#ifdef DIAGNOSTIC
- if_printf(sc->sf_ifp, "tx underrun, increasing "
+ device_printf(sc->sf_dev, "tx underrun, increasing "
"tx threshold to %d bytes\n",
txthresh * 4);
#endif
@@ -1243,7 +1244,7 @@ sf_init_locked(sc)
sf_setperf(sc, 0, IF_LLADDR(sc->sf_ifp));
if (sf_init_rx_ring(sc) == ENOBUFS) {
- if_printf(sc->sf_ifp,
+ device_printf(sc->sf_dev,
"initialization failed: no memory for rx buffers\n");
return;
}
diff --git a/sys/pci/if_sfreg.h b/sys/pci/if_sfreg.h
index 9b3826d..1f6618d 100644
--- a/sys/pci/if_sfreg.h
+++ b/sys/pci/if_sfreg.h
@@ -1032,6 +1032,7 @@ struct sf_list_data {
struct sf_softc {
struct ifnet *sf_ifp; /* interface info */
+ device_t sf_dev; /* device info */
bus_space_handle_t sf_bhandle; /* bus space handle */
bus_space_tag_t sf_btag; /* bus space tag */
void *sf_intrhand; /* interrupt handler cookie */
diff --git a/sys/pci/if_sis.c b/sys/pci/if_sis.c
index 858c4c0..2b67f87 100644
--- a/sys/pci/if_sis.c
+++ b/sys/pci/if_sis.c
@@ -639,7 +639,7 @@ sis_miibus_readreg(device_t dev, int phy, int reg)
}
if (i == SIS_TIMEOUT) {
- if_printf(sc->sis_ifp, "PHY failed to come ready\n");
+ device_printf(sc->sis_dev, "PHY failed to come ready\n");
return(0);
}
@@ -697,7 +697,7 @@ sis_miibus_writereg(device_t dev, int phy, int reg, int data)
}
if (i == SIS_TIMEOUT)
- if_printf(sc->sis_ifp, "PHY failed to come ready\n");
+ device_printf(sc->sis_dev, "PHY failed to come ready\n");
} else {
bzero((char *)&frame, sizeof(frame));
@@ -863,7 +863,7 @@ sis_reset(struct sis_softc *sc)
}
if (i == SIS_TIMEOUT)
- if_printf(sc->sis_ifp, "reset never completed\n");
+ device_printf(sc->sis_dev, "reset never completed\n");
/* Wait a little while for the chip to get its brains in order. */
DELAY(1000);
@@ -918,7 +918,7 @@ sis_attach(device_t dev)
waittime = 0;
sc = device_get_softc(dev);
- sc->sis_self = dev;
+ sc->sis_dev = dev;
mtx_init(&sc->sis_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK,
MTX_DEF);
@@ -1889,7 +1889,7 @@ sis_initl(struct sis_softc *sc)
/* Init circular TX/RX lists. */
if (sis_ring_init(sc) != 0) {
- if_printf(ifp,
+ device_printf(sc->sis_dev,
"initialization failed: no memory for rx buffers\n");
sis_stop(sc);
return;
@@ -2013,7 +2013,7 @@ sis_initl(struct sis_softc *sc)
DELAY(100000);
reg = CSR_READ_4(sc, NS_PHY_TDATA) & 0xff;
if ((reg & 0x0080) == 0 || (reg > 0xd8 && reg <= 0xff)) {
- device_printf(sc->sis_self,
+ device_printf(sc->sis_dev,
"Applying short cable fix (reg=%x)\n", reg);
CSR_WRITE_4(sc, NS_PHY_TDATA, 0x00e8);
reg = CSR_READ_4(sc, NS_PHY_DSPCFG);
diff --git a/sys/pci/if_sisreg.h b/sys/pci/if_sisreg.h
index 4c0a2c0..8e50768 100644
--- a/sys/pci/if_sisreg.h
+++ b/sys/pci/if_sisreg.h
@@ -433,7 +433,7 @@ struct sis_softc {
struct ifnet *sis_ifp; /* interface info */
struct resource *sis_res[2];
void *sis_intrhand;
- device_t sis_self;
+ device_t sis_dev;
device_t sis_miibus;
u_int8_t sis_type;
u_int8_t sis_rev;
diff --git a/sys/pci/if_ste.c b/sys/pci/if_ste.c
index ea2a652..23331d5 100644
--- a/sys/pci/if_ste.c
+++ b/sys/pci/if_ste.c
@@ -504,7 +504,7 @@ ste_wait(sc)
}
if (i == STE_TIMEOUT)
- if_printf(sc->ste_ifp, "command never completed!\n");
+ device_printf(sc->ste_dev, "command never completed!\n");
return;
}
@@ -529,7 +529,7 @@ ste_eeprom_wait(sc)
}
if (i == 100) {
- if_printf(sc->ste_ifp, "eeprom failed to come ready\n");
+ device_printf(sc->ste_dev, "eeprom failed to come ready\n");
return(1);
}
@@ -812,7 +812,7 @@ ste_rxeof(sc)
* If not, something truly strange has happened.
*/
if (!(rxstat & STE_RXSTAT_DMADONE)) {
- if_printf(ifp,
+ device_printf(sc->ste_dev,
"bad receive status -- packet dropped\n");
ifp->if_ierrors++;
cur_rx->ste_ptr->ste_status = 0;
@@ -866,7 +866,8 @@ ste_txeoc(sc)
txstat & STE_TXSTATUS_EXCESSCOLLS ||
txstat & STE_TXSTATUS_RECLAIMERR) {
ifp->if_oerrors++;
- if_printf(ifp, "transmission error: %x\n", txstat);
+ device_printf(sc->ste_dev,
+ "transmission error: %x\n", txstat);
ste_reset(sc);
ste_init_locked(sc);
@@ -874,7 +875,8 @@ ste_txeoc(sc)
if (txstat & STE_TXSTATUS_UNDERRUN &&
sc->ste_tx_thresh < STE_PACKET_SIZE) {
sc->ste_tx_thresh += STE_MIN_FRAMELEN;
- if_printf(ifp, "tx underrun, increasing tx"
+ device_printf(sc->ste_dev,
+ "tx underrun, increasing tx"
" start threshold to %d bytes\n",
sc->ste_tx_thresh);
}
@@ -1309,7 +1311,7 @@ ste_init_locked(sc)
/* Init RX list */
if (ste_init_rx_list(sc) == ENOBUFS) {
- if_printf(ifp,
+ device_printf(sc->ste_dev,
"initialization failed: no memory for RX buffers\n");
ste_stop(sc);
return;
@@ -1469,7 +1471,7 @@ ste_reset(sc)
}
if (i == STE_TIMEOUT)
- if_printf(sc->ste_ifp, "global reset never completed\n");
+ device_printf(sc->ste_dev, "global reset never completed\n");
return;
}
diff --git a/sys/pci/if_tl.c b/sys/pci/if_tl.c
index b5e18746..8384b2c 100644
--- a/sys/pci/if_tl.c
+++ b/sys/pci/if_tl.c
@@ -526,7 +526,7 @@ static u_int8_t tl_eeprom_getbyte(sc, addr, dest)
{
register int i;
u_int8_t byte = 0;
- struct ifnet *ifp = sc->tl_ifp;
+ device_t tl_dev = sc->tl_dev;
tl_dio_write8(sc, TL_NETSIO, 0);
@@ -536,7 +536,7 @@ static u_int8_t tl_eeprom_getbyte(sc, addr, dest)
* Send write control code to EEPROM.
*/
if (tl_eeprom_putbyte(sc, EEPROM_CTL_WRITE)) {
- if_printf(ifp, "failed to send write command, status: %x\n",
+ device_printf(tl_dev, "failed to send write command, status: %x\n",
tl_dio_read8(sc, TL_NETSIO));
return(1);
}
@@ -545,7 +545,7 @@ static u_int8_t tl_eeprom_getbyte(sc, addr, dest)
* Send address of byte we want to read.
*/
if (tl_eeprom_putbyte(sc, addr)) {
- if_printf(ifp, "failed to send address, status: %x\n",
+ device_printf(tl_dev, "failed to send address, status: %x\n",
tl_dio_read8(sc, TL_NETSIO));
return(1);
}
@@ -556,7 +556,7 @@ static u_int8_t tl_eeprom_getbyte(sc, addr, dest)
* Send read control code to EEPROM.
*/
if (tl_eeprom_putbyte(sc, EEPROM_CTL_READ)) {
- if_printf(ifp, "failed to send write command, status: %x\n",
+ device_printf(tl_dev, "failed to send write command, status: %x\n",
tl_dio_read8(sc, TL_NETSIO));
return(1);
}
@@ -1115,6 +1115,7 @@ tl_attach(dev)
vid = pci_get_vendor(dev);
did = pci_get_device(dev);
sc = device_get_softc(dev);
+ sc->tl_dev = dev;
unit = device_get_unit(dev);
t = tl_devs;
@@ -1669,7 +1670,7 @@ tl_intvec_adchk(xsc, type)
sc = xsc;
if (type)
- if_printf(sc->tl_ifp, "adapter check: %x\n",
+ device_printf(sc->tl_dev, "adapter check: %x\n",
(unsigned int)CSR_READ_4(sc, TL_CH_PARM));
tl_softreset(sc, 1);
@@ -1693,7 +1694,7 @@ tl_intvec_netsts(xsc, type)
netsts = tl_dio_read16(sc, TL_NETSTS);
tl_dio_write16(sc, TL_NETSTS, netsts);
- if_printf(sc->tl_ifp, "network status: %x\n", netsts);
+ device_printf(sc->tl_dev, "network status: %x\n", netsts);
return(1);
}
@@ -1724,7 +1725,7 @@ tl_intr(xsc)
switch(ints) {
case (TL_INTR_INVALID):
#ifdef DIAGNOSTIC
- if_printf(ifp, "got an invalid interrupt!\n");
+ device_printf(sc->tl_dev, "got an invalid interrupt!\n");
#endif
/* Re-enable interrupts but don't ack this one. */
CMD_PUT(sc, type);
@@ -1744,7 +1745,7 @@ tl_intr(xsc)
r = tl_intvec_rxeof((void *)sc, type);
break;
case (TL_INTR_DUMMY):
- if_printf(ifp, "got a dummy interrupt\n");
+ device_printf(sc->tl_dev, "got a dummy interrupt\n");
r = 1;
break;
case (TL_INTR_ADCHK):
@@ -1757,7 +1758,7 @@ tl_intr(xsc)
r = tl_intvec_rxeoc((void *)sc, type);
break;
default:
- if_printf(ifp, "bogus interrupt type\n");
+ device_printf(sc->tl_dev, "bogus interrupt type\n");
break;
}
@@ -1813,7 +1814,7 @@ tl_stats_update(xsc)
if (tx_thresh != TL_AC_TXTHRESH_WHOLEPKT) {
tx_thresh >>= 4;
tx_thresh++;
- if_printf(ifp, "tx underrun -- increasing "
+ device_printf(sc->tl_dev, "tx underrun -- increasing "
"tx threshold to %d bytes\n",
(64 * (tx_thresh * 4)));
tl_dio_clrbit(sc, TL_ACOMMIT, TL_AC_TXTHRESH);
@@ -2094,7 +2095,7 @@ tl_init_locked(sc)
/* Init circular RX list. */
if (tl_list_rx_init(sc) == ENOBUFS) {
- if_printf(ifp,
+ device_printf(sc->tl_dev,
"initialization failed: no memory for rx buffers\n");
tl_stop(sc);
return;
diff --git a/sys/pci/if_tlreg.h b/sys/pci/if_tlreg.h
index 0aa50d3..4060c70 100644
--- a/sys/pci/if_tlreg.h
+++ b/sys/pci/if_tlreg.h
@@ -110,6 +110,7 @@ struct tl_chain_data {
struct tl_softc {
struct ifnet *tl_ifp;
+ device_t tl_dev;
struct ifmedia ifmedia; /* media info */
bus_space_handle_t tl_bhandle;
bus_space_tag_t tl_btag;
diff --git a/sys/pci/if_vr.c b/sys/pci/if_vr.c
index 18de6f1..be38015 100644
--- a/sys/pci/if_vr.c
+++ b/sys/pci/if_vr.c
@@ -603,10 +603,10 @@ vr_reset(struct vr_softc *sc)
}
if (i == VR_TIMEOUT) {
if (sc->vr_revid < REV_ID_VT3065_A)
- if_printf(sc->vr_ifp, "reset never completed!\n");
+ device_printf(sc->vr_dev, "reset never completed!\n");
else {
/* Use newer force reset command */
- if_printf(sc->vr_ifp, "Using force reset command.\n");
+ device_printf(sc->vr_dev, "Using force reset command.\n");
VR_SETBIT(sc, VR_MISC_CR1, VR_MISCCR1_FORSRST);
}
}
@@ -651,6 +651,7 @@ vr_attach(dev)
int unit, error = 0, rid;
sc = device_get_softc(dev);
+ sc->vr_dev = dev;
unit = device_get_unit(dev);
mtx_init(&sc->vr_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK,
@@ -973,7 +974,8 @@ vr_rxeof(struct vr_softc *sc)
*/
if (rxstat & VR_RXSTAT_RXERR) {
ifp->if_ierrors++;
- if_printf(ifp, "rx error (%02x):", rxstat & 0x000000ff);
+ device_printf(sc->vr_dev,
+ "rx error (%02x):", rxstat & 0x000000ff);
if (rxstat & VR_RXSTAT_CRCERR)
printf(" crc error");
if (rxstat & VR_RXSTAT_FRAMEALIGNERR)
@@ -1042,7 +1044,7 @@ vr_rxeoc(struct vr_softc *sc)
}
if (!i) {
- if_printf(ifp, "rx shutdown error!\n");
+ device_printf(sc->vr_dev, "rx shutdown error!\n");
sc->vr_flags |= VR_F_RESTART;
return;
}
@@ -1084,7 +1086,7 @@ vr_txeof(struct vr_softc *sc)
i--)
; /* Wait for chip to shutdown */
if (!i) {
- if_printf(ifp, "tx shutdown timeout\n");
+ device_printf(sc->vr_dev, "tx shutdown timeout\n");
sc->vr_flags |= VR_F_RESTART;
break;
}
@@ -1127,7 +1129,7 @@ vr_tick(void *xsc)
VR_LOCK_ASSERT(sc);
if (sc->vr_flags & VR_F_RESTART) {
- if_printf(sc->vr_ifp, "restarting\n");
+ device_printf(sc->vr_dev, "restarting\n");
vr_stop(sc);
vr_reset(sc);
vr_init_locked(sc);
@@ -1261,13 +1263,13 @@ vr_intr(void *arg)
vr_rxeof(sc);
if (status & VR_ISR_RX_DROPPED) {
- if_printf(ifp, "rx packet lost\n");
+ device_printf(sc->vr_dev, "rx packet lost\n");
ifp->if_ierrors++;
}
if ((status & VR_ISR_RX_ERR) || (status & VR_ISR_RX_NOBUF) ||
(status & VR_ISR_RX_NOBUF) || (status & VR_ISR_RX_OFLOW)) {
- if_printf(ifp, "receive error (%04x)", status);
+ device_printf(sc->vr_dev, "receive error (%04x)", status);
if (status & VR_ISR_RX_NOBUF)
printf(" no buffers");
if (status & VR_ISR_RX_OFLOW)
@@ -1469,7 +1471,7 @@ vr_init_locked(struct vr_softc *sc)
/* Init circular RX list. */
if (vr_list_rx_init(sc) == ENOBUFS) {
- if_printf(ifp,
+ device_printf(sc->vr_dev,
"initialization failed: no memory for rx buffers\n");
vr_stop(sc);
return;
diff --git a/sys/pci/if_vrreg.h b/sys/pci/if_vrreg.h
index 7caab56..d5a1023 100644
--- a/sys/pci/if_vrreg.h
+++ b/sys/pci/if_vrreg.h
@@ -453,6 +453,7 @@ struct vr_mii_frame {
struct vr_softc {
struct ifnet *vr_ifp; /* interface info */
+ device_t vr_dev;
bus_space_handle_t vr_bhandle; /* bus space handle */
bus_space_tag_t vr_btag; /* bus space tag */
struct resource *vr_res;
diff --git a/sys/pci/if_wb.c b/sys/pci/if_wb.c
index 486735d..1a59713 100644
--- a/sys/pci/if_wb.c
+++ b/sys/pci/if_wb.c
@@ -655,7 +655,7 @@ wb_setcfg(sc, media)
}
if (i == WB_TIMEOUT)
- if_printf(sc->wb_ifp,
+ device_printf(sc->wb_dev,
"failed to force tx and rx to idle state\n");
}
@@ -696,7 +696,7 @@ wb_reset(sc)
break;
}
if (i == WB_TIMEOUT)
- if_printf(sc->wb_ifp, "reset never completed!\n");
+ device_printf(sc->wb_dev, "reset never completed!\n");
/* Wait a little while for the chip to get its brains in order. */
DELAY(1000);
@@ -784,6 +784,7 @@ wb_attach(dev)
int error = 0, rid;
sc = device_get_softc(dev);
+ sc->wb_dev = dev;
mtx_init(&sc->wb_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK,
MTX_DEF);
@@ -1087,8 +1088,9 @@ wb_rxeof(sc)
!(rxstat & WB_RXSTAT_RXCMP)) {
ifp->if_ierrors++;
wb_newbuf(sc, cur_rx, m);
- if_printf(ifp, "receiver babbling: possible chip "
- "bug, forcing reset\n");
+ device_printf(sc->wb_dev,
+ "receiver babbling: possible chip bug,"
+ " forcing reset\n");
wb_fixmedia(sc);
wb_reset(sc);
wb_init_locked(sc);
@@ -1602,7 +1604,7 @@ wb_init_locked(sc)
/* Init circular RX list. */
if (wb_list_rx_init(sc) == ENOBUFS) {
- if_printf(ifp,
+ device_printf(sc->wb_dev,
"initialization failed: no memory for rx buffers\n");
wb_stop(sc);
return;
diff --git a/sys/pci/if_wbreg.h b/sys/pci/if_wbreg.h
index 44a9d75..864c336 100644
--- a/sys/pci/if_wbreg.h
+++ b/sys/pci/if_wbreg.h
@@ -363,6 +363,7 @@ struct wb_mii_frame {
struct wb_softc {
struct ifnet *wb_ifp; /* interface info */
+ device_t wb_dev;
device_t wb_miibus;
bus_space_handle_t wb_bhandle;
bus_space_tag_t wb_btag;
diff --git a/sys/pci/if_xl.c b/sys/pci/if_xl.c
index 5870bb4..3d019c7 100644
--- a/sys/pci/if_xl.c
+++ b/sys/pci/if_xl.c
@@ -391,7 +391,7 @@ xl_wait(struct xl_softc *sc)
}
if (i == XL_TIMEOUT)
- if_printf(sc->xl_ifp, "command never completed!\n");
+ device_printf(sc->xl_dev, "command never completed!\n");
}
/*
@@ -656,8 +656,7 @@ xl_miibus_mediainit(device_t dev)
if (sc->xl_type == XL_TYPE_905B &&
sc->xl_media == XL_MEDIAOPT_10FL) {
if (bootverbose)
- if_printf(sc->xl_ifp,
- "found 10baseFL\n");
+ device_printf(sc->xl_dev, "found 10baseFL\n");
ifmedia_add(ifm, IFM_ETHER | IFM_10_FL, 0, NULL);
ifmedia_add(ifm, IFM_ETHER | IFM_10_FL|IFM_HDX, 0,
NULL);
@@ -666,14 +665,14 @@ xl_miibus_mediainit(device_t dev)
IFM_ETHER | IFM_10_FL | IFM_FDX, 0, NULL);
} else {
if (bootverbose)
- if_printf(sc->xl_ifp, "found AUI\n");
+ device_printf(sc->xl_dev, "found AUI\n");
ifmedia_add(ifm, IFM_ETHER | IFM_10_5, 0, NULL);
}
}
if (sc->xl_media & XL_MEDIAOPT_BNC) {
if (bootverbose)
- if_printf(sc->xl_ifp, "found BNC\n");
+ device_printf(sc->xl_dev, "found BNC\n");
ifmedia_add(ifm, IFM_ETHER | IFM_10_2, 0, NULL);
}
}
@@ -695,7 +694,7 @@ xl_eeprom_wait(struct xl_softc *sc)
}
if (i == 100) {
- if_printf(sc->xl_ifp, "eeprom failed to come ready\n");
+ device_printf(sc->xl_dev, "eeprom failed to come ready\n");
return (1);
}
@@ -984,7 +983,7 @@ xl_setmode(struct xl_softc *sc, int media)
DELAY(800);
XL_SEL_WIN(7);
- if_printf(sc->xl_ifp, "selecting %s, %s duplex\n", pmsg, dmsg);
+ device_printf(sc->xl_dev, "selecting %s, %s duplex\n", pmsg, dmsg);
}
static void
@@ -1016,7 +1015,7 @@ xl_reset(struct xl_softc *sc)
}
if (i == XL_TIMEOUT)
- if_printf(sc->xl_ifp, "reset didn't complete\n");
+ device_printf(sc->xl_dev, "reset didn't complete\n");
/* Reset TX and RX. */
/* Note: the RX reset takes an absurd amount of time
@@ -1099,20 +1098,20 @@ xl_mediacheck(struct xl_softc *sc)
if (sc->xl_xcvr <= XL_XCVR_AUTO)
return;
else {
- if_printf(sc->xl_ifp,
+ device_printf(sc->xl_dev,
"bogus xcvr value in EEPROM (%x)\n", sc->xl_xcvr);
- if_printf(sc->xl_ifp,
+ device_printf(sc->xl_dev,
"choosing new default based on card type\n");
}
} else {
if (sc->xl_type == XL_TYPE_905B &&
sc->xl_media & XL_MEDIAOPT_10FL)
return;
- if_printf(sc->xl_ifp,
+ device_printf(sc->xl_dev,
"WARNING: no media options bits set in the media options register!!\n");
- if_printf(sc->xl_ifp,
+ device_printf(sc->xl_dev,
"this could be a manufacturing defect in your adapter or system\n");
- if_printf(sc->xl_ifp,
+ device_printf(sc->xl_dev,
"attempting to guess media type; you should probably consult your vendor\n");
}
@@ -1137,7 +1136,7 @@ xl_choose_xcvr(struct xl_softc *sc, int verbose)
sc->xl_media = XL_MEDIAOPT_BT;
sc->xl_xcvr = XL_XCVR_10BT;
if (verbose)
- if_printf(sc->xl_ifp,
+ device_printf(sc->xl_dev,
"guessing 10BaseT transceiver\n");
break;
case TC_DEVICEID_BOOMERANG_10BT_COMBO: /* 3c900-COMBO */
@@ -1145,20 +1144,20 @@ xl_choose_xcvr(struct xl_softc *sc, int verbose)
sc->xl_media = XL_MEDIAOPT_BT|XL_MEDIAOPT_BNC|XL_MEDIAOPT_AUI;
sc->xl_xcvr = XL_XCVR_10BT;
if (verbose)
- if_printf(sc->xl_ifp,
+ device_printf(sc->xl_dev,
"guessing COMBO (AUI/BNC/TP)\n");
break;
case TC_DEVICEID_KRAKATOA_10BT_TPC: /* 3c900B-TPC */
sc->xl_media = XL_MEDIAOPT_BT|XL_MEDIAOPT_BNC;
sc->xl_xcvr = XL_XCVR_10BT;
if (verbose)
- if_printf(sc->xl_ifp, "guessing TPC (BNC/TP)\n");
+ device_printf(sc->xl_dev, "guessing TPC (BNC/TP)\n");
break;
case TC_DEVICEID_CYCLONE_10FL: /* 3c900B-FL */
sc->xl_media = XL_MEDIAOPT_10FL;
sc->xl_xcvr = XL_XCVR_AUI;
if (verbose)
- if_printf(sc->xl_ifp, "guessing 10baseFL\n");
+ device_printf(sc->xl_dev, "guessing 10baseFL\n");
break;
case TC_DEVICEID_BOOMERANG_10_100BT: /* 3c905-TX */
case TC_DEVICEID_HURRICANE_555: /* 3c555 */
@@ -1175,15 +1174,14 @@ xl_choose_xcvr(struct xl_softc *sc, int verbose)
sc->xl_media = XL_MEDIAOPT_MII;
sc->xl_xcvr = XL_XCVR_MII;
if (verbose)
- if_printf(sc->xl_ifp, "guessing MII\n");
+ device_printf(sc->xl_dev, "guessing MII\n");
break;
case TC_DEVICEID_BOOMERANG_100BT4: /* 3c905-T4 */
case TC_DEVICEID_CYCLONE_10_100BT4: /* 3c905B-T4 */
sc->xl_media = XL_MEDIAOPT_BT4;
sc->xl_xcvr = XL_XCVR_MII;
if (verbose)
- if_printf(sc->xl_ifp,
- "guessing 100baseT4/MII\n");
+ device_printf(sc->xl_dev, "guessing 100baseT4/MII\n");
break;
case TC_DEVICEID_HURRICANE_10_100BT: /* 3c905B-TX */
case TC_DEVICEID_HURRICANE_10_100BT_SERV:/*3c980-TX */
@@ -1194,18 +1192,17 @@ xl_choose_xcvr(struct xl_softc *sc, int verbose)
sc->xl_media = XL_MEDIAOPT_BTX;
sc->xl_xcvr = XL_XCVR_AUTO;
if (verbose)
- if_printf(sc->xl_ifp,
- "guessing 10/100 internal\n");
+ device_printf(sc->xl_dev, "guessing 10/100 internal\n");
break;
case TC_DEVICEID_CYCLONE_10_100_COMBO: /* 3c905B-COMBO */
sc->xl_media = XL_MEDIAOPT_BTX|XL_MEDIAOPT_BNC|XL_MEDIAOPT_AUI;
sc->xl_xcvr = XL_XCVR_AUTO;
if (verbose)
- if_printf(sc->xl_ifp,
+ device_printf(sc->xl_dev,
"guessing 10/100 plus BNC/AUI\n");
break;
default:
- if_printf(sc->xl_ifp,
+ device_printf(sc->xl_dev,
"unknown device ID: %x -- defaulting to 10baseT\n", devid);
sc->xl_media = XL_MEDIAOPT_BT;
break;
@@ -1228,6 +1225,8 @@ xl_attach(device_t dev)
uint16_t did;
sc = device_get_softc(dev);
+ sc->xl_dev = dev;
+
unit = device_get_unit(dev);
mtx_init(&sc->xl_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK,
@@ -1663,7 +1662,7 @@ xl_choose_media(struct xl_softc *sc, int *media)
*media = IFM_ETHER|IFM_100_FX;
break;
default:
- if_printf(sc->xl_ifp, "unknown XCVR type: %d\n",
+ device_printf(sc->xl_dev, "unknown XCVR type: %d\n",
sc->xl_xcvr);
/*
* This will probably be wrong, but it prevents
@@ -1911,7 +1910,7 @@ xl_newbuf(struct xl_softc *sc, struct xl_chain_onefrag *c)
xl_dma_map_rxbuf, &baddr, BUS_DMA_NOWAIT);
if (error) {
m_freem(m_new);
- if_printf(sc->xl_ifp, "can't map mbuf (error %d)\n",
+ device_printf(sc->xl_dev, "can't map mbuf (error %d)\n",
error);
return (error);
}
@@ -2010,7 +2009,7 @@ again:
* If not, something truly strange has happened.
*/
if (!(rxstat & XL_RXSTAT_UP_CMPLT)) {
- if_printf(ifp,
+ device_printf(sc->xl_dev,
"bad receive status -- packet dropped\n");
ifp->if_ierrors++;
cur_rx->xl_ptr->xl_status = 0;
@@ -2225,7 +2224,7 @@ xl_txeoc(struct xl_softc *sc)
if (txstat & XL_TXSTATUS_UNDERRUN ||
txstat & XL_TXSTATUS_JABBER ||
txstat & XL_TXSTATUS_RECLAIM) {
- if_printf(sc->xl_ifp,
+ device_printf(sc->xl_dev,
"transmission error: %x\n", txstat);
CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_TX_RESET);
xl_wait(sc);
@@ -2253,7 +2252,7 @@ xl_txeoc(struct xl_softc *sc)
if (txstat & XL_TXSTATUS_UNDERRUN &&
sc->xl_tx_thresh < XL_PACKET_SIZE) {
sc->xl_tx_thresh += XL_MIN_FRAMELEN;
- if_printf(sc->xl_ifp,
+ device_printf(sc->xl_dev,
"tx underrun, increasing tx start threshold to %d bytes\n", sc->xl_tx_thresh);
}
CSR_WRITE_2(sc, XL_COMMAND,
@@ -2824,7 +2823,7 @@ xl_init_locked(struct xl_softc *sc)
/* Init circular RX list. */
error = xl_list_rx_init(sc);
if (error) {
- if_printf(ifp, "initialization of the rx ring failed (%d)\n",
+ device_printf(sc->xl_dev, "initialization of the rx ring failed (%d)\n",
error);
xl_stop(sc);
return;
@@ -2836,7 +2835,7 @@ xl_init_locked(struct xl_softc *sc)
else
error = xl_list_tx_init(sc);
if (error) {
- if_printf(ifp, "initialization of the tx ring failed (%d)\n",
+ device_printf(sc->xl_dev, "initialization of the tx ring failed (%d)\n",
error);
xl_stop(sc);
return;
diff --git a/sys/pci/if_xlreg.h b/sys/pci/if_xlreg.h
index f999b71..c72509a 100644
--- a/sys/pci/if_xlreg.h
+++ b/sys/pci/if_xlreg.h
@@ -581,6 +581,7 @@ struct xl_mii_frame {
struct xl_softc {
struct ifnet *xl_ifp; /* interface info */
+ device_t xl_dev; /* device info */
struct ifmedia ifmedia; /* media info */
bus_space_handle_t xl_bhandle;
bus_space_tag_t xl_btag;
OpenPOWER on IntegriCloud