Page MenuHomeFreeBSD

D52497.id161944.diff
No OneTemporary

D52497.id161944.diff

diff --git a/sys/dev/acpi_support/acpi_ibm.c b/sys/dev/acpi_support/acpi_ibm.c
--- a/sys/dev/acpi_support/acpi_ibm.c
+++ b/sys/dev/acpi_support/acpi_ibm.c
@@ -1447,8 +1447,13 @@
ACPI_SERIAL_BEGIN(ibm);
switch (arg) {
+ /*
+ * XXX "Suspend-to-RAM" here is as opposed to suspend-to-disk, but it is
+ * fine if our suspend sleep state transition request puts us in s2idle
+ * instead of suspend-to-RAM.
+ */
case IBM_EVENT_SUSPEND_TO_RAM:
- power_pm_suspend(POWER_SLEEP_STATE_SUSPEND);
+ power_pm_suspend(POWER_SSTATE_TRANSITION_SUSPEND);
break;
case IBM_EVENT_BLUETOOTH:
diff --git a/sys/dev/syscons/syscons.c b/sys/dev/syscons/syscons.c
--- a/sys/dev/syscons/syscons.c
+++ b/sys/dev/syscons/syscons.c
@@ -3987,10 +3987,10 @@
break;
case SUSP:
- power_pm_suspend(POWER_SLEEP_STATE_SUSPEND);
+ power_pm_suspend(POWER_SSTATE_TRANSITION_SUSPEND);
break;
case STBY:
- power_pm_suspend(POWER_SLEEP_STATE_STANDBY);
+ power_pm_suspend(POWER_SSTATE_TRANSITION_STANDBY);
break;
case DBG:
diff --git a/sys/dev/vt/vt_core.c b/sys/dev/vt/vt_core.c
--- a/sys/dev/vt/vt_core.c
+++ b/sys/dev/vt/vt_core.c
@@ -804,11 +804,11 @@
return (1);
case SPCLKEY | STBY: /* XXX Not present in kbdcontrol parser. */
/* Put machine into Stand-By mode. */
- power_pm_suspend(POWER_SLEEP_STATE_STANDBY);
+ power_pm_suspend(POWER_SSTATE_TRANSITION_STANDBY);
return (1);
case SPCLKEY | SUSP: /* kbdmap(5) keyword `susp`. */
/* Suspend machine. */
- power_pm_suspend(POWER_SLEEP_STATE_SUSPEND);
+ power_pm_suspend(POWER_SSTATE_TRANSITION_SUSPEND);
return (1);
}
diff --git a/sys/kern/subr_power.c b/sys/kern/subr_power.c
--- a/sys/kern/subr_power.c
+++ b/sys/kern/subr_power.c
@@ -176,25 +176,25 @@
}
void
-power_pm_suspend(int state)
+power_pm_suspend(enum power_sstate_transition trans)
{
enum power_stype stype;
if (power_pm_fn == NULL)
return;
- switch (state) {
- case POWER_SLEEP_STATE_STANDBY:
+ switch (trans) {
+ case POWER_SSTATE_TRANSITION_STANDBY:
stype = power_standby_stype;
break;
- case POWER_SLEEP_STATE_SUSPEND:
+ case POWER_SSTATE_TRANSITION_SUSPEND:
stype = power_suspend_stype;
break;
- case POWER_SLEEP_STATE_HIBERNATE:
+ case POWER_SSTATE_TRANSITION_HIBERNATE:
stype = power_hibernate_stype;
break;
default:
- printf("%s: unknown sleep state %d\n", __func__, state);
+ printf("%s: unknown sleep state %d\n", __func__, trans);
return;
}
diff --git a/sys/sys/power.h b/sys/sys/power.h
--- a/sys/sys/power.h
+++ b/sys/sys/power.h
@@ -45,22 +45,25 @@
#define POWER_CMD_SUSPEND 0x00
/*
- * Sleep state.
+ * Sleep state transition requests.
*
* These are high-level sleep states that the system can enter. They map to
* a specific generic sleep type (enum power_stype).
*/
-#define POWER_SLEEP_STATE_STANDBY 0x00
-#define POWER_SLEEP_STATE_SUSPEND 0x01
-#define POWER_SLEEP_STATE_HIBERNATE 0x02
+enum power_sstate_transition {
+ // TODO Is there a reason we'd want to explicitly set these values?
+ POWER_SSTATE_TRANSITION_STANDBY,
+ POWER_SSTATE_TRANSITION_SUSPEND,
+ POWER_SSTATE_TRANSITION_HIBERNATE,
+};
/*
* Sleep type.
*
* These are the specific generic methods of entering a sleep state. E.g.
- * POWER_SLEEP_STATE_SUSPEND could be set to enter either suspend-to-RAM (which
- * is S3 on ACPI systems), or suspend-to-idle (S0ix on ACPI systems). This
- * would be done through the kern.power.suspend sysctl.
+ * POWER_SSTATE_TRANSITION_SUSPEND could be set to enter either suspend-to-RAM
+ * (which is S3 on ACPI systems), or suspend-to-idle (S0ix on ACPI systems).
+ * This would be done through the kern.power.suspend sysctl.
*/
enum power_stype {
POWER_STYPE_AWAKE,
@@ -94,7 +97,7 @@
void *_pm_arg,
bool _pm_supported[static POWER_STYPE_COUNT]);
extern u_int power_pm_get_type(void);
-extern void power_pm_suspend(int);
+extern void power_pm_suspend(enum power_sstate_transition _trans);
/*
* System power API.

File Metadata

Mime Type
text/plain
Expires
Sun, Oct 12, 11:41 AM (36 m, 42 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
23564379
Default Alt Text
D52497.id161944.diff (3 KB)

Event Timeline