On Wed, Apr 08, 2026 at 06:24:33PM +0000, James Cook wrote:
> >Synopsis:    7.8 fails to resume after suspend on Lenovo E420s
> >Category:    amd64
> >Environment:
>       System      : OpenBSD 7.8
>       Details     : OpenBSD 7.8 (GENERIC.MP) #6: Fri Mar 20 10:18:39 MDT 2026
>                        
> [email protected]:/usr/src/sys/arch/amd64/compile/GENERIC.MP
>
>       Architecture: OpenBSD.amd64
>       Machine     : amd64
> >Description:
>       I don't know if it's worth the effort to debug this old laptop, but
>       here's a report in case it's helpful.
>
>         The computer does not wake from suspend when I open the
>         lid. Instead, the indicator light (red dot over i in
>         "Thinkpad" logo) starts flashing with a period of about one
>         second, and I think I heard the optical drive do something.
>
>       I tried once in an X session, leaving it asleep for hours, and once
>       in single-user mode, sleeping for a bit more than a minute. Suspended
>       by closing lid. Same result both times.
>
>         I did not activate rtwn0 (mentioned in my other bug report
>         about this computer; leads to crashes).
> >How-To-Repeat:
>       Close lid. Wait a bit. Open lid. (machdep.lidaction sysctl is at default
>       value of 1.)
> >Fix:
>       Never sleep.
>

Can you try this diff and see if it fixes things?

-ml

Index: acpi_machdep.c
===================================================================
RCS file: /cvs/src/sys/arch/amd64/amd64/acpi_machdep.c,v
diff -u -p -a -u -r1.114 acpi_machdep.c
--- acpi_machdep.c      15 Mar 2026 11:16:36 -0000      1.114
+++ acpi_machdep.c      9 Apr 2026 06:52:22 -0000
@@ -159,7 +159,7 @@ acpi_intr_establish(int irq, int flags,
        apic = ioapic_find_bybase(irq);
        if (apic == NULL)
                return NULL;
-
+
        map = malloc(sizeof(*map), M_DEVBUF, M_NOWAIT | M_ZERO);
        if (map == NULL)
                return NULL;
@@ -472,16 +472,15 @@ acpi_sleep_cpu(struct acpi_softc *sc, in
  * will cause the least number of unexpected side effects.  We re-start
  * the clocks early because we will soon run AML which might do DELAY.
  * Then PM, and then further system/CPU work for the BSP cpu.
- */
+ */
 void
 acpi_resume_cpu(struct acpi_softc *sc, int state)
 {
-       if (sc->sc_fadt->flags & FADT_USE_PLATFORM_CLOCK) {
-               if (rtcalarm_fired())
-                       sc->sc_wakegpe = WAKEGPE_RTC;
-       }
-
        if (state == ACPI_STATE_S0) {
+               if (sc->sc_fadt->flags & FADT_USE_PLATFORM_CLOCK) {
+                       if (rtcalarm_fired())
+                               sc->sc_wakegpe = WAKEGPE_RTC;
+               }
                rtcalarm_resume();
                return;
        }
@@ -504,7 +503,6 @@ acpi_resume_cpu(struct acpi_softc *sc, i
 #endif

        i8254_startclock();
-       rtcalarm_resume();              /* i8254 must be running */
        if (initclock_func == i8254_initclocks)
                rtcstart();             /* in i8254 mode, rtc is profclock */

@@ -518,6 +516,12 @@ acpi_resume_cpu(struct acpi_softc *sc, i
        /* Re-initialise memory range handling on BSP */
        if (mem_range_softc.mr_op != NULL)
                mem_range_softc.mr_op->initAP(&mem_range_softc);
+
+       if (sc->sc_fadt->flags & FADT_USE_PLATFORM_CLOCK) {
+               if (rtcalarm_fired())
+                       sc->sc_wakegpe = WAKEGPE_RTC;
+       }
+       rtcalarm_resume();
 }

 #ifdef MULTIPROCESSOR
@@ -526,7 +530,7 @@ sleep_mp(void)
 {
        int i;

-       /*
+       /*
         * Wait for cpus to halt so we know their FPU state has been
         * saved and their caches have been written back.
         */

Reply via email to