/*
- * Copyright (c) 1998-2014 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 1998-2016 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
extern const OSSymbol * gIOResourcesKey;
extern const OSSymbol * gIOResourceMatchKey;
+extern const OSSymbol * gIOResourceMatchedKey;
extern const OSSymbol * gIOProviderClassKey;
extern const OSSymbol * gIONameMatchKey;
extern const OSSymbol * gIONameMatchedKey;
extern const OSSymbol * gIOInterruptControllersKey;
extern const OSSymbol * gIOInterruptSpecifiersKey;
+extern const OSSymbol * gIOBSDKey;
+extern const OSSymbol * gIOBSDNameKey;
+extern const OSSymbol * gIOBSDMajorKey;
+extern const OSSymbol * gIOBSDMinorKey;
+extern const OSSymbol * gIOBSDUnitKey;
+
extern SInt32 IOServiceOrdering( const OSMetaClassBase * inObj1, const OSMetaClassBase * inObj2, void * ref );
typedef void (*IOInterruptAction)( OSObject * target, void * refCon,
@discussion IOService provides generic open and close semantics to track clients of a provider that have established an active datapath. The use of <code>open</code> and @link close close@/link, and rules regarding ownership are family defined, and defined by the @link handleOpen handleOpen@/link and @link handleClose handleClose@/link methods in the provider. Some families will limit access to a provider based on its open state.
@param forClient Designates the client of the provider requesting the open.
@param options Options for the open. The provider family may implement options for open; IOService defines only <code>kIOServiceSeize</code> to request the device be withdrawn from its current owner.
+ @param arg Family specific arguments which are ignored by IOService.
@result <code>true</code> if the open was successful; <code>false</code> otherwise. */
virtual bool open( IOService * forClient,
@abstract Releases active access to a provider.
@discussion IOService provides generic open and close semantics to track clients of a provider that have established an active datapath. The use of @link open open@/link and <code>close</code>, and rules regarding ownership are family defined, and defined by the @link handleOpen handleOpen@/link and @link handleClose handleClose@/link methods in the provider.
@param forClient Designates the client of the provider requesting the close.
- @param options Options available for the close. The provider family may implement options for close; IOService defines none.
- @param arg Family specific arguments which are ignored by IOService. */
+ @param options Options available for the close. The provider family may implement options for close; IOService defines none. */
virtual void close( IOService * forClient,
IOOptionBits options = 0 );
/*! @function isOpen
@abstract Determines whether a specific, or any, client has an IOService object open.
@discussion Returns the open state of an IOService object with respect to the specified client, or when it is open by any client.
- @param forClient If non-zero, <codeisOpen</code returns the open state for that client. If zero is passed, <codeisOpen</code returns the open state for all clients.
- @result <codetrue</code if the specific, or any, client has the IOService object open. */
+ @param forClient If non-zero, <code>isOpen</code> returns the open state for that client. If zero is passed, <code>isOpen</code> returns the open state for all clients.
+ @result <code>true</code> if the specific, or any, client has the IOService object open. */
virtual bool isOpen( const IOService * forClient = 0 ) const;
/*! @function init
@abstract Initializes generic IOService data structures (expansion data, etc). */
- virtual bool init( OSDictionary * dictionary = 0 );
+ virtual bool init( OSDictionary * dictionary = 0 ) APPLE_KEXT_OVERRIDE;
/*! @function init
@abstract Initializes generic IOService data structures (expansion data, etc). */
virtual bool init( IORegistryEntry * from,
- const IORegistryPlane * inPlane );
+ const IORegistryPlane * inPlane ) APPLE_KEXT_OVERRIDE;
/*! @function free
@abstract Frees data structures that were allocated when power management was initialized on this service. */
- virtual void free( void );
+ virtual void free( void ) APPLE_KEXT_OVERRIDE;
/*! @function lockForArbitration
@abstract Locks an IOService object against changes in state or ownership.
@abstract Uses the resource service to publish a property.
@discussion The resource service uses IOService's matching and notification to allow objects to be published and found by any I/O Kit client by a global name. <code>publishResource</code> makes an object available to anyone waiting for it or looking for it in the future.
@param key An OSSymbol key that globally identifies the object.
- @param The object to be published. */
+ @param value The object to be published. */
static void publishResource( const OSSymbol * key, OSObject * value = 0 );
@abstract Uses the resource service to publish a property.
@discussion The resource service uses IOService object's matching and notification to allow objects to be published and found by any I/O Kit client by a global name. <code>publishResource</code> makes an object available to anyone waiting for it or looking for it in the future.
@param key A C string key that globally identifies the object.
- @param The object to be published. */
+ @param value The object to be published. */
static void publishResource( const char * key, OSObject * value = 0 );
virtual bool addNeededResource( const char * key );
/*! @function registryEntryIDMatching
@abstract Creates a matching dictionary, or adds matching properties to an existing dictionary, that specify a IORegistryEntryID match.
@discussion <code>registryEntryIDMatching</code> creates a matching dictionary that specifies the IOService object with the assigned registry entry ID (returned by <code>IORegistryEntry::getRegistryEntryID()</code>). An existing dictionary may be passed in, in which case the matching properties will be added to that dictionary rather than creating a new one.
- @param name The service's ID. Matching is successful on the IOService object that return that ID from the <code>IORegistryEntry::getRegistryEntryID()</code> method.
+ @param entryID The service's ID. Matching is successful on the IOService object that return that ID from the <code>IORegistryEntry::getRegistryEntryID()</code> method.
@param table If zero, <code>registryEntryIDMatching</code> creates a matching dictionary and returns a reference to it, otherwise the matching properties are added to the specified dictionary.
@result The matching dictionary created, or passed in, is returned on success, or zero on failure. */
IOInterruptSource *_interruptSources;
/* overrides */
- virtual bool serializeProperties( OSSerialize * s ) const;
+ virtual bool serializeProperties( OSSerialize * s ) const APPLE_KEXT_OVERRIDE;
#ifdef KERNEL_PRIVATE
/* Apple only SPI to control CPU low power modes */
void setTerminateDefer(IOService * provider, bool defer);
uint64_t getAuthorizationID( void );
IOReturn setAuthorizationID( uint64_t authorizationID );
+ void cpusRunning(void);
+ void scheduleFinalize(bool now);
private:
static IOReturn waitMatchIdle( UInt32 ms );
bool terminatePhase1( IOOptionBits options = 0 );
void scheduleTerminatePhase2( IOOptionBits options = 0 );
void scheduleStop( IOService * provider );
- void scheduleFinalize( void );
static void terminateThread( void * arg, wait_result_t unused );
static void terminateWorker( IOOptionBits options );
static void actionWillTerminate( IOService * victim, IOOptionBits options,
@param controllingDriver A pointer to the calling driver, usually <code>this</code>.
@param powerStates A driver-defined array of power states that the driver and device support. Power states are defined in <code>pwr_mgt/IOPMpowerState.h</code>.
@param numberOfStates The number of power states in the array.
- @result </code>IOPMNoErr</code>. All errors are logged via <code>kprintf</code>. */
+ @result <code>IOPMNoErr</code>. All errors are logged via <code>kprintf</code>. */
virtual IOReturn registerPowerDriver(
IOService * controllingDriver,
@param period The desired idle timer period in seconds.
@result <code>kIOReturnSuccess</code> upon success; an I/O Kit error code otherwise. */
- virtual IOReturn setIdleTimerPeriod( unsigned long );
+ virtual IOReturn setIdleTimerPeriod( unsigned long period );
#ifndef __LP64__
/*! @function getPMworkloop
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 );
IOReturn registerInterestForNotifer( IONotifier *notify, const OSSymbol * typeOfInterest,
IOServiceInterestHandler handler, void * target, void * ref );
-#ifdef __LP64__
- static IOWorkLoop * getPMworkloop( void );
-#endif
+ static IOWorkLoop * getIOPMWorkloop( void );
protected:
bool tellClientsWithResponse( int messageType );
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 );
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 watchdog_timer_expired ( 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 = 0 );
static void pmTellClientWithResponse( OSObject * object, void * context );
static void pmTellCapabilityAppWithResponse ( OSObject * object, void * arg );
static void pmTellCapabilityClientWithResponse( OSObject * object, void * arg );
+ static void submitPMRequest( IOPMRequest * request );
+ static void submitPMRequests( IOPMRequest ** request, IOItemCount count );
bool ackTimerTick( void );
void addPowerChild1( IOPMRequest * request );
void addPowerChild2( IOPMRequest * request );
void handleActivityTickle( IOPMRequest * request );
void handleInterestChanged( IOPMRequest * request );
void handleSynchronizePowerTree( IOPMRequest * request );
- void submitPMRequest( IOPMRequest * request );
- void submitPMRequest( IOPMRequest ** request, IOItemCount count );
void executePMRequest( IOPMRequest * request );
- bool servicePMRequest( IOPMRequest * request, IOPMWorkQueue * queue );
- bool retirePMRequest( IOPMRequest * request, IOPMWorkQueue * queue );
- bool servicePMRequestQueue( IOPMRequest * request, IOPMRequestQueue * queue );
- bool servicePMReplyQueue( IOPMRequest * request, IOPMRequestQueue * queue );
- bool servicePMFreeQueue( IOPMRequest * request, IOPMCompletionQueue * queue );
+ 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 );