diff options
author | asmodai <asmodai@FreeBSD.org> | 2000-01-23 09:52:09 +0000 |
---|---|---|
committer | asmodai <asmodai@FreeBSD.org> | 2000-01-23 09:52:09 +0000 |
commit | 284564d99ac726dfc9a2fab4729a7f59e90be2a9 (patch) | |
tree | e6e0429e3a8301433040a3a12b4ee1e57a5c4893 /usr.sbin/apmconf | |
parent | 027d4f13842dfa50fa1f4c9056659cc535165464 (diff) | |
download | FreeBSD-src-284564d99ac726dfc9a2fab4729a7f59e90be2a9.zip FreeBSD-src-284564d99ac726dfc9a2fab4729a7f59e90be2a9.tar.gz |
Bury apmconf, apm succeeds it.
Suggested by: msmith
Diffstat (limited to 'usr.sbin/apmconf')
-rw-r--r-- | usr.sbin/apmconf/Makefile | 5 | ||||
-rw-r--r-- | usr.sbin/apmconf/apmconf.8 | 61 | ||||
-rw-r--r-- | usr.sbin/apmconf/apmconf.c | 145 |
3 files changed, 0 insertions, 211 deletions
diff --git a/usr.sbin/apmconf/Makefile b/usr.sbin/apmconf/Makefile deleted file mode 100644 index b451367..0000000 --- a/usr.sbin/apmconf/Makefile +++ /dev/null @@ -1,5 +0,0 @@ - -PROG= apmconf -MAN8= apmconf.8 - -.include <bsd.prog.mk> diff --git a/usr.sbin/apmconf/apmconf.8 b/usr.sbin/apmconf/apmconf.8 deleted file mode 100644 index 249011b..0000000 --- a/usr.sbin/apmconf/apmconf.8 +++ /dev/null @@ -1,61 +0,0 @@ -.\" Copyright (c) 1994 by Tatsumi Hosokawa <hosokawa@jp.FreeBSD.org> -.\" -.\" 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 -.\" -.\" $FreeBSD$ -.\" -.\" 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 AUTHORS -.An Tatsumi Hosokawa Aq hosokawa@jp.FreeBSD.org diff --git a/usr.sbin/apmconf/apmconf.c b/usr.sbin/apmconf/apmconf.c deleted file mode 100644 index 0ce0720..0000000 --- a/usr.sbin/apmconf/apmconf.c +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Copyright (C) 1994 by Tatsumi Hosokawa <hosokawa@jp.FreeBSD.org> - * - * This software may be used, modified, copied, distributed, and sold, - * 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. - * - * Sep., 1994 Implemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD) - */ - -#ifndef lint -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -#include <err.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <sys/file.h> -#include <sys/ioctl.h> -#include <machine/apm_bios.h> - -#define APMDEV "/dev/apm" - -static int enable = 0, disable = 0; -static int haltcpu = 0, nothaltcpu = 0; -static int main_argc; -static char **main_argv; - -static void -parse_option(void) -{ - int i, option; - 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 'e': - mode = OPT_ENABLE; - option = 0; - break; - case 'd': - mode = OPT_DISABLE; - option = 0; - break; - case 'h': - mode = OPT_HALTCPU; - option = 0; - break; - case 't': - mode = OPT_NOTHALTCPU; - option = 0; - break; - default: - errx(1, "unknown option '%s'", main_argv[i]); - } - } - if (option) { - if (i == main_argc - 1) - errx(1, "option '%s' needs arguments", main_argv[i]); - optarg = main_argv[++i]; - } - - switch (mode) { - case OPT_ENABLE: - enable = 1; - break; - case OPT_DISABLE: - disable = 1; - break; - case OPT_HALTCPU: - haltcpu = 1; - break; - case OPT_NOTHALTCPU: - nothaltcpu = 1; - break; - case OPT_NONE: - break; - } - } -} - -static void -enable_apm(int dh) -{ - if (ioctl(dh, APMIO_ENABLE, NULL) == -1) - errx(1, "can't ioctl APMIO_ENABLE"); -} - -static void -disable_apm(int dh) -{ - if (ioctl(dh, APMIO_DISABLE, NULL) == -1) - errx(1, "can't ioctl APMIO_DISABLE"); -} - -static void -haltcpu_apm(int dh) -{ - if (ioctl(dh, APMIO_HALTCPU, NULL) == -1) - errx(1, "can't ioctl APMIO_HALTCPU"); -} - -static void -nothaltcpu_apm(int dh) -{ - if (ioctl(dh, APMIO_NOTHALTCPU, NULL) == -1) - errx(1, "can't ioctl APMIO_NOTHALTCPU"); -} - -int -main(int argc, char *argv[]) -{ - int dh; - - main_argc = argc; - main_argv = argv; - if ((dh = open(APMDEV, O_RDWR)) == -1) - errx(1, "can't open '%s'", APMDEV); - parse_option(); - - /* disable operation is executed first */ - if (disable) { - disable_apm(dh); - } - if (haltcpu) { - haltcpu_apm(dh); - } - if (nothaltcpu) { - nothaltcpu_apm(dh); - } - /* enable operation is executed last */ - if (enable) { - enable_apm(dh); - } - return 0; -} |