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.102 1999/08/22 19:51:33 peter Exp $ |
19 */ 20 |
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> |
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]; |
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 |
1126 make_dev(&apm_cdevsw, 0, 0, 0, 0600, "apm"); |
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 --- |