Loading...
iokit/Kernel/IOStartIOKit.cpp xnu-12377.101.15 xnu-7195.81.3
--- xnu/xnu-12377.101.15/iokit/Kernel/IOStartIOKit.cpp
+++ xnu/xnu-7195.81.3/iokit/Kernel/IOStartIOKit.cpp
@@ -77,8 +77,11 @@
 	t.tv_sec = 30;
 	t.tv_nsec = 0;
 
+// RTC is not present on this target
+#ifndef BCM2837
 	IOService::waitForService(
 		IOService::resourceMatching("IORTC"), &t );
+#endif
 #if defined(__i386__) || defined(__x86_64__)
 	IOService::waitForService(
 		IOService::resourceMatching("IONVRAM"), &t );
@@ -130,8 +133,35 @@
 void
 InitIOKit(void *dtTop)
 {
+	int                         debugFlags = 0;
+
+	if (PE_parse_boot_argn( "io", &debugFlags, sizeof(debugFlags))) {
+		gIOKitDebug = debugFlags;
+	}
+	// Enable IOWaitQuiet panics on arm64 macOS except on KASAN.
+	// existing 3rd party KEXTs may hold the registry busy on x86 RELEASE kernels.
+	// Enabling this on other platforms is tracked in rdar://66364108
+#if XNU_TARGET_OS_OSX && defined(__arm64__) && !KASAN
+	else {
+		gIOKitDebug |= kIOWaitQuietPanics;
+	}
+#endif
+
+	if (PE_parse_boot_argn( "iotrace", &debugFlags, sizeof(debugFlags))) {
+		gIOKitTrace = debugFlags;
+	}
+
 	// Compat for boot-args
 	gIOKitTrace |= (gIOKitDebug & kIOTraceCompatBootArgs);
+
+	if (PE_parse_boot_argn( "pmtimeout", &debugFlags, sizeof(debugFlags))) {
+		gCanSleepTimeout = debugFlags;
+	}
+
+	if (PE_parse_boot_argn( "dk", &debugFlags, sizeof(debugFlags))) {
+		gIODKDebug = debugFlags;
+	}
+
 
 	//
 	// Have to start IOKit environment before we attempt to start
@@ -143,6 +173,7 @@
 	IOLibInit();
 	OSlibkernInit();
 	IOMachPortInitialize();
+	devsw_init();
 
 	gIOProgressBackbufferKey  = OSSymbol::withCStringNoCopy(kIOProgressBackbufferKey);
 	gIORemoveOnReadProperties = OSSet::withObjects((const OSObject **) &gIOProgressBackbufferKey, 1);
@@ -177,7 +208,6 @@
 void
 StartIOKitMatching(void)
 {
-	SOCD_TRACE_XNU(START_IOKIT, SOCD_TRACE_MODE_NONE);
 	assert(gRootNub != NULL);
 	bool ok = gRootNub->startIOServiceMatching();
 	if (__improbable(!ok)) {
@@ -185,14 +215,12 @@
 	}
 
 #if !NO_KEXTD
-	if (OSKext::iokitDaemonAvailable()) {
-		/* Add a busy count to keep the registry busy until the IOKit daemon has
-		 * completely finished launching. This is decremented when the IOKit daemon
-		 * messages the kernel after the in-kernel linker has been
-		 * removed and personalities have been sent.
-		 */
-		IOService::getServiceRoot()->adjustBusy(1);
-	}
+	/* Add a busy count to keep the registry busy until kextd has
+	 * completely finished launching. This is decremented when kextd
+	 * messages the kernel after the in-kernel linker has been
+	 * removed and personalities have been sent.
+	 */
+	IOService::getServiceRoot()->adjustBusy(1);
 #endif
 }