apm.c (49789) | apm.c (50107) |
---|---|
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.98 1999/08/02 18:46:34 msmith Exp $ | 18 * $Id: apm.c,v 1.99 1999/08/14 18:39:40 iwasaki Exp $ |
19 */ 20 21#include "opt_devfs.h" 22 23#include <sys/param.h> 24#include <sys/systm.h> | 19 */ 20 21#include "opt_devfs.h" 22 23#include <sys/param.h> 24#include <sys/systm.h> |
25#include <sys/eventhandler.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/time.h> 31#include <sys/reboot.h> 32#include <sys/bus.h> --- 264 unchanged lines hidden (view full) --- 297 } 298 return 0; 299} 300 301/* 302 * Turn off the entire system. 303 */ 304static void | 26#include <sys/conf.h> 27#include <sys/kernel.h> 28#ifdef DEVFS 29#include <sys/devfsext.h> 30#endif /*DEVFS*/ 31#include <sys/time.h> 32#include <sys/reboot.h> 33#include <sys/bus.h> --- 264 unchanged lines hidden (view full) --- 298 } 299 return 0; 300} 301 302/* 303 * Turn off the entire system. 304 */ 305static void |
305apm_power_off(int howto, void *junk) | 306apm_power_off(void *junk, int howto) |
306{ 307 struct apm_softc *sc = &apm_softc; 308 309 /* Not halting powering off, or not active */ 310 if (!(howto & RB_POWEROFF) || !apm_softc.active) 311 return; 312 sc->bios.r.eax = (APM_BIOS << 8) | APM_SETPWSTATE; 313 sc->bios.r.ebx = PMDV_ALLDEV; --- 728 unchanged lines hidden (view full) --- 1042 sc->sc_resume.ah_arg = sc; 1043 sc->sc_resume.ah_name = "default resume"; 1044 sc->sc_resume.ah_order = APM_MIN_ORDER; 1045 1046 apm_hook_establish(APM_HOOK_SUSPEND, &sc->sc_suspend); 1047 apm_hook_establish(APM_HOOK_RESUME , &sc->sc_resume); 1048 1049 /* Power the system off using APM */ | 307{ 308 struct apm_softc *sc = &apm_softc; 309 310 /* Not halting powering off, or not active */ 311 if (!(howto & RB_POWEROFF) || !apm_softc.active) 312 return; 313 sc->bios.r.eax = (APM_BIOS << 8) | APM_SETPWSTATE; 314 sc->bios.r.ebx = PMDV_ALLDEV; --- 728 unchanged lines hidden (view full) --- 1043 sc->sc_resume.ah_arg = sc; 1044 sc->sc_resume.ah_name = "default resume"; 1045 sc->sc_resume.ah_order = APM_MIN_ORDER; 1046 1047 apm_hook_establish(APM_HOOK_SUSPEND, &sc->sc_suspend); 1048 apm_hook_establish(APM_HOOK_RESUME , &sc->sc_resume); 1049 1050 /* Power the system off using APM */ |
1050 at_shutdown_pri(apm_power_off, NULL, SHUTDOWN_FINAL, SHUTDOWN_PRI_LAST); | 1051 EVENTHANDLER_REGISTER(shutdown_final, apm_power_off, NULL, 1052 SHUTDOWN_PRI_LAST); |
1051 1052 sc->initialized = 1; 1053 1054#ifdef DEVFS 1055 sc->sc_devfs_token = 1056 devfs_add_devswf(&apm_cdevsw, 0, DV_CHR, 0, 0, 0600, "apm"); 1057#endif 1058 return 0; --- 255 unchanged lines hidden --- | 1053 1054 sc->initialized = 1; 1055 1056#ifdef DEVFS 1057 sc->sc_devfs_token = 1058 devfs_add_devswf(&apm_cdevsw, 0, DV_CHR, 0, 0, 0600, "apm"); 1059#endif 1060 return 0; --- 255 unchanged lines hidden --- |