Add power hooks for "ne* at pcmcia?".
ok christos@
This commit is contained in:
parent
8fe4e4040d
commit
09f0de7ce4
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ne2000.c,v 1.49 2006/05/21 23:56:09 christos Exp $ */
|
||||
/* $NetBSD: ne2000.c,v 1.50 2006/07/11 22:48:37 peter Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
|
||||
@ -55,7 +55,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ne2000.c,v 1.49 2006/05/21 23:56:09 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ne2000.c,v 1.50 2006/07/11 22:48:37 peter Exp $");
|
||||
|
||||
#include "opt_ipkdb.h"
|
||||
|
||||
@ -935,3 +935,32 @@ ne2000_ipkdb_attach(kip)
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
ne2000_power(int why, void *arg)
|
||||
{
|
||||
struct ne2000_softc *sc = arg;
|
||||
struct dp8390_softc *dsc = &sc->sc_dp8390;
|
||||
struct ifnet *ifp = &dsc->sc_ec.ec_if;
|
||||
int s;
|
||||
|
||||
s = splnet();
|
||||
switch (why) {
|
||||
case PWR_SUSPEND:
|
||||
case PWR_STANDBY:
|
||||
dp8390_stop(dsc);
|
||||
dp8390_disable(dsc);
|
||||
break;
|
||||
case PWR_RESUME:
|
||||
if (ifp->if_flags & IFF_UP) {
|
||||
if (dp8390_enable(dsc) == 0)
|
||||
dp8390_init(dsc);
|
||||
}
|
||||
break;
|
||||
case PWR_SOFTSUSPEND:
|
||||
case PWR_SOFTSTANDBY:
|
||||
case PWR_SOFTRESUME:
|
||||
break;
|
||||
}
|
||||
splx(s);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ne2000var.h,v 1.17 2005/12/11 12:21:28 christos Exp $ */
|
||||
/* $NetBSD: ne2000var.h,v 1.18 2006/07/11 22:48:37 peter Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
|
||||
@ -67,4 +67,6 @@ int ne2000_detach(struct ne2000_softc *, int);
|
||||
int ne2000_ipkdb_attach(struct ipkdb_if *);
|
||||
#endif
|
||||
|
||||
void ne2000_power(int, void *);
|
||||
|
||||
#endif /* _DEV_IC_NE2000VAR_H_ */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: if_ne_pcmcia.c,v 1.142 2006/03/23 02:14:42 christos Exp $ */
|
||||
/* $NetBSD: if_ne_pcmcia.c,v 1.143 2006/07/11 22:48:37 peter Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997 Marc Horowitz. All rights reserved.
|
||||
@ -30,7 +30,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_ne_pcmcia.c,v 1.142 2006/03/23 02:14:42 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_ne_pcmcia.c,v 1.143 2006/07/11 22:48:37 peter Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -80,6 +80,7 @@ struct ne_pcmcia_softc {
|
||||
struct pcmcia_function *sc_pf; /* our PCMCIA function */
|
||||
int sc_state;
|
||||
#define NE_PCMCIA_ATTACHED 3
|
||||
void *sc_powerhook; /* power management hook */
|
||||
};
|
||||
|
||||
u_int8_t *ne_pcmcia_get_enaddr(struct ne_pcmcia_softc *, int,
|
||||
@ -723,6 +724,11 @@ found:
|
||||
if (ne2000_attach(nsc, enaddr))
|
||||
goto fail2;
|
||||
|
||||
psc->sc_powerhook = powerhook_establish(ne2000_power, nsc);
|
||||
if (psc->sc_powerhook == NULL)
|
||||
printf("%s: WARNING: unable to establish power hook\n",
|
||||
self->dv_xname);
|
||||
|
||||
psc->sc_state = NE_PCMCIA_ATTACHED;
|
||||
ne_pcmcia_disable(dsc);
|
||||
return;
|
||||
@ -745,6 +751,9 @@ ne_pcmcia_detach(self, flags)
|
||||
if (psc->sc_state != NE_PCMCIA_ATTACHED)
|
||||
return (0);
|
||||
|
||||
if (psc->sc_powerhook != NULL)
|
||||
powerhook_disestablish(psc->sc_powerhook);
|
||||
|
||||
error = ne2000_detach(&psc->sc_ne2000, flags);
|
||||
if (error)
|
||||
return (error);
|
||||
|
Loading…
Reference in New Issue
Block a user