-/* $OpenBSD: machdep.c,v 1.118 2010/07/25 21:43:38 deraadt Exp $ */
+/* $OpenBSD: machdep.c,v 1.119 2010/08/05 21:10:10 deraadt Exp $ */
/* $NetBSD: machdep.c,v 1.3 2003/05/07 22:58:18 fvdl Exp $ */
/*-
paddr_t tramp_pdirpa;
int kbd_reset;
+int lid_suspend;
/*
* safepri is a safe priority for sleep to set for a spin-wait
#endif
case CPU_XCRYPT:
return (sysctl_rdint(oldp, oldlenp, newp, amd64_has_xcrypt));
+ case CPU_LIDSUSPEND:
+ return (sysctl_int(oldp, oldlenp, newp, newlen, &lid_suspend));
default:
return (EOPNOTSUPP);
}
-/* $OpenBSD: cpu.h,v 1.53 2010/07/25 21:43:38 deraadt Exp $ */
+/* $OpenBSD: cpu.h,v 1.54 2010/08/05 21:10:10 deraadt Exp $ */
/* $NetBSD: cpu.h,v 1.1 2003/04/26 18:39:39 fvdl Exp $ */
/*-
#define CPU_KBDRESET 10 /* keyboard reset under pcvt */
#define CPU_APMHALT 11 /* halt -p hack */
#define CPU_XCRYPT 12 /* supports VIA xcrypt in userland */
-#define CPU_MAXID 13 /* number of valid machdep ids */
+#define CPU_LIDSUSPEND 13 /* lid close causes a suspend */
+#define CPU_MAXID 14 /* number of valid machdep ids */
#define CTL_MACHDEP_NAMES { \
{ 0, 0 }, \
{ "kbdreset", CTLTYPE_INT }, \
{ "apmhalt", CTLTYPE_INT }, \
{ "xcrypt", CTLTYPE_INT }, \
+ { "lidsuspend", CTLTYPE_INT }, \
}
/*
-/* $OpenBSD: machdep.c,v 1.480 2010/07/25 21:43:35 deraadt Exp $ */
+/* $OpenBSD: machdep.c,v 1.481 2010/08/05 21:10:09 deraadt Exp $ */
/* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */
/*-
void via_update_sensor(void *args);
#endif
int kbd_reset;
+int lid_suspend;
/*
* safepri is a safe priority for sleep to set for a spin-wait
return (sysctl_rdint(oldp, oldlenp, newp, i386_has_sse2));
case CPU_XCRYPT:
return (sysctl_rdint(oldp, oldlenp, newp, i386_has_xcrypt));
+ case CPU_LIDSUSPEND:
+ return (sysctl_int(oldp, oldlenp, newp, newlen, &lid_suspend));
default:
return (EOPNOTSUPP);
}
-/* $OpenBSD: cpu.h,v 1.112 2010/07/25 21:43:37 deraadt Exp $ */
+/* $OpenBSD: cpu.h,v 1.113 2010/08/05 21:10:09 deraadt Exp $ */
/* $NetBSD: cpu.h,v 1.35 1996/05/05 19:29:26 christos Exp $ */
/*-
#define CPU_SSE 14 /* supports SSE */
#define CPU_SSE2 15 /* supports SSE2 */
#define CPU_XCRYPT 16 /* supports VIA xcrypt in userland */
-#define CPU_MAXID 17 /* number of valid machdep ids */
+#define CPU_LIDSUSPEND 17 /* lid close causes a suspend */
+#define CPU_MAXID 18 /* number of valid machdep ids */
#define CTL_MACHDEP_NAMES { \
{ 0, 0 }, \
{ "sse", CTLTYPE_INT }, \
{ "sse2", CTLTYPE_INT }, \
{ "xcrypt", CTLTYPE_INT }, \
+ { "lidsuspend", CTLTYPE_INT }, \
}
/*
-/* $OpenBSD: acpibtn.c,v 1.30 2010/08/05 20:11:32 deraadt Exp $ */
+/* $OpenBSD: acpibtn.c,v 1.31 2010/08/05 21:10:06 deraadt Exp $ */
/*
* Copyright (c) 2005 Marco Peereboom <marco@openbsd.org>
*
return (0);
}
-/* XXX tie this to a sysctl later */
-int acpi_lid_suspend = 0;
-
int
acpibtn_notify(struct aml_node *node, int notify_type, void *arg)
{
struct acpibtn_softc *sc = arg;
#ifndef SMALL_KERNEL
+ extern int lid_suspend;
int64_t lid;
#endif
* _LID method. 0 means the lid is closed and we
* should go to sleep.
*/
- if (acpi_lid_suspend == 0)
+ if (lid_suspend == 0)
break;
if (aml_evalinteger(sc->sc_acpi, sc->sc_devnode,
"_LID", 0, NULL, &lid))