Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci Static'ify.



details:   https://anonhg.NetBSD.org/src/rev/8df549167a89
branches:  trunk
changeset: 588819:8df549167a89
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sat Mar 04 19:20:50 2006 +0000

description:
Static'ify.

diffstat:

 sys/dev/pci/if_bge.c |  393 ++++++++++++++++++--------------------------------
 1 files changed, 144 insertions(+), 249 deletions(-)

diffs (truncated from 765 to 300 lines):

diff -r 4a1389b59770 -r 8df549167a89 sys/dev/pci/if_bge.c
--- a/sys/dev/pci/if_bge.c      Sat Mar 04 17:35:31 2006 +0000
+++ b/sys/dev/pci/if_bge.c      Sat Mar 04 19:20:50 2006 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_bge.c,v 1.103 2006/02/22 15:18:55 rpaulo Exp $      */
+/*     $NetBSD: if_bge.c,v 1.104 2006/03/04 19:20:50 thorpej Exp $     */
 
 /*
  * Copyright (c) 2001 Wind River Systems
@@ -79,7 +79,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.103 2006/02/22 15:18:55 rpaulo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.104 2006/03/04 19:20:50 thorpej Exp $");
 
 #include "bpfilter.h"
 #include "vlan.h"
@@ -162,7 +162,7 @@
  * full link bandwidth, due to ACKs and window updates lingering
  * in the RX queue during the 30-to-40-frame interrupt-mitigation window.
  */
