Deleted Added
full compact
apm.c (39704) apm.c (40751)
1/*
2 * APM (Advanced Power Management) BIOS Device Driver
3 *
4 * Copyright (c) 1994 UKAI, Fumitoshi.
5 * Copyright (c) 1994-1995 by HOSOKAWA, Tatsumi <hosokawa@jp.FreeBSD.org>
6 * Copyright (c) 1996 Nate Williams <nate@FreeBSD.org>
7 * Copyright (c) 1997 Poul-Henning Kamp <phk@FreeBSD.org>
8 *
9 * This software may be used, modified, copied, and distributed, in
10 * both source and binary form provided that the above copyright and
11 * these terms are retained. Under no circumstances is the author
12 * responsible for the proper functioning of this software, nor does
13 * the author assume any responsibility for damages incurred with its
14 * use.
15 *
16 * Sep, 1994 Implemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD)
17 *
1/*
2 * APM (Advanced Power Management) BIOS Device Driver
3 *
4 * Copyright (c) 1994 UKAI, Fumitoshi.
5 * Copyright (c) 1994-1995 by HOSOKAWA, Tatsumi <hosokawa@jp.FreeBSD.org>
6 * Copyright (c) 1996 Nate Williams <nate@FreeBSD.org>
7 * Copyright (c) 1997 Poul-Henning Kamp <phk@FreeBSD.org>
8 *
9 * This software may be used, modified, copied, and distributed, in
10 * both source and binary form provided that the above copyright and
11 * these terms are retained. Under no circumstances is the author
12 * responsible for the proper functioning of this software, nor does
13 * the author assume any responsibility for damages incurred with its
14 * use.
15 *
16 * Sep, 1994 Implemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD)
17 *
18 * $Id: apm.c,v 1.73 1998/07/06 06:29:03 imp Exp $
18 * $Id: apm.c,v 1.74 1998/09/28 03:41:12 jlemon Exp $
19 */
20
21#include "opt_devfs.h"
22#include "opt_vm86.h"
23
24#include <sys/param.h>
25#include <sys/conf.h>
26#include <sys/kernel.h>
27#ifdef DEVFS
28#include <sys/devfsext.h>
29#endif /*DEVFS*/
30#include <sys/systm.h>
31#include <sys/time.h>
19 */
20
21#include "opt_devfs.h"
22#include "opt_vm86.h"
23
24#include <sys/param.h>
25#include <sys/conf.h>
26#include <sys/kernel.h>
27#ifdef DEVFS
28#include <sys/devfsext.h>
29#endif /*DEVFS*/
30#include <sys/systm.h>
31#include <sys/time.h>
32#include <sys/reboot.h>
32#include <i386/isa/isa_device.h>
33#include <machine/apm_bios.h>
34#include <machine/segments.h>
35#include <machine/clock.h>
36#include <vm/vm.h>
37#include <vm/vm_param.h>
38#include <vm/pmap.h>
39#include <sys/syslog.h>

--- 200 unchanged lines hidden (view full) ---

240 return 1;
241 }
242 return 0;
243}
244
245/*
246 * Turn off the entire system.
247 */
33#include <i386/isa/isa_device.h>
34#include <machine/apm_bios.h>
35#include <machine/segments.h>
36#include <machine/clock.h>
37#include <vm/vm.h>
38#include <vm/vm_param.h>
39#include <vm/pmap.h>
40#include <sys/syslog.h>

--- 200 unchanged lines hidden (view full) ---

241 return 1;
242 }
243 return 0;
244}
245
246/*
247 * Turn off the entire system.
248 */
248void
249apm_power_off(void)
249static void
250apm_power_off(int howto, void *junk)
250{
251 u_long eax, ebx, ecx, edx;
252
251{
252 u_long eax, ebx, ecx, edx;
253
253 if (!apm_softc.active)
254 /* Not halting, or not active */
255 if (!(howto & RB_HALT) || !apm_softc.active)
254 return;
255 eax = (APM_BIOS << 8) | APM_SETPWSTATE;
256 ebx = PMDV_ALLDEV;
257 ecx = PMST_OFF;
258 edx = 0;
259 apm_int(&eax, &ebx, &ecx, &edx);
260}
261

--- 636 unchanged lines hidden (view full) ---

898 sc->sc_resume.ah_name = "default resume";
899 sc->sc_resume.ah_order = APM_MIN_ORDER;
900
901 apm_hook_establish(APM_HOOK_SUSPEND, &sc->sc_suspend);
902 apm_hook_establish(APM_HOOK_RESUME , &sc->sc_resume);
903
904 apm_event_enable();
905
256 return;
257 eax = (APM_BIOS << 8) | APM_SETPWSTATE;
258 ebx = PMDV_ALLDEV;
259 ecx = PMST_OFF;
260 edx = 0;
261 apm_int(&eax, &ebx, &ecx, &edx);
262}
263

--- 636 unchanged lines hidden (view full) ---

900 sc->sc_resume.ah_name = "default resume";
901 sc->sc_resume.ah_order = APM_MIN_ORDER;
902
903 apm_hook_establish(APM_HOOK_SUSPEND, &sc->sc_suspend);
904 apm_hook_establish(APM_HOOK_RESUME , &sc->sc_resume);
905
906 apm_event_enable();
907
908 /* Power the system off using APM */
909 at_shutdown_pri(apm_power_off, NULL, SHUTDOWN_FINAL, SHUTDOWN_PRI_LAST);
910
906 sc->initialized = 1;
907
908#ifdef DEVFS
909 sc->sc_devfs_token =
910 devfs_add_devswf(&apm_cdevsw, 0, DV_CHR, 0, 0, 0600, "apm");
911#endif
912 return 0;
913}

--- 109 unchanged lines hidden ---
911 sc->initialized = 1;
912
913#ifdef DEVFS
914 sc->sc_devfs_token =
915 devfs_add_devswf(&apm_cdevsw, 0, DV_CHR, 0, 0, 0600, "apm");
916#endif
917 return 0;
918}

--- 109 unchanged lines hidden ---