void mii_activate(struct mii_data *mii, enum devact act, int phyloc, int offloc) { struct mii_softc *child; if (phyloc != MII_PHY_ANY && offloc != MII_OFFSET_ANY) panic("mii_activate: phyloc and offloc specified"); if ((mii->mii_flags & MIIF_INITDONE) == 0) return; for (child = LIST_FIRST(&mii->mii_phys); child != NULL; child = LIST_NEXT(child, mii_list)) { if (phyloc != MII_PHY_ANY || offloc != MII_OFFSET_ANY) { if (phyloc != MII_PHY_ANY && phyloc != child->mii_phy) continue; if (offloc != MII_OFFSET_ANY && offloc != child->mii_offset) continue; } switch (act) { case DVACT_ACTIVATE: panic("mii_activate: DVACT_ACTIVATE"); break; case DVACT_DEACTIVATE: if (config_deactivate(&child->mii_dev) != 0) panic("%s: config_activate(%d) failed", child->mii_dev.dv_xname, act); } } }
int uhub_activate(struct device *self, enum devact act) { struct uhub_softc *sc = (struct uhub_softc *)self; struct usbd_hub *hub = sc->sc_hub->hub; usbd_device_handle dev; int nports, port, i; switch (act) { case DVACT_ACTIVATE: break; case DVACT_DEACTIVATE: if (hub == NULL) /* malfunctioning hub */ break; nports = hub->hubdesc.bNbrPorts; for(port = 0; port < nports; port++) { dev = hub->ports[port].device; if (dev != NULL && dev->subdevs != NULL) { for (i = 0; dev->subdevs[i] != NULL; i++) config_deactivate(dev->subdevs[i]); } } break; } return (0); }
static usbd_status deactivate_mididev(struct umidi_mididev *mididev) { if (mididev->out_jack) mididev->out_jack->binded = 0; if (mididev->in_jack) mididev->in_jack->binded = 0; config_deactivate(mididev->mdev); return USBD_NORMAL_COMPLETION; }
int utpms_activate(struct device *self, int act) { struct utpms_softc *sc = (struct utpms_softc *)self; int rv = 0; if (act == DVACT_DEACTIVATE) { if (sc->sc_wsmousedev != NULL) rv = config_deactivate(sc->sc_wsmousedev); } return (rv); }
int uslcom_activate(struct device *self, int act) { struct uslcom_softc *sc = (struct uslcom_softc *)self; int rv = 0; switch (act) { case DVACT_DEACTIVATE: if (sc->sc_subdev != NULL) rv = config_deactivate(sc->sc_subdev); sc->sc_dying = 1; break; } return (rv); }
int ums_activate(struct device *self, int act) { struct ums_softc *sc = (struct ums_softc *)self; struct hidms *ms = &sc->sc_ms; int rv = 0; switch (act) { case DVACT_DEACTIVATE: if (ms->sc_wsmousedev != NULL) rv = config_deactivate(ms->sc_wsmousedev); break; } return (rv); }
Static int tpms_activate(device_ptr_t self, enum devact act) { struct tpms_softc *sc = (struct tpms_softc *)self; int ret; if (act == DVACT_DEACTIVATE) { ret = 0; if (sc->sc_wsmousedev != NULL) ret = config_deactivate(sc->sc_wsmousedev); sc->sc_status |= TPMS_DYING; return (ret); } return (EOPNOTSUPP); }
int ubcmtp_activate(struct device *self, int act) { struct ubcmtp_softc *sc = (struct ubcmtp_softc *)self; int ret; if (act == DVACT_DEACTIVATE) { ret = 0; if (sc->sc_wsmousedev != NULL) ret = config_deactivate(sc->sc_wsmousedev); usbd_deactivate(sc->sc_udev); return (ret); } return (EOPNOTSUPP); }
int ukbd_activate(struct device *self, int act) { struct ukbd_softc *sc = (struct ukbd_softc *)self; struct hidkbd *kbd = &sc->sc_kbd; int rv = 0; switch (act) { case DVACT_DEACTIVATE: if (kbd->sc_wskbddev != NULL) rv = config_deactivate(kbd->sc_wskbddev); break; } return (rv); }
int utpms_activate(struct device *self, int act) { struct utpms_softc *sc = (struct utpms_softc *)self; int ret; if (act == DVACT_DEACTIVATE) { ret = 0; if (sc->sc_wsmousedev != NULL) ret = config_deactivate(sc->sc_wsmousedev); sc->sc_status |= UTPMS_DYING; return (ret); } return (EOPNOTSUPP); }
int gpioow_activate(struct device *self, int act) { struct gpioow_softc *sc = (struct gpioow_softc *)self; int rv = 0; switch (act) { case DVACT_ACTIVATE: break; case DVACT_DEACTIVATE: sc->sc_dying = 1; if (sc->sc_ow_dev != NULL) rv = config_deactivate(sc->sc_ow_dev); break; } return (rv); }
int umct_activate(device_t self, enum devact act) { struct umct_softc *sc = device_private(self); int rv = 0; switch (act) { case DVACT_ACTIVATE: return (EOPNOTSUPP); case DVACT_DEACTIVATE: if (sc->sc_subdev != NULL) rv = config_deactivate(sc->sc_subdev); sc->sc_dying = 1; break; } return (rv); }
static int auich_activate(struct device *self, enum devact act) { struct auich_softc *sc; int ret; sc = (struct auich_softc *)self; ret = 0; switch (act) { case DVACT_ACTIVATE: return EOPNOTSUPP; case DVACT_DEACTIVATE: if (sc->sc_audiodev != NULL) ret = config_deactivate(sc->sc_audiodev); return ret; } return EOPNOTSUPP; }
int umodem_activate(struct device *self, enum devact act) { struct umodem_softc *sc = (struct umodem_softc *)self; int rv = 0; switch (act) { case DVACT_ACTIVATE: break; case DVACT_DEACTIVATE: sc->sc_dying = 1; if (sc->sc_subdev) rv = config_deactivate(sc->sc_subdev); break; } return (rv); }
int ukbd_activate(struct device *self, enum devact act) { struct ukbd_softc *sc = (struct ukbd_softc *)self; int rv = 0; switch (act) { case DVACT_ACTIVATE: break; case DVACT_DEACTIVATE: if (sc->sc_wskbddev != NULL) rv = config_deactivate(sc->sc_wskbddev); sc->sc_dying = 1; break; } return (rv); }
int uplcom_activate(device_ptr_t self, enum devact act) { struct uplcom_softc *sc = (struct uplcom_softc *)self; int rv = 0; switch (act) { case DVACT_ACTIVATE: break; case DVACT_DEACTIVATE: if (sc->sc_subdev != NULL) rv = config_deactivate(sc->sc_subdev); sc->sc_dying = 1; break; } return (rv); }
int ums_activate(device_ptr_t self, enum devact act) { struct ums_softc *sc = (struct ums_softc *)self; int rv = 0; switch (act) { case DVACT_ACTIVATE: return (EOPNOTSUPP); break; case DVACT_DEACTIVATE: if (sc->sc_wsmousedev != NULL) rv = config_deactivate(sc->sc_wsmousedev); sc->sc_dying = 1; break; } return (rv); }
int uirda_activate(device_t self, enum devact act) { struct uirda_softc *sc = device_private(self); int error = 0; switch (act) { case DVACT_ACTIVATE: return (EOPNOTSUPP); break; case DVACT_DEACTIVATE: sc->sc_dying = 1; if (sc->sc_child != NULL) error = config_deactivate(sc->sc_child); break; } return (error); }
int uhidev_activate(struct device *self, int act) { struct uhidev_softc *sc = (struct uhidev_softc *)self; int i, rv = 0, r; switch (act) { case DVACT_DEACTIVATE: for (i = 0; i < sc->sc_nrepid; i++) if (sc->sc_subdevs[i] != NULL) { r = config_deactivate( &sc->sc_subdevs[i]->sc_dev); if (r && r != EOPNOTSUPP) rv = r; } usbd_deactivate(sc->sc_udev); break; } return (rv); }
int uhidev_activate(struct device *self, int act) { struct uhidev_softc *sc = (struct uhidev_softc *)self; int i, rv = 0; switch (act) { case DVACT_ACTIVATE: break; case DVACT_DEACTIVATE: for (i = 0; i < sc->sc_nrepid; i++) if (sc->sc_subdevs[i] != NULL) rv |= config_deactivate( &sc->sc_subdevs[i]->sc_dev); sc->sc_dying = 1; break; } return (rv); }
static int u3g_activate(device_t self, enum devact act) { struct u3g_softc *sc = device_private(self); int i, rv = 0; switch (act) { case DVACT_ACTIVATE: return (EOPNOTSUPP); break; case DVACT_DEACTIVATE: for (i = 0; i < sc->numports; i++) { if (sc->sc_ucom[i] && config_deactivate(sc->sc_ucom[i])) rv = -1; } break; } return (rv); }
int xboxcontroller_activate(device_ptr_t self, enum devact act) { struct xboxcontroller_softc *sc = device_private(self); int rv; rv = 0; switch (act) { case DVACT_ACTIVATE: return EOPNOTSUPP; case DVACT_DEACTIVATE: if (sc->sc_wsmousedev != NULL) rv = config_deactivate(sc->sc_wsmousedev); sc->sc_dying = 1; break; } return rv; }
static int u3g_activate(device_t self, enum devact act) { struct u3g_softc *sc = device_private(self); int rv; switch (act) { case DVACT_DEACTIVATE: if (sc->sc_ucom != NULL && config_deactivate(sc->sc_ucom)) rv = -1; else rv = 0; break; default: rv = 0; break; } return (rv); }
int ugensa_activate(device_t self, enum devact act) { struct ugensa_softc *sc = device_private(self); int rv = 0; DPRINTF(("ugensa_activate: sc=%p\n", sc)); switch (act) { case DVACT_ACTIVATE: return (EOPNOTSUPP); break; case DVACT_DEACTIVATE: sc->sc_dying = 1; if (sc->sc_subdev) rv = config_deactivate(sc->sc_subdev); break; } return (rv); }
int uhidev_activate(device_ptr_t self, enum devact act) { struct uhidev_softc *sc = (struct uhidev_softc *)self; int i, rv; switch (act) { case DVACT_ACTIVATE: return (EOPNOTSUPP); break; case DVACT_DEACTIVATE: rv = 0; for (i = 0; i < sc->sc_nrepid; i++) if (sc->sc_subdevs[i] != NULL) rv |= config_deactivate( &sc->sc_subdevs[i]->sc_dev); sc->sc_dying = 1; break; } return (rv); }
int scsi_activate_lun(struct scsibus_softc *sc, int target, int lun, int act) { struct scsi_link *link; struct device *dev; int rv = 0; link = scsi_get_link(sc, target, lun); if (link == NULL) return (0); dev = link->device_softc; switch (act) { case DVACT_DEACTIVATE: atomic_setbits_int(&link->state, SDEV_S_DYING); config_deactivate(dev); break; default: rv = config_suspend(dev, act); break; } return (rv); }
int an_attach(struct an_softc *sc) { struct ieee80211com *ic = &sc->sc_ic; struct ifnet *ifp = &sc->sc_if; int i, s; struct an_rid_wepkey *akey; int buflen, kid, rid; int chan, chan_min, chan_max; s = splnet(); an_wait(sc); if (an_reset(sc) != 0) { config_deactivate(sc->sc_dev); splx(s); return 1; } /* Load factory config */ if (an_cmd(sc, AN_CMD_READCFG, 0) != 0) { splx(s); aprint_error_dev(sc->sc_dev, "failed to load config data\n"); return 1; } /* Read the current configuration */ buflen = sizeof(sc->sc_config); if (an_read_rid(sc, AN_RID_GENCONFIG, &sc->sc_config, &buflen) != 0) { splx(s); aprint_error_dev(sc->sc_dev, "read config failed\n"); return 1; } /* Read the card capabilities */ buflen = sizeof(sc->sc_caps); if (an_read_rid(sc, AN_RID_CAPABILITIES, &sc->sc_caps, &buflen) != 0) { splx(s); aprint_error_dev(sc->sc_dev, "read caps failed\n"); return 1; } #ifdef AN_DEBUG if (an_debug) { static const int dumprid[] = { AN_RID_GENCONFIG, AN_RID_CAPABILITIES, AN_RID_SSIDLIST, AN_RID_APLIST, AN_RID_STATUS, AN_RID_ENCAP }; for (rid = 0; rid < sizeof(dumprid)/sizeof(dumprid[0]); rid++) { buflen = sizeof(sc->sc_buf); if (an_read_rid(sc, dumprid[rid], &sc->sc_buf, &buflen) != 0) continue; printf("%04x (%d):\n", dumprid[rid], buflen); for (i = 0; i < (buflen + 1) / 2; i++) printf(" %04x", sc->sc_buf.sc_val[i]); printf("\n"); } } #endif /* Read WEP settings from persistent memory */ akey = &sc->sc_buf.sc_wepkey; buflen = sizeof(struct an_rid_wepkey); rid = AN_RID_WEP_VOLATILE; /* first persistent key */ while (an_read_rid(sc, rid, akey, &buflen) == 0) { kid = le16toh(akey->an_key_index); DPRINTF(("an_attach: wep rid=0x%x len=%d(%zu) index=0x%04x " "mac[0]=%02x keylen=%d\n", rid, buflen, sizeof(*akey), kid, akey->an_mac_addr[0], le16toh(akey->an_key_len))); if (kid == 0xffff) { sc->sc_tx_perskey = akey->an_mac_addr[0]; sc->sc_tx_key = -1; break; } if (kid >= IEEE80211_WEP_NKID) break; sc->sc_perskeylen[kid] = le16toh(akey->an_key_len); sc->sc_wepkeys[kid].an_wep_keylen = -1; rid = AN_RID_WEP_PERSISTENT; /* for next key */ buflen = sizeof(struct an_rid_wepkey); } aprint_normal_dev(sc->sc_dev, "%s %s (firmware %s)\n", sc->sc_caps.an_manufname, sc->sc_caps.an_prodname, sc->sc_caps.an_prodvers); memcpy(ifp->if_xname, device_xname(sc->sc_dev), IFNAMSIZ); ifp->if_softc = sc; ifp->if_flags = IFF_BROADCAST | IFF_NOTRAILERS | IFF_SIMPLEX | IFF_MULTICAST | IFF_ALLMULTI; ifp->if_ioctl = an_ioctl; ifp->if_start = an_start; ifp->if_init = an_init; ifp->if_stop = an_stop; ifp->if_watchdog = an_watchdog; IFQ_SET_READY(&ifp->if_snd); ic->ic_ifp = ifp; ic->ic_phytype = IEEE80211_T_DS; ic->ic_opmode = IEEE80211_M_STA; ic->ic_caps = IEEE80211_C_WEP | IEEE80211_C_PMGT | IEEE80211_C_IBSS | IEEE80211_C_MONITOR; ic->ic_state = IEEE80211_S_INIT; IEEE80211_ADDR_COPY(ic->ic_myaddr, sc->sc_caps.an_oemaddr); switch (le16toh(sc->sc_caps.an_regdomain)) { default: case AN_REGDOMAIN_USA: case AN_REGDOMAIN_CANADA: chan_min = 1; chan_max = 11; break; case AN_REGDOMAIN_EUROPE: case AN_REGDOMAIN_AUSTRALIA: chan_min = 1; chan_max = 13; break; case AN_REGDOMAIN_JAPAN: chan_min = 14; chan_max = 14; break; case AN_REGDOMAIN_SPAIN: chan_min = 10; chan_max = 11; break; case AN_REGDOMAIN_FRANCE: chan_min = 10; chan_max = 13; break; case AN_REGDOMAIN_JAPANWIDE: chan_min = 1; chan_max = 14; break; } for (chan = chan_min; chan <= chan_max; chan++) { ic->ic_channels[chan].ic_freq = ieee80211_ieee2mhz(chan, IEEE80211_CHAN_2GHZ); ic->ic_channels[chan].ic_flags = IEEE80211_CHAN_B; } ic->ic_ibss_chan = &ic->ic_channels[chan_min]; aprint_normal("%s: 802.11 address: %s, channel: %d-%d\n", ifp->if_xname, ether_sprintf(ic->ic_myaddr), chan_min, chan_max); /* Find supported rate */ for (i = 0; i < sizeof(sc->sc_caps.an_rates); i++) { if (sc->sc_caps.an_rates[i] == 0) continue; ic->ic_sup_rates[IEEE80211_MODE_11B].rs_rates[ ic->ic_sup_rates[IEEE80211_MODE_11B].rs_nrates++] = sc->sc_caps.an_rates[i]; } /* * Call MI attach routine. */ if_attach(ifp); ieee80211_ifattach(ic); sc->sc_newstate = ic->ic_newstate; ic->ic_newstate = an_newstate; ieee80211_media_init(ic, an_media_change, an_media_status); /* * radiotap BPF device */ bpf_attach2(ifp, DLT_IEEE802_11_RADIO, sizeof(struct ieee80211_frame) + 64, &sc->sc_drvbpf); memset(&sc->sc_rxtapu, 0, sizeof(sc->sc_rxtapu)); sc->sc_rxtap.ar_ihdr.it_len = htole16(sizeof(sc->sc_rxtapu)); sc->sc_rxtap.ar_ihdr.it_present = htole32(AN_RX_RADIOTAP_PRESENT); memset(&sc->sc_txtapu, 0, sizeof(sc->sc_txtapu)); sc->sc_txtap.at_ihdr.it_len = htole16(sizeof(sc->sc_txtapu)); sc->sc_txtap.at_ihdr.it_present = htole32(AN_TX_RADIOTAP_PRESENT); sc->sc_attached = 1; splx(s); ieee80211_announce(ic); return 0; }