-struct bge_load_rx_thresh {
+static const struct bge_load_rx_thresh {
        int rx_ticks;
        int rx_max_bds; }
 bge_rx_threshes[] = {
@@ -179,81 +179,53 @@
 static int     bge_auto_thresh = 1;
 static int     bge_rx_thresh_lvl;
 
-#ifdef __NetBSD__
-static int bge_rxthresh_nodenum;
-#endif /* __NetBSD__ */
-
-int bge_probe(struct device *, struct cfdata *, void *);
-void bge_attach(struct device *, struct device *, void *);
-void bge_powerhook(int, void *);
-void bge_release_resources(struct bge_softc *);
-void bge_txeof(struct bge_softc *);
-void bge_rxeof(struct bge_softc *);
-
-void bge_tick(void *);
-void bge_stats_update(struct bge_softc *);
-int bge_encap(struct bge_softc *, struct mbuf *, u_int32_t *);
-static inline int bge_cksum_pad(struct mbuf *pkt);
-static inline int bge_compact_dma_runt(struct mbuf *pkt);
-
-int bge_intr(void *);
-void bge_start(struct ifnet *);
-int bge_ioctl(struct ifnet *, u_long, caddr_t);
-int bge_init(struct ifnet *);
-void bge_stop(struct bge_softc *);
-void bge_watchdog(struct ifnet *);
-void bge_shutdown(void *);
-int bge_ifmedia_upd(struct ifnet *);
-void bge_ifmedia_sts(struct ifnet *, struct ifmediareq *);
-
-u_int8_t bge_eeprom_getbyte(struct bge_softc *, int, u_int8_t *);
-int bge_read_eeprom(struct bge_softc *, caddr_t, int, int);
-
-void bge_setmulti(struct bge_softc *);
-
-void bge_handle_events(struct bge_softc *);
-int bge_alloc_jumbo_mem(struct bge_softc *);
-void bge_free_jumbo_mem(struct bge_softc *);
-void *bge_jalloc(struct bge_softc *);
-void bge_jfree(struct mbuf *, caddr_t, size_t, void *);
-int bge_newbuf_std(struct bge_softc *, int, struct mbuf *, bus_dmamap_t);
-int bge_newbuf_jumbo(struct bge_softc *, int, struct mbuf *);
-int bge_init_rx_ring_std(struct bge_softc *);
-void bge_free_rx_ring_std(struct bge_softc *);
-int bge_init_rx_ring_jumbo(struct bge_softc *);
-void bge_free_rx_ring_jumbo(struct bge_softc *);
-void bge_free_tx_ring(struct bge_softc *);
-int bge_init_tx_ring(struct bge_softc *);
-
-int bge_chipinit(struct bge_softc *);
-int bge_blockinit(struct bge_softc *);
-int bge_setpowerstate(struct bge_softc *, int);
-
-#ifdef notdef
-u_int8_t bge_vpd_readbyte(struct bge_softc *, int);
-void bge_vpd_read_res(struct bge_softc *, struct vpd_res *, int);
-void bge_vpd_read(struct bge_softc *);
+static int     bge_rxthresh_nodenum;
+
+static int     bge_probe(device_t, cfdata_t, void *);
+static void    bge_attach(device_t, device_t, void *);
+static void    bge_powerhook(int, void *);
+static void    bge_release_resources(struct bge_softc *);
+static void    bge_txeof(struct bge_softc *);
+static void    bge_rxeof(struct bge_softc *);
+
+static void    bge_tick(void *);
+static void    bge_stats_update(struct bge_softc *);
+static int     bge_encap(struct bge_softc *, struct mbuf *, u_int32_t *);
+
+static int     bge_intr(void *);
+static void    bge_start(struct ifnet *);
+static int     bge_ioctl(struct ifnet *, u_long, caddr_t);
+static int     bge_init(struct ifnet *);
+static void    bge_stop(struct bge_softc *);
+static void    bge_watchdog(struct ifnet *);
+static void    bge_shutdown(void *);
+static int     bge_ifmedia_upd(struct ifnet *);
+static void    bge_ifmedia_sts(struct ifnet *, struct ifmediareq *);
+
+static void    bge_setmulti(struct bge_softc *);
+
+static void    bge_handle_events(struct bge_softc *);
+static int     bge_alloc_jumbo_mem(struct bge_softc *);
+#if 0 /* XXX */
+static void    bge_free_jumbo_mem(struct bge_softc *);
 #endif
-
-u_int32_t bge_readmem_ind(struct bge_softc *, int);
-void bge_writemem_ind(struct bge_softc *, int, int);
-#ifdef notdef
-u_int32_t bge_readreg_ind(struct bge_softc *, int);
-#endif
-void bge_writereg_ind(struct bge_softc *, int, int);
-
-int bge_miibus_readreg(struct device *, int, int);
-void bge_miibus_writereg(struct device *, int, int, int);
-void bge_miibus_statchg(struct device *);
-
-void bge_reset(struct bge_softc *);
-
-void   bge_set_thresh(struct ifnet *  /*ifp*/, int /*lvl*/);
-void   bge_update_all_threshes(int /*lvl*/);
-
-void bge_dump_status(struct bge_softc *);
-void bge_dump_rxbd(struct bge_rx_bd *);
-
+static void    *bge_jalloc(struct bge_softc *);
+static void    bge_jfree(struct mbuf *, caddr_t, size_t, void *);
+static int     bge_newbuf_std(struct bge_softc *, int, struct mbuf *,
+                              bus_dmamap_t);
+static int     bge_newbuf_jumbo(struct bge_softc *, int, struct mbuf *);
+static int     bge_init_rx_ring_std(struct bge_softc *);
+static void    bge_free_rx_ring_std(struct bge_softc *);
+static int     bge_init_rx_ring_jumbo(struct bge_softc *);
+static void    bge_free_rx_ring_jumbo(struct bge_softc *);
+static void    bge_free_tx_ring(struct bge_softc *);
+static int     bge_init_tx_ring(struct bge_softc *);
+
+static int     bge_chipinit(struct bge_softc *);
+static int     bge_blockinit(struct bge_softc *);
+static int     bge_setpowerstate(struct bge_softc *, int);
+
+static void    bge_reset(struct bge_softc *);
 
 #define BGE_DEBUG
 #ifdef BGE_DEBUG
@@ -319,10 +291,8 @@
 CFATTACH_DECL(bge, sizeof(struct bge_softc),
     bge_probe, bge_attach, NULL, NULL);
 
-u_int32_t
-bge_readmem_ind(sc, off)
-       struct bge_softc *sc;
-       int off;
+static u_int32_t
+bge_readmem_ind(struct bge_softc *sc, int off)
 {
        struct pci_attach_args  *pa = &(sc->bge_pa);
        pcireg_t val;
@@ -332,10 +302,8 @@
        return val;
 }
 
-void
-bge_writemem_ind(sc, off, val)
-       struct bge_softc *sc;
-       int off, val;
+static void
+bge_writemem_ind(struct bge_softc *sc, int off, int val)
 {
        struct pci_attach_args  *pa = &(sc->bge_pa);
 
@@ -344,10 +312,8 @@
 }
 
 #ifdef notdef
-u_int32_t
-bge_readreg_ind(sc, off)
-       struct bge_softc *sc;
-       int off;
+static u_int32_t
+bge_readreg_ind(struct bge_softc *sc, int off)
 {
        struct pci_attach_args  *pa = &(sc->bge_pa);
 
@@ -356,10 +322,8 @@
 }
 #endif
 
-void
-bge_writereg_ind(sc, off, val)
-       struct bge_softc *sc;
-       int off, val;
+static void
+bge_writereg_ind(struct bge_softc *sc, int off, int val)
 {
        struct pci_attach_args  *pa = &(sc->bge_pa);
 
@@ -368,10 +332,8 @@
 }
 
 #ifdef notdef
-u_int8_t
-bge_vpd_readbyte(sc, addr)
-       struct bge_softc *sc;
-       int addr;
+static u_int8_t
+bge_vpd_readbyte(struct bge_softc *sc, int addr)
 {
        int i;
        u_int32_t val;
@@ -395,11 +357,8 @@
        return((val >> ((addr % 4) * 8)) & 0xFF);
 }
 
-void
-bge_vpd_read_res(sc, res, addr)
-       struct bge_softc *sc;
-       struct vpd_res *res;
-       int addr;
+static void
+bge_vpd_read_res(struct bge_softc *sc, struct vpd_res *res, int addr)
 {
        int i;
        u_int8_t *ptr;
@@ -409,9 +368,8 @@
                ptr[i] = bge_vpd_readbyte(sc, i + addr);
 }
 
-void
-bge_vpd_read(sc)
-       struct bge_softc *sc;
+static void
+bge_vpd_read(struct bge_softc *sc)
 {
        int pos = 0, i;
        struct vpd_res res;
@@ -463,11 +421,8 @@
  * auto access interface for reading the EEPROM. We use the auto
  * access method.
  */
-u_int8_t
-bge_eeprom_getbyte(sc, addr, dest)
-       struct bge_softc *sc;
-       int addr;
-       u_int8_t *dest;
+static u_int8_t
+bge_eeprom_getbyte(struct bge_softc *sc, int addr, u_int8_t *dest)
 {
        int i;
        u_int32_t byte = 0;
@@ -509,12 +464,8 @@
 /*
  * Read a sequence of bytes from the EEPROM.
  */
-int
-bge_read_eeprom(sc, dest, off, cnt)
-       struct bge_softc *sc;
-       caddr_t dest;
-       int off;
-       int cnt;
+static int
+bge_read_eeprom(struct bge_softc *sc, caddr_t dest, int off, int cnt)
 {
        int err = 0, i;
        u_int8_t byte = 0;
@@ -529,10 +480,8 @@
        return(err ? 1 : 0);
 }
 
-int
-bge_miibus_readreg(dev, phy, reg)
-       struct device *dev;
-       int phy, reg;
+static int
+bge_miibus_readreg(device_t dev, int phy, int reg)
 {
        struct bge_softc *sc = (struct bge_softc *)dev;
        u_int32_t val;
@@ -584,10 +533,8 @@
        return(val & 0xFFFF);
 }
 
-void
-bge_miibus_writereg(dev, phy, reg, val)
-       struct device *dev;
-       int phy, reg, val;
+static void
+bge_miibus_writereg(device_t dev, int phy, int reg, int val)
 {
        struct bge_softc *sc = (struct bge_softc *)dev;



Home | Main Index | Thread Index | Old Index