diff options
author | phk <phk@FreeBSD.org> | 1994-11-01 22:46:40 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 1994-11-01 22:46:40 +0000 |
commit | 78746675615710e5ad559354cce31bf7f7e3dba1 (patch) | |
tree | 9b7973e6dace2096f3258a313ca64dba0ee4c4ca /usr.sbin/apmconf | |
parent | dcf7506baaa555db6bb633aacabb8788461d51f5 (diff) | |
download | FreeBSD-src-78746675615710e5ad559354cce31bf7f7e3dba1.zip FreeBSD-src-78746675615710e5ad559354cce31bf7f7e3dba1.tar.gz |
The latest user-land changes from the author. I added a big warning to the
apm.4 man-page. I also hope the Makefiles make sense now.
Submitted by: HOSOKAWA Tatsumi
Diffstat (limited to 'usr.sbin/apmconf')
-rw-r--r-- | usr.sbin/apmconf/Makefile | 5 | ||||
-rw-r--r-- | usr.sbin/apmconf/apmconf.8 | 60 | ||||
-rw-r--r-- | usr.sbin/apmconf/apmconf.c | 52 |
3 files changed, 70 insertions, 47 deletions
diff --git a/usr.sbin/apmconf/Makefile b/usr.sbin/apmconf/Makefile index 9cdb007..b451367 100644 --- a/usr.sbin/apmconf/Makefile +++ b/usr.sbin/apmconf/Makefile @@ -1,8 +1,5 @@ -# $Id$ PROG= apmconf -# BINMODE= 550 -# BINOWN= root -NOMAN= 1 +MAN8= apmconf.8 .include <bsd.prog.mk> diff --git a/usr.sbin/apmconf/apmconf.8 b/usr.sbin/apmconf/apmconf.8 new file mode 100644 index 0000000..d49e6de --- /dev/null +++ b/usr.sbin/apmconf/apmconf.8 @@ -0,0 +1,60 @@ +.\" LP (Laptop Package) +.\" +.\" Copyright (c) 1994 by HOSOKAWA, Tatsumi <hosokawa@mt.cs.keio.ac.jp> +.\" +.\" This software may be used, modified, copied, and distributed, in +.\" both source and binary form provided that the above copyright and +.\" these terms are retained. Under no circumstances is the author +.\" responsible for the proper functioning of this software, nor does +.\" the author assume any responsibility for damages incurred with its +.\" use. +.Dd November 1, 1994 +.Dt APMCONF 8 +.Os +.Sh NAME +.Nm apmconf +.Nd configure APM BIOS driver +.Sh SYNOPSIS +.Nm apmconf +.Op Fl e +.Op Fl d +.Op Fl h +.Op Fl t +.Sh DESCRIPTION +.Nm apmconf +is used to configure the APM (Advanced Power Management) BIOS driver +.Xr apm 4 +on laptop PCs. +.Pp +The following options are available. +.Bl -tag -width indent +.It Fl e +Enable power management. +.It Fl d +Disable power management. +.El +.Pp +These options enable/disable power management functions provided by +.Xr apm 4 . +.Bl -tag -width indent +.It Fl h +Enable HLT instruction in kernel context switch routine. +.It Fl t +Disable HLT instruction in kernel context switch routine. +.El +.Pp +These options are not necessary for almost all APM implementations, +but for some implementations whose +.Dq Pa Idle CPU +call executes both CPU clock slowdown and HLT instruction, +.Fl t +is necessary to prevent the system from reducing its peak performance. +See +.Xr apm 4 +for details. +.Sh SEE ALSO +.Xr apm 4 , +.Xr apm 8 , +.Xr zzz 8 +.Sh AUTHOR +HOSOKAWA, Tatsumi <hosokawa@mt.cs.keio.ac.jp> (Keio Univ., Japan) diff --git a/usr.sbin/apmconf/apmconf.c b/usr.sbin/apmconf/apmconf.c index de1aea2..f8886d4 100644 --- a/usr.sbin/apmconf/apmconf.c +++ b/usr.sbin/apmconf/apmconf.c @@ -20,10 +20,8 @@ #include <sys/ioctl.h> #include <machine/apm_bios.h> -#define CONFIGFILE "/etc/apm.conf" -#define APMDEV "/dev/apm" +#define APMDEV "/dev/apm0" -static int verbose = 0; static int enable = 0, disable = 0; static int haltcpu = 0, nothaltcpu = 0; static int main_argc; @@ -34,18 +32,13 @@ parse_option(void) { int i, option; char *optarg; - enum {OPT_NONE, OPT_VERBOSE, - OPT_ENABLE, OPT_DISABLE, OPT_HALTCPU, OPT_NOTHALTCPU} mode; + enum {OPT_NONE, OPT_ENABLE, OPT_DISABLE, OPT_HALTCPU, OPT_NOTHALTCPU} mode; for (i = 1; i < main_argc; i++) { option = 0; mode = OPT_NONE; if (main_argv[i][0] == '-') { switch (main_argv[i][1]) { - case 'v': - mode = OPT_VERBOSE; - option = 0; - break; case 'e': mode = OPT_ENABLE; option = 0; @@ -76,9 +69,6 @@ parse_option(void) } switch (mode) { - case OPT_VERBOSE: - verbose = 1; - break; case OPT_ENABLE: enable = 1; break; @@ -95,44 +85,20 @@ parse_option(void) } } +static struct apm_eqv_event eqv_event[APM_MAX_EQUIV_EVENTS]; static int eqv_num = 0; - -#define PMEV_SYMBOL(name) {#name, name} -#define ARRAY_SIZEOF(array) (sizeof(array) / sizeof(array[0])) - -typedef struct pmev_symbol { - char *name; - int id; -} *pmev_symbol_t; - -static struct pmev_symbol pmev_symbols[] = { - PMEV_SYMBOL(PMEV_NOEVENT), - PMEV_SYMBOL(PMEV_STANDBYREQ), - PMEV_SYMBOL(PMEV_SUSPENDREQ), - PMEV_SYMBOL(PMEV_NORMRESUME), - PMEV_SYMBOL(PMEV_CRITRESUME), - PMEV_SYMBOL(PMEV_BATTERYLOW), - PMEV_SYMBOL(PMEV_POWERSTATECHANGE), - PMEV_SYMBOL(PMEV_UPDATETIME), - PMEV_SYMBOL(PMEV_CRITSUSPEND), - PMEV_SYMBOL(PMEV_USERSTANDBYREQ), - PMEV_SYMBOL(PMEV_USERSUSPENDREQ), - PMEV_SYMBOL(PMEV_STANDBYRESUME), -}; - -static int -pmev(char *name, int *id) +static apm_eqv_event_t +get_eqv_event(int id) { int i; - for (i = 0; i < ARRAY_SIZEOF(pmev_symbols); i++) { - if (strcasecmp(pmev_symbols[i].name, name) == 0) { - *id = pmev_symbols[i].id; - return 0; + for (i = 0; i < eqv_num; i++) { + if (id == eqv_event[i].aee_event) { + return &eqv_event[i]; } } - return 1; + return NULL; } static void |