Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F172039459
D59583.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D59583.diff
View Options
diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c
--- a/sys/dev/acpica/acpi.c
+++ b/sys/dev/acpica/acpi.c
@@ -271,6 +271,24 @@
#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 @@
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 @@
/*
* 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 @@
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,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Sep 16, 3:37 PM (1 h, 28 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
38877612
Default Alt Text
D59583.diff (3 KB)
Attached To
Mode
D59583: acpi: Increase length of time (1s -> 5s) for quirk
Attached
Detach File
Event Timeline
Log In to Comment