aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAymeric Wibo <obiwac@FreeBSD.org>2026-01-19 13:19:52 +0000
committerAymeric Wibo <obiwac@FreeBSD.org>2026-01-19 16:30:10 +0000
commit4b534b814aa03b44660ede6d5f1a62cb33c24115 (patch)
treee264e186cabe6db0bcd827db8b69dbc862a5e3c9
parent709a53c8b20b5770f7e2f117d4799b5617479976 (diff)
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
-rw-r--r--sys/dev/acpica/acpi.c9
1 files 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;
}