From 284d5097c3fead45ff30adfa50ee17d9a06667cd Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Fri, 27 Aug 2010 19:11:00 +0000 Subject: 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 --- sys/arch/i386/i386/apm.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'sys/arch/i386') 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 */ -- cgit v1.2.3