int
wi_pcmcia_activate(struct device *dev, enum devact act)
{
	struct wi_pcmcia_softc *psc = (struct wi_pcmcia_softc *)dev;
	struct wi_softc *sc = &psc->sc_wi;
	struct ifnet *ifp = &sc->sc_ic.ic_if;
	int s;

	s = splnet();
	switch (act) {
	case DVACT_ACTIVATE:
		pcmcia_function_enable(psc->sc_pf);
		sc->sc_ih = pcmcia_intr_establish(psc->sc_pf, IPL_NET,
		    wi_intr, sc, sc->sc_dev.dv_xname);
		wi_cor_reset(sc);
		wi_init(sc);
		break;

	case DVACT_DEACTIVATE:
		ifp->if_timer = 0;
		if (ifp->if_flags & IFF_RUNNING)
			wi_stop(sc);
		sc->wi_flags &= ~WI_FLAGS_INITIALIZED;
		if (sc->sc_ih != NULL)
			pcmcia_intr_disestablish(psc->sc_pf, sc->sc_ih);
		pcmcia_function_disable(psc->sc_pf);
		break;
	}
	splx(s);
	return (0);
}
Exemple #2
0
static int
wi_pci_resume(device_t dev)
{
    struct wi_softc	*sc = device_get_softc(dev);
    struct ieee80211com *ic = &sc->sc_ic;

    WI_LOCK(sc);
    if (sc->wi_bus_type != WI_BUS_PCI_NATIVE) {
        return (0);
        WI_UNLOCK(sc);
    }
    if (ic->ic_nrunning > 0)
        wi_init(sc);
    WI_UNLOCK(sc);
    return (0);
}
Exemple #3
0
void
wi_pcmcia_wakeup(struct wi_softc *sc)
{
	int s;

	s = splnet();
	while (sc->wi_flags & WI_FLAGS_BUSY)
		tsleep(&sc->wi_flags, 0, "wipwr", 0);
	sc->wi_flags |= WI_FLAGS_BUSY;

	wi_cor_reset(sc);
	wi_init(sc);

	sc->wi_flags &= ~WI_FLAGS_BUSY;
	wakeup(&sc->wi_flags);
	splx(s);
}