/*
- * Copyright (c) 1998-2016 Apple Inc. All rights reserved.
+ * Copyright (c) 1998-2020 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
#include <IOKit/pwr_mgt/IOPMpowerState.h>
#include <IOKit/IOServicePM.h>
#include <IOKit/IOReportTypes.h>
+#include <DriverKit/IOService.h>
+#include <libkern/c++/OSPtr.h>
extern "C" {
#include <kern/thread_call.h>
}
+
#ifndef UINT64_MAX
#define UINT64_MAX 18446744073709551615ULL
#endif
// options for terminate()
kIOServiceRequired = 0x00000001,
kIOServiceTerminate = 0x00000004,
+ kIOServiceTerminateWithRematch = 0x00000010,
// options for registerService() & terminate()
kIOServiceSynchronous = 0x00000002,
extern const OSSymbol * gIOResourcesKey;
extern const OSSymbol * gIOResourceMatchKey;
extern const OSSymbol * gIOResourceMatchedKey;
+extern const OSSymbol * gIOResourceIOKitKey;
+
extern const OSSymbol * gIOProviderClassKey;
extern const OSSymbol * gIONameMatchKey;
extern const OSSymbol * gIONameMatchedKey;
extern const OSSymbol * gIOPropertyMatchKey;
+extern const OSSymbol * gIOPropertyExistsMatchKey;
extern const OSSymbol * gIOLocationMatchKey;
extern const OSSymbol * gIOParentMatchKey;
extern const OSSymbol * gIOPathMatchKey;
extern const OSSymbol * gIOMatchCategoryKey;
extern const OSSymbol * gIODefaultMatchCategoryKey;
extern const OSSymbol * gIOMatchedServiceCountKey;
+extern const OSSymbol * gIOMatchedPersonalityKey;
+extern const OSSymbol * gIORematchPersonalityKey;
+extern const OSSymbol * gIORematchCountKey;
+extern const OSSymbol * gIODEXTMatchCountKey;
extern const OSSymbol * gIOUserClientClassKey;
+
+extern const OSSymbol * gIOUserClassKey;
+extern const OSSymbol * gIOUserServerClassKey;
+extern const OSSymbol * gIOUserServerNameKey;
+extern const OSSymbol * gIOUserServerTagKey;
+extern const OSSymbol * gIOUserUserClientKey;
+
extern const OSSymbol * gIOKitDebugKey;
extern const OSSymbol * gIOServiceKey;
extern const OSSymbol * gIOInterruptControllersKey;
extern const OSSymbol * gIOInterruptSpecifiersKey;
+extern const OSSymbol * gIOSupportedPropertiesKey;
+extern const OSSymbol * gIOUserServicePropertiesKey;
+extern const OSSymbol * gIOCompatibilityMatchKey;
+extern const OSSymbol * gIOCompatibilityPropertiesKey;
+extern const OSSymbol * gIOPathKey;
+
extern const OSSymbol * gIOBSDKey;
extern const OSSymbol * gIOBSDNameKey;
extern const OSSymbol * gIOBSDMajorKey;
extern const OSSymbol * gIOBSDMinorKey;
extern const OSSymbol * gIOBSDUnitKey;
+extern const OSSymbol * gIODriverKitEntitlementKey;
+extern const OSSymbol * gIOServiceDEXTEntitlementsKey;
+extern const OSSymbol * gIODriverKitUserClientEntitlementsKey;
+extern const OSSymbol * gIODriverKitUserClientEntitlementAllowAnyKey;
+extern const OSSymbol * gIOMatchDeferKey;
+extern const OSSymbol * gIOAllCPUInitializedKey;
+
+#if XNU_KERNEL_PRIVATE && !defined(IOServiceTrace)
+
+#include <IOKit/IOTimeStamp.h>
+#if (KDEBUG_LEVEL >= KDEBUG_LEVEL_STANDARD)
+#define IOServiceTrace(csc, a, b, c, d) do { \
+ if(kIOTraceIOService & gIOKitTrace) { \
+ KERNEL_DEBUG_CONSTANT(IODBG_IOSERVICE(csc), a, b, c, d, 0); \
+ } \
+} while(0)
+#else /* (KDEBUG_LEVEL >= KDEBUG_LEVEL_STANDARD) */
+#define IOServiceTrace(csc, a, b, c, d) do { \
+ (void)a; \
+ (void)b; \
+ (void)c; \
+ (void)d; \
+} while (0)
+#endif /* (KDEBUG_LEVEL >= KDEBUG_LEVEL_STANDARD) */
+
+#endif // XNU_KERNEL_PRIVATE && !IOServiceTrace
+
extern SInt32 IOServiceOrdering( const OSMetaClassBase * inObj1, const OSMetaClassBase * inObj2, void * ref );
typedef void (*IOInterruptAction)( OSObject * target, void * refCon,
typedef void (*IOServiceApplierFunction)(IOService * service, void * context);
typedef void (*OSObjectApplierFunction)(OSObject * object, void * context);
+#ifdef __BLOCKS__
+typedef void (^IOServiceApplierBlock)(IOService * service);
+typedef void (^OSObjectApplierBlock)(OSObject * object);
+#endif /* __BLOCKS__ */
+
class IOUserClient;
class IOPlatformExpert;
+class IOUserServerCheckInToken;
/*! @class IOService
* @abstract The base class for most I/O Kit families, devices, and drivers.
struct IOInterruptAccountingData;
struct IOInterruptAccountingReporter;
+struct OSObjectUserVars;
class IOService : public IORegistryEntry
{
- OSDeclareDefaultStructors(IOService)
+ OSDeclareDefaultStructorsWithDispatch(IOService);
+#if XNU_KERNEL_PRIVATE
+public:
+#else
protected:
+#endif /* XNU_KERNEL_PRIVATE */
/*! @struct ExpansionData
* @discussion This structure will be used to expand the capablilties of this class in the future.
*/
IOLock * interruptStatisticsLock;
IOInterruptAccountingReporter * interruptStatisticsArray;
int interruptStatisticsArrayCount;
+
+ OSObjectUserVars * uvars;
};
/*! @var reserved
private:
#if __LP64__
- OSMetaClassDeclareReservedUsed(IOService, 0);
- OSMetaClassDeclareReservedUsed(IOService, 1);
+ OSMetaClassDeclareReservedUsedX86(IOService, 0);
+ OSMetaClassDeclareReservedUsedX86(IOService, 1);
OSMetaClassDeclareReservedUnused(IOService, 2);
OSMetaClassDeclareReservedUnused(IOService, 3);
OSMetaClassDeclareReservedUnused(IOService, 4);
OSMetaClassDeclareReservedUnused(IOService, 6);
OSMetaClassDeclareReservedUnused(IOService, 7);
#else
- OSMetaClassDeclareReservedUsed(IOService, 0);
- OSMetaClassDeclareReservedUsed(IOService, 1);
- OSMetaClassDeclareReservedUsed(IOService, 2);
- OSMetaClassDeclareReservedUsed(IOService, 3);
- OSMetaClassDeclareReservedUsed(IOService, 4);
- OSMetaClassDeclareReservedUsed(IOService, 5);
- OSMetaClassDeclareReservedUsed(IOService, 6);
- OSMetaClassDeclareReservedUsed(IOService, 7);
+ OSMetaClassDeclareReservedUsedX86(IOService, 0);
+ OSMetaClassDeclareReservedUsedX86(IOService, 1);
+ OSMetaClassDeclareReservedUsedX86(IOService, 2);
+ OSMetaClassDeclareReservedUsedX86(IOService, 3);
+ OSMetaClassDeclareReservedUsedX86(IOService, 4);
+ OSMetaClassDeclareReservedUsedX86(IOService, 5);
+ OSMetaClassDeclareReservedUsedX86(IOService, 6);
+ OSMetaClassDeclareReservedUsedX86(IOService, 7);
#endif
OSMetaClassDeclareReservedUnused(IOService, 8);
virtual bool open( IOService * forClient,
IOOptionBits options = 0,
- void * arg = 0 );
+ void * arg = NULL );
/*! @function close
* @abstract Releases active access to a provider.
* @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;
+ virtual bool isOpen( const IOService * forClient = NULL ) const;
/*! @function handleOpen
* @abstract Controls the open / close behavior of an IOService object (overrideable by subclasses).
/*! @function init
* @abstract Initializes generic IOService data structures (expansion data, etc). */
- virtual bool init( OSDictionary * dictionary = 0 ) APPLE_KEXT_OVERRIDE;
+ virtual bool init( OSDictionary * dictionary = NULL ) APPLE_KEXT_OVERRIDE;
/*! @function init
* @abstract Initializes generic IOService data structures (expansion data, etc). */
* @param key An OSSymbol key that globally identifies the object.
* @param value The object to be published. */
- static void publishResource( const OSSymbol * key, OSObject * value = 0 );
+ static void publishResource( const OSSymbol * key, OSObject * value = NULL );
+ static void publishUserResource( const OSSymbol * key, OSObject * value = NULL );
/*! @function publishResource
* @abstract Uses the resource service to publish a property.
* @param key A C string key that globally identifies the object.
* @param value The object to be published. */
- static void publishResource( const char * key, OSObject * value = 0 );
+ static void publishResource( const char * key, OSObject * value = NULL );
virtual bool addNeededResource( const char * key );
/* Notifications */
* @param priority A constant ordering all notifications of a each type.
* @result An instance of an IONotifier object that can be used to control or destroy the notification request. */
- static IONotifier * addNotification(
+ static OSPtr<IONotifier> addNotification(
const OSSymbol * type, OSDictionary * matching,
IOServiceNotificationHandler handler,
- void * target, void * ref = 0,
+ void * target, void * ref = NULL,
SInt32 priority = 0 )
APPLE_KEXT_DEPRECATED;
static IONotifier * addMatchingNotification(
const OSSymbol * type, OSDictionary * matching,
IOServiceMatchingNotificationHandler handler,
- void * target, void * ref = 0,
+ void * target, void * ref = NULL,
SInt32 priority = 0 );
* @param timeout The maximum time to wait.
* @result A published IOService object matching the supplied dictionary. */
- LIBKERN_RETURNS_NOT_RETAINED
- static IOService * waitForService(
+ static LIBKERN_RETURNS_NOT_RETAINED IOService * waitForService(
LIBKERN_CONSUMED OSDictionary * matching,
- mach_timespec_t * timeout = 0);
+ mach_timespec_t * timeout = NULL);
/*! @function waitForMatchingService
* @abstract Waits for a matching to service to be published.
* @param timeout The maximum time to wait in nanoseconds. Default is to wait forever.
* @result A published IOService object matching the supplied dictionary. waitForMatchingService returns a reference to the IOService which should be released by the caller. (Differs from waitForService() which does not retain the returned object.) */
- static IOService * waitForMatchingService( OSDictionary * matching,
+ static OSPtr<IOService> waitForMatchingService( OSDictionary * matching,
uint64_t timeout = UINT64_MAX);
+#ifdef XNU_KERNEL_PRIVATE
+ static IOService * waitForMatchingServiceWithToken( OSDictionary * matching,
+ uint64_t timeout, IOUserServerCheckInToken * token );
+#endif
+
/*! @function getMatchingServices
* @abstract Finds the set of current published IOService objects matching a matching dictionary.
* @discussion Provides a method of finding the current set of published IOService objects matching the supplied matching dictionary.
* @param matching The matching dictionary describing the desired IOService objects.
* @result An instance of an iterator over a set of IOService objects. To be released by the caller. */
- static OSIterator * getMatchingServices( OSDictionary * matching );
+ static OSPtr<OSIterator> getMatchingServices( OSDictionary * matching );
/*! @function copyMatchingService
* @abstract Finds one of the current published IOService objects matching a matching dictionary.
* @param matching The matching dictionary describing the desired IOService object.
* @result The IOService object or NULL. To be released by the caller. */
- static IOService * copyMatchingService( OSDictionary * matching );
+ static OSPtr<IOService> copyMatchingService( OSDictionary * matching );
public:
/* Helpers to make matching dictionaries for simple cases,
* @param table If zero, <code>serviceMatching</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. */
- static OSDictionary * serviceMatching( const char * className,
- OSDictionary * table = 0 );
+ static OSPtr<OSDictionary> serviceMatching( const char * className,
+ OSDictionary * table = NULL );
/*! @function serviceMatching
* @abstract Creates a matching dictionary, or adds matching properties to an existing dictionary, that specify an IOService class match.
* @param table If zero, <code>serviceMatching</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. */
- static OSDictionary * serviceMatching( const OSString * className,
- OSDictionary * table = 0 );
+ static OSPtr<OSDictionary> serviceMatching( const OSString * className,
+ OSDictionary * table = NULL );
/*! @function nameMatching
* @abstract Creates a matching dictionary, or adds matching properties to an existing dictionary, that specify an IOService name match.
* @param table If zero, <code>nameMatching</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. */
- static OSDictionary * nameMatching( const char * name,
- OSDictionary * table = 0 );
+ static OSPtr<OSDictionary> nameMatching( const char * name,
+ OSDictionary * table = NULL );
/*! @function nameMatching
* @abstract Creates a matching dictionary, or adds matching properties to an existing dictionary, that specify an IOService name match.
* @param table If zero, <code>nameMatching</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. */
- static OSDictionary * nameMatching( const OSString* name,
- OSDictionary * table = 0 );
+ static OSPtr<OSDictionary> nameMatching( const OSString* name,
+ OSDictionary * table = NULL );
/*! @function resourceMatching
* @abstract Creates a matching dictionary, or adds matching properties to an existing dictionary, that specify a resource service match.
* @param table If zero, <code>resourceMatching</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. */
- static OSDictionary * resourceMatching( const char * name,
- OSDictionary * table = 0 );
+ static OSPtr<OSDictionary> resourceMatching( const char * name,
+ OSDictionary * table = NULL );
/*! @function resourceMatching
* @abstract Creates a matching dictionary, or adds matching properties to an existing dictionary, that specify a resource service match.
* @param table If zero, <code>resourceMatching</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. */
- static OSDictionary * resourceMatching( const OSString * name,
- OSDictionary * table = 0 );
+ static OSPtr<OSDictionary> resourceMatching( const OSString * name,
+ OSDictionary * table = NULL );
/*! @function propertyMatching
* @param table If zero, nameMatching will create a matching dictionary and return 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. */
- static OSDictionary * propertyMatching( const OSSymbol * key, const OSObject * value,
- OSDictionary * table = 0 );
+ static OSPtr<OSDictionary> propertyMatching( const OSSymbol * key, const OSObject * value,
+ OSDictionary * table = NULL );
/*! @function registryEntryIDMatching
* @abstract Creates a matching dictionary, or adds matching properties to an existing dictionary, that specify a IORegistryEntryID match.
* @result The matching dictionary created, or passed in, is returned on success, or zero on failure. */
static OSDictionary * registryEntryIDMatching( uint64_t entryID,
- OSDictionary * table = 0 );
+ OSDictionary * table = NULL );
/*! @function addLocation
* @param table The matching properties are added to the specified dictionary, which must be non-zero.
* @result The location matching dictionary created is returned on success, or zero on failure. */
- static OSDictionary * addLocation( OSDictionary * table );
+ static OSPtr<OSDictionary> addLocation( OSDictionary * table );
/* Helpers for matching dictionaries. */
* @discussion For those few IOService objects that obtain service from multiple providers, this method supplies an iterator over a client's providers.
* @result An iterator over the providers of the client, or zero if there is a resource failure. The iterator must be released when the iteration is finished. All objects returned by the iteration are retained while the iterator is valid, though they may no longer be attached during the iteration. */
- virtual OSIterator * getProviderIterator( void ) const;
+ virtual OSPtr<OSIterator> getProviderIterator( void ) const;
/*! @function getOpenProviderIterator
* @abstract Returns an iterator over an client's providers that are currently opened by the client.
* @discussion For those few IOService objects that obtain service from multiple providers, this method supplies an iterator over a client's providers, locking each in turn with @link lockForArbitration lockForArbitration@/link and returning those that have been opened by the client.
* @result An iterator over the providers the client has open, or zero if there is a resource failure. The iterator must be released when the iteration is finished. All objects returned by the iteration are retained while the iterator is valid, and the current entry in the iteration is locked with <code>lockForArbitration</code>, protecting it from state changes. */
- virtual OSIterator * getOpenProviderIterator( void ) const;
+ virtual OSPtr<OSIterator> getOpenProviderIterator( void ) const;
/*! @function getClient
* @abstract Returns an IOService object's primary client.
* @discussion For IOService objects that may have multiple clients, this method supplies an iterator over a provider's clients.
* @result An iterator over the clients of the provider, or zero if there is a resource failure. The iterator must be released when the iteration is finished. All objects returned by the iteration are retained while the iterator is valid, though they may no longer be attached during the iteration. */
- virtual OSIterator * getClientIterator( void ) const;
+ virtual OSPtr<OSIterator> getClientIterator( void ) const;
/*! @function getOpenClientIterator
* @abstract Returns an iterator over a provider's clients that currently have opened the provider.
* @discussion For IOService objects that may have multiple clients, this method supplies an iterator over a provider's clients, locking each in turn with @link lockForArbitration lockForArbitration@/link and returning those that have opened the provider.
* @result An iterator over the clients that have opened the provider, or zero if there is a resource failure. The iterator must be released when the iteration is finished. All objects returned by the iteration are retained while the iterator is valid, and the current entry in the iteration is locked with <code>lockForArbitration</code>, protecting it from state changes. */
- virtual OSIterator * getOpenClientIterator( void ) const;
+ virtual OSPtr<OSIterator> getOpenClientIterator( void ) const;
/*! @function callPlatformFunction
* @abstract Calls the platform function with the given name.
virtual IOReturn registerInterrupt(int source, OSObject *target,
IOInterruptAction handler,
- void *refCon = 0);
+ void *refCon = NULL);
#ifdef __BLOCKS__
/*! @function registerInterrupt
* @result An IOReturn code defined by the message type. */
virtual IOReturn message( UInt32 type, IOService * provider,
- void * argument = 0 );
+ void * argument = NULL );
/*! @function messageClient
* @abstract Sends a generic message to an attached client.
* @result The return code from the client message call. */
virtual IOReturn messageClient( UInt32 messageType, OSObject * client,
- void * messageArgument = 0, vm_size_t argSize = 0 );
+ void * messageArgument = NULL, vm_size_t argSize = 0 );
/*! @function messageClients
* @abstract Sends a generic message to all attached clients.
* @result Any non-<code>kIOReturnSuccess</code> return codes returned by the clients, or <code>kIOReturnSuccess</code> if all return <code>kIOReturnSuccess</code>. */
virtual IOReturn messageClients( UInt32 type,
- void * argument = 0, vm_size_t argSize = 0 );
+ void * argument = NULL, vm_size_t argSize = 0 );
- virtual IONotifier * registerInterest( const OSSymbol * typeOfInterest,
+ virtual OSPtr<IONotifier> registerInterest( const OSSymbol * typeOfInterest,
IOServiceInterestHandler handler,
- void * target, void * ref = 0 );
+ void * target, void * ref = NULL );
#ifdef __BLOCKS__
- IONotifier * registerInterest(const OSSymbol * typeOfInterest,
+ OSPtr<IONotifier> registerInterest(const OSSymbol * typeOfInterest,
IOServiceInterestHandlerBlock handler);
#endif /* __BLOCKS__ */
virtual void applyToClients( IOServiceApplierFunction applier,
void * context );
+#ifdef __BLOCKS__
+ void applyToProviders(IOServiceApplierBlock applier);
+ void applyToClients(IOServiceApplierBlock applier);
+#endif /* __BLOCKS__ */
+
virtual void applyToInterested( const OSSymbol * typeOfInterest,
OSObjectApplierFunction applier,
void * context );
virtual IOReturn newUserClient( task_t owningTask, void * securityID,
UInt32 type, OSDictionary * properties,
- IOUserClient ** handler );
+ LIBKERN_RETURNS_RETAINED IOUserClient ** handler );
virtual IOReturn newUserClient( task_t owningTask, void * securityID,
- UInt32 type, IOUserClient ** handler );
+ UInt32 type,
+ LIBKERN_RETURNS_RETAINED IOUserClient ** handler );
+
+ IOReturn newUserClient( task_t owningTask, void * securityID,
+ UInt32 type, OSDictionary * properties,
+ OSSharedPtr<IOUserClient>& handler );
+
+ IOReturn newUserClient( task_t owningTask, void * securityID,
+ UInt32 type,
+ OSSharedPtr<IOUserClient>& handler );
/* Return code utilities */
/* overrides */
virtual bool serializeProperties( OSSerialize * s ) const APPLE_KEXT_OVERRIDE;
-#ifdef KERNEL_PRIVATE
-/* Apple only SPI to control CPU low power modes */
- void setCPUSnoopDelay(UInt32 ns);
- UInt32 getCPUSnoopDelay();
-#endif
- void requireMaxBusStall(UInt32 ns);
- void requireMaxInterruptDelay(uint32_t ns);
+ IOReturn requireMaxBusStall(UInt32 ns);
+ IOReturn requireMaxInterruptDelay(uint32_t ns);
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* * * * * * * * * * * * Internals * * * * * * * * * * * */
static void setPMRootDomain( class IOPMrootDomain * rootDomain );
static IOReturn catalogNewDrivers( OSOrderedSet * newTables );
uint64_t getAccumulatedBusyTime( void );
- static void updateConsoleUsers(OSArray * consoleUsers, IOMessage systemMessage);
+ static void updateConsoleUsers(OSArray * consoleUsers, IOMessage systemMessage,
+ bool afterUserspaceReboot = false);
static void consoleLockTimer(thread_call_param_t p0, thread_call_param_t p1);
void setTerminateDefer(IOService * provider, bool defer);
uint64_t getAuthorizationID( void );
IOReturn setAuthorizationID( uint64_t authorizationID );
void cpusRunning(void);
void scheduleFinalize(bool now);
+ static void willShutdown();
+ static void startDeferredMatches();
+ static void iokitDaemonLaunched();
+ void resetRematchProperties();
+ bool hasUserServer() const;
+ static void userSpaceWillReboot();
+ static void userSpaceDidReboot();
private:
static IOReturn waitMatchIdle( UInt32 ms );
- static IONotifier * installNotification(
+ static OSPtr<IONotifier> installNotification(
const OSSymbol * type, OSDictionary * matching,
IOServiceMatchingNotificationHandler handler,
void * target, void * ref,
- SInt32 priority, OSIterator ** existing );
+ SInt32 priority,
+ LIBKERN_RETURNS_RETAINED OSIterator ** existing);
#if !defined(__LP64__)
- static IONotifier * installNotification(
+ static OSPtr<IONotifier> installNotification(
const OSSymbol * type, OSDictionary * matching,
IOServiceNotificationHandler handler,
void * target, void * ref,
- SInt32 priority, OSIterator ** existing);
+ SInt32 priority,
+ LIBKERN_RETURNS_RETAINED OSIterator ** existing);
#endif /* !defined(__LP64__) */
#endif
bool checkResource( OSObject * matching );
APPLE_KEXT_COMPATIBILITY_VIRTUAL
- void probeCandidates( OSOrderedSet * matches );
+ void probeCandidates( LIBKERN_CONSUMED OSOrderedSet * matches );
APPLE_KEXT_COMPATIBILITY_VIRTUAL
bool startCandidate( IOService * candidate );
bool matchInternal(OSDictionary * table, uint32_t options, unsigned int * did);
static bool instanceMatch(const OSObject * entry, void * context);
- static OSObject * copyExistingServices( OSDictionary * matching,
+ static OSPtr<OSObject> copyExistingServices( OSDictionary * matching,
IOOptionBits inState, IOOptionBits options = 0 );
- static IONotifier * setNotification(
+ static OSPtr<IONotifier> setNotification(
const OSSymbol * type, OSDictionary * matching,
IOServiceMatchingNotificationHandler handler,
void * target, void * ref,
SInt32 priority = 0 );
- static IONotifier * doInstallNotification(
+ static OSPtr<IONotifier> doInstallNotification(
const OSSymbol * type, OSDictionary * matching,
IOServiceMatchingNotificationHandler handler,
void * target, void * ref,
static bool syncNotificationHandler( void * target, void * ref,
IOService * newService, IONotifier * notifier );
+ static void userServerCheckInTokenNotificationHandler(
+ IOUserServerCheckInToken * token,
+ void * ref);
+
APPLE_KEXT_COMPATIBILITY_VIRTUAL
void deliverNotification( const OSSymbol * type,
IOOptionBits orNewState, IOOptionBits andNewState );
- OSArray * copyNotifiers(const OSSymbol * type,
+ OSPtr<OSArray> copyNotifiers(const OSSymbol * type,
IOOptionBits orNewState, IOOptionBits andNewState);
- bool invokeNotifiers(OSArray ** willSend);
+ bool invokeNotifiers(OSArray * willSend[]);
bool invokeNotifier( class _IOServiceNotifier * notify );
APPLE_KEXT_COMPATIBILITY_VIRTUAL
APPLE_KEXT_COMPATIBILITY_VIRTUAL
IOReturn waitForState( UInt32 mask, UInt32 value,
- mach_timespec_t * timeout = 0 );
+ mach_timespec_t * timeout = NULL );
IOReturn waitForState( UInt32 mask, UInt32 value, uint64_t timeout );
static void __attribute__((__noreturn__)) terminateThread( void * arg, wait_result_t unused );
static void terminateWorker( IOOptionBits options );
static void actionWillTerminate( IOService * victim, IOOptionBits options,
- OSArray * doPhase2List, void*, void * );
+ OSArray * doPhase2List, bool, void * );
static void actionDidTerminate( IOService * victim, IOOptionBits options,
void *, void *, void *);
APPLE_KEXT_COMPATIBILITY_VIRTUAL
IOReturn resolveInterrupt(IOService *nub, int source);
APPLE_KEXT_COMPATIBILITY_VIRTUAL
- IOReturn lookupInterrupt(int source, bool resolve, IOInterruptController **interruptController);
+ IOReturn lookupInterrupt(
+ int source, bool resolve,
+ LIBKERN_RETURNS_NOT_RETAINED IOInterruptController *
+ *interruptController);
#ifdef XNU_KERNEL_PRIVATE
/* end xnu internals */
* Drivers may eliminate the influence of the <code>changePowerStateTo</code> method on power state one of two ways. See @link powerOverrideOnPriv powerOverrideOnPriv@/link to ignore the method's influence, or call <code>changePowerStateTo(0)</code> in the driver's <code>start</code> routine to remove the <code>changePowerStateTo</code> method's power request.
* @param ordinal The number of the desired power state in the power state array.
* @result A return code that can be ignored by the caller. */
-
+public:
IOReturn changePowerStateToPriv( unsigned long ordinal );
/*! @function powerOverrideOnPriv
public:
void idleTimerExpired( void );
void settleTimerExpired( void );
- IOReturn synchronizePowerTree( IOOptionBits options = 0, IOService * notifyRoot = 0 );
- bool assertPMDriverCall( IOPMDriverCallEntry * callEntry, IOOptionBits options = 0, IOPMinformee * inform = 0 );
+ 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 changePowerStateWithTagToPriv( IOPMPowerStateIndex ordinal, IOPMRequestTag tag );
+ IOReturn changePowerStateWithTagTo( 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 );
+ IOPMPowerStateIndex getPowerStateForClient( const OSSymbol * client );
static const char * getIOMessageString( uint32_t msg );
static void setAdvisoryTickleEnable( bool enable );
void reset_watchdog_timer(IOService *obj, int timeout);
static IOWorkLoop * getIOPMWorkloop( void );
bool getBlockingDriverCall(thread_t *thread, const void **callMethod);
+ void cancelIdlePowerDown(IOService * service);
protected:
bool tellClientsWithResponse( int messageType );
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 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 pmTellCapabilityAppWithResponse( OSObject * object, void * arg );
static void pmTellCapabilityClientWithResponse( OSObject * object, void * arg );
static void submitPMRequest(LIBKERN_CONSUMED IOPMRequest * request );
- static void submitPMRequests( IOPMRequest ** request, IOItemCount count );
+ 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 adjustPowerState( IOPMPowerStateIndex clamp = 0 );
void handlePMstop( IOPMRequest * request );
void handleRegisterPowerDriver( IOPMRequest * request );
bool handleAcknowledgePowerChange( IOPMRequest * request );
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 actionPMCompletionQueue( LIBKERN_CONSUMED IOPMRequest * request, IOPMCompletionQueue * queue );
bool notifyInterestedDrivers( void );
void notifyInterestedDriversDone( void );
bool notifyControllingDriver( void );
void notifyRootDomain( void );
void notifyRootDomainDone( void );
void cleanClientResponses( bool logErrors );
- void updatePowerClient( const OSSymbol * client, uint32_t powerState );
+ void updatePowerClient( const OSSymbol * client, IOPMPowerStateIndex powerState );
void removePowerClient( const OSSymbol * client );
- IOReturn requestPowerState( const OSSymbol * client, uint32_t state );
+ IOReturn requestPowerState( const OSSymbol * client, IOPMPowerStateIndex state, IOPMRequestTag tag = 0 );
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 = 0 );
+ void waitForPMDriverCall( IOService * target = NULL );
#endif /* XNU_KERNEL_PRIVATE */
};
+#ifdef PRIVATE
+
+class IOServiceCompatibility : public IOService
+{
+ OSDeclareDefaultStructors(IOServiceCompatibility);
+};
+
+#endif /* PRIVATE */
+
#endif /* ! _IOKIT_IOSERVICE_H */