summaryrefslogtreecommitdiffstats
path: root/sys/dev/acpica/acpivar.h
diff options
context:
space:
mode:
authornjl <njl@FreeBSD.org>2007-06-21 22:50:37 +0000
committernjl <njl@FreeBSD.org>2007-06-21 22:50:37 +0000
commit79d6390885127f514c12c1f7aeb8e0272fa73621 (patch)
tree6d3282ab53bb6c9d24fd93319d317dd8d32ef41e /sys/dev/acpica/acpivar.h
parent4db323384d511bec08394e226ffbc340bcadbbf0 (diff)
downloadFreeBSD-src-79d6390885127f514c12c1f7aeb8e0272fa73621.zip
FreeBSD-src-79d6390885127f514c12c1f7aeb8e0272fa73621.tar.gz
Update the suspend/resume user API while maintaining backwards compat.
Improvements: * /etc/rc.suspend,rc.resume are always run, no matter the source of the suspend request (user or kernel, apm or acpi) * suspend now requires positive user acknowledgement. If a user program wants to cancel the suspend, they can. If one of the user programs hangs or doesn't respond within 10 seconds, the system suspends anyway. * /dev/apm is clonable, allowing multiple listeners for suspend events. In the future, xorg-server can use this to be informed about suspend even if there are other listeners (i.e. apmd). Changes: * Two new ACPI ioctls: REQSLPSTATE and ACKSLPSTATE. Request begins the process of suspending by notifying all listeners. acpi is monitored by devd(8) and /dev/apm listener(s) are also counted. Users register their approval or disapproval via Ack. If anyone disapproves, suspend is vetoed. * Old user programs or kernel modules that used SETSLPSTATE continue to work. A message is printed once that this interface is deprecated. * acpiconf gains the -k flag to ack the suspend request. This flag is undocumented on purpose since it's only used by /etc/rc.suspend. It is not intended to be a permanent change and will be removed once a better power API is implemented. * S5 (power off) is no longer supported via acpiconf -s 5 or apm -z/-Z. This restores previous behavior of halt/shutdown -p being the interface. * Miscellaneous improvements to error reporting Approved by: re
Diffstat (limited to 'sys/dev/acpica/acpivar.h')
-rw-r--r--sys/dev/acpica/acpivar.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/sys/dev/acpica/acpivar.h b/sys/dev/acpica/acpivar.h
index ceb9828..1034273 100644
--- a/sys/dev/acpica/acpivar.h
+++ b/sys/dev/acpica/acpivar.h
@@ -39,12 +39,14 @@
#include <sys/ktr.h>
#include <sys/lock.h>
#include <sys/mutex.h>
+#include <sys/selinfo.h>
#include <sys/sx.h>
#include <sys/sysctl.h>
#include <machine/bus.h>
#include <machine/resource.h>
+struct apm_clone_data;
struct acpi_softc {
device_t acpi_dev;
struct cdev *acpi_dev_t;
@@ -76,6 +78,11 @@ struct acpi_softc {
bus_dmamap_t acpi_wakemap;
vm_offset_t acpi_wakeaddr;
vm_paddr_t acpi_wakephys;
+
+ int acpi_next_sstate; /* Next suspend Sx state. */
+ struct apm_clone_data *acpi_clone; /* Pseudo-dev for devd(8). */
+ STAILQ_HEAD(,apm_clone_data) apm_cdevs; /* All apm/apmctl/acpi cdevs. */
+ struct callout susp_force_to; /* Force suspend if no acks. */
};
struct acpi_device {
@@ -89,6 +96,22 @@ struct acpi_device {
struct resource_list ad_rl;
};
+/* Track device (/dev/{apm,apmctl} and /dev/acpi) notification status. */
+struct apm_clone_data {
+ STAILQ_ENTRY(apm_clone_data) entries;
+ struct cdev *cdev;
+ int flags;
+#define ACPI_EVF_NONE 0 /* /dev/apm semantics */
+#define ACPI_EVF_DEVD 1 /* /dev/acpi is handled via devd(8) */
+#define ACPI_EVF_WRITE 2 /* Device instance is opened writable. */
+ int notify_status;
+#define APM_EV_NONE 0 /* Device not yet aware of pending sleep. */
+#define APM_EV_NOTIFIED 1 /* Device saw next sleep state. */
+#define APM_EV_ACKED 2 /* Device agreed sleep can occur. */
+ struct acpi_softc *acpi_sc;
+ struct selinfo sel_read;
+};
+
#define ACPI_PRW_MAX_POWERRES 8
struct acpi_prw_data {
@@ -304,6 +327,8 @@ ACPI_STATUS acpi_AppendBufferResource(ACPI_BUFFER *buf,
ACPI_RESOURCE *res);
ACPI_STATUS acpi_OverrideInterruptLevel(UINT32 InterruptNumber);
ACPI_STATUS acpi_SetIntrModel(int model);
+int acpi_ReqSleepState(struct acpi_softc *sc, int state);
+int acpi_AckSleepState(struct apm_clone_data *clone, int error);
ACPI_STATUS acpi_SetSleepState(struct acpi_softc *sc, int state);
int acpi_wake_init(device_t dev, int type);
int acpi_wake_set_enable(device_t dev, int enable);
OpenPOWER on IntegriCloud