]> git.saurik.com Git - apple/xnu.git/blobdiff - bsd/kern/kern_shutdown.c
xnu-4570.51.1.tar.gz
[apple/xnu.git] / bsd / kern / kern_shutdown.c
index 2be1a131061266b2651cc6e5e2a1f2155d0ef8ee..48f9128005f977f12234a8277002b99c16126792 100644 (file)
@@ -68,6 +68,7 @@
 #include <sys/sysproto.h>              /* abused for sync() */
 #include <kern/clock.h>                        /* for delay_for_interval() */
 #include <libkern/OSAtomic.h>
+#include <IOKit/IOPlatformExpert.h>
 
 #include <sys/kdebug.h>
 
@@ -83,7 +84,6 @@ static int  sd_closelog(vfs_context_t);
 static void sd_log(vfs_context_t, const char *, ...);
 static void proc_shutdown(void);
 static void kernel_hwm_panic_info(void);
-extern void IOSystemShutdownNotification(void);
 extern void halt_log_enter(const char * what, const void * pc, uint64_t time);
 
 #if DEVELOPMENT || DEBUG
@@ -157,10 +157,9 @@ reboot_kernel(int howto, char *message)
                return (EBUSY);
        }
        /*
-        * Temporary hack to notify the power management root domain
-        * that the system will shut down.
+        * Notify the power management root domain that the system will shut down.
         */
-       IOSystemShutdownNotification();
+       IOSystemShutdownNotification(kIOSystemShutdownNotificationStageProcessExit);
 
        if ((howto&RB_QUICK)==RB_QUICK) {
                printf("Quick reboot...\n");
@@ -201,6 +200,8 @@ reboot_kernel(int howto, char *message)
                        halt_log_enter("shutdown.trace", 0, mach_absolute_time() - startTime);
                }
 
+               IOSystemShutdownNotification(kIOSystemShutdownNotificationStageRootUnmount);
+
                /*
                 * Unmount filesystems
                 */