Author: jkim
Date: Thu Apr 14 22:17:39 2011
New Revision: 220647
URL: http://svn.freebsd.org/changeset/base/220647

Log:
  Add event handlers for (ACPI) suspend/resume events.  Suspend event handlers
  are invoked right before device drivers go into sleep state and resume event
  handlers are invoked right after all device drivers are waken up.

Modified:
  head/sys/dev/acpica/acpi.c
  head/sys/sys/eventhandler.h

Modified: head/sys/dev/acpica/acpi.c
==============================================================================
--- head/sys/dev/acpica/acpi.c  Thu Apr 14 22:06:11 2011        (r220646)
+++ head/sys/dev/acpica/acpi.c  Thu Apr 14 22:17:39 2011        (r220647)
@@ -2594,6 +2594,8 @@ acpi_EnterSleepState(struct acpi_softc *
        return_ACPI_STATUS (AE_OK);
     }
 
+    EVENTHANDLER_INVOKE(power_suspend);
+
     if (smp_started) {
        thread_lock(curthread);
        sched_bind(curthread, 0);
@@ -2685,6 +2687,8 @@ backout:
        thread_unlock(curthread);
     }
 
+    EVENTHANDLER_INVOKE(power_resume);
+
     /* Allow another sleep request after a while. */
     timeout(acpi_sleep_enable, sc, hz * ACPI_MINIMUM_AWAKETIME);
 

Modified: head/sys/sys/eventhandler.h
==============================================================================
--- head/sys/sys/eventhandler.h Thu Apr 14 22:06:11 2011        (r220646)
+++ head/sys/sys/eventhandler.h Thu Apr 14 22:17:39 2011        (r220647)
@@ -178,6 +178,11 @@ EVENTHANDLER_DECLARE(shutdown_pre_sync, 
 EVENTHANDLER_DECLARE(shutdown_post_sync, shutdown_fn); /* after fs sync */
 EVENTHANDLER_DECLARE(shutdown_final, shutdown_fn);
 
+/* Power state change events */
+typedef void (*power_change_fn)(void *);
+EVENTHANDLER_DECLARE(power_resume, power_change_fn);
+EVENTHANDLER_DECLARE(power_suspend, power_change_fn);
+
 /* Low memory event */
 typedef void (*vm_lowmem_handler_t)(void *, int);
 #define        LOWMEM_PRI_DEFAULT      EVENTHANDLER_PRI_FIRST
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to