summaryrefslogtreecommitdiff
path: root/sys/arch/amd64
diff options
context:
space:
mode:
authorMartin Natano <natano@cvs.openbsd.org>2017-03-02 10:38:11 +0000
committerMartin Natano <natano@cvs.openbsd.org>2017-03-02 10:38:11 +0000
commit74ec58af25dbea2773d924537499c413d0d983dd (patch)
tree9a9d0c79a40dd17ac87ca0acbfdb4623020c08bc /sys/arch/amd64
parent6bfb01fcf4947233b8bf5ffe005dbc1f79a35df0 (diff)
Add a new sysctl machdep.lidaction. The sysctl works as follows:
machdep.lidaction=0 # do nothing machdep.lidaction=1 # suspend machdep.lidaction=2 # hibernate lidsuspend is just an alias for lidaction, so if you change one, the other one will have the same value. The plan is to remove machdep.lidsuspend eventually when people have upgraded their /ets/sysctl.conf. discussed with deraadt, who came up with the new MIB name no objections mlarkin ok stsp halex jcs
Diffstat (limited to 'sys/arch/amd64')
-rw-r--r--sys/arch/amd64/amd64/machdep.c9
-rw-r--r--sys/arch/amd64/include/cpu.h6
2 files changed, 9 insertions, 6 deletions
diff --git a/sys/arch/amd64/amd64/machdep.c b/sys/arch/amd64/amd64/machdep.c
index 45e44274833..653d636df9f 100644
--- a/sys/arch/amd64/amd64/machdep.c
+++ b/sys/arch/amd64/amd64/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.223 2016/10/09 11:25:39 tom Exp $ */
+/* $OpenBSD: machdep.c,v 1.224 2017/03/02 10:38:09 natano Exp $ */
/* $NetBSD: machdep.c,v 1.3 2003/05/07 22:58:18 fvdl Exp $ */
/*-
@@ -188,7 +188,7 @@ paddr_t lo32_paddr;
paddr_t tramp_pdirpa;
int kbd_reset;
-int lid_suspend = 1;
+int lid_action = 1;
/*
* safepri is a safe priority for sleep to set for a spin-wait
@@ -495,7 +495,8 @@ cpu_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
case CPU_XCRYPT:
return (sysctl_rdint(oldp, oldlenp, newp, amd64_has_xcrypt));
case CPU_LIDSUSPEND:
- return (sysctl_int(oldp, oldlenp, newp, newlen, &lid_suspend));
+ case CPU_LIDACTION:
+ return (sysctl_int(oldp, oldlenp, newp, newlen, &lid_action));
default:
return (EOPNOTSUPP);
}
@@ -715,7 +716,7 @@ __dead void
boot(int howto)
{
if ((howto & RB_POWERDOWN) != 0)
- lid_suspend = 0;
+ lid_action = 0;
if (cold) {
if ((howto & RB_USERREQ) == 0)
diff --git a/sys/arch/amd64/include/cpu.h b/sys/arch/amd64/include/cpu.h
index 09ce08cc938..4b51f80e0fe 100644
--- a/sys/arch/amd64/include/cpu.h
+++ b/sys/arch/amd64/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.107 2016/12/14 10:30:59 reyk Exp $ */
+/* $OpenBSD: cpu.h,v 1.108 2017/03/02 10:38:10 natano Exp $ */
/* $NetBSD: cpu.h,v 1.1 2003/04/26 18:39:39 fvdl Exp $ */
/*-
@@ -425,7 +425,8 @@ void mp_setperf_init(void);
#define CPU_APMHALT 11 /* halt -p hack */
#define CPU_XCRYPT 12 /* supports VIA xcrypt in userland */
#define CPU_LIDSUSPEND 13 /* lid close causes a suspend */
-#define CPU_MAXID 14 /* number of valid machdep ids */
+#define CPU_LIDACTION 14 /* action caused by lid close */
+#define CPU_MAXID 15 /* number of valid machdep ids */
#define CTL_MACHDEP_NAMES { \
{ 0, 0 }, \
@@ -442,6 +443,7 @@ void mp_setperf_init(void);
{ "apmhalt", CTLTYPE_INT }, \
{ "xcrypt", CTLTYPE_INT }, \
{ "lidsuspend", CTLTYPE_INT }, \
+ { "lidaction", CTLTYPE_INT }, \
}
/*