From 1413ef1d07ad62f14d3cbbbead95a5f359b83124 Mon Sep 17 00:00:00 2001 From: cgd Date: Wed, 6 Nov 1996 18:09:43 +0000 Subject: [PATCH] Add an APM_NO_STANDBY option, which can be enabled by people whose BIOSes do the wrong thing with standby mode (as some older ThinkPAD 701c BIOSes do, for example.) Rename APM_NOIDLE to APM_NO_IDLE for consistency and "niceness," and error out (with a useful error message) if APM_NOIDLE is defined. --- sys/arch/i386/i386/apm.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/sys/arch/i386/i386/apm.c b/sys/arch/i386/i386/apm.c index 640dc28d6c6d..6d8414295ca3 100644 --- a/sys/arch/i386/i386/apm.c +++ b/sys/arch/i386/i386/apm.c @@ -1,4 +1,4 @@ -/* $NetBSD: apm.c,v 1.13 1996/11/04 23:04:45 jtc Exp $ */ +/* $NetBSD: apm.c,v 1.14 1996/11/06 18:09:43 cgd Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -41,6 +41,10 @@ #error only one APM device may be configured #endif +#ifdef APM_NOIDLE +#error APM_NOIDLE option deprecated; use APM_NO_IDLE instead +#endif + #include #include #include @@ -350,18 +354,22 @@ struct apmregs *regs; case APM_USER_STANDBY_REQ: DPRINTF(("user wants STANDBY--fat chance\n")); (void) apm_set_powstate(APM_DEV_ALLDEVS, APM_LASTREQ_REJECTED); +#ifndef APM_NO_STANDBY (void) apm_record_event(sc, regs->bx); apm_userstandbys++; +#endif break; case APM_STANDBY_REQ: DPRINTF(("standby requested\n")); if (apm_standbys || apm_suspends) DPRINTF(("damn fool BIOS did not wait for answer\n")); +#ifndef APM_NO_STANDBY if (apm_record_event(sc, regs->bx)) { (void) apm_set_powstate(APM_DEV_ALLDEVS, APM_LASTREQ_INPROG); apm_standbys++; } else +#endif (void) apm_set_powstate(APM_DEV_ALLDEVS, APM_LASTREQ_REJECTED); break; @@ -443,6 +451,7 @@ void *arg; { struct apmregs regs; struct apm_softc *sc = arg; + while (apm_get_event(®s) == 0 && !apm_damn_fool_bios) { apm_event_handle(sc, ®s); }; @@ -524,7 +533,7 @@ u_int dev, state; return 0; } -#ifdef APM_NOIDLE +#ifdef APM_NO_IDLE int apmidleon = 0; #else int apmidleon = 1; @@ -1011,11 +1020,13 @@ apmioctl(dev, cmd, data, flag, p) switch (cmd) { /* some ioctl names from linux */ +#ifndef APM_NO_STANDBY case APM_IOC_STANDBY: if ((flag & FWRITE) == 0) return EBADF; apm_userstandbys++; return 0; +#endif case APM_IOC_SUSPEND: if ((flag & FWRITE) == 0) return EBADF;