summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--etc/etc.landisk/sysctl.conf1
-rw-r--r--etc/etc.loongson/sysctl.conf1
-rw-r--r--etc/etc.palm/sysctl.conf1
-rw-r--r--etc/etc.sgi/sysctl.conf1
-rw-r--r--etc/etc.sparc64/sysctl.conf1
-rw-r--r--etc/etc.zaurus/sysctl.conf1
-rw-r--r--etc/sysctl.conf3
-rw-r--r--sbin/sysctl/sysctl.85
-rw-r--r--share/man/man4/acpibtn.49
-rw-r--r--share/man/man4/man4.landisk/power.411
-rw-r--r--share/man/man4/man4.sgi/power.46
-rw-r--r--share/man/man4/man4.sparc64/power.46
-rw-r--r--share/man/man4/man4.zaurus/zkbd.47
-rw-r--r--share/man/man7/securelevel.79
-rw-r--r--sys/arch/arm/arm/arm32_machdep.c10
-rw-r--r--sys/arch/arm/include/cpu.h6
-rw-r--r--sys/arch/landisk/dev/power.c8
-rw-r--r--sys/arch/landisk/include/cpu.h8
-rw-r--r--sys/arch/landisk/landisk/machdep.c8
-rw-r--r--sys/arch/loongson/loongson/machdep.c7
-rw-r--r--sys/arch/mips64/include/cpu.h6
-rw-r--r--sys/arch/octeon/octeon/machdep.c7
-rw-r--r--sys/arch/sgi/dev/power.c8
-rw-r--r--sys/arch/sgi/sgi/machdep.c7
-rw-r--r--sys/arch/sparc64/dev/power.c8
-rw-r--r--sys/arch/sparc64/dev/rtc.c8
-rw-r--r--sys/arch/sparc64/include/cpu.h7
-rw-r--r--sys/arch/sparc64/sparc64/machdep.c7
-rw-r--r--sys/arch/zaurus/dev/zaurus_kbd.c8
-rw-r--r--sys/dev/acpi/acpi.c10
-rw-r--r--sys/dev/wscons/wskbd.c4
-rw-r--r--sys/kern/kern_sysctl.c9
-rw-r--r--sys/sys/sysctl.h48
33 files changed, 118 insertions, 128 deletions
diff --git a/etc/etc.landisk/sysctl.conf b/etc/etc.landisk/sysctl.conf
index 8128872c162..a73015c114c 100644
--- a/etc/etc.landisk/sysctl.conf
+++ b/etc/etc.landisk/sysctl.conf
@@ -1,2 +1 @@
-#machdep.kbdreset=1 # permit console to do a nice halt
#machdep.led_blink=1 # blink the power led
diff --git a/etc/etc.loongson/sysctl.conf b/etc/etc.loongson/sysctl.conf
index 393f66d8884..e69de29bb2d 100644
--- a/etc/etc.loongson/sysctl.conf
+++ b/etc/etc.loongson/sysctl.conf
@@ -1 +0,0 @@
-#machdep.kbdreset=1 # 1=Enable power button shutdown
diff --git a/etc/etc.palm/sysctl.conf b/etc/etc.palm/sysctl.conf
index 04d5e3b0ba5..b743bf5a96b 100644
--- a/etc/etc.palm/sysctl.conf
+++ b/etc/etc.palm/sysctl.conf
@@ -1,4 +1,3 @@
-#machdep.kbdreset=1 # permit zkbd(4) power key to do a nice halt
#machdep.maxspeed=520 # set change maximum processor speed
#machdep.lidsuspend=1 # closing the lid will suspend machine
#hw.setperf=0 # 0=slowest speed, 100=fastest speed
diff --git a/etc/etc.sgi/sysctl.conf b/etc/etc.sgi/sysctl.conf
index 393f66d8884..e69de29bb2d 100644
--- a/etc/etc.sgi/sysctl.conf
+++ b/etc/etc.sgi/sysctl.conf
@@ -1 +0,0 @@
-#machdep.kbdreset=1 # 1=Enable power button shutdown
diff --git a/etc/etc.sparc64/sysctl.conf b/etc/etc.sparc64/sysctl.conf
index 101cc47ccd4..38cba543cc2 100644
--- a/etc/etc.sparc64/sysctl.conf
+++ b/etc/etc.sparc64/sysctl.conf
@@ -1,3 +1,2 @@
#machdep.led_blink=1 # 1=On sparc64, make led(s) blink
#machdep.allowaperture=1 # See xf86(4)
-#machdep.kbdreset=1 # permit console to do a nice halt
diff --git a/etc/etc.zaurus/sysctl.conf b/etc/etc.zaurus/sysctl.conf
index 04d5e3b0ba5..b743bf5a96b 100644
--- a/etc/etc.zaurus/sysctl.conf
+++ b/etc/etc.zaurus/sysctl.conf
@@ -1,4 +1,3 @@
-#machdep.kbdreset=1 # permit zkbd(4) power key to do a nice halt
#machdep.maxspeed=520 # set change maximum processor speed
#machdep.lidsuspend=1 # closing the lid will suspend machine
#hw.setperf=0 # 0=slowest speed, 100=fastest speed
diff --git a/etc/sysctl.conf b/etc/sysctl.conf
index ed92f14a411..4650854b4a1 100644
--- a/etc/sysctl.conf
+++ b/etc/sysctl.conf
@@ -1,4 +1,4 @@
-# $OpenBSD: sysctl.conf,v 1.51 2011/04/04 11:14:33 deraadt Exp $
+# $OpenBSD: sysctl.conf,v 1.52 2011/06/24 19:47:48 naddy Exp $
#
# This file contains a list of sysctl options the user wants set at
# boot time. See sysctl(3) and sysctl(8) for more information on
@@ -36,3 +36,4 @@
#kern.watchdog.period=32 # >0=Enable hardware watchdog(4) timer if available
#kern.watchdog.auto=0 # 0=Disable automatic watchdog(4) retriggering
#kern.pool_debug=0 # 0=Disable pool corruption checks (faster)
+#hw.allowpowerdown=0 # 0=Disable power button shutdown
diff --git a/sbin/sysctl/sysctl.8 b/sbin/sysctl/sysctl.8
index e85c2b2c3d4..238048037f5 100644
--- a/sbin/sysctl/sysctl.8
+++ b/sbin/sysctl/sysctl.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: sysctl.8,v 1.158 2011/05/23 07:18:45 djm Exp $
+.\" $OpenBSD: sysctl.8,v 1.159 2011/06/24 19:47:48 naddy Exp $
.\" $NetBSD: sysctl.8,v 1.4 1995/09/30 07:12:49 thorpej Exp $
.\"
.\" Copyright (c) 1993
@@ -30,7 +30,7 @@
.\"
.\" @(#)sysctl.8 8.2 (Berkeley) 5/9/95
.\"
-.Dd $Mdocdate: May 23 2011 $
+.Dd $Mdocdate: June 24 2011 $
.Dt SYSCTL 8
.Os
.Sh NAME
@@ -342,6 +342,7 @@ and a few require a kernel compiled with non-standard
.It hw.serialno string no
.It hw.uuid string no
.It hw.ncpufound integer no
+.It hw.allowpowerdown integer yes
.It machdep.console_device dev_t no
.It machdep.unaligned_print integer yes
.It machdep.unaligned_fix integer yes
diff --git a/share/man/man4/acpibtn.4 b/share/man/man4/acpibtn.4
index 5a21f928dcf..a93e437813e 100644
--- a/share/man/man4/acpibtn.4
+++ b/share/man/man4/acpibtn.4
@@ -1,4 +1,4 @@
-.\" $OpenBSD: acpibtn.4,v 1.3 2007/05/31 19:19:48 jmc Exp $
+.\" $OpenBSD: acpibtn.4,v 1.4 2011/06/24 19:47:48 naddy Exp $
.\"
.\" Copyright (c) 2006 Michael Knudsen <mk@openbsd.org>
.\"
@@ -14,7 +14,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: May 31 2007 $
+.Dd $Mdocdate: June 24 2011 $
.Dt ACPIBTN 4
.Os
.Sh NAME
@@ -29,7 +29,10 @@ driver is used to handle the event triggered when the user presses an ACPI
button.
Currently, the only event handled is the press of a power button which
causes the system to perform a regular system shutdown and power off the
-machine.
+machine if the
+.Va hw.allowpowerdown
+.Xr sysctl 8
+is set to 1.
.Sh SEE ALSO
.Xr acpi 4 ,
.Xr intro 4
diff --git a/share/man/man4/man4.landisk/power.4 b/share/man/man4/man4.landisk/power.4
index f33e9557f62..0ee69224bba 100644
--- a/share/man/man4/man4.landisk/power.4
+++ b/share/man/man4/man4.landisk/power.4
@@ -1,4 +1,4 @@
-.\" $OpenBSD: power.4,v 1.4 2007/05/31 19:19:55 jmc Exp $
+.\" $OpenBSD: power.4,v 1.5 2011/06/24 19:47:48 naddy Exp $
.\"
.\"
.\" Copyright (c) 2007 Martin Reindl
@@ -15,7 +15,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: May 31 2007 $
+.Dd $Mdocdate: June 24 2011 $
.Dt POWER 4 landisk
.Os
.Sh NAME
@@ -30,7 +30,7 @@ The
.Nm
driver catches that interrupt.
If the
-.Va machdep.kbdreset
+.Va hw.allowpowerdown
.Xr sysctl 8
is set to 1,
.Nm power
@@ -39,7 +39,10 @@ will signal
to do a clean shutdown.
.Sh SEE ALSO
.Xr intro 4 ,
-.Xr obio 4
+.Xr obio 4 ,
+.Xr init 8 ,
+.Xr rc.shutdown 8 ,
+.Xr sysctl 8
.Sh HISTORY
Support for the
.Nm
diff --git a/share/man/man4/man4.sgi/power.4 b/share/man/man4/man4.sgi/power.4
index d56f6b78abc..aabc55ede45 100644
--- a/share/man/man4/man4.sgi/power.4
+++ b/share/man/man4/man4.sgi/power.4
@@ -1,4 +1,4 @@
-.\" $OpenBSD: power.4,v 1.3 2009/10/26 18:38:09 miod Exp $
+.\" $OpenBSD: power.4,v 1.4 2011/06/24 19:47:48 naddy Exp $
.\"
.\" Copyright (c) 2007 Jasper Lievisse Adriaanse <jasper@openbsd.org>
.\" All rights reserved.
@@ -15,7 +15,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: October 26 2009 $
+.Dd $Mdocdate: June 24 2011 $
.Dt POWER 4 sgi
.Os
.Sh NAME
@@ -31,7 +31,7 @@ The
.Nm
driver catches that interrupt.
If the
-.Va machdep.kbdreset
+.Va hw.allowpowerdown
.Xr sysctl 8
is set to 1,
.Nm
diff --git a/share/man/man4/man4.sparc64/power.4 b/share/man/man4/man4.sparc64/power.4
index eddcb7fd91a..63d2da376a0 100644
--- a/share/man/man4/man4.sparc64/power.4
+++ b/share/man/man4/man4.sparc64/power.4
@@ -1,4 +1,4 @@
-.\" $OpenBSD: power.4,v 1.4 2007/05/31 19:19:57 jmc Exp $
+.\" $OpenBSD: power.4,v 1.5 2011/06/24 19:47:48 naddy Exp $
.\"
.\" Copyright (c) 2006 Jason L. Wright (jason@thought.net)
.\" All rights reserved.
@@ -24,7 +24,7 @@
.\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd $Mdocdate: May 31 2007 $
+.Dd $Mdocdate: June 24 2011 $
.Dt POWER 4 sparc64
.Os
.Sh NAME
@@ -39,7 +39,7 @@ The
.Nm
driver catches that interrupt.
If the
-.Va machdep.kbdreset
+.Va hw.allowpowerdown
.Xr sysctl 8
is set to 1,
.Nm power
diff --git a/share/man/man4/man4.zaurus/zkbd.4 b/share/man/man4/man4.zaurus/zkbd.4
index ccfee87adb6..05ffca6905d 100644
--- a/share/man/man4/man4.zaurus/zkbd.4
+++ b/share/man/man4/man4.zaurus/zkbd.4
@@ -1,4 +1,4 @@
-.\" $OpenBSD: zkbd.4,v 1.16 2007/05/31 19:19:57 jmc Exp $
+.\" $OpenBSD: zkbd.4,v 1.17 2011/06/24 19:47:48 naddy Exp $
.\"
.\" Copyright (c) 2004 Theo de Raadt <deraadt@openbsd.org>
.\"
@@ -14,7 +14,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: May 31 2007 $
+.Dd $Mdocdate: June 24 2011 $
.Dt ZKBD 4 zaurus
.Os
.Sh NAME
@@ -77,7 +77,8 @@ End
On/Off is special: pressing the key will immediately suspend the system.
Pressing the key while the Zaurus is suspended will cause it to resume.
Pressing the key longer than 3 seconds will do a nice halt if
-the machdep.kbdreset
+the
+.Va hw.allowpowerdown
.Xr sysctl 8
variable is 1.
.Pp
diff --git a/share/man/man7/securelevel.7 b/share/man/man7/securelevel.7
index b935ebb55a6..4bb98bb48dc 100644
--- a/share/man/man7/securelevel.7
+++ b/share/man/man7/securelevel.7
@@ -1,4 +1,4 @@
-.\" $OpenBSD: securelevel.7,v 1.22 2009/05/09 13:45:28 sthen Exp $
+.\" $OpenBSD: securelevel.7,v 1.23 2011/06/24 19:47:48 naddy Exp $
.\"
.\" Copyright (c) 2000 Hugh Graham
.\"
@@ -23,7 +23,7 @@
.\" IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd $Mdocdate: May 9 2009 $
+.Dd $Mdocdate: June 24 2011 $
.Dt SECURELEVEL 7
.Os
.Sh NAME
@@ -80,6 +80,11 @@ the
variable may not be changed
.It
the
+.Va hw.allowpowerdown
+.Xr sysctl 8
+variable may not be changed
+.It
+the
.Va net.inet.ip.sourceroute
.Xr sysctl 8
variable may not be changed
diff --git a/sys/arch/arm/arm/arm32_machdep.c b/sys/arch/arm/arm/arm32_machdep.c
index a04518a8175..4a3c320532d 100644
--- a/sys/arch/arm/arm/arm32_machdep.c
+++ b/sys/arch/arm/arm/arm32_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: arm32_machdep.c,v 1.37 2011/06/05 19:41:09 deraadt Exp $ */
+/* $OpenBSD: arm32_machdep.c,v 1.38 2011/06/24 19:47:48 naddy Exp $ */
/* $NetBSD: arm32_machdep.c,v 1.42 2003/12/30 12:33:15 pk Exp $ */
/*
@@ -102,8 +102,6 @@ int allowaperture = 0;
#endif
#if defined(__zaurus__)
-/* Permit console keyboard to do a nice halt. */
-int kbd_reset;
int lid_suspend;
extern int xscale_maxspeed;
#endif
@@ -357,12 +355,6 @@ cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
return (sysctl_int(oldp, oldlenp, newp, newlen, &cpu_apmwarn));
#endif
#if defined(__zaurus__)
- case CPU_KBDRESET:
- if (securelevel > 0)
- return (sysctl_rdint(oldp, oldlenp, newp,
- kbd_reset));
- return (sysctl_int(oldp, oldlenp, newp, newlen,
- &kbd_reset));
case CPU_LIDSUSPEND:
return (sysctl_int(oldp, oldlenp, newp, newlen,
&lid_suspend));
diff --git a/sys/arch/arm/include/cpu.h b/sys/arch/arm/include/cpu.h
index 407d972b233..d44de5e13d3 100644
--- a/sys/arch/arm/include/cpu.h
+++ b/sys/arch/arm/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.26 2010/11/28 20:44:20 miod Exp $ */
+/* $OpenBSD: cpu.h,v 1.27 2011/06/24 19:47:48 naddy Exp $ */
/* $NetBSD: cpu.h,v 1.34 2003/06/23 11:01:08 martin Exp $ */
/*
@@ -61,7 +61,7 @@
#define CPU_POWERSAVE 5 /* int: use CPU powersave mode */
#define CPU_ALLOWAPERTURE 6 /* int: allow mmap of /dev/xf86 */
#define CPU_APMWARN 7 /* APM battery warning percentage */
-#define CPU_KBDRESET 8 /* int: console keyboard reset */
+ /* 8 formerly int: keyboard reset */
/* 9 formerly int: CPU_ZTSRAWMODE */
/* 10 formerly struct: CPU_ZTSSCALE */
#define CPU_MAXSPEED 11 /* int: number of valid machdep ids */
@@ -77,7 +77,7 @@
{ "powersave", CTLTYPE_INT }, \
{ "allowaperture", CTLTYPE_INT }, \
{ "apmwarn", CTLTYPE_INT }, \
- { "kbdreset", CTLTYPE_INT }, \
+ { 0, 0 }, \
{ 0, 0 }, \
{ 0, 0 }, \
{ "maxspeed", CTLTYPE_INT }, \
diff --git a/sys/arch/landisk/dev/power.c b/sys/arch/landisk/dev/power.c
index 889acf50e04..cfe383ed948 100644
--- a/sys/arch/landisk/dev/power.c
+++ b/sys/arch/landisk/dev/power.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: power.c,v 1.4 2007/06/15 18:17:25 miod Exp $ */
+/* $OpenBSD: power.c,v 1.5 2011/06/24 19:47:48 naddy Exp $ */
/*
* Copyright (c) 2007 Martin Reindl.
@@ -90,7 +90,7 @@ power_attach(struct device *parent, struct device *self, void *aux)
int
power_intr(void *arg)
{
- extern int kbd_reset;
+ extern int allowpowerdown;
int status;
status = (int8_t)_reg_read_1(LANDISK_BTNSTAT);
@@ -105,8 +105,8 @@ power_intr(void *arg)
Debugger();
#endif
_reg_write_1(LANDISK_PWRSW_INTCLR, 1);
- if (kbd_reset == 1) {
- kbd_reset = 0;
+ if (allowpowerdown == 1) {
+ allowpowerdown = 0;
psignal(initproc, SIGUSR1);
}
return (1);
diff --git a/sys/arch/landisk/include/cpu.h b/sys/arch/landisk/include/cpu.h
index 54d84c0d210..f22d99ee1d0 100644
--- a/sys/arch/landisk/include/cpu.h
+++ b/sys/arch/landisk/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.3 2011/03/23 16:54:35 pirofti Exp $ */
+/* $OpenBSD: cpu.h,v 1.4 2011/06/24 19:47:48 naddy Exp $ */
/* $NetBSD: cpu.h,v 1.1 2006/09/01 21:26:18 uwe Exp $ */
#ifndef _MACHINE_CPU_H_
@@ -12,14 +12,14 @@ void machine_reset(void);
* CTL_MACHDEP definitions.
*/
#define CPU_CONSDEV 1 /* dev_t: console terminal device */
-#define CPU_KBDRESET 2 /* keyboard reset */
-#define CPU_LED_BLINK 3 /* keyboard reset */
+ /* 2 formerly: keyboard reset */
+#define CPU_LED_BLINK 3 /* blink leds */
#define CPU_MAXID 4 /* number of valid machdep ids */
#define CTL_MACHDEP_NAMES { \
{ 0, 0 }, \
{ "console_device", CTLTYPE_STRUCT }, \
- { "kbdreset", CTLTYPE_INT }, \
+ { 0, 0 }, \
{ "led_blink", CTLTYPE_INT } \
}
diff --git a/sys/arch/landisk/landisk/machdep.c b/sys/arch/landisk/landisk/machdep.c
index 87029d7013b..4e189e34fb0 100644
--- a/sys/arch/landisk/landisk/machdep.c
+++ b/sys/arch/landisk/landisk/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.24 2011/05/30 22:25:21 oga Exp $ */
+/* $OpenBSD: machdep.c,v 1.25 2011/06/24 19:47:48 naddy Exp $ */
/* $NetBSD: machdep.c,v 1.1 2006/09/01 21:26:18 uwe Exp $ */
/*-
@@ -110,7 +110,6 @@ __dead void main(void);
void cpu_init_kcore_hdr(void);
void blink_led(void *);
-int kbd_reset;
int led_blink;
extern u_int32_t getramsize(void);
@@ -473,11 +472,6 @@ cpu_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
sizeof consdev));
}
- case CPU_KBDRESET:
- if (securelevel > 0)
- return (sysctl_rdint(oldp, oldlenp, newp, kbd_reset));
- return (sysctl_int(oldp, oldlenp, newp, newlen, &kbd_reset));
-
case CPU_LED_BLINK:
oldval = led_blink;
ret = sysctl_int(oldp, oldlenp, newp, newlen, &led_blink);
diff --git a/sys/arch/loongson/loongson/machdep.c b/sys/arch/loongson/loongson/machdep.c
index 30d0d63dd38..0151104d072 100644
--- a/sys/arch/loongson/loongson/machdep.c
+++ b/sys/arch/loongson/loongson/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.30 2011/06/05 19:41:07 deraadt Exp $ */
+/* $OpenBSD: machdep.c,v 1.31 2011/06/24 19:47:48 naddy Exp $ */
/*
* Copyright (c) 2009, 2010 Miodrag Vallat.
@@ -105,7 +105,6 @@ vaddr_t uncached_base;
int physmem; /* Max supported memory, changes to actual. */
int ncpu = 1; /* At least one CPU in the system. */
struct user *proc0paddr;
-int kbd_reset;
const struct platform *sys_platform;
struct cpu_hwinfo bootcpu_hwinfo;
@@ -754,10 +753,6 @@ cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
return ENOTDIR; /* Overloaded */
switch (name[0]) {
- case CPU_KBDRESET:
- if (securelevel > 0)
- return (sysctl_rdint(oldp, oldlenp, newp, kbd_reset));
- return (sysctl_int(oldp, oldlenp, newp, newlen, &kbd_reset));
default:
return EOPNOTSUPP;
}
diff --git a/sys/arch/mips64/include/cpu.h b/sys/arch/mips64/include/cpu.h
index d53bb477dc0..548434d5e07 100644
--- a/sys/arch/mips64/include/cpu.h
+++ b/sys/arch/mips64/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.71 2011/03/31 20:37:44 miod Exp $ */
+/* $OpenBSD: cpu.h,v 1.72 2011/06/24 19:47:48 naddy Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -504,13 +504,13 @@ void cpu_startclock(struct cpu_info *);
* CTL_MACHDEP definitions.
*/
#define CPU_ALLOWAPERTURE 1 /* allow mmap of /dev/xf86 */
-#define CPU_KBDRESET 2 /* keyboard reset */
+ /* 2 formerly: keyboard reset */
#define CPU_MAXID 3 /* number of valid machdep ids */
#define CTL_MACHDEP_NAMES { \
{ 0, 0 }, \
{ "allowaperture", CTLTYPE_INT }, \
- { "kbdreset", CTLTYPE_INT }, \
+ { 0, 0 }, \
}
/*
diff --git a/sys/arch/octeon/octeon/machdep.c b/sys/arch/octeon/octeon/machdep.c
index ac4bc21ea6b..b059e904fac 100644
--- a/sys/arch/octeon/octeon/machdep.c
+++ b/sys/arch/octeon/octeon/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.13 2011/06/05 19:41:07 deraadt Exp $ */
+/* $OpenBSD: machdep.c,v 1.14 2011/06/24 19:47:48 naddy Exp $ */
/*
* Copyright (c) 2009, 2010 Miodrag Vallat.
@@ -176,7 +176,6 @@ vaddr_t uncached_base;
int physmem; /* Max supported memory, changes to actual. */
int ncpu = 1; /* At least one CPU in the system. */
struct user *proc0paddr;
-int kbd_reset;
struct cpu_hwinfo bootcpu_hwinfo;
@@ -630,10 +629,6 @@ cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
return ENOTDIR; /* Overloaded */
switch (name[0]) {
- case CPU_KBDRESET:
- if (securelevel > 0)
- return (sysctl_rdint(oldp, oldlenp, newp, kbd_reset));
- return (sysctl_int(oldp, oldlenp, newp, newlen, &kbd_reset));
default:
return EOPNOTSUPP;
}
diff --git a/sys/arch/sgi/dev/power.c b/sys/arch/sgi/dev/power.c
index 3696db748f5..ed8350a51c8 100644
--- a/sys/arch/sgi/dev/power.c
+++ b/sys/arch/sgi/dev/power.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: power.c,v 1.13 2009/11/25 11:23:29 miod Exp $ */
+/* $OpenBSD: power.c,v 1.14 2011/06/24 19:47:49 naddy Exp $ */
/*
* Copyright (c) 2007 Jasper Lievisse Adriaanse <jasper@openbsd.org>
@@ -126,7 +126,7 @@ power_mainbus_intr(void *v)
int
power_intr(void *unused)
{
- extern int kbd_reset;
+ extern int allowpowerdown;
int val;
/*
@@ -140,8 +140,8 @@ power_intr(void *unused)
/* debounce condition */
dsrtc_register_write(DS1687_EXT_CTRL, val & ~DS1687_KICKSTART);
- if (kbd_reset == 1) {
- kbd_reset = 0;
+ if (allowpowerdown == 1) {
+ allowpowerdown = 0;
psignal(initproc, SIGUSR2);
}
diff --git a/sys/arch/sgi/sgi/machdep.c b/sys/arch/sgi/sgi/machdep.c
index e3e817b53ba..dd6e701ad16 100644
--- a/sys/arch/sgi/sgi/machdep.c
+++ b/sys/arch/sgi/sgi/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.110 2011/06/05 19:41:08 deraadt Exp $ */
+/* $OpenBSD: machdep.c,v 1.111 2011/06/24 19:47:49 naddy Exp $ */
/*
* Copyright (c) 2003-2004 Opsycon AB (www.opsycon.se / www.opsycon.com)
@@ -106,7 +106,6 @@ int rsvdmem; /* Reserved memory not usable. */
int ncpu = 1; /* At least one CPU in the system. */
struct user *proc0paddr;
int console_ok; /* Set when console initialized. */
-int kbd_reset;
int16_t masternasid;
int32_t *environment;
@@ -657,10 +656,6 @@ cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
return ENOTDIR; /* Overloaded */
switch (name[0]) {
- case CPU_KBDRESET:
- if (securelevel > 0)
- return (sysctl_rdint(oldp, oldlenp, newp, kbd_reset));
- return (sysctl_int(oldp, oldlenp, newp, newlen, &kbd_reset));
default:
return EOPNOTSUPP;
}
diff --git a/sys/arch/sparc64/dev/power.c b/sys/arch/sparc64/dev/power.c
index f6373562837..560e2e63b3b 100644
--- a/sys/arch/sparc64/dev/power.c
+++ b/sys/arch/sparc64/dev/power.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: power.c,v 1.5 2007/04/24 18:30:45 kettenis Exp $ */
+/* $OpenBSD: power.c,v 1.6 2011/06/24 19:47:49 naddy Exp $ */
/*
* Copyright (c) 2006 Jason L. Wright (jason@thought.net)
@@ -132,10 +132,10 @@ power_attach(parent, self, aux)
int
power_intr(void *vsc)
{
- extern int kbd_reset;
+ extern int allowpowerdown;
- if (kbd_reset == 1) {
- kbd_reset = 0;
+ if (allowpowerdown == 1) {
+ allowpowerdown = 0;
psignal(initproc, SIGUSR2);
}
return (1);
diff --git a/sys/arch/sparc64/dev/rtc.c b/sys/arch/sparc64/dev/rtc.c
index dfa57e4ed53..ae69bc342ac 100644
--- a/sys/arch/sparc64/dev/rtc.c
+++ b/sys/arch/sparc64/dev/rtc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rtc.c,v 1.8 2010/04/10 12:52:39 kettenis Exp $ */
+/* $OpenBSD: rtc.c,v 1.9 2011/06/24 19:47:49 naddy Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -208,10 +208,10 @@ rtc_attach(struct device *parent, struct device *self, void *aux)
int
rtc_intr(void *arg)
{
- extern int kbd_reset;
+ extern int allowpowerdown;
- if (kbd_reset == 1) {
- kbd_reset = 0;
+ if (allowpowerdown == 1) {
+ allowpowerdown = 0;
psignal(initproc, SIGUSR2);
}
return (1);
diff --git a/sys/arch/sparc64/include/cpu.h b/sys/arch/sparc64/include/cpu.h
index dbe6b079dd6..eb7dcd75ba0 100644
--- a/sys/arch/sparc64/include/cpu.h
+++ b/sys/arch/sparc64/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.76 2011/03/23 16:54:37 pirofti Exp $ */
+/* $OpenBSD: cpu.h,v 1.77 2011/06/24 19:47:49 naddy Exp $ */
/* $NetBSD: cpu.h,v 1.28 2001/06/14 22:56:58 thorpej Exp $ */
/*
@@ -47,12 +47,13 @@
/*
* CTL_MACHDEP definitions.
*/
+ /* 1 formerly: booted kernel name */
#define CPU_LED_BLINK 2 /* int: blink leds? */
#define CPU_ALLOWAPERTURE 3 /* allow xf86 operations */
#define CPU_CPUTYPE 4 /* cpu type */
#define CPU_CECCERRORS 5 /* Correctable ECC errors */
#define CPU_CECCLAST 6 /* Correctable ECC last fault addr */
-#define CPU_KBDRESET 7 /* soft reset via keyboard */
+ /* 7 formerly: soft reset via keyboard */
#define CPU_MAXID 8 /* number of valid machdep ids */
#define CTL_MACHDEP_NAMES { \
@@ -63,7 +64,7 @@
{ "cputype", CTLTYPE_INT }, \
{ "ceccerrs", CTLTYPE_INT }, \
{ "cecclast", CTLTYPE_QUAD }, \
- { "kbdreset", CTLTYPE_INT }, \
+ { 0, 0 }, \
}
#ifdef _KERNEL
diff --git a/sys/arch/sparc64/sparc64/machdep.c b/sys/arch/sparc64/sparc64/machdep.c
index 7eafe947e50..6f950c279af 100644
--- a/sys/arch/sparc64/sparc64/machdep.c
+++ b/sys/arch/sparc64/sparc64/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.133 2011/06/23 20:44:39 ariane Exp $ */
+/* $OpenBSD: machdep.c,v 1.134 2011/06/24 19:47:49 naddy Exp $ */
/* $NetBSD: machdep.c,v 1.108 2001/07/24 19:30:14 eeh Exp $ */
/*-
@@ -167,7 +167,6 @@ int physmem;
extern caddr_t msgbufaddr;
int sparc_led_blink;
-int kbd_reset;
#ifdef APERTURE
#ifdef INSECURE
@@ -409,10 +408,6 @@ cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
return (sysctl_rdint(oldp, oldlenp, newp, ceccerrs));
case CPU_CECCLAST:
return (sysctl_rdquad(oldp, oldlenp, newp, cecclast));
- case CPU_KBDRESET:
- if (securelevel > 0)
- return (sysctl_rdint(oldp, oldlenp, newp, kbd_reset));
- return (sysctl_int(oldp, oldlenp, newp, newlen, &kbd_reset));
default:
return (EOPNOTSUPP);
}
diff --git a/sys/arch/zaurus/dev/zaurus_kbd.c b/sys/arch/zaurus/dev/zaurus_kbd.c
index 43f3c0960c3..da14d54e3b9 100644
--- a/sys/arch/zaurus/dev/zaurus_kbd.c
+++ b/sys/arch/zaurus/dev/zaurus_kbd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: zaurus_kbd.c,v 1.31 2010/09/07 16:21:41 deraadt Exp $ */
+/* $OpenBSD: zaurus_kbd.c,v 1.32 2011/06/24 19:47:49 naddy Exp $ */
/*
* Copyright (c) 2005 Dale Rahn <drahn@openbsd.org>
*
@@ -429,7 +429,7 @@ zkbd_poll(void *v)
}
#if NAPM > 0
-extern int kbd_reset;
+extern int allowpowerdown;
extern int apm_suspends;
static int zkbdondown; /* on key is pressed */
static struct timeval zkbdontv = { 0, 0 }; /* last on key event */
@@ -461,8 +461,8 @@ zkbd_on(void *v)
}
} else if (zkbdondown) {
if (ratecheck(&zkbdontv, &zkbdhalttv)) {
- if (kbd_reset == 1) {
- kbd_reset = 0;
+ if (allowpowerdown == 1) {
+ allowpowerdown = 0;
psignal(initproc, SIGUSR1);
}
} else if (ratecheck(&zkbdontv, &zkbdsleeptv)) {
diff --git a/sys/dev/acpi/acpi.c b/sys/dev/acpi/acpi.c
index afe55a227ae..231f34b3f83 100644
--- a/sys/dev/acpi/acpi.c
+++ b/sys/dev/acpi/acpi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpi.c,v 1.225 2011/06/16 23:02:11 pirofti Exp $ */
+/* $OpenBSD: acpi.c,v 1.226 2011/06/24 19:47:49 naddy Exp $ */
/*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
* Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org>
@@ -1452,8 +1452,12 @@ acpi_sbtn_task(void *arg0, int dummy)
void
acpi_powerdown_task(void *arg0, int dummy)
{
- /* XXX put a knob in front of this */
- psignal(initproc, SIGUSR2);
+ extern int allowpowerdown;
+
+ if (allowpowerdown == 1) {
+ allowpowerdown = 0;
+ psignal(initproc, SIGUSR2);
+ }
}
void
diff --git a/sys/dev/wscons/wskbd.c b/sys/dev/wscons/wskbd.c
index 220f61aa28f..5fac46762db 100644
--- a/sys/dev/wscons/wskbd.c
+++ b/sys/dev/wscons/wskbd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wskbd.c,v 1.68 2011/06/23 16:31:16 deraadt Exp $ */
+/* $OpenBSD: wskbd.c,v 1.69 2011/06/24 19:47:49 naddy Exp $ */
/* $NetBSD: wskbd.c,v 1.80 2005/05/04 01:52:16 augustss Exp $ */
/*
@@ -244,7 +244,9 @@ struct cfattach wskbd_ca = {
wskbd_detach, wskbd_activate
};
+#if defined(__i386__) || defined(__amd64__)
extern int kbd_reset;
+#endif
#ifndef WSKBD_DEFAULT_BELL_PITCH
#define WSKBD_DEFAULT_BELL_PITCH 400 /* 400Hz */
diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c
index c64d2a68368..c56f3e043c5 100644
--- a/sys/kern/kern_sysctl.c
+++ b/sys/kern/kern_sysctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_sysctl.c,v 1.203 2011/06/09 21:10:55 sthen Exp $ */
+/* $OpenBSD: kern_sysctl.c,v 1.204 2011/06/24 19:47:49 naddy Exp $ */
/* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */
/*-
@@ -611,6 +611,7 @@ kern_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
* hardware related system variables.
*/
char *hw_vendor, *hw_prod, *hw_uuid, *hw_serial, *hw_ver;
+int allowpowerdown = 1;
int
hw_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
@@ -716,6 +717,12 @@ hw_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
case HW_USERMEM64:
return (sysctl_rdquad(oldp, oldlenp, newp,
ptoa((psize_t)physmem - uvmexp.wired)));
+ case HW_ALLOWPOWERDOWN:
+ if (securelevel > 0)
+ return (sysctl_rdint(oldp, oldlenp, newp,
+ allowpowerdown));
+ return (sysctl_int(oldp, oldlenp, newp, newlen,
+ &allowpowerdown));
default:
return (EOPNOTSUPP);
}
diff --git a/sys/sys/sysctl.h b/sys/sys/sysctl.h
index ca0619f1da1..0084bceb806 100644
--- a/sys/sys/sysctl.h
+++ b/sys/sys/sysctl.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: sysctl.h,v 1.113 2011/04/18 21:44:56 guenther Exp $ */
+/* $OpenBSD: sysctl.h,v 1.114 2011/06/24 19:47:49 naddy Exp $ */
/* $NetBSD: sysctl.h,v 1.16 1996/04/09 20:55:36 cgd Exp $ */
/*
@@ -757,28 +757,29 @@ struct kinfo_file2 {
/*
* CTL_HW identifiers
*/
-#define HW_MACHINE 1 /* string: machine class */
-#define HW_MODEL 2 /* string: specific machine model */
-#define HW_NCPU 3 /* int: number of cpus being used */
-#define HW_BYTEORDER 4 /* int: machine byte order */
-#define HW_PHYSMEM 5 /* int: total memory */
-#define HW_USERMEM 6 /* int: non-kernel memory */
-#define HW_PAGESIZE 7 /* int: software page size */
-#define HW_DISKNAMES 8 /* strings: disk drive names */
-#define HW_DISKSTATS 9 /* struct: diskstats[] */
-#define HW_DISKCOUNT 10 /* int: number of disks */
-#define HW_SENSORS 11 /* node: hardware monitors */
-#define HW_CPUSPEED 12 /* get CPU frequency */
-#define HW_SETPERF 13 /* set CPU performance % */
-#define HW_VENDOR 14 /* string: vendor name */
-#define HW_PRODUCT 15 /* string: product name */
-#define HW_VERSION 16 /* string: hardware version */
-#define HW_SERIALNO 17 /* string: hardware serial number */
-#define HW_UUID 18 /* string: universal unique id */
-#define HW_PHYSMEM64 19 /* quad: total memory */
-#define HW_USERMEM64 20 /* quad: non-kernel memory */
-#define HW_NCPUFOUND 21 /* int: number of cpus found*/
-#define HW_MAXID 22 /* number of valid hw ids */
+#define HW_MACHINE 1 /* string: machine class */
+#define HW_MODEL 2 /* string: specific machine model */
+#define HW_NCPU 3 /* int: number of cpus being used */
+#define HW_BYTEORDER 4 /* int: machine byte order */
+#define HW_PHYSMEM 5 /* int: total memory */
+#define HW_USERMEM 6 /* int: non-kernel memory */
+#define HW_PAGESIZE 7 /* int: software page size */
+#define HW_DISKNAMES 8 /* strings: disk drive names */
+#define HW_DISKSTATS 9 /* struct: diskstats[] */
+#define HW_DISKCOUNT 10 /* int: number of disks */
+#define HW_SENSORS 11 /* node: hardware monitors */
+#define HW_CPUSPEED 12 /* get CPU frequency */
+#define HW_SETPERF 13 /* set CPU performance % */
+#define HW_VENDOR 14 /* string: vendor name */
+#define HW_PRODUCT 15 /* string: product name */
+#define HW_VERSION 16 /* string: hardware version */
+#define HW_SERIALNO 17 /* string: hardware serial number */
+#define HW_UUID 18 /* string: universal unique id */
+#define HW_PHYSMEM64 19 /* quad: total memory */
+#define HW_USERMEM64 20 /* quad: non-kernel memory */
+#define HW_NCPUFOUND 21 /* int: number of cpus found*/
+#define HW_ALLOWPOWERDOWN 22 /* allow power button shutdown */
+#define HW_MAXID 23 /* number of valid hw ids */
#define CTL_HW_NAMES { \
{ 0, 0 }, \
@@ -803,6 +804,7 @@ struct kinfo_file2 {
{ "physmem", CTLTYPE_QUAD }, \
{ "usermem", CTLTYPE_QUAD }, \
{ "ncpufound", CTLTYPE_INT }, \
+ { "allowpowerdown", CTLTYPE_INT }, \
}
/*