diff options
author | Brad Smith <brad@cvs.openbsd.org> | 2006-04-05 01:47:39 +0000 |
---|---|---|
committer | Brad Smith <brad@cvs.openbsd.org> | 2006-04-05 01:47:39 +0000 |
commit | ffcec174f0e090fd77e0a727e04a296ff5bc991c (patch) | |
tree | 96bea9eeea9d771c670df46f86295040ea120ca8 /sys/dev/pci | |
parent | 0898160056a31f0981cae42f585dce85844d89b7 (diff) |
add a power hook for bge(4).
From Thordur I. Bjornsson <thib at mi dot is>
Diffstat (limited to 'sys/dev/pci')
-rw-r--r-- | sys/dev/pci/if_bge.c | 24 | ||||
-rw-r--r-- | sys/dev/pci/if_bgereg.h | 4 |
2 files changed, 24 insertions, 4 deletions
diff --git a/sys/dev/pci/if_bge.c b/sys/dev/pci/if_bge.c index 177267bb925..d9aeec8290a 100644 --- a/sys/dev/pci/if_bge.c +++ b/sys/dev/pci/if_bge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bge.c,v 1.139 2006/03/29 02:23:25 brad Exp $ */ +/* $OpenBSD: if_bge.c,v 1.140 2006/04/05 01:47:38 brad Exp $ */ /* * Copyright (c) 2001 Wind River Systems @@ -141,6 +141,7 @@ int bge_intr(void *); void bge_start(struct ifnet *); int bge_ioctl(struct ifnet *, u_long, caddr_t); void bge_init(void *); +void bge_power(int, void *); void bge_stop_block(struct bge_softc *, bus_size_t, u_int32_t); void bge_stop(struct bge_softc *); void bge_watchdog(struct ifnet *); @@ -2019,8 +2020,9 @@ bge_attach(struct device *parent, struct device *self, void *aux) if_attach(ifp); ether_ifattach(ifp); - shutdownhook_establish(bge_shutdown, sc); - + sc->sc_shutdownhook = shutdownhook_establish(bge_shutdown, sc); + sc->sc_powerhook = powerhook_establish(bge_power, sc); + timeout_set(&sc->bge_timeout, bge_tick, sc); return; @@ -3412,3 +3414,19 @@ bge_link_upd(struct bge_softc *sc) BGE_MACSTAT_CFG_CHANGED|BGE_MACSTAT_MI_COMPLETE| BGE_MACSTAT_LINK_CHANGED); } + +void +bge_power(int why, void *xcs) +{ + struct bge_softc *sc = (struct bge_softc *)xcs; + struct ifnet *ifp; + + if (why == PWR_RESUME) { + ifp = &sc->arpcom.ac_if; + if (ifp->if_flags & IFF_UP) { + bge_init(xcs); + if (ifp->if_flags & IFF_RUNNING) + bge_start(ifp); + } + } +} diff --git a/sys/dev/pci/if_bgereg.h b/sys/dev/pci/if_bgereg.h index f552d95daa3..06db0fed51c 100644 --- a/sys/dev/pci/if_bgereg.h +++ b/sys/dev/pci/if_bgereg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bgereg.h,v 1.43 2006/03/10 21:39:01 brad Exp $ */ +/* $OpenBSD: if_bgereg.h,v 1.44 2006/04/05 01:47:38 brad Exp $ */ /* * Copyright (c) 2001 Wind River Systems @@ -2378,6 +2378,8 @@ struct bge_softc { int bge_link; /* link state */ int bge_link_evt; /* pending link event */ struct timeout bge_timeout; + void *sc_powerhook; + void *sc_shutdownhook; u_long bge_rx_discards; u_long bge_tx_discards; u_long bge_tx_collisions; |