diff options
Diffstat (limited to 'sys')
40 files changed, 235 insertions, 234 deletions
diff --git a/sys/arch/sparc/dev/if_le.c b/sys/arch/sparc/dev/if_le.c index feaab59f2e2..e883e9df40f 100644 --- a/sys/arch/sparc/dev/if_le.c +++ b/sys/arch/sparc/dev/if_le.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_le.c,v 1.36 2014/12/22 02:26:54 tedu Exp $ */ +/* $OpenBSD: if_le.c,v 1.37 2015/09/11 13:02:28 stsp Exp $ */ /* $NetBSD: if_le.c,v 1.50 1997/09/09 20:54:48 pk Exp $ */ /*- @@ -93,18 +93,18 @@ int lemediachange(struct lance_softc *); void lemediastatus(struct lance_softc *, struct ifmediareq *); #if defined(SUN4C) || defined(SUN4D) || defined(SUN4E) || defined(SUN4M) -static int lebufmedia[] = { +static uint64_t lebufmedia[] = { IFM_ETHER | IFM_10_T }; #endif #if defined(SUN4M) -static int ledmamedia[] = { +static uint64_t ledmamedia[] = { IFM_ETHER | IFM_10_T, IFM_ETHER | IFM_10_5, IFM_ETHER | IFM_AUTO }; #endif -static int lebaremedia[] = { +static uint64_t lebaremedia[] = { IFM_ETHER | IFM_10_5 }; diff --git a/sys/dev/ic/dc.c b/sys/dev/ic/dc.c index 25e85e57c6a..ebaaae16416 100644 --- a/sys/dev/ic/dc.c +++ b/sys/dev/ic/dc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dc.c,v 1.142 2015/08/30 02:12:23 deraadt Exp $ */ +/* $OpenBSD: dc.c,v 1.143 2015/09/11 13:02:28 stsp Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -182,7 +182,7 @@ void dc_decode_leaf_mii(struct dc_softc *, struct dc_eblock_mii *); void dc_decode_leaf_sym(struct dc_softc *, struct dc_eblock_sym *); -void dc_apply_fixup(struct dc_softc *, int); +void dc_apply_fixup(struct dc_softc *, uint64_t); #define DC_SETBIT(sc, reg, x) \ CSR_WRITE_4(sc, reg, CSR_READ_4(sc, reg) | (x)) @@ -1359,7 +1359,7 @@ dc_reset(struct dc_softc *sc) } void -dc_apply_fixup(struct dc_softc *sc, int media) +dc_apply_fixup(struct dc_softc *sc, uint64_t media) { struct dc_mediainfo *m; u_int8_t *p; diff --git a/sys/dev/ic/dcreg.h b/sys/dev/ic/dcreg.h index c9c6016e30c..44985ddbbe8 100644 --- a/sys/dev/ic/dcreg.h +++ b/sys/dev/ic/dcreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: dcreg.h,v 1.50 2015/08/30 02:12:23 deraadt Exp $ */ +/* $OpenBSD: dcreg.h,v 1.51 2015/09/11 13:02:28 stsp Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -505,7 +505,7 @@ struct dc_chain_data { }; struct dc_mediainfo { - int dc_media; + uint64_t dc_media; u_int8_t *dc_gp_ptr; u_int8_t dc_gp_len; u_int8_t *dc_reset_ptr; @@ -742,7 +742,7 @@ struct dc_softc { u_int dc_revision; struct timeout dc_tick_tmo; #ifdef SRM_MEDIA - int dc_srm_media; + uint64_t dc_srm_media; #endif bus_dma_tag_t sc_dmat; bus_dmamap_t sc_listmap; diff --git a/sys/dev/ic/elink3.c b/sys/dev/ic/elink3.c index 72395980c77..f5f1e518592 100644 --- a/sys/dev/ic/elink3.c +++ b/sys/dev/ic/elink3.c @@ -1,4 +1,4 @@ -/* $OpenBSD: elink3.c,v 1.86 2015/07/08 07:21:50 mpi Exp $ */ +/* $OpenBSD: elink3.c,v 1.87 2015/09/11 13:02:28 stsp Exp $ */ /* $NetBSD: elink3.c,v 1.32 1997/05/14 00:22:00 thorpej Exp $ */ /* @@ -75,7 +75,7 @@ struct ep_media { int epm_eeprom_data; /* bitmask for eeprom config */ int epm_conn; /* sc->ep_connectors code for medium */ char *epm_name; /* name of medium */ - int epm_ifmedia; /* ifmedia word for medium */ + uint64_t epm_ifmedia; /* ifmedia word for medium */ int epm_ifdata; }; @@ -118,7 +118,7 @@ struct ep_media ep_isa_media[] = { }; /* Map vortex reset_options bits to if_media codes. */ -const u_int ep_default_to_media[] = { +const uint64_t ep_default_to_media[] = { IFM_ETHER | IFM_10_T, IFM_ETHER | IFM_10_5, 0, /* reserved by 3Com */ diff --git a/sys/dev/ic/gem.c b/sys/dev/ic/gem.c index 57b1a68ea38..4044432b762 100644 --- a/sys/dev/ic/gem.c +++ b/sys/dev/ic/gem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gem.c,v 1.112 2015/06/24 09:40:54 mpi Exp $ */ +/* $OpenBSD: gem.c,v 1.113 2015/09/11 13:02:28 stsp Exp $ */ /* $NetBSD: gem.c,v 1.1 2001/09/16 00:11:43 eeh Exp $ */ /* @@ -1315,7 +1315,7 @@ gem_mii_statchg(struct device *dev) { struct gem_softc *sc = (void *)dev; #ifdef GEM_DEBUG - int instance = IFM_INST(sc->sc_mii.mii_media.ifm_cur->ifm_media); + uint64_t instance = IFM_INST(sc->sc_mii.mii_media.ifm_cur->ifm_media); #endif bus_space_tag_t t = sc->sc_bustag; bus_space_handle_t mac = sc->sc_h1; @@ -1323,7 +1323,7 @@ gem_mii_statchg(struct device *dev) #ifdef GEM_DEBUG if (sc->sc_debug) - printf("gem_mii_statchg: status change: phy = %d\n", instance); + printf("gem_mii_statchg: status change: phy = %lld\n", instance); #endif /* Set tx full duplex options */ diff --git a/sys/dev/ic/hme.c b/sys/dev/ic/hme.c index 98f8091300c..b9d915c1907 100644 --- a/sys/dev/ic/hme.c +++ b/sys/dev/ic/hme.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hme.c,v 1.73 2015/06/24 09:40:54 mpi Exp $ */ +/* $OpenBSD: hme.c,v 1.74 2015/09/11 13:02:28 stsp Exp $ */ /* $NetBSD: hme.c,v 1.21 2001/07/07 15:59:37 thorpej Exp $ */ /*- @@ -259,7 +259,7 @@ hme_config(struct hme_softc *sc) */ if (child->mii_phy > 1 || child->mii_inst > 1) { printf("%s: cannot accommodate MII device %s" - " at phy %d, instance %d\n", + " at phy %d, instance %lld\n", sc->sc_dev.dv_xname, child->mii_dev.dv_xname, child->mii_phy, child->mii_inst); @@ -1104,7 +1104,7 @@ hme_mediachange(struct ifnet *ifp) bus_space_tag_t t = sc->sc_bustag; bus_space_handle_t mif = sc->sc_mif; bus_space_handle_t mac = sc->sc_mac; - int instance = IFM_INST(sc->sc_mii.mii_media.ifm_cur->ifm_media); + uint64_t instance = IFM_INST(sc->sc_mii.mii_media.ifm_cur->ifm_media); int phy = sc->sc_phys[instance]; u_int32_t v; diff --git a/sys/dev/ic/if_wi.c b/sys/dev/ic/if_wi.c index b224c99ff13..2b8bc35684c 100644 --- a/sys/dev/ic/if_wi.c +++ b/sys/dev/ic/if_wi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_wi.c,v 1.162 2015/06/24 09:40:54 mpi Exp $ */ +/* $OpenBSD: if_wi.c,v 1.163 2015/09/11 13:02:28 stsp Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -2672,9 +2672,9 @@ wi_get_id(struct wi_softc *sc) STATIC int wi_sync_media(struct wi_softc *sc, int ptype, int txrate) { - int media = sc->sc_media.ifm_cur->ifm_media; - int options = IFM_OPTIONS(media); - int subtype; + uint64_t media = sc->sc_media.ifm_cur->ifm_media; + uint64_t options = IFM_OPTIONS(media); + uint64_t subtype; switch (txrate) { case 1: diff --git a/sys/dev/ic/lancevar.h b/sys/dev/ic/lancevar.h index 39c8bd55a71..2ce562f2a0b 100644 --- a/sys/dev/ic/lancevar.h +++ b/sys/dev/ic/lancevar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: lancevar.h,v 1.2 2015/05/01 14:56:18 mpi Exp $ */ +/* $OpenBSD: lancevar.h,v 1.3 2015/09/11 13:02:28 stsp Exp $ */ /* $NetBSD: lancevar.h,v 1.15 2012/02/02 19:43:03 tls Exp $ */ /*- @@ -70,9 +70,9 @@ struct lance_softc { * Media-supported by this interface. If this is NULL, * the only supported media is assumed to be "manual". */ - const int *sc_supmedia; - int sc_nsupmedia; - int sc_defaultmedia; + const uint64_t *sc_supmedia; + int sc_nsupmedia; + uint64_t sc_defaultmedia; /* PCnet bit to use software selection of a port */ int sc_initmodemedia; diff --git a/sys/dev/ic/lemac.c b/sys/dev/ic/lemac.c index d82155d8975..c00af6637ab 100644 --- a/sys/dev/ic/lemac.c +++ b/sys/dev/ic/lemac.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lemac.c,v 1.20 2015/06/24 09:40:54 mpi Exp $ */ +/* $OpenBSD: lemac.c,v 1.21 2015/09/11 13:02:28 stsp Exp $ */ /* $NetBSD: lemac.c,v 1.20 2001/06/13 10:46:02 wiz Exp $ */ /*- @@ -1006,7 +1006,7 @@ lemac_ifattach(struct lemac_softc *sc) | IFF_MULTICAST; if (sc->sc_flags & LEMAC_ALIVE) { - int media; + uint64_t media; IFQ_SET_READY(&ifp->if_snd); diff --git a/sys/dev/ic/rtl80x9.c b/sys/dev/ic/rtl80x9.c index 9cded86e920..91b297fd26a 100644 --- a/sys/dev/ic/rtl80x9.c +++ b/sys/dev/ic/rtl80x9.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtl80x9.c,v 1.10 2015/03/14 03:38:47 jsg Exp $ */ +/* $OpenBSD: rtl80x9.c,v 1.11 2015/09/11 13:02:28 stsp Exp $ */ /* $NetBSD: rtl80x9.c,v 1.1 1998/10/31 00:44:33 thorpej Exp $ */ /*- @@ -159,7 +159,7 @@ void rtl80x9_media_init(sc) struct dp8390_softc *sc; { - static int rtl80x9_media[] = { + static uint64_t rtl80x9_media[] = { IFM_ETHER|IFM_AUTO, IFM_ETHER|IFM_10_T, IFM_ETHER|IFM_10_T|IFM_FDX, @@ -168,7 +168,8 @@ rtl80x9_media_init(sc) static const int rtl80x9_nmedia = sizeof(rtl80x9_media) / sizeof(rtl80x9_media[0]); - int i, defmedia; + int i; + uint64_t defmedia; u_int8_t conf2, conf3; /* Set NIC to page 3 registers. */ diff --git a/sys/dev/ic/smc83c170.c b/sys/dev/ic/smc83c170.c index e6258492ddc..bbad3733a72 100644 --- a/sys/dev/ic/smc83c170.c +++ b/sys/dev/ic/smc83c170.c @@ -1,4 +1,4 @@ -/* $OpenBSD: smc83c170.c,v 1.21 2015/06/24 09:40:54 mpi Exp $ */ +/* $OpenBSD: smc83c170.c,v 1.22 2015/09/11 13:02:28 stsp Exp $ */ /* $NetBSD: smc83c170.c,v 1.59 2005/02/27 00:27:02 perry Exp $ */ /*- @@ -1412,7 +1412,7 @@ epic_mediachange(struct ifnet *ifp) struct epic_softc *sc = ifp->if_softc; struct mii_data *mii = &sc->sc_mii; struct ifmedia *ifm = &mii->mii_media; - int media = ifm->ifm_cur->ifm_media; + uint64_t media = ifm->ifm_cur->ifm_media; u_int32_t miicfg; struct mii_softc *miisc; int cfg; diff --git a/sys/dev/ic/smc83c170var.h b/sys/dev/ic/smc83c170var.h index bd59a495c2e..af8eb5b90b1 100644 --- a/sys/dev/ic/smc83c170var.h +++ b/sys/dev/ic/smc83c170var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: smc83c170var.h,v 1.3 2009/08/10 20:29:54 deraadt Exp $ */ +/* $OpenBSD: smc83c170var.h,v 1.4 2015/09/11 13:02:28 stsp Exp $ */ /* $NetBSD: smc83c170var.h,v 1.9 2005/02/04 02:10:37 perry Exp $ */ /*- @@ -130,7 +130,7 @@ struct epic_softc { int sc_rxptr; /* next ready RX descriptor */ - u_int sc_serinst; /* ifmedia instance for serial mode */ + uint64_t sc_serinst; /* ifmedia instance for serial mode */ }; #define EPIC_CDTXADDR(sc, x) ((sc)->sc_cddma + EPIC_CDTXOFF((x))) diff --git a/sys/dev/ic/smc91cxx.c b/sys/dev/ic/smc91cxx.c index d3abd0d7fde..9fcebee9026 100644 --- a/sys/dev/ic/smc91cxx.c +++ b/sys/dev/ic/smc91cxx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: smc91cxx.c,v 1.40 2015/06/24 09:40:54 mpi Exp $ */ +/* $OpenBSD: smc91cxx.c,v 1.41 2015/09/11 13:02:28 stsp Exp $ */ /* $NetBSD: smc91cxx.c,v 1.11 1998/08/08 23:51:41 mycroft Exp $ */ /*- @@ -135,7 +135,7 @@ const char *smc91cxx_idstrs[] = { }; /* Supported media types. */ -const int smc91cxx_media[] = { +const uint64_t smc91cxx_media[] = { IFM_ETHER|IFM_10_T, IFM_ETHER|IFM_10_5, }; @@ -172,7 +172,7 @@ void smc91cxx_tick(void *); int smc91cxx_mediachange(struct ifnet *); void smc91cxx_mediastatus(struct ifnet *, struct ifmediareq *); -int smc91cxx_set_media(struct smc91cxx_softc *, int); +int smc91cxx_set_media(struct smc91cxx_softc *, uint64_t); void smc91cxx_read(struct smc91cxx_softc *); void smc91cxx_reset(struct smc91cxx_softc *); @@ -330,7 +330,7 @@ smc91cxx_mediachange(ifp) int smc91cxx_set_media(sc, media) struct smc91cxx_softc *sc; - int media; + uint64_t media; { bus_space_tag_t bst = sc->sc_bst; bus_space_handle_t bsh = sc->sc_bsh; diff --git a/sys/dev/ic/xl.c b/sys/dev/ic/xl.c index a0af31e0ba3..c36fcd6717c 100644 --- a/sys/dev/ic/xl.c +++ b/sys/dev/ic/xl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: xl.c,v 1.125 2015/06/24 09:40:54 mpi Exp $ */ +/* $OpenBSD: xl.c,v 1.126 2015/09/11 13:02:28 stsp Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -166,7 +166,7 @@ int xl_mii_readreg(struct xl_softc *, struct xl_mii_frame *); int xl_mii_writereg(struct xl_softc *, struct xl_mii_frame *); void xl_setcfg(struct xl_softc *); -void xl_setmode(struct xl_softc *, int); +void xl_setmode(struct xl_softc *, uint64_t); void xl_iff(struct xl_softc *); void xl_iff_90x(struct xl_softc *); void xl_iff_905b(struct xl_softc *); @@ -676,7 +676,7 @@ xl_setcfg(struct xl_softc *sc) } void -xl_setmode(struct xl_softc *sc, int media) +xl_setmode(struct xl_softc *sc, uint64_t media) { struct ifnet *ifp = &sc->sc_arpcom.ac_if; u_int32_t icfg; @@ -2349,7 +2349,8 @@ xl_attach(struct xl_softc *sc) u_int8_t enaddr[ETHER_ADDR_LEN]; u_int16_t xcvr[2]; struct ifnet *ifp = &sc->sc_arpcom.ac_if; - int i, media = IFM_ETHER|IFM_100_TX|IFM_FDX; + int i; + uint64_t media = IFM_ETHER|IFM_100_TX|IFM_FDX; struct ifmedia *ifm; i = splnet(); diff --git a/sys/dev/isa/if_ec.c b/sys/dev/isa/if_ec.c index 8b85b9167ac..fc16aab3b0e 100644 --- a/sys/dev/isa/if_ec.c +++ b/sys/dev/isa/if_ec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ec.c,v 1.13 2014/08/11 12:45:45 mpi Exp $ */ +/* $OpenBSD: if_ec.c,v 1.14 2015/09/11 13:02:28 stsp Exp $ */ /* $NetBSD: if_ec.c,v 1.9 1998/07/05 06:49:12 jonathan Exp $ */ /*- @@ -98,7 +98,7 @@ struct cfattach ec_ca = { sizeof(struct ec_softc), ec_probe, ec_attach }; -int ec_set_media(struct ec_softc *, int); +int ec_set_media(struct ec_softc *, uint64_t); void ec_media_init(struct dp8390_softc *); @@ -739,7 +739,7 @@ ec_init_card(struct dp8390_softc *sc) } int -ec_set_media(struct ec_softc *esc, int media) +ec_set_media(struct ec_softc *esc, uint64_t media) { u_int8_t new; diff --git a/sys/dev/isa/if_ex.c b/sys/dev/isa/if_ex.c index 7f1f7c4091f..9ad0cec6bf0 100644 --- a/sys/dev/isa/if_ex.c +++ b/sys/dev/isa/if_ex.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ex.c,v 1.39 2015/06/24 09:40:54 mpi Exp $ */ +/* $OpenBSD: if_ex.c,v 1.40 2015/09/11 13:02:28 stsp Exp $ */ /* * Copyright (c) 1997, Donald A. Schmidt * Copyright (c) 1996, Javier Martín Rueda (jmrueda@diatel.upm.es) @@ -109,7 +109,7 @@ int ex_ioctl(struct ifnet *, u_long, caddr_t); void ex_setmulti(struct ex_softc *); void ex_reset(struct ex_softc *); void ex_watchdog(struct ifnet *); -int ex_get_media(struct ex_softc *); +uint64_t ex_get_media(struct ex_softc *); int ex_ifmedia_upd(struct ifnet *); void ex_ifmedia_sts(struct ifnet *, struct ifmediareq *); @@ -900,7 +900,7 @@ ex_watchdog(struct ifnet *ifp) DODEBUG(Start_End, printf("ex_watchdog: finish\n");); } -int +uint64_t ex_get_media(struct ex_softc *sc) { int current, media; diff --git a/sys/dev/isa/if_we.c b/sys/dev/isa/if_we.c index d48f49fb271..5c0f34ca0f5 100644 --- a/sys/dev/isa/if_we.c +++ b/sys/dev/isa/if_we.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_we.c,v 1.23 2014/08/11 12:45:45 mpi Exp $ */ +/* $OpenBSD: if_we.c,v 1.24 2015/09/11 13:02:28 stsp Exp $ */ /* $NetBSD: if_we.c,v 1.11 1998/07/05 06:49:14 jonathan Exp $ */ /*- @@ -747,7 +747,7 @@ void we_media_init(struct dp8390_softc *sc) { struct we_softc *wsc = (void *)sc; - int defmedia = IFM_ETHER; + uint64_t defmedia = IFM_ETHER; u_int8_t x; if (sc->is790) { diff --git a/sys/dev/mii/mii_physubr.c b/sys/dev/mii/mii_physubr.c index 368112fd717..5258c66e143 100644 --- a/sys/dev/mii/mii_physubr.c +++ b/sys/dev/mii/mii_physubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mii_physubr.c,v 1.44 2014/12/05 15:50:04 mpi Exp $ */ +/* $OpenBSD: mii_physubr.c,v 1.45 2015/09/11 13:02:28 stsp Exp $ */ /* $NetBSD: mii_physubr.c,v 1.20 2001/04/13 23:30:09 thorpej Exp $ */ /*- @@ -509,7 +509,7 @@ mii_phy_match(const struct mii_attach_args *ma, const struct mii_phydesc *mpd) /* * Return the flow control status flag from MII_ANAR & MII_ANLPAR. */ -int +uint64_t mii_phy_flowstatus(struct mii_softc *sc) { int anar, anlpar; @@ -561,7 +561,7 @@ mii_phy_flowstatus(struct mii_softc *sc) * Given an ifmedia word, return the corresponding ANAR value. */ int -mii_anar(int media) +mii_anar(uint64_t media) { int rv; diff --git a/sys/dev/mii/miivar.h b/sys/dev/mii/miivar.h index 6a3c5139355..1b86aabb7c9 100644 --- a/sys/dev/mii/miivar.h +++ b/sys/dev/mii/miivar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: miivar.h,v 1.32 2013/12/28 03:30:41 deraadt Exp $ */ +/* $OpenBSD: miivar.h,v 1.33 2015/09/11 13:02:28 stsp Exp $ */ /* $NetBSD: miivar.h,v 1.17 2000/03/06 20:56:57 thorpej Exp $ */ /*- @@ -70,13 +70,13 @@ struct mii_data { * request is made. */ LIST_HEAD(mii_listhead, mii_softc) mii_phys; - int mii_instance; + uint64_t mii_instance; /* * PHY driver fills this in with active media status. */ - int mii_media_status; - int mii_media_active; + uint64_t mii_media_status; + uint64_t mii_media_active; /* * Calls from MII layer into network interface driver. @@ -116,7 +116,7 @@ struct mii_softc { int mii_model; /* MII_MODEL(ma->mii_id2) */ int mii_rev; /* MII_REV(ma->mii_id2) */ int mii_offset; /* first PHY, second PHY, etc. */ - int mii_inst; /* instance for ifmedia */ + uint64_t mii_inst; /* instance for ifmedia */ /* Our PHY functions. */ const struct mii_phy_funcs *mii_funcs; @@ -240,7 +240,7 @@ int mii_mediachg(struct mii_data *); void mii_tick(struct mii_data *); void mii_pollstat(struct mii_data *); void mii_down(struct mii_data *); -int mii_anar(int); +int mii_anar(uint64_t); int mii_phy_detach(struct device *, int); @@ -261,7 +261,7 @@ void mii_phy_status(struct mii_softc *); void mii_phy_update(struct mii_softc *, int); int mii_phy_statusmsg(struct mii_softc *); -int mii_phy_flowstatus(struct mii_softc *); +uint64_t mii_phy_flowstatus(struct mii_softc *); void ukphy_status(struct mii_softc *); diff --git a/sys/dev/pci/if_alc.c b/sys/dev/pci/if_alc.c index 1fe1d168780..86c40021e69 100644 --- a/sys/dev/pci/if_alc.c +++ b/sys/dev/pci/if_alc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_alc.c,v 1.33 2015/06/24 09:40:54 mpi Exp $ */ +/* $OpenBSD: if_alc.c,v 1.34 2015/09/11 13:02:28 stsp Exp $ */ /*- * Copyright (c) 2009, Pyun YongHyeon <yongari@FreeBSD.org> * All rights reserved. @@ -79,7 +79,7 @@ void alc_watchdog(struct ifnet *); int alc_mediachange(struct ifnet *); void alc_mediastatus(struct ifnet *, struct ifmediareq *); -void alc_aspm(struct alc_softc *, int); +void alc_aspm(struct alc_softc *, uint64_t); void alc_disable_l0s_l1(struct alc_softc *); int alc_dma_alloc(struct alc_softc *); void alc_dma_free(struct alc_softc *); @@ -550,7 +550,7 @@ alc_phy_down(struct alc_softc *sc) } void -alc_aspm(struct alc_softc *sc, int media) +alc_aspm(struct alc_softc *sc, uint64_t media) { uint32_t pmcfg; uint16_t linkcfg; diff --git a/sys/dev/pci/if_bgereg.h b/sys/dev/pci/if_bgereg.h index 86ec5842efe..6d8f9ab41df 100644 --- a/sys/dev/pci/if_bgereg.h +++ b/sys/dev/pci/if_bgereg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bgereg.h,v 1.126 2014/09/02 10:14:55 brad Exp $ */ +/* $OpenBSD: if_bgereg.h,v 1.127 2015/09/11 13:02:28 stsp Exp $ */ /* * Copyright (c) 2001 Wind River Systems @@ -2930,7 +2930,7 @@ struct bge_softc { #define BGE_STS_BIT(sc, x) ((sc)->bge_sts & (x)) #define BGE_STS_SETBIT(sc, x) ((sc)->bge_sts |= (x)) #define BGE_STS_CLRBIT(sc, x) ((sc)->bge_sts &= ~(x)) - int bge_flowflags; + uint64_t bge_flowflags; int bge_txcnt; struct timeout bge_timeout; struct timeout bge_rxtimeout; diff --git a/sys/dev/pci/if_bnxreg.h b/sys/dev/pci/if_bnxreg.h index 427c503f51c..29873b2d70e 100644 --- a/sys/dev/pci/if_bnxreg.h +++ b/sys/dev/pci/if_bnxreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bnxreg.h,v 1.45 2014/12/26 05:46:32 tedu Exp $ */ +/* $OpenBSD: if_bnxreg.h,v 1.46 2015/09/11 13:02:28 stsp Exp $ */ /*- * Copyright (c) 2006 Broadcom Corporation @@ -4799,7 +4799,7 @@ struct bnx_softc { u_int32_t bnx_shared_hw_cfg; u_int32_t bnx_port_hw_cfg; - int bnx_flowflags; + uint64_t bnx_flowflags; u_int16_t bus_speed_mhz; /* PCI bus speed */ struct flash_spec *bnx_flash_info; /* Flash NVRAM settings */ diff --git a/sys/dev/pci/if_cas.c b/sys/dev/pci/if_cas.c index 83d532514af..68afd1f3e47 100644 --- a/sys/dev/pci/if_cas.c +++ b/sys/dev/pci/if_cas.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_cas.c,v 1.41 2015/06/24 09:40:54 mpi Exp $ */ +/* $OpenBSD: if_cas.c,v 1.42 2015/09/11 13:02:28 stsp Exp $ */ /* * @@ -560,7 +560,7 @@ cas_config(struct cas_softc *sc) */ if (child->mii_phy > 1 || child->mii_inst > 1) { printf("%s: cannot accommodate MII device %s" - " at phy %d, instance %d\n", + " at phy %d, instance %lld\n", sc->sc_dev.dv_xname, child->mii_dev.dv_xname, child->mii_phy, child->mii_inst); @@ -1489,7 +1489,7 @@ cas_mii_statchg(struct device *dev) { struct cas_softc *sc = (void *)dev; #ifdef CAS_DEBUG - int instance = IFM_INST(sc->sc_mii.mii_media.ifm_cur->ifm_media); + uint64_t instance = IFM_INST(sc->sc_mii.mii_media.ifm_cur->ifm_media); #endif bus_space_tag_t t = sc->sc_memt; bus_space_handle_t mac = sc->sc_memh; diff --git a/sys/dev/pci/if_devar.h b/sys/dev/pci/if_devar.h index e6c150cbbf6..267ea2d3822 100644 --- a/sys/dev/pci/if_devar.h +++ b/sys/dev/pci/if_devar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_devar.h,v 1.35 2015/06/26 11:50:39 kettenis Exp $ */ +/* $OpenBSD: if_devar.h,v 1.36 2015/09/11 13:02:28 stsp Exp $ */ /* $NetBSD: if_devar.h,v 1.13 1997/06/08 18:46:36 thorpej Exp $ */ /*- @@ -644,7 +644,7 @@ static const char * const tulip_mediums[] = { }; #endif -static const int tulip_media_to_ifmedia[] = { +static const uint64_t tulip_media_to_ifmedia[] = { IFM_ETHER | IFM_NONE, /* TULIP_MEDIA_UNKNOWN */ IFM_ETHER | IFM_10_T, /* TULIP_MEDIA_10BASET */ IFM_ETHER | IFM_10_T | IFM_FDX, /* TULIP_MEDIA_10BASET_FD */ diff --git a/sys/dev/pci/if_em.c b/sys/dev/pci/if_em.c index f0dc3fa777f..d6e721fd2f0 100644 --- a/sys/dev/pci/if_em.c +++ b/sys/dev/pci/if_em.c @@ -31,7 +31,7 @@ POSSIBILITY OF SUCH DAMAGE. ***************************************************************************/ -/* $OpenBSD: if_em.c,v 1.303 2015/09/01 09:48:50 mpi Exp $ */ +/* $OpenBSD: if_em.c,v 1.304 2015/09/11 13:02:28 stsp Exp $ */ /* $FreeBSD: if_em.c,v 1.46 2004/09/29 18:28:28 mlaier Exp $ */ #include <dev/pci/if_em.h> @@ -209,7 +209,7 @@ void em_init(void *); void em_stop(void *, int); void em_media_status(struct ifnet *, struct ifmediareq *); int em_media_change(struct ifnet *); -int em_flowstatus(struct em_softc *); +uint64_t em_flowstatus(struct em_softc *); void em_identify_hardware(struct em_softc *); int em_allocate_pci_resources(struct em_softc *); void em_free_pci_resources(struct em_softc *); @@ -958,7 +958,7 @@ void em_media_status(struct ifnet *ifp, struct ifmediareq *ifmr) { struct em_softc *sc = ifp->if_softc; - u_char fiber_type = IFM_1000_SX; + uint64_t fiber_type = IFM_1000_SX; u_int16_t gsr; INIT_DEBUGOUT("em_media_status: begin"); @@ -1068,7 +1068,7 @@ em_media_change(struct ifnet *ifp) return (0); } -int +uint64_t em_flowstatus(struct em_softc *sc) { u_int16_t ar, lpar; @@ -1870,7 +1870,7 @@ void em_setup_interface(struct em_softc *sc) { struct ifnet *ifp; - u_char fiber_type = IFM_1000_SX; + uint64_t fiber_type = IFM_1000_SX; INIT_DEBUGOUT("em_setup_interface: begin"); diff --git a/sys/dev/pci/if_ix.h b/sys/dev/pci/if_ix.h index b97115ad6bb..59477252920 100644 --- a/sys/dev/pci/if_ix.h +++ b/sys/dev/pci/if_ix.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ix.h,v 1.28 2015/09/11 12:09:10 claudio Exp $ */ +/* $OpenBSD: if_ix.h,v 1.29 2015/09/11 13:02:28 stsp Exp $ */ /****************************************************************************** @@ -246,7 +246,7 @@ struct ix_softc { uint32_t shadow_vfta[IXGBE_VFTA_SIZE]; /* Info about the interface */ - uint optics; + uint64_t optics; uint32_t fc; /* local flow ctrl setting */ int advertise; /* link speeds */ uint16_t max_frame_size; diff --git a/sys/dev/pci/if_oce.c b/sys/dev/pci/if_oce.c index 3da3b451c66..4bf67e5e1bb 100644 --- a/sys/dev/pci/if_oce.c +++ b/sys/dev/pci/if_oce.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_oce.c,v 1.85 2015/06/29 18:58:04 mikeb Exp $ */ +/* $OpenBSD: if_oce.c,v 1.86 2015/09/11 13:02:28 stsp Exp $ */ /* * Copyright (c) 2012 Mike Belopuhov @@ -322,7 +322,7 @@ struct oce_softc { struct ifmedia sc_media; ushort sc_link_up; ushort sc_link_speed; - uint sc_fc; + uint64_t sc_fc; struct oce_dma_mem sc_mbx; struct oce_dma_mem sc_pld; @@ -472,7 +472,7 @@ int oce_check_native_mode(struct oce_softc *); int oce_create_iface(struct oce_softc *, uint8_t *macaddr); int oce_config_vlan(struct oce_softc *, struct normal_vlan *vtags, int nvtags, int untagged, int promisc); -int oce_set_flow_control(struct oce_softc *, uint flags); +int oce_set_flow_control(struct oce_softc *, uint64_t); int oce_config_rss(struct oce_softc *, int enable); int oce_update_mcast(struct oce_softc *, uint8_t multi[][ETHER_ADDR_LEN], int naddr); @@ -3032,7 +3032,7 @@ oce_config_vlan(struct oce_softc *sc, struct normal_vlan *vtags, int nvtags, * @returns 0 on success, EIO on failure */ int -oce_set_flow_control(struct oce_softc *sc, uint flags) +oce_set_flow_control(struct oce_softc *sc, uint64_t flags) { struct mbx_common_get_set_flow_control cmd; int err; diff --git a/sys/dev/pci/if_vge.c b/sys/dev/pci/if_vge.c index f5fab40cc94..9307bea7e67 100644 --- a/sys/dev/pci/if_vge.c +++ b/sys/dev/pci/if_vge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_vge.c,v 1.63 2015/06/24 09:40:54 mpi Exp $ */ +/* $OpenBSD: if_vge.c,v 1.64 2015/09/11 13:02:28 stsp Exp $ */ /* $FreeBSD: if_vge.c,v 1.3 2004/09/11 22:13:25 wpaul Exp $ */ /* * Copyright (c) 2004 @@ -1739,7 +1739,7 @@ vge_miibus_statchg(struct device *dev) } break; default: - printf("%s: unknown media type: %x\n", + printf("%s: unknown media type: %llx\n", sc->vge_dev.dv_xname, IFM_SUBTYPE(ife->ifm_media)); break; } diff --git a/sys/dev/pci/if_wb.c b/sys/dev/pci/if_wb.c index 41e7ec3c9f4..7a3fcb0dca9 100644 --- a/sys/dev/pci/if_wb.c +++ b/sys/dev/pci/if_wb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_wb.c,v 1.61 2015/06/24 09:40:54 mpi Exp $ */ +/* $OpenBSD: if_wb.c,v 1.62 2015/09/11 13:02:28 stsp Exp $ */ /* * Copyright (c) 1997, 1998 @@ -155,7 +155,7 @@ void wb_mii_send(struct wb_softc *, u_int32_t, int); int wb_mii_readreg(struct wb_softc *, struct wb_mii_frame *); int wb_mii_writereg(struct wb_softc *, struct wb_mii_frame *); -void wb_setcfg(struct wb_softc *, u_int32_t); +void wb_setcfg(struct wb_softc *, uint64_t); u_int8_t wb_calchash(caddr_t); void wb_setmulti(struct wb_softc *); void wb_reset(struct wb_softc *); @@ -580,7 +580,7 @@ void wb_setmulti(sc) void wb_setcfg(sc, media) struct wb_softc *sc; - u_int32_t media; + uint64_t media; { int i, restart = 0; @@ -654,7 +654,7 @@ wb_fixmedia(sc) struct wb_softc *sc; { struct mii_data *mii = &sc->sc_mii; - u_int32_t media; + uint64_t media; if (LIST_FIRST(&mii->mii_phys) == NULL) return; diff --git a/sys/dev/sbus/be.c b/sys/dev/sbus/be.c index 3bfd201531d..1d9572e96e6 100644 --- a/sys/dev/sbus/be.c +++ b/sys/dev/sbus/be.c @@ -1,4 +1,4 @@ -/* $OpenBSD: be.c,v 1.32 2015/07/08 07:21:50 mpi Exp $ */ +/* $OpenBSD: be.c,v 1.33 2015/09/11 13:02:28 stsp Exp $ */ /* $NetBSD: be.c,v 1.26 2001/03/20 15:39:20 pk Exp $ */ /*- @@ -210,7 +210,7 @@ beattach(struct device *parent, struct device *self, void *aux) bus_dma_tag_t dmatag = sa->sa_dmatag; bus_dma_segment_t seg; bus_size_t size; - int instance; + uint64_t instance; int rseg, error; u_int32_t v; extern void myetheraddr(u_char *); @@ -371,7 +371,7 @@ beattach(struct device *parent, struct device *self, void *aux) if (child->mii_phy != BE_PHY_EXTERNAL || child->mii_inst > 0) { printf("%s: cannot accommodate MII device %s" - " at phy %d, instance %d\n", + " at phy %d, instance %lld\n", sc->sc_dev.dv_xname, child->mii_dev.dv_xname, child->mii_phy, child->mii_inst); @@ -1335,13 +1335,13 @@ be_mii_statchg(struct device *self) struct be_softc *sc = (struct be_softc *)self; bus_space_tag_t t = sc->sc_bustag; bus_space_handle_t br = sc->sc_br; - u_int instance; + u_int64_t instance; u_int32_t v; instance = IFM_INST(sc->sc_mii.mii_media.ifm_cur->ifm_media); #ifdef DIAGNOSTIC if (instance > 1) - panic("be_mii_statchg: instance %d out of range", instance); + panic("be_mii_statchg: instance %lld out of range", instance); #endif /* Update duplex mode in TX configuration */ @@ -1550,7 +1550,7 @@ void be_intphy_status(struct be_softc *sc) { struct mii_data *mii = &sc->sc_mii; - int media_active, media_status; + uint64_t media_active, media_status; int bmcr, bmsr; media_status = IFM_AVALID; @@ -1580,7 +1580,7 @@ be_intphy_status(struct be_softc *sc) bmsr = be_mii_readreg((struct device *)sc, BE_PHY_INTERNAL, MII_BMSR)| be_mii_readreg((struct device *)sc, BE_PHY_INTERNAL, MII_BMSR); if (bmsr & BMSR_LINK) - media_status |= IFM_ACTIVE; + media_status |= IFM_ACTIVE; mii->mii_media_status = media_status; mii->mii_media_active = media_active; diff --git a/sys/dev/sbus/if_le.c b/sys/dev/sbus/if_le.c index 5053db7f0f3..a6ba3a4b557 100644 --- a/sys/dev/sbus/if_le.c +++ b/sys/dev/sbus/if_le.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_le.c,v 1.16 2014/12/22 02:28:52 tedu Exp $ */ +/* $OpenBSD: if_le.c,v 1.17 2015/09/11 13:02:28 stsp Exp $ */ /* $NetBSD: if_le.c,v 1.17 2001/05/30 11:46:35 mrg Exp $ */ /*- @@ -81,7 +81,7 @@ void leattach_sbus(struct device *, struct device *, void *); /* * Media types supported. */ -static int lemedia[] = { +static uint64_t lemedia[] = { IFM_ETHER | IFM_10_5 }; diff --git a/sys/dev/sbus/if_le_lebuffer.c b/sys/dev/sbus/if_le_lebuffer.c index b899138024b..5900e3e6d08 100644 --- a/sys/dev/sbus/if_le_lebuffer.c +++ b/sys/dev/sbus/if_le_lebuffer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_le_lebuffer.c,v 1.12 2014/12/22 02:28:52 tedu Exp $ */ +/* $OpenBSD: if_le_lebuffer.c,v 1.13 2015/09/11 13:02:28 stsp Exp $ */ /* $NetBSD: if_le_lebuffer.c,v 1.10 2002/03/11 16:00:56 pk Exp $ */ /*- @@ -79,7 +79,7 @@ void leattach_lebuffer(struct device *, struct device *, void *); /* * Media types supported. */ -static int lemedia[] = { +static uint64_t lemedia[] = { IFM_ETHER | IFM_10_T }; diff --git a/sys/dev/sbus/if_le_ledma.c b/sys/dev/sbus/if_le_ledma.c index 7c0c640fcac..62d2703eb3e 100644 --- a/sys/dev/sbus/if_le_ledma.c +++ b/sys/dev/sbus/if_le_ledma.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_le_ledma.c,v 1.18 2014/12/22 02:28:52 tedu Exp $ */ +/* $OpenBSD: if_le_ledma.c,v 1.19 2015/09/11 13:02:28 stsp Exp $ */ /* $NetBSD: if_le_ledma.c,v 1.14 2001/05/30 11:46:35 mrg Exp $ */ /*- @@ -85,7 +85,7 @@ void leattach_ledma(struct device *, struct device *, void *); /* * Media types supported by the Sun4m. */ -static int lemedia[] = { +static uint64_t lemedia[] = { IFM_ETHER | IFM_10_T, IFM_ETHER | IFM_10_5, IFM_ETHER | IFM_AUTO diff --git a/sys/dev/sbus/qe.c b/sys/dev/sbus/qe.c index a6e375927b7..45426eb421e 100644 --- a/sys/dev/sbus/qe.c +++ b/sys/dev/sbus/qe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: qe.c,v 1.30 2015/07/08 07:21:50 mpi Exp $ */ +/* $OpenBSD: qe.c,v 1.31 2015/09/11 13:02:28 stsp Exp $ */ /* $NetBSD: qe.c,v 1.16 2001/03/30 17:30:18 christos Exp $ */ /*- @@ -1156,7 +1156,7 @@ qe_ifmedia_upd(ifp) struct ifnet *ifp; { struct qe_softc *sc = ifp->if_softc; - int media = sc->sc_ifmedia.ifm_media; + uint64_t media = sc->sc_ifmedia.ifm_media; if (IFM_TYPE(media) != IFM_ETHER) return (EINVAL); diff --git a/sys/net/if.h b/sys/net/if.h index 741ec2be537..b9749b72abc 100644 --- a/sys/net/if.h +++ b/sys/net/if.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if.h,v 1.166 2015/09/09 16:01:10 dlg Exp $ */ +/* $OpenBSD: if.h,v 1.167 2015/09/11 13:02:28 stsp Exp $ */ /* $NetBSD: if.h,v 1.23 1996/05/07 02:40:27 thorpej Exp $ */ /* @@ -348,12 +348,13 @@ struct ifgroupreq { struct ifreq { char ifr_name[IFNAMSIZ]; /* if name, e.g. "en0" */ union { - struct sockaddr ifru_addr; - struct sockaddr ifru_dstaddr; - struct sockaddr ifru_broadaddr; - short ifru_flags; - int ifru_metric; - caddr_t ifru_data; + struct sockaddr ifru_addr; + struct sockaddr ifru_dstaddr; + struct sockaddr ifru_broadaddr; + short ifru_flags; + int ifru_metric; + uint64_t ifru_media; + caddr_t ifru_data; } ifr_ifru; #define ifr_addr ifr_ifru.ifru_addr /* address */ #define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-to-p link */ @@ -362,7 +363,7 @@ struct ifreq { #define ifr_metric ifr_ifru.ifru_metric /* metric */ #define ifr_mtu ifr_ifru.ifru_metric /* mtu (overload) */ #define ifr_hardmtu ifr_ifru.ifru_metric /* hardmtu (overload) */ -#define ifr_media ifr_ifru.ifru_metric /* media options (overload) */ +#define ifr_media ifr_ifru.ifru_media /* media options */ #define ifr_rdomainid ifr_ifru.ifru_metric /* VRF instance (overload) */ #define ifr_vnetid ifr_ifru.ifru_metric /* Virtual Net Id (overload) */ #define ifr_ttl ifr_ifru.ifru_metric /* tunnel TTL (overload) */ @@ -384,14 +385,14 @@ struct ifaliasreq { }; struct ifmediareq { - char ifm_name[IFNAMSIZ]; /* if name, e.g. "en0" */ - int ifm_current; /* current media options */ - int ifm_mask; /* don't care mask */ - int ifm_status; /* media status */ - int ifm_active; /* active options */ - int ifm_count; /* # entries in ifm_ulist - array */ - int *ifm_ulist; /* media words */ + char ifm_name[IFNAMSIZ]; /* if name, e.g. "en0" */ + uint64_t ifm_current; /* get/set current media options */ + uint64_t ifm_mask; /* don't care mask */ + uint64_t ifm_status; /* media status */ + uint64_t ifm_active; /* active options */ + int ifm_count; /* # entries in ifm_ulist + array */ + uint64_t *ifm_ulist; /* media words */ }; struct ifkalivereq { diff --git a/sys/net/if_media.c b/sys/net/if_media.c index 6663ee58c6c..8e683b94423 100644 --- a/sys/net/if_media.c +++ b/sys/net/if_media.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_media.c,v 1.26 2015/03/14 03:38:51 jsg Exp $ */ +/* $OpenBSD: if_media.c,v 1.27 2015/09/11 13:02:28 stsp Exp $ */ /* $NetBSD: if_media.c,v 1.10 2000/03/13 23:52:39 soren Exp $ */ /*- @@ -96,14 +96,14 @@ #ifdef IFMEDIA_DEBUG int ifmedia_debug = 0; -static void ifmedia_printword(int); +static void ifmedia_printword(uint64_t); #endif /* * Initialize if_media struct for a specific interface instance. */ void -ifmedia_init(struct ifmedia *ifm, int dontcare_mask, +ifmedia_init(struct ifmedia *ifm, uint64_t dontcare_mask, ifm_change_cb_t change_callback, ifm_stat_cb_t status_callback) { TAILQ_INIT(&ifm->ifm_list); @@ -119,7 +119,7 @@ ifmedia_init(struct ifmedia *ifm, int dontcare_mask, * for a specific interface instance. */ void -ifmedia_add(struct ifmedia *ifm, int mword, int data, void *aux) +ifmedia_add(struct ifmedia *ifm, uint64_t mword, int data, void *aux) { struct ifmedia_entry *entry; @@ -167,7 +167,7 @@ ifmedia_list_add(struct ifmedia *ifm, struct ifmedia_entry *lp, int count) * media-change callback. */ void -ifmedia_set(struct ifmedia *ifm, int target) +ifmedia_set(struct ifmedia *ifm, uint64_t target) { struct ifmedia_entry *match; @@ -188,7 +188,7 @@ ifmedia_set(struct ifmedia *ifm, int target) * In either case, it makes sense to select no media. */ if (match == NULL) { - printf("ifmedia_set: no match for 0x%x/0x%x\n", + printf("ifmedia_set: no match for 0x%llx/0x%llx\n", target, ~ifm->ifm_mask); target = (target & IFM_NMASK) | IFM_NONE; match = ifmedia_match(ifm, target, ifm->ifm_mask); @@ -219,7 +219,6 @@ ifmedia_ioctl(struct ifnet *ifp, struct ifreq *ifr, struct ifmedia *ifm, u_long cmd) { struct ifmedia_entry *match; - struct ifmediareq *ifmr = (struct ifmediareq *) ifr; int error = 0; if (ifp == NULL || ifr == NULL || ifm == NULL) @@ -230,11 +229,11 @@ ifmedia_ioctl(struct ifnet *ifp, struct ifreq *ifr, struct ifmedia *ifm, /* * Set the current media. */ - case SIOCSIFMEDIA: + case SIOCSIFMEDIA: { struct ifmedia_entry *oldentry; - u_int oldmedia; - u_int newmedia = ifr->ifr_media; + uint64_t oldmedia; + uint64_t newmedia = ifr->ifr_media; match = ifmedia_match(ifm, newmedia, ifm->ifm_mask); if (match == NULL) { @@ -287,6 +286,7 @@ ifmedia_ioctl(struct ifnet *ifp, struct ifreq *ifr, struct ifmedia *ifm, */ case SIOCGIFMEDIA: { + struct ifmediareq *ifmr = (struct ifmediareq *) ifr; struct ifmedia_entry *ep; size_t nwords; @@ -309,11 +309,11 @@ ifmedia_ioctl(struct ifnet *ifp, struct ifreq *ifr, struct ifmedia *ifm, if (ifmr->ifm_count != 0) { size_t minwords; - int *kptr; + uint64_t *kptr; minwords = nwords > (size_t)ifmr->ifm_count ? (size_t)ifmr->ifm_count : nwords; - kptr = mallocarray(nwords, sizeof(int), M_TEMP, + kptr = mallocarray(nwords, sizeof(*kptr), M_TEMP, M_WAITOK | M_ZERO); /* * Get the media words from the interface's list. @@ -324,7 +324,7 @@ ifmedia_ioctl(struct ifnet *ifp, struct ifreq *ifr, struct ifmedia *ifm, kptr[nwords++] = ep->ifm_media; if (ep == NULL) error = copyout(kptr, ifmr->ifm_ulist, - nwords * sizeof(int)); + nwords * sizeof(*kptr)); else error = E2BIG; free(kptr, M_TEMP, 0); @@ -344,7 +344,7 @@ ifmedia_ioctl(struct ifnet *ifp, struct ifreq *ifr, struct ifmedia *ifm, * Find media entry matching a given ifm word. */ struct ifmedia_entry * -ifmedia_match(struct ifmedia *ifm, u_int target, u_int mask) +ifmedia_match(struct ifmedia *ifm, uint64_t target, uint64_t mask) { struct ifmedia_entry *match, *next; @@ -356,7 +356,7 @@ ifmedia_match(struct ifmedia *ifm, u_int target, u_int mask) if (match) { #if defined(IFMEDIA_DEBUG) || defined(DIAGNOSTIC) printf("ifmedia_match: multiple match for " - "0x%x/0x%x, selected instance %d\n", + "0x%llx/0x%llx, selected instance %lld\n", target, mask, IFM_INST(match->ifm_media)); #endif break; @@ -372,7 +372,7 @@ ifmedia_match(struct ifmedia *ifm, u_int target, u_int mask) * Delete all media for a given instance. */ void -ifmedia_delete_instance(struct ifmedia *ifm, u_int inst) +ifmedia_delete_instance(struct ifmedia *ifm, uint64_t inst) { struct ifmedia_entry *ife, *nife; @@ -392,8 +392,8 @@ ifmedia_delete_instance(struct ifmedia *ifm, u_int inst) struct ifmedia_baudrate ifmedia_baudrate_descriptions[] = IFM_BAUDRATE_DESCRIPTIONS; -u_int64_t -ifmedia_baudrate(int mword) +uint64_t +ifmedia_baudrate(uint64_t mword) { int i; @@ -422,10 +422,10 @@ struct ifmedia_description ifm_option_descriptions[] = * print a media word. */ static void -ifmedia_printword(int ifmw) +ifmedia_printword(uint64_t ifmw) { struct ifmedia_description *desc; - int seen_option = 0; + uint64_t seen_option = 0; /* Print the top-level interface type. */ for (desc = ifm_type_descriptions; desc->ifmt_string != NULL; diff --git a/sys/net/if_media.h b/sys/net/if_media.h index b4f90eab0b7..fcd86039e04 100644 --- a/sys/net/if_media.h +++ b/sys/net/if_media.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_media.h,v 1.33 2015/09/09 15:57:15 stsp Exp $ */ +/* $OpenBSD: if_media.h,v 1.34 2015/09/11 13:02:28 stsp Exp $ */ /* $NetBSD: if_media.h,v 1.22 2000/02/17 21:53:16 sommerfeld Exp $ */ /*- @@ -68,18 +68,6 @@ #ifndef _NET_IF_MEDIA_H_ #define _NET_IF_MEDIA_H_ -/* - * Prototypes and definitions for BSD/OS-compatible network interface - * media selection. - * - * Where it is safe to do so, this code strays slightly from the BSD/OS - * design. Software which uses the API (device drivers, basically) - * shouldn't notice any difference. - * - * Many thanks to Matt Thomas for providing the information necessary - * to implement this interface. - */ - #ifdef _KERNEL struct ifnet; @@ -96,7 +84,7 @@ typedef void (*ifm_stat_cb_t)(struct ifnet *, struct ifmediareq *); */ struct ifmedia_entry { TAILQ_ENTRY(ifmedia_entry) ifm_list; - u_int ifm_media; /* description of this media attachment */ + uint64_t ifm_media; /* description of this media attachment */ u_int ifm_data; /* for driver-specific use */ void *ifm_aux; /* for driver-specific use */ }; @@ -106,8 +94,8 @@ struct ifmedia_entry { * It is used to keep general media state. */ struct ifmedia { - u_int ifm_mask; /* mask of changes we don't care about */ - u_int ifm_media; /* current user-set media word */ + uint64_t ifm_mask; /* mask of changes we don't care about */ + uint64_t ifm_media; /* current user-set media word */ struct ifmedia_entry *ifm_cur; /* currently selected media */ TAILQ_HEAD(, ifmedia_entry) ifm_list; /* list of all supported media */ ifm_change_cb_t ifm_change; /* media change driver callback */ @@ -115,49 +103,49 @@ struct ifmedia { }; /* Initialize an interface's struct if_media field. */ -void ifmedia_init(struct ifmedia *, int, ifm_change_cb_t, +void ifmedia_init(struct ifmedia *, uint64_t, ifm_change_cb_t, ifm_stat_cb_t); /* Add one supported medium to a struct ifmedia. */ -void ifmedia_add(struct ifmedia *, int, int, void *); +void ifmedia_add(struct ifmedia *, uint64_t, int, void *); /* Add an array (of ifmedia_entry) media to a struct ifmedia. */ void ifmedia_list_add(struct ifmedia *, struct ifmedia_entry *, int); /* Set default media type on initialization. */ -void ifmedia_set(struct ifmedia *, int); +void ifmedia_set(struct ifmedia *, uint64_t); /* Common ioctl function for getting/setting media, called by driver. */ int ifmedia_ioctl(struct ifnet *, struct ifreq *, struct ifmedia *, u_long); /* Locate a media entry */ -struct ifmedia_entry *ifmedia_match(struct ifmedia *, u_int, u_int); +struct ifmedia_entry *ifmedia_match(struct ifmedia *, uint64_t, uint64_t); /* Delete all media for a given media instance */ -void ifmedia_delete_instance(struct ifmedia *, u_int); +void ifmedia_delete_instance(struct ifmedia *, uint64_t); /* Compute baudrate for a given media. */ -u_int64_t ifmedia_baudrate(int); +uint64_t ifmedia_baudrate(uint64_t); #endif /*_KERNEL */ /* * if_media Options word: * Bits Use * ---- ------- - * 0-4 Media subtype MAX SUBTYPE == 31! - * 5-7 Media type - * 8-15 Type specific options - * 16-19 RFU - * 20-27 Shared (global) options - * 28-31 Instance + * 0-7 Media subtype MAX SUBTYPE == 255! + * 8-15 Media type + * 16-31 Type specific options + * 32-39 Mode (for multi-mode devices) + * 40-55 Shared (global) options + * 56-63 Instance */ /* * Ethernet */ -#define IFM_ETHER 0x00000020 +#define IFM_ETHER 0x0000000000000100ULL #define IFM_10_T 3 /* 10BaseT - RJ45 */ #define IFM_10_2 4 /* 10Base2 - Thinnet */ #define IFM_10_5 5 /* 10Base5 - AUI */ @@ -181,14 +169,14 @@ u_int64_t ifmedia_baudrate(int); #define IFM_10G_T 22 /* 10GbaseT cat 6 */ #define IFM_10G_SFP_CU 23 /* 10G SFP+ direct attached cable */ -#define IFM_ETH_MASTER 0x00000100 /* master mode (1000baseT) */ -#define IFM_ETH_RXPAUSE 0x00000200 /* receive PAUSE frames */ -#define IFM_ETH_TXPAUSE 0x00000400 /* transmit PAUSE frames */ +#define IFM_ETH_MASTER 0x0000000000010000ULL /* master mode (1000baseT) */ +#define IFM_ETH_RXPAUSE 0x0000000000020000ULL /* receive PAUSE frames */ +#define IFM_ETH_TXPAUSE 0x0000000000040000ULL /* transmit PAUSE frames */ /* * FDDI */ -#define IFM_FDDI 0x00000060 +#define IFM_FDDI 0x0000000000000300ULL #define IFM_FDDI_SMF 3 /* Single-mode fiber */ #define IFM_FDDI_MMF 4 /* Multi-mode fiber */ #define IFM_FDDI_UTP 5 /* CDDI / UTP */ @@ -197,7 +185,7 @@ u_int64_t ifmedia_baudrate(int); /* * IEEE 802.11 Wireless */ -#define IFM_IEEE80211 0x00000080 +#define IFM_IEEE80211 0x0000000000000400ULL #define IFM_IEEE80211_FH1 3 /* Frequency Hopping 1Mbps */ #define IFM_IEEE80211_FH2 4 /* Frequency Hopping 2Mbps */ #define IFM_IEEE80211_DS2 5 /* Direct Sequence 2Mbps */ @@ -215,23 +203,23 @@ u_int64_t ifmedia_baudrate(int); #define IFM_IEEE80211_OFDM54 17 /* OFDM 54Mbps */ #define IFM_IEEE80211_OFDM72 18 /* OFDM 72Mbps */ -#define IFM_IEEE80211_ADHOC 0x100 /* Operate in Adhoc mode */ -#define IFM_IEEE80211_HOSTAP 0x200 /* Operate in Host AP mode */ -#define IFM_IEEE80211_IBSS 0x400 /* Operate in IBSS mode */ -#define IFM_IEEE80211_IBSSMASTER 0x800 /* Operate as an IBSS master */ -#define IFM_IEEE80211_MONITOR 0x1000 /* Operate in Monitor mode */ -#define IFM_IEEE80211_TURBO 0x2000 /* Operate in Turbo mode */ +#define IFM_IEEE80211_ADHOC 0x0000000000010000ULL /* Operate in Adhoc mode */ +#define IFM_IEEE80211_HOSTAP 0x0000000000020000ULL /* Operate in Host AP mode */ +#define IFM_IEEE80211_IBSS 0x0000000000040000ULL /* Operate in IBSS mode */ +#define IFM_IEEE80211_IBSSMASTER 0x0000000000080000ULL /* Operate as an IBSS master */ +#define IFM_IEEE80211_MONITOR 0x0000000000100000ULL /* Operate in Monitor mode */ +#define IFM_IEEE80211_TURBO 0x0000000000200000ULL /* Operate in Turbo mode */ /* operating mode for multi-mode devices */ -#define IFM_IEEE80211_11A 0x00010000 /* 5GHz, OFDM mode */ -#define IFM_IEEE80211_11B 0x00020000 /* Direct Sequence mode */ -#define IFM_IEEE80211_11G 0x00030000 /* 2GHz, CCK mode */ -#define IFM_IEEE80211_FH 0x00040000 /* 2GHz, GFSK mode */ +#define IFM_IEEE80211_11A 0x0000000100000000ULL /* 5GHz, OFDM mode */ +#define IFM_IEEE80211_11B 0x0000000200000000ULL /* Direct Sequence mode */ +#define IFM_IEEE80211_11G 0x0000000300000000ULL /* 2GHz, CCK mode */ +#define IFM_IEEE80211_FH 0x0000000400000000ULL /* 2GHz, GFSK mode */ /* * Digitally multiplexed "Carrier" Serial Interfaces */ -#define IFM_TDM 0x000000a0 +#define IFM_TDM 0x0000000000000500ULL #define IFM_TDM_T1 3 /* T1 B8ZS+ESF 24 ts */ #define IFM_TDM_T1_AMI 4 /* T1 AMI+SF 24 ts */ #define IFM_TDM_E1 5 /* E1 HDB3+G.703 clearchannel 32 ts */ @@ -256,42 +244,46 @@ u_int64_t ifmedia_baudrate(int); #define IFM_TDM_FR_ITU 0x1000 /* Frame Relay + LMI ITU "Q933A" */ /* operating mode */ -#define IFM_TDM_MASTER 0x00010000 /* aka clock source internal */ +#define IFM_TDM_MASTER 0x0000000100000000ULL /* aka clock source internal */ /* * Common Access Redundancy Protocol */ -#define IFM_CARP 0x000000c0 +#define IFM_CARP 0x0000000000000600ULL /* * Shared media sub-types */ -#define IFM_AUTO 0 /* Autoselect best media */ -#define IFM_MANUAL 1 /* Jumper/dipswitch selects media */ -#define IFM_NONE 2 /* Deselect all media */ +#define IFM_AUTO 0ULL /* Autoselect best media */ +#define IFM_MANUAL 1ULL /* Jumper/dipswitch selects media */ +#define IFM_NONE 2ULL /* Deselect all media */ /* * Shared options */ -#define IFM_FDX 0x00100000 /* Force full duplex */ -#define IFM_HDX 0x00200000 /* Force half duplex */ -#define IFM_FLOW 0x00400000 /* enable hardware flow control */ -#define IFM_FLAG0 0x01000000 /* Driver defined flag */ -#define IFM_FLAG1 0x02000000 /* Driver defined flag */ -#define IFM_FLAG2 0x04000000 /* Driver defined flag */ -#define IFM_LOOP 0x08000000 /* Put hardware in loopback */ +#define IFM_FDX 0x0000010000000000ULL /* Force full duplex */ +#define IFM_HDX 0x0000020000000000ULL /* Force half duplex */ +#define IFM_FLOW 0x0000040000000000ULL /* enable hardware flow control */ +#define IFM_FLAG0 0x0000100000000000ULL /* Driver defined flag */ +#define IFM_FLAG1 0x0000200000000000ULL /* Driver defined flag */ +#define IFM_FLAG2 0x0000400000000000ULL /* Driver defined flag */ +#define IFM_LOOP 0x0000800000000000ULL /* Put hardware in loopback */ /* * Masks */ -#define IFM_NMASK 0x000000e0 /* Network type */ -#define IFM_TMASK 0x0000001f /* Media sub-type */ -#define IFM_IMASK 0xf0000000 /* Instance */ -#define IFM_ISHIFT 28 /* Instance shift */ -#define IFM_OMASK 0x0000ff00 /* Type specific options */ -#define IFM_MMASK 0x00070000 /* Mode */ -#define IFM_MSHIFT 16 /* Mode shift */ -#define IFM_GMASK 0x0ff00000 /* Global options */ +#define IFM_NMASK 0x000000000000ff00ULL /* Network type */ +#define IFM_NSHIFT 8 /* Network type shift */ +#define IFM_TMASK 0x00000000000000ffULL /* Media sub-type */ +#define IFM_TSHIFT 0 /* Sub-type shift */ +#define IFM_IMASK 0xff00000000000000ULL /* Instance */ +#define IFM_ISHIFT 56 /* Instance shift */ +#define IFM_OMASK 0x00000000ffff0000ULL /* Type specific options */ +#define IFM_OSHIFT 16 /* Specific options shift */ +#define IFM_MMASK 0x000000ff00000000ULL /* Mode */ +#define IFM_MSHIFT 32 /* Mode shift */ +#define IFM_GMASK 0x00ffff0000000000ULL /* Global options */ +#define IFM_GSHIFT 40 /* Global options shift */ /* Ethernet flow control mask */ #define IFM_ETH_FMASK (IFM_FLOW|IFM_ETH_RXPAUSE|IFM_ETH_TXPAUSE) @@ -302,8 +294,8 @@ u_int64_t ifmedia_baudrate(int); /* * Status bits */ -#define IFM_AVALID 0x00000001 /* Active bit valid */ -#define IFM_ACTIVE 0x00000002 /* Interface attached to working net */ +#define IFM_AVALID 0x0000000000000001ULL /* Active bit valid */ +#define IFM_ACTIVE 0x0000000000000002ULL /* Interface attached to working net */ /* Mask of "status valid" bits, for ifconfig(8). */ #define IFM_STATUS_VALID IFM_AVALID @@ -324,13 +316,16 @@ u_int64_t ifmedia_baudrate(int); #define IFM_MODE(x) ((x) & IFM_MMASK) #define IFM_INST_MAX IFM_INST(IFM_IMASK) -#define IFM_INST_ANY ((u_int) -1) +#define IFM_INST_ANY ((uint64_t) -1) /* * Macro to create a media word. + * All arguments are IFM_* macros, except 'instance' which is a 64-bit integer. + * XXX 'operating mode' is not included here?!? */ #define IFM_MAKEWORD(type, subtype, options, instance) \ - ((type) | (subtype) | (options) | ((instance) << IFM_ISHIFT)) + ((type) | (subtype) | (options) | \ + ((uint64_t)(instance) << IFM_ISHIFT)) /* * NetBSD extension not defined in the BSDI API. This is used in various @@ -346,8 +341,8 @@ u_int64_t ifmedia_baudrate(int); * for a media type; subsequent matches are aliases. */ struct ifmedia_description { - int ifmt_word; /* word value; may be masked */ - const char *ifmt_string; /* description */ + uint64_t ifmt_word; /* word value; may be masked */ + const char *ifmt_string; /* description */ }; #define IFM_TYPE_DESCRIPTIONS { \ @@ -516,8 +511,8 @@ struct ifmedia_description { * Baudrate descriptions for the various media types. */ struct ifmedia_baudrate { - int ifmb_word; /* media word */ - u_int64_t ifmb_baudrate; /* corresponding baudrate */ + uint64_t ifmb_word; /* media word */ + uint64_t ifmb_baudrate; /* corresponding baudrate */ }; #define IFM_BAUDRATE_DESCRIPTIONS { \ @@ -584,9 +579,9 @@ struct ifmedia_baudrate { * Status bit descriptions for the various media types. */ struct ifmedia_status_description { - int ifms_type; - int ifms_valid; - int ifms_bit; + uint64_t ifms_type; + uint64_t ifms_valid; + uint64_t ifms_bit; const char *ifms_string[2]; }; diff --git a/sys/net80211/ieee80211.c b/sys/net80211/ieee80211.c index 3484528e92f..cc891f1c85b 100644 --- a/sys/net80211/ieee80211.c +++ b/sys/net80211/ieee80211.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ieee80211.c,v 1.44 2015/03/14 03:38:51 jsg Exp $ */ +/* $OpenBSD: ieee80211.c,v 1.45 2015/09/11 13:02:28 stsp Exp $ */ /* $NetBSD: ieee80211.c,v 1.19 2004/06/06 05:45:29 dyoung Exp $ */ /*- @@ -250,7 +250,8 @@ ieee80211_media_init(struct ifnet *ifp, IFM_MAKEWORD(IFM_IEEE80211, (_s), (_o), 0), 0, NULL) struct ieee80211com *ic = (void *)ifp; struct ifmediareq imr; - int i, j, mode, rate, maxrate, mword, mopt, r; + int i, j, mode, rate, maxrate, r; + uint64_t mword, mopt; const struct ieee80211_rateset *rs; struct ieee80211_rateset allrates; @@ -267,7 +268,7 @@ ieee80211_media_init(struct ifnet *ifp, maxrate = 0; memset(&allrates, 0, sizeof(allrates)); for (mode = IEEE80211_MODE_AUTO; mode < IEEE80211_MODE_MAX; mode++) { - static const u_int mopts[] = { + static const uint64_t mopts[] = { IFM_AUTO, IFM_IEEE80211_11A, IFM_IEEE80211_11B, @@ -816,13 +817,13 @@ ieee80211_chan2mode(struct ieee80211com *ic, * convert IEEE80211 rate value to ifmedia subtype. * ieee80211 rate is in unit of 0.5Mbps. */ -int +uint64_t ieee80211_rate2media(struct ieee80211com *ic, int rate, enum ieee80211_phymode mode) { static const struct { - u_int m; /* rate + mode */ - u_int r; /* if_media rate */ + uint64_t m; /* rate + mode */ + uint64_t r; /* if_media rate */ } rates[] = { { 2 | IFM_IEEE80211_11B, IFM_IEEE80211_DS1 }, { 4 | IFM_IEEE80211_11B, IFM_IEEE80211_DS2 }, @@ -851,7 +852,8 @@ ieee80211_rate2media(struct ieee80211com *ic, int rate, { 108 | IFM_IEEE80211_11G, IFM_IEEE80211_OFDM54 }, /* NB: OFDM72 doesn't really exist so we don't handle it */ }; - u_int mask, i; + uint64_t mask; + int i; mask = rate & IEEE80211_RATE_VAL; switch (mode) { @@ -876,11 +878,11 @@ ieee80211_rate2media(struct ieee80211com *ic, int rate, } int -ieee80211_media2rate(int mword) +ieee80211_media2rate(uint64_t mword) { int i; static const struct { - int subtype; + uint64_t subtype; int rate; } ieeerates[] = { { IFM_AUTO, -1 }, diff --git a/sys/net80211/ieee80211_var.h b/sys/net80211/ieee80211_var.h index abf04d7c7d1..a55b3272a22 100644 --- a/sys/net80211/ieee80211_var.h +++ b/sys/net80211/ieee80211_var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ieee80211_var.h,v 1.62 2012/01/21 19:42:16 stsp Exp $ */ +/* $OpenBSD: ieee80211_var.h,v 1.63 2015/09/11 13:02:28 stsp Exp $ */ /* $NetBSD: ieee80211_var.h,v 1.7 2004/05/06 03:07:10 dyoung Exp $ */ /*- @@ -387,9 +387,9 @@ int ieee80211_ioctl(struct ifnet *, u_long, caddr_t); int ieee80211_get_rate(struct ieee80211com *); void ieee80211_watchdog(struct ifnet *); int ieee80211_fix_rate(struct ieee80211com *, struct ieee80211_node *, int); -int ieee80211_rate2media(struct ieee80211com *, int, - enum ieee80211_phymode); -int ieee80211_media2rate(int); +uint64_t ieee80211_rate2media(struct ieee80211com *, int, + enum ieee80211_phymode); +int ieee80211_media2rate(uint64_t); u_int8_t ieee80211_rate2plcp(u_int8_t, enum ieee80211_phymode); u_int8_t ieee80211_plcp2rate(u_int8_t, enum ieee80211_phymode); u_int ieee80211_mhz2ieee(u_int, u_int); diff --git a/sys/sys/sockio.h b/sys/sys/sockio.h index 9afc8bb0306..0cca55d514d 100644 --- a/sys/sys/sockio.h +++ b/sys/sys/sockio.h @@ -1,4 +1,4 @@ -/* $OpenBSD: sockio.h,v 1.59 2015/07/21 04:14:52 rzalamena Exp $ */ +/* $OpenBSD: sockio.h,v 1.60 2015/09/11 13:02:28 stsp Exp $ */ /* $NetBSD: sockio.h,v 1.5 1995/08/23 00:40:47 thorpej Exp $ */ /*- @@ -76,8 +76,9 @@ #define SIOCGETVIFCNT _IOWR('u', 51, struct sioc_vif_req)/* vif pkt cnt */ #define SIOCGETSGCNT _IOWR('u', 52, struct sioc_sg_req) /* sg pkt cnt */ -#define SIOCSIFMEDIA _IOWR('i', 53, struct ifreq) /* set net media */ -#define SIOCGIFMEDIA _IOWR('i', 54, struct ifmediareq) /* get net media */ +/* 53 and 54 used to be SIOC[SG]IFMEDIA with a 32 bit media word */ +#define SIOCSIFMEDIA _IOWR('i', 55, struct ifreq) /* set net media */ +#define SIOCGIFMEDIA _IOWR('i', 56, struct ifmediareq) /* get net media */ #define SIOCSIFPHYADDR _IOW('i', 70, struct ifaliasreq) /* set gif address */ #define SIOCGIFPSRCADDR _IOWR('i', 71, struct ifreq) /* get gif psrc addr */ |