summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--etc/etc.loongson/sysctl.conf1
-rw-r--r--sys/arch/loongson/loongson/machdep.c5
-rw-r--r--sys/arch/mips64/include/cpu.h6
3 files changed, 9 insertions, 3 deletions
diff --git a/etc/etc.loongson/sysctl.conf b/etc/etc.loongson/sysctl.conf
index e69de29bb2d..e6491005aa6 100644
--- a/etc/etc.loongson/sysctl.conf
+++ b/etc/etc.loongson/sysctl.conf
@@ -0,0 +1 @@
+#machdep.lidsuspend=0 # do not suspend laptop upon lid closing
diff --git a/sys/arch/loongson/loongson/machdep.c b/sys/arch/loongson/loongson/machdep.c
index 55fd7183960..9560a53e68e 100644
--- a/sys/arch/loongson/loongson/machdep.c
+++ b/sys/arch/loongson/loongson/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.69 2016/12/11 07:57:14 visa Exp $ */
+/* $OpenBSD: machdep.c,v 1.70 2016/12/16 12:01:19 fcambus Exp $ */
/*
* Copyright (c) 2009, 2010, 2014 Miodrag Vallat.
@@ -116,6 +116,7 @@ int physmem; /* Max supported memory, changes to actual. */
int ncpu = 1; /* At least one CPU in the system. */
int nnodes = 1; /* Number of NUMA nodes, only on 3A. */
struct user *proc0paddr;
+int lid_suspend = 1;
const struct platform *sys_platform;
struct cpu_hwinfo bootcpu_hwinfo;
@@ -1016,6 +1017,8 @@ cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
return ENOTDIR; /* Overloaded */
switch (name[0]) {
+ case CPU_LIDSUSPEND:
+ return sysctl_int(oldp, oldlenp, newp, newlen, &lid_suspend);
default:
return EOPNOTSUPP;
}
diff --git a/sys/arch/mips64/include/cpu.h b/sys/arch/mips64/include/cpu.h
index af67a5aa6ae..7eb47813237 100644
--- a/sys/arch/mips64/include/cpu.h
+++ b/sys/arch/mips64/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.111 2016/08/14 08:23:52 visa Exp $ */
+/* $OpenBSD: cpu.h,v 1.112 2016/12/16 12:01:19 fcambus Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -361,12 +361,14 @@ void cp0_calibrate(struct cpu_info *);
*/
#define CPU_ALLOWAPERTURE 1 /* allow mmap of /dev/xf86 */
/* 2 formerly: keyboard reset */
-#define CPU_MAXID 3 /* number of valid machdep ids */
+#define CPU_LIDSUSPEND 3 /* lid close causes a suspend */
+#define CPU_MAXID 4 /* number of valid machdep ids */
#define CTL_MACHDEP_NAMES { \
{ 0, 0 }, \
{ "allowaperture", CTLTYPE_INT }, \
{ 0, 0 }, \
+ { "lidsuspend", CTLTYPE_INT }, \
}
/*