diff options
| author | maxv <maxv@NetBSD.org> | 2019-11-28 17:09:10 +0000 |
|---|---|---|
| committer | maxv <maxv@NetBSD.org> | 2019-11-28 17:09:10 +0000 |
| commit | 8cd22b985ef700f35854781be4d504e8acd5fa4e (patch) | |
| tree | dea876cd88c93e31af8c66df2b0c47180fa3c40d /sys/dev | |
| parent | 3e54302c0fe24aa1f820e56e558aab968f2ac84c (diff) | |
localify
Diffstat (limited to 'sys/dev')
| -rw-r--r-- | sys/dev/pci/if_et.c | 203 | ||||
| -rw-r--r-- | sys/dev/pci/if_msk.c | 152 | ||||
| -rw-r--r-- | sys/dev/pci/if_sk.c | 207 | ||||
| -rw-r--r-- | sys/dev/pci/mpii.c | 310 | ||||
| -rw-r--r-- | sys/dev/pcmcia/if_xi.c | 6 | ||||
| -rw-r--r-- | sys/dev/usb/if_atu.c | 156 | ||||
| -rw-r--r-- | sys/dev/usb/if_urtw.c | 382 | ||||
| -rw-r--r-- | sys/dev/usb/if_zyd.c | 20 |
8 files changed, 718 insertions, 718 deletions
diff --git a/sys/dev/pci/if_et.c b/sys/dev/pci/if_et.c index 50e6a7260c2..c20d6878d34 100644 --- a/sys/dev/pci/if_et.c +++ b/sys/dev/pci/if_et.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_et.c,v 1.27 2019/10/12 06:00:52 msaitoh Exp $ */ +/* $NetBSD: if_et.c,v 1.28 2019/11/28 17:09:10 maxv Exp $ */ /* $OpenBSD: if_et.c,v 1.12 2008/07/11 09:29:02 kevlo $ */ /* * Copyright (c) 2007 The DragonFly Project. All rights reserved. @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_et.c,v 1.27 2019/10/12 06:00:52 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_et.c,v 1.28 2019/11/28 17:09:10 maxv Exp $"); #include "opt_inet.h" #include "vlan.h" @@ -81,63 +81,62 @@ __KERNEL_RCSID(0, "$NetBSD: if_et.c,v 1.27 2019/10/12 06:00:52 msaitoh Exp $"); #include <dev/pci/if_etreg.h> -int et_match(device_t, cfdata_t, void *); -void et_attach(device_t, device_t, void *); -int et_detach(device_t, int); -int et_shutdown(device_t); +static int et_match(device_t, cfdata_t, void *); +static void et_attach(device_t, device_t, void *); +static int et_detach(device_t, int); -int et_miibus_readreg(device_t, int, int, uint16_t *); -int et_miibus_writereg(device_t, int, int, uint16_t); -void et_miibus_statchg(struct ifnet *); +static int et_miibus_readreg(device_t, int, int, uint16_t *); +static int et_miibus_writereg(device_t, int, int, uint16_t); +static void et_miibus_statchg(struct ifnet *); -int et_init(struct ifnet *); -int et_ioctl(struct ifnet *, u_long, void *); -void et_start(struct ifnet *); -void et_watchdog(struct ifnet *); +static int et_init(struct ifnet *); +static int et_ioctl(struct ifnet *, u_long, void *); +static void et_start(struct ifnet *); +static void et_watchdog(struct ifnet *); static int et_ifmedia_upd(struct ifnet *); static void et_ifmedia_sts(struct ifnet *, struct ifmediareq *); -int et_intr(void *); -void et_enable_intrs(struct et_softc *, uint32_t); -void et_disable_intrs(struct et_softc *); -void et_rxeof(struct et_softc *); -void et_txeof(struct et_softc *); -void et_txtick(void *); +static int et_intr(void *); +static void et_enable_intrs(struct et_softc *, uint32_t); +static void et_disable_intrs(struct et_softc *); +static void et_rxeof(struct et_softc *); +static void et_txeof(struct et_softc *); +static void et_txtick(void *); -int et_dma_alloc(struct et_softc *); -void et_dma_free(struct et_softc *); -int et_dma_mem_create(struct et_softc *, bus_size_t, +static int et_dma_alloc(struct et_softc *); +static void et_dma_free(struct et_softc *); +static int et_dma_mem_create(struct et_softc *, bus_size_t, void **, bus_addr_t *, bus_dmamap_t *, bus_dma_segment_t *); -void et_dma_mem_destroy(struct et_softc *, void *, bus_dmamap_t); -int et_dma_mbuf_create(struct et_softc *); -void et_dma_mbuf_destroy(struct et_softc *, int, const int[]); - -int et_init_tx_ring(struct et_softc *); -int et_init_rx_ring(struct et_softc *); -void et_free_tx_ring(struct et_softc *); -void et_free_rx_ring(struct et_softc *); -int et_encap(struct et_softc *, struct mbuf **); -int et_newbuf(struct et_rxbuf_data *, int, int, int); -int et_newbuf_cluster(struct et_rxbuf_data *, int, int); -int et_newbuf_hdr(struct et_rxbuf_data *, int, int); - -void et_stop(struct et_softc *); -int et_chip_init(struct et_softc *); -void et_chip_attach(struct et_softc *); -void et_init_mac(struct et_softc *); -void et_init_rxmac(struct et_softc *); -void et_init_txmac(struct et_softc *); -int et_init_rxdma(struct et_softc *); -int et_init_txdma(struct et_softc *); -int et_start_rxdma(struct et_softc *); -int et_start_txdma(struct et_softc *); -int et_stop_rxdma(struct et_softc *); -int et_stop_txdma(struct et_softc *); -void et_reset(struct et_softc *); -int et_bus_config(struct et_softc *); -void et_get_eaddr(struct et_softc *, uint8_t[]); -void et_setmulti(struct et_softc *); -void et_tick(void *); +static void et_dma_mem_destroy(struct et_softc *, void *, bus_dmamap_t); +static int et_dma_mbuf_create(struct et_softc *); +static void et_dma_mbuf_destroy(struct et_softc *, int, const int[]); + +static int et_init_tx_ring(struct et_softc *); +static int et_init_rx_ring(struct et_softc *); +static void et_free_tx_ring(struct et_softc *); +static void et_free_rx_ring(struct et_softc *); +static int et_encap(struct et_softc *, struct mbuf **); +static int et_newbuf(struct et_rxbuf_data *, int, int, int); +static int et_newbuf_cluster(struct et_rxbuf_data *, int, int); +static int et_newbuf_hdr(struct et_rxbuf_data *, int, int); + +static void et_stop(struct et_softc *); +static int et_chip_init(struct et_softc *); +static void et_chip_attach(struct et_softc *); +static void et_init_mac(struct et_softc *); +static void et_init_rxmac(struct et_softc *); +static void et_init_txmac(struct et_softc *); +static int et_init_rxdma(struct et_softc *); +static int et_init_txdma(struct et_softc *); +static int et_start_rxdma(struct et_softc *); +static int et_start_txdma(struct et_softc *); +static int et_stop_rxdma(struct et_softc *); +static int et_stop_txdma(struct et_softc *); +static void et_reset(struct et_softc *); +static int et_bus_config(struct et_softc *); +static void et_get_eaddr(struct et_softc *, uint8_t[]); +static void et_setmulti(struct et_softc *); +static void et_tick(void *); static int et_rx_intr_npkts = 32; static int et_rx_intr_delay = 20; /* x10 usec */ @@ -154,7 +153,7 @@ static const struct et_bsize et_bufsize[ET_RX_NRING] = { { .bufsize = 0, .newbuf = et_newbuf_cluster }, }; -const struct et_product { +static const struct et_product { pci_vendor_id_t vendor; pci_product_id_t product; } et_devices[] = { @@ -165,7 +164,7 @@ const struct et_product { CFATTACH_DECL_NEW(et, sizeof(struct et_softc), et_match, et_attach, et_detach, NULL); -int +static int et_match(device_t dev, cfdata_t match, void *aux) { struct pci_attach_args *pa = aux; @@ -181,7 +180,7 @@ et_match(device_t dev, cfdata_t match, void *aux) return 0; } -void +static void et_attach(device_t parent, device_t self, void *aux) { struct et_softc *sc = device_private(self); @@ -319,7 +318,7 @@ fail: } } -int +static int et_detach(device_t self, int flags) { struct et_softc *sc = device_private(self); @@ -353,7 +352,8 @@ et_detach(device_t self, int flags) return 0; } -int +#if 0 /* XXX XXX XXX UNUSED */ +static int et_shutdown(device_t self) { struct et_softc *sc = device_private(self); @@ -365,8 +365,9 @@ et_shutdown(device_t self) return 0; } +#endif -int +static int et_miibus_readreg(device_t dev, int phy, int reg, uint16_t *val) { struct et_softc *sc = device_private(dev); @@ -410,7 +411,7 @@ back: return ret; } -int +static int et_miibus_writereg(device_t dev, int phy, int reg, uint16_t val) { struct et_softc *sc = device_private(dev); @@ -452,7 +453,7 @@ et_miibus_writereg(device_t dev, int phy, int reg, uint16_t val) return rv; } -void +static void et_miibus_statchg(struct ifnet *ifp) { struct et_softc *sc = ifp->if_softc; @@ -570,7 +571,7 @@ et_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr) ifmr->ifm_status = mii->mii_media_status; } -void +static void et_stop(struct et_softc *sc) { struct ifnet *ifp = &sc->sc_ethercom.ec_if; @@ -596,7 +597,7 @@ et_stop(struct et_softc *sc) ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); } -int +static int et_bus_config(struct et_softc *sc) { uint32_t val; //, max_plsz; @@ -671,7 +672,7 @@ et_bus_config(struct et_softc *sc) return 0; } -void +static void et_get_eaddr(struct et_softc *sc, uint8_t eaddr[]) { uint32_t r; @@ -686,7 +687,7 @@ et_get_eaddr(struct et_softc *sc, uint8_t eaddr[]) eaddr[5] = (r >> 8) & 0xff; } -void +static void et_reset(struct et_softc *sc) { @@ -706,19 +707,19 @@ et_reset(struct et_softc *sc) CSR_WRITE_4(sc, ET_MAC_CFG1, 0); } -void +static void et_disable_intrs(struct et_softc *sc) { CSR_WRITE_4(sc, ET_INTR_MASK, 0xffffffff); } -void +static void et_enable_intrs(struct et_softc *sc, uint32_t intrs) { CSR_WRITE_4(sc, ET_INTR_MASK, ~intrs); } -int +static int et_dma_alloc(struct et_softc *sc) { struct et_txdesc_ring *tx_ring = &sc->sc_tx_ring; @@ -801,7 +802,7 @@ et_dma_alloc(struct et_softc *sc) return 0; } -void +static void et_dma_free(struct et_softc *sc) { struct et_txdesc_ring *tx_ring = &sc->sc_tx_ring; @@ -847,7 +848,7 @@ et_dma_free(struct et_softc *sc) et_dma_mbuf_destroy(sc, ET_TX_NDESC, rx_done); } -int +static int et_dma_mbuf_create(struct et_softc *sc) { struct et_txbuf_data *tbd = &sc->sc_tx_data; @@ -906,7 +907,7 @@ et_dma_mbuf_create(struct et_softc *sc) return 0; } -void +static void et_dma_mbuf_destroy(struct et_softc *sc, int tx_done, const int rx_done[]) { struct et_txbuf_data *tbd = &sc->sc_tx_data; @@ -944,7 +945,7 @@ et_dma_mbuf_destroy(struct et_softc *sc, int tx_done, const int rx_done[]) bus_dmamap_destroy(sc->sc_dmat, sc->sc_mbuf_tmp_dmap); } -int +static int et_dma_mem_create(struct et_softc *sc, bus_size_t size, void **addr, bus_addr_t *paddr, bus_dmamap_t *dmap, bus_dma_segment_t *seg) { @@ -986,14 +987,14 @@ et_dma_mem_create(struct et_softc *sc, bus_size_t size, return 0; } -void +static void et_dma_mem_destroy(struct et_softc *sc, void *addr, bus_dmamap_t dmap) { bus_dmamap_unload(sc->sc_dmat, dmap); bus_dmamem_free(sc->sc_dmat, (bus_dma_segment_t *)&addr, 1); } -void +static void et_chip_attach(struct et_softc *sc) { uint32_t val; @@ -1033,7 +1034,7 @@ et_chip_attach(struct et_softc *sc) CSR_WRITE_4(sc, ET_MMC_CTRL, ET_MMC_CTRL_ENABLE); } -int +static int et_intr(void *xsc) { struct et_softc *sc = xsc; @@ -1064,7 +1065,7 @@ back: return (1); } -int +static int et_init(struct ifnet *ifp) { struct et_softc *sc = ifp->if_softc; @@ -1124,7 +1125,7 @@ back: return (0); } -int +static int et_ioctl(struct ifnet *ifp, u_long cmd, void *data) { struct et_softc *sc = ifp->if_softc; @@ -1171,7 +1172,7 @@ et_ioctl(struct ifnet *ifp, u_long cmd, void *data) return error; } -void +static void et_start(struct ifnet *ifp) { struct et_softc *sc = ifp->if_softc; @@ -1212,7 +1213,7 @@ et_start(struct ifnet *ifp) } } -void +static void et_watchdog(struct ifnet *ifp) { struct et_softc *sc = ifp->if_softc; @@ -1223,7 +1224,7 @@ et_watchdog(struct ifnet *ifp) et_start(ifp); } -int +static int et_stop_rxdma(struct et_softc *sc) { @@ -1238,7 +1239,7 @@ et_stop_rxdma(struct et_softc *sc) return 0; } -int +static int et_stop_txdma(struct et_softc *sc) { @@ -1247,7 +1248,7 @@ et_stop_txdma(struct et_softc *sc) return 0; } -void +static void et_free_tx_ring(struct et_softc *sc) { struct et_txbuf_data *tbd = &sc->sc_tx_data; @@ -1269,7 +1270,7 @@ et_free_tx_ring(struct et_softc *sc) tx_ring->tr_dmap->dm_mapsize, BUS_DMASYNC_PREWRITE); } -void +static void et_free_rx_ring(struct et_softc *sc) { int n; @@ -1295,7 +1296,7 @@ et_free_rx_ring(struct et_softc *sc) } } -void +static void et_setmulti(struct et_softc *sc) { struct ethercom *ec = &sc->sc_ethercom; @@ -1353,7 +1354,7 @@ back: CSR_WRITE_4(sc, ET_RXMAC_CTRL, rxmac_ctrl); } -int +static int et_chip_init(struct et_softc *sc) { struct ifnet *ifp = &sc->sc_ethercom.ec_if; @@ -1408,7 +1409,7 @@ et_chip_init(struct et_softc *sc) return 0; } -int +static int et_init_tx_ring(struct et_softc *sc) { struct et_txdesc_ring *tx_ring = &sc->sc_tx_ring; @@ -1429,7 +1430,7 @@ et_init_tx_ring(struct et_softc *sc) return 0; } -int +static int et_init_rx_ring(struct et_softc *sc) { struct et_rxstatus_data *rxsd = &sc->sc_rx_status; @@ -1461,7 +1462,7 @@ et_init_rx_ring(struct et_softc *sc) return 0; } -int +static int et_init_rxdma(struct et_softc *sc) { struct et_rxstatus_data *rxsd = &sc->sc_rx_status; @@ -1531,7 +1532,7 @@ et_init_rxdma(struct et_softc *sc) return 0; } -int +static int et_init_txdma(struct et_softc *sc) { struct et_txdesc_ring *tx_ring = &sc->sc_tx_ring; @@ -1566,7 +1567,7 @@ et_init_txdma(struct et_softc *sc) return 0; } -void +static void et_init_mac(struct et_softc *sc) { struct ifnet *ifp = &sc->sc_ethercom.ec_if; @@ -1619,7 +1620,7 @@ et_init_mac(struct et_softc *sc) CSR_WRITE_4(sc, ET_MAC_CFG1, 0); } -void +static void et_init_rxmac(struct et_softc *sc) { struct ifnet *ifp = &sc->sc_ethercom.ec_if; @@ -1700,7 +1701,7 @@ et_init_rxmac(struct et_softc *sc) et_setmulti(sc); } -void +static void et_init_txmac(struct et_softc *sc) { @@ -1715,7 +1716,7 @@ et_init_txmac(struct et_softc *sc) ET_TXMAC_CTRL_ENABLE | ET_TXMAC_CTRL_FC_DISABLE); } -int +static int et_start_rxdma(struct et_softc *sc) { uint32_t val = 0; @@ -1738,7 +1739,7 @@ et_start_rxdma(struct et_softc *sc) return 0; } -int +static int et_start_txdma(struct et_softc *sc) { @@ -1746,7 +1747,7 @@ et_start_txdma(struct et_softc *sc) return 0; } -void +static void et_rxeof(struct et_softc *sc) { struct ifnet *ifp = &sc->sc_ethercom.ec_if; @@ -1848,7 +1849,7 @@ et_rxeof(struct et_softc *sc) } } -int +static int et_encap(struct et_softc *sc, struct mbuf **m0) { struct mbuf *m = *m0; @@ -1983,7 +1984,7 @@ back: return error; } -void +static void et_txeof(struct et_softc *sc) { struct ifnet *ifp = &sc->sc_ethercom.ec_if; @@ -2039,7 +2040,7 @@ et_txeof(struct et_softc *sc) if_schedule_deferred_start(ifp); } -void +static void et_txtick(void *xsc) { struct et_softc *sc = xsc; @@ -2050,7 +2051,7 @@ et_txtick(void *xsc) splx(s); } -void +static void et_tick(void *xsc) { struct et_softc *sc = xsc; @@ -2062,19 +2063,19 @@ et_tick(void *xsc) splx(s); } -int +static int et_newbuf_cluster(struct et_rxbuf_data *rbd, int buf_idx, int init) { return et_newbuf(rbd, buf_idx, init, MCLBYTES); } -int +static int et_newbuf_hdr(struct et_rxbuf_data *rbd, int buf_idx, int init) { return et_newbuf(rbd, buf_idx, init, MHLEN); } -int +static int et_newbuf(struct et_rxbuf_data *rbd, int buf_idx, int init, int len0) { struct et_softc *sc = rbd->rbd_softc; diff --git a/sys/dev/pci/if_msk.c b/sys/dev/pci/if_msk.c index 65f4e03b7f2..b00198ad849 100644 --- a/sys/dev/pci/if_msk.c +++ b/sys/dev/pci/if_msk.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_msk.c,v 1.94 2019/11/15 12:38:09 msaitoh Exp $ */ +/* $NetBSD: if_msk.c,v 1.95 2019/11/28 17:09:10 maxv Exp $ */ /* $OpenBSD: if_msk.c,v 1.79 2009/10/15 17:54:56 deraadt Exp $ */ /* @@ -52,7 +52,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.94 2019/11/15 12:38:09 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.95 2019/11/28 17:09:10 maxv Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -92,45 +92,45 @@ __KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.94 2019/11/15 12:38:09 msaitoh Exp $"); #include <dev/pci/if_skreg.h> #include <dev/pci/if_mskvar.h> -int mskc_probe(device_t, cfdata_t, void *); -void mskc_attach(device_t, device_t, void *); -int mskc_detach(device_t, int); -void mskc_reset(struct sk_softc *); +static int mskc_probe(device_t, cfdata_t, void *); +static void mskc_attach(device_t, device_t, void *); +static int mskc_detach(device_t, int); +static void mskc_reset(struct sk_softc *); static bool mskc_suspend(device_t, const pmf_qual_t *); static bool mskc_resume(device_t, const pmf_qual_t *); -int msk_probe(device_t, cfdata_t, void *); -void msk_attach(device_t, device_t, void *); -int msk_detach(device_t, int); -void msk_reset(struct sk_if_softc *); -int mskcprint(void *, const char *); -int msk_intr(void *); -void msk_intr_yukon(struct sk_if_softc *); -void msk_rxeof(struct sk_if_softc *, uint16_t, uint32_t); -void msk_txeof(struct sk_if_softc *); -int msk_encap(struct sk_if_softc *, struct mbuf *, uint32_t *); -void msk_start(struct ifnet *); -int msk_ioctl(struct ifnet *, u_long, void *); -int msk_init(struct ifnet *); -void msk_init_yukon(struct sk_if_softc *); -void msk_stop(struct ifnet *, int); -void msk_watchdog(struct ifnet *); -int msk_newbuf(struct sk_if_softc *, bus_dmamap_t); -int msk_alloc_jumbo_mem(struct sk_if_softc *); -void *msk_jalloc(struct sk_if_softc *); -void msk_jfree(struct mbuf *, void *, size_t, void *); -int msk_init_rx_ring(struct sk_if_softc *); -int msk_init_tx_ring(struct sk_if_softc *); -void msk_fill_rx_ring(struct sk_if_softc *); - -void msk_update_int_mod(struct sk_softc *, int); - -int msk_miibus_readreg(device_t, int, int, uint16_t *); -int msk_miibus_writereg(device_t, int, int, uint16_t); -void msk_miibus_statchg(struct ifnet *); - -void msk_setmulti(struct sk_if_softc *); -void msk_setpromisc(struct sk_if_softc *); -void msk_tick(void *); +static int msk_probe(device_t, cfdata_t, void *); +static void msk_attach(device_t, device_t, void *); +static int msk_detach(device_t, int); +static void msk_reset(struct sk_if_softc *); +static int mskcprint(void *, const char *); +static int msk_intr(void *); +static void msk_intr_yukon(struct sk_if_softc *); +static void msk_rxeof(struct sk_if_softc *, uint16_t, uint32_t); +static void msk_txeof(struct sk_if_softc *); +static int msk_encap(struct sk_if_softc *, struct mbuf *, uint32_t *); +static void msk_start(struct ifnet *); +static int msk_ioctl(struct ifnet *, u_long, void *); +static int msk_init(struct ifnet *); +static void msk_init_yukon(struct sk_if_softc *); +static void msk_stop(struct ifnet *, int); +static void msk_watchdog(struct ifnet *); +static int msk_newbuf(struct sk_if_softc *, bus_dmamap_t); +static int msk_alloc_jumbo_mem(struct sk_if_softc *); +static void *msk_jalloc(struct sk_if_softc *); +static void msk_jfree(struct mbuf *, void *, size_t, void *); +static int msk_init_rx_ring(struct sk_if_softc *); +static int msk_init_tx_ring(struct sk_if_softc *); +static void msk_fill_rx_ring(struct sk_if_softc *); + +static void msk_update_int_mod(struct sk_softc *, int); + +static int msk_miibus_readreg(device_t, int, int, uint16_t *); +static int msk_miibus_writereg(device_t, int, int, uint16_t); +static void msk_miibus_statchg(struct ifnet *); + +static void msk_setmulti(struct sk_if_softc *); +static void msk_setpromisc(struct sk_if_softc *); +static void msk_tick(void *); static void msk_fill_rx_tick(void *); /* #define MSK_DEBUG 1 */ @@ -238,7 +238,7 @@ sk_win_write_1(struct sk_softc *sc, uint32_t reg, uint8_t x) CSR_WRITE_1(sc, reg, x); } -int +static int msk_miibus_readreg(device_t dev, int phy, int reg, uint16_t *val) { struct sk_if_softc *sc_if = device_private(dev); @@ -270,7 +270,7 @@ msk_miibus_readreg(device_t dev, int phy, int reg, uint16_t *val) return 0; } -int +static int msk_miibus_writereg(device_t dev, int phy, int reg, uint16_t val) { struct sk_if_softc *sc_if = device_private(dev); @@ -297,7 +297,7 @@ msk_miibus_writereg(device_t dev, int phy, int reg, uint16_t val) return 0; } -void +static void msk_miibus_statchg(struct ifnet *ifp) { struct sk_if_softc *sc_if = ifp->if_softc; @@ -340,7 +340,7 @@ msk_miibus_statchg(struct ifnet *ifp) SK_YU_READ_2(sc_if, YUKON_GPCR))); } -void +static void msk_setmulti(struct sk_if_softc *sc_if) { struct ifnet *ifp= &sc_if->sk_ethercom.ec_if; @@ -400,7 +400,7 @@ allmulti: SK_YU_WRITE_2(sc_if, YUKON_RCR, reg); } -void +static void msk_setpromisc(struct sk_if_softc *sc_if) { struct ifnet *ifp = &sc_if->sk_ethercom.ec_if; @@ -413,7 +413,7 @@ msk_setpromisc(struct sk_if_softc *sc_if) YU_RCR_UFLEN | YU_RCR_MUFLEN); } -int +static int msk_init_rx_ring(struct sk_if_softc *sc_if) { struct msk_chain_data *cd = &sc_if->sk_cdata; @@ -453,7 +453,7 @@ msk_init_rx_ring(struct sk_if_softc *sc_if) return 0; } -int +static int msk_init_tx_ring(struct sk_if_softc *sc_if) { struct sk_softc *sc = sc_if->sk_softc; @@ -508,7 +508,7 @@ msk_init_tx_ring(struct sk_if_softc *sc_if) return 0; } -int +static int msk_newbuf(struct sk_if_softc *sc_if, bus_dmamap_t dmamap) { struct mbuf *m_new = NULL; @@ -582,7 +582,7 @@ msk_newbuf(struct sk_if_softc *sc_if, bus_dmamap_t dmamap) * Memory management for jumbo frames. */ -int +static int msk_alloc_jumbo_mem(struct sk_if_softc *sc_if) { struct sk_softc *sc = sc_if->sk_softc; @@ -690,7 +690,7 @@ msk_free_jumbo_mem(struct sk_if_softc *sc_if) /* * Allocate a jumbo buffer. */ -void * +static void * msk_jalloc(struct sk_if_softc *sc_if) { struct sk_jpool_entry *entry; @@ -712,7 +712,7 @@ msk_jalloc(struct sk_if_softc *sc_if) /* * Release a jumbo buffer. */ -void +static void msk_jfree(struct mbuf *m, void *buf, size_t size, void *arg) { struct sk_jpool_entry *entry; @@ -750,7 +750,7 @@ msk_jfree(struct mbuf *m, void *buf, size_t size, void *arg) callout_schedule(&sc->sk_tick_rx, 0); } -int +static int msk_ioctl(struct ifnet *ifp, u_long cmd, void *data) { struct sk_if_softc *sc = ifp->if_softc; @@ -802,7 +802,7 @@ msk_ioctl(struct ifnet *ifp, u_long cmd, void *data) return error; } -void +static void msk_update_int_mod(struct sk_softc *sc, int verbose) { uint32_t imtimer_ticks; @@ -866,7 +866,7 @@ msk_lookup(const struct pci_attach_args *pa) * Probe for a SysKonnect GEnesis chip. Check the PCI vendor and device * IDs against our list and return a device name if we find a match. */ -int +static int mskc_probe(device_t parent, cfdata_t match, void *aux) { struct pci_attach_args *pa = (struct pci_attach_args *)aux; @@ -877,7 +877,7 @@ mskc_probe(device_t parent, cfdata_t match, void *aux) /* * Force the GEnesis into reset, then bring it out of reset. */ -void +static void mskc_reset(struct sk_softc *sc) { uint32_t imtimer_ticks, reg1; @@ -1078,7 +1078,7 @@ mskc_reset(struct sk_softc *sc) msk_update_int_mod(sc, 0); } -int +static int msk_probe(device_t parent, cfdata_t match, void *aux) { struct skc_attach_args *sa = aux; @@ -1104,7 +1104,7 @@ msk_probe(device_t parent, cfdata_t match, void *aux) return 0; } -void +static void msk_reset(struct sk_if_softc *sc_if) { /* GMAC and GPHY Reset */ @@ -1129,7 +1129,7 @@ msk_resume(device_t dv, const pmf_qual_t *qual) * Each XMAC chip is attached as a separate logical IP interface. * Single port cards will have only one logical interface of course. */ -void +static void msk_attach(device_t parent, device_t self, void *aux) { struct sk_if_softc *sc_if = device_private(self); @@ -1307,7 +1307,7 @@ fail: sc->sk_if[sa->skc_port] = NULL; } -int +static int msk_detach(device_t self, int flags) { struct sk_if_softc *sc_if = device_private(self); @@ -1352,7 +1352,7 @@ msk_detach(device_t self, int flags) return 0; } -int +static int mskcprint(void *aux, const char *pnp) { struct skc_attach_args *sa = aux; @@ -1370,7 +1370,7 @@ mskcprint(void *aux, const char *pnp) * Attach the interface. Allocate softc structures, do ifmedia * setup and ethernet/BPF attach. */ -void +static void mskc_attach(device_t parent, device_t self, void *aux) { struct sk_softc *sc = device_private(self); @@ -1753,7 +1753,7 @@ fail_1: sc->sk_bsize = 0; } -int +static int mskc_detach(device_t self, int flags) { struct sk_softc *sc = device_private(self); @@ -1787,7 +1787,7 @@ mskc_detach(device_t self, int flags) return 0; } -int +static int msk_encap(struct sk_if_softc *sc_if, struct mbuf *m_head, uint32_t *txidx) { struct sk_softc *sc = sc_if->sk_softc; @@ -1925,7 +1925,7 @@ msk_encap(struct sk_if_softc *sc_if, struct mbuf *m_head, uint32_t *txidx) return 0; } -void +static void msk_start(struct ifnet *ifp) { struct sk_if_softc *sc_if = ifp->if_softc; @@ -1973,7 +1973,7 @@ msk_start(struct ifnet *ifp) } } -void +static void msk_watchdog(struct ifnet *ifp) { struct sk_if_softc *sc_if = ifp->if_softc; @@ -2034,7 +2034,7 @@ msk_rxvalid(struct sk_softc *sc, uint32_t stat, uint32_t len) return 1; } -void +static void msk_rxeof(struct sk_if_softc *sc_if, uint16_t len, uint32_t rxstat) { struct sk_softc *sc = sc_if->sk_softc; @@ -2089,7 +2089,7 @@ msk_rxeof(struct sk_if_softc *sc_if, uint16_t len, uint32_t rxstat) if_percpuq_enqueue(ifp->if_percpuq, m); } -void +static void msk_txeof(struct sk_if_softc *sc_if) { struct sk_softc *sc = sc_if->sk_softc; @@ -2149,7 +2149,7 @@ msk_txeof(struct sk_if_softc *sc_if) sc_if->sk_cdata.sk_tx_cons = idx; } -void +static void msk_fill_rx_ring(struct sk_if_softc *sc_if) { /* Make sure to not completely wrap around */ @@ -2185,7 +2185,7 @@ msk_fill_rx_tick(void *xsc_if) splx(s); } -void +static void msk_tick(void *xsc_if) { struct sk_if_softc *sc_if = xsc_if; @@ -2199,7 +2199,7 @@ msk_tick(void *xsc_if) callout_schedule(&sc_if->sk_tick_ch, hz); } -void +static void msk_intr_yukon(struct sk_if_softc *sc_if) { uint8_t status; @@ -2219,7 +2219,7 @@ msk_intr_yukon(struct sk_if_softc *sc_if) DPRINTFN(2, ("msk_intr_yukon status=%#x\n", status)); } -int +static int msk_intr(void *xsc) { struct sk_softc *sc = xsc; @@ -2310,7 +2310,7 @@ msk_intr(void *xsc) return claimed; } -void +static void msk_init_yukon(struct sk_if_softc *sc_if) { uint32_t v; @@ -2452,7 +2452,7 @@ msk_init_yukon(struct sk_if_softc *sc_if) * Note that to properly initialize any part of the GEnesis chip, * you first have to take it out of reset mode. */ -int +static int msk_init(struct ifnet *ifp) { struct sk_if_softc *sc_if = ifp->if_softc; @@ -2615,7 +2615,7 @@ out: * Note: the logic of second parameter is inverted compared to OpenBSD * code, since this code uses the function as if_stop hook too. */ -void +static void msk_stop(struct ifnet *ifp, int disable) { struct sk_if_softc *sc_if = ifp->if_softc; @@ -2705,7 +2705,7 @@ CFATTACH_DECL3_NEW(msk, sizeof(struct sk_if_softc), msk_probe, msk_attach, msk_detach, NULL, NULL, NULL, DVF_DETACH_SHUTDOWN); #ifdef MSK_DEBUG -void +static void msk_dump_txdesc(struct msk_tx_desc *le, int idx) { #define DESC_PRINT(X) \ @@ -2720,7 +2720,7 @@ msk_dump_txdesc(struct msk_tx_desc *le, int idx) #undef DESC_PRINT } -void +static void msk_dump_bytes(const char *data, int len) { int c, i, j; @@ -2752,7 +2752,7 @@ msk_dump_bytes(const char *data, int len) } } -void +static void msk_dump_mbuf(struct mbuf *m) { int count = m->m_pkthdr.len; diff --git a/sys/dev/pci/if_sk.c b/sys/dev/pci/if_sk.c index 6b26cbcebea..87732eec76c 100644 --- a/sys/dev/pci/if_sk.c +++ b/sys/dev/pci/if_sk.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_sk.c,v 1.101 2019/11/10 21:16:36 chs Exp $ */ +/* $NetBSD: if_sk.c,v 1.102 2019/11/28 17:09:10 maxv Exp $ */ /*- * Copyright (c) 2003 The NetBSD Foundation, Inc. @@ -115,7 +115,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_sk.c,v 1.101 2019/11/10 21:16:36 chs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_sk.c,v 1.102 2019/11/28 17:09:10 maxv Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -153,57 +153,54 @@ __KERNEL_RCSID(0, "$NetBSD: if_sk.c,v 1.101 2019/11/10 21:16:36 chs Exp $"); #include <dev/pci/if_skreg.h> #include <dev/pci/if_skvar.h> -int skc_probe(device_t, cfdata_t, void *); -void skc_attach(device_t, device_t, void *); -int sk_probe(device_t, cfdata_t, void *); -void sk_attach(device_t, device_t, void *); -int skcprint(void *, const char *); -int sk_intr(void *); -void sk_intr_bcom(struct sk_if_softc *); -void sk_intr_xmac(struct sk_if_softc *); -void sk_intr_yukon(struct sk_if_softc *); -void sk_rxeof(struct sk_if_softc *); -void sk_txeof(struct sk_if_softc *); -int sk_encap(struct sk_if_softc *, struct mbuf *, uint32_t *); -void sk_start(struct ifnet *); -int sk_ioctl(struct ifnet *, u_long, void *); -int sk_init(struct ifnet *); -void sk_unreset_xmac(struct sk_if_softc *); -void sk_init_xmac(struct sk_if_softc *); -void sk_unreset_yukon(struct sk_if_softc *); -void sk_init_yukon(struct sk_if_softc *); -void sk_stop(struct ifnet *, int); -void sk_watchdog(struct ifnet *); -void sk_shutdown(void *); -int sk_ifmedia_upd(struct ifnet *); -void sk_reset(struct sk_softc *); -int sk_newbuf(struct sk_if_softc *, int, struct mbuf *, bus_dmamap_t); -int sk_alloc_jumbo_mem(struct sk_if_softc *); -void sk_free_jumbo_mem(struct sk_if_softc *); -void *sk_jalloc(struct sk_if_softc *); -void sk_jfree(struct mbuf *, void *, size_t, void *); -int sk_init_rx_ring(struct sk_if_softc *); -int sk_init_tx_ring(struct sk_if_softc *); -uint8_t sk_vpd_readbyte(struct sk_softc *, int); -void sk_vpd_read_res(struct sk_softc *, - struct vpd_res *, int); -void sk_vpd_read(struct sk_softc *); - -void sk_update_int_mod(struct sk_softc *); - -int sk_xmac_miibus_readreg(device_t, int, int, uint16_t *); -int sk_xmac_miibus_writereg(device_t, int, int, uint16_t); -void sk_xmac_miibus_statchg(struct ifnet *); - -int sk_marv_miibus_readreg(device_t, int, int, uint16_t *); -int sk_marv_miibus_writereg(device_t, int, int, uint16_t); -void sk_marv_miibus_statchg(struct ifnet *); - -uint32_t sk_xmac_hash(void *); -uint32_t sk_yukon_hash(void *); -void sk_setfilt(struct sk_if_softc *, void *, int); -void sk_setmulti(struct sk_if_softc *); -void sk_tick(void *); +static int skc_probe(device_t, cfdata_t, void *); +static void skc_attach(device_t, device_t, void *); +static int sk_probe(device_t, cfdata_t, void *); +static void sk_attach(device_t, device_t, void *); +static int skcprint(void *, const char *); +static int sk_intr(void *); +static void sk_intr_bcom(struct sk_if_softc *); +static void sk_intr_xmac(struct sk_if_softc *); +static void sk_intr_yukon(struct sk_if_softc *); +static void sk_rxeof(struct sk_if_softc *); +static void sk_txeof(struct sk_if_softc *); +static int sk_encap(struct sk_if_softc *, struct mbuf *, uint32_t *); +static void sk_start(struct ifnet *); +static int sk_ioctl(struct ifnet *, u_long, void *); +static int sk_init(struct ifnet *); +static void sk_unreset_xmac(struct sk_if_softc *); +static void sk_init_xmac(struct sk_if_softc *); +static void sk_unreset_yukon(struct sk_if_softc *); +static void sk_init_yukon(struct sk_if_softc *); +static void sk_stop(struct ifnet *, int); +static void sk_watchdog(struct ifnet *); +static int sk_ifmedia_upd(struct ifnet *); +static void sk_reset(struct sk_softc *); +static int sk_newbuf(struct sk_if_softc *, int, struct mbuf *, bus_dmamap_t); +static int sk_alloc_jumbo_mem(struct sk_if_softc *); +static void *sk_jalloc(struct sk_if_softc *); +static void sk_jfree(struct mbuf *, void *, size_t, void *); +static int sk_init_rx_ring(struct sk_if_softc *); +static int sk_init_tx_ring(struct sk_if_softc *); +static uint8_t sk_vpd_readbyte(struct sk_softc *, int); +static void sk_vpd_read_res(struct sk_softc *, struct vpd_res *, int); +static void sk_vpd_read(struct sk_softc *); + +static void sk_update_int_mod(struct sk_softc *); + +static int sk_xmac_miibus_readreg(device_t, int, int, uint16_t *); +static int sk_xmac_miibus_writereg(device_t, int, int, uint16_t); +static void sk_xmac_miibus_statchg(struct ifnet *); + +static int sk_marv_miibus_readreg(device_t, int, int, uint16_t *); +static int sk_marv_miibus_writereg(device_t, int, int, uint16_t); +static void sk_marv_miibus_statchg(struct ifnet *); + +static uint32_t sk_xmac_hash(void *); +static uint32_t sk_yukon_hash(void *); +static void sk_setfilt(struct sk_if_softc *, void *, int); +static void sk_setmulti(struct sk_if_softc *); +static void sk_tick(void *); static bool skc_suspend(device_t, const pmf_qual_t *); static bool skc_resume(device_t, const pmf_qual_t *); @@ -215,9 +212,9 @@ static bool sk_resume(device_t dv, const pmf_qual_t *); #define DPRINTFN(n, x) if (skdebug >= (n)) printf x int skdebug = SK_DEBUG; -void sk_dump_txdesc(struct sk_tx_desc *, int); -void sk_dump_mbuf(struct mbuf *); -void sk_dump_bytes(const char *, int); +static void sk_dump_txdesc(struct sk_tx_desc *, int); +static void sk_dump_mbuf(struct mbuf *); +static void sk_dump_bytes(const char *, int); #else #define DPRINTF(x) #define DPRINTFN(n, x) @@ -322,7 +319,7 @@ sk_win_write_1(struct sk_softc *sc, uint32_t reg, uint8_t x) * the controller softc structure for later use. At the moment, * we only use the ID string during sk_attach(). */ -uint8_t +static uint8_t sk_vpd_readbyte(struct sk_softc *sc, int addr) { int i; @@ -341,7 +338,7 @@ sk_vpd_readbyte(struct sk_softc *sc, int addr) return sk_win_read_1(sc, SK_PCI_REG(SK_PCI_VPD_DATA)); } -void +static void sk_vpd_read_res(struct sk_softc *sc, struct vpd_res *res, int addr) { int i; @@ -352,7 +349,7 @@ sk_vpd_read_res(struct sk_softc *sc, struct vpd_res *res, int addr) ptr[i] = sk_vpd_readbyte(sc, i + addr); } -void +static void sk_vpd_read(struct sk_softc *sc) { int pos = 0, i; @@ -396,7 +393,7 @@ sk_vpd_read(struct sk_softc *sc) sc->sk_vpd_readonly[i] = sk_vpd_readbyte(sc, i + pos); } -int +static int sk_xmac_miibus_readreg(device_t dev, int phy, int reg, uint16_t *val) { struct sk_if_softc *sc_if = device_private(dev); @@ -428,7 +425,7 @@ sk_xmac_miibus_readreg(device_t dev, int phy, int reg, uint16_t *val) return 0; } -int +static int sk_xmac_miibus_writereg(device_t dev, int phy, int reg, uint16_t val) { struct sk_if_softc *sc_if = device_private(dev); @@ -462,7 +459,7 @@ sk_xmac_miibus_writereg(device_t dev, int phy, int reg, uint16_t val) return 0; } -void +static void sk_xmac_miibus_statchg(struct ifnet *ifp) { struct sk_if_softc *sc_if = ifp->if_softc; @@ -482,7 +479,7 @@ sk_xmac_miibus_statchg(struct ifnet *ifp) } } -int +static int sk_marv_miibus_readreg(device_t dev, int phy, int reg, uint16_t *val) { struct sk_if_softc *sc_if = device_private(dev); @@ -523,7 +520,7 @@ sk_marv_miibus_readreg(device_t dev, int phy, int reg, uint16_t *val) return 0; } -int +static int sk_marv_miibus_writereg(device_t dev, int phy, int reg, uint16_t val) { struct sk_if_softc *sc_if = device_private(dev); @@ -551,7 +548,7 @@ sk_marv_miibus_writereg(device_t dev, int phy, int reg, uint16_t val) return 0; } -void +static void sk_marv_miibus_statchg(struct ifnet *ifp) { DPRINTFN(9, ("sk_marv_miibus_statchg: gpcr=%x\n", @@ -559,7 +556,7 @@ sk_marv_miibus_statchg(struct ifnet *ifp) YUKON_GPCR))); } -uint32_t +static uint32_t sk_xmac_hash(void *addr) { uint32_t crc; @@ -570,7 +567,7 @@ sk_xmac_hash(void *addr) return crc; } -uint32_t +static uint32_t sk_yukon_hash(void *addr) { uint32_t crc; @@ -581,7 +578,7 @@ sk_yukon_hash(void *addr) return crc; } -void +static void sk_setfilt(struct sk_if_softc *sc_if, void *addrv, int slot) { char *addr = addrv; @@ -592,7 +589,7 @@ sk_setfilt(struct sk_if_softc *sc_if, void *addrv, int slot) SK_XM_WRITE_2(sc_if, base + 4, *(uint16_t *)(&addr[4])); } -void +static void sk_setmulti(struct sk_if_softc *sc_if) { struct sk_softc *sc = sc_if->sk_softc; @@ -691,7 +688,7 @@ allmulti: } } -int +static int sk_init_rx_ring(struct sk_if_softc *sc_if) { struct sk_chain_data *cd = &sc_if->sk_cdata; @@ -728,7 +725,7 @@ sk_init_rx_ring(struct sk_if_softc *sc_if) return 0; } -int +static int sk_init_tx_ring(struct sk_if_softc *sc_if) { struct sk_chain_data *cd = &sc_if->sk_cdata; @@ -761,7 +758,7 @@ sk_init_tx_ring(struct sk_if_softc *sc_if) return 0; } -int +static int sk_newbuf(struct sk_if_softc *sc_if, int i, struct mbuf *m, bus_dmamap_t dmamap) { @@ -821,7 +818,7 @@ sk_newbuf(struct sk_if_softc *sc_if, int i, struct mbuf *m, * Memory management for jumbo frames. */ -int +static int sk_alloc_jumbo_mem(struct sk_if_softc *sc_if) { struct sk_softc *sc = sc_if->sk_softc; @@ -919,7 +916,7 @@ out: /* * Allocate a jumbo buffer. */ -void * +static void * sk_jalloc(struct sk_if_softc *sc_if) { struct sk_jpool_entry *entry; @@ -941,7 +938,7 @@ sk_jalloc(struct sk_if_softc *sc_if) /* * Release a jumbo buffer. */ -void +static void sk_jfree(struct mbuf *m, void *buf, size_t size, void *arg) { struct sk_jpool_entry *entry; @@ -978,7 +975,7 @@ sk_jfree(struct mbuf *m, void *buf, size_t size, void *arg) /* * Set media options. */ -int +static int sk_ifmedia_upd(struct ifnet *ifp) { struct sk_if_softc *sc_if = ifp->if_softc; @@ -1018,7 +1015,7 @@ sk_promisc(struct sk_if_softc *sc_if, int on) } } -int +static int sk_ioctl(struct ifnet *ifp, u_long command, void *data) { struct sk_if_softc *sc_if = ifp->if_softc; @@ -1073,7 +1070,7 @@ sk_ioctl(struct ifnet *ifp, u_long command, void *data) return error; } -void +static void sk_update_int_mod(struct sk_softc *sc) { uint32_t imtimer_ticks; @@ -1128,7 +1125,7 @@ sk_lookup(const struct pci_attach_args *pa) * Probe for a SysKonnect GEnesis chip. */ -int +static int skc_probe(device_t parent, cfdata_t match, void *aux) { struct pci_attach_args *pa = (struct pci_attach_args *)aux; @@ -1152,7 +1149,7 @@ skc_probe(device_t parent, cfdata_t match, void *aux) /* * Force the GEnesis into reset, then bring it out of reset. */ -void +static void sk_reset(struct sk_softc *sc) { DPRINTFN(2, ("sk_reset\n")); @@ -1188,7 +1185,7 @@ sk_reset(struct sk_softc *sc) sk_update_int_mod(sc); } -int +static int sk_probe(device_t parent, cfdata_t match, void *aux) { struct skc_attach_args *sa = aux; @@ -1203,7 +1200,7 @@ sk_probe(device_t parent, cfdata_t match, void *aux) * Each XMAC chip is attached as a separate logical IP interface. * Single port cards will have only one logical interface of course. */ -void +static void sk_attach(device_t parent, device_t self, void *aux) { struct sk_if_softc *sc_if = device_private(self); @@ -1477,7 +1474,7 @@ fail: sc->sk_if[sa->skc_port] = NULL; } -int +static int skcprint(void *aux, const char *pnp) { struct skc_attach_args *sa = aux; @@ -1495,7 +1492,7 @@ skcprint(void *aux, const char *pnp) * Attach the interface. Allocate softc structures, do ifmedia * setup and ethernet/BPF attach. */ -void +static void skc_attach(device_t parent, device_t self, void *aux) { struct sk_softc *sc = device_private(self); @@ -1851,7 +1848,7 @@ fail: bus_space_unmap(sc->sk_btag, sc->sk_bhandle, iosize); } -int +static int sk_encap(struct sk_if_softc *sc_if, struct mbuf *m_head, uint32_t *txidx) { struct sk_softc *sc = sc_if->sk_softc; @@ -1950,7 +1947,7 @@ sk_encap(struct sk_if_softc *sc_if, struct mbuf *m_head, uint32_t *txidx) return 0; } -void +static void sk_start(struct ifnet *ifp) { struct sk_if_softc *sc_if = ifp->if_softc; @@ -2001,7 +1998,7 @@ sk_start(struct ifnet *ifp) } -void +static void sk_watchdog(struct ifnet *ifp) { struct sk_if_softc *sc_if = ifp->if_softc; @@ -2020,7 +2017,8 @@ sk_watchdog(struct ifnet *ifp) } } -void +#if 0 /* XXX XXX XXX UNUSED */ +static void sk_shutdown(void *v) { struct sk_if_softc *sc_if = (struct sk_if_softc *)v; @@ -2039,8 +2037,9 @@ sk_shutdown(void *v) */ sk_reset(sc); } +#endif -void +static void sk_rxeof(struct sk_if_softc *sc_if) { struct ifnet *ifp = &sc_if->sk_ethercom.ec_if; @@ -2122,7 +2121,7 @@ sk_rxeof(struct sk_if_softc *sc_if) } } -void +static void sk_txeof(struct sk_if_softc *sc_if) { struct sk_softc *sc = sc_if->sk_softc; @@ -2182,7 +2181,7 @@ sk_txeof(struct sk_if_softc *sc_if) sc_if->sk_cdata.sk_tx_cons = idx; } -void +static void sk_tick(void *xsc_if) { struct sk_if_softc *sc_if = xsc_if; @@ -2227,7 +2226,7 @@ sk_tick(void *xsc_if) callout_stop(&sc_if->sk_tick_ch); } -void +static void sk_intr_bcom(struct sk_if_softc *sc_if) { struct mii_data *mii = &sc_if->sk_mii; @@ -2281,7 +2280,7 @@ sk_intr_bcom(struct sk_if_softc *sc_if) SK_XM_SETBIT_2(sc_if, XM_MMUCMD, XM_MMUCMD_TX_ENB | XM_MMUCMD_RX_ENB); } -void +static void sk_intr_xmac(struct sk_if_softc *sc_if) { uint16_t status = SK_XM_READ_2(sc_if, XM_ISR); @@ -2306,7 +2305,7 @@ sk_intr_xmac(struct sk_if_softc *sc_if) SK_XM_SETBIT_4(sc_if, XM_MODE, XM_MODE_FLUSH_RXFIFO); } -void +static void sk_intr_yukon(struct sk_if_softc *sc_if) { #ifdef SK_DEBUG @@ -2319,7 +2318,7 @@ sk_intr_yukon(struct sk_if_softc *sc_if) DPRINTFN(3, ("sk_intr_yukon status=%#x\n", status)); } -int +static int sk_intr(void *xsc) { struct sk_softc *sc = xsc; @@ -2412,7 +2411,7 @@ sk_intr(void *xsc) return claimed; } -void +static void sk_unreset_xmac(struct sk_if_softc *sc_if) { struct sk_softc *sc = sc_if->sk_softc; @@ -2480,7 +2479,7 @@ sk_unreset_xmac(struct sk_if_softc *sc_if) } } -void +static void sk_init_xmac(struct sk_if_softc *sc_if) { struct sk_softc *sc = sc_if->sk_softc; @@ -2585,7 +2584,7 @@ sk_init_xmac(struct sk_if_softc *sc_if) sc_if->sk_link = 1; } -void +static void sk_unreset_yukon(struct sk_if_softc *sc_if) { uint32_t /*mac, */phy; @@ -2644,7 +2643,7 @@ sk_unreset_yukon(struct sk_if_softc *sc_if) SK_IF_READ_4(sc_if, 0, SK_GMAC_CTRL))); } -void +static void sk_init_yukon(struct sk_if_softc *sc_if) { uint16_t reg; @@ -2728,7 +2727,7 @@ sk_init_yukon(struct sk_if_softc *sc_if) * Note that to properly initialize any part of the GEnesis chip, * you first have to take it out of reset mode. */ -int +static int sk_init(struct ifnet *ifp) { struct sk_if_softc *sc_if = ifp->if_softc; @@ -2901,7 +2900,7 @@ out: return rc; } -void +static void sk_stop(struct ifnet *ifp, int disable) { struct sk_if_softc *sc_if = ifp->if_softc; @@ -3024,7 +3023,7 @@ CFATTACH_DECL_NEW(sk, sizeof(struct sk_if_softc), sk_probe, sk_attach, NULL, NULL); #ifdef SK_DEBUG -void +static void sk_dump_txdesc(struct sk_tx_desc *desc, int idx) { #define DESC_PRINT(X) \ @@ -3045,7 +3044,7 @@ sk_dump_txdesc(struct sk_tx_desc *desc, int idx) #undef PRINT } -void +static void sk_dump_bytes(const char *data, int len) { int c, i, j; @@ -3077,7 +3076,7 @@ sk_dump_bytes(const char *data, int len) } } -void +static void sk_dump_mbuf(struct mbuf *m) { int count = m->m_pkthdr.len; diff --git a/sys/dev/pci/mpii.c b/sys/dev/pci/mpii.c index a0fffc45aed..b763ab83b84 100644 --- a/sys/dev/pci/mpii.c +++ b/sys/dev/pci/mpii.c @@ -1,4 +1,4 @@ -/* $NetBSD: mpii.c,v 1.23 2019/11/10 21:16:36 chs Exp $ */ +/* $NetBSD: mpii.c,v 1.24 2019/11/28 17:09:10 maxv Exp $ */ /* $OpenBSD: mpii.c,v 1.115 2018/08/14 05:22:21 jmatthew Exp $ */ /* * Copyright (c) 2010, 2012 Mike Belopuhov @@ -20,7 +20,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: mpii.c,v 1.23 2019/11/10 21:16:36 chs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mpii.c,v 1.24 2019/11/28 17:09:10 maxv Exp $"); #include "bio.h" @@ -248,101 +248,101 @@ struct mpii_softc { envsys_data_t *sc_sensors; }; -int mpii_match(device_t, cfdata_t, void *); -void mpii_attach(device_t, device_t, void *); -int mpii_detach(device_t, int); -void mpii_childdetached(device_t, device_t); -int mpii_rescan(device_t, const char *, const int *); +static int mpii_match(device_t, cfdata_t, void *); +static void mpii_attach(device_t, device_t, void *); +static int mpii_detach(device_t, int); +static void mpii_childdetached(device_t, device_t); +static int mpii_rescan(device_t, const char *, const int *); -int mpii_intr(void *); +static int mpii_intr(void *); CFATTACH_DECL3_NEW(mpii, sizeof(struct mpii_softc), mpii_match, mpii_attach, mpii_detach, NULL, mpii_rescan, mpii_childdetached, DVF_DETACH_SHUTDOWN); -void mpii_scsipi_request(struct scsipi_channel *, +static void mpii_scsipi_request(struct scsipi_channel *, scsipi_adapter_req_t, void *); -void mpii_scsi_cmd_done(struct mpii_ccb *); +static void mpii_scsi_cmd_done(struct mpii_ccb *); -struct mpii_dmamem * +static struct mpii_dmamem * mpii_dmamem_alloc(struct mpii_softc *, size_t); -void mpii_dmamem_free(struct mpii_softc *, +static void mpii_dmamem_free(struct mpii_softc *, struct mpii_dmamem *); -int mpii_alloc_ccbs(struct mpii_softc *); -struct mpii_ccb *mpii_get_ccb(struct mpii_softc *); -void mpii_put_ccb(struct mpii_softc *, struct mpii_ccb *); -int mpii_alloc_replies(struct mpii_softc *); -int mpii_alloc_queues(struct mpii_softc *); -void mpii_push_reply(struct mpii_softc *, struct mpii_rcb *); -void mpii_push_replies(struct mpii_softc *); - -void mpii_scsi_cmd_tmo(void *); -void mpii_scsi_cmd_tmo_handler(struct work *, void *); -void mpii_scsi_cmd_tmo_done(struct mpii_ccb *); - -int mpii_insert_dev(struct mpii_softc *, struct mpii_device *); -int mpii_remove_dev(struct mpii_softc *, struct mpii_device *); -struct mpii_device * +static int mpii_alloc_ccbs(struct mpii_softc *); +static struct mpii_ccb *mpii_get_ccb(struct mpii_softc *); +static void mpii_put_ccb(struct mpii_softc *, struct mpii_ccb *); +static int mpii_alloc_replies(struct mpii_softc *); +static int mpii_alloc_queues(struct mpii_softc *); +static void mpii_push_reply(struct mpii_softc *, struct mpii_rcb *); +static void mpii_push_replies(struct mpii_softc *); + +static void mpii_scsi_cmd_tmo(void *); +static void mpii_scsi_cmd_tmo_handler(struct work *, void *); +static void mpii_scsi_cmd_tmo_done(struct mpii_ccb *); + +static int mpii_insert_dev(struct mpii_softc *, struct mpii_device *); +static int mpii_remove_dev(struct mpii_softc *, struct mpii_device *); +static struct mpii_device * mpii_find_dev(struct mpii_softc *, u_int16_t); -void mpii_start(struct mpii_softc *, struct mpii_ccb *); -int mpii_poll(struct mpii_softc *, struct mpii_ccb *); -void mpii_poll_done(struct mpii_ccb *); -struct mpii_rcb * +static void mpii_start(struct mpii_softc *, struct mpii_ccb *); +static int mpii_poll(struct mpii_softc *, struct mpii_ccb *); +static void mpii_poll_done(struct mpii_ccb *); +static struct mpii_rcb * mpii_reply(struct mpii_softc *, struct mpii_reply_descr *); -void mpii_wait(struct mpii_softc *, struct mpii_ccb *); -void mpii_wait_done(struct mpii_ccb *); +static void mpii_wait(struct mpii_softc *, struct mpii_ccb *); +static void mpii_wait_done(struct mpii_ccb *); -void mpii_init_queues(struct mpii_softc *); +static void mpii_init_queues(struct mpii_softc *); -int mpii_load_xs(struct mpii_ccb *); -int mpii_load_xs_sas3(struct mpii_ccb *); +static int mpii_load_xs(struct mpii_ccb *); +static int mpii_load_xs_sas3(struct mpii_ccb *); -u_int32_t mpii_read(struct mpii_softc *, bus_size_t); -void mpii_write(struct mpii_softc *, bus_size_t, u_int32_t); -int mpii_wait_eq(struct mpii_softc *, bus_size_t, u_int32_t, +static u_int32_t mpii_read(struct mpii_softc *, bus_size_t); +static void mpii_write(struct mpii_softc *, bus_size_t, u_int32_t); +static int mpii_wait_eq(struct mpii_softc *, bus_size_t, u_int32_t, u_int32_t); -int mpii_wait_ne(struct mpii_softc *, bus_size_t, u_int32_t, +static int mpii_wait_ne(struct mpii_softc *, bus_size_t, u_int32_t, u_int32_t); -int mpii_init(struct mpii_softc *); -int mpii_reset_soft(struct mpii_softc *); -int mpii_reset_hard(struct mpii_softc *); +static int mpii_init(struct mpii_softc *); +static int mpii_reset_soft(struct mpii_softc *); +static int mpii_reset_hard(struct mpii_softc *); -int mpii_handshake_send(struct mpii_softc *, void *, size_t); -int mpii_handshake_recv_dword(struct mpii_softc *, +static int mpii_handshake_send(struct mpii_softc *, void *, size_t); +static int mpii_handshake_recv_dword(struct mpii_softc *, u_int32_t *); -int mpii_handshake_recv(struct mpii_softc *, void *, size_t); - -void mpii_empty_done(struct mpii_ccb *); - -int mpii_iocinit(struct mpii_softc *); -int mpii_iocfacts(struct mpii_softc *); -int mpii_portfacts(struct mpii_softc *); -int mpii_portenable(struct mpii_softc *); -int mpii_cfg_coalescing(struct mpii_softc *); -int mpii_board_info(struct mpii_softc *); -int mpii_target_map(struct mpii_softc *); - -int mpii_eventnotify(struct mpii_softc *); -void mpii_eventnotify_done(struct mpii_ccb *); -void mpii_eventack(struct work *, void *); -void mpii_eventack_done(struct mpii_ccb *); -void mpii_event_process(struct mpii_softc *, struct mpii_rcb *); -void mpii_event_done(struct mpii_softc *, struct mpii_rcb *); -void mpii_event_sas(struct mpii_softc *, struct mpii_rcb *); -void mpii_event_sas_work(struct work *, void *); -void mpii_event_raid(struct mpii_softc *, +static int mpii_handshake_recv(struct mpii_softc *, void *, size_t); + +static void mpii_empty_done(struct mpii_ccb *); + +static int mpii_iocinit(struct mpii_softc *); +static int mpii_iocfacts(struct mpii_softc *); +static int mpii_portfacts(struct mpii_softc *); +static int mpii_portenable(struct mpii_softc *); +static int mpii_cfg_coalescing(struct mpii_softc *); +static int mpii_board_info(struct mpii_softc *); +static int mpii_target_map(struct mpii_softc *); + +static int mpii_eventnotify(struct mpii_softc *); +static void mpii_eventnotify_done(struct mpii_ccb *); +static void mpii_eventack(struct work *, void *); +static void mpii_eventack_done(struct mpii_ccb *); +static void mpii_event_process(struct mpii_softc *, struct mpii_rcb *); +static void mpii_event_done(struct mpii_softc *, struct mpii_rcb *); +static void mpii_event_sas(struct mpii_softc *, struct mpii_rcb *); +static void mpii_event_sas_work(struct work *, void *); +static void mpii_event_raid(struct mpii_softc *, struct mpii_msg_event_reply *); -void mpii_event_discovery(struct mpii_softc *, +static void mpii_event_discovery(struct mpii_softc *, struct mpii_msg_event_reply *); -void mpii_sas_remove_device(struct mpii_softc *, u_int16_t); +static void mpii_sas_remove_device(struct mpii_softc *, u_int16_t); -int mpii_req_cfg_header(struct mpii_softc *, u_int8_t, +static int mpii_req_cfg_header(struct mpii_softc *, u_int8_t, u_int8_t, u_int32_t, int, void *); -int mpii_req_cfg_page(struct mpii_softc *, u_int32_t, int, +static int mpii_req_cfg_page(struct mpii_softc *, u_int32_t, int, void *, int, void *, size_t); #if 0 @@ -350,21 +350,21 @@ int mpii_ioctl_cache(struct scsi_link *, u_long, struct dk_cache *); #endif #if NBIO > 0 -int mpii_ioctl(device_t, u_long, void *); -int mpii_ioctl_inq(struct mpii_softc *, struct bioc_inq *); -int mpii_ioctl_vol(struct mpii_softc *, struct bioc_vol *); -int mpii_ioctl_disk(struct mpii_softc *, struct bioc_disk *); -int mpii_bio_hs(struct mpii_softc *, struct bioc_disk *, int, +static int mpii_ioctl(device_t, u_long, void *); +static int mpii_ioctl_inq(struct mpii_softc *, struct bioc_inq *); +static int mpii_ioctl_vol(struct mpii_softc *, struct bioc_vol *); +static int mpii_ioctl_disk(struct mpii_softc *, struct bioc_disk *); +static int mpii_bio_hs(struct mpii_softc *, struct bioc_disk *, int, int, int *); -int mpii_bio_disk(struct mpii_softc *, struct bioc_disk *, +static int mpii_bio_disk(struct mpii_softc *, struct bioc_disk *, u_int8_t); -struct mpii_device * +static struct mpii_device * mpii_find_vol(struct mpii_softc *, int); #ifndef SMALL_KERNEL - int mpii_bio_volstate(struct mpii_softc *, struct bioc_vol *); -int mpii_create_sensors(struct mpii_softc *); -void mpii_refresh_sensors(struct sysmon_envsys *, envsys_data_t *); -int mpii_destroy_sensors(struct mpii_softc *); +static int mpii_bio_volstate(struct mpii_softc *, struct bioc_vol *); +static int mpii_create_sensors(struct mpii_softc *); +static void mpii_refresh_sensors(struct sysmon_envsys *, envsys_data_t *); +static int mpii_destroy_sensors(struct mpii_softc *); #endif /* SMALL_KERNEL */ #endif /* NBIO > 0 */ @@ -437,7 +437,7 @@ static const struct mpii_pci_product { { 0, 0} }; -int +static int mpii_match(device_t parent, cfdata_t match, void *aux) { struct pci_attach_args *pa = aux; @@ -451,7 +451,7 @@ mpii_match(device_t parent, cfdata_t match, void *aux) return (0); } -void +static void mpii_attach(device_t parent, device_t self, void *aux) { struct mpii_softc *sc = device_private(self); @@ -669,7 +669,7 @@ unmap: sc->sc_ios = 0; } -int +static int mpii_detach(device_t self, int flags) { struct mpii_softc *sc = device_private(self); @@ -716,7 +716,7 @@ mpii_detach(device_t self, int flags) return (0); } -int +static int mpii_rescan(device_t self, const char *ifattr, const int *locators) { struct mpii_softc *sc = device_private(self); @@ -730,7 +730,7 @@ mpii_rescan(device_t self, const char *ifattr, const int *locators) return 0; } -void +static void mpii_childdetached(device_t self, device_t child) { struct mpii_softc *sc = device_private(self); @@ -743,7 +743,7 @@ mpii_childdetached(device_t self, device_t child) } -int +static int mpii_intr(void *arg) { struct mpii_rcb_list evts = SIMPLEQ_HEAD_INITIALIZER(evts); @@ -818,7 +818,7 @@ mpii_intr(void *arg) return (1); } -int +static int mpii_load_xs_sas3(struct mpii_ccb *ccb) { struct mpii_softc *sc = ccb->ccb_sc; @@ -876,7 +876,7 @@ mpii_load_xs_sas3(struct mpii_ccb *ccb) return (0); } -int +static int mpii_load_xs(struct mpii_ccb *ccb) { struct mpii_softc *sc = ccb->ccb_sc; @@ -942,7 +942,7 @@ mpii_load_xs(struct mpii_ccb *ccb) return (0); } -u_int32_t +static u_int32_t mpii_read(struct mpii_softc *sc, bus_size_t r) { u_int32_t rv; @@ -956,7 +956,7 @@ mpii_read(struct mpii_softc *sc, bus_size_t r) return (rv); } -void +static void mpii_write(struct mpii_softc *sc, bus_size_t r, u_int32_t v) { DNPRINTF(MPII_D_RW, "%s: mpii_write %#lx %#x\n", DEVNAME(sc), r, v); @@ -967,7 +967,7 @@ mpii_write(struct mpii_softc *sc, bus_size_t r, u_int32_t v) } -int +static int mpii_wait_eq(struct mpii_softc *sc, bus_size_t r, u_int32_t mask, u_int32_t target) { @@ -985,7 +985,7 @@ mpii_wait_eq(struct mpii_softc *sc, bus_size_t r, u_int32_t mask, return (1); } -int +static int mpii_wait_ne(struct mpii_softc *sc, bus_size_t r, u_int32_t mask, u_int32_t target) { @@ -1003,7 +1003,7 @@ mpii_wait_ne(struct mpii_softc *sc, bus_size_t r, u_int32_t mask, return (1); } -int +static int mpii_init(struct mpii_softc *sc) { u_int32_t db; @@ -1061,7 +1061,7 @@ mpii_init(struct mpii_softc *sc) return (1); } -int +static int mpii_reset_soft(struct mpii_softc *sc) { DNPRINTF(MPII_D_MISC, "%s: mpii_reset_soft\n", DEVNAME(sc)); @@ -1087,7 +1087,7 @@ mpii_reset_soft(struct mpii_softc *sc) return (0); } -int +static int mpii_reset_hard(struct mpii_softc *sc) { u_int16_t i; @@ -1140,7 +1140,7 @@ mpii_reset_hard(struct mpii_softc *sc) return(0); } -int +static int mpii_handshake_send(struct mpii_softc *sc, void *buf, size_t dwords) { u_int32_t *query = buf; @@ -1183,7 +1183,7 @@ mpii_handshake_send(struct mpii_softc *sc, void *buf, size_t dwords) return (0); } -int +static int mpii_handshake_recv_dword(struct mpii_softc *sc, u_int32_t *dword) { u_int16_t *words = (u_int16_t *)dword; @@ -1199,7 +1199,7 @@ mpii_handshake_recv_dword(struct mpii_softc *sc, u_int32_t *dword) return (0); } -int +static int mpii_handshake_recv(struct mpii_softc *sc, void *buf, size_t dwords) { struct mpii_msg_reply *reply = buf; @@ -1242,13 +1242,13 @@ mpii_handshake_recv(struct mpii_softc *sc, void *buf, size_t dwords) return (0); } -void +static void mpii_empty_done(struct mpii_ccb *ccb) { /* nothing to do */ } -int +static int mpii_iocfacts(struct mpii_softc *sc) { struct mpii_msg_iocfacts_request ifq; @@ -1385,7 +1385,7 @@ mpii_iocfacts(struct mpii_softc *sc) return (0); } -int +static int mpii_iocinit(struct mpii_softc *sc) { struct mpii_msg_iocinit_request iiq; @@ -1468,7 +1468,7 @@ mpii_iocinit(struct mpii_softc *sc) return (0); } -void +static void mpii_push_reply(struct mpii_softc *sc, struct mpii_rcb *rcb) { u_int32_t *rfp; @@ -1490,7 +1490,7 @@ mpii_push_reply(struct mpii_softc *sc, struct mpii_rcb *rcb) mutex_exit(&sc->sc_reply_free_mtx); } -int +static int mpii_portfacts(struct mpii_softc *sc) { struct mpii_msg_portfacts_request *pfq; @@ -1542,7 +1542,7 @@ err: return (rv); } -void +static void mpii_eventack(struct work *wk, void * cookie) { struct mpii_softc *sc = cookie; @@ -1577,7 +1577,7 @@ mpii_eventack(struct work *wk, void * cookie) } } -void +static void mpii_eventack_done(struct mpii_ccb *ccb) { struct mpii_softc *sc = ccb->ccb_sc; @@ -1588,7 +1588,7 @@ mpii_eventack_done(struct mpii_ccb *ccb) mpii_put_ccb(sc, ccb); } -int +static int mpii_portenable(struct mpii_softc *sc) { struct mpii_msg_portenable_request *peq; @@ -1627,7 +1627,7 @@ mpii_portenable(struct mpii_softc *sc) return (0); } -int +static int mpii_cfg_coalescing(struct mpii_softc *sc) { struct mpii_cfg_hdr hdr; @@ -1672,7 +1672,7 @@ mpii_cfg_coalescing(struct mpii_softc *sc) htole32(~(1 << (evt % 32))); \ } while (0) -int +static int mpii_eventnotify(struct mpii_softc *sc) { struct mpii_msg_event_request *enq; @@ -1741,7 +1741,7 @@ mpii_eventnotify(struct mpii_softc *sc) return (0); } -void +static void mpii_eventnotify_done(struct mpii_ccb *ccb) { struct mpii_softc *sc = ccb->ccb_sc; @@ -1753,7 +1753,7 @@ mpii_eventnotify_done(struct mpii_ccb *ccb) mpii_event_process(sc, rcb); } -void +static void mpii_event_raid(struct mpii_softc *sc, struct mpii_msg_event_reply *enp) { struct mpii_evt_ir_cfg_change_list *ccl; @@ -1857,7 +1857,7 @@ mpii_event_raid(struct mpii_softc *sc, struct mpii_msg_event_reply *enp) } } -void +static void mpii_event_sas(struct mpii_softc *sc, struct mpii_rcb *rcb) { struct mpii_msg_event_reply *enp; @@ -1937,7 +1937,7 @@ mpii_event_sas(struct mpii_softc *sc, struct mpii_rcb *rcb) mpii_event_done(sc, rcb); } -void +static void mpii_event_sas_work(struct work *wq, void *xsc) { struct mpii_softc *sc = xsc; @@ -2003,7 +2003,7 @@ mpii_event_sas_work(struct work *wq, void *xsc) } } -void +static void mpii_event_discovery(struct mpii_softc *sc, struct mpii_msg_event_reply *enp) { struct mpii_evt_sas_discovery *esd = @@ -2018,7 +2018,7 @@ mpii_event_discovery(struct mpii_softc *sc, struct mpii_msg_event_reply *enp) } } -void +static void mpii_event_process(struct mpii_softc *sc, struct mpii_rcb *rcb) { struct mpii_msg_event_reply *enp; @@ -2106,7 +2106,7 @@ mpii_event_process(struct mpii_softc *sc, struct mpii_rcb *rcb) mpii_event_done(sc, rcb); } -void +static void mpii_event_done(struct mpii_softc *sc, struct mpii_rcb *rcb) { struct mpii_msg_event_reply *enp = rcb->rcb_reply; @@ -2124,7 +2124,7 @@ mpii_event_done(struct mpii_softc *sc, struct mpii_rcb *rcb) mpii_push_reply(sc, rcb); } -void +static void mpii_sas_remove_device(struct mpii_softc *sc, u_int16_t handle) { struct mpii_msg_scsi_task_request *stq; @@ -2164,7 +2164,7 @@ mpii_sas_remove_device(struct mpii_softc *sc, u_int16_t handle) mpii_put_ccb(sc, ccb); } -int +static int mpii_board_info(struct mpii_softc *sc) { struct mpii_msg_iocfacts_request ifq; @@ -2210,7 +2210,7 @@ mpii_board_info(struct mpii_softc *sc) return (0); } -int +static int mpii_target_map(struct mpii_softc *sc) { struct mpii_cfg_hdr hdr; @@ -2248,7 +2248,7 @@ mpii_target_map(struct mpii_softc *sc) return (0); } -int +static int mpii_req_cfg_header(struct mpii_softc *sc, u_int8_t type, u_int8_t number, u_int32_t address, int flags, void *p) { @@ -2343,7 +2343,7 @@ mpii_req_cfg_header(struct mpii_softc *sc, u_int8_t type, u_int8_t number, return (rv); } -int +static int mpii_req_cfg_page(struct mpii_softc *sc, u_int32_t address, int flags, void *p, int read, void *page, size_t len) { @@ -2451,7 +2451,7 @@ mpii_req_cfg_page(struct mpii_softc *sc, u_int32_t address, int flags, return (rv); } -struct mpii_rcb * +static struct mpii_rcb * mpii_reply(struct mpii_softc *sc, struct mpii_reply_descr *rdp) { struct mpii_rcb *rcb = NULL; @@ -2482,7 +2482,7 @@ mpii_reply(struct mpii_softc *sc, struct mpii_reply_descr *rdp) return (rcb); } -struct mpii_dmamem * +static struct mpii_dmamem * mpii_dmamem_alloc(struct mpii_softc *sc, size_t size) { struct mpii_dmamem *mdm; @@ -2523,7 +2523,7 @@ mdmfree: return (NULL); } -void +static void mpii_dmamem_free(struct mpii_softc *sc, struct mpii_dmamem *mdm) { DNPRINTF(MPII_D_MEM, "%s: mpii_dmamem_free %p\n", DEVNAME(sc), mdm); @@ -2535,7 +2535,7 @@ mpii_dmamem_free(struct mpii_softc *sc, struct mpii_dmamem *mdm) free(mdm, M_DEVBUF); } -int +static int mpii_insert_dev(struct mpii_softc *sc, struct mpii_device *dev) { int slot; /* initial hint */ @@ -2562,7 +2562,7 @@ mpii_insert_dev(struct mpii_softc *sc, struct mpii_device *dev) return (0); } -int +static int mpii_remove_dev(struct mpii_softc *sc, struct mpii_device *dev) { int i; @@ -2584,7 +2584,7 @@ mpii_remove_dev(struct mpii_softc *sc, struct mpii_device *dev) return (1); } -struct mpii_device * +static struct mpii_device * mpii_find_dev(struct mpii_softc *sc, u_int16_t handle) { int i; @@ -2601,7 +2601,7 @@ mpii_find_dev(struct mpii_softc *sc, u_int16_t handle) return (NULL); } -int +static int mpii_alloc_ccbs(struct mpii_softc *sc) { struct mpii_ccb *ccb; @@ -2678,7 +2678,7 @@ free_ccbs: return (1); } -void +static void mpii_put_ccb(struct mpii_softc *sc, struct mpii_ccb *ccb) { DNPRINTF(MPII_D_CCB, "%s: mpii_put_ccb %p\n", DEVNAME(sc), ccb); @@ -2694,7 +2694,7 @@ mpii_put_ccb(struct mpii_softc *sc, struct mpii_ccb *ccb) mutex_exit(&sc->sc_ccb_free_mtx); } -struct mpii_ccb * +static struct mpii_ccb * mpii_get_ccb(struct mpii_softc *sc) { struct mpii_ccb *ccb; @@ -2713,7 +2713,7 @@ mpii_get_ccb(struct mpii_softc *sc) return (ccb); } -int +static int mpii_alloc_replies(struct mpii_softc *sc) { DNPRINTF(MPII_D_MISC, "%s: mpii_alloc_replies\n", DEVNAME(sc)); @@ -2731,7 +2731,7 @@ mpii_alloc_replies(struct mpii_softc *sc) return (0); } -void +static void mpii_push_replies(struct mpii_softc *sc) { struct mpii_rcb *rcb; @@ -2752,7 +2752,7 @@ mpii_push_replies(struct mpii_softc *sc) } } -void +static void mpii_start(struct mpii_softc *sc, struct mpii_ccb *ccb) { struct mpii_request_header *rhp; @@ -2817,7 +2817,7 @@ mpii_start(struct mpii_softc *sc, struct mpii_ccb *ccb) #endif } -int +static int mpii_poll(struct mpii_softc *sc, struct mpii_ccb *ccb) { void (*done)(struct mpii_ccb *); @@ -2848,7 +2848,7 @@ mpii_poll(struct mpii_softc *sc, struct mpii_ccb *ccb) return (0); } -void +static void mpii_poll_done(struct mpii_ccb *ccb) { int *rv = ccb->ccb_cookie; @@ -2856,7 +2856,7 @@ mpii_poll_done(struct mpii_ccb *ccb) *rv = 0; } -int +static int mpii_alloc_queues(struct mpii_softc *sc) { u_int32_t *rfp; @@ -2890,7 +2890,7 @@ free_reply_freeq: return (1); } -void +static void mpii_init_queues(struct mpii_softc *sc) { DNPRINTF(MPII_D_MISC, "%s: mpii_init_queues\n", DEVNAME(sc)); @@ -2901,7 +2901,7 @@ mpii_init_queues(struct mpii_softc *sc) mpii_write_reply_post(sc, sc->sc_reply_post_host_index); } -void +static void mpii_wait(struct mpii_softc *sc, struct mpii_ccb *ccb) { void (*done)(struct mpii_ccb *); @@ -2926,7 +2926,7 @@ mpii_wait(struct mpii_softc *sc, struct mpii_ccb *ccb) done(ccb); } -void +static void mpii_wait_done(struct mpii_ccb *ccb) { mutex_enter(&ccb->ccb_mtx); @@ -2935,7 +2935,7 @@ mpii_wait_done(struct mpii_ccb *ccb) mutex_exit(&ccb->ccb_mtx); } -void +static void mpii_scsipi_request(struct scsipi_channel *chan, scsipi_adapter_req_t req, void *arg) { @@ -3068,7 +3068,7 @@ done: scsipi_done(xs); } -void +static void mpii_scsi_cmd_tmo(void *xccb) { struct mpii_ccb *ccb = xccb; @@ -3090,7 +3090,7 @@ mpii_scsi_cmd_tmo(void *xccb) } } -void +static void mpii_scsi_cmd_tmo_handler(struct work *wk, void *cookie) { struct mpii_softc *sc = cookie; @@ -3120,7 +3120,7 @@ mpii_scsi_cmd_tmo_handler(struct work *wk, void *cookie) } } -void +static void mpii_scsi_cmd_tmo_done(struct mpii_ccb *tccb) { mpii_put_ccb(tccb->ccb_sc, tccb); @@ -3179,7 +3179,7 @@ map_scsi_status(u_int8_t mpii_scsi_status) return scsi_status; } -void +static void mpii_scsi_cmd_done(struct mpii_ccb *ccb) { struct mpii_msg_scsi_io_error *sie; @@ -3431,7 +3431,7 @@ done: #endif /* 0 */ #if NBIO > 0 -int +static int mpii_ioctl(device_t dev, u_long cmd, void *addr) { struct mpii_softc *sc = device_private(dev); @@ -3460,7 +3460,7 @@ mpii_ioctl(device_t dev, u_long cmd, void *addr) return (error); } -int +static int mpii_ioctl_inq(struct mpii_softc *sc, struct bioc_inq *bi) { int i; @@ -3477,7 +3477,7 @@ mpii_ioctl_inq(struct mpii_softc *sc, struct bioc_inq *bi) return (0); } -int +static int mpii_ioctl_vol(struct mpii_softc *sc, struct bioc_vol *bv) { struct mpii_cfg_raid_vol_pg0 *vpg; @@ -3576,7 +3576,7 @@ mpii_ioctl_vol(struct mpii_softc *sc, struct bioc_vol *bv) return (0); } -int +static int mpii_ioctl_disk(struct mpii_softc *sc, struct bioc_disk *bd) { struct mpii_cfg_raid_vol_pg0 *vpg; @@ -3637,7 +3637,7 @@ mpii_ioctl_disk(struct mpii_softc *sc, struct bioc_disk *bd) return (mpii_bio_disk(sc, bd, dn)); } -int +static int mpii_bio_hs(struct mpii_softc *sc, struct bioc_disk *bd, int nvdsk, int hsmap, int *hscnt) { @@ -3707,7 +3707,7 @@ mpii_bio_hs(struct mpii_softc *sc, struct bioc_disk *bd, int nvdsk, return (0); } -int +static int mpii_bio_disk(struct mpii_softc *sc, struct bioc_disk *bd, u_int8_t dn) { struct mpii_cfg_raid_physdisk_pg0 *ppg; @@ -3798,7 +3798,7 @@ mpii_bio_disk(struct mpii_softc *sc, struct bioc_disk *bd, u_int8_t dn) return (0); } -struct mpii_device * +static struct mpii_device * mpii_find_vol(struct mpii_softc *sc, int volid) { struct mpii_device *dev = NULL; @@ -3815,7 +3815,7 @@ mpii_find_vol(struct mpii_softc *sc, int volid) /* * Non-sleeping lightweight version of the mpii_ioctl_vol */ -int +static int mpii_bio_volstate(struct mpii_softc *sc, struct bioc_vol *bv) { struct mpii_cfg_raid_vol_pg0 *vpg; @@ -3877,7 +3877,7 @@ mpii_bio_volstate(struct mpii_softc *sc, struct bioc_vol *bv) return (0); } -int +static int mpii_create_sensors(struct mpii_softc *sc) { int i, rv; @@ -3924,7 +3924,7 @@ out: return 1; } -int +static int mpii_destroy_sensors(struct mpii_softc *sc) { if (sc->sc_sme == NULL) @@ -3936,7 +3936,7 @@ mpii_destroy_sensors(struct mpii_softc *sc) } -void +static void mpii_refresh_sensors(struct sysmon_envsys *sme, envsys_data_t *edata) { struct mpii_softc *sc = sme->sme_cookie; diff --git a/sys/dev/pcmcia/if_xi.c b/sys/dev/pcmcia/if_xi.c index e551a3bc2e4..a85432367f5 100644 --- a/sys/dev/pcmcia/if_xi.c +++ b/sys/dev/pcmcia/if_xi.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_xi.c,v 1.91 2019/10/30 10:12:37 msaitoh Exp $ */ +/* $NetBSD: if_xi.c,v 1.92 2019/11/28 17:09:10 maxv Exp $ */ /* OpenBSD: if_xe.c,v 1.9 1999/09/16 11:28:42 niklas Exp */ /* @@ -55,7 +55,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_xi.c,v 1.91 2019/10/30 10:12:37 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_xi.c,v 1.92 2019/11/28 17:09:10 maxv Exp $"); #include "opt_inet.h" @@ -128,7 +128,7 @@ int xidebug = 0; #define DPRINTF(cat, x) (void)0 #endif -#define STATIC +#define STATIC static STATIC int xi_enable(struct xi_softc *); STATIC void xi_disable(struct xi_softc *); diff --git a/sys/dev/usb/if_atu.c b/sys/dev/usb/if_atu.c index a155ca192a8..f52e5d02f01 100644 --- a/sys/dev/usb/if_atu.c +++ b/sys/dev/usb/if_atu.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_atu.c,v 1.65 2019/05/05 03:17:54 mrg Exp $ */ +/* $NetBSD: if_atu.c,v 1.66 2019/11/28 17:09:10 maxv Exp $ */ /* $OpenBSD: if_atu.c,v 1.48 2004/12/30 01:53:21 dlg Exp $ */ /* * Copyright (c) 2003, 2004 @@ -48,7 +48,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_atu.c,v 1.65 2019/05/05 03:17:54 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_atu.c,v 1.66 2019/11/28 17:09:10 maxv Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -228,65 +228,65 @@ static const struct atu_radfirm { atmel_fw_intersil_ext, sizeof(atmel_fw_intersil_ext) } }; -int atu_newbuf(struct atu_softc *, struct atu_chain *, struct mbuf *); -void atu_rxeof(struct usbd_xfer *, void *, usbd_status); -void atu_txeof(struct usbd_xfer *, void *, usbd_status); -void atu_start(struct ifnet *); -int atu_ioctl(struct ifnet *, u_long, void *); -int atu_init(struct ifnet *); -void atu_stop(struct ifnet *, int); -void atu_watchdog(struct ifnet *); -usbd_status atu_usb_request(struct atu_softc *, uint8_t, +static int atu_newbuf(struct atu_softc *, struct atu_chain *, struct mbuf *); +static void atu_rxeof(struct usbd_xfer *, void *, usbd_status); +static void atu_txeof(struct usbd_xfer *, void *, usbd_status); +static void atu_start(struct ifnet *); +static int atu_ioctl(struct ifnet *, u_long, void *); +static int atu_init(struct ifnet *); +static void atu_stop(struct ifnet *, int); +static void atu_watchdog(struct ifnet *); +static usbd_status atu_usb_request(struct atu_softc *, uint8_t, uint8_t, uint16_t, uint16_t, uint16_t, uint8_t *); -int atu_send_command(struct atu_softc *, uint8_t *, int); -int atu_get_cmd_status(struct atu_softc *, uint8_t, +static int atu_send_command(struct atu_softc *, uint8_t *, int); +static int atu_get_cmd_status(struct atu_softc *, uint8_t, uint8_t *); -int atu_wait_completion(struct atu_softc *, uint8_t, +static int atu_wait_completion(struct atu_softc *, uint8_t, uint8_t *); -int atu_send_mib(struct atu_softc *, uint8_t, +static int atu_send_mib(struct atu_softc *, uint8_t, uint8_t, uint8_t, void *); -int atu_get_mib(struct atu_softc *, uint8_t, +static int atu_get_mib(struct atu_softc *, uint8_t, uint8_t, uint8_t, uint8_t *); #if 0 int atu_start_ibss(struct atu_softc *); #endif -int atu_start_scan(struct atu_softc *); -int atu_switch_radio(struct atu_softc *, int); -int atu_initial_config(struct atu_softc *); -int atu_join(struct atu_softc *, struct ieee80211_node *); -int8_t atu_get_dfu_state(struct atu_softc *); -uint8_t atu_get_opmode(struct atu_softc *, uint8_t *); -void atu_internal_firmware(device_t); -void atu_external_firmware(device_t); -int atu_get_card_config(struct atu_softc *); -int atu_media_change(struct ifnet *); -void atu_media_status(struct ifnet *, struct ifmediareq *); -int atu_tx_list_init(struct atu_softc *); -int atu_rx_list_init(struct atu_softc *); -void atu_xfer_list_free(struct atu_softc *, struct atu_chain *, +static int atu_start_scan(struct atu_softc *); +static int atu_switch_radio(struct atu_softc *, int); +static int atu_initial_config(struct atu_softc *); +static int atu_join(struct atu_softc *, struct ieee80211_node *); +static int8_t atu_get_dfu_state(struct atu_softc *); +static uint8_t atu_get_opmode(struct atu_softc *, uint8_t *); +static void atu_internal_firmware(device_t); +static void atu_external_firmware(device_t); +static int atu_get_card_config(struct atu_softc *); +static int atu_media_change(struct ifnet *); +static void atu_media_status(struct ifnet *, struct ifmediareq *); +static int atu_tx_list_init(struct atu_softc *); +static int atu_rx_list_init(struct atu_softc *); +static void atu_xfer_list_free(struct atu_softc *, struct atu_chain *, int); #ifdef ATU_DEBUG -void atu_debug_print(struct atu_softc *); +static void atu_debug_print(struct atu_softc *); #endif -void atu_task(void *); -int atu_newstate(struct ieee80211com *, enum ieee80211_state, int); -int atu_tx_start(struct atu_softc *, struct ieee80211_node *, +static void atu_task(void *); +static int atu_newstate(struct ieee80211com *, enum ieee80211_state, int); +static int atu_tx_start(struct atu_softc *, struct ieee80211_node *, struct atu_chain *, struct mbuf *); -void atu_complete_attach(struct atu_softc *); -uint8_t atu_calculate_padding(int); +static void atu_complete_attach(struct atu_softc *); +static uint8_t atu_calculate_padding(int); -int atu_match(device_t, cfdata_t, void *); -void atu_attach(device_t, device_t, void *); -int atu_detach(device_t, int); -int atu_activate(device_t, enum devact); +static int atu_match(device_t, cfdata_t, void *); +static void atu_attach(device_t, device_t, void *); +static int atu_detach(device_t, int); +static int atu_activate(device_t, enum devact); CFATTACH_DECL_NEW(atu, sizeof(struct atu_softc), atu_match, atu_attach, atu_detach, atu_activate); -usbd_status +static usbd_status atu_usb_request(struct atu_softc *sc, uint8_t type, uint8_t request, uint16_t value, uint16_t index, uint16_t length, uint8_t *data) @@ -345,14 +345,14 @@ atu_usb_request(struct atu_softc *sc, uint8_t type, return err; } -int +static int atu_send_command(struct atu_softc *sc, uint8_t *command, int size) { return atu_usb_request(sc, UT_WRITE_VENDOR_DEVICE, 0x0e, 0x0000, 0x0000, size, command); } -int +static int atu_get_cmd_status(struct atu_softc *sc, uint8_t cmd, uint8_t *status) { /* @@ -368,7 +368,7 @@ atu_get_cmd_status(struct atu_softc *sc, uint8_t cmd, uint8_t *status) 0x0000, 6, status); } -int +static int atu_wait_completion(struct atu_softc *sc, uint8_t cmd, uint8_t *status) { int idle_count = 0, err; @@ -410,7 +410,7 @@ atu_wait_completion(struct atu_softc *sc, uint8_t cmd, uint8_t *status) } } -int +static int atu_send_mib(struct atu_softc *sc, uint8_t type, uint8_t size, uint8_t index, void *data) { @@ -461,7 +461,7 @@ atu_send_mib(struct atu_softc *sc, uint8_t type, uint8_t size, return atu_wait_completion(sc, CMD_SET_MIB, NULL); } -int +static int atu_get_mib(struct atu_softc *sc, uint8_t type, uint8_t size, uint8_t index, uint8_t *buf) { @@ -524,7 +524,7 @@ atu_start_ibss(struct atu_softc *sc) } #endif -int +static int atu_start_scan(struct atu_softc *sc) { struct ieee80211com *ic = &sc->sc_ic; @@ -588,7 +588,7 @@ atu_start_scan(struct atu_softc *sc) return 0; } -int +static int atu_switch_radio(struct atu_softc *sc, int state) { usbd_status err; @@ -625,7 +625,7 @@ atu_switch_radio(struct atu_softc *sc, int state) return 0; } -int +static int atu_initial_config(struct atu_softc *sc) { struct ieee80211com *ic = &sc->sc_ic; @@ -779,7 +779,7 @@ atu_initial_config(struct atu_softc *sc) return 0; } -int +static int atu_join(struct atu_softc *sc, struct ieee80211_node *node) { struct atu_cmd_join join; @@ -836,7 +836,7 @@ atu_join(struct atu_softc *sc, struct ieee80211_node *node) /* * Get the state of the DFU unit */ -int8_t +static int8_t atu_get_dfu_state(struct atu_softc *sc) { uint8_t state; @@ -849,7 +849,7 @@ atu_get_dfu_state(struct atu_softc *sc) /* * Get MAC opmode */ -uint8_t +static uint8_t atu_get_opmode(struct atu_softc *sc, uint8_t *mode) { @@ -860,7 +860,7 @@ atu_get_opmode(struct atu_softc *sc, uint8_t *mode) /* * Upload the internal firmware into the device */ -void +static void atu_internal_firmware(device_t arg) { struct atu_softc *sc = device_private(arg); @@ -981,7 +981,7 @@ atu_internal_firmware(device_t arg) usb_needs_reattach(sc->atu_udev); } -void +static void atu_external_firmware(device_t arg) { struct atu_softc *sc = device_private(arg); @@ -1044,7 +1044,7 @@ atu_external_firmware(device_t arg) atu_complete_attach(sc); } -int +static int atu_get_card_config(struct atu_softc *sc) { struct ieee80211com *ic = &sc->sc_ic; @@ -1090,7 +1090,7 @@ atu_get_card_config(struct atu_softc *sc) /* * Probe for an AT76c503 chip. */ -int +static int atu_match(device_t parent, cfdata_t match, void *aux) { struct usb_attach_arg *uaa = aux; @@ -1107,7 +1107,7 @@ atu_match(device_t parent, cfdata_t match, void *aux) return UMATCH_NONE; } -int +static int atu_media_change(struct ifnet *ifp) { struct atu_softc *sc = ifp->if_softc; @@ -1132,7 +1132,7 @@ atu_media_change(struct ifnet *ifp) return err; } -void +static void atu_media_status(struct ifnet *ifp, struct ifmediareq *req) { #ifdef ATU_DEBUG @@ -1144,7 +1144,7 @@ atu_media_status(struct ifnet *ifp, struct ifmediareq *req) ieee80211_media_status(ifp, req); } -void +static void atu_task(void *arg) { struct atu_softc *sc = (struct atu_softc *)arg; @@ -1190,7 +1190,7 @@ atu_task(void *arg) } } -int +static int atu_newstate(struct ieee80211com *ic, enum ieee80211_state nstate, int arg) { struct ifnet *ifp = ic->ic_ifp; @@ -1234,7 +1234,7 @@ atu_newstate(struct ieee80211com *ic, enum ieee80211_state nstate, int arg) * Attach the interface. Allocate softc structures, do * setup and ethernet/BPF attach. */ -void +static void atu_attach(device_t parent, device_t self, void *aux) { struct atu_softc *sc = device_private(self); @@ -1350,7 +1350,7 @@ atu_attach(device_t parent, device_t self, void *aux) return; } -void +static void atu_complete_attach(struct atu_softc *sc) { struct ieee80211com *ic = &sc->sc_ic; @@ -1467,7 +1467,7 @@ atu_complete_attach(struct atu_softc *sc) sc->sc_state = ATU_S_OK; } -int +static int atu_detach(device_t self, int flags) { struct atu_softc *sc = device_private(self); @@ -1486,7 +1486,7 @@ atu_detach(device_t self, int flags) return 0; } -int +static int atu_activate(device_t self, enum devact act) { struct atu_softc *sc = device_private(self); @@ -1506,7 +1506,7 @@ atu_activate(device_t self, enum devact act) /* * Initialize an RX descriptor and attach an MBUF cluster. */ -int +static int atu_newbuf(struct atu_softc *sc, struct atu_chain *c, struct mbuf *m) { struct mbuf *m_new = NULL; @@ -1536,7 +1536,7 @@ atu_newbuf(struct atu_softc *sc, struct atu_chain *c, struct mbuf *m) return 0; } -int +static int atu_rx_list_init(struct atu_softc *sc) { struct atu_cdata *cd = &sc->atu_cdata; @@ -1563,7 +1563,7 @@ atu_rx_list_init(struct atu_softc *sc) return 0; } -int +static int atu_tx_list_init(struct atu_softc *sc) { struct atu_cdata *cd = &sc->atu_cdata; @@ -1593,7 +1593,7 @@ atu_tx_list_init(struct atu_softc *sc) return 0; } -void +static void atu_xfer_list_free(struct atu_softc *sc, struct atu_chain *ch, int listlen) { int i; @@ -1617,7 +1617,7 @@ atu_xfer_list_free(struct atu_softc *sc, struct atu_chain *ch, int listlen) * A frame has been uploaded: pass the resulting mbuf chain up to * the higher level protocols. */ -void +static void atu_rxeof(struct usbd_xfer *xfer, void *priv, usbd_status status) { struct atu_chain *c = (struct atu_chain *)priv; @@ -1726,7 +1726,7 @@ done: * A frame was downloaded to the chip. It's safe for us to clean up * the list buffers. */ -void +static void atu_txeof(struct usbd_xfer *xfer, void *priv, usbd_status status) { struct atu_chain *c = (struct atu_chain *)priv; @@ -1773,7 +1773,7 @@ atu_txeof(struct usbd_xfer *xfer, void *priv, usbd_status status) atu_start(ifp); } -uint8_t +static uint8_t atu_calculate_padding(int size) { size %= 64; @@ -1785,7 +1785,7 @@ atu_calculate_padding(int size) return 0; } -int +static int atu_tx_start(struct atu_softc *sc, struct ieee80211_node *ni, struct atu_chain *c, struct mbuf *m) { @@ -1840,7 +1840,7 @@ atu_tx_start(struct atu_softc *sc, struct ieee80211_node *ni, return 0; } -void +static void atu_start(struct ifnet *ifp) { struct atu_softc *sc = ifp->if_softc; @@ -1958,7 +1958,7 @@ bad: } } -int +static int atu_init(struct ifnet *ifp) { struct atu_softc *sc = ifp->if_softc; @@ -2054,7 +2054,7 @@ atu_init(struct ifnet *ifp) } #ifdef ATU_DEBUG -void +static void atu_debug_print(struct atu_softc *sc) { usbd_status err; @@ -2137,7 +2137,7 @@ atu_debug_print(struct atu_softc *sc) } #endif /* ATU_DEBUG */ -int +static int atu_ioctl(struct ifnet *ifp, u_long command, void *data) { struct atu_softc *sc = ifp->if_softc; @@ -2175,7 +2175,7 @@ atu_ioctl(struct ifnet *ifp, u_long command, void *data) return err; } -void +static void atu_watchdog(struct ifnet *ifp) { struct atu_softc *sc = ifp->if_softc; @@ -2219,7 +2219,7 @@ atu_watchdog(struct ifnet *ifp) * Stop the adapter and free any mbufs allocated to the * RX and TX lists. */ -void +static void atu_stop(struct ifnet *ifp, int disable) { struct atu_softc *sc = ifp->if_softc; diff --git a/sys/dev/usb/if_urtw.c b/sys/dev/usb/if_urtw.c index c5256e19cbe..dad6bdce557 100644 --- a/sys/dev/usb/if_urtw.c +++ b/sys/dev/usb/if_urtw.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_urtw.c,v 1.19 2019/09/14 12:40:31 maxv Exp $ */ +/* $NetBSD: if_urtw.c,v 1.20 2019/11/28 17:09:10 maxv Exp $ */ /* $OpenBSD: if_urtw.c,v 1.39 2011/07/03 15:47:17 matthew Exp $ */ /*- @@ -19,7 +19,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_urtw.c,v 1.19 2019/09/14 12:40:31 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_urtw.c,v 1.20 2019/11/28 17:09:10 maxv Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -478,110 +478,110 @@ static struct urtw_pair urtw_ratetable[] = { { 96, 10 }, { 108, 11 } }; -int urtw_init(struct ifnet *); -void urtw_stop(struct ifnet *, int); -int urtw_ioctl(struct ifnet *, u_long, void *); -void urtw_start(struct ifnet *); -int urtw_alloc_rx_data_list(struct urtw_softc *); -void urtw_free_rx_data_list(struct urtw_softc *); -int urtw_alloc_tx_data_list(struct urtw_softc *); -void urtw_free_tx_data_list(struct urtw_softc *); -void urtw_rxeof(struct usbd_xfer *, void *, +static int urtw_init(struct ifnet *); +static void urtw_stop(struct ifnet *, int); +static int urtw_ioctl(struct ifnet *, u_long, void *); +static void urtw_start(struct ifnet *); +static int urtw_alloc_rx_data_list(struct urtw_softc *); +static void urtw_free_rx_data_list(struct urtw_softc *); +static int urtw_alloc_tx_data_list(struct urtw_softc *); +static void urtw_free_tx_data_list(struct urtw_softc *); +static void urtw_rxeof(struct usbd_xfer *, void *, usbd_status); -int urtw_tx_start(struct urtw_softc *, +static int urtw_tx_start(struct urtw_softc *, struct ieee80211_node *, struct mbuf *, int); -void urtw_txeof_low(struct usbd_xfer *, void *, +static void urtw_txeof_low(struct usbd_xfer *, void *, usbd_status); -void urtw_txeof_normal(struct usbd_xfer *, void *, +static void urtw_txeof_normal(struct usbd_xfer *, void *, usbd_status); -void urtw_next_scan(void *); -void urtw_task(void *); -void urtw_ledusbtask(void *); -void urtw_ledtask(void *); -int urtw_media_change(struct ifnet *); -int urtw_newstate(struct ieee80211com *, enum ieee80211_state, int); -void urtw_watchdog(struct ifnet *); -void urtw_set_chan(struct urtw_softc *, struct ieee80211_channel *); -int urtw_isbmode(uint16_t); -uint16_t urtw_rate2rtl(int); -uint16_t urtw_rtl2rate(int); -usbd_status urtw_set_rate(struct urtw_softc *); -usbd_status urtw_update_msr(struct urtw_softc *); -usbd_status urtw_read8_c(struct urtw_softc *, int, uint8_t *, uint8_t); -usbd_status urtw_read16_c(struct urtw_softc *, int, uint16_t *, uint8_t); -usbd_status urtw_read32_c(struct urtw_softc *, int, uint32_t *, uint8_t); -usbd_status urtw_write8_c(struct urtw_softc *, int, uint8_t, uint8_t); -usbd_status urtw_write16_c(struct urtw_softc *, int, uint16_t, uint8_t); -usbd_status urtw_write32_c(struct urtw_softc *, int, uint32_t, uint8_t); -usbd_status urtw_eprom_cs(struct urtw_softc *, int); -usbd_status urtw_eprom_ck(struct urtw_softc *); -usbd_status urtw_eprom_sendbits(struct urtw_softc *, int16_t *, +static void urtw_next_scan(void *); +static void urtw_task(void *); +static void urtw_ledusbtask(void *); +static void urtw_ledtask(void *); +static int urtw_media_change(struct ifnet *); +static int urtw_newstate(struct ieee80211com *, enum ieee80211_state, int); +static void urtw_watchdog(struct ifnet *); +static void urtw_set_chan(struct urtw_softc *, struct ieee80211_channel *); +static int urtw_isbmode(uint16_t); +static uint16_t urtw_rate2rtl(int); +static uint16_t urtw_rtl2rate(int); +static usbd_status urtw_set_rate(struct urtw_softc *); +static usbd_status urtw_update_msr(struct urtw_softc *); +static usbd_status urtw_read8_c(struct urtw_softc *, int, uint8_t *, uint8_t); +static usbd_status urtw_read16_c(struct urtw_softc *, int, uint16_t *, uint8_t); +static usbd_status urtw_read32_c(struct urtw_softc *, int, uint32_t *, uint8_t); +static usbd_status urtw_write8_c(struct urtw_softc *, int, uint8_t, uint8_t); +static usbd_status urtw_write16_c(struct urtw_softc *, int, uint16_t, uint8_t); +static usbd_status urtw_write32_c(struct urtw_softc *, int, uint32_t, uint8_t); +static usbd_status urtw_eprom_cs(struct urtw_softc *, int); +static usbd_status urtw_eprom_ck(struct urtw_softc *); +static usbd_status urtw_eprom_sendbits(struct urtw_softc *, int16_t *, int); -usbd_status urtw_eprom_read32(struct urtw_softc *, uint32_t, +static usbd_status urtw_eprom_read32(struct urtw_softc *, uint32_t, uint32_t *); -usbd_status urtw_eprom_readbit(struct urtw_softc *, int16_t *); -usbd_status urtw_eprom_writebit(struct urtw_softc *, int16_t); -usbd_status urtw_get_macaddr(struct urtw_softc *); -usbd_status urtw_get_txpwr(struct urtw_softc *); -usbd_status urtw_get_rfchip(struct urtw_softc *); -usbd_status urtw_led_init(struct urtw_softc *); -usbd_status urtw_8185_rf_pins_enable(struct urtw_softc *); -usbd_status urtw_8185_tx_antenna(struct urtw_softc *, uint8_t); -usbd_status urtw_8187_write_phy(struct urtw_softc *, uint8_t, uint32_t); -usbd_status urtw_8187_write_phy_ofdm_c(struct urtw_softc *, uint8_t, +static usbd_status urtw_eprom_readbit(struct urtw_softc *, int16_t *); +static usbd_status urtw_eprom_writebit(struct urtw_softc *, int16_t); +static usbd_status urtw_get_macaddr(struct urtw_softc *); +static usbd_status urtw_get_txpwr(struct urtw_softc *); +static usbd_status urtw_get_rfchip(struct urtw_softc *); +static usbd_status urtw_led_init(struct urtw_softc *); +static usbd_status urtw_8185_rf_pins_enable(struct urtw_softc *); +static usbd_status urtw_8185_tx_antenna(struct urtw_softc *, uint8_t); +static usbd_status urtw_8187_write_phy(struct urtw_softc *, uint8_t, uint32_t); +static usbd_status urtw_8187_write_phy_ofdm_c(struct urtw_softc *, uint8_t, uint32_t); -usbd_status urtw_8187_write_phy_cck_c(struct urtw_softc *, uint8_t, +static usbd_status urtw_8187_write_phy_cck_c(struct urtw_softc *, uint8_t, uint32_t); -usbd_status urtw_8225_setgain(struct urtw_softc *, int16_t); -usbd_status urtw_8225_usb_init(struct urtw_softc *); -usbd_status urtw_8225_write_c(struct urtw_softc *, uint8_t, uint16_t); -usbd_status urtw_8225_write_s16(struct urtw_softc *, uint8_t, int, +static usbd_status urtw_8225_setgain(struct urtw_softc *, int16_t); +static usbd_status urtw_8225_usb_init(struct urtw_softc *); +static usbd_status urtw_8225_write_c(struct urtw_softc *, uint8_t, uint16_t); +static usbd_status urtw_8225_write_s16(struct urtw_softc *, uint8_t, int, uint16_t); -usbd_status urtw_8225_read(struct urtw_softc *, uint8_t, uint32_t *); -usbd_status urtw_8225_rf_init(struct urtw_rf *); -usbd_status urtw_8225_rf_set_chan(struct urtw_rf *, int); -usbd_status urtw_8225_rf_set_sens(struct urtw_rf *); -usbd_status urtw_8225_set_txpwrlvl(struct urtw_softc *, int); -usbd_status urtw_8225v2_rf_init(struct urtw_rf *); -usbd_status urtw_8225v2_rf_set_chan(struct urtw_rf *, int); -usbd_status urtw_8225v2_set_txpwrlvl(struct urtw_softc *, int); -usbd_status urtw_8225v2_setgain(struct urtw_softc *, int16_t); -usbd_status urtw_8225_isv2(struct urtw_softc *, int *); -usbd_status urtw_read8e(struct urtw_softc *, int, uint8_t *); -usbd_status urtw_write8e(struct urtw_softc *, int, uint8_t); -usbd_status urtw_8180_set_anaparam(struct urtw_softc *, uint32_t); -usbd_status urtw_8185_set_anaparam2(struct urtw_softc *, uint32_t); -usbd_status urtw_open_pipes(struct urtw_softc *); -usbd_status urtw_close_pipes(struct urtw_softc *); -usbd_status urtw_intr_enable(struct urtw_softc *); -usbd_status urtw_intr_disable(struct urtw_softc *); -usbd_status urtw_reset(struct urtw_softc *); -usbd_status urtw_led_on(struct urtw_softc *, int); -usbd_status urtw_led_ctl(struct urtw_softc *, int); -usbd_status urtw_led_blink(struct urtw_softc *); -usbd_status urtw_led_mode0(struct urtw_softc *, int); -usbd_status urtw_led_mode1(struct urtw_softc *, int); -usbd_status urtw_led_mode2(struct urtw_softc *, int); -usbd_status urtw_led_mode3(struct urtw_softc *, int); -usbd_status urtw_rx_setconf(struct urtw_softc *); -usbd_status urtw_rx_enable(struct urtw_softc *); -usbd_status urtw_tx_enable(struct urtw_softc *); -usbd_status urtw_8187b_update_wmm(struct urtw_softc *); -usbd_status urtw_8187b_reset(struct urtw_softc *); -int urtw_8187b_init(struct ifnet *); -usbd_status urtw_8225v2_b_config_mac(struct urtw_softc *); -usbd_status urtw_8225v2_b_init_rfe(struct urtw_softc *); -usbd_status urtw_8225v2_b_update_chan(struct urtw_softc *); -usbd_status urtw_8225v2_b_rf_init(struct urtw_rf *); -usbd_status urtw_8225v2_b_rf_set_chan(struct urtw_rf *, int); -usbd_status urtw_8225v2_b_set_txpwrlvl(struct urtw_softc *, int); -int urtw_set_bssid(struct urtw_softc *, const uint8_t *); -int urtw_set_macaddr(struct urtw_softc *, const uint8_t *); - -int urtw_match(device_t, cfdata_t, void *); -void urtw_attach(device_t, device_t, void *); -int urtw_detach(device_t, int); -int urtw_activate(device_t, enum devact); +static usbd_status urtw_8225_read(struct urtw_softc *, uint8_t, uint32_t *); +static usbd_status urtw_8225_rf_init(struct urtw_rf *); +static usbd_status urtw_8225_rf_set_chan(struct urtw_rf *, int); +static usbd_status urtw_8225_rf_set_sens(struct urtw_rf *); +static usbd_status urtw_8225_set_txpwrlvl(struct urtw_softc *, int); +static usbd_status urtw_8225v2_rf_init(struct urtw_rf *); +static usbd_status urtw_8225v2_rf_set_chan(struct urtw_rf *, int); +static usbd_status urtw_8225v2_set_txpwrlvl(struct urtw_softc *, int); +static usbd_status urtw_8225v2_setgain(struct urtw_softc *, int16_t); +static usbd_status urtw_8225_isv2(struct urtw_softc *, int *); +static usbd_status urtw_read8e(struct urtw_softc *, int, uint8_t *); +static usbd_status urtw_write8e(struct urtw_softc *, int, uint8_t); +static usbd_status urtw_8180_set_anaparam(struct urtw_softc *, uint32_t); +static usbd_status urtw_8185_set_anaparam2(struct urtw_softc *, uint32_t); +static usbd_status urtw_open_pipes(struct urtw_softc *); +static usbd_status urtw_close_pipes(struct urtw_softc *); +static usbd_status urtw_intr_enable(struct urtw_softc *); +static usbd_status urtw_intr_disable(struct urtw_softc *); +static usbd_status urtw_reset(struct urtw_softc *); +static usbd_status urtw_led_on(struct urtw_softc *, int); +static usbd_status urtw_led_ctl(struct urtw_softc *, int); +static usbd_status urtw_led_blink(struct urtw_softc *); +static usbd_status urtw_led_mode0(struct urtw_softc *, int); +static usbd_status urtw_led_mode1(struct urtw_softc *, int); +static usbd_status urtw_led_mode2(struct urtw_softc *, int); +static usbd_status urtw_led_mode3(struct urtw_softc *, int); +static usbd_status urtw_rx_setconf(struct urtw_softc *); +static usbd_status urtw_rx_enable(struct urtw_softc *); +static usbd_status urtw_tx_enable(struct urtw_softc *); +static usbd_status urtw_8187b_update_wmm(struct urtw_softc *); +static usbd_status urtw_8187b_reset(struct urtw_softc *); +static int urtw_8187b_init(struct ifnet *); +static usbd_status urtw_8225v2_b_config_mac(struct urtw_softc *); +static usbd_status urtw_8225v2_b_init_rfe(struct urtw_softc *); +static usbd_status urtw_8225v2_b_update_chan(struct urtw_softc *); +static usbd_status urtw_8225v2_b_rf_init(struct urtw_rf *); +static usbd_status urtw_8225v2_b_rf_set_chan(struct urtw_rf *, int); +static usbd_status urtw_8225v2_b_set_txpwrlvl(struct urtw_softc *, int); +static int urtw_set_bssid(struct urtw_softc *, const uint8_t *); +static int urtw_set_macaddr(struct urtw_softc *, const uint8_t *); + +static int urtw_match(device_t, cfdata_t, void *); +static void urtw_attach(device_t, device_t, void *); +static int urtw_detach(device_t, int); +static int urtw_activate(device_t, enum devact); CFATTACH_DECL_NEW(urtw, sizeof(struct urtw_softc), urtw_match, @@ -590,7 +590,7 @@ CFATTACH_DECL_NEW(urtw, sizeof(struct urtw_softc), urtw_activate ); -int +static int urtw_match(device_t parent, cfdata_t match, void *aux) { struct usb_attach_arg *uaa = aux; @@ -599,7 +599,7 @@ urtw_match(device_t parent, cfdata_t match, void *aux) UMATCH_VENDOR_PRODUCT : UMATCH_NONE; } -void +static void urtw_attach(device_t parent, device_t self, void *aux) { struct urtw_softc *sc = device_private(self); @@ -766,7 +766,7 @@ fail: sc->sc_dying = true; } -int +static int urtw_detach(device_t self, int flags) { struct urtw_softc *sc = device_private(self); @@ -805,7 +805,7 @@ out: return 0; } -int +static int urtw_activate(device_t self, enum devact act) { struct urtw_softc *sc = device_private(self); @@ -819,7 +819,7 @@ urtw_activate(device_t self, enum devact act) return 0; } -usbd_status +static usbd_status urtw_close_pipes(struct urtw_softc *sc) { usbd_status error = 0; @@ -846,7 +846,7 @@ fail: return error; } -usbd_status +static usbd_status urtw_open_pipes(struct urtw_softc *sc) { usbd_status error; @@ -899,7 +899,7 @@ fail: return error; } -int +static int urtw_alloc_rx_data_list(struct urtw_softc *sc) { int i, error; @@ -943,7 +943,7 @@ fail: return error; } -void +static void urtw_free_rx_data_list(struct urtw_softc *sc) { int i; @@ -966,7 +966,7 @@ urtw_free_rx_data_list(struct urtw_softc *sc) } } -int +static int urtw_alloc_tx_data_list(struct urtw_softc *sc) { int i, error; @@ -1003,7 +1003,7 @@ fail: return error; } -void +static void urtw_free_tx_data_list(struct urtw_softc *sc) { int i; @@ -1030,7 +1030,7 @@ urtw_free_tx_data_list(struct urtw_softc *sc) } } -int +static int urtw_media_change(struct ifnet *ifp) { int error; @@ -1046,7 +1046,7 @@ urtw_media_change(struct ifnet *ifp) return 0; } -int +static int urtw_newstate(struct ieee80211com *ic, enum ieee80211_state nstate, int arg) { struct urtw_softc *sc = ic->ic_ifp->if_softc; @@ -1067,7 +1067,7 @@ urtw_newstate(struct ieee80211com *ic, enum ieee80211_state nstate, int arg) return 0; } -usbd_status +static usbd_status urtw_led_init(struct urtw_softc *sc) { uint32_t rev; @@ -1101,7 +1101,7 @@ fail: return error; } -usbd_status +static usbd_status urtw_8225_write_s16(struct urtw_softc *sc, uint8_t addr, int index, uint16_t data) { @@ -1116,7 +1116,7 @@ urtw_8225_write_s16(struct urtw_softc *sc, uint8_t addr, int index, return usbd_do_request(sc->sc_udev, &req, &data); } -usbd_status +static usbd_status urtw_8225_read(struct urtw_softc *sc, uint8_t addr, uint32_t *data) { int i; @@ -1206,7 +1206,7 @@ fail: return error; } -usbd_status +static usbd_status urtw_8225_write_c(struct urtw_softc *sc, uint8_t addr, uint16_t data) { uint16_t d80, d82, d84; @@ -1239,7 +1239,7 @@ fail: return error; } -usbd_status +static usbd_status urtw_8225_isv2(struct urtw_softc *sc, int *ret) { uint32_t data; @@ -1272,7 +1272,7 @@ fail: return error; } -usbd_status +static usbd_status urtw_get_rfchip(struct urtw_softc *sc) { struct urtw_rf *rf = &sc->sc_rf; @@ -1322,7 +1322,7 @@ fail: return USBD_INVAL; } -usbd_status +static usbd_status urtw_get_txpwr(struct urtw_softc *sc) { int i, j; @@ -1393,7 +1393,7 @@ fail: return error; } -usbd_status +static usbd_status urtw_get_macaddr(struct urtw_softc *sc) { struct ieee80211com *ic = &sc->sc_ic; @@ -1419,7 +1419,7 @@ fail: return error; } -usbd_status +static usbd_status urtw_eprom_read32(struct urtw_softc *sc, uint32_t addr, uint32_t *data) { #define URTW_READCMD_LEN 3 @@ -1495,7 +1495,7 @@ fail: #undef URTW_READCMD_LEN } -usbd_status +static usbd_status urtw_eprom_readbit(struct urtw_softc *sc, int16_t *data) { uint8_t data8; @@ -1509,7 +1509,7 @@ fail: return error; } -usbd_status +static usbd_status urtw_eprom_sendbits(struct urtw_softc *sc, int16_t *buf, int buflen) { int i = 0; @@ -1527,7 +1527,7 @@ fail: return error; } -usbd_status +static usbd_status urtw_eprom_writebit(struct urtw_softc *sc, int16_t bit) { uint8_t data; @@ -1543,7 +1543,7 @@ fail: return error; } -usbd_status +static usbd_status urtw_eprom_ck(struct urtw_softc *sc) { uint8_t data; @@ -1561,7 +1561,7 @@ fail: return error; } -usbd_status +static usbd_status urtw_eprom_cs(struct urtw_softc *sc, int able) { uint8_t data; @@ -1577,7 +1577,7 @@ fail: return error; } -usbd_status +static usbd_status urtw_read8_c(struct urtw_softc *sc, int val, uint8_t *data, uint8_t idx) { usb_device_request_t req; @@ -1593,7 +1593,7 @@ urtw_read8_c(struct urtw_softc *sc, int val, uint8_t *data, uint8_t idx) return error; } -usbd_status +static usbd_status urtw_read8e(struct urtw_softc *sc, int val, uint8_t *data) { usb_device_request_t req; @@ -1609,7 +1609,7 @@ urtw_read8e(struct urtw_softc *sc, int val, uint8_t *data) return error; } -usbd_status +static usbd_status urtw_read16_c(struct urtw_softc *sc, int val, uint16_t *data, uint8_t idx) { usb_device_request_t req; @@ -1625,7 +1625,7 @@ urtw_read16_c(struct urtw_softc *sc, int val, uint16_t *data, uint8_t idx) return error; } -usbd_status +static usbd_status urtw_read32_c(struct urtw_softc *sc, int val, uint32_t *data, uint8_t idx) { usb_device_request_t req; @@ -1641,7 +1641,7 @@ urtw_read32_c(struct urtw_softc *sc, int val, uint32_t *data, uint8_t idx) return error; } -usbd_status +static usbd_status urtw_write8_c(struct urtw_softc *sc, int val, uint8_t data, uint8_t idx) { usb_device_request_t req; @@ -1655,7 +1655,7 @@ urtw_write8_c(struct urtw_softc *sc, int val, uint8_t data, uint8_t idx) return usbd_do_request(sc->sc_udev, &req, &data); } -usbd_status +static usbd_status urtw_write8e(struct urtw_softc *sc, int val, uint8_t data) { usb_device_request_t req; @@ -1669,7 +1669,7 @@ urtw_write8e(struct urtw_softc *sc, int val, uint8_t data) return usbd_do_request(sc->sc_udev, &req, &data); } -usbd_status +static usbd_status urtw_write16_c(struct urtw_softc *sc, int val, uint16_t data, uint8_t idx) { usb_device_request_t req; @@ -1683,7 +1683,7 @@ urtw_write16_c(struct urtw_softc *sc, int val, uint16_t data, uint8_t idx) return usbd_do_request(sc->sc_udev, &req, &data); } -usbd_status +static usbd_status urtw_write32_c(struct urtw_softc *sc, int val, uint32_t data, uint8_t idx) { usb_device_request_t req; @@ -1711,7 +1711,7 @@ fail: return error; } -usbd_status +static usbd_status urtw_8180_set_anaparam(struct urtw_softc *sc, uint32_t val) { uint8_t data; @@ -1734,7 +1734,7 @@ fail: return error; } -usbd_status +static usbd_status urtw_8185_set_anaparam2(struct urtw_softc *sc, uint32_t val) { uint8_t data; @@ -1757,7 +1757,7 @@ fail: return error; } -usbd_status +static usbd_status urtw_intr_disable(struct urtw_softc *sc) { usbd_status error; @@ -1768,7 +1768,7 @@ fail: return error; } -usbd_status +static usbd_status urtw_reset(struct urtw_softc *sc) { uint8_t data; @@ -1823,7 +1823,7 @@ fail: return error; } -usbd_status +static usbd_status urtw_led_on(struct urtw_softc *sc, int type) { usbd_status error; @@ -1876,7 +1876,7 @@ fail: return error; } -usbd_status +static usbd_status urtw_led_mode0(struct urtw_softc *sc, int mode) { switch (mode) { @@ -1925,25 +1925,25 @@ urtw_led_mode0(struct urtw_softc *sc, int mode) return 0; } -usbd_status +static usbd_status urtw_led_mode1(struct urtw_softc *sc, int mode) { return USBD_INVAL; } -usbd_status +static usbd_status urtw_led_mode2(struct urtw_softc *sc, int mode) { return USBD_INVAL; } -usbd_status +static usbd_status urtw_led_mode3(struct urtw_softc *sc, int mode) { return USBD_INVAL; } -void +static void urtw_ledusbtask(void *arg) { struct urtw_softc *sc = arg; @@ -1954,7 +1954,7 @@ urtw_ledusbtask(void *arg) urtw_led_blink(sc); } -void +static void urtw_ledtask(void *arg) { struct urtw_softc *sc = arg; @@ -1966,7 +1966,7 @@ urtw_ledtask(void *arg) usb_add_task(sc->sc_udev, &sc->sc_ledtask, USB_TASKQ_DRIVER); } -usbd_status +static usbd_status urtw_led_ctl(struct urtw_softc *sc, int mode) { usbd_status error = 0; @@ -1992,7 +1992,7 @@ urtw_led_ctl(struct urtw_softc *sc, int mode) return error; } -usbd_status +static usbd_status urtw_led_blink(struct urtw_softc *sc) { uint8_t ing = 0; @@ -2038,7 +2038,7 @@ urtw_led_blink(struct urtw_softc *sc) return 0; } -usbd_status +static usbd_status urtw_update_msr(struct urtw_softc *sc) { struct ieee80211com *ic = &sc->sc_ic; @@ -2071,7 +2071,7 @@ fail: return error; } -uint16_t +static uint16_t urtw_rate2rtl(int rate) { unsigned int i; @@ -2084,7 +2084,7 @@ urtw_rate2rtl(int rate) return 3; } -uint16_t +static uint16_t urtw_rtl2rate(int rate) { unsigned int i; @@ -2097,7 +2097,7 @@ urtw_rtl2rate(int rate) return 0; } -usbd_status +static usbd_status urtw_set_rate(struct urtw_softc *sc) { int i, basic_rate, min_rr_rate, max_rr_rate; @@ -2123,7 +2123,7 @@ fail: return error; } -usbd_status +static usbd_status urtw_intr_enable(struct urtw_softc *sc) { usbd_status error; @@ -2133,7 +2133,7 @@ fail: return error; } -usbd_status +static usbd_status urtw_rx_setconf(struct urtw_softc *sc) { struct ifnet *ifp = sc->sc_ic.ic_ifp; @@ -2174,7 +2174,7 @@ fail: return error; } -usbd_status +static usbd_status urtw_rx_enable(struct urtw_softc *sc) { int i; @@ -2208,7 +2208,7 @@ fail: return error; } -usbd_status +static usbd_status urtw_tx_enable(struct urtw_softc *sc) { uint8_t data8; @@ -2251,7 +2251,7 @@ fail: return error; } -int +static int urtw_init(struct ifnet *ifp) { struct urtw_softc *sc = ifp->if_softc; @@ -2368,7 +2368,7 @@ fail: return error; } -int +static int urtw_ioctl(struct ifnet *ifp, u_long cmd, void *data) { #define IS_RUNNING(ifp) \ @@ -2425,7 +2425,7 @@ urtw_ioctl(struct ifnet *ifp, u_long cmd, void *data) #undef IS_RUNNING } -void +static void urtw_start(struct ifnet *ifp) { struct urtw_softc *sc = ifp->if_softc; @@ -2498,7 +2498,7 @@ urtw_start(struct ifnet *ifp) } } -void +static void urtw_watchdog(struct ifnet *ifp) { struct urtw_softc *sc = ifp->if_softc; @@ -2517,7 +2517,7 @@ urtw_watchdog(struct ifnet *ifp) ieee80211_watchdog(&sc->sc_ic); } -void +static void urtw_txeof_low(struct usbd_xfer *xfer, void *priv, usbd_status status) { @@ -2556,7 +2556,7 @@ urtw_txeof_low(struct usbd_xfer *xfer, void *priv, splx(s); } -void +static void urtw_txeof_normal(struct usbd_xfer *xfer, void *priv, usbd_status status) { @@ -2595,7 +2595,7 @@ urtw_txeof_normal(struct usbd_xfer *xfer, void *priv, splx(s); } -int +static int urtw_tx_start(struct urtw_softc *sc, struct ieee80211_node *ni, struct mbuf *m0, int prior) { @@ -2706,7 +2706,7 @@ urtw_tx_start(struct urtw_softc *sc, struct ieee80211_node *ni, struct mbuf *m0, return 0; } -usbd_status +static usbd_status urtw_8225_usb_init(struct urtw_softc *sc) { uint8_t data; @@ -2733,7 +2733,7 @@ fail: return error; } -usbd_status +static usbd_status urtw_8185_rf_pins_enable(struct urtw_softc *sc) { usbd_status error = 0; @@ -2743,7 +2743,7 @@ fail: return error; } -usbd_status +static usbd_status urtw_8187_write_phy(struct urtw_softc *sc, uint8_t addr, uint32_t data) { uint32_t phyw; @@ -2762,21 +2762,21 @@ fail: return error; } -usbd_status +static usbd_status urtw_8187_write_phy_ofdm_c(struct urtw_softc *sc, uint8_t addr, uint32_t data) { data = data & 0xff; return urtw_8187_write_phy(sc, addr, data); } -usbd_status +static usbd_status urtw_8187_write_phy_cck_c(struct urtw_softc *sc, uint8_t addr, uint32_t data) { data = data & 0xff; return urtw_8187_write_phy(sc, addr, data | 0x10000); } -usbd_status +static usbd_status urtw_8225_setgain(struct urtw_softc *sc, int16_t gain) { usbd_status error; @@ -2789,7 +2789,7 @@ fail: return error; } -usbd_status +static usbd_status urtw_8225_set_txpwrlvl(struct urtw_softc *sc, int chan) { int i, idx, set; @@ -2842,7 +2842,7 @@ fail: return error; } -usbd_status +static usbd_status urtw_8185_tx_antenna(struct urtw_softc *sc, uint8_t ant) { usbd_status error; @@ -2853,7 +2853,7 @@ fail: return error; } -usbd_status +static usbd_status urtw_8225_rf_init(struct urtw_rf *rf) { struct urtw_softc *sc = rf->rf_sc; @@ -2950,7 +2950,7 @@ fail: return error; } -usbd_status +static usbd_status urtw_8225_rf_set_chan(struct urtw_rf *rf, int chan) { struct urtw_softc *sc = rf->rf_sc; @@ -2986,7 +2986,7 @@ fail: return error; } -usbd_status +static usbd_status urtw_8225_rf_set_sens(struct urtw_rf *rf) { struct urtw_softc *sc = rf->rf_sc; @@ -3011,7 +3011,7 @@ fail: return error; } -void +static void urtw_stop(struct ifnet *ifp, int disable) { struct urtw_softc *sc = ifp->if_softc; @@ -3045,7 +3045,7 @@ fail: return; } -int +static int urtw_isbmode(uint16_t rate) { rate = urtw_rtl2rate(rate); @@ -3054,7 +3054,7 @@ urtw_isbmode(uint16_t rate) rate == 44) ? 1 : 0; } -void +static void urtw_rxeof(struct usbd_xfer *xfer, void *priv, usbd_status status) { struct urtw_rx_data *data = priv; @@ -3181,7 +3181,7 @@ skip: /* setup a new transfer */ (void)usbd_transfer(xfer); } -usbd_status +static usbd_status urtw_8225v2_setgain(struct urtw_softc *sc, int16_t gain) { uint8_t *gainp; @@ -3201,7 +3201,7 @@ fail: return error; } -usbd_status +static usbd_status urtw_8225v2_set_txpwrlvl(struct urtw_softc *sc, int chan) { int i; @@ -3248,7 +3248,7 @@ fail: return error; } -usbd_status +static usbd_status urtw_8225v2_rf_init(struct urtw_rf *rf) { struct urtw_softc *sc = rf->rf_sc; @@ -3366,7 +3366,7 @@ fail: return error; } -usbd_status +static usbd_status urtw_8225v2_rf_set_chan(struct urtw_rf *rf, int chan) { struct urtw_softc *sc = rf->rf_sc; @@ -3403,7 +3403,7 @@ fail: return error; } -void +static void urtw_set_chan(struct urtw_softc *sc, struct ieee80211_channel *c) { struct urtw_rf *rf = &sc->sc_rf; @@ -3435,7 +3435,7 @@ fail: return; } -void +static void urtw_next_scan(void *arg) { struct urtw_softc *sc = arg; @@ -3451,7 +3451,7 @@ urtw_next_scan(void *arg) splx(s); } -void +static void urtw_task(void *arg) { struct urtw_softc *sc = arg; @@ -3515,7 +3515,7 @@ fail: } } -usbd_status +static usbd_status urtw_8187b_update_wmm(struct urtw_softc *sc) { struct ieee80211com *ic = &sc->sc_ic; @@ -3547,7 +3547,7 @@ fail: return error; } -usbd_status +static usbd_status urtw_8187b_reset(struct urtw_softc *sc) { uint8_t data; @@ -3592,7 +3592,7 @@ fail: return error; } -int +static int urtw_8187b_init(struct ifnet *ifp) { struct urtw_softc *sc = ifp->if_softc; @@ -3731,7 +3731,7 @@ fail: return error; } -usbd_status +static usbd_status urtw_8225v2_b_config_mac(struct urtw_softc *sc) { int i; @@ -3755,7 +3755,7 @@ fail: return error; } -usbd_status +static usbd_status urtw_8225v2_b_init_rfe(struct urtw_softc *sc) { usbd_status error; @@ -3769,7 +3769,7 @@ fail: return error; } -usbd_status +static usbd_status urtw_8225v2_b_update_chan(struct urtw_softc *sc) { struct ieee80211com *ic = &sc->sc_ic; @@ -3805,7 +3805,7 @@ fail: return error; } -usbd_status +static usbd_status urtw_8225v2_b_rf_init(struct urtw_rf *rf) { struct urtw_softc *sc = rf->rf_sc; @@ -3901,7 +3901,7 @@ fail: return error; } -usbd_status +static usbd_status urtw_8225v2_b_rf_set_chan(struct urtw_rf *rf, int chan) { struct urtw_softc *sc = rf->rf_sc; @@ -3926,7 +3926,7 @@ fail: return error; } -usbd_status +static usbd_status urtw_8225v2_b_set_txpwrlvl(struct urtw_softc *sc, int chan) { int i; @@ -4029,7 +4029,7 @@ fail: return error; } -int +static int urtw_set_bssid(struct urtw_softc *sc, const uint8_t *bssid) { int error; @@ -4045,7 +4045,7 @@ fail: return error; } -int +static int urtw_set_macaddr(struct urtw_softc *sc, const uint8_t *addr) { int error; diff --git a/sys/dev/usb/if_zyd.c b/sys/dev/usb/if_zyd.c index 15fcc050a92..ca5b2e51ce1 100644 --- a/sys/dev/usb/if_zyd.c +++ b/sys/dev/usb/if_zyd.c @@ -1,5 +1,5 @@ /* $OpenBSD: if_zyd.c,v 1.52 2007/02/11 00:08:04 jsg Exp $ */ -/* $NetBSD: if_zyd.c,v 1.52 2019/05/05 03:17:54 mrg Exp $ */ +/* $NetBSD: if_zyd.c,v 1.53 2019/11/28 17:09:10 maxv Exp $ */ /*- * Copyright (c) 2006 by Damien Bergamini <damien.bergamini@free.fr> @@ -23,7 +23,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_zyd.c,v 1.52 2019/05/05 03:17:54 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_zyd.c,v 1.53 2019/11/28 17:09:10 maxv Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -156,10 +156,10 @@ static const struct zyd_type { #define zyd_lookup(v, p) \ ((const struct zyd_type *)usb_lookup(zyd_devs, v, p)) -int zyd_match(device_t, cfdata_t, void *); -void zyd_attach(device_t, device_t, void *); -int zyd_detach(device_t, int); -int zyd_activate(device_t, enum devact); +static int zyd_match(device_t, cfdata_t, void *); +static void zyd_attach(device_t, device_t, void *); +static int zyd_detach(device_t, int); +static int zyd_activate(device_t, enum devact); CFATTACH_DECL_NEW(zyd, sizeof(struct zyd_softc), zyd_match, @@ -239,7 +239,7 @@ Static void zyd_iter_func(void *, struct ieee80211_node *); Static void zyd_amrr_timeout(void *); Static void zyd_newassoc(struct ieee80211_node *, int); -int +static int zyd_match(device_t parent, cfdata_t match, void *aux) { struct usb_attach_arg *uaa = aux; @@ -297,7 +297,7 @@ zyd_attachhook(device_t self) return; } -void +static void zyd_attach(device_t parent, device_t self, void *aux) { struct zyd_softc *sc = device_private(self); @@ -452,7 +452,7 @@ zyd_complete_attach(struct zyd_softc *sc) fail: return error; } -int +static int zyd_detach(device_t self, int flags) { struct zyd_softc *sc = device_private(self); @@ -2650,7 +2650,7 @@ zyd_newassoc(struct ieee80211_node *ni, int isnew) ni->ni_txrate = i; } -int +static int zyd_activate(device_t self, enum devact act) { struct zyd_softc *sc = device_private(self); |
