PERFORCE change 38516 for review

John Baldwin jhb at FreeBSD.org
Wed Sep 24 08:27:24 PDT 2003


http://perforce.freebsd.org/chv.cgi?CH=38516

Change 38516 by jhb at jhb_laptop on 2003/09/24 08:26:54

	Add methods to ACPI for getting/setting device power state.

Affected files ...

.. //depot/projects/power/sys/dev/acpica/acpi.c#2 edit

Differences ...

==== //depot/projects/power/sys/dev/acpica/acpi.c#2 (text+ko) ====

@@ -1415,6 +1415,43 @@
 }
 
 /*
+ * Get a specified device's power state.
+ */
+ACPI_STATUS
+acpi_GetPowerState(ACPI_HANDLE handle, int *state)
+{
+
+	return (acpi_EvaluateInteger(handle, "_PSC", state);
+}
+
+/*
+ * Set a specified device's power state.
+ */
+ACPI_STATUS
+acpi_SetPowerState(ACPI_HANDLE handle, int state)
+{
+	char *method;
+
+	switch (state) {
+	case ACPI_STATE_D0:
+		method = "_PS0";
+		break;
+	case ACPI_STATE_D1:
+		method = "_PS1";
+		break;
+	case ACPI_STATE_D2:
+		method = "_PS2";
+		break;
+	case ACPI_STATE_D3:
+		method = "_PS3";
+		break;
+	default:
+		return (AE_BAD_PARAMETER);
+	}
+	return (AcpiEvaluateObject(handle, method, NULL, NULL);
+}
+
+/*
  * Set the system sleep state
  *
  * Currently we support S1-S5 but S4 is only S4BIOS


More information about the p4-projects mailing list