summaryrefslogtreecommitdiffstats
path: root/sys/dev
diff options
context:
space:
mode:
authormdodd <mdodd@FreeBSD.org>1999-08-20 14:12:14 +0000
committermdodd <mdodd@FreeBSD.org>1999-08-20 14:12:14 +0000
commit732c3788e6a0ccbde759d4160e870f034eb4aa51 (patch)
treec9fca1c5132474316433189f4c1a4f4edf4cb140 /sys/dev
parentc6637d28b3ca72411273a6044b5ac622089d3bf3 (diff)
downloadFreeBSD-src-732c3788e6a0ccbde759d4160e870f034eb4aa51.zip
FreeBSD-src-732c3788e6a0ccbde759d4160e870f034eb4aa51.tar.gz
Set ifp->if_init to the right function.
if_init_f_t is passed void * containing the address of ifp->if_softc not the unit number. Someone tell me if these things don't work as I don't have the hardware needed to test them. (thats a first.) I'll get if_ze and if_zp later. Pointed out by: Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/ep/if_ep.c10
-rw-r--r--sys/dev/ie/if_ie.c34
-rw-r--r--sys/dev/lnc/if_lnc.c9
3 files changed, 31 insertions, 22 deletions
diff --git a/sys/dev/ep/if_ep.c b/sys/dev/ep/if_ep.c
index 22daafb..d1f3460 100644
--- a/sys/dev/ep/if_ep.c
+++ b/sys/dev/ep/if_ep.c
@@ -38,7 +38,7 @@
*/
/*
- * $Id: if_ep.c,v 1.82 1999/08/18 06:11:58 mdodd Exp $
+ * $Id: if_ep.c,v 1.83 1999/08/18 22:14:20 mdodd Exp $
*
* Promiscuous mode added and interrupt logic slightly changed
* to reduce the number of adapter failures. Transceiver select
@@ -112,7 +112,7 @@ static struct ep_board * ep_look_for_board_at __P((struct isa_device *is));
static int ep_isa_attach __P((struct isa_device *));
static int epioctl __P((struct ifnet * ifp, u_long, caddr_t));
-static void epinit __P((struct ep_softc *));
+static void epinit __P((void *));
static ointhand2_t epintr;
static void epread __P((struct ep_softc *));
void epreset __P((int));
@@ -636,6 +636,7 @@ ep_attach(sc)
ifp->if_start = epstart;
ifp->if_ioctl = epioctl;
ifp->if_watchdog = epwatchdog;
+ ifp->if_init = epinit;
if (!attached) {
if_attach(ifp);
@@ -664,9 +665,10 @@ ep_attach(sc)
* interrupts. ?!
*/
static void
-epinit(sc)
- struct ep_softc *sc;
+epinit(xsc)
+ void *xsc;
{
+ struct ep_softc *sc = xsc;
register struct ifnet *ifp = &sc->arpcom.ac_if;
int s, i, j;
diff --git a/sys/dev/ie/if_ie.c b/sys/dev/ie/if_ie.c
index 5c643ca..29276ab 100644
--- a/sys/dev/ie/if_ie.c
+++ b/sys/dev/ie/if_ie.c
@@ -47,7 +47,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: if_ie.c,v 1.62 1999/08/18 06:11:59 mdodd Exp $
+ * $Id: if_ie.c,v 1.63 1999/08/18 22:14:22 mdodd Exp $
*/
/*
@@ -172,7 +172,7 @@ static int ni_probe(struct isa_device * dvp);
static int ee16_probe(struct isa_device * dvp);
static int check_ie_present(int unit, caddr_t where, unsigned size);
-static void ieinit(int unit);
+static void ieinit(void *);
static void ie_stop(int unit);
static int ieioctl(struct ifnet * ifp, u_long command, caddr_t data);
static void iestart(struct ifnet * ifp);
@@ -285,6 +285,7 @@ static struct ie_softc {
void (*ie_chan_attn) (int);
enum ie_hardware hard_type;
int hard_vers;
+ int unit;
u_short port; /* i/o base address for this interface */
caddr_t iomem; /* memory size */
@@ -412,6 +413,7 @@ el_probe(struct isa_device *dvp)
u_char signature[] = "*3COM*";
int unit = dvp->id_unit;
+ sc->unit = unit;
sc->port = dvp->id_iobase;
sc->iomembot = dvp->id_maddr;
sc->bus_use = 0;
@@ -824,6 +826,7 @@ ieattach(struct isa_device *dvp)
ifp->if_output = ether_output;
ifp->if_start = iestart;
ifp->if_ioctl = ieioctl;
+ ifp->if_init = ieinit;
ifp->if_type = IFT_ETHER;
ifp->if_addrlen = 6;
ifp->if_hdrlen = 14;
@@ -2121,9 +2124,10 @@ mc_setup(int unit, v_caddr_t ptr,
* THIS ROUTINE MUST BE CALLED AT splimp() OR HIGHER.
*/
static void
-ieinit(int unit)
+ieinit(xsc)
+ void *xsc;
{
- struct ie_softc *ie = &ie_softc[unit];
+ struct ie_softc *ie = xsc;
volatile struct ie_sys_ctl_block *scb = ie->scb;
v_caddr_t ptr;
int i;
@@ -2144,9 +2148,9 @@ ieinit(int unit)
scb->ie_command_list = MK_16(MEM, cmd);
- if (command_and_wait(unit, IE_CU_START, cmd, IE_STAT_COMPL)
+ if (command_and_wait(sc->unit, IE_CU_START, cmd, IE_STAT_COMPL)
|| !(cmd->com.ie_cmd_status & IE_STAT_OK)) {
- printf("ie%d: configure command failed\n", unit);
+ printf("ie%d: configure command failed\n", sc->unit);
return;
}
}
@@ -2160,13 +2164,13 @@ ieinit(int unit)
cmd->com.ie_cmd_cmd = IE_CMD_IASETUP | IE_CMD_LAST;
cmd->com.ie_cmd_link = 0xffff;
- bcopy((volatile char *)ie_softc[unit].arpcom.ac_enaddr,
+ bcopy((volatile char *)ie_softc[sc->unit].arpcom.ac_enaddr,
(volatile char *)&cmd->ie_address, sizeof cmd->ie_address);
scb->ie_command_list = MK_16(MEM, cmd);
- if (command_and_wait(unit, IE_CU_START, cmd, IE_STAT_COMPL)
+ if (command_and_wait(sc->unit, IE_CU_START, cmd, IE_STAT_COMPL)
|| !(cmd->com.ie_cmd_status & IE_STAT_OK)) {
printf("ie%d: individual address "
- "setup command failed\n", unit);
+ "setup command failed\n", sc->unit);
return;
}
}
@@ -2174,12 +2178,12 @@ ieinit(int unit)
/*
* Now run the time-domain reflectometer.
*/
- run_tdr(unit, (volatile void *) ptr);
+ run_tdr(sc->unit, (volatile void *) ptr);
/*
* Acknowledge any interrupts we have generated thus far.
*/
- ie_ack(ie->scb, IE_ST_WHENCE, unit, ie->ie_chan_attn);
+ ie_ack(ie->scb, IE_ST_WHENCE, sc->unit, ie->ie_chan_attn);
/*
* Set up the RFA.
@@ -2229,11 +2233,11 @@ ieinit(int unit)
bart_config |= IEE16_BART_MCS16_TEST;
outb(PORT + IEE16_CONFIG, bart_config);
ee16_interrupt_enable(ie);
- ee16_chan_attn(unit);
+ ee16_chan_attn(sc->unit);
}
ie->arpcom.ac_if.if_flags |= IFF_RUNNING; /* tell higher levels
* we're here */
- start_receiver(unit);
+ start_receiver(sc->unit);
return;
}
@@ -2272,12 +2276,12 @@ ieioctl(struct ifnet *ifp, u_long command, caddr_t data)
(ifp->if_flags & IFF_RUNNING) == 0) {
ie_softc[ifp->if_unit].promisc =
ifp->if_flags & (IFF_PROMISC | IFF_ALLMULTI);
- ieinit(ifp->if_unit);
+ ieinit(ifp->if_softc);
} else if (ie_softc[ifp->if_unit].promisc ^
(ifp->if_flags & (IFF_PROMISC | IFF_ALLMULTI))) {
ie_softc[ifp->if_unit].promisc =
ifp->if_flags & (IFF_PROMISC | IFF_ALLMULTI);
- ieinit(ifp->if_unit);
+ ieinit(ifp->if_softc);
}
break;
diff --git a/sys/dev/lnc/if_lnc.c b/sys/dev/lnc/if_lnc.c
index ee75beb..058ca3f 100644
--- a/sys/dev/lnc/if_lnc.c
+++ b/sys/dev/lnc/if_lnc.c
@@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: if_lnc.c,v 1.63 1999/08/18 06:11:59 mdodd Exp $
+ * $Id: if_lnc.c,v 1.64 1999/08/18 22:14:23 mdodd Exp $
*/
/*
@@ -180,7 +180,7 @@ static int lance_probe __P((struct lnc_softc *sc));
static int pcnet_probe __P((struct lnc_softc *sc));
static int lnc_attach_sc __P((struct lnc_softc *sc, int unit));
static int lnc_attach __P((struct isa_device *isa_dev));
-static void lnc_init __P((struct lnc_softc *sc));
+static void lnc_init __P((void *));
static ointhand2_t lncintr;
static __inline int mbuf_to_buffer __P((struct mbuf *m, char *buffer));
static __inline struct mbuf *chain_to_cluster __P((struct mbuf *m));
@@ -1278,6 +1278,7 @@ lnc_attach_sc(struct lnc_softc *sc, int unit)
sc->arpcom.ac_if.if_start = lnc_start;
sc->arpcom.ac_if.if_ioctl = lnc_ioctl;
sc->arpcom.ac_if.if_watchdog = lnc_watchdog;
+ sc->arpcom.ac_if.if_init = lnc_init;
sc->arpcom.ac_if.if_type = IFT_ETHER;
sc->arpcom.ac_if.if_addrlen = ETHER_ADDR_LEN;
sc->arpcom.ac_if.if_hdrlen = ETHER_HDR_LEN;
@@ -1372,8 +1373,10 @@ lnc_attach_ne2100_pci(int unit, unsigned iobase)
#endif
static void
-lnc_init(struct lnc_softc *sc)
+lnc_init(xsc)
+ void *xsc;
{
+ struct lnc_softc *sc = xsc;
int s, i;
char *lnc_mem;
OpenPOWER on IntegriCloud