summaryrefslogtreecommitdiff
path: root/sys/arch/i386
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2010-08-27 19:11:00 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2010-08-27 19:11:00 +0000
commit284d5097c3fead45ff30adfa50ee17d9a06667cd (patch)
tree5b914fe840e5de8e87b80bc90eb3c4fa9204c8b5 /sys/arch/i386
parent2649b00e6efed2ae6b0db5a6e3a45272a80d153c (diff)
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
Diffstat (limited to 'sys/arch/i386')
-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 */