-/* $OpenBSD: apm.c,v 1.24 2021/03/26 23:34:50 kn Exp $ */
+/* $OpenBSD: apm.c,v 1.25 2022/02/10 05:48:02 gkoehler Exp $ */
/*-
* Copyright (c) 2001 Alexander Guy. All rights reserved.
#include <macppc/dev/pm_direct.h>
+#include "wsdisplay.h"
+#include <dev/wscons/wsdisplayvar.h>
+
#if defined(APMDEBUG)
#define DPRINTF(x) printf x
#else
switch (cmd) {
/* some ioctl names from linux */
case APM_IOC_STANDBY:
- case APM_IOC_STANDBY_REQ:
case APM_IOC_SUSPEND:
- case APM_IOC_SUSPEND_REQ:
- case APM_IOC_DEV_CTL:
- if ((flag & FWRITE) == 0)
+ if ((flag & FWRITE) == 0) {
error = EBADF;
- else
- error = EOPNOTSUPP;
+ break;
+ }
+#ifdef SUSPEND
+ sleep_state(sc, SLEEP_SUSPEND);
+#endif
break;
case APM_IOC_PRN_CTL:
if ((flag & FWRITE) == 0)
return (0);
}
+
+#ifdef SUSPEND
+void
+sleep_clocks(void *v)
+{
+}
+
+int
+sleep_showstate(void *v, int sleepmode)
+{
+ switch (sleepmode) {
+ case SLEEP_SUSPEND:
+ /* TODO blink the light */
+ return 0;
+ default:
+ return EOPNOTSUPP;
+ }
+}
+
+int
+sleep_setstate(void *v)
+{
+ printf("TODO sleep_setstate\n");
+ return 0;
+}
+
+int
+sleep_resume(void *v)
+{
+ return 0;
+}
+
+void
+gosleep(void *v)
+{
+}
+
+void
+display_suspend(void *v)
+{
+#if NWSDISPLAY > 0
+ wsdisplay_suspend();
+#endif /* NWSDISPLAY > 0 */
+}
+
+void
+display_resume(void *v)
+{
+#if NWSDISPLAY > 0
+ wsdisplay_resume();
+#endif /* NWSDISPLAY > 0 */
+}
+
+void
+suspend_finish(void *v)
+{
+}
+
+void
+disable_lid_wakeups(void *v)
+{
+}
+#endif /* SUSPEND */
-/* $OpenBSD: cpu.h,v 1.70 2021/07/06 09:34:06 kettenis Exp $ */
+/* $OpenBSD: cpu.h,v 1.71 2022/02/10 05:48:02 gkoehler Exp $ */
/* $NetBSD: cpu.h,v 1.1 1996/09/30 16:34:21 ws Exp $ */
/*
return (emsr & PSL_EE);
}
+static inline void
+intr_enable(void)
+{
+ ppc_mtmsr(ppc_mfmsr() | PSL_EE);
+}
+
static __inline u_long
intr_disable(void)
{