From nobody Wed Sep 16 12:41:42 2026 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4hlJRb52M1z6t8ss for ; Wed, 16 Sep 2026 12:41:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "YR2" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4hlJRb489Hz4nS7 for ; Wed, 16 Sep 2026 12:41:47 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1789562507; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=KllAfl2N+WmWzJE05OgzzfwdUeSdm0MLmg3ojDcwWGg=; b=ehN7EcJ+uNMF7eKviZU0MntBNfVMZOZnRQxZtQ/2qDXsjNzNzTscxKunTN1RJ8sucCP5E9 Zta3D9H9HSv9OfzPYrKcKiL/Rg7ecNuR4oKwIRHYsF/Vs15dPQV1encnqqBBLOMm1qeK9Q MIhrcV8jGyjWqipUiCouMyfV8QaTsK0f0Sh868i0hQPJSdM1e7X0s3LDvR/XrZjHtcaGk8 Ok8MghkdCJkStAQQCjhY3mYBRa24VxKXvnscJFRluRoYhDCR0JjJjc5VFUPUAo+WGdyRBh KvMSBm5ZeYuRw0iulrfUUihwVtdcw1/UQDSw0LBi/9OAamcLSDlU9kLMwhuYHw== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1789562507; b=jqXUCiJCRhdu0T8U2hMUOXDS93Jmmf6+AKHjcZlP0hls5EEaZ9DdvWZPUPqOpvlVg+4o45 S+pGCS50fsKM+eNiWoRO6h71iiocia52b8AQXfQ7qUZWhXpXvqiRBp/MsxX6sCvPMdzJEA nKdSTXLWILWpg5IpA95oxMI1W7BgpKIPeYWMEOF/GM5rPKrN1tNrEMdGc67obCq/jbBDFe 4yZPpOuem0IywaP2RE1092F1Rqlx4S2CioAyZw3rfNPDMFNDbYz1Z/658BTTw4elP5G/k/ UvSGaFds0V7cmwklf8eHWK10r60jlXR/lLNVSEZxwCyPNHv6K7x8fZe+aq1w2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1789562507; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=KllAfl2N+WmWzJE05OgzzfwdUeSdm0MLmg3ojDcwWGg=; b=EFTE1/j6lutw5++u4pYhH82y2UFHZMfXAmUvWbpojRkc0FI3yJR+zEia4jP5ttFv3Buppu 2PNRj/PYqAcMC6YaCqf7slXkMHB+XKCdZ+ZFNo8hgXsAJpnFCYWRqes6L94SdJCRctrIdt fJMVSD+Ws9LSriQvdkRn2SaM18dJ9ELTr7tyve7jzWWJMVMkEwiM04iTKXKwOcECIQfnQ7 KJdzwj7FMX320CP1UqoZZwJ7lPqL24VKdcK0vuZjrfX5BPEuNQbqp6Ryu2O8+d1Kaa+pGb Y3Oy8KDBm5nHUPSB4YDk7T/N3bh1h36vTWO00K16sqquXKqVhSfHadpbfztxfw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4hlJRb3CRrzmvC for ; Wed, 16 Sep 2026 12:41:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 25304 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 16 Sep 2026 12:41:42 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Devin Teske From: Aymeric Wibo Subject: git: d2ad1c3ffe67 - main - acpi: Increase length of time (1s -> 5s) for quirk List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: obiwac X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d2ad1c3ffe67d7994a409956b6344dd458170d04 Auto-Submitted: auto-generated Date: Wed, 16 Sep 2026 12:41:42 +0000 Message-Id: <6aaa8e86.25304.67e746e3@gitrepo.freebsd.org> The branch main has been updated by obiwac: URL: https://cgit.FreeBSD.org/src/commit/?id=d2ad1c3ffe67d7994a409956b6344dd458170d04 commit d2ad1c3ffe67d7994a409956b6344dd458170d04 Author: Devin Teske AuthorDate: 2026-09-16 12:40:45 +0000 Commit: Aymeric Wibo CommitDate: 2026-09-16 12:40:52 +0000 acpi: Increase length of time (1s -> 5s) for quirk The ACPI quirk on Framework Laptop 12 firmware was previously clocked at ~620 ms for a Notify 0x80 replayed on power-button press to wake. However, when KMS is not loaded, that very same notification comes in past the 1s we previously allowed. Use the already-defined ACPI_MINIMUM_AWAKETIME (5) seconds as our new boundary so that we can successfully come out of S3 on this hardware. Introduce new tunable hw.acpi.button_replay_window Reviewed by: obiwac, olce Differential Revision: https://reviews.freebsd.org/D59583 --- sys/dev/acpica/acpi.c | 46 +++++++++++++++++++++++++++++++--------------- 1 file changed, 31 insertions(+), 15 deletions(-) diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c index 8b897defe6ce..7f9e637c25f9 100644 --- a/sys/dev/acpica/acpi.c +++ b/sys/dev/acpica/acpi.c @@ -271,6 +271,24 @@ static struct rman acpi_rman_io, acpi_rman_mem; #define ACPI_MINIMUM_AWAKETIME 5 +/* + * Grace window after wakeup during which a power/sleep button press for suspend + * is ignored. Some firmware wrongly reports the depress that caused the wakeup + * as an "S0 Power/Sleep Button Pressed" notify (value 0x80) instead of the + * spec-required "Device Wake" notify (0x02); honoring it re-enters sleep + * immediately after resume. On the Framework Laptop 12 the replayed event + * arrives within ~620 ms of the recorded resume time when i915kms is loaded, + * so a one-second window was chosen originally; without KMS the same notify + * can arrive after that one-second mark (and is then held until + * acpi_sleep_disabled clears), so the default was widened to + * ACPI_MINIMUM_AWAKETIME seconds (the same bound already used since + * ece50487e935 to ignore sleep requests for a period after wakeup on some + * Toshiba and ThinkPad machines). Override with hw.acpi.button_replay_window + * (seconds; 0 disables; default ACPI_MINIMUM_AWAKETIME). See + * https://bugs.freebsd.org/296243 for the traces, timing data, and analysis. + */ +static int acpi_button_replay_secs = ACPI_MINIMUM_AWAKETIME; + /* Holds the description of the acpi0 device. */ static char acpi_desc[ACPI_OEM_ID_SIZE + ACPI_OEM_TABLE_ID_SIZE + 2]; @@ -763,6 +781,11 @@ acpi_attach(device_t dev) SYSCTL_ADD_INT(&sc->acpi_sysctl_ctx, SYSCTL_CHILDREN(sc->acpi_sysctl_tree), OID_AUTO, "sleep_delay", CTLFLAG_RW, &sc->acpi_sleep_delay, 0, "sleep delay in seconds"); + SYSCTL_ADD_INT(&sc->acpi_sysctl_ctx, SYSCTL_CHILDREN(sc->acpi_sysctl_tree), + OID_AUTO, "button_replay_window", CTLFLAG_RWTUN, + &acpi_button_replay_secs, 0, + "Seconds after resume to ignore firmware-replayed power/sleep " + "button presses (0 disables)"); SYSCTL_ADD_BOOL(&sc->acpi_sysctl_ctx, SYSCTL_CHILDREN(sc->acpi_sysctl_tree), OID_AUTO, "s4bios_supported", CTLFLAG_RD, &sc->acpi_s4bios_supported, 0, "Whether firmware supports saving/restoring the machine state (S4BIOS)."); @@ -3769,7 +3792,7 @@ backout: /* * Record the resume time so a spurious power/sleep button press can be * ignored for a grace period afterward (see the comment before - * ACPI_BUTTON_REPLAY_WINDOW). This must be taken before + * acpi_button_replay_secs). This must be taken before * DEVICE_RESUME(), which re-initializes the EC that replays the press. */ sc->acpi_resume_sbt = getsbinuptime(); @@ -4163,27 +4186,20 @@ acpi_system_eventhandler_wakeup(struct acpi_softc *const sc, return_VOID; } -/* - * Grace window after wakeup during which a power/sleep button press for suspend - * is ignored. Some firmware wrongly reports the depress that caused the wakeup - * as an "S0 Power/Sleep Button Pressed" notify (value 0x80) instead of the - * spec-required "Device Wake" notify (0x02); honoring it re-enters sleep - * immediately after resume. On the Framework Laptop 12 the replayed event - * arrives within ~620 ms of the recorded resume time, so a one-second window - * was chosen. See https://bugs.freebsd.org/296243 for the traces, timing - * data, and analysis. - */ -#define ACPI_BUTTON_REPLAY_WINDOW SBT_1S - static bool acpi_button_resume_replay(struct acpi_softc *sc, const char *which) { - sbintime_t elapsed; + sbintime_t elapsed, window; + int secs; if (sc->acpi_resume_sbt == 0) return (false); + secs = acpi_button_replay_secs; + if (secs <= 0) + return (false); + window = SBT_1S * secs; elapsed = getsbinuptime() - sc->acpi_resume_sbt; - if (elapsed < 0 || elapsed >= ACPI_BUTTON_REPLAY_WINDOW) + if (elapsed < 0 || elapsed >= window) return (false); if (bootverbose) { device_printf(sc->acpi_dev,