]> git.saurik.com Git - apple/xnu.git/blobdiff - iokit/IOKit/IOService.h
xnu-3789.51.2.tar.gz
[apple/xnu.git] / iokit / IOKit / IOService.h
index 5d5c093bcf80b3e4d8b6f363416921dbbda60d01..35e7ec20e664636230523ece558ab22aa6c618c0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998-2014 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 1998-2016 Apple Inc. All rights reserved.
  *
  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
  * 
@@ -108,6 +108,7 @@ extern const IORegistryPlane *  gIOPowerPlane;
 
 extern const OSSymbol *     gIOResourcesKey;
 extern const OSSymbol *     gIOResourceMatchKey;
+extern const OSSymbol *     gIOResourceMatchedKey;
 extern const OSSymbol *     gIOProviderClassKey;
 extern const OSSymbol *     gIONameMatchKey;
 extern const OSSymbol *     gIONameMatchedKey;
@@ -142,6 +143,12 @@ extern const OSSymbol *     gIODeviceMemoryKey;
 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,
@@ -536,6 +543,7 @@ public:
     @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,
@@ -546,8 +554,7 @@ public:
     @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 );
@@ -555,8 +562,8 @@ public:
 /*! @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;
 
@@ -607,17 +614,17 @@ public:
 
 /*! @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.
@@ -697,7 +704,7 @@ public:
     @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 );
 
@@ -705,7 +712,7 @@ public:
     @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 );
@@ -872,7 +879,7 @@ public:
 /*! @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. */
 
@@ -1258,7 +1265,7 @@ public:
     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 */
@@ -1285,6 +1292,8 @@ public:
     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 );
@@ -1378,7 +1387,6 @@ private:
     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, 
@@ -1437,7 +1445,7 @@ public:
     @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,
@@ -1654,7 +1662,7 @@ public:
     @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
@@ -1813,6 +1821,7 @@ public:
     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 );
@@ -1822,9 +1831,7 @@ public:
     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 );
@@ -1879,6 +1886,8 @@ private:
     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 );
@@ -1888,8 +1897,9 @@ private:
 
     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 );
@@ -1899,6 +1909,8 @@ private:
     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 );
@@ -1914,14 +1926,12 @@ private:
     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 );