+static void swdDebugSetupCallout( thread_call_param_t p0, thread_call_param_t p1 )
+{
+ IOPMrootDomain * rootDomain = (IOPMrootDomain *) p0;
+ uint32_t notifyRef = (uint32_t)(uintptr_t) p1;
+
+ rootDomain->swdDebugSetup();
+
+ if (p1) {
+ rootDomain->allowPowerChange(notifyRef);
+ }
+ DLOG("swdDebugSetupCallout finish\n");
+}
+
+void IOPMrootDomain::swdDebugSetup( )
+{
+#if HIBERNATION
+ static int32_t mem_only = -1;
+ if ((mem_only == -1) &&
+ (PE_parse_boot_argn("swd_mem_only", &mem_only, sizeof(mem_only)) == false)) {
+ mem_only = 0;
+ }
+
+ if ((mem_only == 1) || (gRootDomain->sleepWakeDebugIsWdogEnabled() == false)) {
+ return;
+ }
+ DLOG("swdDebugSetup state:%d\n", swd_DebugImageSetup);
+ if (swd_DebugImageSetup == FALSE) {
+ swd_DebugImageSetup = TRUE;
+ if (CAP_GAIN(kIOPMSystemCapabilityGraphics) ||
+ (CAP_LOSS(kIOPMSystemCapabilityGraphics))) {
+ IOHibernateSystemPostWake(true);
+ }
+ IOOpenDebugDataFile(kSleepWakeStackBinFilename, SWD_BUF_SIZE);
+ }
+#endif
+
+
+}
+
+static void swdDebugTeardownCallout( thread_call_param_t p0, thread_call_param_t p1 )
+{
+ IOPMrootDomain * rootDomain = (IOPMrootDomain *) p0;
+ uint32_t notifyRef = (uint32_t)(uintptr_t) p1;
+
+ rootDomain->swdDebugTeardown();
+ if (p1) {
+ rootDomain->allowPowerChange(notifyRef);
+ }
+ DLOG("swdDebugTeardownCallout finish\n");
+}
+
+void IOPMrootDomain::swdDebugTeardown( )
+{
+
+#if HIBERNATION
+ DLOG("swdDebugTeardown state:%d\n", swd_DebugImageSetup);
+ if (swd_DebugImageSetup == TRUE) {
+ swd_DebugImageSetup = FALSE;
+ IOCloseDebugDataFile();
+ }
+#endif
+
+
+}
+//******************************************************************************
+
+