summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2010-08-27 19:10:59 +0000
committerderaadt <deraadt@openbsd.org>2010-08-27 19:10:59 +0000
commit43e638d42150d4b1700db5da758a0d79cd9c74ac (patch)
treef6f5fec6ecafe5aa0c5ee2507523f8722e0a81b8
parentcaught a small typo while reading the code: senor -> sensor (diff)
downloadwireguard-openbsd-43e638d42150d4b1700db5da758a0d79cd9c74ac.tar.xz
wireguard-openbsd-43e638d42150d4b1700db5da758a0d79cd9c74ac.zip
Run powerhooks with interrupts blocked. This requires a bit of a song and
dance since some laptops unsuspend out of apm with interrupts enabled?! That causes problems with shared interrupts... but also it would be best if we treat powerhook functions (now backed by activate functions) the same as acpi treats them, and it means that the powerhook wrappers don't need to do their own spl protection. ok kettenis
-rw-r--r--sys/arch/i386/i386/apm.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/sys/arch/i386/i386/apm.c b/sys/arch/i386/i386/apm.c
index 7fcb28810c8..62739e48c85 100644
--- a/sys/arch/i386/i386/apm.c
+++ b/sys/arch/i386/i386/apm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: apm.c,v 1.89 2010/08/27 04:09:11 deraadt Exp $ */
+/* $OpenBSD: apm.c,v 1.90 2010/08/27 19:10:59 deraadt Exp $ */
/*-
* Copyright (c) 1998-2001 Michael Shalayeff. All rights reserved.
@@ -317,6 +317,8 @@ apm_power_print(struct apm_softc *sc, struct apmregs *regs)
#endif
}
+int apm_saved_spl;
+
void
apm_suspend()
{
@@ -325,6 +327,8 @@ apm_suspend()
#endif /* NWSDISPLAY > 0 */
bufq_quiesce();
+ apm_saved_spl = splhigh();
+ disable_intr();
dopowerhooks(PWR_SUSPEND);
if (cold)
@@ -341,6 +345,8 @@ apm_standby()
#endif /* NWSDISPLAY > 0 */
bufq_quiesce();
+ apm_saved_spl = splhigh();
+ disable_intr();
dopowerhooks(PWR_SUSPEND);
if (cold)
@@ -356,6 +362,9 @@ apm_resume(struct apm_softc *sc, struct apmregs *regs)
apm_resumes = APM_RESUME_HOLDOFF;
+ /* Some machines resume with interrupts on */
+ disable_intr();
+
/* they say that some machines may require reinitializing the clocks */
i8254_startclock();
if (initclock_func == i8254_initclocks)
@@ -363,7 +372,12 @@ apm_resume(struct apm_softc *sc, struct apmregs *regs)
inittodr(time_second);
/* lower bit in cx means pccard was powered down */
+
dopowerhooks(PWR_RESUME);
+
+ enable_intr();
+ splx(apm_saved_spl);
+
apm_record_event(sc, regs->bx);
/* acknowledge any rtc interrupt we may have missed */