apm.c (50179) | apm.c (50254) |
---|---|
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.101 1999/08/22 14:48:00 iwasaki Exp $ | 18 * $Id: apm.c,v 1.102 1999/08/22 19:51:33 peter Exp $ |
19 */ 20 | 19 */ 20 |
21#include "opt_devfs.h" 22 | |
23#include <sys/param.h> 24#include <sys/systm.h> 25#include <sys/eventhandler.h> 26#include <sys/conf.h> 27#include <sys/kernel.h> | 21#include <sys/param.h> 22#include <sys/systm.h> 23#include <sys/eventhandler.h> 24#include <sys/conf.h> 25#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> 34#include <sys/select.h> 35#include <sys/poll.h> 36#include <sys/fcntl.h> 37#include <sys/proc.h> 38#include <sys/uio.h> --- 35 unchanged lines hidden (view full) --- 74 struct apmhook sc_suspend; 75 struct apmhook sc_resume; 76 struct selinfo sc_rsel; 77 int sc_flags; 78 int event_count; 79 int event_ptr; 80 struct apm_event_info event_list[APM_NEVENTS]; 81 u_char event_filter[APM_NPMEV]; | 26#include <sys/time.h> 27#include <sys/reboot.h> 28#include <sys/bus.h> 29#include <sys/select.h> 30#include <sys/poll.h> 31#include <sys/fcntl.h> 32#include <sys/proc.h> 33#include <sys/uio.h> --- 35 unchanged lines hidden (view full) --- 69 struct apmhook sc_suspend; 70 struct apmhook sc_resume; 71 struct selinfo sc_rsel; 72 int sc_flags; 73 int event_count; 74 int event_ptr; 75 struct apm_event_info event_list[APM_NEVENTS]; 76 u_char event_filter[APM_NPMEV]; |
82#ifdef DEVFS 83 void *sc_devfs_token; 84#endif | |
85}; 86#define SCFLAG_ONORMAL 0x0000001 87#define SCFLAG_OCTL 0x0000002 88#define SCFLAG_OPEN (SCFLAG_ONORMAL|SCFLAG_OCTL) 89 90#define APMDEV(dev) (minor(dev)&0x0f) 91#define APMDEV_NORMAL 0 92#define APMDEV_CTL 8 --- 1033 unchanged lines hidden (view full) --- 1126 apm_hook_establish(APM_HOOK_RESUME , &sc->sc_resume); 1127 1128 /* Power the system off using APM */ 1129 EVENTHANDLER_REGISTER(shutdown_final, apm_power_off, NULL, 1130 SHUTDOWN_PRI_LAST); 1131 1132 sc->initialized = 1; 1133 | 77}; 78#define SCFLAG_ONORMAL 0x0000001 79#define SCFLAG_OCTL 0x0000002 80#define SCFLAG_OPEN (SCFLAG_ONORMAL|SCFLAG_OCTL) 81 82#define APMDEV(dev) (minor(dev)&0x0f) 83#define APMDEV_NORMAL 0 84#define APMDEV_CTL 8 --- 1033 unchanged lines hidden (view full) --- 1118 apm_hook_establish(APM_HOOK_RESUME , &sc->sc_resume); 1119 1120 /* Power the system off using APM */ 1121 EVENTHANDLER_REGISTER(shutdown_final, apm_power_off, NULL, 1122 SHUTDOWN_PRI_LAST); 1123 1124 sc->initialized = 1; 1125 |
1134#ifdef DEVFS 1135 sc->sc_devfs_token = 1136 devfs_add_devswf(&apm_cdevsw, 0, DV_CHR, 0, 0, 0600, "apm"); 1137#endif | 1126 make_dev(&apm_cdevsw, 0, 0, 0, 0600, "apm"); |
1138 return 0; 1139} 1140 1141static int 1142apmopen(dev_t dev, int flag, int fmt, struct proc *p) 1143{ 1144 struct apm_softc *sc = &apm_softc; 1145 int ctl = APMDEV(dev); --- 249 unchanged lines hidden --- | 1127 return 0; 1128} 1129 1130static int 1131apmopen(dev_t dev, int flag, int fmt, struct proc *p) 1132{ 1133 struct apm_softc *sc = &apm_softc; 1134 int ctl = APMDEV(dev); --- 249 unchanged lines hidden --- |