summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorJason Wright <jason@cvs.openbsd.org>2003-04-29 21:39:35 +0000
committerJason Wright <jason@cvs.openbsd.org>2003-04-29 21:39:35 +0000
commit5b6f51120e9295cc52f7fe84b01298cbc173afb8 (patch)
tree82f87d2419fdba1780b55188a19a09abd2cdaaac /sys/dev
parent7b778aa2455879c1d86c006e363ced82681144f1 (diff)
- remove last vestige of "old autoconf": dc_unit is dead, long live dv_xname
- remove a bunch of #if 0 stuff (most of which referred to dc_unit, grr) - delay a bzero until necessary
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/cardbus/if_dc_cardbus.c3
-rw-r--r--sys/dev/ic/dc.c54
-rw-r--r--sys/dev/ic/dcreg.h3
-rw-r--r--sys/dev/pci/if_dc_pci.c11
4 files changed, 27 insertions, 44 deletions
diff --git a/sys/dev/cardbus/if_dc_cardbus.c b/sys/dev/cardbus/if_dc_cardbus.c
index 891edd1a86e..b90f26a6a4b 100644
--- a/sys/dev/cardbus/if_dc_cardbus.c
+++ b/sys/dev/cardbus/if_dc_cardbus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_dc_cardbus.c,v 1.12 2002/07/23 17:34:14 drahn Exp $ */
+/* $OpenBSD: if_dc_cardbus.c,v 1.13 2003/04/29 21:39:34 jason Exp $ */
#include <sys/param.h>
#include <sys/systm.h>
@@ -104,7 +104,6 @@ dc_cardbus_attach(parent, self, aux)
bus_addr_t addr;
sc->sc_dmat = ca->ca_dmat;
- sc->dc_unit = sc->sc_dev.dv_unit;
csc->sc_ct = ct;
csc->sc_tag = ca->ca_tag;
diff --git a/sys/dev/ic/dc.c b/sys/dev/ic/dc.c
index 508ac0ca4f6..54f116a4047 100644
--- a/sys/dev/ic/dc.c
+++ b/sys/dev/ic/dc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dc.c,v 1.56 2003/04/29 15:19:12 jason Exp $ */
+/* $OpenBSD: dc.c,v 1.57 2003/04/29 21:39:34 jason Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
@@ -631,8 +631,6 @@ dc_miibus_readreg(self, phy, reg)
struct dc_softc *sc = (struct dc_softc *)self;
int i, rval, phy_reg;
- bzero((char *)&frame, sizeof(frame));
-
/*
* Note: both the AL981 and AN983 have internal PHYs,
* however the AL981 provides direct access to the PHY
@@ -650,7 +648,6 @@ dc_miibus_readreg(self, phy, reg)
* MII address 0 (possibly HomePNA?) and 1 (ethernet)
* so we only respond to correct one.
*/
-
if (DC_IS_CONEXANT(sc) && phy != DC_CONEXANT_PHYADDR)
return (0);
@@ -720,8 +717,8 @@ dc_miibus_readreg(self, phy, reg)
phy_reg = DC_AL_ANER;
break;
default:
- printf("dc%d: phy_read: bad phy register %x\n",
- sc->dc_unit, reg);
+ printf("dc%s: phy_read: bad phy register %x\n",
+ sc->sc_dev.dv_xname, reg);
return (0);
break;
}
@@ -733,6 +730,8 @@ dc_miibus_readreg(self, phy, reg)
return (rval);
}
+ bzero(&frame, sizeof(frame));
+
frame.mii_phyaddr = phy;
frame.mii_regaddr = reg;
if (sc->dc_type == DC_TYPE_98713) {
@@ -796,8 +795,8 @@ dc_miibus_writereg(self, phy, reg, data)
phy_reg = DC_AL_ANER;
break;
default:
- printf("dc%d: phy_write: bad phy register %x\n",
- sc->dc_unit, reg);
+ printf("%s: phy_write: bad phy register %x\n",
+ sc->sc_dev.dv_xname, reg);
return;
break;
}
@@ -1250,8 +1249,8 @@ dc_setcfg(sc, media)
}
if (i == DC_TIMEOUT)
- printf("dc%d: failed to force tx and "
- "rx to idle state\n", sc->dc_unit);
+ printf("%s: failed to force tx and "
+ "rx to idle state\n", sc->sc_dev.dv_xname);
}
@@ -1397,7 +1396,7 @@ dc_reset(sc)
}
if (i == DC_TIMEOUT)
- printf("dc%d: reset never completed!\n", sc->dc_unit);
+ printf("%s: reset never completed!\n", sc->sc_dev.dv_xname);
/* Wait a little while for the chip to get its brains in order. */
DELAY(1000);
@@ -1768,7 +1767,7 @@ hasmac:
}
if (error) {
- printf("dc%d: MII without any PHY!\n", sc->dc_unit);
+ printf("%s: MII without any PHY!\n", sc->sc_dev.dv_xname);
error = ENXIO;
goto fail;
}
@@ -1907,15 +1906,15 @@ dc_newbuf(sc, i, m)
if (m == NULL) {
MGETHDR(m_new, M_DONTWAIT, MT_DATA);
if (m_new == NULL) {
- printf("dc%d: no memory for rx list "
- "-- packet dropped!\n", sc->dc_unit);
+ printf("dc%s: no memory for rx list "
+ "-- packet dropped!\n", sc->sc_dev.dv_xname);
return (ENOBUFS);
}
MCLGET(m_new, M_DONTWAIT);
if (!(m_new->m_flags & M_EXT)) {
- printf("dc%d: no memory for rx list "
- "-- packet dropped!\n", sc->dc_unit);
+ printf("dc%s: no memory for rx list "
+ "-- packet dropped!\n", sc->sc_dev.dv_xname);
m_freem(m_new);
return (ENOBUFS);
}
@@ -2476,27 +2475,15 @@ dc_intr(arg)
if (status & DC_ISR_TX_UNDERRUN) {
u_int32_t cfg;
-#if 0
- printf("dc%d: TX underrun -- ", sc->dc_unit);
-#endif
if (DC_IS_DAVICOM(sc) || DC_IS_INTEL(sc))
dc_init(sc);
cfg = CSR_READ_4(sc, DC_NETCFG);
cfg &= ~DC_NETCFG_TX_THRESH;
if (sc->dc_txthresh == DC_TXTHRESH_160BYTES) {
-#if 0
- printf("using store and forward mode\n");
-#endif
DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_STORENFWD);
} else if (sc->dc_flags & DC_TX_STORENFWD) {
-#if 0
- printf("resetting\n");
-#endif
} else {
sc->dc_txthresh += 0x4000;
-#if 0
- printf("increasing TX threshold\n");
-#endif
CSR_WRITE_4(sc, DC_NETCFG, cfg);
DC_SETBIT(sc, DC_NETCFG, sc->dc_txthresh);
DC_CLRBIT(sc, DC_NETCFG, DC_NETCFG_STORENFWD);
@@ -2633,14 +2620,15 @@ dc_coal(sc, m_head)
m = *m_head;
MGETHDR(m_new, M_DONTWAIT, MT_DATA);
if (m_new == NULL) {
- printf("dc%d: no memory for tx list", sc->dc_unit);
+ printf("dc%s: no memory for tx list", sc->sc_dev.dv_xname);
return (ENOBUFS);
}
if (m->m_pkthdr.len > MHLEN) {
MCLGET(m_new, M_DONTWAIT);
if (!(m_new->m_flags & M_EXT)) {
m_freem(m_new);
- printf("dc%d: no memory for tx list", sc->dc_unit);
+ printf("dc%s: no memory for tx list",
+ sc->sc_dev.dv_xname);
return (ENOBUFS);
}
}
@@ -2826,8 +2814,8 @@ dc_init(xsc)
/* Init circular RX list. */
if (dc_list_rx_init(sc) == ENOBUFS) {
- printf("dc%d: initialization failed: no "
- "memory for rx buffers\n", sc->dc_unit);
+ printf("%s: initialization failed: no "
+ "memory for rx buffers\n", sc->sc_dev.dv_xname);
dc_stop(sc);
splx(s);
return;
@@ -3057,7 +3045,7 @@ dc_watchdog(ifp)
sc = ifp->if_softc;
ifp->if_oerrors++;
- printf("dc%d: watchdog timeout\n", sc->dc_unit);
+ printf("%s: watchdog timeout\n", sc->sc_dev.dv_xname);
dc_stop(sc);
dc_reset(sc);
diff --git a/sys/dev/ic/dcreg.h b/sys/dev/ic/dcreg.h
index e6d3d8dc82b..2cd64b9c21a 100644
--- a/sys/dev/ic/dcreg.h
+++ b/sys/dev/ic/dcreg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: dcreg.h,v 1.27 2002/10/20 16:46:27 henning Exp $ */
+/* $OpenBSD: dcreg.h,v 1.28 2003/04/29 21:39:34 jason Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
@@ -705,7 +705,6 @@ struct dc_softc {
void *sc_dhook;
struct resource *dc_irq;
struct resource *dc_res;
- u_int8_t dc_unit; /* interface number */
u_int8_t dc_type;
u_int8_t dc_pmode;
u_int8_t dc_link;
diff --git a/sys/dev/pci/if_dc_pci.c b/sys/dev/pci/if_dc_pci.c
index 5b02d14980d..31138c643c2 100644
--- a/sys/dev/pci/if_dc_pci.c
+++ b/sys/dev/pci/if_dc_pci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_dc_pci.c,v 1.35 2003/04/19 11:54:02 henning Exp $ */
+/* $OpenBSD: if_dc_pci.c,v 1.36 2003/04/29 21:39:34 jason Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
@@ -165,9 +165,6 @@ void dc_pci_acpi(self, aux)
struct pci_attach_args *pa = (struct pci_attach_args *)aux;
pci_chipset_tag_t pc = pa->pa_pc;
u_int32_t r, cptr;
- int unit;
-
- unit = sc->dc_unit;
/* Find the location of the capabilities block */
cptr = pci_conf_read(pc, pa->pa_tag, DC_PCI_CCAP) & 0xFF;
@@ -185,8 +182,9 @@ void dc_pci_acpi(self, aux)
irq = pci_conf_read(pc, pa->pa_tag, DC_PCI_CFIT);
/* Reset the power state. */
- printf("dc%d: chip is in D%d power mode "
- "-- setting to D0\n", unit, r & DC_PSTATE_D3);
+ printf("%s: chip is in D%d power mode "
+ "-- setting to D0\n", sc->sc_dev.dv_xname,
+ r & DC_PSTATE_D3);
r &= 0xFFFFFFFC;
pci_conf_write(pc, pa->pa_tag, cptr + 4, r);
@@ -221,7 +219,6 @@ void dc_pci_attach(parent, self, aux)
s = splimp();
sc->sc_dmat = pa->pa_dmat;
- sc->dc_unit = sc->sc_dev.dv_unit;
/*
* Handle power management nonsense.