]> git.saurik.com Git - apple/xnu.git/blobdiff - iokit/Kernel/IOStartIOKit.cpp
xnu-4570.51.1.tar.gz
[apple/xnu.git] / iokit / Kernel / IOStartIOKit.cpp
index 7b70541d6486089b04e756e859add89749f4cc52..6eb48b713b9b4e884454b18d0755cb0f97e112bd 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998-2011 Apple Inc. All rights reserved.
+ * Copyright (c) 1998-2010 Apple Inc. All rights reserved.
  *
  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
  * 
 #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/IOStatisticsPrivate.h>
+#include <IOKit/IOKitKeysPrivate.h>
+#include <IOKit/IOInterruptAccountingPrivate.h>
 #include <IOKit/assert.h>
+#include <sys/conf.h>
 
 #include "IOKitKernelInternal.h"
 
+const OSSymbol * gIOProgressBackbufferKey;
+OSSet *          gIORemoveOnReadProperties;
+
 extern "C" {
 
+void StartIOKit( void * p1, void * p2, void * p3, void * p4 );
+void IORegistrySetOSBuildVersion(char * build_version);
+void IORecordProgressBackbuffer(void * buffer, size_t size, uint32_t theme);
+
 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>
@@ -61,24 +72,12 @@ void IOKitInitializeTime( void )
        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
 
-    clock_initialize_calendar();
-}
-
-void IOKitResetTime( void )
-{
-    clock_sec_t                secs;
-       clock_usec_t    microsecs;
-
-    clock_initialize_calendar();
-
-    clock_get_calendar_microtime(&secs, &microsecs);
-    gIOLastWakeTime.tv_sec  = secs;
-    gIOLastWakeTime.tv_usec = microsecs;
+       clock_initialize_calendar();
 }
 
 void iokit_post_constructor_init(void)
@@ -86,12 +85,16 @@ void iokit_post_constructor_init(void)
     IORegistryEntry *          root;
     OSObject *                 obj;
 
+    IOCPUInitialize();
     root = IORegistryEntry::initialize();
     assert( root );
     IOService::initialize();
     IOCatalogue::initialize();
+    IOStatistics::initialize();
+    OSKext::initialize();
     IOUserClient::initialize();
     IOMemoryDescriptor::initialize();
+    IORootParent::initialize();
 
     // Initializes IOPMinformeeList class-wide shared lock
     IOPMinformeeList::getSharedRecursiveLock();
@@ -107,12 +110,8 @@ void iokit_post_constructor_init(void)
         root->setProperty( kIOKitDiagnosticsKey, obj );
        obj->release();
     }
-
 }
 
-// From <osfmk/kern/debug.c>
-extern int debug_mode;
-
 /*****
  * Pointer into bootstrap KLD segment for functions never used past startup.
  */
@@ -122,24 +121,21 @@ void StartIOKit( void * p1, void * p2, void * p3, void * p4 )
 {
     IOPlatformExpertDevice *   rootNub;
     int                                debugFlags;
-       uint32_t                intThreshold;
 
     if( PE_parse_boot_argn( "io", &debugFlags, sizeof (debugFlags) ))
        gIOKitDebug = debugFlags;
-
-    if( PE_parse_boot_argn( "iotrace", &debugFlags, sizeof (debugFlags) ))
-               gIOKitTrace = debugFlags;
+#if DEVELOPMENT || DEBUG
+    else gIOKitDebug |= kIOWaitQuietPanics;
+#endif /* DEVELOPMENT || DEBUG */
        
-       // Compat for boot-args
-       gIOKitTrace |= (gIOKitDebug & kIOTraceCompatBootArgs);
-
-    if( PE_parse_boot_argn( "iointthreshold", &intThreshold, sizeof (intThreshold) ))
-               gIOInterruptThresholdNS = intThreshold * 1000;
+    if( PE_parse_boot_argn( "iotrace", &debugFlags, sizeof (debugFlags) ))
+       gIOKitTrace = debugFlags;
        
-    // Check for the log synchronous bit set in io
-    if (gIOKitDebug & kIOLogSynchronous)
-        debug_mode = true;
+    // Compat for boot-args
+    gIOKitTrace |= (gIOKitDebug & kIOTraceCompatBootArgs);
        
+    if( PE_parse_boot_argn( "pmtimeout", &debugFlags, sizeof (debugFlags) ))
+        gCanSleepTimeout = debugFlags;
     //
     // Have to start IOKit environment before we attempt to start
     // the C++ runtime environment.  At some stage we have to clean up
@@ -149,6 +145,12 @@ void StartIOKit( void * p1, void * p2, void * p3, void * p4 )
     //
     IOLibInit(); 
     OSlibkernInit();
+    devsw_init();
+
+    gIOProgressBackbufferKey  = OSSymbol::withCStringNoCopy(kIOProgressBackbufferKey);
+    gIORemoveOnReadProperties = OSSet::withObjects((const OSObject **) &gIOProgressBackbufferKey, 1);
+
+    interruptAccountingInit();
 
     rootNub = new IOPlatformExpertDevice;
 
@@ -191,4 +193,17 @@ IORegistrySetOSBuildVersion(char * build_version)
     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" */