The branch main has been updated by obiwac:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=4b534b814aa03b44660ede6d5f1a62cb33c24115

commit 4b534b814aa03b44660ede6d5f1a62cb33c24115
Author:     Aymeric Wibo <[email protected]>
AuthorDate: 2026-01-19 13:19:52 +0000
Commit:     Aymeric Wibo <[email protected]>
CommitDate: 2026-01-19 16:30:10 +0000

    acpi: Fix not calling AcpiLeaveSleepState() in S3 path
    
    When resuming from ACPI suspend, the ACPI_SS_SLP_PREP bit in slp_state
    was being checked and subsequently unset when calling resumeclock().
    This bit was also being checked for the AcpiLeaveSleepState() call in
    the non-s2idle path, but having just been unset, it was never actually
    being called.
    
    Change this so that resumeclock() is always being called (since we never
    goto breakout between suspendclock() and resumeclock() anyway) and
    ACPI_SS_SLP_PREP is purely used for AcpiEnterSleepStatePrep() and
    AcpiLeaveSleepState() in the non-s2idle paths.
    
    PR:             292568
    Reported by:    Marek Zarychta
    Reviewed by:    olce
    Tested by:      Marek Zarychta
    Approved by:    olce
    Fixes:  7669cbd0f064 (“acpi: Suspend-to-idle support (s2idle)”)
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D54777
---
 sys/dev/acpica/acpi.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c
index 518cbce19e33..c76bc8477537 100644
--- a/sys/dev/acpica/acpi.c
+++ b/sys/dev/acpica/acpi.c
@@ -3645,8 +3645,8 @@ acpi_EnterSleepState(struct acpi_softc *sc, enum 
power_stype stype)
                AcpiFormatException(status));
            goto backout;
        }
+       slp_state |= ACPI_SS_SLP_PREP;
     }
-    slp_state |= ACPI_SS_SLP_PREP;
 
     if (sc->acpi_sleep_delay > 0)
        DELAY(sc->acpi_sleep_delay * 1000000);
@@ -3672,16 +3672,13 @@ acpi_EnterSleepState(struct acpi_softc *sc, enum 
power_stype stype)
     case POWER_STYPE_UNKNOWN:
        __unreachable();
     }
+    resumeclock();
 
     /*
      * Back out state according to how far along we got in the suspend
      * process.  This handles both the error and success cases.
      */
 backout:
-    if ((slp_state & ACPI_SS_SLP_PREP) != 0) {
-       resumeclock();
-       slp_state &= ~ACPI_SS_SLP_PREP;
-    }
     if ((slp_state & ACPI_SS_GPE_SET) != 0) {
        acpi_wake_prep_walk(sc, stype);
        sc->acpi_stype = POWER_STYPE_AWAKE;
@@ -3691,7 +3688,7 @@ backout:
        DEVICE_RESUME(root_bus);
        slp_state &= ~ACPI_SS_DEV_SUSPEND;
     }
-    if (stype != POWER_STYPE_SUSPEND_TO_IDLE && (slp_state & ACPI_SS_SLP_PREP) 
!= 0) {
+    if ((slp_state & ACPI_SS_SLP_PREP) != 0) {
        AcpiLeaveSleepState(acpi_sstate);
        slp_state &= ~ACPI_SS_SLP_PREP;
     }

Reply via email to