From 1b0c7d8f045e292360d8b3b7e0cf000c18ce1cb2 Mon Sep 17 00:00:00 2001 From: Owain Ainsworth Date: Thu, 26 Feb 2009 17:19:48 +0000 Subject: Add a two new ioctls to the apm(4) interface. APM_IOC_{SUSPEND,STANDBY}_REQ: This is to fix an issue with apm suspend where a call to zzz suspended the machine immediately, not giving anyone listening for apm events (other than apmd) a chance to deal with the upcoming change. This hit X hard since the introduction of drm, since it needs to have time to idle the 3d engine and otherwise get the device into a recoverable state. Such things are needed until we support modesetting in the kernel. Now, instead of forcing a suspend, using ioctl sends out an event similar to if you had put the lid down, giving all userland applications a chance to reply. tested by sthen@ and beck@, especial thanks to sthen for sitting there while I tried to debug this remotely, I owe him beer. Prompted by and ok deraadt@ --- sys/arch/amd64/include/apmvar.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'sys/arch/amd64/include') diff --git a/sys/arch/amd64/include/apmvar.h b/sys/arch/amd64/include/apmvar.h index 7be38bb9db4..b8a27a2ab83 100644 --- a/sys/arch/amd64/include/apmvar.h +++ b/sys/arch/amd64/include/apmvar.h @@ -1,5 +1,5 @@ /* XXX - DSR */ -/* $OpenBSD: apmvar.h,v 1.1 2004/01/28 01:39:39 mickey Exp $ */ +/* $OpenBSD: apmvar.h,v 1.2 2009/02/26 17:19:47 oga Exp $ */ /* * Copyright (c) 1995 John T. Kohl @@ -288,6 +288,8 @@ struct apm_ctl { #define APM_PRINT_OFF 1 /* driver power status not displayed */ #define APM_PRINT_PCT 2 /* driver power status only displayed if the percentage changes */ +#define APM_IOC_STANDBY_REQ _IO('A', 7) /* request standby */ +#define APM_IOC_SUSPEND_REQ _IO('A', 8) /* request suspend */ #ifdef _KERNEL extern void apm_cpu_busy(void); -- cgit v1.2.3