--- src/sys/dev/netif/ed/if_ed.c 2005/06/20 15:10:40 1.25 +++ src/sys/dev/netif/ed/if_ed.c 2005/10/01 06:36:11 1.26 @@ -91,22 +91,18 @@ static void ed_tick (void *); static void ds_getmcaf (struct ed_softc *, u_int32_t *); -static void ed_get_packet (struct ed_softc *, char *, /* u_short */ int); +static void ed_get_packet (struct ed_softc *, char *, u_short); static __inline void ed_rint (struct ed_softc *); static __inline void ed_xmit (struct ed_softc *); static __inline char * ed_ring_copy (struct ed_softc *, char *, char *, - /* u_short */ int); + u_short); static void ed_hpp_set_physical_link (struct ed_softc *); -static void ed_hpp_readmem (struct ed_softc *, int, unsigned char *, - /* u_short */ int); -static void ed_hpp_writemem (struct ed_softc *, unsigned char *, - /* u_short */ int, /* u_short */ int); -static u_short ed_hpp_write_mbufs (struct ed_softc *, struct mbuf *, - int); +static void ed_hpp_readmem (struct ed_softc *, u_short, u_char *, u_short); +static void ed_hpp_writemem (struct ed_softc *, u_char *, u_short, u_short); +static u_short ed_hpp_write_mbufs (struct ed_softc *, struct mbuf *, int); -static u_short ed_pio_write_mbufs (struct ed_softc *, struct mbuf *, - int); +static u_short ed_pio_write_mbufs (struct ed_softc *, struct mbuf *, int); static void ed_setrcr (struct ed_softc *); @@ -117,7 +113,7 @@ DECLARE_DUMMY_MODULE(if_ed); /* * Interrupt conversion table for WD/SMC ASIC/83C584 */ -static unsigned short ed_intr_val[] = { +static u_short ed_intr_val[] = { 9, 3, 5, @@ -131,7 +127,7 @@ static unsigned short ed_intr_val[] = { /* * Interrupt conversion table for 83C790 */ -static unsigned short ed_790_intr_val[] = { +static u_short ed_790_intr_val[] = { 0, 9, 3, @@ -146,7 +142,7 @@ static unsigned short ed_790_intr_val[] * Interrupt conversion table for the HP PC LAN+ */ -static unsigned short ed_hpp_intr_val[] = { +static u_short ed_hpp_intr_val[] = { 0, /* 0 */ 0, /* 1 */ 0, /* 2 */ @@ -189,8 +185,7 @@ static unsigned short ed_hpp_intr_val[] */ int -ed_probe_generic8390(sc) - struct ed_softc *sc; +ed_probe_generic8390(struct ed_softc *sc) { if ((ed_nic_inb(sc, ED_P0_CR) & (ED_CR_RD2 | ED_CR_TXP | ED_CR_STA | ED_CR_STP)) != @@ -206,10 +201,7 @@ ed_probe_generic8390(sc) * Probe and vendor-specific initialization routine for SMC/WD80x3 boards */ int -ed_probe_WD80x3_generic(dev, flags, intr_vals) - device_t dev; - int flags; - unsigned short *intr_vals[]; +ed_probe_WD80x3_generic(device_t dev, int flags, u_short *intr_vals[]) { struct ed_softc *sc = device_get_softc(dev); int error; @@ -613,14 +605,11 @@ ed_probe_WD80x3_generic(dev, flags, intr } int -ed_probe_WD80x3(dev, port_rid, flags) - device_t dev; - int port_rid; - int flags; +ed_probe_WD80x3(device_t dev, int port_rid, int flags) { struct ed_softc *sc = device_get_softc(dev); int error; - static unsigned short *intr_vals[] = {ed_intr_val, ed_790_intr_val}; + static u_short *intr_vals[] = {ed_intr_val, ed_790_intr_val}; error = ed_alloc_port(dev, port_rid, ED_WD_IO_PORTS); if (error) @@ -636,10 +625,7 @@ ed_probe_WD80x3(dev, port_rid, flags) * Probe and vendor-specific initialization routine for 3Com 3c503 boards */ int -ed_probe_3Com(dev, port_rid, flags) - device_t dev; - int port_rid; - int flags; +ed_probe_3Com(device_t dev, int port_rid, int flags) { struct ed_softc *sc = device_get_softc(dev); int error; @@ -912,8 +898,9 @@ ed_probe_3Com(dev, port_rid, flags) for (i = 0; i < memsize; ++i) if (sc->mem_start[i]) { - device_printf(dev, "failed to clear shared memory at %llx - check configuration\n", - (unsigned long long)kvtop(sc->mem_start + i)); + device_printf(dev, "failed to clear shared memory " + "at %llx - check configuration\n", + (unsigned long long)kvtop(sc->mem_start + i)); return (ENXIO); } return (0); @@ -923,10 +910,7 @@ ed_probe_3Com(dev, port_rid, flags) * Probe and vendor-specific initialization routine for SIC boards */ int -ed_probe_SIC(dev, port_rid, flags) - device_t dev; - int port_rid; - int flags; +ed_probe_SIC(device_t dev, int port_rid, int flags) { struct ed_softc *sc = device_get_softc(dev); int error; @@ -1037,9 +1021,7 @@ ed_probe_SIC(dev, port_rid, flags) * Probe and vendor-specific initialization routine for NE1000/2000 boards */ int -ed_probe_Novell_generic(dev, flags) - device_t dev; - int flags; +ed_probe_Novell_generic(device_t dev, int flags) { struct ed_softc *sc = device_get_softc(dev); u_int memsize, n; @@ -1247,10 +1229,7 @@ ed_probe_Novell_generic(dev, flags) } int -ed_probe_Novell(dev, port_rid, flags) - device_t dev; - int port_rid; - int flags; +ed_probe_Novell(device_t dev, int port_rid, int flags) { struct ed_softc *sc = device_get_softc(dev); int error; @@ -1290,10 +1269,7 @@ ed_probe_Novell(dev, port_rid, flags) * command line. */ int -ed_probe_HP_pclanp(dev, port_rid, flags) - device_t dev; - int port_rid; - int flags; +ed_probe_HP_pclanp(device_t dev, int port_rid, int flags) { struct ed_softc *sc = device_get_softc(dev); int error; @@ -1606,10 +1582,7 @@ ed_hpp_set_physical_link(struct ed_softc * Allocate a port resource with the given resource id. */ int -ed_alloc_port(dev, rid, size) - device_t dev; - int rid; - int size; +ed_alloc_port(device_t dev, int rid, int size) { struct ed_softc *sc = device_get_softc(dev); struct resource *res; @@ -1630,10 +1603,7 @@ ed_alloc_port(dev, rid, size) * Allocate a memory resource with the given resource id. */ int -ed_alloc_memory(dev, rid, size) - device_t dev; - int rid; - int size; +ed_alloc_memory(device_t dev, int rid, int size) { struct ed_softc *sc = device_get_softc(dev); struct resource *res; @@ -1654,10 +1624,7 @@ ed_alloc_memory(dev, rid, size) * Allocate an irq resource with the given resource id. */ int -ed_alloc_irq(dev, rid, flags) - device_t dev; - int rid; - int flags; +ed_alloc_irq(device_t dev, int rid, int flags) { struct ed_softc *sc = device_get_softc(dev); struct resource *res; @@ -1677,8 +1644,7 @@ ed_alloc_irq(dev, rid, flags) * Release all resources */ void -ed_release_resources(dev) - device_t dev; +ed_release_resources(device_t dev) { struct ed_softc *sc = device_get_softc(dev); @@ -1786,8 +1752,7 @@ ed_attach(device_t dev) * Reset interface. */ static void -ed_reset(ifp) - struct ifnet *ifp; +ed_reset(struct ifnet *ifp) { struct ed_softc *sc = ifp->if_softc; @@ -1811,8 +1776,7 @@ ed_reset(ifp) * Take interface offline. */ void -ed_stop(sc) - struct ed_softc *sc; +ed_stop(struct ed_softc *sc) { int n = 5000; @@ -1840,8 +1804,7 @@ ed_stop(sc) * generate an interrupt after a transmit has been started on it. */ static void -ed_watchdog(ifp) - struct ifnet *ifp; +ed_watchdog(struct ifnet *ifp) { struct ed_softc *sc = ifp->if_softc; @@ -1855,8 +1818,7 @@ ed_watchdog(ifp) #ifndef ED_NO_MIIBUS static void -ed_tick(arg) - void *arg; +ed_tick(void *arg) { struct ed_softc *sc = arg; struct mii_data *mii; @@ -1883,8 +1845,7 @@ ed_tick(arg) * Initialize device. */ static void -ed_init(xsc) - void *xsc; +ed_init(void *xsc) { struct ed_softc *sc = xsc; struct ifnet *ifp = &sc->arpcom.ac_if; @@ -2048,11 +2009,10 @@ ed_init(xsc) * This routine actually starts the transmission on the interface */ static __inline void -ed_xmit(sc) - struct ed_softc *sc; +ed_xmit(struct ed_softc *sc) { struct ifnet *ifp = (struct ifnet *)sc; - unsigned short len; + u_short len; if (sc->gone) return; @@ -2104,8 +2064,7 @@ ed_xmit(sc) * (i.e. that the output part of the interface is idle) */ static void -ed_start(ifp) - struct ifnet *ifp; +ed_start(struct ifnet *ifp) { struct ed_softc *sc = ifp->if_softc; struct mbuf *m0, *m; @@ -2253,8 +2212,7 @@ outloop: * Ethernet interface receiver interrupt. */ static __inline void -ed_rint(sc) - struct ed_softc *sc; +ed_rint(struct ed_softc *sc) { struct ifnet *ifp = &sc->arpcom.ac_if; u_char boundry; @@ -2388,8 +2346,7 @@ ed_rint(sc) * Ethernet interface interrupt processor */ void -edintr(arg) - void *arg; +edintr(void *arg) { struct ed_softc *sc = (struct ed_softc*) arg; struct ifnet *ifp = (struct ifnet *)sc; @@ -2656,11 +2613,7 @@ edintr(arg) * pretty ugly. */ static int -ed_ioctl(ifp, command, data, cr) - struct ifnet *ifp; - u_long command; - caddr_t data; - struct ucred *cr; +ed_ioctl(struct ifnet *ifp, u_long command, caddr_t data, struct ucred *cr) { struct ed_softc *sc = ifp->if_softc; #ifndef ED_NO_MIIBUS @@ -2752,11 +2705,7 @@ ed_ioctl(ifp, command, data, cr) * ring-wrap. */ static __inline char * -ed_ring_copy(sc, src, dst, amount) - struct ed_softc *sc; - char *src; - char *dst; - u_short amount; +ed_ring_copy(struct ed_softc *sc, char *src, char *dst, u_short amount) { u_short tmp_amount; @@ -2787,10 +2736,7 @@ ed_ring_copy(sc, src, dst, amount) * ether_input(). */ static void -ed_get_packet(sc, buf, len) - struct ed_softc *sc; - char *buf; - u_short len; +ed_get_packet(struct ed_softc *sc, char *buf, u_short len) { struct ifnet *ifp = &sc->arpcom.ac_if; struct ether_header *eh; @@ -2855,11 +2801,7 @@ ed_get_packet(sc, buf, len) * This routine is currently Novell-specific. */ void -ed_pio_readmem(sc, src, dst, amount) - struct ed_softc *sc; - int src; - unsigned char *dst; - unsigned short amount; +ed_pio_readmem(struct ed_softc *sc, int src, u_char *dst, u_short amount) { /* HP PC Lan+ cards need special handling */ if (sc->vendor == ED_VENDOR_HP && sc->type == ED_TYPE_HP_PCLANPLUS) { @@ -2898,11 +2840,7 @@ ed_pio_readmem(sc, src, dst, amount) * be even. */ void -ed_pio_writemem(sc, src, dst, len) - struct ed_softc *sc; - char *src; - unsigned short dst; - unsigned short len; +ed_pio_writemem(struct ed_softc *sc, char *src, u_short dst, u_short len) { int maxwait = 200; /* about 240us */ @@ -2944,13 +2882,10 @@ ed_pio_writemem(sc, src, dst, len) * programmed I/O. */ static u_short -ed_pio_write_mbufs(sc, m, dst) - struct ed_softc *sc; - struct mbuf *m; - int dst; +ed_pio_write_mbufs(struct ed_softc *sc, struct mbuf *m, int dst) { struct ifnet *ifp = (struct ifnet *)sc; - unsigned short total_len, dma_len; + u_short total_len, dma_len; struct mbuf *mp; int maxwait = 200; /* about 240us */ @@ -3002,9 +2937,9 @@ ed_pio_write_mbufs(sc, m, dst) } } else { /* NE2000s are a pain */ - unsigned char *data; + u_char *data; int len, wantbyte; - unsigned char savebyte[2]; + u_char savebyte[2]; wantbyte = 0; @@ -3070,11 +3005,7 @@ ed_pio_write_mbufs(sc, m, dst) */ static void -ed_hpp_readmem(sc, src, dst, amount) - struct ed_softc *sc; - unsigned short src; - unsigned char *dst; - unsigned short amount; +ed_hpp_readmem(struct ed_softc *sc, u_short src, u_char *dst, u_short amount) { int use_32bit_access = !(sc->hpp_id & ED_HPP_ID_16_BIT_ACCESS); @@ -3173,11 +3104,7 @@ ed_hpp_readmem(sc, src, dst, amount) * be even. */ static void -ed_hpp_writemem(sc, src, dst, len) - struct ed_softc *sc; - unsigned char *src; - unsigned short dst; - unsigned short len; +ed_hpp_writemem(struct ed_softc *sc, u_char *src, u_short dst, u_short len) { /* reset remote DMA complete flag */ ed_nic_outb(sc, ED_P0_ISR, ED_ISR_RDC); @@ -3229,8 +3156,8 @@ static u_short ed_hpp_write_mbufs(struct ed_softc *sc, struct mbuf *m, int dst) { int len, wantbyte; - unsigned short total_len; - unsigned char savebyte[2]; + u_short total_len; + u_char savebyte[2]; volatile u_short * const d = (volatile u_short *) sc->hpp_mem_start; int use_32bit_accesses = !(sc->hpp_id & ED_HPP_ID_16_BIT_ACCESS); @@ -3346,9 +3273,7 @@ ed_hpp_write_mbufs(struct ed_softc *sc, * MII bus support routines. */ int -ed_miibus_readreg(dev, phy, reg) - device_t dev; - int phy, reg; +ed_miibus_readreg(device_t dev, int phy, int reg) { struct ed_softc *sc = device_get_softc(dev); int failed, val; @@ -3376,9 +3301,7 @@ ed_miibus_readreg(dev, phy, reg) } void -ed_miibus_writereg(dev, phy, reg, data) - device_t dev; - int phy, reg, data; +ed_miibus_writereg(device_t dev, int phy, int reg, int data) { struct ed_softc *sc = device_get_softc(dev); @@ -3402,8 +3325,7 @@ ed_miibus_writereg(dev, phy, reg, data) } int -ed_ifmedia_upd(ifp) - struct ifnet *ifp; +ed_ifmedia_upd(struct ifnet *ifp) { struct ed_softc *sc; struct mii_data *mii; @@ -3417,9 +3339,7 @@ ed_ifmedia_upd(ifp) } void -ed_ifmedia_sts(ifp, ifmr) - struct ifnet *ifp; - struct ifmediareq *ifmr; +ed_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr) { struct ed_softc *sc; struct mii_data *mii; @@ -3435,9 +3355,7 @@ ed_ifmedia_sts(ifp, ifmr) } void -ed_child_detached(dev, child) - device_t dev; - device_t child; +ed_child_detached(device_t dev, device_t child) { struct ed_softc *sc; @@ -3448,8 +3366,7 @@ ed_child_detached(dev, child) #endif static void -ed_setrcr(sc) - struct ed_softc *sc; +ed_setrcr(struct ed_softc *sc) { struct ifnet *ifp = (struct ifnet *)sc; int i; @@ -3528,8 +3445,7 @@ ed_setrcr(sc) * Compute crc for ethernet address */ static uint32_t -ds_mchash(addr) - const uint8_t *addr; +ds_mchash(const uint8_t *addr) { #define ED_POLYNOMIAL 0x04c11db6 uint32_t crc = 0xffffffff; @@ -3553,9 +3469,7 @@ ds_mchash(addr) * list of multicast addresses we need to listen to. */ static void -ds_getmcaf(sc, mcaf) - struct ed_softc *sc; - u_int32_t *mcaf; +ds_getmcaf(struct ed_softc *sc, u_int32_t *mcaf) { u_int32_t index; u_char *af = (u_char *) mcaf;