reason.
ok mglocker@, deraadt@
-/* $OpenBSD: acpi.c,v 1.431 2024/06/11 17:35:26 kettenis Exp $ */
+/* $OpenBSD: acpi.c,v 1.432 2024/06/25 11:57:10 kettenis Exp $ */
/*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
* Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org>
if (!(en & sts & (1L << jdx)))
continue;
+ if (cpu_suspended) {
+ cpu_suspended = 0;
+ sc->sc_wakegpe = idx + jdx;
+ }
+
/* Signal this GPE */
gpe = idx + jdx;
sc->gpe_table[gpe].active = 1;
ACPI_PM1_PWRBTN_STS);
sts &= ~ACPI_PM1_PWRBTN_STS;
- if (cpu_suspended)
+ if (cpu_suspended) {
cpu_suspended = 0;
+ sc->sc_wakegpe = -1;
+ }
acpi_addtask(sc, acpi_pbtn_task, sc, 0);
}
ACPI_PM1_SLPBTN_STS);
sts &= ~ACPI_PM1_SLPBTN_STS;
+ if (cpu_suspended) {
+ cpu_suspended = 0;
+ sc->sc_wakegpe = -2;
+ }
+
acpi_addtask(sc, acpi_sbtn_task, sc, 0);
}
if (sts) {
-/* $OpenBSD: acpi_x86.c,v 1.21 2024/05/29 12:21:33 kettenis Exp $ */
+/* $OpenBSD: acpi_x86.c,v 1.22 2024/06/25 11:57:10 kettenis Exp $ */
/*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
* Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org>
{
struct acpi_softc *sc = v;
+ printf("wakeup event: ");
+ switch (sc->sc_wakegpe) {
+ case -1:
+ printf("PWRBTN\n");
+ break;
+ case -2:
+ printf("SLPTN\n");
+ break;
+ default:
+ printf("GPE 0x%x\n", sc->sc_wakegpe);
+ break;
+ }
+
acpi_record_event(sc, APM_NORMAL_RESUME);
acpi_indicator(sc, ACPI_SST_WORKING);
-/* $OpenBSD: acpiec.c,v 1.65 2022/08/10 16:58:16 patrick Exp $ */
+/* $OpenBSD: acpiec.c,v 1.66 2024/06/25 11:57:10 kettenis Exp $ */
/*
* Copyright (c) 2006 Can Erkin Acar <canacar@openbsd.org>
*
{
struct acpiec_softc *sc = (struct acpiec_softc *)self;
struct acpi_attach_args *aa = aux;
+#ifndef SMALL_KERNEL
+ struct acpi_wakeq *wq;
+#endif
struct aml_value res;
int64_t st;
#ifndef SMALL_KERNEL
acpi_set_gpehandler(sc->sc_acpi, sc->sc_gpe, acpiec_gpehandler,
sc, GPE_EDGE);
+
+ /*
+ * On many machines the EC is not listed as a wakeup device
+ * but is necessary to wake up from S0i.
+ */
+ wq = malloc(sizeof(struct acpi_wakeq), M_DEVBUF, M_WAITOK | M_ZERO);
+ wq->q_node = sc->sc_devnode;
+ wq->q_gpe = sc->sc_gpe;
+ wq->q_state = ACPI_STATE_S0;
+ wq->q_enabled = 1;
+ SIMPLEQ_INSERT_TAIL(&sc->sc_acpi->sc_wakedevs, wq, q_next);
#endif
if (aml_evalname(sc->sc_acpi, sc->sc_devnode, "_GLK", 0, NULL, &res))
-/* $OpenBSD: acpivar.h,v 1.127 2024/05/13 19:56:37 kettenis Exp $ */
+/* $OpenBSD: acpivar.h,v 1.128 2024/06/25 11:57:10 kettenis Exp $ */
/*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
*
int slp_typb;
} sc_sleeptype[6];
int sc_lastgpe;
+ int sc_wakegpe;
struct gpe_block *gpe_table;