From 34a927e5519a08d50670e2eb665ed5d8a2ee9e9a Mon Sep 17 00:00:00 2001 From: miod Date: Mon, 11 Aug 2014 18:08:17 +0000 Subject: [PATCH] De-static so that my ddb backtrace get closer to reality. --- sys/arch/octeon/dev/cn30xxasx.c | 14 +- sys/arch/octeon/dev/cn30xxfau.c | 22 +-- sys/arch/octeon/dev/cn30xxfpa.c | 30 ++-- sys/arch/octeon/dev/cn30xxgmx.c | 90 ++++++------ sys/arch/octeon/dev/cn30xxpow.c | 59 ++++---- sys/arch/octeon/dev/cn30xxsmi.c | 6 +- sys/arch/octeon/dev/if_cnmac.c | 245 ++++++++++++++++---------------- 7 files changed, 229 insertions(+), 237 deletions(-) diff --git a/sys/arch/octeon/dev/cn30xxasx.c b/sys/arch/octeon/dev/cn30xxasx.c index 1ba51971729..f32f85b55ad 100644 --- a/sys/arch/octeon/dev/cn30xxasx.c +++ b/sys/arch/octeon/dev/cn30xxasx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cn30xxasx.c,v 1.4 2013/09/19 00:15:59 jmatthew Exp $ */ +/* $OpenBSD: cn30xxasx.c,v 1.5 2014/08/11 18:08:17 miod Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -78,10 +78,10 @@ cn30xxasx_init(struct cn30xxasx_attach_args *aa, #define _ASX_WR8(sc, off, v) \ bus_space_write_8((sc)->sc_regt, (sc)->sc_regh, (off), (v)) -static int cn30xxasx_enable_tx(struct cn30xxasx_softc *, int); -static int cn30xxasx_enable_rx(struct cn30xxasx_softc *, int); +int cn30xxasx_enable_tx(struct cn30xxasx_softc *, int); +int cn30xxasx_enable_rx(struct cn30xxasx_softc *, int); #ifdef OCTEON_ETH_DEBUG -static int cn30xxasx_enable_intr(struct cn30xxasx_softc *, int); +int cn30xxasx_enable_intr(struct cn30xxasx_softc *, int); #endif int @@ -96,7 +96,7 @@ cn30xxasx_enable(struct cn30xxasx_softc *sc, int enable) return 0; } -static int +int cn30xxasx_enable_tx(struct cn30xxasx_softc *sc, int enable) { uint64_t asx_tx_port; @@ -110,7 +110,7 @@ cn30xxasx_enable_tx(struct cn30xxasx_softc *sc, int enable) return 0; } -static int +int cn30xxasx_enable_rx(struct cn30xxasx_softc *sc, int enable) { uint64_t asx_rx_port; @@ -159,7 +159,7 @@ cn30xxasx_intr_rml(void *arg) OCTEON_EVCNT_INC(sc, asxovrflw); } -static int +int cn30xxasx_enable_intr(struct cn30xxasx_softc *sc, int enable) { uint64_t asx_int_xxx = 0; diff --git a/sys/arch/octeon/dev/cn30xxfau.c b/sys/arch/octeon/dev/cn30xxfau.c index 56320d6fc9d..f4509275b56 100644 --- a/sys/arch/octeon/dev/cn30xxfau.c +++ b/sys/arch/octeon/dev/cn30xxfau.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cn30xxfau.c,v 1.4 2013/06/01 22:20:35 jasper Exp $ */ +/* $OpenBSD: cn30xxfau.c,v 1.5 2014/08/11 18:08:17 miod Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -34,17 +34,17 @@ #include #include -static int64_t cn30xxfau_op_load(uint64_t); -static void cn30xxfau_op_iobdma(int, uint64_t); -static void cn30xxfau_op_store(uint64_t, int64_t); -static int64_t cn30xxfau_op_load_paddr(int, int, int) __unused; -static void cn30xxfau_op_iobdma_store_data(int, int, int, int, int); -static void cn30xxfau_op_store_paddr(int, int, int64_t); +int64_t cn30xxfau_op_load(uint64_t); +void cn30xxfau_op_iobdma(int, uint64_t); +void cn30xxfau_op_store(uint64_t, int64_t); +int64_t cn30xxfau_op_load_paddr(int, int, int) __unused; +void cn30xxfau_op_iobdma_store_data(int, int, int, int, int); +void cn30xxfau_op_store_paddr(int, int, int64_t); /* ---- utilities */ -static int64_t +int64_t cn30xxfau_op_load(uint64_t args) { paddr_t addr; @@ -57,7 +57,7 @@ cn30xxfau_op_load(uint64_t args) return octeon_xkphys_read_8(addr); } -static void +void cn30xxfau_op_store(uint64_t args, int64_t value) { paddr_t addr; @@ -80,7 +80,7 @@ cn30xxfau_op_store(uint64_t args, int64_t value) /* Load Physical Address for FAU Operations */ -static int64_t +int64_t cn30xxfau_op_load_paddr(int incval, int tagwait, int reg) { uint64_t args; @@ -96,7 +96,7 @@ cn30xxfau_op_load_paddr(int incval, int tagwait, int reg) /* Store Physical Address for FAU Operations */ -static void +void cn30xxfau_op_store_paddr(int noadd, int reg, int64_t value) { uint64_t args; diff --git a/sys/arch/octeon/dev/cn30xxfpa.c b/sys/arch/octeon/dev/cn30xxfpa.c index f0f7c799fbe..34e9919c860 100644 --- a/sys/arch/octeon/dev/cn30xxfpa.c +++ b/sys/arch/octeon/dev/cn30xxfpa.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cn30xxfpa.c,v 1.2 2012/12/05 23:20:14 deraadt Exp $ */ +/* $OpenBSD: cn30xxfpa.c,v 1.3 2014/08/11 18:08:17 miod Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -78,19 +78,19 @@ struct cn30xxfpa_softc { #endif }; -void cn30xxfpa_bootstrap(struct octeon_config *); -void cn30xxfpa_reset(void); -void cn30xxfpa_int_enable(struct cn30xxfpa_softc *, int); -void cn30xxfpa_buf_dma_alloc(struct cn30xxfpa_buf *); +void cn30xxfpa_bootstrap(struct octeon_config *); +void cn30xxfpa_reset(void); +void cn30xxfpa_int_enable(struct cn30xxfpa_softc *, int); +void cn30xxfpa_buf_dma_alloc(struct cn30xxfpa_buf *); -static void cn30xxfpa_init(struct cn30xxfpa_softc *); +void cn30xxfpa_init(struct cn30xxfpa_softc *); #ifdef notyet -static uint64_t cn30xxfpa_iobdma(struct cn30xxfpa_softc *, int, int); +uint64_t cn30xxfpa_iobdma(struct cn30xxfpa_softc *, int, int); #endif #ifdef OCTEON_ETH_DEBUG -void cn30xxfpa_intr_evcnt_attach(struct cn30xxfpa_softc *); -void cn30xxfpa_intr_rml(void *); +void cn30xxfpa_intr_evcnt_attach(struct cn30xxfpa_softc *); +void cn30xxfpa_intr_rml(void *); #endif static struct cn30xxfpa_softc cn30xxfpa_softc; @@ -296,9 +296,9 @@ cn30xxfpa_query(int poolno) /* ---- local functions */ -static void cn30xxfpa_init_bus(struct cn30xxfpa_softc *); -static void cn30xxfpa_init_bus_space(struct cn30xxfpa_softc *); -static void cn30xxfpa_init_regs(struct cn30xxfpa_softc *); +void cn30xxfpa_init_bus(struct cn30xxfpa_softc *); +void cn30xxfpa_init_bus_space(struct cn30xxfpa_softc *); +void cn30xxfpa_init_regs(struct cn30xxfpa_softc *); void cn30xxfpa_init(struct cn30xxfpa_softc *sc) @@ -315,13 +315,13 @@ cn30xxfpa_init(struct cn30xxfpa_softc *sc) #endif } -static void +void cn30xxfpa_init_bus(struct cn30xxfpa_softc *sc) { cn30xxfpa_init_bus_space(sc); } -static void +void cn30xxfpa_init_bus_space(struct cn30xxfpa_softc *sc) { int status; @@ -337,7 +337,7 @@ cn30xxfpa_init_bus_space(struct cn30xxfpa_softc *sc) panic("can't map %s space", "operations"); } -static void +void cn30xxfpa_init_regs(struct cn30xxfpa_softc *sc) { diff --git a/sys/arch/octeon/dev/cn30xxgmx.c b/sys/arch/octeon/dev/cn30xxgmx.c index 9b3bc66e19f..9b0efc9e236 100644 --- a/sys/arch/octeon/dev/cn30xxgmx.c +++ b/sys/arch/octeon/dev/cn30xxgmx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cn30xxgmx.c,v 1.12 2014/05/07 14:44:54 pirofti Exp $ */ +/* $OpenBSD: cn30xxgmx.c,v 1.13 2014/08/11 18:08:17 miod Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -85,30 +85,30 @@ struct cn30xxgmx_port_ops { int (*port_ops_set_filter)(struct cn30xxgmx_port_softc *); }; -static int cn30xxgmx_match(struct device *, void *, void *); -static void cn30xxgmx_attach(struct device *, struct device *, void *); -static int cn30xxgmx_print(void *, const char *); -static int cn30xxgmx_submatch(struct device *, void *, void *); -static int cn30xxgmx_init(struct cn30xxgmx_softc *); -static int cn30xxgmx_rx_frm_ctl_xable(struct cn30xxgmx_port_softc *, - uint64_t, int); -static int cn30xxgmx_rgmii_enable(struct cn30xxgmx_port_softc *, int); -static int cn30xxgmx_rgmii_speed(struct cn30xxgmx_port_softc *); -static int cn30xxgmx_rgmii_speed_newlink(struct cn30xxgmx_port_softc *, - uint64_t *); -static int cn30xxgmx_rgmii_speed_speed(struct cn30xxgmx_port_softc *); -static int cn30xxgmx_rgmii_timing(struct cn30xxgmx_port_softc *); -static int cn30xxgmx_rgmii_set_mac_addr(struct cn30xxgmx_port_softc *, - uint8_t *, uint64_t); -static int cn30xxgmx_rgmii_set_filter(struct cn30xxgmx_port_softc *); +int cn30xxgmx_match(struct device *, void *, void *); +void cn30xxgmx_attach(struct device *, struct device *, void *); +int cn30xxgmx_print(void *, const char *); +int cn30xxgmx_submatch(struct device *, void *, void *); +int cn30xxgmx_init(struct cn30xxgmx_softc *); +int cn30xxgmx_rx_frm_ctl_xable(struct cn30xxgmx_port_softc *, + uint64_t, int); +int cn30xxgmx_rgmii_enable(struct cn30xxgmx_port_softc *, int); +int cn30xxgmx_rgmii_speed(struct cn30xxgmx_port_softc *); +int cn30xxgmx_rgmii_speed_newlink(struct cn30xxgmx_port_softc *, + uint64_t *); +int cn30xxgmx_rgmii_speed_speed(struct cn30xxgmx_port_softc *); +int cn30xxgmx_rgmii_timing(struct cn30xxgmx_port_softc *); +int cn30xxgmx_rgmii_set_mac_addr(struct cn30xxgmx_port_softc *, + uint8_t *, uint64_t); +int cn30xxgmx_rgmii_set_filter(struct cn30xxgmx_port_softc *); #ifdef OCTEON_ETH_DEBUG -void cn30xxgmx_intr_evcnt_attach(struct cn30xxgmx_softc *); -void cn30xxgmx_dump(void); -void cn30xxgmx_debug_reset(void); -int cn30xxgmx_intr_drop(void *); -static int cn30xxgmx_rgmii_speed_newlink_log( - struct cn30xxgmx_port_softc *, uint64_t); +void cn30xxgmx_intr_evcnt_attach(struct cn30xxgmx_softc *); +void cn30xxgmx_dump(void); +void cn30xxgmx_debug_reset(void); +int cn30xxgmx_intr_drop(void *); +int cn30xxgmx_rgmii_speed_newlink_log(struct cn30xxgmx_port_softc *, + uint64_t); #endif static const int cn30xxgmx_rx_adr_cam_regs[] = { @@ -175,7 +175,7 @@ struct cfattach cn30xxgmx_ca = {sizeof(struct cn30xxgmx_softc), struct cfdriver cn30xxgmx_cd = {NULL, "cn30xxgmx", DV_DULL}; -static int +int cn30xxgmx_match(struct device *parent, void *match, void *aux) { struct cfdata *cf = (struct cfdata *)match; @@ -188,7 +188,7 @@ cn30xxgmx_match(struct device *parent, void *match, void *aux) return 1; } -static int +int cn30xxgmx_port_phy_addr(int port) { extern struct boot_info *octeon_boot_info; @@ -206,7 +206,7 @@ cn30xxgmx_port_phy_addr(int port) } } -static void +void cn30xxgmx_attach(struct device *parent, struct device *self, void *aux) { struct cn30xxgmx_softc *sc = (void *)self; @@ -272,7 +272,7 @@ cn30xxgmx_attach(struct device *parent, struct device *self, void *aux) #endif } -static int +int cn30xxgmx_print(void *aux, const char *pnp) { struct cn30xxgmx_attach_args *ga = aux; @@ -292,7 +292,7 @@ cn30xxgmx_print(void *aux, const char *pnp) return UNCONF; } -static int +int cn30xxgmx_submatch(struct device *parent, void *vcf, void *aux) { struct cfdata *cf = vcf; @@ -300,7 +300,7 @@ cn30xxgmx_submatch(struct device *parent, void *vcf, void *aux) return (*cf->cf_attach->ca_match)(parent, vcf, aux); } -static int +int cn30xxgmx_init(struct cn30xxgmx_softc *sc) { int result = 0; @@ -445,7 +445,7 @@ cn30xxgmx_rx_stats_dec_bad(struct cn30xxgmx_port_softc *sc) _GMX_PORT_WR8(sc, GMX0_RX0_STATS_PKTS_BAD, tmp - 1); } -static int +int cn30xxgmx_tx_ovr_bp_enable(struct cn30xxgmx_port_softc *sc, int enable) { uint64_t ovr_bp; @@ -466,7 +466,7 @@ cn30xxgmx_tx_ovr_bp_enable(struct cn30xxgmx_port_softc *sc, int enable) return 0; } -static int +int cn30xxgmx_rx_pause_enable(struct cn30xxgmx_port_softc *sc, int enable) { if (enable) { @@ -544,7 +544,7 @@ cn30xxgmx_rx_frm_ctl_disable(struct cn30xxgmx_port_softc *sc, return cn30xxgmx_rx_frm_ctl_xable(sc, rx_frm_ctl, 0); } -static int +int cn30xxgmx_rx_frm_ctl_xable(struct cn30xxgmx_port_softc *sc, uint64_t rx_frm_ctl, int enable) { @@ -660,7 +660,7 @@ cn30xxgmx_reset_flowctl(struct cn30xxgmx_port_softc *sc) return 0; } -static int +int cn30xxgmx_rgmii_enable(struct cn30xxgmx_port_softc *sc, int enable) { uint64_t mode; @@ -674,7 +674,7 @@ cn30xxgmx_rgmii_enable(struct cn30xxgmx_port_softc *sc, int enable) return 0; } -static int +int cn30xxgmx_rgmii_speed(struct cn30xxgmx_port_softc *sc) { struct ifnet *ifp = &sc->sc_port_ac->ac_if; @@ -726,7 +726,7 @@ cn30xxgmx_rgmii_speed(struct cn30xxgmx_port_softc *sc) return 0; } -static int +int cn30xxgmx_rgmii_speed_newlink(struct cn30xxgmx_port_softc *sc, uint64_t *rnewlink) { @@ -781,7 +781,7 @@ cn30xxgmx_rgmii_speed_newlink(struct cn30xxgmx_port_softc *sc, } #ifdef OCTEON_ETH_DEBUG -static int +int cn30xxgmx_rgmii_speed_newlink_log(struct cn30xxgmx_port_softc *sc, uint64_t newlink) { @@ -854,7 +854,7 @@ cn30xxgmx_rgmii_speed_newlink_log(struct cn30xxgmx_port_softc *sc, } #endif -static int +int cn30xxgmx_rgmii_speed_speed(struct cn30xxgmx_port_softc *sc) { uint64_t prt_cfg; @@ -988,7 +988,7 @@ cn30xxgmx_rgmii_speed_speed(struct cn30xxgmx_port_softc *sc) return 0; } -static int +int cn30xxgmx_rgmii_timing(struct cn30xxgmx_port_softc *sc) { extern struct boot_info *octeon_boot_info; @@ -1061,7 +1061,7 @@ cn30xxgmx_rgmii_timing(struct cn30xxgmx_port_softc *sc) return 0; } -static int +int cn30xxgmx_rgmii_set_mac_addr(struct cn30xxgmx_port_softc *sc, uint8_t *addr, uint64_t mac) { @@ -1081,7 +1081,7 @@ cn30xxgmx_rgmii_set_mac_addr(struct cn30xxgmx_port_softc *sc, uint8_t *addr, #define OCTEON_ETH_USE_GMX_CAM -static int +int cn30xxgmx_rgmii_set_filter(struct cn30xxgmx_port_softc *sc) { struct ifnet *ifp = &sc->sc_port_ac->ac_if; @@ -1220,8 +1220,8 @@ cn30xxgmx_stats(struct cn30xxgmx_port_softc *sc) #define _POLICY_REJECT CN30XXGMX_FILTER_POLICY_REJECT #define _POLICY_REJECT_ALL CN30XXGMX_FILTER_POLICY_REJECT_ALL -static int cn30xxgmx_setfilt_addrs(struct cn30xxgmx_port_softc *, - size_t, uint8_t **); +int cn30xxgmx_setfilt_addrs(struct cn30xxgmx_port_softc *, + size_t, uint8_t **); int cn30xxgmx_setfilt(struct cn30xxgmx_port_softc *sc, enum _POLICY policy, @@ -1262,7 +1262,7 @@ cn30xxgmx_setfilt(struct cn30xxgmx_port_softc *sc, enum _POLICY policy, return 0; } -static int +int cn30xxgmx_setfilt_addrs(struct cn30xxgmx_port_softc *sc, size_t naddrs, uint8_t **addrs) { @@ -1295,9 +1295,9 @@ cn30xxgmx_setfilt_addrs(struct cn30xxgmx_port_softc *sc, size_t naddrs, /* ---- interrupt */ #ifdef OCTEON_ETH_DEBUG -void cn30xxgmx_intr_rml_gmx0(void); +void cn30xxgmx_intr_rml_gmx0(void); -int cn30xxgmx_intr_rml_verbose; +int cn30xxgmx_intr_rml_verbose; /* tx - per unit (gmx0, gmx1, ...) */ static const struct octeon_evcnt_entry cn30xxgmx_intr_evcnt_tx_entries[] = { diff --git a/sys/arch/octeon/dev/cn30xxpow.c b/sys/arch/octeon/dev/cn30xxpow.c index f5d3fd10baa..33fed11e59f 100644 --- a/sys/arch/octeon/dev/cn30xxpow.c +++ b/sys/arch/octeon/dev/cn30xxpow.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cn30xxpow.c,v 1.4 2014/03/29 18:09:30 guenther Exp $ */ +/* $OpenBSD: cn30xxpow.c,v 1.5 2014/08/11 18:08:17 miod Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -69,32 +69,31 @@ struct cn30xxpow_intr_handle { #endif }; -void cn30xxpow_bootstrap(struct octeon_config *); +void cn30xxpow_bootstrap(struct octeon_config *); #ifdef OCTEON_ETH_DEBUG -void cn30xxpow_intr_evcnt_attach(struct cn30xxpow_softc *); -void cn30xxpow_intr_rml(void *); - -static void cn30xxpow_intr_debug_init( - struct cn30xxpow_intr_handle *, int); -static void cn30xxpow_intr_work_debug_ival(struct cn30xxpow_softc *, - struct cn30xxpow_intr_handle *); -static void cn30xxpow_intr_work_debug_per(struct cn30xxpow_softc *, - struct cn30xxpow_intr_handle *, int); +void cn30xxpow_intr_evcnt_attach(struct cn30xxpow_softc *); +void cn30xxpow_intr_rml(void *); + +void cn30xxpow_intr_debug_init(struct cn30xxpow_intr_handle *, int); +void cn30xxpow_intr_work_debug_ival(struct cn30xxpow_softc *, + struct cn30xxpow_intr_handle *); +void cn30xxpow_intr_work_debug_per(struct cn30xxpow_softc *, + struct cn30xxpow_intr_handle *, int); #endif -static void cn30xxpow_init(struct cn30xxpow_softc *); -static void cn30xxpow_init_regs(struct cn30xxpow_softc *); -static int cn30xxpow_tag_sw_poll(void); -static void cn30xxpow_tag_sw_wait(void); -static void cn30xxpow_config_int_pc(struct cn30xxpow_softc *, int); -static void cn30xxpow_config_int(struct cn30xxpow_softc *, int, - uint64_t, uint64_t, uint64_t); -static void cn30xxpow_intr_work(struct cn30xxpow_softc *, - struct cn30xxpow_intr_handle *, int); -static int cn30xxpow_intr(void *); +void cn30xxpow_init(struct cn30xxpow_softc *); +void cn30xxpow_init_regs(struct cn30xxpow_softc *); +int cn30xxpow_tag_sw_poll(void); +void cn30xxpow_tag_sw_wait(void); +void cn30xxpow_config_int_pc(struct cn30xxpow_softc *, int); +void cn30xxpow_config_int(struct cn30xxpow_softc *, int, + uint64_t, uint64_t, uint64_t); +void cn30xxpow_intr_work(struct cn30xxpow_softc *, + struct cn30xxpow_intr_handle *, int); +int cn30xxpow_intr(void *); #ifdef OCTEON_ETH_DEBUG -void cn30xxpow_dump(void); +void cn30xxpow_dump(void); #endif /* XXX */ @@ -257,7 +256,7 @@ cn30xxpow_status_by_queue_remote_tail(int queue) */ /* return 1 if pending bit is clear (ready) */ -static int +int cn30xxpow_tag_sw_poll(void) { uint64_t result; @@ -273,7 +272,7 @@ cn30xxpow_tag_sw_poll(void) return (int)result; } -static void +void cn30xxpow_tag_sw_wait(void) { @@ -301,7 +300,7 @@ cn30xxpow_bootstrap(struct octeon_config *mcp) } -static void +void cn30xxpow_config_int(struct cn30xxpow_softc *sc, int group, uint64_t tc_thr, uint64_t ds_thr, uint64_t iq_thr) { @@ -371,7 +370,7 @@ cn30xxpow_intr_establish(int group, int level, #define _NAMELEN 8 #define _DESCRLEN 40 -static void +void cn30xxpow_intr_debug_init(struct cn30xxpow_intr_handle *pow_ih, int group) { pow_ih->pi_first = 1; @@ -468,7 +467,7 @@ cn30xxpow_init_regs(struct cn30xxpow_softc *sc) /* ---- interrupt handling */ #ifdef OCTEON_ETH_DEBUG -static void +void cn30xxpow_intr_work_debug_ival(struct cn30xxpow_softc *sc, struct cn30xxpow_intr_handle *pow_ih) { @@ -493,7 +492,7 @@ stat_done: pow_ih->pi_last = now; /* struct copy */ } -static void +void cn30xxpow_intr_work_debug_per(struct cn30xxpow_softc *sc, struct cn30xxpow_intr_handle *pow_ih, int count) { @@ -543,7 +542,7 @@ cn30xxpow_intr_work_debug_per(struct cn30xxpow_softc *sc, */ #define MAX_RX_CNT 0x7fffffff -static void +void cn30xxpow_intr_work(struct cn30xxpow_softc *sc, struct cn30xxpow_intr_handle *pow_ih, int max_recv_cnt) { @@ -592,7 +591,7 @@ done: /* splx(s); */ } -static int +int cn30xxpow_intr(void *data) { struct cn30xxpow_intr_handle *pow_ih = data; diff --git a/sys/arch/octeon/dev/cn30xxsmi.c b/sys/arch/octeon/dev/cn30xxsmi.c index 37b9ad9d4df..a2244113aca 100644 --- a/sys/arch/octeon/dev/cn30xxsmi.c +++ b/sys/arch/octeon/dev/cn30xxsmi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cn30xxsmi.c,v 1.2 2012/12/05 23:20:14 deraadt Exp $ */ +/* $OpenBSD: cn30xxsmi.c,v 1.3 2014/08/11 18:08:17 miod Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -38,7 +38,7 @@ #include #include -static void cn30xxsmi_enable(struct cn30xxsmi_softc *); +void cn30xxsmi_enable(struct cn30xxsmi_softc *); /* XXX */ void @@ -123,7 +123,7 @@ cn30xxsmi_write(struct cn30xxsmi_softc *sc, int phy_addr, int reg, int value) } } -static void +void cn30xxsmi_enable(struct cn30xxsmi_softc *sc) { _SMI_WR8(sc, SMI_EN_OFFSET, SMI_EN_EN); diff --git a/sys/arch/octeon/dev/if_cnmac.c b/sys/arch/octeon/dev/if_cnmac.c index c059f220181..6e923a69ea9 100644 --- a/sys/arch/octeon/dev/if_cnmac.c +++ b/sys/arch/octeon/dev/if_cnmac.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_cnmac.c,v 1.15 2014/07/22 10:35:35 mpi Exp $ */ +/* $OpenBSD: if_cnmac.c,v 1.16 2014/08/11 18:08:17 miod Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -121,85 +121,78 @@ #define OCTEON_ETH_TAP(ifp, m, dir) #endif /* NBPFILTER > 0 */ -static void octeon_eth_buf_init(struct octeon_eth_softc *); - -static int octeon_eth_match(struct device *, void *, void *); -static void octeon_eth_attach(struct device *, struct device *, void *); -static void octeon_eth_pip_init(struct octeon_eth_softc *); -static void octeon_eth_ipd_init(struct octeon_eth_softc *); -static void octeon_eth_pko_init(struct octeon_eth_softc *); -static void octeon_eth_asx_init(struct octeon_eth_softc *); -static void octeon_eth_smi_init(struct octeon_eth_softc *); - -static void octeon_eth_board_mac_addr(uint8_t *); - -static int octeon_eth_mii_readreg(struct device *, int, int); -static void octeon_eth_mii_writereg(struct device *, int, int, int); -static void octeon_eth_mii_statchg(struct device *); - -static int octeon_eth_mediainit(struct octeon_eth_softc *); -static void octeon_eth_mediastatus(struct ifnet *, struct ifmediareq *); -static int octeon_eth_mediachange(struct ifnet *); - -static void octeon_eth_send_queue_flush_prefetch(struct octeon_eth_softc *); -static void octeon_eth_send_queue_flush_fetch(struct octeon_eth_softc *); -static void octeon_eth_send_queue_flush(struct octeon_eth_softc *); -static void octeon_eth_send_queue_flush_sync(struct octeon_eth_softc *); -static int octeon_eth_send_queue_is_full(struct octeon_eth_softc *); -static void octeon_eth_send_queue_add(struct octeon_eth_softc *, - struct mbuf *, uint64_t *); -static void octeon_eth_send_queue_del(struct octeon_eth_softc *, - struct mbuf **, uint64_t **); -static int octeon_eth_buf_free_work(struct octeon_eth_softc *, - uint64_t *, uint64_t); -static void octeon_eth_buf_ext_free_m(caddr_t, u_int, void *); -static void octeon_eth_buf_ext_free_ext(caddr_t, u_int, void *); - -static int octeon_eth_ioctl(struct ifnet *, u_long, caddr_t); -static void octeon_eth_watchdog(struct ifnet *); -static int octeon_eth_init(struct ifnet *); -static int octeon_eth_stop(struct ifnet *, int); -static void octeon_eth_start(struct ifnet *); - -static int octeon_eth_send_cmd(struct octeon_eth_softc *, uint64_t, - uint64_t); -static uint64_t octeon_eth_send_makecmd_w1(int, paddr_t); -static uint64_t octeon_eth_send_makecmd_w0(uint64_t, uint64_t, size_t, - int); -static int octeon_eth_send_makecmd_gbuf(struct octeon_eth_softc *, - struct mbuf *, uint64_t *, int *); -static int octeon_eth_send_makecmd(struct octeon_eth_softc *, - struct mbuf *, uint64_t *, uint64_t *, uint64_t *); -static int octeon_eth_send_buf(struct octeon_eth_softc *, - struct mbuf *, uint64_t *); -static int octeon_eth_send(struct octeon_eth_softc *, - struct mbuf *); - -static int octeon_eth_reset(struct octeon_eth_softc *); -static int octeon_eth_configure(struct octeon_eth_softc *); -static int octeon_eth_configure_common(struct octeon_eth_softc *); - -static void octeon_eth_tick_free(void *arg); -static void octeon_eth_tick_misc(void *); - -static int octeon_eth_recv_mbuf(struct octeon_eth_softc *, - uint64_t *, struct mbuf **); -static int octeon_eth_recv_check_code(struct octeon_eth_softc *, - uint64_t); +void octeon_eth_buf_init(struct octeon_eth_softc *); + +int octeon_eth_match(struct device *, void *, void *); +void octeon_eth_attach(struct device *, struct device *, void *); +void octeon_eth_pip_init(struct octeon_eth_softc *); +void octeon_eth_ipd_init(struct octeon_eth_softc *); +void octeon_eth_pko_init(struct octeon_eth_softc *); +void octeon_eth_asx_init(struct octeon_eth_softc *); +void octeon_eth_smi_init(struct octeon_eth_softc *); + +void octeon_eth_board_mac_addr(uint8_t *); + +int octeon_eth_mii_readreg(struct device *, int, int); +void octeon_eth_mii_writereg(struct device *, int, int, int); +void octeon_eth_mii_statchg(struct device *); + +int octeon_eth_mediainit(struct octeon_eth_softc *); +void octeon_eth_mediastatus(struct ifnet *, struct ifmediareq *); +int octeon_eth_mediachange(struct ifnet *); + +void octeon_eth_send_queue_flush_prefetch(struct octeon_eth_softc *); +void octeon_eth_send_queue_flush_fetch(struct octeon_eth_softc *); +void octeon_eth_send_queue_flush(struct octeon_eth_softc *); +void octeon_eth_send_queue_flush_sync(struct octeon_eth_softc *); +int octeon_eth_send_queue_is_full(struct octeon_eth_softc *); +void octeon_eth_send_queue_add(struct octeon_eth_softc *, + struct mbuf *, uint64_t *); +void octeon_eth_send_queue_del(struct octeon_eth_softc *, + struct mbuf **, uint64_t **); +int octeon_eth_buf_free_work(struct octeon_eth_softc *, + uint64_t *, uint64_t); +void octeon_eth_buf_ext_free_m(caddr_t, u_int, void *); +void octeon_eth_buf_ext_free_ext(caddr_t, u_int, void *); + +int octeon_eth_ioctl(struct ifnet *, u_long, caddr_t); +void octeon_eth_watchdog(struct ifnet *); +int octeon_eth_init(struct ifnet *); +int octeon_eth_stop(struct ifnet *, int); +void octeon_eth_start(struct ifnet *); + +int octeon_eth_send_cmd(struct octeon_eth_softc *, uint64_t, uint64_t); +uint64_t octeon_eth_send_makecmd_w1(int, paddr_t); +uint64_t octeon_eth_send_makecmd_w0(uint64_t, uint64_t, size_t, int); +int octeon_eth_send_makecmd_gbuf(struct octeon_eth_softc *, + struct mbuf *, uint64_t *, int *); +int octeon_eth_send_makecmd(struct octeon_eth_softc *, + struct mbuf *, uint64_t *, uint64_t *, uint64_t *); +int octeon_eth_send_buf(struct octeon_eth_softc *, + struct mbuf *, uint64_t *); +int octeon_eth_send(struct octeon_eth_softc *, struct mbuf *); + +int octeon_eth_reset(struct octeon_eth_softc *); +int octeon_eth_configure(struct octeon_eth_softc *); +int octeon_eth_configure_common(struct octeon_eth_softc *); + +void octeon_eth_tick_free(void *arg); +void octeon_eth_tick_misc(void *); + +int octeon_eth_recv_mbuf(struct octeon_eth_softc *, + uint64_t *, struct mbuf **); +int octeon_eth_recv_check_code(struct octeon_eth_softc *, uint64_t); #if 0 /* not used */ -static int octeon_eth_recv_check_jumbo(struct octeon_eth_softc *, - uint64_t); +int octeon_eth_recv_check_jumbo(struct octeon_eth_softc *, uint64_t); #endif -static int octeon_eth_recv_check_link(struct octeon_eth_softc *, - uint64_t); -static int octeon_eth_recv_check(struct octeon_eth_softc *, - uint64_t); -static int octeon_eth_recv(struct octeon_eth_softc *, uint64_t *); -static void octeon_eth_recv_intr(void *, uint64_t *); +int octeon_eth_recv_check_link(struct octeon_eth_softc *, uint64_t); +int octeon_eth_recv_check(struct octeon_eth_softc *, uint64_t); +int octeon_eth_recv(struct octeon_eth_softc *, uint64_t *); +void octeon_eth_recv_intr(void *, uint64_t *); /* device driver context */ -static struct octeon_eth_softc *octeon_eth_gsc[GMX_PORT_NUNITS]; -static void *octeon_eth_pow_recv_ih; +struct octeon_eth_softc *octeon_eth_gsc[GMX_PORT_NUNITS]; +void *octeon_eth_pow_recv_ih; /* sysctl'able parameters */ int octeon_eth_param_pko_cmd_w0_n2 = 1; @@ -256,7 +249,7 @@ static const struct octeon_evcnt_entry octeon_evcnt_entries[] = { /* ---- buffer management */ -static const struct octeon_eth_pool_param { +const struct octeon_eth_pool_param { int poolno; size_t size; size_t nelems; @@ -277,7 +270,7 @@ struct cn30xxfpa_buf *octeon_eth_pools[8/* XXX */]; uint64_t octeon_eth_mac_addr = 0; uint32_t octeon_eth_mac_addr_offset = 0; -static void +void octeon_eth_buf_init(struct octeon_eth_softc *sc) { static int once; @@ -298,7 +291,7 @@ octeon_eth_buf_init(struct octeon_eth_softc *sc) /* ---- autoconf */ -static int +int octeon_eth_match(struct device *parent, void *match, void *aux) { struct cfdata *cf = (struct cfdata *)match; @@ -310,7 +303,7 @@ octeon_eth_match(struct device *parent, void *match, void *aux) return 1; } -static void +void octeon_eth_attach(struct device *parent, struct device *self, void *aux) { struct octeon_eth_softc *sc = (void *)self; @@ -408,7 +401,7 @@ octeon_eth_attach(struct device *parent, struct device *self, void *aux) /* ---- submodules */ /* XXX */ -static void +void octeon_eth_pip_init(struct octeon_eth_softc *sc) { struct cn30xxpip_attach_args pip_aa; @@ -422,7 +415,7 @@ octeon_eth_pip_init(struct octeon_eth_softc *sc) } /* XXX */ -static void +void octeon_eth_ipd_init(struct octeon_eth_softc *sc) { struct cn30xxipd_attach_args ipd_aa; @@ -435,7 +428,7 @@ octeon_eth_ipd_init(struct octeon_eth_softc *sc) } /* XXX */ -static void +void octeon_eth_pko_init(struct octeon_eth_softc *sc) { struct cn30xxpko_attach_args pko_aa; @@ -449,7 +442,7 @@ octeon_eth_pko_init(struct octeon_eth_softc *sc) } /* XXX */ -static void +void octeon_eth_asx_init(struct octeon_eth_softc *sc) { struct cn30xxasx_attach_args asx_aa; @@ -459,7 +452,7 @@ octeon_eth_asx_init(struct octeon_eth_softc *sc) cn30xxasx_init(&asx_aa, &sc->sc_asx); } -static void +void octeon_eth_smi_init(struct octeon_eth_softc *sc) { struct cn30xxsmi_attach_args smi_aa; @@ -472,7 +465,7 @@ octeon_eth_smi_init(struct octeon_eth_softc *sc) /* ---- XXX */ -static void +void octeon_eth_board_mac_addr(uint8_t *enaddr) { extern struct boot_info *octeon_boot_info; @@ -527,21 +520,21 @@ octeon_eth_board_mac_addr(uint8_t *enaddr) /* ---- media */ -static int +int octeon_eth_mii_readreg(struct device *self, int phy_no, int reg) { struct octeon_eth_softc *sc = (struct octeon_eth_softc *)self; return cn30xxsmi_read(sc->sc_smi, phy_no, reg); } -static void +void octeon_eth_mii_writereg(struct device *self, int phy_no, int reg, int value) { struct octeon_eth_softc *sc = (struct octeon_eth_softc *)self; cn30xxsmi_write(sc->sc_smi, phy_no, reg, value); } -static void +void octeon_eth_mii_statchg(struct device *self) { struct octeon_eth_softc *sc = (struct octeon_eth_softc *)self; @@ -559,7 +552,7 @@ octeon_eth_mii_statchg(struct device *self) cn30xxgmx_port_enable(sc->sc_gmx_port, 1); } -static int +int octeon_eth_mediainit(struct octeon_eth_softc *sc) { struct ifnet *ifp = &sc->sc_arpcom.ac_if; @@ -588,7 +581,7 @@ octeon_eth_mediainit(struct octeon_eth_softc *sc) return 0; } -static void +void octeon_eth_mediastatus(struct ifnet *ifp, struct ifmediareq *ifmr) { struct octeon_eth_softc *sc = ifp->if_softc; @@ -600,7 +593,7 @@ octeon_eth_mediastatus(struct ifnet *ifp, struct ifmediareq *ifmr) sc->sc_gmx_port->sc_port_flowflags; } -static int +int octeon_eth_mediachange(struct ifnet *ifp) { struct octeon_eth_softc *sc = ifp->if_softc; @@ -613,7 +606,7 @@ octeon_eth_mediachange(struct ifnet *ifp) /* ---- send buffer garbage collection */ -static void +void octeon_eth_send_queue_flush_prefetch(struct octeon_eth_softc *sc) { OCTEON_ETH_KASSERT(sc->sc_prefetch == 0); @@ -621,7 +614,7 @@ octeon_eth_send_queue_flush_prefetch(struct octeon_eth_softc *sc) sc->sc_prefetch = 1; } -static void +void octeon_eth_send_queue_flush_fetch(struct octeon_eth_softc *sc) { #ifndef OCTEON_ETH_DEBUG @@ -634,7 +627,7 @@ octeon_eth_send_queue_flush_fetch(struct octeon_eth_softc *sc) sc->sc_prefetch = 0; } -static void +void octeon_eth_send_queue_flush(struct octeon_eth_softc *sc) { const int64_t sent_count = sc->sc_hard_done_cnt; @@ -659,7 +652,7 @@ octeon_eth_send_queue_flush(struct octeon_eth_softc *sc) sc->sc_flush = i; } -static void +void octeon_eth_send_queue_flush_sync(struct octeon_eth_softc *sc) { if (sc->sc_flush == 0) @@ -676,7 +669,7 @@ octeon_eth_send_queue_flush_sync(struct octeon_eth_softc *sc) sc->sc_flush = 0; } -static int +int octeon_eth_send_queue_is_full(struct octeon_eth_softc *sc) { #ifdef OCTEON_ETH_SEND_QUEUE_CHECK @@ -716,7 +709,7 @@ struct _send_queue_entry { #define _sqe_gbuf _sqe_u._sqe_s_gbuf._sqe_s_gbuf_gbuf }; -static void +void octeon_eth_send_queue_add(struct octeon_eth_softc *sc, struct mbuf *m, uint64_t *gbuf) { @@ -733,7 +726,7 @@ octeon_eth_send_queue_add(struct octeon_eth_softc *sc, struct mbuf *m, OCTEON_EVCNT_INC(sc, txadd); } -static void +void octeon_eth_send_queue_del(struct octeon_eth_softc *sc, struct mbuf **rm, uint64_t **rgbuf) { @@ -754,7 +747,7 @@ octeon_eth_send_queue_del(struct octeon_eth_softc *sc, struct mbuf **rm, OCTEON_EVCNT_INC(sc, txdel); } -static int +int octeon_eth_buf_free_work(struct octeon_eth_softc *sc, uint64_t *work, uint64_t word2) { @@ -776,7 +769,7 @@ octeon_eth_buf_free_work(struct octeon_eth_softc *sc, uint64_t *work, return 0; } -static void +void octeon_eth_buf_ext_free_m(caddr_t buf, u_int size, void *arg) { uint64_t *work = (void *)arg; @@ -793,7 +786,7 @@ octeon_eth_buf_ext_free_m(caddr_t buf, u_int size, void *arg) splx(s); } -static void +void octeon_eth_buf_ext_free_ext(caddr_t buf, u_int size, void *arg) { @@ -814,7 +807,7 @@ octeon_eth_buf_ext_free_ext(caddr_t buf, u_int size, /* ---- ifnet interfaces */ -static int +int octeon_eth_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) { struct octeon_eth_softc *sc = ifp->if_softc; @@ -884,7 +877,7 @@ octeon_eth_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) /* ---- send (output) */ -static uint64_t +uint64_t octeon_eth_send_makecmd_w0(uint64_t fau0, uint64_t fau1, size_t len, int segs) { return cn30xxpko_cmd_word0( @@ -899,7 +892,7 @@ octeon_eth_send_makecmd_w0(uint64_t fau0, uint64_t fau1, size_t len, int segs) segs, (int)len); /* segs, totalbytes */ } -static uint64_t +uint64_t octeon_eth_send_makecmd_w1(int size, paddr_t addr) { return cn30xxpko_cmd_word1( @@ -927,7 +920,7 @@ if_cnmac_kvtophys(vaddr_t kva) panic("if_cnmac_kvtophys"); } -static int +int octeon_eth_send_makecmd_gbuf(struct octeon_eth_softc *sc, struct mbuf *m0, uint64_t *gbuf, int *rsegs) { @@ -981,7 +974,7 @@ octeon_eth_send_makecmd_gbuf(struct octeon_eth_softc *sc, struct mbuf *m0, return 0; } -static int +int octeon_eth_send_makecmd(struct octeon_eth_softc *sc, struct mbuf *m, uint64_t *gbuf, uint64_t *rpko_cmd_w0, uint64_t *rpko_cmd_w1) { @@ -1018,7 +1011,7 @@ done: return result; } -static int +int octeon_eth_send_cmd(struct octeon_eth_softc *sc, uint64_t pko_cmd_w0, uint64_t pko_cmd_w1) { @@ -1060,7 +1053,7 @@ done: return result; } -static int +int octeon_eth_send_buf(struct octeon_eth_softc *sc, struct mbuf *m, uint64_t *gbuf) { @@ -1086,7 +1079,7 @@ done: return result; } -static int +int octeon_eth_send(struct octeon_eth_softc *sc, struct mbuf *m) { paddr_t gaddr = 0; @@ -1125,7 +1118,7 @@ done: return result; } -static void +void octeon_eth_start(struct ifnet *ifp) { struct octeon_eth_softc *sc = ifp->if_softc; @@ -1226,7 +1219,7 @@ last: octeon_eth_send_queue_flush_fetch(sc); } -static void +void octeon_eth_watchdog(struct ifnet *ifp) { struct octeon_eth_softc *sc = ifp->if_softc; @@ -1242,7 +1235,7 @@ octeon_eth_watchdog(struct ifnet *ifp) octeon_eth_start(ifp); } -static int +int octeon_eth_init(struct ifnet *ifp) { struct octeon_eth_softc *sc = ifp->if_softc; @@ -1275,7 +1268,7 @@ octeon_eth_init(struct ifnet *ifp) return 0; } -static int +int octeon_eth_stop(struct ifnet *ifp, int disable) { struct octeon_eth_softc *sc = ifp->if_softc; @@ -1299,7 +1292,7 @@ octeon_eth_stop(struct ifnet *ifp, int disable) #define PKO_INDEX_MASK ((1ULL << 12/* XXX */) - 1) -static int +int octeon_eth_reset(struct octeon_eth_softc *sc) { cn30xxgmx_reset_speed(sc->sc_gmx_port); @@ -1310,7 +1303,7 @@ octeon_eth_reset(struct octeon_eth_softc *sc) return 0; } -static int +int octeon_eth_configure(struct octeon_eth_softc *sc) { cn30xxgmx_port_enable(sc->sc_gmx_port, 0); @@ -1331,7 +1324,7 @@ octeon_eth_configure(struct octeon_eth_softc *sc) return 0; } -static int +int octeon_eth_configure_common(struct octeon_eth_softc *sc) { static int once; @@ -1352,7 +1345,7 @@ octeon_eth_configure_common(struct octeon_eth_softc *sc) return 0; } -static int +int octeon_eth_recv_mbuf(struct octeon_eth_softc *sc, uint64_t *work, struct mbuf **rm) { @@ -1414,7 +1407,7 @@ octeon_eth_recv_mbuf(struct octeon_eth_softc *sc, uint64_t *work, return 0; } -static int +int octeon_eth_recv_check_code(struct octeon_eth_softc *sc, uint64_t word2) { uint64_t opecode = word2 & PIP_WQE_WORD2_NOIP_OPECODE; @@ -1430,7 +1423,7 @@ octeon_eth_recv_check_code(struct octeon_eth_softc *sc, uint64_t word2) } #if 0 /* not used */ -static int +int octeon_eth_recv_check_jumbo(struct octeon_eth_softc *sc, uint64_t word2) { if (__predict_false((word2 & PIP_WQE_WORD2_IP_BUFS) > (1ULL << 56))) @@ -1439,7 +1432,7 @@ octeon_eth_recv_check_jumbo(struct octeon_eth_softc *sc, uint64_t word2) } #endif -static int +int octeon_eth_recv_check_link(struct octeon_eth_softc *sc, uint64_t word2) { if (__predict_false(!cn30xxgmx_link_status(sc->sc_gmx_port))) @@ -1447,7 +1440,7 @@ octeon_eth_recv_check_link(struct octeon_eth_softc *sc, uint64_t word2) return 0; } -static int +int octeon_eth_recv_check(struct octeon_eth_softc *sc, uint64_t word2) { if (__predict_false(octeon_eth_recv_check_link(sc, word2)) != 0) { @@ -1495,7 +1488,7 @@ octeon_eth_recv_check(struct octeon_eth_softc *sc, uint64_t word2) return 0; } -static int +int octeon_eth_recv(struct octeon_eth_softc *sc, uint64_t *work) { int result = 0; @@ -1571,7 +1564,7 @@ drop: return result; } -static void +void octeon_eth_recv_intr(void *data, uint64_t *work) { struct octeon_eth_softc *sc; @@ -1601,7 +1594,7 @@ octeon_eth_recv_intr(void *data, uint64_t *work) * => garbage collect send gather buffer / mbuf * => called at softclock */ -static void +void octeon_eth_tick_free(void *arg) { struct octeon_eth_softc *sc = arg; @@ -1634,7 +1627,7 @@ octeon_eth_tick_free(void *arg) * => check link status * => called at softclock */ -static void +void octeon_eth_tick_misc(void *arg) { struct octeon_eth_softc *sc = arg; -- 2.20.1