]> git.saurik.com Git - apple/xnu.git/blobdiff - iokit/IOKit/pwr_mgt/IOPMPrivate.h
xnu-6153.41.3.tar.gz
[apple/xnu.git] / iokit / IOKit / pwr_mgt / IOPMPrivate.h
index b3f7b33972a4375397c8cdfa8f58efb52d190074..ee04a50724eacc04bc8200fca20f97089dcde411 100644 (file)
@@ -106,6 +106,9 @@ enum {
 #define kIOPMMessageLaunchBootSpinDump \
                 iokit_family_msg(sub_iokit_powermanagement, 0x440)
 
 #define kIOPMMessageLaunchBootSpinDump \
                 iokit_family_msg(sub_iokit_powermanagement, 0x440)
 
+#define kIOPMMessageProModeStateChange \
+                iokit_family_msg(sub_iokit_powermanagement, 0x450)
+
 /* @enum SystemSleepReasons
  * @abstract The potential causes for system sleep as logged in the system event record.
  */
 /* @enum SystemSleepReasons
  * @abstract The potential causes for system sleep as logged in the system event record.
  */
@@ -183,6 +186,7 @@ enum {
  * These are valid values for IOPM.h:IOPMCalendarStruct->selector
  */
 enum {
  * These are valid values for IOPM.h:IOPMCalendarStruct->selector
  */
 enum {
+    kPMCalendarTypeInvalid = 0,
     kPMCalendarTypeMaintenance = 1,
     kPMCalendarTypeSleepService = 2
 };
     kPMCalendarTypeMaintenance = 1,
     kPMCalendarTypeSleepService = 2
 };
@@ -269,6 +273,8 @@ enum {
 #define kIOPMSleepStatisticsAppsKey             "AppStatistics"
 #define kIOPMIdleSleepPreventersKey             "IdleSleepPreventers"
 #define kIOPMSystemSleepPreventersKey           "SystemSleepPreventers"
 #define kIOPMSleepStatisticsAppsKey             "AppStatistics"
 #define kIOPMIdleSleepPreventersKey             "IdleSleepPreventers"
 #define kIOPMSystemSleepPreventersKey           "SystemSleepPreventers"
+#define kIOPMIdleSleepPreventersWithIDKey       "IdleSleepPreventersWithID"
+#define kIOPMSystemSleepPreventersWithIDKey     "SystemSleepPreventersWithID"
 
 // Application response statistics
 #define kIOPMStatsNameKey                       "Name"
 
 // Application response statistics
 #define kIOPMStatsNameKey                       "Name"
@@ -674,6 +680,11 @@ enum {
 #define kIOPMWakeEventReasonKey             "Reason"
 #define kIOPMWakeEventDetailsKey            "Details"
 
 #define kIOPMWakeEventReasonKey             "Reason"
 #define kIOPMWakeEventDetailsKey            "Details"
 
+/* kIOPMFeatureProModeKey
+ * Feature published if ProMode is supported
+ */
+#define kIOPMFeatureProModeKey              "ProMode"
+
 /*****************************************************************************
  *
  * Wake event flags reported to IOPMrootDomain::claimSystemWakeEvent()
 /*****************************************************************************
  *
  * Wake event flags reported to IOPMrootDomain::claimSystemWakeEvent()
@@ -682,6 +693,84 @@ enum {
 
 #define kIOPMWakeEventSource                0x00000001
 
 
 #define kIOPMWakeEventSource                0x00000001
 
+#if !(defined(RC_HIDE_N144) || defined(RC_HIDE_N146))
+/*****************************************************************************
+ *
+ * AOT defs
+ *
+ *****************************************************************************/
+
+// signals the device should wake up to user space running
+#define kIOPMWakeEventAOTExit                   0x00000002
+
+// will start a 400 ms timer before sleeping
+#define kIOPMWakeEventAOTPossibleExit           0x00000004
+
+// signals the device should wake up to user space running
+#define kIOPMWakeEventAOTConfirmedPossibleExit  0x00000008
+
+// signals the device should go back to AOT
+#define kIOPMWakeEventAOTRejectedPossibleExit   0x00000010
+
+// signals the device should go back to AOT
+#define kIOPMWakeEventAOTExpiredPossibleExit    0x00000020
+
+#define kIOPMWakeEventAOTFlags \
+                                 (kIOPMWakeEventAOTExit \
+                                | kIOPMWakeEventAOTPossibleExit \
+                                | kIOPMWakeEventAOTConfirmedPossibleExit \
+                                | kIOPMWakeEventAOTRejectedPossibleExit \
+                                | kIOPMWakeEventAOTExpiredPossibleExit)
+
+#define kIOPMWakeEventAOTPossibleFlags \
+                                 (kIOPMWakeEventAOTPossibleExit \
+                                | kIOPMWakeEventAOTConfirmedPossibleExit \
+                                | kIOPMWakeEventAOTRejectedPossibleExit \
+                                | kIOPMWakeEventAOTExpiredPossibleExit)
+
+#define kIOPMWakeEventAOTPerCycleFlags \
+                                 (kIOPMWakeEventAOTPossibleExit \
+                                | kIOPMWakeEventAOTRejectedPossibleExit \
+                                | kIOPMWakeEventAOTExpiredPossibleExit)
+
+#define kIOPMWakeEventAOTExitFlags \
+                                 (kIOPMWakeEventAOTExit \
+                                | kIOPMWakeEventAOTConfirmedPossibleExit)
+
+enum {
+    kIOPMAOTModeEnable        = 0x00000001,
+    kIOPMAOTModeCycle         = 0x00000002,
+    kIOPMAOTModeAddEventFlags = 0x00000004,
+    kIOPMAOTModeRespectTimers = 0x00000008,
+    kIOPMAOTModeDefault       = (kIOPMAOTModeEnable | kIOPMAOTModeAddEventFlags | kIOPMAOTModeRespectTimers)
+};
+
+enum {
+    kIOPMAOTMetricsKernelWakeCountMax = 24
+};
+
+struct IOPMAOTMetrics
+{
+    uint32_t sleepCount;
+    uint32_t possibleCount;
+    uint32_t confirmedPossibleCount;
+    uint32_t rejectedPossibleCount;
+    uint32_t expiredPossibleCount;
+    uint32_t noTimeSetCount;
+    uint32_t rtcAlarmsCount;
+    uint32_t softwareRequestCount;
+    uint64_t totalTime;
+
+       char     kernelWakeReason[kIOPMAOTMetricsKernelWakeCountMax][64];
+       // 54:10 secs:ms calendar time
+    uint64_t kernelSleepTime[kIOPMAOTMetricsKernelWakeCountMax];
+    uint64_t kernelWakeTime[kIOPMAOTMetricsKernelWakeCountMax];
+};
+
+#define kIOPMAOTPowerKey    "aot-power"
+
+#endif /* !(defined(RC_HIDE_N144) || defined(RC_HIDE_N146)) */
+
 /*****************************************************************************
  *
  * System Sleep Policy
 /*****************************************************************************
  *
  * System Sleep Policy
@@ -857,11 +946,14 @@ typedef struct {
 
 #define SWD_HDR_SIGNATURE       0xdeb8da2a
 
 
 #define SWD_HDR_SIGNATURE       0xdeb8da2a
 
-#define SWD_BUF_SIZE            (40*PAGE_SIZE)
-#define SWD_INITIAL_STACK_SIZE  ((SWD_BUF_SIZE/2)-sizeof(swd_hdr))
+#define SWD_STACKSHOT_SIZE      (40*PAGE_SIZE)
+#define SWD_COMPRESSED_BUFSIZE  (5*PAGE_SIZE)
+#define SWD_ZLIB_BUFSIZE        (10*PAGE_SIZE)
+#define SWD_STACKSHOT_VAR_PREFIX    "sleepwake_diags"
 
 #define SWD_SPINDUMP_SIZE          (256*1024)
 #define SWD_INITIAL_SPINDUMP_SIZE  ((SWD_SPINDUMP_SIZE/2)-sizeof(swd_hdr))
 
 #define SWD_SPINDUMP_SIZE          (256*1024)
 #define SWD_INITIAL_SPINDUMP_SIZE  ((SWD_SPINDUMP_SIZE/2)-sizeof(swd_hdr))
+#define SWD_MAX_STACKSHOTS          (10)
 
 /* Bits in swd_flags */
 #define SWD_WDOG_ENABLED        0x01
 
 /* Bits in swd_flags */
 #define SWD_WDOG_ENABLED        0x01
@@ -870,6 +962,7 @@ typedef struct {
 #define SWD_VALID_LOGS          0x08
 #define SWD_LOGS_IN_FILE        0x10
 #define SWD_LOGS_IN_MEM         0x20
 #define SWD_VALID_LOGS          0x08
 #define SWD_LOGS_IN_FILE        0x10
 #define SWD_LOGS_IN_MEM         0x20
+#define SWD_PWR_BTN_STACKSHOT   0x30
 
 #define SWD_DATA_CRC_ERROR      0x010000
 #define SWD_BUF_SIZE_ERROR      0x020000
 
 #define SWD_DATA_CRC_ERROR      0x010000
 #define SWD_BUF_SIZE_ERROR      0x020000
@@ -880,25 +973,11 @@ typedef struct {
 
 
 /* Filenames associated with the stackshots/logs generated by the SWD */
 
 
 /* Filenames associated with the stackshots/logs generated by the SWD */
-#define kSleepWakeStackBinFilename          "/var/log/SleepWakeStacks.bin"
-#define kSleepWakeStackFilename             "/var/log/SleepWakeStacks.dump"
-#define kSleepWakeLogFilename               "/var/log/SleepWakeLog.dump"
-#define kAppleOSXWatchdogStackFilename      "/var/log/AppleOSXWatchdogStacks.dump"
-#define kAppleOSXWatchdogLogFilename        "/var/log/AppleOSXWatchdogLog.dump"
+#define kOSWatchdogStacksFilename           "/var/log/OSXWatchdogStacks.gz"
+#define kOSWatchdogFailureStringFile        "/var/log/OSWatchdogFailureString.txt"
+#define kSleepWakeStacksFilename            "/var/log/SleepWakeStacks.gz"
+#define kSleepWakeFailureStringFile         "/var/log/SleepWakeFailureString.txt"
 
 
-inline char const* getDumpStackFilename(swd_hdr *hdr)
-{
-    if (hdr && hdr->is_osx_watchdog)
-        return kAppleOSXWatchdogStackFilename;
-    return kSleepWakeStackFilename;
-}
-
-inline char const* getDumpLogFilename(swd_hdr *hdr)
-{
-    if (hdr && hdr->is_osx_watchdog)
-        return kAppleOSXWatchdogLogFilename;
-    return kSleepWakeLogFilename;
-}
 
 /* RootDomain IOReporting channels */
 #define kSleepCntChID IOREPORT_MAKEID('S','l','e','e','p','C','n','t')
 
 /* RootDomain IOReporting channels */
 #define kSleepCntChID IOREPORT_MAKEID('S','l','e','e','p','C','n','t')