summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjason <jason@openbsd.org>2001-08-19 01:45:55 +0000
committerjason <jason@openbsd.org>2001-08-19 01:45:55 +0000
commit4719a6f230a6586f7082e8b47a622fb26fe1e4bb (patch)
treeba0e178f70f06f9f06ff74d70d5b6df5e1253930
parentdeal with -1 from snprintf, if it ever happens (diff)
downloadwireguard-openbsd-4719a6f230a6586f7082e8b47a622fb26fe1e4bb.tar.xz
wireguard-openbsd-4719a6f230a6586f7082e8b47a622fb26fe1e4bb.zip
Add a powerhook for bringing the 556 out of sleepy mode after suspend.
(This isn't perfect... it still requires an down up transition, but Bob is kicking me off his laptop so he can do "Real Work").
-rw-r--r--sys/dev/ic/xl.c25
-rw-r--r--sys/dev/ic/xlreg.h4
2 files changed, 26 insertions, 3 deletions
diff --git a/sys/dev/ic/xl.c b/sys/dev/ic/xl.c
index 54623f5c489..a9971cdd015 100644
--- a/sys/dev/ic/xl.c
+++ b/sys/dev/ic/xl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: xl.c,v 1.28 2001/08/12 20:12:12 mickey Exp $ */
+/* $OpenBSD: xl.c,v 1.29 2001/08/19 01:45:55 jason Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
@@ -196,6 +196,28 @@ int xl_miibus_readreg __P((struct device *, int, int));
void xl_miibus_writereg __P((struct device *, int, int, int));
void xl_miibus_statchg __P((struct device *));
+void xl_power __P((int, void *));
+
+void
+xl_power(why, arg)
+ int why;
+ void *arg;
+{
+ struct xl_softc *sc = arg;
+ struct ifnet *ifp;
+ int s;
+
+ s = splimp();
+ if (why != PWR_RESUME)
+ xl_stop(sc);
+ else {
+ ifp = &sc->arpcom.ac_if;
+ if (ifp->if_flags & IFF_UP)
+ xl_reset(sc, 1);
+ }
+ splx(s);
+}
+
/*
* Murphy's law says that it's possible the chip can wedge and
* the 'command in progress' bit may never clear. Hence, we wait
@@ -2649,6 +2671,7 @@ xl_attach(sc)
ether_ifattach(ifp);
sc->sc_sdhook = shutdownhook_establish(xl_shutdown, sc);
+ sc->sc_pwrhook = powerhook_establish(xl_power, sc);
}
int
diff --git a/sys/dev/ic/xlreg.h b/sys/dev/ic/xlreg.h
index 3749426f22e..3632c16b5fc 100644
--- a/sys/dev/ic/xlreg.h
+++ b/sys/dev/ic/xlreg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: xlreg.h,v 1.8 2000/11/09 17:39:07 mickey Exp $ */
+/* $OpenBSD: xlreg.h,v 1.9 2001/08/19 01:45:55 jason Exp $ */
/*
* Copyright (c) 1997, 1998
@@ -585,7 +585,7 @@ struct xl_softc {
struct xl_chain_data xl_cdata;
int xl_flags;
void (*intr_ack) __P((struct xl_softc *));
- void * sc_sdhook;
+ void * sc_sdhook, *sc_pwrhook;
};
#define xl_rx_goodframes(x) \