From 93bfd059fdd6c594e585405b0bf0e405905469a3 Mon Sep 17 00:00:00 2001 From: Nate Lawson Date: Fri, 25 May 2007 05:26:21 +0000 Subject: [PATCH] Add a sysctl, 'debug.acpi.suspend_bounce', that causes the system to bounce back in a simulated resume instead of entering the requested suspend state. This helps in testing drivers separately from the acpi suspend code. To test your drivers, set debug.acpi.suspend_bounce=1 and then run acpiconf -s3 (or 4). MFC after: 1 day --- sys/dev/acpica/acpi.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c index c6dbb3bfb63c..f9b77bfc9d52 100644 --- a/sys/dev/acpica/acpi.c +++ b/sys/dev/acpica/acpi.c @@ -242,6 +242,10 @@ SYSCTL_INT(_debug_acpi, OID_AUTO, do_powerstate, CTLFLAG_RW, /* Allow users to override quirks. */ TUNABLE_INT("debug.acpi.quirks", &acpi_quirks); +static int acpi_susp_bounce; +SYSCTL_INT(_debug_acpi, OID_AUTO, suspend_bounce, CTLFLAG_RW, + &acpi_susp_bounce, 0, "Don't actually suspend, just test devices."); + /* * ACPI can only be loaded as a module by the loader; activating it after * system bootstrap time is not useful, and can be fatal to the system. @@ -2198,6 +2202,10 @@ acpi_SetSleepState(struct acpi_softc *sc, int state) } slp_state = ACPI_SS_DEV_SUSPEND; + /* If testing device suspend only, back out of everything here. */ + if (acpi_susp_bounce) + break; + status = AcpiEnterSleepStatePrep(state); if (ACPI_FAILURE(status)) { device_printf(sc->acpi_dev, "AcpiEnterSleepStatePrep failed - %s\n",