- IOReturn enqueuePowerChange ( unsigned long, unsigned long, unsigned long, IOPowerConnection *, unsigned long );
- void setParentInfo ( IOPMPowerFlags, IOPowerConnection * );
- IOReturn notifyAll ( bool is_prechange );
- bool notifyChild ( IOPowerConnection * nextObject, bool is_prechange );
- bool inform ( IOPMinformee * nextObject, bool is_prechange );
- void our_prechange_03 ( void );
- void our_prechange_04 ( void );
- void our_prechange_05 ( void );
- void our_prechange_1 ( void );
- void our_prechange_2 ( void );
- void our_prechange_3 ( void );
- void our_prechange_4 ( void );
- IOReturn parent_down_0 ( void );
- IOReturn parent_down_02 ( void );
- void parent_down_04 ( void );
- void parent_down_05 ( void );
- IOReturn parent_down_1 ( void );
- IOReturn parent_down_2 ( void );
- void parent_down_3 ( void );
- void parent_down_4 ( void );
- void parent_down_5 ( void );
- void parent_down_6 ( void );
- void parent_up_0 ( void );
- IOReturn parent_up_1 ( void );
- IOReturn parent_up_2 ( void );
- IOReturn parent_up_3 ( void );
- void parent_up_4 ( void );
- void parent_up_5 ( void );
- void parent_up_6 ( void );
- void all_done ( void );
- void all_acked ( void );
- void driver_acked ( void );
- void start_ack_timer ( void );
- void stop_ack_timer ( void );
- unsigned long compute_settle_time ( void );
- IOReturn startSettleTimer ( unsigned long delay );
- IOReturn changeState ( void );
- IOReturn add_child_to_active_change ( IOPowerConnection * );
- IOReturn add_driver_to_active_change ( IOPMinformee * );
- IOReturn instruct_driver ( unsigned long newState );
- bool acquire_lock ( void );
- IOReturn start_parent_change ( unsigned long queue_head );
- void start_our_change ( unsigned long queue_head );
- IOReturn ask_parent ( unsigned long requestedState );
- bool checkForDone ( void );
- bool responseValid ( unsigned long x );
- IOReturn allowCancelCommon ( void );
- void computeDesiredState ( void );
+ virtual void powerChangeDone( unsigned long stateNumber );
+#ifdef XNU_KERNEL_PRIVATE
+/* Power management internals */
+public:
+ void idleTimerExpired( void );
+ void settleTimerExpired( void );
+ IOReturn synchronizePowerTree( IOOptionBits options = 0, IOService * notifyRoot = NULL );
+ bool assertPMDriverCall( IOPMDriverCallEntry * callEntry, IOOptionBits method, const IOPMinformee * inform = NULL, IOOptionBits options = 0 );
+ void deassertPMDriverCall( IOPMDriverCallEntry * callEntry );
+ IOReturn changePowerStateWithOverrideTo( IOPMPowerStateIndex ordinal, IOPMRequestTag tag );
+ IOReturn changePowerStateForRootDomain( IOPMPowerStateIndex ordinal );
+ IOReturn setIgnoreIdleTimer( bool ignore );
+ IOReturn quiescePowerTree( void * target, IOPMCompletionAction action, void * param );
+ uint32_t getPowerStateForClient( const OSSymbol * client );
+ static const char * getIOMessageString( uint32_t msg );
+ static void setAdvisoryTickleEnable( bool enable );
+ void reset_watchdog_timer(IOService *obj, int timeout);
+ void start_watchdog_timer( void );
+ void stop_watchdog_timer( void );
+ void start_watchdog_timer(uint64_t deadline);
+ IOReturn registerInterestForNotifier( IONotifier *notify, const OSSymbol * typeOfInterest,
+ IOServiceInterestHandler handler, void * target, void * ref );
+
+ static IOWorkLoop * getIOPMWorkloop( void );
+ bool getBlockingDriverCall(thread_t *thread, const void **callMethod);
+ void cancelIdlePowerDown(IOService * service);
+
+protected:
+ bool tellClientsWithResponse( int messageType );
+ void tellClients( int messageType );
+ void PMDebug( uint32_t event, uintptr_t param1, uintptr_t param2 );
+
+private:
+#ifndef __LP64__
+ void ack_timer_ticked( void );
+ IOReturn serializedAllowPowerChange2( unsigned long );
+ IOReturn serializedCancelPowerChange2( unsigned long );
+ IOReturn powerDomainWillChangeTo( IOPMPowerFlags, IOPowerConnection * );
+ IOReturn powerDomainDidChangeTo( IOPMPowerFlags, IOPowerConnection * );
+#endif
+ void PMfree( void );
+ bool tellChangeDown1( unsigned long );
+ bool tellChangeDown2( unsigned long );
+ IOReturn startPowerChange( IOPMPowerChangeFlags, IOPMPowerStateIndex, IOPMPowerFlags, IOPowerConnection *, IOPMPowerFlags );
+ void setParentInfo( IOPMPowerFlags, IOPowerConnection *, bool );
+ IOReturn notifyAll( uint32_t nextMS );
+ bool notifyChild( IOPowerConnection * child );
+ IOPMPowerStateIndex getPowerStateForDomainFlags( IOPMPowerFlags flags );
+
+// power change initiated by driver
+ void OurChangeStart( void );
+ void OurSyncStart( void );
+ void OurChangeTellClientsPowerDown( void );
+ void OurChangeTellUserPMPolicyPowerDown( void );
+ void OurChangeTellPriorityClientsPowerDown( void );
+ void OurChangeTellCapabilityWillChange( void );
+ void OurChangeNotifyInterestedDriversWillChange( void );
+ void OurChangeSetPowerState( void );
+ void OurChangeWaitForPowerSettle( void );
+ void OurChangeNotifyInterestedDriversDidChange( void );
+ void OurChangeTellCapabilityDidChange( void );
+ void OurChangeFinish( void );
+
+// downward power change initiated by a power parent
+ IOReturn ParentChangeStart( void );
+ void ParentChangeTellPriorityClientsPowerDown( void );
+ void ParentChangeTellCapabilityWillChange( void );
+ void ParentChangeNotifyInterestedDriversWillChange( void );
+ void ParentChangeSetPowerState( void );
+ void ParentChangeWaitForPowerSettle( void );
+ void ParentChangeNotifyInterestedDriversDidChange( void );
+ void ParentChangeTellCapabilityDidChange( void );
+ void ParentChangeAcknowledgePowerChange( void );
+ void ParentChangeRootChangeDown( void );
+
+ void all_done( void );
+ void start_ack_timer( void );
+ void stop_ack_timer( void );
+ void start_ack_timer( UInt32 value, UInt32 scale );
+ void startSettleTimer( void );
+ void start_spindump_timer( const char * delay_type );
+ void stop_spindump_timer( void );
+ bool checkForDone( void );
+ bool responseValid( uint32_t x, int pid );
+ void computeDesiredState( unsigned long tempDesire, bool computeOnly );
+ void trackSystemSleepPreventers( IOPMPowerStateIndex, IOPMPowerStateIndex, IOPMPowerChangeFlags );
+ void tellSystemCapabilityChange( uint32_t nextMS );
+ void restartIdleTimer( void );
+
+ static void ack_timer_expired( thread_call_param_t, thread_call_param_t );
+ static void watchdog_timer_expired( thread_call_param_t arg0, thread_call_param_t arg1 );
+ static void spindump_timer_expired( thread_call_param_t arg0, thread_call_param_t arg1 );
+ static IOReturn actionAckTimerExpired(OSObject *, void *, void *, void *, void * );
+ static IOReturn actionSpinDumpTimerExpired(OSObject *, void *, void *, void *, void * );
+
+ static IOReturn actionDriverCalloutDone(OSObject *, void *, void *, void *, void * );
+ static IOPMRequest * acquirePMRequest( IOService * target, IOOptionBits type, IOPMRequest * active = NULL );
+ static void releasePMRequest( IOPMRequest * request );
+ static void pmDriverCallout( IOService * from );
+ static void pmTellAppWithResponse( OSObject * object, void * context );
+ static void pmTellClientWithResponse( OSObject * object, void * context );
+ static void pmTellCapabilityAppWithResponse( OSObject * object, void * arg );
+ static void pmTellCapabilityClientWithResponse( OSObject * object, void * arg );
+ static void submitPMRequest(LIBKERN_CONSUMED IOPMRequest * request );
+ static void submitPMRequests( IOPMRequest * requests[], IOItemCount count );
+ bool ackTimerTick( void );
+ void addPowerChild1( IOPMRequest * request );
+ void addPowerChild2( IOPMRequest * request );
+ void addPowerChild3( IOPMRequest * request );
+ void adjustPowerState( uint32_t clamp = 0 );
+ void handlePMstop( IOPMRequest * request );
+ void handleRegisterPowerDriver( IOPMRequest * request );
+ bool handleAcknowledgePowerChange( IOPMRequest * request );
+ void handlePowerDomainWillChangeTo( IOPMRequest * request );
+ void handlePowerDomainDidChangeTo( IOPMRequest * request );
+ void handleRequestPowerState( IOPMRequest * request );
+ void handlePowerOverrideChanged( IOPMRequest * request );
+ void handleActivityTickle( IOPMRequest * request );
+ void handleInterestChanged( IOPMRequest * request );
+ void handleSynchronizePowerTree( IOPMRequest * request );
+ void executePMRequest( IOPMRequest * request );
+ bool actionPMWorkQueueInvoke( IOPMRequest * request, IOPMWorkQueue * queue );
+ bool actionPMWorkQueueRetire( IOPMRequest * request, IOPMWorkQueue * queue );
+ bool actionPMRequestQueue( IOPMRequest * request, IOPMRequestQueue * queue );
+ bool actionPMReplyQueue( IOPMRequest * request, IOPMRequestQueue * queue );
+ bool actionPMCompletionQueue( IOPMRequest * request, IOPMCompletionQueue * queue );
+ bool notifyInterestedDrivers( void );
+ void notifyInterestedDriversDone( void );
+ bool notifyControllingDriver( void );
+ void notifyControllingDriverDone( void );
+ void driverSetPowerState( void );
+ void driverInformPowerChange( void );
+ bool isPMBlocked( IOPMRequest * request, int count );
+ void notifyChildren( void );
+ void notifyChildrenOrdered( void );
+ void notifyChildrenDelayed( void );
+ void notifyRootDomain( void );
+ void notifyRootDomainDone( void );
+ void cleanClientResponses( bool logErrors );
+ void updatePowerClient( const OSSymbol * client, uint32_t powerState );
+ void removePowerClient( const OSSymbol * client );
+ IOReturn requestPowerState( const OSSymbol * client, uint32_t state );
+ IOReturn requestDomainPower( IOPMPowerStateIndex ourPowerState, IOOptionBits options = 0 );
+ IOReturn configurePowerStatesReport( IOReportConfigureAction action, void *result );
+ IOReturn updatePowerStatesReport( IOReportConfigureAction action, void *result, void *destination );
+ IOReturn configureSimplePowerReport(IOReportConfigureAction action, void *result );
+ IOReturn updateSimplePowerReport( IOReportConfigureAction action, void *result, void *destination );
+ void waitForPMDriverCall( IOService * target = NULL );
+#endif /* XNU_KERNEL_PRIVATE */