*
* @APPLE_LICENSE_HEADER_START@
*
- * The contents of this file constitute Original Code as defined in and
- * are subject to the Apple Public Source License Version 1.1 (the
- * "License"). You may not use this file except in compliance with the
- * License. Please obtain a copy of the License at
- * http://www.apple.com/publicsource and read it before using this file.
+ * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
*
- * This Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
- * License for the specific language governing rights and limitations
- * under the License.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
kIOServiceFirstMatchState = 0x00000010
};
-// options for registerService()
enum {
+ // options for registerService()
kIOServiceExclusive = 0x00000001,
- kIOServiceSynchronous = 0x00000002,
-};
-// options for terminate()
-enum {
- kIOServiceRequired = 0x00000001
+ // options for terminate()
+ kIOServiceRequired = 0x00000001,
+ kIOServiceTerminate = 0x00000004,
+
+ // options for registerService() & terminate()
+ kIOServiceSynchronous = 0x00000002,
+ // options for registerService()
+ kIOServiceAsynchronous = 0x00000008
};
// options for open()
extern const OSSymbol * gIONameMatchedKey;
extern const OSSymbol * gIOPropertyMatchKey;
extern const OSSymbol * gIOLocationMatchKey;
+extern const OSSymbol * gIOParentMatchKey;
extern const OSSymbol * gIOPathMatchKey;
extern const OSSymbol * gIOMatchCategoryKey;
extern const OSSymbol * gIODefaultMatchCategoryKey;
extern const OSSymbol * gIOGeneralInterest;
extern const OSSymbol * gIOBusyInterest;
+extern const OSSymbol * gIOOpenInterest;
extern const OSSymbol * gIOAppPowerStateInterest;
+extern const OSSymbol * gIOPriorityPowerStateInterest;
extern const OSSymbol * gIODeviceMemoryKey;
extern const OSSymbol * gIOInterruptControllersKey;
protected:
// TRUE once PMinit has been called
bool initialized;
+
+public:
// pointer to protected instance variables for power management
IOPMprot * pm_vars;
+public:
+ /* methods available in Mac OS X 10.1 or later */
+/*! @function requestTerminate
+ @abstract Passes a termination up the stack.
+ @discussion When an IOService is made inactive the default behaviour is to also make any of its clients that have it as their only provider also inactive, in this way recursing the termination up the driver stack. This method allows an IOService object to override this behaviour. Returning true from this method when passed a just terminated provider will cause the client to also be terminated.
+ @param provider The terminated provider of this object.
+ @param options Options originally passed to terminate, plus kIOServiceRecursing.
+ @result true if this object should be terminated now that its provider as been. */
+
+ virtual bool requestTerminate( IOService * provider, IOOptionBits options );
+
+/*! @function willTerminate
+ @abstract Passes a termination up the stack.
+ @discussion Notification that a provider has been terminated, sent before recursing up the stack, in root-to-leaf order.
+ @param provider The terminated provider of this object.
+ @param options Options originally passed to terminate.
+ @result true return true. */
+
+ virtual bool willTerminate( IOService * provider, IOOptionBits options );
+
+/*! @function didTerminate
+ @abstract Passes a termination up the stack.
+ @discussion Notification that a provider has been terminated, sent after recursing up the stack, in leaf-to-root order.
+ @param provider The terminated provider of this object.
+ @param options Options originally passed to terminate.
+ @param defer If there is pending I/O that requires this object to persist, and the provider is not opened by this object set defer to true and call the IOService::didTerminate() implementation when the I/O completes. Otherwise, leave defer set to its default value of false.
+ @result true return true. */
+
+ virtual bool didTerminate( IOService * provider, IOOptionBits options, bool * defer );
+
private:
- OSMetaClassDeclareReservedUnused(IOService, 0);
- OSMetaClassDeclareReservedUnused(IOService, 1);
- OSMetaClassDeclareReservedUnused(IOService, 2);
+ OSMetaClassDeclareReservedUsed(IOService, 0);
+ OSMetaClassDeclareReservedUsed(IOService, 1);
+ OSMetaClassDeclareReservedUsed(IOService, 2);
+
OSMetaClassDeclareReservedUnused(IOService, 3);
OSMetaClassDeclareReservedUnused(IOService, 4);
OSMetaClassDeclareReservedUnused(IOService, 5);
@discussion When an IOService is successfully terminated, it is immediately made inactive, which blocks further attach()es, matching or notifications occuring on the object. It remains inactive until the last client closes, and is then finalized and destroyed.
@result Returns true if the IOService has been terminated. */
- inline bool isInactive( void ) const
- { return( 0 != (kIOServiceInactiveState & getState())); }
+ bool isInactive( void ) const;
/* Stack creation */
virtual bool finalize( IOOptionBits options );
+/*! @function free
+ @discussion Free data structures that were allocated when power management was initialized on this service. */
+
+ virtual void free( void );
+
/*! @function lockForArbitration
@abstract Locks an IOService against changes in state or ownership.
@discussion The registration, termination and open / close functions of IOService use lockForArbtration to single thread access to an IOService. lockForArbitration will grant recursive access to the same thread.
/*! @function adjustBusy
@abstract Adjusts the busyState of an IOService.
- @discussion Applies a delta to an IOService's busyState. A change in the busyState to or from zero will changes the IOService's provider's busyState by one (in the same direction).
+ @discussion Applies a delta to an IOService's busyState. A change in the busyState to or from zero will change the IOService's provider's busyState by one (in the same direction).
@param delta The delta to be applied to the IOService busy state. */
virtual void adjustBusy( SInt32 delta );
static IOPlatformExpert * getPlatform( void );
+/*! @function getPMRootDomain
+ @abstract Returns a pointer to the power management root domain instance for the machine.
+ @discussion This method provides an accessor to the power management root domain instance for the machine.
+ @result A pointer to the power management root domain instance. It should not be released by the caller. */
+
+ static class IOPMrootDomain * getPMRootDomain( void );
+
/*! @function getServiceRoot
@abstract Returns a pointer to the root of the service plane.
@discussion This method provides an accessor to the root of the service plane for the machine.
static IOService * getServiceRoot( void );
+/*! @function getResourceService
+ @abstract Returns a pointer to the IOResources service.
+ @discussion IOService maintains a resource service IOResources that allows objects to be published and found globally in IOKit based on a name, using the standard IOService matching and notification calls.
+ @result A pointer to the IOResources instance. It should not be released by the caller. */
+
+ static IOService * getResourceService( void );
+
/* Allocate resources for a matched service */
/*! @function getResources
virtual bool serializeProperties( OSSerialize * s ) const;
static void setPlatform( IOPlatformExpert * platform);
+ static void setPMRootDomain( class IOPMrootDomain * rootDomain );
static IOReturn catalogNewDrivers( OSOrderedSet * newTables );
+ static IOReturn waitMatchIdle( UInt32 ms );
static IOService * resources( void );
virtual bool checkResources( void );
virtual IOReturn waitForState( UInt32 mask, UInt32 value,
mach_timespec_t * timeout = 0 );
+ UInt32 _adjustBusy( SInt32 delta );
+
+ bool terminatePhase1( IOOptionBits options = 0 );
+ void scheduleTerminatePhase2( IOOptionBits options = 0 );
+ void scheduleStop( IOService * provider );
+ void scheduleFinalize( void );
+ static void terminateThread( void * arg );
+ static void terminateWorker( IOOptionBits options );
+ static void actionWillTerminate( IOService * victim, IOOptionBits options,
+ OSArray * doPhase2List );
+ static void actionDidTerminate( IOService * victim, IOOptionBits options );
+ static void actionFinalize( IOService * victim, IOOptionBits options );
+ static void actionStop( IOService * client, IOService * provider );
+
+ void PMfree( void );
+
virtual IOReturn resolveInterrupt(IOService *nub, int source);
virtual IOReturn lookupInterrupt(int source, bool resolve, IOInterruptController **interruptController);
virtual bool askChangeDown ( unsigned long );
virtual bool tellChangeDown ( unsigned long );
+ bool tellChangeDown1 ( unsigned long );
+ bool tellChangeDown2 ( unsigned long );
virtual void tellNoChangeDown ( unsigned long );
virtual void tellChangeUp ( unsigned long );
virtual IOReturn allowPowerChange ( unsigned long refcon );
subclassed policy-makers, and that is how one finds out that a power change
it initiated is complete
@param stateNumber
- This is the number of the state in the state array that the device has switched to. */
+ This is the number of the state in the state array that the device has switched from. */
virtual void powerChangeDone ( unsigned long );
bool tellClientsWithResponse ( int messageType );
private:
- IOReturn enqueuePowerChange ( unsigned long, unsigned long, unsigned long, IOPowerConnection * );
+ 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 );
bool checkForDone ( void );
bool responseValid ( unsigned long x );
IOReturn allowCancelCommon ( void );
+ void computeDesiredState ( void );
+ void rebuildChildClampBits ( void );
};
#endif /* ! _IOKIT_IOSERVICE_H */