summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--etc/etc.i386/sysctl.conf1
-rw-r--r--sbin/reboot/reboot.813
-rw-r--r--sbin/shutdown/shutdown.813
-rw-r--r--sbin/sysctl/sysctl.83
-rw-r--r--sys/arch/i386/i386/machdep.c23
-rw-r--r--sys/arch/i386/include/cpu.h7
6 files changed, 50 insertions, 10 deletions
diff --git a/etc/etc.i386/sysctl.conf b/etc/etc.i386/sysctl.conf
index 8e96d662af2..4cdc72ebf1e 100644
--- a/etc/etc.i386/sysctl.conf
+++ b/etc/etc.i386/sysctl.conf
@@ -1,3 +1,4 @@
#machdep.allowaperture=1 # 1=permit access to aperture driver (XFree86)
#machdep.apmwarn=10 # battery % when apm status messages enabled
+#machdep.apmhalt=0 # 1=powerdown hack, try if halt -p doesn't work
#machdep.kbdreset=1 # permit console CTRL-ALT-DEL to do a nice halt
diff --git a/sbin/reboot/reboot.8 b/sbin/reboot/reboot.8
index cded0f1b4d2..eb8c5a1443a 100644
--- a/sbin/reboot/reboot.8
+++ b/sbin/reboot/reboot.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: reboot.8,v 1.19 2000/11/09 03:57:33 deraadt Exp $
+.\" $OpenBSD: reboot.8,v 1.20 2001/01/05 04:27:23 marc Exp $
.\" $NetBSD: reboot.8,v 1.3 1995/10/05 05:36:21 mycroft Exp $
.\"
.\" Copyright (c) 1990, 1991, 1993
@@ -81,6 +81,13 @@ This option should probably not be used.
Causes the system to power down, if it is being halted, and the
hardware supports automatic power down.
(Currently supported on some i386, sparc, and mac68k platforms.)
+.Sy Note :
+If this option does not work on your i386 machine try setting
+.Li machdep.apmhalt
+to the value 1 using
+.Xr sysctl 8 .
+This can be set at boot time in
+.Pa sysctl.conf .
.El
.Pp
Normally, the
@@ -93,6 +100,7 @@ users advance warning of their impending doom.
script which is run at shutdown time
.El
.Sh SEE ALSO
+.Xr sysctl.conf 5 ,
.Xr utmp 5 ,
.Xr boot 8 ,
.Xr rc.shutdown 8 ,
@@ -108,7 +116,8 @@ script which is run at shutdown time
.Xr boot_powerpc 8 ,
.Xr boot_sparc 8 ,
.Xr boot_sun3 8 ,
-.Xr boot_vax 8
+.Xr boot_vax 8 ,
+.Xr sysctl 8
.Sh HISTORY
A
.Nm reboot
diff --git a/sbin/shutdown/shutdown.8 b/sbin/shutdown/shutdown.8
index 95dd35dd1e7..dc4dfbd9ed2 100644
--- a/sbin/shutdown/shutdown.8
+++ b/sbin/shutdown/shutdown.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: shutdown.8,v 1.21 2000/11/09 17:53:07 aaron Exp $
+.\" $OpenBSD: shutdown.8,v 1.22 2001/01/05 04:27:23 marc Exp $
.\" $NetBSD: shutdown.8,v 1.6 1995/03/18 15:01:07 cgd Exp $
.\"
.\" Copyright (c) 1988, 1991, 1993
@@ -79,6 +79,13 @@ when
.Nm
execs
.Xr halt 8 .
+.Sy Note :
+If this option does not work on your i386 machine try setting
+.Li machdep.apmhalt
+to the value 1 using
+.Xr sysctl 8 .
+This can be set at boot time in
+.Pa sysctl.conf .
.It Fl k
Kick everybody off.
The
@@ -177,9 +184,11 @@ before the system is shutdown
.Sh SEE ALSO
.Xr login 1 ,
.Xr wall 1 ,
+.Xr sysctl.conf 5 ,
.Xr halt 8 ,
.Xr reboot 8 ,
-.Xr rc.shutdown 8
+.Xr rc.shutdown 8 ,
+.Xr sysctl 8
.Sh COMPATIBILITY
The hours and minutes in the second time format may be separated by
a colon
diff --git a/sbin/sysctl/sysctl.8 b/sbin/sysctl/sysctl.8
index 85d2190544d..52885b7186f 100644
--- a/sbin/sysctl/sysctl.8
+++ b/sbin/sysctl/sysctl.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: sysctl.8,v 1.59 2001/01/04 07:50:33 angelos Exp $
+.\" $OpenBSD: sysctl.8,v 1.60 2001/01/05 04:27:23 marc Exp $
.\" $NetBSD: sysctl.8,v 1.4 1995/09/30 07:12:49 thorpej Exp $
.\"
.\" Copyright (c) 1993
@@ -248,6 +248,7 @@ privilege can change the value.
.It hw.pagesize integer no
.It machdep.console_device dev_t no
.It machdep.apmwarn integer yes (i386 only)
+.It machdep.apmhalt integer yes (i386 only)
.It machdep.kbdreset integer yes (i386 only)
.It machdep.allowaperture integer yes (i386 only, XFree86)
.It machdep.led_blink integer yes (sparc only)
diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c
index abf5af39ee2..188383cc884 100644
--- a/sys/arch/i386/i386/machdep.c
+++ b/sys/arch/i386/i386/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.140 2000/11/16 19:10:58 millert Exp $ */
+/* $OpenBSD: machdep.c,v 1.141 2001/01/05 04:27:23 marc Exp $ */
/* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */
/*-
@@ -194,6 +194,10 @@ char machine_arch[] = "i386"; /* machine == machine_arch */
/*
* Declare these as initialized data so we can patch them.
*/
+#if NAPM > 0
+int cpu_apmhalt = 0; /* sysctl'd to 1 for halt -p hack */
+#endif
+
int nswbuf = 0;
#ifdef NBUF
int nbuf = NBUF;
@@ -1530,8 +1534,19 @@ haltsys:
* try to turn the system off.
*/
delay(500000);
- apm_set_powstate(APM_DEV_DISK(0xff), APM_SYS_OFF);
- delay(500000);
+ /*
+ * It's been reported that the following bit of code
+ * is required on most systems <mickey@openbsd.org>
+ * but cause powerdown problem on other systems
+ * <smcho@tsp.korea.ac.kr>. Use sysctl to set
+ * apmhalt to a non-zero value to skip the offending
+ * code.
+ */
+ if (!cpu_apmhalt) {
+ apm_set_powstate(APM_DEV_DISK(0xff),
+ APM_SYS_OFF);
+ delay(500000);
+ }
rv = apm_set_powstate(APM_DEV_DISK(0xff), APM_SYS_OFF);
if (rv == 0 || rv == ENXIO) {
delay(500000);
@@ -2312,6 +2327,8 @@ cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
#if NAPM > 0
case CPU_APMWARN:
return (sysctl_int(oldp, oldlenp, newp, newlen, &cpu_apmwarn));
+ case CPU_APMHALT:
+ return (sysctl_int(oldp, oldlenp, newp, newlen, &cpu_apmhalt));
#endif
case CPU_KBDRESET:
if (securelevel > 0)
diff --git a/sys/arch/i386/include/cpu.h b/sys/arch/i386/include/cpu.h
index f8590e25c2c..396b54d193a 100644
--- a/sys/arch/i386/include/cpu.h
+++ b/sys/arch/i386/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.31 2000/08/02 14:09:59 deraadt Exp $ */
+/* $OpenBSD: cpu.h,v 1.32 2001/01/05 04:27:24 marc Exp $ */
/* $NetBSD: cpu.h,v 1.35 1996/05/05 19:29:26 christos Exp $ */
/*-
@@ -159,6 +159,7 @@ extern int cpu;
extern int cpu_class;
extern int cpu_feature;
extern int cpu_apmwarn;
+extern int cpu_apmhalt;
extern int cpuid_level;
extern struct cpu_nocpuid_nameclass i386_nocpuid_cpus[];
extern struct cpu_cpuid_nameclass i386_cpuid_cpus[];
@@ -255,7 +256,8 @@ void setconf __P((void));
#define CPU_CPUFEATURE 8 /* cpuid features */
#define CPU_APMWARN 9 /* APM battery warning percentage */
#define CPU_KBDRESET 10 /* keyboard reset under pcvt */
-#define CPU_MAXID 11 /* number of valid machdep ids */
+#define CPU_APMHALT 11 /* halt -p hack */
+#define CPU_MAXID 12 /* number of valid machdep ids */
#define CTL_MACHDEP_NAMES { \
{ 0, 0 }, \
@@ -269,6 +271,7 @@ void setconf __P((void));
{ "cpufeature", CTLTYPE_INT }, \
{ "apmwarn", CTLTYPE_INT }, \
{ "kbdreset", CTLTYPE_INT }, \
+ { "apmhalt", CTLTYPE_INT }, \
}
#endif /* !_I386_CPU_H_ */