-/* $OpenBSD: acpi.c,v 1.427 2024/05/13 01:15:50 jsg Exp $ */
+/* $OpenBSD: acpi.c,v 1.428 2024/05/13 19:56:37 kettenis Exp $ */
/*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
* Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org>
#endif /* SMALL_KERNEL */
+int
+acpi_resuming(struct acpi_softc *sc)
+{
+ return (getuptime() < sc->sc_resume_time + 10);
+}
+
void
acpi_reset(void)
{
en | ACPI_PM1_PWRBTN_EN);
splx(s);
+ /* Ignore button events if we're resuming. */
+ if (acpi_resuming(sc))
+ return;
+
switch (pwr_action) {
case 0:
break;
-/* $OpenBSD: acpi_x86.c,v 1.17 2023/07/06 06:58:07 deraadt Exp $ */
+/* $OpenBSD: acpi_x86.c,v 1.18 2024/05/13 19:56:37 kettenis Exp $ */
/*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
* Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org>
{
struct acpi_softc *sc = v;
+ sc->sc_resume_time = getuptime();
+
acpibtn_disable_psw(); /* disable _LID for wakeup */
/* 3rd resume AML step: _TTS(runstate) */
-/* $OpenBSD: acpibtn.c,v 1.51 2023/06/29 20:58:08 dv Exp $ */
+/* $OpenBSD: acpibtn.c,v 1.52 2024/05/13 19:56:37 kettenis Exp $ */
/*
* Copyright (c) 2005 Marco Peereboom <marco@openbsd.org>
*
dnprintf(10, "acpibtn_notify: %.2x %s\n", notify_type,
sc->sc_devnode->name);
+ /* Ignore button events if we're resuming. */
+ if (acpi_resuming(sc->sc_acpi))
+ return (0);
+
switch (sc->sc_btn_type) {
case ACPIBTN_LID:
#ifndef SMALL_KERNEL
-/* $OpenBSD: acpivar.h,v 1.126 2024/05/13 01:15:50 jsg Exp $ */
+/* $OpenBSD: acpivar.h,v 1.127 2024/05/13 19:56:37 kettenis Exp $ */
/*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
*
struct aml_node *sc_sst;
struct aml_node *sc_wak;
int sc_state;
+ time_t sc_resume_time;
struct acpiec_softc *sc_ec; /* XXX assume single EC */
struct acpi_ac_head sc_ac;
void acpi_sleep_pm(struct acpi_softc *, int);
void acpi_resume_pm(struct acpi_softc *, int);
void acpi_resume_cpu(struct acpi_softc *, int);
+int acpi_resuming(struct acpi_softc *);
#define ACPI_IOREAD 0
#define ACPI_IOWRITE 1