From owner-freebsd-bugs Wed Sep 2 10:10:13 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id KAA25072 for freebsd-bugs-outgoing; Wed, 2 Sep 1998 10:10:13 -0700 (PDT) (envelope-from owner-freebsd-bugs@FreeBSD.ORG) Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id KAA24998 for ; Wed, 2 Sep 1998 10:10:06 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.8.8/8.8.5) id KAA08445; Wed, 2 Sep 1998 10:10:00 -0700 (PDT) Received: from quack.kfu.com (quack.kfu.com [170.1.70.2]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id KAA24592 for ; Wed, 2 Sep 1998 10:06:44 -0700 (PDT) (envelope-from nsayer@quack.kfu.com) Received: (from nsayer@localhost) by quack.kfu.com (8.8.7/8.8.5) id KAA24303; Wed, 2 Sep 1998 10:05:43 -0700 (PDT) Message-Id: <199809021705.KAA24303@quack.kfu.com> Date: Wed, 2 Sep 1998 10:05:43 -0700 (PDT) From: Nick Sayer Reply-To: nsayer@quack.kfu.com To: FreeBSD-gnats-submit@FreeBSD.ORG X-Send-Pr-Version: 3.2 Subject: kern/7812: APM machines should attempt to power down at halt Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 7812 >Category: kern >Synopsis: APM machines should attempt to power down at halt >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Wed Sep 2 10:10:00 PDT 1998 >Last-Modified: >Originator: Nick Sayer >Organization: Just me >Release: FreeBSD 2.2.7-RELEASE i386 >Environment: >Description: Some laptops and ATX machines can power themselves off under APM control. When such machines are halted, they should at least try to power themselves off if APM events are enabled. If the attempt fails, this code will fall through to the traditional 'press any key to reboot' prompt. >How-To-Repeat: >Fix: --- apm.c- Mon Jul 6 22:22:36 1998 +++ apm.c Wed Sep 2 10:00:07 1998 @@ -24,6 +24,7 @@ #include #endif /*DEVFS*/ #include +#include #include #include #include @@ -38,6 +39,7 @@ static int apm_display __P((int newstate)); static int apm_int __P((u_long *eax, u_long *ebx, u_long *ecx)); static void apm_resume __P((void)); +static void apm_powerdown __P((int howlong,void *ignore)); /* static data */ struct apm_softc { @@ -408,6 +410,23 @@ apm_execute_hook(hook[APM_HOOK_RESUME]); } +/* + * Some latops and ATX machines can power themselves off. + */ +void +apm_powerdown(int howto, void *ignore) +{ + u_long eax, ebx, ecx; + + if (howto & RB_HALT) + { + eax = (APM_BIOS << 8) | APM_SETPWSTATE; + ebx = PMDV_ALLDEV; + ecx = PMST_OFF; + + apm_int(&eax, &ebx, &ecx); /* ignore errors */ + } +} /* get APM information */ static int @@ -511,6 +530,7 @@ if (sc->initialized) { sc->active = 1; apm_timeout(sc); + at_shutdown(apm_powerdown,NULL,SHUTDOWN_POST_SYNC); } } @@ -526,6 +546,7 @@ if (sc->initialized) { untimeout(apm_timeout, NULL); sc->active = 0; + rm_at_shutdown(apm_powerdown,NULL); } } >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message