Add suspend/resume hooks to ensure that the chip doesn't scramble memory
after an APM suspend and is unsnoozed after an APM resume.
This commit is contained in:
parent
c2150bf8bf
commit
92c19e5ff7
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: if_tlp_cardbus.c,v 1.20 2000/03/15 18:39:52 thorpej Exp $ */
|
||||
/* $NetBSD: if_tlp_cardbus.c,v 1.21 2000/03/19 21:45:24 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
|
||||
@ -152,6 +152,7 @@ void tlp_cardbus_setup __P((struct tulip_cardbus_softc *));
|
||||
|
||||
int tlp_cardbus_enable __P((struct tulip_softc *));
|
||||
void tlp_cardbus_disable __P((struct tulip_softc *));
|
||||
void tlp_cardbus_power __P((struct tulip_softc *, int));
|
||||
|
||||
void tlp_cardbus_x3201_reset __P((struct tulip_softc *));
|
||||
|
||||
@ -225,6 +226,7 @@ tlp_cardbus_attach(parent, self, aux)
|
||||
*/
|
||||
sc->sc_enable = tlp_cardbus_enable;
|
||||
sc->sc_disable = tlp_cardbus_disable;
|
||||
sc->sc_power = tlp_cardbus_power;
|
||||
|
||||
/*
|
||||
* Get revision info, and set some chip-specific variables.
|
||||
@ -449,6 +451,26 @@ tlp_cardbus_disable(sc)
|
||||
Cardbus_function_disable(ct);
|
||||
}
|
||||
|
||||
void
|
||||
tlp_cardbus_power(sc, why)
|
||||
struct tulip_softc *sc;
|
||||
int why;
|
||||
{
|
||||
struct tulip_cardbus_softc *csc = (void *) sc;
|
||||
|
||||
if (why == PWR_RESUME) {
|
||||
/*
|
||||
* Give the PCI configuration registers a kick
|
||||
* in the head.
|
||||
*/
|
||||
#ifdef DIAGNOSTIC
|
||||
if (TULIP_IS_ENABLED(sc) == 0)
|
||||
panic("tlp_cardbus_power");
|
||||
#endif
|
||||
tlp_cardbus_setup(csc);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
tlp_cardbus_setup(csc)
|
||||
struct tulip_cardbus_softc *csc;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: tulip.c,v 1.53 2000/03/15 18:39:50 thorpej Exp $ */
|
||||
/* $NetBSD: tulip.c,v 1.54 2000/03/19 21:45:23 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
|
||||
@ -156,6 +156,7 @@ int tlp_srom_size __P((struct tulip_softc *));
|
||||
|
||||
int tlp_enable __P((struct tulip_softc *));
|
||||
void tlp_disable __P((struct tulip_softc *));
|
||||
void tlp_power __P((int, void *));
|
||||
|
||||
void tlp_filter_setup __P((struct tulip_softc *));
|
||||
void tlp_winb_filter_setup __P((struct tulip_softc *));
|
||||
@ -490,6 +491,15 @@ tlp_attach(sc, enaddr)
|
||||
if (sc->sc_sdhook == NULL)
|
||||
printf("%s: WARNING: unable to establish shutdown hook\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
|
||||
/*
|
||||
* Add a suspend hook to make sure we come back up after a
|
||||
* resume.
|
||||
*/
|
||||
sc->sc_powerhook = powerhook_establish(tlp_power, sc);
|
||||
if (sc->sc_powerhook == NULL)
|
||||
printf("%s: WARNING: unable to establish power hook\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
return;
|
||||
|
||||
/*
|
||||
@ -1884,6 +1894,33 @@ tlp_disable(sc)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* tlp_power:
|
||||
*
|
||||
* Power management (suspend/resume) hook.
|
||||
*/
|
||||
void
|
||||
tlp_power(why, arg)
|
||||
int why;
|
||||
void *arg;
|
||||
{
|
||||
struct tulip_softc *sc = arg;
|
||||
struct ifnet *ifp = &sc->sc_ethercom.ec_if;
|
||||
int s;
|
||||
|
||||
s = splnet();
|
||||
if (why != PWR_RESUME) {
|
||||
tlp_stop(sc, 0);
|
||||
if (sc->sc_power != NULL)
|
||||
(*sc->sc_power)(sc, why);
|
||||
} else if (ifp->if_flags & IFF_UP) {
|
||||
if (sc->sc_power != NULL)
|
||||
(*sc->sc_power)(sc, why);
|
||||
tlp_init(sc);
|
||||
}
|
||||
splx(s);
|
||||
}
|
||||
|
||||
/*
|
||||
* tlp_rxdrain:
|
||||
*
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: tulipvar.h,v 1.30 2000/03/15 18:39:51 thorpej Exp $ */
|
||||
/* $NetBSD: tulipvar.h,v 1.31 2000/03/19 21:45:24 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
|
||||
@ -270,6 +270,7 @@ struct tulip_softc {
|
||||
bus_dma_tag_t sc_dmat; /* bus DMA tag */
|
||||
struct ethercom sc_ethercom; /* ethernet common data */
|
||||
void *sc_sdhook; /* shutdown hook */
|
||||
void *sc_powerhook; /* power management hook */
|
||||
|
||||
struct tulip_stats sc_stats; /* debugging stats */
|
||||
|
||||
@ -326,6 +327,7 @@ struct tulip_softc {
|
||||
/* Power management hooks. */
|
||||
int (*sc_enable) __P((struct tulip_softc *));
|
||||
void (*sc_disable) __P((struct tulip_softc *));
|
||||
void (*sc_power) __P((struct tulip_softc *, int));
|
||||
|
||||
/*
|
||||
* The Winbond 89C840F places registers 4 bytes apart, instead
|
||||
|
Loading…
Reference in New Issue
Block a user