Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src Add new powerhook argument values, PWR_SOFTSUSPEND, PWR_SOFT...
details: https://anonhg.NetBSD.org/src/rev/f2a681145b86
branches: trunk
changeset: 499666:f2a681145b86
user: takemura <takemura%NetBSD.org@localhost>
date: Sun Nov 26 11:08:57 2000 +0000
description:
Add new powerhook argument values, PWR_SOFTSUSPEND, PWR_SOFTSTANDBY and
PWR_SOFTRESUME. Apm calls powerhook with the values in normal interrupt
priority level while others are protected with splhigh().
diffstat:
share/man/man9/powerhook_establish.9 | 8 +++++++-
sys/arch/i386/i386/apm.c | 8 +++++++-
sys/dev/ic/awi.c | 20 ++++++++++++++------
sys/dev/ic/i82557.c | 14 +++++++++++---
sys/dev/ic/rtl81x9.c | 22 ++++++++++++++++------
sys/dev/ic/tulip.c | 22 ++++++++++++++++------
sys/dev/ieee1394/fwohci.c | 14 +++++++++++---
sys/dev/isa/ym.c | 15 ++++++++++++---
sys/dev/pci/cs4280.c | 14 +++++++++++---
sys/dev/usb/uhci.c | 14 +++++++++++---
sys/kern/kern_subr.c | 4 ++--
sys/sys/systm.h | 11 +++++++----
12 files changed, 125 insertions(+), 41 deletions(-)
diffs (truncated from 404 to 300 lines):
diff -r 28b5f3455aa9 -r f2a681145b86 share/man/man9/powerhook_establish.9
--- a/share/man/man9/powerhook_establish.9 Sun Nov 26 08:33:43 2000 +0000
+++ b/share/man/man9/powerhook_establish.9 Sun Nov 26 11:08:57 2000 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: powerhook_establish.9,v 1.1 1999/12/06 14:50:02 augustss Exp $
+.\" $NetBSD: powerhook_establish.9,v 1.2 2000/11/26 11:09:00 takemura Exp $
.\"
.\" Copyright (c) 1999 The NetBSD Foundation, Inc.
.\" All rights reserved.
@@ -80,10 +80,16 @@
resume. The reason is reflected in the
.Fa why
argument and the values
+.Dv PWR_SOFTSUSPEND ,
.Dv PWR_SUSPEND ,
+.Dv PWR_SOFTSTANDBY ,
.Dv PWR_STANDBY ,
+.Dv PWR_SOFTRESUME ,
and
.Dv PWR_RESUME .
+It calls with PWR_SOFTxxx in the normal priority level while the other
+callings are protected with
+.Xr splhigh 9 .
At suspend the system is going to lose (almost) all power, standby retains
some power (e.g., minimal power to USB devices), and at resume power is
back to normal.
diff -r 28b5f3455aa9 -r f2a681145b86 sys/arch/i386/i386/apm.c
--- a/sys/arch/i386/i386/apm.c Sun Nov 26 08:33:43 2000 +0000
+++ b/sys/arch/i386/i386/apm.c Sun Nov 26 11:08:57 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: apm.c,v 1.55 2000/11/15 01:59:35 enami Exp $ */
+/* $NetBSD: apm.c,v 1.56 2000/11/26 11:08:57 takemura Exp $ */
/*-
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -401,6 +401,8 @@
}
sc->sc_power_state = PWR_SUSPEND;
+ dopowerhooks(PWR_SOFTSUSPEND);
+
apm_spl = splhigh();
dopowerhooks(PWR_SUSPEND);
@@ -423,6 +425,8 @@
}
sc->sc_power_state = PWR_STANDBY;
+ dopowerhooks(PWR_SOFTSTANDBY);
+
apm_spl = splhigh();
dopowerhooks(PWR_STANDBY);
@@ -456,6 +460,8 @@
splx(apm_spl);
+ dopowerhooks(PWR_SOFTRESUME);
+
apm_record_event(sc, regs->BX);
}
diff -r 28b5f3455aa9 -r f2a681145b86 sys/dev/ic/awi.c
--- a/sys/dev/ic/awi.c Sun Nov 26 08:33:43 2000 +0000
+++ b/sys/dev/ic/awi.c Sun Nov 26 11:08:57 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: awi.c,v 1.27 2000/11/15 01:02:15 thorpej Exp $ */
+/* $NetBSD: awi.c,v 1.28 2000/11/26 11:08:57 takemura Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -429,14 +429,22 @@
ocansleep = sc->sc_cansleep;
sc->sc_cansleep = 0;
#ifdef needtobefixed /*ONOE*/
- if (why == PWR_RESUME) {
+ switch (why) {
+ case PWR_SUSPEND:
+ case PWR_STANDBY:
+ awi_stop(sc);
+ if (sc->sc_disable)
+ (*sc->sc_disable)(sc);
+ break;
+ case PWR_RESUME:
sc->sc_enabled = 0;
awi_init(sc);
(void)awi_intr(sc);
- } else {
- awi_stop(sc);
- if (sc->sc_disable)
- (*sc->sc_disable)(sc);
+ break;
+ case PWR_SOFTSUSPEND:
+ case PWR_SOFTSTANDBY:
+ case PWR_SOFTRESUME:
+ break;
}
#endif
sc->sc_cansleep = ocansleep;
diff -r 28b5f3455aa9 -r f2a681145b86 sys/dev/ic/i82557.c
--- a/sys/dev/ic/i82557.c Sun Nov 26 08:33:43 2000 +0000
+++ b/sys/dev/ic/i82557.c Sun Nov 26 11:08:57 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: i82557.c,v 1.41 2000/11/15 01:02:16 thorpej Exp $ */
+/* $NetBSD: i82557.c,v 1.42 2000/11/26 11:08:58 takemura Exp $ */
/*-
* Copyright (c) 1997, 1998, 1999 The NetBSD Foundation, Inc.
@@ -476,11 +476,19 @@
int s;
s = splnet();
- if (why != PWR_RESUME)
+ switch (why) {
+ case PWR_SUSPEND:
+ case PWR_STANDBY:
fxp_stop(ifp, 0);
- else {
+ break;
+ case PWR_RESUME:
if (ifp->if_flags & IFF_UP)
fxp_init(ifp);
+ break;
+ case PWR_SOFTSUSPEND:
+ case PWR_SOFTSTANDBY:
+ case PWR_SOFTRESUME:
+ break;
}
splx(s);
}
diff -r 28b5f3455aa9 -r f2a681145b86 sys/dev/ic/rtl81x9.c
--- a/sys/dev/ic/rtl81x9.c Sun Nov 26 08:33:43 2000 +0000
+++ b/sys/dev/ic/rtl81x9.c Sun Nov 26 11:08:57 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rtl81x9.c,v 1.18 2000/11/15 01:02:17 thorpej Exp $ */
+/* $NetBSD: rtl81x9.c,v 1.19 2000/11/26 11:08:58 takemura Exp $ */
/*
* Copyright (c) 1997, 1998
@@ -931,14 +931,24 @@
int s;
s = splnet();
- if (why != PWR_RESUME) {
+ switch (why) {
+ case PWR_SUSPEND:
+ case PWR_STANDBY:
rtk_stop(ifp, 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);
- rtk_init(ifp);
+ break;
+ case PWR_RESUME:
+ if (ifp->if_flags & IFF_UP) {
+ if (sc->sc_power != NULL)
+ (*sc->sc_power)(sc, why);
+ rtk_init(ifp);
+ }
+ break;
+ case PWR_SOFTSUSPEND:
+ case PWR_SOFTSTANDBY:
+ case PWR_SOFTRESUME:
+ break;
}
splx(s);
diff -r 28b5f3455aa9 -r f2a681145b86 sys/dev/ic/tulip.c
--- a/sys/dev/ic/tulip.c Sun Nov 26 08:33:43 2000 +0000
+++ b/sys/dev/ic/tulip.c Sun Nov 26 11:08:57 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tulip.c,v 1.81 2000/11/15 01:02:17 thorpej Exp $ */
+/* $NetBSD: tulip.c,v 1.82 2000/11/26 11:08:58 takemura Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
@@ -1953,14 +1953,24 @@
int s;
s = splnet();
- if (why != PWR_RESUME) {
+ switch (why) {
+ case PWR_SUSPEND:
+ case PWR_STANDBY:
tlp_stop(ifp, 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(ifp);
+ break;
+ case PWR_RESUME:
+ if (ifp->if_flags & IFF_UP) {
+ if (sc->sc_power != NULL)
+ (*sc->sc_power)(sc, why);
+ tlp_init(ifp);
+ }
+ break;
+ case PWR_SOFTSUSPEND:
+ case PWR_SOFTSTANDBY:
+ case PWR_SOFTRESUME:
+ break;
}
splx(s);
}
diff -r 28b5f3455aa9 -r f2a681145b86 sys/dev/ieee1394/fwohci.c
--- a/sys/dev/ieee1394/fwohci.c Sun Nov 26 08:33:43 2000 +0000
+++ b/sys/dev/ieee1394/fwohci.c Sun Nov 26 11:08:57 2000 +0000
@@ -576,11 +576,19 @@
int s;
s = splimp();
- if (why == PWR_RESUME) {
+ switch (why) {
+ case PWR_SUSPEND:
+ case PWR_STANDBY:
+ fwohci_shutdown(sc);
+ break;
+ case PWR_RESUME:
fwohci_hw_init(sc);
fwohci_phy_busreset(sc);
- } else {
- fwohci_shutdown(sc);
+ break;
+ case PWR_SOFTSUSPEND:
+ case PWR_SOFTSTANDBY:
+ case PWR_SOFTRESUME:
+ break;
}
splx(s);
}
diff -r 28b5f3455aa9 -r f2a681145b86 sys/dev/isa/ym.c
--- a/sys/dev/isa/ym.c Sun Nov 26 08:33:43 2000 +0000
+++ b/sys/dev/isa/ym.c Sun Nov 26 11:08:57 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ym.c,v 1.16 2000/09/04 00:57:17 itohy Exp $ */
+/* $NetBSD: ym.c,v 1.17 2000/11/26 11:08:59 takemura Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -1054,7 +1054,9 @@
s = splaudio();
- if (why != PWR_RESUME) {
+ switch (why) {
+ case PWR_SUSPEND:
+ case PWR_STANDBY:
/*
* suspending...
*/
@@ -1078,7 +1080,9 @@
sc->sc_sa3_scan[SA3_PWR_MNG] = ym_read(sc, SA3_PWR_MNG);
if (sc->sc_on_blocks)
ym_chip_powerdown(sc);
- } else {
+ break;
+
+ case PWR_RESUME:
/*
* resuming...
*/
@@ -1099,6 +1103,11 @@
/* Restore global/digital power-down state. */
ym_write(sc, SA3_PWR_MNG, sc->sc_sa3_scan[SA3_PWR_MNG]);
ym_write(sc, SA3_DPWRDWN, sc->sc_sa3_scan[SA3_DPWRDWN]);
+ break;
+ case PWR_SOFTSUSPEND:
+ case PWR_SOFTSTANDBY:
+ case PWR_SOFTRESUME:
+ break;
}
splx(s);
}
diff -r 28b5f3455aa9 -r f2a681145b86 sys/dev/pci/cs4280.c
--- a/sys/dev/pci/cs4280.c Sun Nov 26 08:33:43 2000 +0000
+++ b/sys/dev/pci/cs4280.c Sun Nov 26 11:08:57 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cs4280.c,v 1.7 2000/09/20 14:33:48 augustss Exp $ */
+/* $NetBSD: cs4280.c,v 1.8 2000/11/26 11:08:59 takemura Exp $ */
/*
* Copyright (c) 1999, 2000 Tatoku Ogaito. All rights reserved.
@@ -1787,7 +1787,9 @@
DPRINTF(("%s: cs4280_power why=%d\n",
sc->sc_dev.dv_xname, why));
- if (why != PWR_RESUME) {
+ switch (why) {
+ case PWR_SUSPEND:
+ case PWR_STANDBY:
sc->sc_suspend = why;
cs4280_halt_output(sc);
@@ -1800,7 +1802,8 @@
}
/* should I powerdown here ? */
Home |
Main Index |
Thread Index |
Old Index