parent
09f0de7ce4
commit
58224a41e7
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: elink3.c,v 1.116 2006/06/07 15:34:47 nakayama Exp $ */
|
||||
/* $NetBSD: elink3.c,v 1.117 2006/07/11 22:49:47 peter Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
|
||||
|
@ -69,7 +69,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: elink3.c,v 1.116 2006/06/07 15:34:47 nakayama Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: elink3.c,v 1.117 2006/07/11 22:49:47 peter Exp $");
|
||||
|
||||
#include "opt_inet.h"
|
||||
#include "opt_ns.h"
|
||||
|
@ -2189,3 +2189,29 @@ ep_statchg(self)
|
|||
bus_space_write_2(iot, ioh, ELINK_W3_MAC_CONTROL, mctl);
|
||||
GO_WINDOW(1); /* back to operating window */
|
||||
}
|
||||
|
||||
void
|
||||
ep_power(int why, void *arg)
|
||||
{
|
||||
struct ep_softc *sc = arg;
|
||||
struct ifnet *ifp = &sc->sc_ethercom.ec_if;
|
||||
int s;
|
||||
|
||||
s = splnet();
|
||||
switch (why) {
|
||||
case PWR_SUSPEND:
|
||||
case PWR_STANDBY:
|
||||
epstop(ifp, 1);
|
||||
break;
|
||||
case PWR_RESUME:
|
||||
if (ifp->if_flags & IFF_UP) {
|
||||
(void)epinit(ifp);
|
||||
}
|
||||
break;
|
||||
case PWR_SOFTSUSPEND:
|
||||
case PWR_SOFTSTANDBY:
|
||||
case PWR_SOFTRESUME:
|
||||
break;
|
||||
}
|
||||
splx(s);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: elink3var.h,v 1.33 2005/12/11 12:21:26 christos Exp $ */
|
||||
/* $NetBSD: elink3var.h,v 1.34 2006/07/11 22:49:47 peter Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994 Herb Peyerl <hpeyerl@beer.org>
|
||||
|
@ -124,3 +124,5 @@ void epdisable(struct ep_softc *);
|
|||
|
||||
int ep_activate(struct device *, enum devact);
|
||||
int ep_detach(struct device *, int);
|
||||
|
||||
void ep_power(int, void *);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if_ep_pcmcia.c,v 1.54 2005/12/11 12:23:23 christos Exp $ */
|
||||
/* $NetBSD: if_ep_pcmcia.c,v 1.55 2006/07/11 22:49:47 peter Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998, 2000, 2004 The NetBSD Foundation, Inc.
|
||||
|
@ -67,7 +67,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_ep_pcmcia.c,v 1.54 2005/12/11 12:23:23 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_ep_pcmcia.c,v 1.55 2006/07/11 22:49:47 peter Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -114,6 +114,8 @@ struct ep_pcmcia_softc {
|
|||
struct pcmcia_io_handle sc_pcioh; /* PCMCIA i/o space info */
|
||||
int sc_io_window; /* our i/o window */
|
||||
struct pcmcia_function *sc_pf; /* our PCMCIA function */
|
||||
|
||||
void *sc_powerhook; /* power management hook */
|
||||
};
|
||||
|
||||
CFATTACH_DECL(ep_pcmcia, sizeof(struct ep_pcmcia_softc),
|
||||
|
@ -337,6 +339,11 @@ ep_pcmcia_attach(parent, self, aux)
|
|||
aprint_error("%s: couldn't configure controller\n",
|
||||
self->dv_xname);
|
||||
|
||||
psc->sc_powerhook = powerhook_establish(ep_power, sc);
|
||||
if (psc->sc_powerhook == NULL)
|
||||
aprint_error("%s: WARNING: unable to establish power hook\n",
|
||||
self->dv_xname);
|
||||
|
||||
sc->enabled = 0;
|
||||
ep_pcmcia_disable(sc);
|
||||
return;
|
||||
|
@ -361,6 +368,9 @@ ep_pcmcia_detach(self, flags)
|
|||
/* Nothing to detach. */
|
||||
return (0);
|
||||
|
||||
if (psc->sc_powerhook != NULL)
|
||||
powerhook_disestablish(psc->sc_powerhook);
|
||||
|
||||
rv = ep_detach(self, flags);
|
||||
if (rv != 0)
|
||||
return (rv);
|
||||
|
|
Loading…
Reference in New Issue