]> git.saurik.com Git - apple/xnu.git/blobdiff - iokit/Kernel/IOStartIOKit.cpp
xnu-2782.20.48.tar.gz
[apple/xnu.git] / iokit / Kernel / IOStartIOKit.cpp
index b621622fa938e72cec9b9b9f209fd47b9e1aa391..787a69bf26679ddd080c2bf68d45b97da7fb7e14 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 1998-2008 Apple Inc. All rights reserved.
+ * Copyright (c) 1998-2010 Apple Inc. All rights reserved.
  *
  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
  * 
  *
  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
  * 
  * 
  * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
  */
  * 
  * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
  */
-/*
- * Copyright (c) 1998,1999 Apple Inc.  All rights reserved. 
- *
- * HISTORY
- *
- */
 
 #include <libkern/c++/OSUnserialize.h>
 #include <libkern/c++/OSKext.h>
 
 #include <libkern/c++/OSUnserialize.h>
 #include <libkern/c++/OSKext.h>
 #include <IOKit/IOLib.h>
 #include <IOKit/IOKitKeys.h>
 #include <IOKit/IOKitDebug.h>
 #include <IOKit/IOLib.h>
 #include <IOKit/IOKitKeys.h>
 #include <IOKit/IOKitDebug.h>
+#include <IOKit/pwr_mgt/RootDomain.h>
 #include <IOKit/pwr_mgt/IOPMinformeeList.h>
 #include <IOKit/pwr_mgt/IOPMinformeeList.h>
+#include <IOKit/IOStatisticsPrivate.h>
+#include <IOKit/IOKitKeysPrivate.h>
+#include <IOKit/IOInterruptAccountingPrivate.h>
 
 #include <IOKit/assert.h>
 
 #include "IOKitKernelInternal.h"
 
 
 #include <IOKit/assert.h>
 
 #include "IOKitKernelInternal.h"
 
+const OSSymbol * gIOProgressBackbufferKey;
+OSSet *          gIORemoveOnReadProperties;
+
 extern "C" {
 
 extern void OSlibkernInit (void);
 
 extern "C" {
 
 extern void OSlibkernInit (void);
 
-void iokit_post_constructor_init(void) __attribute__((section("__TEXT, initcode")));
+void iokit_post_constructor_init(void);
 
 #include <kern/clock.h>
 #include <sys/time.h>
 
 #include <kern/clock.h>
 #include <sys/time.h>
@@ -67,7 +68,7 @@ void IOKitInitializeTime( void )
        t.tv_nsec = 0;
        IOService::waitForService(
                IOService::resourceMatching("IORTC"), &t );
        t.tv_nsec = 0;
        IOService::waitForService(
                IOService::resourceMatching("IORTC"), &t );
-#ifdef ppc
+#if defined(__i386__) || defined(__x86_64__)
        IOService::waitForService(
                IOService::resourceMatching("IONVRAM"), &t );
 #endif
        IOService::waitForService(
                IOService::resourceMatching("IONVRAM"), &t );
 #endif
@@ -85,6 +86,8 @@ void IOKitResetTime( void )
     clock_get_calendar_microtime(&secs, &microsecs);
     gIOLastWakeTime.tv_sec  = secs;
     gIOLastWakeTime.tv_usec = microsecs;
     clock_get_calendar_microtime(&secs, &microsecs);
     gIOLastWakeTime.tv_sec  = secs;
     gIOLastWakeTime.tv_usec = microsecs;
+
+    IOService::updateConsoleUsers(NULL, kIOMessageSystemHasPoweredOn);
 }
 
 void iokit_post_constructor_init(void)
 }
 
 void iokit_post_constructor_init(void)
@@ -96,8 +99,11 @@ void iokit_post_constructor_init(void)
     assert( root );
     IOService::initialize();
     IOCatalogue::initialize();
     assert( root );
     IOService::initialize();
     IOCatalogue::initialize();
+    IOStatistics::initialize();
+    OSKext::initialize();
     IOUserClient::initialize();
     IOMemoryDescriptor::initialize();
     IOUserClient::initialize();
     IOMemoryDescriptor::initialize();
+    IORootParent::initialize();
 
     // Initializes IOPMinformeeList class-wide shared lock
     IOPMinformeeList::getSharedRecursiveLock();
 
     // Initializes IOPMinformeeList class-wide shared lock
     IOPMinformeeList::getSharedRecursiveLock();
@@ -113,7 +119,6 @@ void iokit_post_constructor_init(void)
         root->setProperty( kIOKitDiagnosticsKey, obj );
        obj->release();
     }
         root->setProperty( kIOKitDiagnosticsKey, obj );
        obj->release();
     }
-
 }
 
 // From <osfmk/kern/debug.c>
 }
 
 // From <osfmk/kern/debug.c>
@@ -130,8 +135,14 @@ void StartIOKit( void * p1, void * p2, void * p3, void * p4 )
     int                                debugFlags;
 
     if( PE_parse_boot_argn( "io", &debugFlags, sizeof (debugFlags) ))
     int                                debugFlags;
 
     if( PE_parse_boot_argn( "io", &debugFlags, sizeof (debugFlags) ))
-       gIOKitDebug = debugFlags;
-
+               gIOKitDebug = debugFlags;
+       
+    if( PE_parse_boot_argn( "iotrace", &debugFlags, sizeof (debugFlags) ))
+               gIOKitTrace = debugFlags;
+       
+       // Compat for boot-args
+       gIOKitTrace |= (gIOKitDebug & kIOTraceCompatBootArgs);
+       
     // Check for the log synchronous bit set in io
     if (gIOKitDebug & kIOLogSynchronous)
         debug_mode = true;
     // Check for the log synchronous bit set in io
     if (gIOKitDebug & kIOLogSynchronous)
         debug_mode = true;
@@ -146,6 +157,11 @@ void StartIOKit( void * p1, void * p2, void * p3, void * p4 )
     IOLibInit(); 
     OSlibkernInit();
 
     IOLibInit(); 
     OSlibkernInit();
 
+    gIOProgressBackbufferKey  = OSSymbol::withCStringNoCopy(kIOProgressBackbufferKey);
+    gIORemoveOnReadProperties = OSSet::withObjects((const OSObject **) &gIOProgressBackbufferKey, 1);
+
+    interruptAccountingInit();
+
     rootNub = new IOPlatformExpertDevice;
 
     if( rootNub && rootNub->initWithArgs( p1, p2, p3, p4)) {
     rootNub = new IOPlatformExpertDevice;
 
     if( rootNub && rootNub->initWithArgs( p1, p2, p3, p4)) {
@@ -187,4 +203,17 @@ IORegistrySetOSBuildVersion(char * build_version)
     return;
 }
 
     return;
 }
 
+void
+IORecordProgressBackbuffer(void * buffer, size_t size, uint32_t theme)
+{
+    IORegistryEntry * chosen;
+    if ((chosen = IORegistryEntry::fromPath(kIODeviceTreePlane ":/chosen")))
+    {
+        chosen->setProperty(kIOProgressBackbufferKey, buffer, size);
+       chosen->setProperty(kIOProgressColorThemeKey, theme, 32);
+
+        chosen->release();
+    }
+}
+
 }; /* extern "C" */
 }; /* extern "C" */