diff --git a/sys/dev/scd/scd.c b/sys/dev/scd/scd.c index 15ad25ed505..7eeca7b004c 100644 --- a/sys/dev/scd/scd.c +++ b/sys/dev/scd/scd.c @@ -41,7 +41,7 @@ */ -/* $Id: scd.c,v 1.39 1998/07/04 22:30:17 julian Exp $ */ +/* $Id: scd.c,v 1.40 1998/07/13 09:53:02 bde Exp $ */ /* Please send any comments to micke@dynas.se */ @@ -201,7 +201,8 @@ static struct cdevsw scd_cdevsw = { D_DISK, 0, -1 }; -int scd_attach(struct isa_device *dev) +static int +scd_attach(struct isa_device *dev) { int unit = dev->id_unit; struct scd_data *cd = scd_data + unit; @@ -694,7 +695,13 @@ scd_subchan(int unit, struct ioc_read_subchannel *sc) return 0; } -int +static __inline void +write_control(unsigned port, unsigned data) +{ + outb(port + OREG_CONTROL, data); +} + +static int scd_probe(struct isa_device *dev) { struct sony_drive_configuration drive_config; @@ -1285,12 +1292,6 @@ read_toc(dev_t dev) return 0; } -static __inline void -write_control(unsigned port, unsigned data) -{ - outb(port + OREG_CONTROL, data); -} - static void init_drive(unsigned unit) { diff --git a/sys/i386/isa/if_el.c b/sys/i386/isa/if_el.c index dac89ffd578..f8aad8e4d02 100644 --- a/sys/i386/isa/if_el.c +++ b/sys/i386/isa/if_el.c @@ -6,7 +6,7 @@ * * Questions, comments, bug reports and fixes to kimmel@cs.umass.edu. * - * $Id: if_el.c,v 1.38 1998/10/22 05:58:39 bde Exp $ + * $Id: if_el.c,v 1.39 1998/12/07 21:58:21 archie Exp $ */ /* Except of course for the portions of code lifted from other FreeBSD * drivers (mainly elread, elget and el_ioctl) @@ -146,6 +146,29 @@ el_probe(struct isa_device *idev) } } +/* Do a hardware reset of the 3c501. Do not call until after el_probe()! */ +static __inline void +el_hardreset(int unit) +{ + register struct el_softc *sc; + register int base; + register int j; + + sc = &el_softc[unit]; + base = sc->el_base; + + /* First reset the board */ + outb(base+EL_AC,EL_AC_RESET); + DELAY(5); + outb(base+EL_AC,0); + + /* Then give it back its ethernet address. Thanks to the mach + * source code for this undocumented goodie... + */ + for(j=0;jarpcom.ac_enaddr[j]); +} + /* Attach the interface to the kernel data structures. By the time * this is called, we know that the card exists at the given I/O address. * We still assume that the IRQ given is correct. @@ -220,28 +243,6 @@ static void el_stop(int unit) outb(sc->el_base+EL_AC,0); } -/* Do a hardware reset of the 3c501. Do not call until after el_probe()! */ -static __inline void el_hardreset(int unit) -{ - register struct el_softc *sc; - register int base; - register int j; - - sc = &el_softc[unit]; - base = sc->el_base; - - /* First reset the board */ - outb(base+EL_AC,EL_AC_RESET); - DELAY(5); - outb(base+EL_AC,0); - - /* Then give it back its ethernet address. Thanks to the mach - * source code for this undocumented goodie... - */ - for(j=0;jarpcom.ac_enaddr[j]); -} - /* Initialize interface. */ static void el_init(int unit) @@ -405,7 +406,8 @@ el_start(struct ifnet *ifp) * to the board. Call at splimp or interrupt, after downloading data! * Returns 0 on success, non-0 on failure */ -static int el_xmit(struct el_softc *sc,int len) +static int +el_xmit(struct el_softc *sc,int len) { int gpl; int i; @@ -427,8 +429,53 @@ static int el_xmit(struct el_softc *sc,int len) return(0); } +/* Pass a packet up to the higher levels. */ +static __inline void +elread(struct el_softc *sc,caddr_t buf,int len) +{ + register struct ether_header *eh; + struct mbuf *m; + + eh = (struct ether_header *)buf; + +#if NBPFILTER > 0 + /* + * Check if there's a bpf filter listening on this interface. + * If so, hand off the raw packet to bpf. + */ + if(sc->arpcom.ac_if.if_bpf) { + bpf_tap(&sc->arpcom.ac_if, buf, + len + sizeof(struct ether_header)); + + /* + * Note that the interface cannot be in promiscuous mode if + * there are no bpf listeners. And if el are in promiscuous + * mode, el have to check if this packet is really ours. + * + * This test does not support multicasts. + */ + if((sc->arpcom.ac_if.if_flags & IFF_PROMISC) + && bcmp(eh->ether_dhost,sc->arpcom.ac_enaddr, + sizeof(eh->ether_dhost)) != 0 + && bcmp(eh->ether_dhost,etherbroadcastaddr, + sizeof(eh->ether_dhost)) != 0) + return; + } +#endif + + /* + * Pull packet off interface. + */ + m = elget(buf,len,0,&sc->arpcom.ac_if); + if(m == 0) + return; + + ether_input(&sc->arpcom.ac_if,eh,m); +} + /* controller interrupt */ -static void elintr(int unit) +static void +elintr(int unit) { register struct el_softc *sc; register int base; @@ -523,49 +570,6 @@ static void elintr(int unit) return; } -/* Pass a packet up to the higher levels. */ -static __inline void elread(struct el_softc *sc,caddr_t buf,int len) -{ - register struct ether_header *eh; - struct mbuf *m; - - eh = (struct ether_header *)buf; - -#if NBPFILTER > 0 - /* - * Check if there's a bpf filter listening on this interface. - * If so, hand off the raw packet to bpf. - */ - if(sc->arpcom.ac_if.if_bpf) { - bpf_tap(&sc->arpcom.ac_if, buf, - len + sizeof(struct ether_header)); - - /* - * Note that the interface cannot be in promiscuous mode if - * there are no bpf listeners. And if el are in promiscuous - * mode, el have to check if this packet is really ours. - * - * This test does not support multicasts. - */ - if((sc->arpcom.ac_if.if_flags & IFF_PROMISC) - && bcmp(eh->ether_dhost,sc->arpcom.ac_enaddr, - sizeof(eh->ether_dhost)) != 0 - && bcmp(eh->ether_dhost,etherbroadcastaddr, - sizeof(eh->ether_dhost)) != 0) - return; - } -#endif - - /* - * Pull packet off interface. - */ - m = elget(buf,len,0,&sc->arpcom.ac_if); - if(m == 0) - return; - - ether_input(&sc->arpcom.ac_if,eh,m); -} - /* * Pull read data off a interface. * Len is length of data, with local net header stripped. diff --git a/sys/i386/isa/scd.c b/sys/i386/isa/scd.c index 15ad25ed505..7eeca7b004c 100644 --- a/sys/i386/isa/scd.c +++ b/sys/i386/isa/scd.c @@ -41,7 +41,7 @@ */ -/* $Id: scd.c,v 1.39 1998/07/04 22:30:17 julian Exp $ */ +/* $Id: scd.c,v 1.40 1998/07/13 09:53:02 bde Exp $ */ /* Please send any comments to micke@dynas.se */ @@ -201,7 +201,8 @@ static struct cdevsw scd_cdevsw = { D_DISK, 0, -1 }; -int scd_attach(struct isa_device *dev) +static int +scd_attach(struct isa_device *dev) { int unit = dev->id_unit; struct scd_data *cd = scd_data + unit; @@ -694,7 +695,13 @@ scd_subchan(int unit, struct ioc_read_subchannel *sc) return 0; } -int +static __inline void +write_control(unsigned port, unsigned data) +{ + outb(port + OREG_CONTROL, data); +} + +static int scd_probe(struct isa_device *dev) { struct sony_drive_configuration drive_config; @@ -1285,12 +1292,6 @@ read_toc(dev_t dev) return 0; } -static __inline void -write_control(unsigned port, unsigned data) -{ - outb(port + OREG_CONTROL, data); -} - static void init_drive(unsigned unit) {