diff options
author | Owain Ainsworth <oga@cvs.openbsd.org> | 2010-03-30 17:40:56 +0000 |
---|---|---|
committer | Owain Ainsworth <oga@cvs.openbsd.org> | 2010-03-30 17:40:56 +0000 |
commit | 17f79ce6ab989e13c40b1b05780f81a5d5f2fe05 (patch) | |
tree | dd13f9c70165296d96946a2c3d66f8b4709ae64c /sys/arch/zaurus | |
parent | f5972d809904e97326ca314c087612469e208db2 (diff) |
Prevent the apmd/x races for good.
When we hit suspend time, go through all wsdisplays on the system. if
they are in mode MAPPED, but not MODE_DUMBFB then if possible do a full
vt switch to a !mapped vt, and prevent switching back until resume time.
This has to be called from MD code because this involves userland
running so that X can run the vt switch signal handler. This way, any
case where we are using the "poke registers from userland" model, we
will not be on the hardware when we go down, so the kernel can actually
handle thing properly.
Tested on several acpi laptops (by kettenis@ and ian@), x40 (me and
beck@ at LEAST) and zaurus (me). Maybe others, but if so I forgot who at
this time..
Idea from deraadt somewhere over the Faroe Islands (I thought of a
similar thing myself a while ago). Much prompting from him. Ok and
comments miod@
Diffstat (limited to 'sys/arch/zaurus')
-rw-r--r-- | sys/arch/zaurus/dev/zaurus_apm.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/sys/arch/zaurus/dev/zaurus_apm.c b/sys/arch/zaurus/dev/zaurus_apm.c index 18049edf1cb..75785f2de6b 100644 --- a/sys/arch/zaurus/dev/zaurus_apm.c +++ b/sys/arch/zaurus/dev/zaurus_apm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: zaurus_apm.c,v 1.13 2006/12/12 23:14:28 dim Exp $ */ +/* $OpenBSD: zaurus_apm.c,v 1.14 2010/03/30 17:40:55 oga Exp $ */ /* * Copyright (c) 2005 Uwe Stuehler <uwe@bsdx.de> @@ -34,6 +34,10 @@ void zssp_init(void); /* XXX */ #include <zaurus/dev/zaurus_apm.h> +#include <dev/wscons/wsdisplayvar.h> + +#include "wsdisplay.h" + #if defined(APMDEBUG) #define DPRINTF(x) printf x #else @@ -637,6 +641,10 @@ zapm_poweroff(void) KASSERT(apm_cd.cd_ndevs > 0 && apm_cd.cd_devs[0] != NULL); sc = apm_cd.cd_devs[0]; +#if NWSDISPLAY > 0 + wsdisplay_suspend(); +#endif /* NWSDISPLAY > 0 */ + dopowerhooks(PWR_SUSPEND); /* XXX enable charging during suspend */ @@ -660,6 +668,10 @@ zapm_poweroff(void) /* NOTREACHED */ dopowerhooks(PWR_RESUME); + +#if NWSDISPLAY > 0 + wsdisplay_resume(); +#endif /* NWSDISPLAY > 0 */ } /* |