cosmetic changes before i do some functional changes.

This commit is contained in:
enami 1999-10-20 16:34:22 +00:00
parent 3eac94ab90
commit 8a5c548579
1 changed files with 40 additions and 33 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: elink3.c,v 1.59 1999/10/11 17:48:20 thorpej Exp $ */
/* $NetBSD: elink3.c,v 1.60 1999/10/20 16:34:22 enami Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -202,11 +202,11 @@ void ep_509_probemedia __P((struct ep_softc *sc));
static void eptxstat __P((struct ep_softc *));
static int epstatus __P((struct ep_softc *));
void epinit __P((struct ep_softc *));
int epioctl __P((struct ifnet *, u_long, caddr_t));
void epstart __P((struct ifnet *));
void epwatchdog __P((struct ifnet *));
void epreset __P((struct ep_softc *));
void epinit __P((struct ep_softc *));
int epioctl __P((struct ifnet *, u_long, caddr_t));
void epstart __P((struct ifnet *));
void epwatchdog __P((struct ifnet *));
void epreset __P((struct ep_softc *));
static void epshutdown __P((void *));
void epread __P((struct ep_softc *));
struct mbuf *epget __P((struct ep_softc *, int));
@ -282,7 +282,8 @@ ep_finish_reset(iot, ioh)
int i;
for (i = 0; i < 10000; i++) {
if ((bus_space_read_2(iot, ioh, ELINK_STATUS) & S_COMMAND_IN_PROGRESS) == 0)
if ((bus_space_read_2(iot, ioh, ELINK_STATUS) &
S_COMMAND_IN_PROGRESS) == 0)
break;
DELAY(10);
}
@ -321,7 +322,8 @@ ep_discard_rxtop(iot, ioh)
* is about right.
*/
for (i = 0; i < 8000; i++) {
if ((bus_space_read_2(iot, ioh, ELINK_STATUS) & S_COMMAND_IN_PROGRESS) == 0)
if ((bus_space_read_2(iot, ioh, ELINK_STATUS) &
S_COMMAND_IN_PROGRESS) == 0)
return;
}
@ -378,7 +380,7 @@ epconfig(sc, chipset, enaddr)
* threshold value was shifted or not.
*/
bus_space_write_2(iot, ioh, ELINK_COMMAND,
SET_TX_AVAIL_THRESH | ELINK_LARGEWIN_PROBE );
SET_TX_AVAIL_THRESH | ELINK_LARGEWIN_PROBE);
GO_WINDOW(5);
i = bus_space_read_2(iot, ioh, ELINK_W5_TX_AVAIL_THRESH);
GO_WINDOW(1);
@ -494,13 +496,12 @@ epconfig(sc, chipset, enaddr)
GO_WINDOW(1); /* Window 1 is operating window */
#if NBPFILTER > 0
bpfattach(&sc->sc_ethercom.ec_if.if_bpf, ifp, DLT_EN10MB,
sizeof(struct ether_header));
bpfattach(ifp->if_bpf, ifp, DLT_EN10MB, sizeof(struct ether_header));
#endif
#if NRND > 0
rnd_attach_source(&sc->rnd_source, sc->sc_dev.dv_xname,
RND_TYPE_NET, 0);
RND_TYPE_NET, 0);
#endif
sc->tx_start_thresh = 20; /* probably a good starting point. */
@ -537,7 +538,8 @@ ep_internalconfig(sc)
GO_WINDOW(3);
config0 = (u_int)bus_space_read_2(iot, ioh, ELINK_W3_INTERNAL_CONFIG);
config1 = (u_int)bus_space_read_2(iot, ioh, ELINK_W3_INTERNAL_CONFIG + 2);
config1 = (u_int)bus_space_read_2(iot, ioh,
ELINK_W3_INTERNAL_CONFIG + 2);
GO_WINDOW(0);
ram_size = (config0 & CONFIG_RAMSIZE) >> CONFIG_RAMSIZE_SHIFT;
@ -644,7 +646,8 @@ ep_vortex_probemedia(sc)
const char *sep = "", *defmedianame = NULL;
GO_WINDOW(3);
config1 = (u_int)bus_space_read_2(iot, ioh, ELINK_W3_INTERNAL_CONFIG + 2);
config1 = (u_int)bus_space_read_2(iot, ioh,
ELINK_W3_INTERNAL_CONFIG + 2);
reset_options = (int)bus_space_read_1(iot, ioh, ELINK_W3_RESET_OPTIONS);
GO_WINDOW(0);
@ -741,7 +744,8 @@ epinit(sc)
if (sc->bustype != ELINK_BUS_PCI) {
GO_WINDOW(0);
bus_space_write_2(iot, ioh, ELINK_W0_CONFIG_CTRL, 0);
bus_space_write_2(iot, ioh, ELINK_W0_CONFIG_CTRL, ENABLE_DRQ_IRQ);
bus_space_write_2(iot, ioh, ELINK_W0_CONFIG_CTRL,
ENABLE_DRQ_IRQ);
}
if (sc->bustype == ELINK_BUS_PCMCIA) {
@ -799,10 +803,12 @@ epinit(sc)
}
/* Enable interrupts. */
bus_space_write_2(iot, ioh, ELINK_COMMAND, SET_RD_0_MASK | S_CARD_FAILURE |
S_RX_COMPLETE | S_TX_COMPLETE | S_TX_AVAIL);
bus_space_write_2(iot, ioh, ELINK_COMMAND, SET_INTR_MASK | S_CARD_FAILURE |
S_RX_COMPLETE | S_TX_COMPLETE | S_TX_AVAIL);
bus_space_write_2(iot, ioh, ELINK_COMMAND,
SET_RD_0_MASK | S_CARD_FAILURE | S_RX_COMPLETE | S_TX_COMPLETE |
S_TX_AVAIL);
bus_space_write_2(iot, ioh, ELINK_COMMAND,
SET_INTR_MASK | S_CARD_FAILURE | S_RX_COMPLETE | S_TX_COMPLETE |
S_TX_AVAIL);
/*
* Attempt to get rid of any stray interrupts that occured during
@ -846,10 +852,10 @@ epsetfilter(sc)
register struct ifnet *ifp = &sc->sc_ethercom.ec_if;
GO_WINDOW(1); /* Window 1 is operating window */
bus_space_write_2(sc->sc_iot, sc->sc_ioh, ELINK_COMMAND, SET_RX_FILTER |
FIL_INDIVIDUAL | FIL_BRDCST |
((ifp->if_flags & IFF_MULTICAST) ? FIL_MULTICAST : 0 ) |
((ifp->if_flags & IFF_PROMISC) ? FIL_PROMISC : 0 ));
bus_space_write_2(sc->sc_iot, sc->sc_ioh, ELINK_COMMAND,
SET_RX_FILTER | FIL_INDIVIDUAL | FIL_BRDCST |
((ifp->if_flags & IFF_MULTICAST) ? FIL_MULTICAST : 0) |
((ifp->if_flags & IFF_PROMISC) ? FIL_PROMISC : 0));
}
int
@ -921,8 +927,8 @@ epsetmedia(sc)
resopt = bus_space_read_2(iot, ioh,
ELINK_W3_RESET_OPTIONS);
bus_space_write_2(iot, ioh,
ELINK_W3_RESET_OPTIONS, resopt|ELINK_RUNNER_ENABLE_MII);
bus_space_write_2(iot, ioh, ELINK_W3_RESET_OPTIONS,
resopt | ELINK_RUNNER_ENABLE_MII);
}
#endif
@ -935,7 +941,8 @@ epsetmedia(sc)
config1 |= (ELINKMEDIA_MII << CONFIG_MEDIAMASK_SHIFT);
bus_space_write_2(iot, ioh, ELINK_W3_INTERNAL_CONFIG, config0);
bus_space_write_2(iot, ioh, ELINK_W3_INTERNAL_CONFIG + 2, config1);
bus_space_write_2(iot, ioh, ELINK_W3_INTERNAL_CONFIG + 2,
config1);
GO_WINDOW(1); /* back to operating window */
mii_mediachg(&sc->sc_mii);
@ -1141,7 +1148,7 @@ startagain:
return;
} else {
bus_space_write_2(iot, ioh, ELINK_COMMAND,
SET_TX_AVAIL_THRESH | ELINK_THRESH_DISABLE );
SET_TX_AVAIL_THRESH | ELINK_THRESH_DISABLE);
}
IF_DEQUEUE(&ifp->if_snd, m0);
@ -1149,7 +1156,7 @@ startagain:
return;
bus_space_write_2(iot, ioh, ELINK_COMMAND, SET_TX_START_THRESH |
((len / 4 + sc->tx_start_thresh) /* >> sc->ep_pktlenshift*/) );
((len / 4 + sc->tx_start_thresh) /* >> sc->ep_pktlenshift*/));
#if NBPFILTER > 0
if (ifp->if_bpf)
@ -1179,7 +1186,7 @@ startagain:
bus_space_write_2(iot, ioh, txreg, len);
bus_space_write_2(iot, ioh, txreg, 0xffff); /* Second is meaningless */
if (ELINK_IS_BUS_32(sc->bustype)) {
for (m = m0; m; ) {
for (m = m0; m;) {
if (m->m_len > 3) {
/* align our reads from core */
if (mtod(m, u_long) & 3) {
@ -1205,7 +1212,7 @@ startagain:
m = m0;
}
} else {
for (m = m0; m; ) {
for (m = m0; m;) {
if (m->m_len > 1) {
if (mtod(m, u_long) & 1) {
bus_space_write_1(iot, ioh,
@ -1328,8 +1335,8 @@ eptxstat(sc)
* We need to read+write TX_STATUS until we get a 0 status
* in order to turn off the interrupt flag.
*/
while ((i = bus_space_read_1(iot, ioh, ep_w1_reg(sc, ELINK_W1_TX_STATUS)))
& TXS_COMPLETE) {
while ((i = bus_space_read_1(iot, ioh,
ep_w1_reg(sc, ELINK_W1_TX_STATUS))) & TXS_COMPLETE) {
bus_space_write_1(iot, ioh, ep_w1_reg(sc, ELINK_W1_TX_STATUS),
0x0);
@ -1536,7 +1543,7 @@ again:
if ((ifp->if_flags & IFF_PROMISC) &&
(eh->ether_dhost[0] & 1) == 0 && /* !mcast and !bcast */
bcmp(eh->ether_dhost, LLADDR(sc->sc_ethercom.ec_if.if_sadl),
sizeof(eh->ether_dhost)) != 0) {
sizeof(eh->ether_dhost)) != 0) {
m_freem(m);
return;
}