| 1 | /* iig(DriverKit-286) generated from IOService.iig */ |
| 2 | |
| 3 | /* IOService.iig:1-71 */ |
| 4 | /* |
| 5 | * Copyright (c) 2019-2019 Apple Inc. All rights reserved. |
| 6 | * |
| 7 | * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ |
| 8 | * |
| 9 | * This file contains Original Code and/or Modifications of Original Code |
| 10 | * as defined in and that are subject to the Apple Public Source License |
| 11 | * Version 2.0 (the 'License'). You may not use this file except in |
| 12 | * compliance with the License. The rights granted to you under the License |
| 13 | * may not be used to create, or enable the creation or redistribution of, |
| 14 | * unlawful or unlicensed copies of an Apple operating system, or to |
| 15 | * circumvent, violate, or enable the circumvention or violation of, any |
| 16 | * terms of an Apple operating system software license agreement. |
| 17 | * |
| 18 | * Please obtain a copy of the License at |
| 19 | * http://www.opensource.apple.com/apsl/ and read it before using this file. |
| 20 | * |
| 21 | * The Original Code and all software distributed under the License are |
| 22 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER |
| 23 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
| 24 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, |
| 25 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. |
| 26 | * Please see the License for the specific language governing rights and |
| 27 | * limitations under the License. |
| 28 | * |
| 29 | * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ |
| 30 | */ |
| 31 | |
| 32 | #if !__IIG |
| 33 | #if KERNEL |
| 34 | #include <IOKit/IOService.h> |
| 35 | #endif |
| 36 | #endif |
| 37 | |
| 38 | #ifndef _IOKIT_UIOSERVICE_H |
| 39 | #define _IOKIT_UIOSERVICE_H |
| 40 | |
| 41 | #include <DriverKit/OSObject.h> /* .iig include */ |
| 42 | |
| 43 | class IOMemoryDescriptor; |
| 44 | class IOBufferMemoryDescriptor; |
| 45 | class IOUserClient; |
| 46 | class OSAction; |
| 47 | class IOServiceStateNotificationDispatchSource; |
| 48 | |
| 49 | typedef char IOServiceName[128]; |
| 50 | typedef char IOPropertyName[128]; |
| 51 | typedef char IORegistryPlaneName[128]; |
| 52 | |
| 53 | enum { |
| 54 | kIOServiceSearchPropertyParents = 0x00000001, |
| 55 | }; |
| 56 | |
| 57 | #define kIOServiceDefaultQueueName "Default" |
| 58 | |
| 59 | enum { |
| 60 | kIOServicePowerCapabilityOff = 0x00000000, |
| 61 | kIOServicePowerCapabilityOn = 0x00000002, |
| 62 | kIOServicePowerCapabilityLow = 0x00010000, |
| 63 | }; |
| 64 | |
| 65 | enum { |
| 66 | _kIOPMWakeEventSource = 0x00000001, |
| 67 | }; |
| 68 | |
| 69 | // values for OSNumber kIOSystemStateHaltDescriptionKey:kIOSystemStateHaltDescriptionHaltStateKey |
| 70 | enum { |
| 71 | kIOServiceHaltStatePowerOff = 0x00000001, |
| 72 | kIOServiceHaltStateRestart = 0x00000002, |
| 73 | }; |
| 74 | |
| 75 | /* source class IOService IOService.iig:72-551 */ |
| 76 | |
| 77 | #if __DOCUMENTATION__ |
| 78 | #define KERNEL IIG_KERNEL |
| 79 | |
| 80 | /*! |
| 81 | * @class IOService |
| 82 | * |
| 83 | * @abstract |
| 84 | * IOService represents an device or OS service in IOKit and DriverKit. |
| 85 | * |
| 86 | * @discussion |
| 87 | * IOKit provides driver lifecycle management through the IOService APIs. |
| 88 | * Drivers and devices are represented as subclasses of IOService. |
| 89 | * |
| 90 | |
| 91 | */ |
| 92 | |
| 93 | class KERNEL IOService : public OSObject |
| 94 | { |
| 95 | public: |
| 96 | virtual bool |
| 97 | init() override; |
| 98 | |
| 99 | virtual void |
| 100 | free() override; |
| 101 | |
| 102 | /*! |
| 103 | * @brief First call made to a matched IOService. |
| 104 | * @discussion During matching IOKit will create an IOService object for successful matches. |
| 105 | * Start is the first call made to the new object. |
| 106 | * @param provider The IOService provider for the match. This should be OSRequiredCast to the expected class. |
| 107 | * The provider is retained by DriverKit for the duration of Start() and on successful Start() until |
| 108 | * IOService::Stop() is called. |
| 109 | * @return kIOReturnSuccess on success. See IOReturn.h for error codes. |
| 110 | */ |
| 111 | virtual kern_return_t |
| 112 | Start(IOService * provider) LOCAL; |
| 113 | |
| 114 | /*! |
| 115 | * @brief Terminate access to provider. |
| 116 | * @discussion During termination IOKit will teardown any IOService objects attached to a terminated provider. |
| 117 | * Stop should quiesce all activity and when complete, pass the call to super. After calling super, the |
| 118 | * provider is no longer valid and this object will likely be freed. |
| 119 | * @param provider The IOService provider for being terminated, one previously passed to Start |
| 120 | * @return kIOReturnSuccess on success. See IOReturn.h for error codes. |
| 121 | */ |
| 122 | virtual kern_return_t |
| 123 | Stop(IOService * provider) LOCAL; |
| 124 | |
| 125 | /*! @function ClientCrashed |
| 126 | * @discussion Notification for kernel objects of a client crash. |
| 127 | * @param client Attached client. |
| 128 | * @param options No options are currently defined. |
| 129 | * @return kIOReturnSuccess on success. See IOReturn.h for error codes. |
| 130 | */ |
| 131 | virtual kern_return_t |
| 132 | ClientCrashed(IOService * client, uint64_t options); |
| 133 | |
| 134 | /*! |
| 135 | * @brief Obtain IOKit IORegistryEntryID. |
| 136 | * @param registryEntryID IORegistryEntryID for the IOKit object. |
| 137 | * @return kIOReturnSuccess on success. See IOReturn.h for error codes. |
| 138 | */ |
| 139 | virtual kern_return_t |
| 140 | GetRegistryEntryID(uint64_t * registryEntryID) LOCAL; |
| 141 | |
| 142 | /*! |
| 143 | * @brief Set the IORegistryEntry name. |
| 144 | * @param name Name for the IOKit object. The c-string will be copied. |
| 145 | * @return kIOReturnSuccess on success. See IOReturn.h for error codes. |
| 146 | */ |
| 147 | virtual kern_return_t |
| 148 | SetName( |
| 149 | const IOServiceName name); |
| 150 | |
| 151 | /*! |
| 152 | * @brief Start the matching process on the IOService object. |
| 153 | * @return kIOReturnSuccess on success. See IOReturn.h for error codes. |
| 154 | */ |
| 155 | virtual kern_return_t |
| 156 | RegisterService(); |
| 157 | |
| 158 | /*! |
| 159 | * @brief Set the IODispatchQueue for a given name on the IOService. |
| 160 | * @param name Name for the queue. The name may be referenced by methods in the .iig class definition |
| 161 | * with the QUEUENAME() attribute to indicate the method must be invoked on that queue. If a method |
| 162 | * is invoked before the queue is set for the name, the default queue is used. A default queue is |
| 163 | * created by DriverKit for every new IOService object with the name kIOServiceDefaultQueueName. |
| 164 | * @param queue Queue to be associated with the name on this IOService. |
| 165 | * @return kIOReturnSuccess on success. See IOReturn.h for error codes. |
| 166 | */ |
| 167 | virtual kern_return_t |
| 168 | SetDispatchQueue( |
| 169 | const IODispatchQueueName name, |
| 170 | IODispatchQueue * queue) override LOCAL; |
| 171 | |
| 172 | /*! |
| 173 | * @brief Obtain the IODispatchQueue for a given name on the IOService. |
| 174 | * @param name Name for the queue. |
| 175 | * @param queue Returned, retained queue or NULL. The caller should release this queue. |
| 176 | * @return kIOReturnSuccess on success. See IOReturn.h for error codes. |
| 177 | */ |
| 178 | virtual kern_return_t |
| 179 | CopyDispatchQueue( |
| 180 | const IODispatchQueueName name, |
| 181 | IODispatchQueue ** queue) override; |
| 182 | |
| 183 | /*! |
| 184 | * @brief Create the default IODispatchQueue for an IOService. IOService::init() |
| 185 | * calls this to create its default queue. |
| 186 | * @param queue Returned, retained queue or NULL. |
| 187 | * @return kIOReturnSuccess on success. See IOReturn.h for error codes. |
| 188 | */ |
| 189 | virtual kern_return_t |
| 190 | CreateDefaultDispatchQueue( |
| 191 | IODispatchQueue ** queue) LOCAL; |
| 192 | |
| 193 | /*! |
| 194 | * @brief Obtain the IOKit registry properties for the IOService. |
| 195 | * @param properties Returned, retained dictionary of properties or NULL. The caller should release this dictionary. |
| 196 | * @return kIOReturnSuccess on success. See IOReturn.h for error codes. |
| 197 | */ |
| 198 | virtual kern_return_t |
| 199 | CopyProperties( |
| 200 | OSDictionary ** properties); |
| 201 | |
| 202 | /*! |
| 203 | * @brief Obtain the an IOKit registry properties from the service or one of its parents. |
| 204 | * @param name Name of the property as a c-string. |
| 205 | * @param plane Name of the registry plane to be searched, if the option kIOServiceSearchPropertyParents |
| 206 | * is used. |
| 207 | * @param options Pass kIOServiceSearchPropertyParents to search for the property in the IOService and all |
| 208 | * its parents in the IOKit registry. |
| 209 | * @param property Returned, retained property object or NULL. The caller should release this property. |
| 210 | * @return kIOReturnSuccess on success. See IOReturn.h for error codes. |
| 211 | */ |
| 212 | virtual kern_return_t |
| 213 | SearchProperty( |
| 214 | const IOPropertyName name, |
| 215 | const IORegistryPlaneName plane, |
| 216 | uint64_t options, |
| 217 | OSContainer ** property); |
| 218 | |
| 219 | /*! |
| 220 | * @brief Send a dictionary of properties to an IOService. |
| 221 | * @discussion By default the method will fail. A DriverKit subclass or kernel class may implement this method. |
| 222 | * @param properties Dictionary of properties. |
| 223 | * @return kIOReturnSuccess on success. See IOReturn.h for error codes. |
| 224 | */ |
| 225 | virtual kern_return_t |
| 226 | SetProperties( |
| 227 | OSDictionary * properties); |
| 228 | |
| 229 | /*! |
| 230 | * @brief Add an IOService created by Create() to the power manangement tree. |
| 231 | * @discussion IOService objects created by matching on a provider are always added to the power management tree. |
| 232 | * Any IOService created with the Create() API is not, but may be added by calling this method. |
| 233 | * @return kIOReturnSuccess on success. See IOReturn.h for error codes. |
| 234 | */ |
| 235 | virtual kern_return_t |
| 236 | JoinPMTree(void); |
| 237 | |
| 238 | /*! |
| 239 | * @brief Notification of change in power state of a provider. |
| 240 | * @discussion DriverKit notifies of changes in power of a provider. The driver should make itself safe for |
| 241 | * the new state before passing the call to super. |
| 242 | * @param powerFlags The power capabilities of the new state. The values possible are: |
| 243 | * kIOServicePowerCapabilityOff the system will be entering sleep state |
| 244 | * kIOServicePowerCapabilityOn the device and system are fully powered |
| 245 | * kIOServicePowerCapabilityLow the device is in a reduced power state while the system is running |
| 246 | * @return kIOReturnSuccess on success. See IOReturn.h for error codes. |
| 247 | */ |
| 248 | virtual kern_return_t |
| 249 | SetPowerState( |
| 250 | uint32_t powerFlags) LOCAL; |
| 251 | |
| 252 | /*! |
| 253 | * @brief Allow provider to enter a low power state. |
| 254 | * @discussion A driver may allow a device to enter a lower power state. |
| 255 | * @param powerFlags The power capabilities of the new state. The values possible are: |
| 256 | * kIOServicePowerCapabilityLow the device is in a reduced power state while the system is running |
| 257 | * @return kIOReturnSuccess on success. See IOReturn.h for error codes. |
| 258 | */ |
| 259 | virtual kern_return_t |
| 260 | ChangePowerState( |
| 261 | uint32_t powerFlags); |
| 262 | |
| 263 | /*! |
| 264 | * @brief Request create a new user client for a client process. |
| 265 | * @discussion An application may request an IOUserClient be opened with the IOKit framework |
| 266 | * IOServiceOpen() call. The type parameter of that call is passed here. The driver should respond to |
| 267 | * the call by calling IOService::Create() with a plist entry describing the new user client object. |
| 268 | * @param type The type passed to IOServiceOpen(). |
| 269 | * @param userClient The object created by IOService::Create() |
| 270 | * @return kIOReturnSuccess on success. See IOReturn.h for error codes. |
| 271 | */ |
| 272 | virtual kern_return_t |
| 273 | NewUserClient( |
| 274 | uint32_t type, |
| 275 | IOUserClient ** userClient); |
| 276 | |
| 277 | /*! |
| 278 | * @brief Request to create an IOService object from a plist property. |
| 279 | * @discussion An IOService interface or IOUserClient subclass may be created from a plist property of the driver. |
| 280 | * The plist should contain the following IOKit matching keys: |
| 281 | * IOClass - kernel class of IOUserUserClient |
| 282 | * IOUserClass - DriverKit class to be instantiated |
| 283 | * IOServiceDEXTEntitlements - Array of entitlements to be checked against a user client owning task |
| 284 | * @param provider The provider of the new object. |
| 285 | * @param propertiesKey The name of the properties dictionary in this IOService |
| 286 | * @param result The created object retained, to be released by the caller. |
| 287 | * @return kIOReturnSuccess on success. See IOReturn.h for error codes. |
| 288 | */ |
| 289 | virtual kern_return_t |
| 290 | Create( |
| 291 | IOService * provider, |
| 292 | const IOPropertyName propertiesKey, |
| 293 | IOService ** result) LOCAL; |
| 294 | |
| 295 | /*! |
| 296 | * @brief Start an IOService termination. |
| 297 | * @discussion An IOService object created with Create() may be removed by calling Terminate(). |
| 298 | * The termination is asynchronous and will later call Stop() on the service. |
| 299 | * @param options No options are currently defined, pass zero. |
| 300 | * @return kIOReturnSuccess on success. See IOReturn.h for error codes. |
| 301 | */ |
| 302 | virtual kern_return_t |
| 303 | Terminate( |
| 304 | uint64_t options); |
| 305 | |
| 306 | /*! |
| 307 | * @brief Obtain supportable properties describing the provider chain. |
| 308 | * @discussion Obtain supportable properties describing the provider chain. This will be a subset of registry |
| 309 | * properties the OS considers supportable. |
| 310 | * The array is ordered with a dictionary of properties for each entry in the provider chain from this |
| 311 | * service towards the root. |
| 312 | * @param propertyKeys If only certain property values are need, they may be passed in this array. |
| 313 | * @param properties Returned, retained array of dictionaries of properties or NULL. The caller should release |
| 314 | * this array. |
| 315 | * @return kIOReturnSuccess on success. See IOReturn.h for error codes. |
| 316 | */ |
| 317 | virtual kern_return_t |
| 318 | CopyProviderProperties( |
| 319 | OSArray * propertyKeys, |
| 320 | OSArray ** properties); |
| 321 | |
| 322 | /*! |
| 323 | * @brief Reduce power saving modes in the system in order to provide decreased latency |
| 324 | * to hardware DMA requests. |
| 325 | * @discussion When the system enters lower power states DMA access to memory may be affected. |
| 326 | * The best way by far to handle this is to change how you schedule your time-critical DMA operations in |
| 327 | * your driver such that an occasional delay will not affect the proper functioning of your device. |
| 328 | * However, if this is not possible, your driver can inform power management when a time-critical transfer |
| 329 | * begins and ends so that the system will not enter the lowest power states during that time. To do this, |
| 330 | * pass a value to requireMaxBusStall that informs power management of the maximum memory access latency in |
| 331 | * nanoseconds that can be tolerated by the driver. This value is hardware dependent and is related to the |
| 332 | * amount of buffering available in the hardware. |
| 333 | * Supported values are given by the kIOMaxBusStall* enum in IOTypes.h |
| 334 | * Pass the largest value possible that works for your device. This will minimize power |
| 335 | * consumption and maximize battery life by still allowing some level of CPU power management. |
| 336 | * @param maxBusStall A value from the kIOMaxBusStall* enum in IOTypes.h |
| 337 | * @return kIOReturnSuccess on success. See IOReturn.h for error codes. |
| 338 | */ |
| 339 | virtual kern_return_t |
| 340 | RequireMaxBusStall( |
| 341 | uint64_t maxBusStall); |
| 342 | |
| 343 | /*! @function AdjustBusy |
| 344 | * @discussion Adjust the busy state of this service by applying a delta to the current busy state. |
| 345 | * Adjusting the busy state of a service to or from zero will change the provider's busy state by one, in the same direction. |
| 346 | * @param delta The delta value to apply to the busy state. |
| 347 | * @return kIOReturnSuccess on success. See IOReturn.h for error codes. |
| 348 | */ |
| 349 | virtual kern_return_t |
| 350 | AdjustBusy(int32_t delta); |
| 351 | |
| 352 | /*! @function GetBusyState |
| 353 | * @discussion Get the busy state of this service. |
| 354 | * @param busyState The returned busy state. |
| 355 | * @return kIOReturnSuccess on success. See IOReturn.h for error codes. |
| 356 | */ |
| 357 | virtual kern_return_t |
| 358 | GetBusyState(uint32_t *busyState); |
| 359 | |
| 360 | /*! |
| 361 | * @brief Post an event to CoreAnalytics. |
| 362 | * @discussion Post an event to CoreAnalytics. See the CoreAnalytics documentation for |
| 363 | * details. |
| 364 | * @param options No options currently defined pass zero. |
| 365 | * @param eventName See the CoreAnalytics documentation for details. |
| 366 | * @param eventPayload See the CoreAnalytics documentation for details. |
| 367 | * @return kIOReturnSuccess on success. See IOReturn.h for error codes. |
| 368 | */ |
| 369 | virtual kern_return_t |
| 370 | CoreAnalyticsSendEvent( |
| 371 | uint64_t options, |
| 372 | OSString * eventName, |
| 373 | OSDictionary * eventPayload); |
| 374 | |
| 375 | /*! @function IOCreatePropertyMatchingDictionary |
| 376 | * @abstract Construct a matching dictionary for property matching. |
| 377 | */ |
| 378 | static OSDictionary * |
| 379 | CreatePropertyMatchingDictionary(const char * key, OSObjectPtr value, OSDictionary * matching) LOCALONLY; |
| 380 | |
| 381 | /*! @function IOCreatePropertyMatchingDictionary |
| 382 | * @abstract Construct a matching dictionary for property matching. |
| 383 | */ |
| 384 | static OSDictionary * |
| 385 | CreatePropertyMatchingDictionary(const char * key, const char * stringValue, OSDictionary * matching) LOCALONLY; |
| 386 | |
| 387 | /*! @function IOCreateKernelClassMatchingDictionary |
| 388 | * @abstract Construct a matching dictionary for kernel class matching. |
| 389 | */ |
| 390 | static OSDictionary * |
| 391 | CreateKernelClassMatchingDictionary(OSString * className, OSDictionary * matching) LOCALONLY; |
| 392 | |
| 393 | /*! @function IOCreateKernelClassMatchingDictionary |
| 394 | * @abstract Construct a matching dictionary for kernel class matching. |
| 395 | */ |
| 396 | static OSDictionary * |
| 397 | CreateKernelClassMatchingDictionary(const char * className, OSDictionary * matching) LOCALONLY; |
| 398 | |
| 399 | /*! @function IOCreateUserClassMatchingDictionary |
| 400 | * @abstract Construct a matching dictionary for user class matching. |
| 401 | */ |
| 402 | static OSDictionary * |
| 403 | CreateUserClassMatchingDictionary(OSString * className, OSDictionary * matching) LOCALONLY; |
| 404 | |
| 405 | /*! @function IOCreateUserClassMatchingDictionary |
| 406 | * @abstract Construct a matching dictionary for user class matching. |
| 407 | */ |
| 408 | static OSDictionary * |
| 409 | CreateUserClassMatchingDictionary(const char * className, OSDictionary * matching) LOCALONLY; |
| 410 | |
| 411 | /*! @function IOCreateNameMatchingDictionary |
| 412 | * @abstract Construct a matching dictionary for IOService name matching. |
| 413 | */ |
| 414 | static OSDictionary * |
| 415 | CreateNameMatchingDictionary(OSString * serviceName, OSDictionary * matching) LOCALONLY; |
| 416 | |
| 417 | /*! @function IOCreateNameMatchingDictionary |
| 418 | * @abstract Construct a matching dictionary for IOService name matching. |
| 419 | */ |
| 420 | static OSDictionary * |
| 421 | CreateNameMatchingDictionary(const char * serviceName, OSDictionary * matching) LOCALONLY; |
| 422 | |
| 423 | /*! @function UpdateReport |
| 424 | * @abstract update an IOReporting subscription by reading out channel data. |
| 425 | */ |
| 426 | virtual IOReturn UpdateReport(OSData *channels, uint32_t action, |
| 427 | uint32_t *outElementCount, |
| 428 | uint64_t offset, uint64_t capacity, |
| 429 | IOMemoryDescriptor *buffer); |
| 430 | |
| 431 | /*! @function ConfigureReport |
| 432 | * @abstract Configure an IOReporting subscription |
| 433 | * @discussion outCount is counting channels for enable,disable. It is counting |
| 434 | * elements for getDimensions |
| 435 | */ |
| 436 | virtual IOReturn ConfigureReport(OSData *channels, uint32_t action, uint32_t *outCount); |
| 437 | |
| 438 | /*! @function SetLegend |
| 439 | * @abstract set IORLegend and IORLegendPublic ioreg properties on this service. |
| 440 | * @discussion For use by DriverKit userspace services, since they can't set |
| 441 | * registry properties directly. |
| 442 | */ |
| 443 | virtual IOReturn SetLegend(OSArray *legend, bool is_public); |
| 444 | |
| 445 | /*! |
| 446 | * @brief Get the IORegistryEntry name. |
| 447 | * @return kIOReturnSuccess on success. See IOReturn.h for error codes. |
| 448 | */ |
| 449 | virtual kern_return_t |
| 450 | CopyName(OSString ** name); |
| 451 | |
| 452 | /*! @function StringFromReturn |
| 453 | * @abstract Get a string description for an IOReturn value. |
| 454 | * @return kIOReturnSuccess on success. See IOReturn.h for error codes. |
| 455 | */ |
| 456 | virtual kern_return_t |
| 457 | StringFromReturn( |
| 458 | IOReturn retval, |
| 459 | OSString ** str); |
| 460 | |
| 461 | virtual kern_return_t |
| 462 | _ClaimSystemWakeEvent( |
| 463 | IOService * device, |
| 464 | uint64_t flags, |
| 465 | const IOPropertyName reason, |
| 466 | OSContainer * details); |
| 467 | |
| 468 | #if PRIVATE_WIFI_ONLY |
| 469 | /*! |
| 470 | * @brief Optionally supported external method to set properties in this service. |
| 471 | * @param properties The properties to set. |
| 472 | * @return kIOReturnSuccess on success. See IOReturn.h for error codes. |
| 473 | */ |
| 474 | virtual kern_return_t |
| 475 | UserSetProperties(OSContainer * properties) LOCAL; |
| 476 | |
| 477 | /*! |
| 478 | * @brief Send the kIOMessageServicePropertyChange message |
| 479 | * @return kIOReturnSuccess on success. See IOReturn.h for error codes. |
| 480 | */ |
| 481 | virtual kern_return_t |
| 482 | SendIOMessageServicePropertyChange(); |
| 483 | |
| 484 | const char * |
| 485 | StringFromReturn( |
| 486 | IOReturn retval) LOCALONLY; |
| 487 | #endif /* PRIVATE_WIFI_ONLY */ |
| 488 | |
| 489 | /*! @function RemoveProperty |
| 490 | * @abstract Remove a property from the IOService. |
| 491 | * @return kIOReturnSuccess on success. See IOReturn.h for error codes. |
| 492 | */ |
| 493 | virtual kern_return_t |
| 494 | RemoveProperty(OSString * propertyName); |
| 495 | |
| 496 | /*! @function GetProvider |
| 497 | * @abstract Get the provider of this IOService. |
| 498 | * @discussion The DriverKit runtime caches the provider passed to IOService::Start(IOService * provider). |
| 499 | * This method returns the cached object. |
| 500 | */ |
| 501 | IOService * |
| 502 | GetProvider() const LOCALONLY; |
| 503 | |
| 504 | /*! |
| 505 | * @function CopySystemStateNotificationService |
| 506 | * @abstract Obtain the system state notification service. |
| 507 | * @param service Return IOService object with +1 retain count, to be released |
| 508 | * by the caller. |
| 509 | * @return kIOReturnSuccess on success. See IOReturn.h for error codes. |
| 510 | */ |
| 511 | virtual kern_return_t |
| 512 | CopySystemStateNotificationService(IOService ** service); |
| 513 | |
| 514 | /*! |
| 515 | * @function StateNotificationItemCreate |
| 516 | * @abstract Create a state notification item. |
| 517 | * @param itemName name of the item. |
| 518 | * @param schema dictionary describing behaviors for the item. Keys are defined in |
| 519 | * IOKitKeys.h kIOStateNotification* |
| 520 | * @return kIOReturnSuccess on success. See IOReturn.h for error codes. |
| 521 | */ |
| 522 | virtual kern_return_t |
| 523 | StateNotificationItemCreate(OSString * itemName, OSDictionary * schema); |
| 524 | |
| 525 | /*! |
| 526 | * @function StateNotificationItemSet |
| 527 | * @abstract Set the value of a state notification item. |
| 528 | * @param itemName name of the item. |
| 529 | * @param value dictionary value for the item, item creator to define. |
| 530 | * @return kIOReturnSuccess on success. See IOReturn.h for error codes. |
| 531 | */ |
| 532 | virtual kern_return_t |
| 533 | StateNotificationItemSet(OSString * itemName, OSDictionary * value); |
| 534 | |
| 535 | /*! |
| 536 | * @function StateNotificationItemCopy |
| 537 | * @abstract Set the value of a state notification item. |
| 538 | * @param itemName name of the item. |
| 539 | * @param value dictionary value for the item, item creator to define. |
| 540 | * @return kIOReturnSuccess on success. See IOReturn.h for error codes. |
| 541 | */ |
| 542 | virtual kern_return_t |
| 543 | StateNotificationItemCopy(OSString * itemName, OSDictionary ** value); |
| 544 | |
| 545 | private: |
| 546 | virtual void |
| 547 | Stop_async( |
| 548 | IOService * provider) LOCAL; |
| 549 | |
| 550 | virtual kern_return_t |
| 551 | _NewUserClient( |
| 552 | uint32_t type, |
| 553 | OSDictionary * entitlements, |
| 554 | IOUserClient ** userClient) LOCAL; |
| 555 | }; |
| 556 | |
| 557 | #undef KERNEL |
| 558 | #else /* __DOCUMENTATION__ */ |
| 559 | |
| 560 | /* generated class IOService IOService.iig:72-551 */ |
| 561 | |
| 562 | #define IOService_Start_ID 0xab6f76dde6d693f2ULL |
| 563 | #define IOService_Stop_ID 0x98e715041c459fa5ULL |
| 564 | #define IOService_ClientCrashed_ID 0xf608d8d479c824a3ULL |
| 565 | #define IOService_GetRegistryEntryID_ID 0x8a6f522f3894a0d7ULL |
| 566 | #define IOService_SetName_ID 0xff378dd57615eb9fULL |
| 567 | #define IOService_RegisterService_ID 0xe9722c2bb1347c28ULL |
| 568 | #define IOService_CreateDefaultDispatchQueue_ID 0x805bb452f0b44ef7ULL |
| 569 | #define IOService_CopyProperties_ID 0x833ec8f92f8b5362ULL |
| 570 | #define IOService_SearchProperty_ID 0xad751cdb94c8dcc8ULL |
| 571 | #define IOService_SetProperties_ID 0xd8a753ea156f9162ULL |
| 572 | #define IOService_JoinPMTree_ID 0xf26c46526735efffULL |
| 573 | #define IOService_SetPowerState_ID 0xd200fde7d57ecca6ULL |
| 574 | #define IOService_ChangePowerState_ID 0xdb75cfc3395484a0ULL |
| 575 | #define IOService_NewUserClient_ID 0xf669efffcb89ed9cULL |
| 576 | #define IOService_Create_ID 0xe1a46dbd68bbe09cULL |
| 577 | #define IOService_Terminate_ID 0xf7a595d9927810c8ULL |
| 578 | #define IOService_CopyProviderProperties_ID 0xc2a554959002c8e7ULL |
| 579 | #define IOService_RequireMaxBusStall_ID 0xc21228652ff536afULL |
| 580 | #define IOService_AdjustBusy_ID 0xde9f5ab8cc9758ebULL |
| 581 | #define IOService_GetBusyState_ID 0xf5e47b685861dee5ULL |
| 582 | #define IOService_CoreAnalyticsSendEvent_ID 0xedf64411b90d31caULL |
| 583 | #define IOService_UpdateReport_ID 0x8509eed786c7ff1aULL |
| 584 | #define IOService_ConfigureReport_ID 0x85d9def59e3f02beULL |
| 585 | #define IOService_SetLegend_ID 0xa32ee5222548afa2ULL |
| 586 | #define IOService_CopyName_ID 0xfe0617febc5b2cc4ULL |
| 587 | #define IOService_StringFromReturn_ID 0xf62cec3df59db769ULL |
| 588 | #define IOService__ClaimSystemWakeEvent_ID 0x845c18dfe6f75305ULL |
| 589 | #define IOService_UserSetProperties_ID 0xad8461d6bb5e656dULL |
| 590 | #define IOService_SendIOMessageServicePropertyChange_ID 0xf26f1c63c935e672ULL |
| 591 | #define IOService_RemoveProperty_ID 0xdadeb06419d321b0ULL |
| 592 | #define IOService_CopySystemStateNotificationService_ID 0x9165d1fce9b2ca5aULL |
| 593 | #define IOService_StateNotificationItemCreate_ID 0xb35947bdab354e9eULL |
| 594 | #define IOService_StateNotificationItemSet_ID 0xb318c8fa26b5b891ULL |
| 595 | #define IOService_StateNotificationItemCopy_ID 0xad2e6404fde4b615ULL |
| 596 | #define IOService_Stop_async_ID 0xa8c93137712a16a2ULL |
| 597 | #define IOService__NewUserClient_ID 0x80b22dd60ee3abb6ULL |
| 598 | |
| 599 | #define IOService_Start_Args \ |
| 600 | IOService * provider |
| 601 | |
| 602 | #define IOService_Stop_Args \ |
| 603 | IOService * provider |
| 604 | |
| 605 | #define IOService_ClientCrashed_Args \ |
| 606 | IOService * client, \ |
| 607 | uint64_t options |
| 608 | |
| 609 | #define IOService_GetRegistryEntryID_Args \ |
| 610 | uint64_t * registryEntryID |
| 611 | |
| 612 | #define IOService_SetName_Args \ |
| 613 | const char * name |
| 614 | |
| 615 | #define IOService_RegisterService_Args \ |
| 616 | |
| 617 | |
| 618 | #define IOService_SetDispatchQueue_Args \ |
| 619 | const char * name, \ |
| 620 | IODispatchQueue * queue |
| 621 | |
| 622 | #define IOService_CopyDispatchQueue_Args \ |
| 623 | const char * name, \ |
| 624 | IODispatchQueue ** queue |
| 625 | |
| 626 | #define IOService_CreateDefaultDispatchQueue_Args \ |
| 627 | IODispatchQueue ** queue |
| 628 | |
| 629 | #define IOService_CopyProperties_Args \ |
| 630 | OSDictionary ** properties |
| 631 | |
| 632 | #define IOService_SearchProperty_Args \ |
| 633 | const char * name, \ |
| 634 | const char * plane, \ |
| 635 | uint64_t options, \ |
| 636 | OSContainer ** property |
| 637 | |
| 638 | #define IOService_SetProperties_Args \ |
| 639 | OSDictionary * properties |
| 640 | |
| 641 | #define IOService_JoinPMTree_Args \ |
| 642 | |
| 643 | |
| 644 | #define IOService_SetPowerState_Args \ |
| 645 | uint32_t powerFlags |
| 646 | |
| 647 | #define IOService_ChangePowerState_Args \ |
| 648 | uint32_t powerFlags |
| 649 | |
| 650 | #define IOService_NewUserClient_Args \ |
| 651 | uint32_t type, \ |
| 652 | IOUserClient ** userClient |
| 653 | |
| 654 | #define IOService_Create_Args \ |
| 655 | IOService * provider, \ |
| 656 | const char * propertiesKey, \ |
| 657 | IOService ** result |
| 658 | |
| 659 | #define IOService_Terminate_Args \ |
| 660 | uint64_t options |
| 661 | |
| 662 | #define IOService_CopyProviderProperties_Args \ |
| 663 | OSArray * propertyKeys, \ |
| 664 | OSArray ** properties |
| 665 | |
| 666 | #define IOService_RequireMaxBusStall_Args \ |
| 667 | uint64_t maxBusStall |
| 668 | |
| 669 | #define IOService_AdjustBusy_Args \ |
| 670 | int32_t delta |
| 671 | |
| 672 | #define IOService_GetBusyState_Args \ |
| 673 | uint32_t * busyState |
| 674 | |
| 675 | #define IOService_CoreAnalyticsSendEvent_Args \ |
| 676 | uint64_t options, \ |
| 677 | OSString * eventName, \ |
| 678 | OSDictionary * eventPayload |
| 679 | |
| 680 | #define IOService_UpdateReport_Args \ |
| 681 | OSData * channels, \ |
| 682 | uint32_t action, \ |
| 683 | uint32_t * outElementCount, \ |
| 684 | uint64_t offset, \ |
| 685 | uint64_t capacity, \ |
| 686 | IOMemoryDescriptor * buffer |
| 687 | |
| 688 | #define IOService_ConfigureReport_Args \ |
| 689 | OSData * channels, \ |
| 690 | uint32_t action, \ |
| 691 | uint32_t * outCount |
| 692 | |
| 693 | #define IOService_SetLegend_Args \ |
| 694 | OSArray * legend, \ |
| 695 | bool is_public |
| 696 | |
| 697 | #define IOService_CopyName_Args \ |
| 698 | OSString ** name |
| 699 | |
| 700 | #define IOService_StringFromReturn_Args \ |
| 701 | IOReturn retval, \ |
| 702 | OSString ** str |
| 703 | |
| 704 | #define IOService__ClaimSystemWakeEvent_Args \ |
| 705 | IOService * device, \ |
| 706 | uint64_t flags, \ |
| 707 | const char * reason, \ |
| 708 | OSContainer * details |
| 709 | |
| 710 | #define IOService_UserSetProperties_Args \ |
| 711 | OSContainer * properties |
| 712 | |
| 713 | #define IOService_SendIOMessageServicePropertyChange_Args \ |
| 714 | |
| 715 | |
| 716 | #define IOService_RemoveProperty_Args \ |
| 717 | OSString * propertyName |
| 718 | |
| 719 | #define IOService_CopySystemStateNotificationService_Args \ |
| 720 | IOService ** service |
| 721 | |
| 722 | #define IOService_StateNotificationItemCreate_Args \ |
| 723 | OSString * itemName, \ |
| 724 | OSDictionary * schema |
| 725 | |
| 726 | #define IOService_StateNotificationItemSet_Args \ |
| 727 | OSString * itemName, \ |
| 728 | OSDictionary * value |
| 729 | |
| 730 | #define IOService_StateNotificationItemCopy_Args \ |
| 731 | OSString * itemName, \ |
| 732 | OSDictionary ** value |
| 733 | |
| 734 | #define IOService_Stop_async_Args \ |
| 735 | IOService * provider |
| 736 | |
| 737 | #define IOService__NewUserClient_Args \ |
| 738 | uint32_t type, \ |
| 739 | OSDictionary * entitlements, \ |
| 740 | IOUserClient ** userClient |
| 741 | |
| 742 | #define IOService_Methods \ |
| 743 | \ |
| 744 | public:\ |
| 745 | \ |
| 746 | virtual kern_return_t\ |
| 747 | Dispatch(const IORPC rpc) APPLE_KEXT_OVERRIDE;\ |
| 748 | \ |
| 749 | static kern_return_t\ |
| 750 | _Dispatch(IOService * self, const IORPC rpc);\ |
| 751 | \ |
| 752 | kern_return_t\ |
| 753 | Start(\ |
| 754 | IOService * provider,\ |
| 755 | OSDispatchMethod supermethod = NULL);\ |
| 756 | \ |
| 757 | kern_return_t\ |
| 758 | Stop(\ |
| 759 | IOService * provider,\ |
| 760 | OSDispatchMethod supermethod = NULL);\ |
| 761 | \ |
| 762 | kern_return_t\ |
| 763 | ClientCrashed(\ |
| 764 | IOService * client,\ |
| 765 | uint64_t options,\ |
| 766 | OSDispatchMethod supermethod = NULL);\ |
| 767 | \ |
| 768 | kern_return_t\ |
| 769 | GetRegistryEntryID(\ |
| 770 | uint64_t * registryEntryID,\ |
| 771 | OSDispatchMethod supermethod = NULL);\ |
| 772 | \ |
| 773 | kern_return_t\ |
| 774 | SetName(\ |
| 775 | const char * name,\ |
| 776 | OSDispatchMethod supermethod = NULL);\ |
| 777 | \ |
| 778 | kern_return_t\ |
| 779 | RegisterService(\ |
| 780 | OSDispatchMethod supermethod = NULL);\ |
| 781 | \ |
| 782 | kern_return_t\ |
| 783 | CreateDefaultDispatchQueue(\ |
| 784 | IODispatchQueue ** queue,\ |
| 785 | OSDispatchMethod supermethod = NULL);\ |
| 786 | \ |
| 787 | kern_return_t\ |
| 788 | CopyProperties(\ |
| 789 | OSDictionary ** properties,\ |
| 790 | OSDispatchMethod supermethod = NULL);\ |
| 791 | \ |
| 792 | kern_return_t\ |
| 793 | SearchProperty(\ |
| 794 | const char * name,\ |
| 795 | const char * plane,\ |
| 796 | uint64_t options,\ |
| 797 | OSContainer ** property,\ |
| 798 | OSDispatchMethod supermethod = NULL);\ |
| 799 | \ |
| 800 | kern_return_t\ |
| 801 | SetProperties(\ |
| 802 | OSDictionary * properties,\ |
| 803 | OSDispatchMethod supermethod = NULL);\ |
| 804 | \ |
| 805 | kern_return_t\ |
| 806 | JoinPMTree(\ |
| 807 | OSDispatchMethod supermethod = NULL);\ |
| 808 | \ |
| 809 | kern_return_t\ |
| 810 | SetPowerState(\ |
| 811 | uint32_t powerFlags,\ |
| 812 | OSDispatchMethod supermethod = NULL);\ |
| 813 | \ |
| 814 | kern_return_t\ |
| 815 | ChangePowerState(\ |
| 816 | uint32_t powerFlags,\ |
| 817 | OSDispatchMethod supermethod = NULL);\ |
| 818 | \ |
| 819 | kern_return_t\ |
| 820 | NewUserClient(\ |
| 821 | uint32_t type,\ |
| 822 | IOUserClient ** userClient,\ |
| 823 | OSDispatchMethod supermethod = NULL);\ |
| 824 | \ |
| 825 | kern_return_t\ |
| 826 | Create(\ |
| 827 | IOService * provider,\ |
| 828 | const char * propertiesKey,\ |
| 829 | IOService ** result,\ |
| 830 | OSDispatchMethod supermethod = NULL);\ |
| 831 | \ |
| 832 | kern_return_t\ |
| 833 | Terminate(\ |
| 834 | uint64_t options,\ |
| 835 | OSDispatchMethod supermethod = NULL);\ |
| 836 | \ |
| 837 | kern_return_t\ |
| 838 | CopyProviderProperties(\ |
| 839 | OSArray * propertyKeys,\ |
| 840 | OSArray ** properties,\ |
| 841 | OSDispatchMethod supermethod = NULL);\ |
| 842 | \ |
| 843 | kern_return_t\ |
| 844 | RequireMaxBusStall(\ |
| 845 | uint64_t maxBusStall,\ |
| 846 | OSDispatchMethod supermethod = NULL);\ |
| 847 | \ |
| 848 | kern_return_t\ |
| 849 | AdjustBusy(\ |
| 850 | int32_t delta,\ |
| 851 | OSDispatchMethod supermethod = NULL);\ |
| 852 | \ |
| 853 | kern_return_t\ |
| 854 | GetBusyState(\ |
| 855 | uint32_t * busyState,\ |
| 856 | OSDispatchMethod supermethod = NULL);\ |
| 857 | \ |
| 858 | kern_return_t\ |
| 859 | CoreAnalyticsSendEvent(\ |
| 860 | uint64_t options,\ |
| 861 | OSString * eventName,\ |
| 862 | OSDictionary * eventPayload,\ |
| 863 | OSDispatchMethod supermethod = NULL);\ |
| 864 | \ |
| 865 | static OSDictionary *\ |
| 866 | CreatePropertyMatchingDictionary(\ |
| 867 | const char * key,\ |
| 868 | OSObjectPtr value,\ |
| 869 | OSDictionary * matching);\ |
| 870 | \ |
| 871 | static OSDictionary *\ |
| 872 | CreatePropertyMatchingDictionary(\ |
| 873 | const char * key,\ |
| 874 | const char * stringValue,\ |
| 875 | OSDictionary * matching);\ |
| 876 | \ |
| 877 | static OSDictionary *\ |
| 878 | CreateKernelClassMatchingDictionary(\ |
| 879 | OSString * className,\ |
| 880 | OSDictionary * matching);\ |
| 881 | \ |
| 882 | static OSDictionary *\ |
| 883 | CreateKernelClassMatchingDictionary(\ |
| 884 | const char * className,\ |
| 885 | OSDictionary * matching);\ |
| 886 | \ |
| 887 | static OSDictionary *\ |
| 888 | CreateUserClassMatchingDictionary(\ |
| 889 | OSString * className,\ |
| 890 | OSDictionary * matching);\ |
| 891 | \ |
| 892 | static OSDictionary *\ |
| 893 | CreateUserClassMatchingDictionary(\ |
| 894 | const char * className,\ |
| 895 | OSDictionary * matching);\ |
| 896 | \ |
| 897 | static OSDictionary *\ |
| 898 | CreateNameMatchingDictionary(\ |
| 899 | OSString * serviceName,\ |
| 900 | OSDictionary * matching);\ |
| 901 | \ |
| 902 | static OSDictionary *\ |
| 903 | CreateNameMatchingDictionary(\ |
| 904 | const char * serviceName,\ |
| 905 | OSDictionary * matching);\ |
| 906 | \ |
| 907 | IOReturn\ |
| 908 | UpdateReport(\ |
| 909 | OSData * channels,\ |
| 910 | uint32_t action,\ |
| 911 | uint32_t * outElementCount,\ |
| 912 | uint64_t offset,\ |
| 913 | uint64_t capacity,\ |
| 914 | IOMemoryDescriptor * buffer,\ |
| 915 | OSDispatchMethod supermethod = NULL);\ |
| 916 | \ |
| 917 | IOReturn\ |
| 918 | ConfigureReport(\ |
| 919 | OSData * channels,\ |
| 920 | uint32_t action,\ |
| 921 | uint32_t * outCount,\ |
| 922 | OSDispatchMethod supermethod = NULL);\ |
| 923 | \ |
| 924 | IOReturn\ |
| 925 | SetLegend(\ |
| 926 | OSArray * legend,\ |
| 927 | bool is_public,\ |
| 928 | OSDispatchMethod supermethod = NULL);\ |
| 929 | \ |
| 930 | kern_return_t\ |
| 931 | CopyName(\ |
| 932 | OSString ** name,\ |
| 933 | OSDispatchMethod supermethod = NULL);\ |
| 934 | \ |
| 935 | kern_return_t\ |
| 936 | StringFromReturn(\ |
| 937 | IOReturn retval,\ |
| 938 | OSString ** str,\ |
| 939 | OSDispatchMethod supermethod = NULL);\ |
| 940 | \ |
| 941 | kern_return_t\ |
| 942 | _ClaimSystemWakeEvent(\ |
| 943 | IOService * device,\ |
| 944 | uint64_t flags,\ |
| 945 | const char * reason,\ |
| 946 | OSContainer * details,\ |
| 947 | OSDispatchMethod supermethod = NULL);\ |
| 948 | \ |
| 949 | kern_return_t\ |
| 950 | UserSetProperties(\ |
| 951 | OSContainer * properties,\ |
| 952 | OSDispatchMethod supermethod = NULL);\ |
| 953 | \ |
| 954 | kern_return_t\ |
| 955 | SendIOMessageServicePropertyChange(\ |
| 956 | OSDispatchMethod supermethod = NULL);\ |
| 957 | \ |
| 958 | const char *\ |
| 959 | StringFromReturn(\ |
| 960 | IOReturn retval);\ |
| 961 | \ |
| 962 | kern_return_t\ |
| 963 | RemoveProperty(\ |
| 964 | OSString * propertyName,\ |
| 965 | OSDispatchMethod supermethod = NULL);\ |
| 966 | \ |
| 967 | IOService *\ |
| 968 | GetProvider(\ |
| 969 | ) const;\ |
| 970 | \ |
| 971 | kern_return_t\ |
| 972 | CopySystemStateNotificationService(\ |
| 973 | IOService ** service,\ |
| 974 | OSDispatchMethod supermethod = NULL);\ |
| 975 | \ |
| 976 | kern_return_t\ |
| 977 | StateNotificationItemCreate(\ |
| 978 | OSString * itemName,\ |
| 979 | OSDictionary * schema,\ |
| 980 | OSDispatchMethod supermethod = NULL);\ |
| 981 | \ |
| 982 | kern_return_t\ |
| 983 | StateNotificationItemSet(\ |
| 984 | OSString * itemName,\ |
| 985 | OSDictionary * value,\ |
| 986 | OSDispatchMethod supermethod = NULL);\ |
| 987 | \ |
| 988 | kern_return_t\ |
| 989 | StateNotificationItemCopy(\ |
| 990 | OSString * itemName,\ |
| 991 | OSDictionary ** value,\ |
| 992 | OSDispatchMethod supermethod = NULL);\ |
| 993 | \ |
| 994 | void\ |
| 995 | Stop_async(\ |
| 996 | IOService * provider,\ |
| 997 | OSDispatchMethod supermethod = NULL);\ |
| 998 | \ |
| 999 | kern_return_t\ |
| 1000 | _NewUserClient(\ |
| 1001 | uint32_t type,\ |
| 1002 | OSDictionary * entitlements,\ |
| 1003 | IOUserClient ** userClient,\ |
| 1004 | OSDispatchMethod supermethod = NULL);\ |
| 1005 | \ |
| 1006 | \ |
| 1007 | protected:\ |
| 1008 | /* _Impl methods */\ |
| 1009 | \ |
| 1010 | kern_return_t\ |
| 1011 | Start_Impl(IOService_Start_Args);\ |
| 1012 | \ |
| 1013 | kern_return_t\ |
| 1014 | Stop_Impl(IOService_Stop_Args);\ |
| 1015 | \ |
| 1016 | kern_return_t\ |
| 1017 | GetRegistryEntryID_Impl(IOService_GetRegistryEntryID_Args);\ |
| 1018 | \ |
| 1019 | kern_return_t\ |
| 1020 | SetDispatchQueue_Impl(OSObject_SetDispatchQueue_Args);\ |
| 1021 | \ |
| 1022 | kern_return_t\ |
| 1023 | CreateDefaultDispatchQueue_Impl(IOService_CreateDefaultDispatchQueue_Args);\ |
| 1024 | \ |
| 1025 | kern_return_t\ |
| 1026 | SetPowerState_Impl(IOService_SetPowerState_Args);\ |
| 1027 | \ |
| 1028 | kern_return_t\ |
| 1029 | Create_Impl(IOService_Create_Args);\ |
| 1030 | \ |
| 1031 | kern_return_t\ |
| 1032 | UserSetProperties_Impl(IOService_UserSetProperties_Args);\ |
| 1033 | \ |
| 1034 | void\ |
| 1035 | Stop_async_Impl(IOService_Stop_async_Args);\ |
| 1036 | \ |
| 1037 | kern_return_t\ |
| 1038 | _NewUserClient_Impl(IOService__NewUserClient_Args);\ |
| 1039 | \ |
| 1040 | \ |
| 1041 | public:\ |
| 1042 | /* _Invoke methods */\ |
| 1043 | \ |
| 1044 | typedef kern_return_t (*Start_Handler)(OSMetaClassBase * target, IOService_Start_Args);\ |
| 1045 | static kern_return_t\ |
| 1046 | Start_Invoke(const IORPC rpc,\ |
| 1047 | OSMetaClassBase * target,\ |
| 1048 | Start_Handler func);\ |
| 1049 | \ |
| 1050 | typedef kern_return_t (*Stop_Handler)(OSMetaClassBase * target, IOService_Stop_Args);\ |
| 1051 | static kern_return_t\ |
| 1052 | Stop_Invoke(const IORPC rpc,\ |
| 1053 | OSMetaClassBase * target,\ |
| 1054 | Stop_Handler func);\ |
| 1055 | \ |
| 1056 | typedef kern_return_t (*ClientCrashed_Handler)(OSMetaClassBase * target, IOService_ClientCrashed_Args);\ |
| 1057 | static kern_return_t\ |
| 1058 | ClientCrashed_Invoke(const IORPC rpc,\ |
| 1059 | OSMetaClassBase * target,\ |
| 1060 | ClientCrashed_Handler func);\ |
| 1061 | \ |
| 1062 | typedef kern_return_t (*GetRegistryEntryID_Handler)(OSMetaClassBase * target, IOService_GetRegistryEntryID_Args);\ |
| 1063 | static kern_return_t\ |
| 1064 | GetRegistryEntryID_Invoke(const IORPC rpc,\ |
| 1065 | OSMetaClassBase * target,\ |
| 1066 | GetRegistryEntryID_Handler func);\ |
| 1067 | \ |
| 1068 | typedef kern_return_t (*SetName_Handler)(OSMetaClassBase * target, IOService_SetName_Args);\ |
| 1069 | static kern_return_t\ |
| 1070 | SetName_Invoke(const IORPC rpc,\ |
| 1071 | OSMetaClassBase * target,\ |
| 1072 | SetName_Handler func);\ |
| 1073 | \ |
| 1074 | typedef kern_return_t (*RegisterService_Handler)(OSMetaClassBase * targetIOService_RegisterService_Args);\ |
| 1075 | static kern_return_t\ |
| 1076 | RegisterService_Invoke(const IORPC rpc,\ |
| 1077 | OSMetaClassBase * target,\ |
| 1078 | RegisterService_Handler func);\ |
| 1079 | \ |
| 1080 | typedef kern_return_t (*CreateDefaultDispatchQueue_Handler)(OSMetaClassBase * target, IOService_CreateDefaultDispatchQueue_Args);\ |
| 1081 | static kern_return_t\ |
| 1082 | CreateDefaultDispatchQueue_Invoke(const IORPC rpc,\ |
| 1083 | OSMetaClassBase * target,\ |
| 1084 | CreateDefaultDispatchQueue_Handler func);\ |
| 1085 | \ |
| 1086 | typedef kern_return_t (*CopyProperties_Handler)(OSMetaClassBase * target, IOService_CopyProperties_Args);\ |
| 1087 | static kern_return_t\ |
| 1088 | CopyProperties_Invoke(const IORPC rpc,\ |
| 1089 | OSMetaClassBase * target,\ |
| 1090 | CopyProperties_Handler func);\ |
| 1091 | \ |
| 1092 | typedef kern_return_t (*SearchProperty_Handler)(OSMetaClassBase * target, IOService_SearchProperty_Args);\ |
| 1093 | static kern_return_t\ |
| 1094 | SearchProperty_Invoke(const IORPC rpc,\ |
| 1095 | OSMetaClassBase * target,\ |
| 1096 | SearchProperty_Handler func);\ |
| 1097 | \ |
| 1098 | typedef kern_return_t (*SetProperties_Handler)(OSMetaClassBase * target, IOService_SetProperties_Args);\ |
| 1099 | static kern_return_t\ |
| 1100 | SetProperties_Invoke(const IORPC rpc,\ |
| 1101 | OSMetaClassBase * target,\ |
| 1102 | SetProperties_Handler func);\ |
| 1103 | \ |
| 1104 | typedef kern_return_t (*JoinPMTree_Handler)(OSMetaClassBase * targetIOService_JoinPMTree_Args);\ |
| 1105 | static kern_return_t\ |
| 1106 | JoinPMTree_Invoke(const IORPC rpc,\ |
| 1107 | OSMetaClassBase * target,\ |
| 1108 | JoinPMTree_Handler func);\ |
| 1109 | \ |
| 1110 | typedef kern_return_t (*SetPowerState_Handler)(OSMetaClassBase * target, IOService_SetPowerState_Args);\ |
| 1111 | static kern_return_t\ |
| 1112 | SetPowerState_Invoke(const IORPC rpc,\ |
| 1113 | OSMetaClassBase * target,\ |
| 1114 | SetPowerState_Handler func);\ |
| 1115 | \ |
| 1116 | typedef kern_return_t (*ChangePowerState_Handler)(OSMetaClassBase * target, IOService_ChangePowerState_Args);\ |
| 1117 | static kern_return_t\ |
| 1118 | ChangePowerState_Invoke(const IORPC rpc,\ |
| 1119 | OSMetaClassBase * target,\ |
| 1120 | ChangePowerState_Handler func);\ |
| 1121 | \ |
| 1122 | typedef kern_return_t (*NewUserClient_Handler)(OSMetaClassBase * target, IOService_NewUserClient_Args);\ |
| 1123 | static kern_return_t\ |
| 1124 | NewUserClient_Invoke(const IORPC rpc,\ |
| 1125 | OSMetaClassBase * target,\ |
| 1126 | NewUserClient_Handler func);\ |
| 1127 | \ |
| 1128 | typedef kern_return_t (*Create_Handler)(OSMetaClassBase * target, IOService_Create_Args);\ |
| 1129 | static kern_return_t\ |
| 1130 | Create_Invoke(const IORPC rpc,\ |
| 1131 | OSMetaClassBase * target,\ |
| 1132 | Create_Handler func);\ |
| 1133 | \ |
| 1134 | typedef kern_return_t (*Terminate_Handler)(OSMetaClassBase * target, IOService_Terminate_Args);\ |
| 1135 | static kern_return_t\ |
| 1136 | Terminate_Invoke(const IORPC rpc,\ |
| 1137 | OSMetaClassBase * target,\ |
| 1138 | Terminate_Handler func);\ |
| 1139 | \ |
| 1140 | typedef kern_return_t (*CopyProviderProperties_Handler)(OSMetaClassBase * target, IOService_CopyProviderProperties_Args);\ |
| 1141 | static kern_return_t\ |
| 1142 | CopyProviderProperties_Invoke(const IORPC rpc,\ |
| 1143 | OSMetaClassBase * target,\ |
| 1144 | CopyProviderProperties_Handler func);\ |
| 1145 | \ |
| 1146 | typedef kern_return_t (*RequireMaxBusStall_Handler)(OSMetaClassBase * target, IOService_RequireMaxBusStall_Args);\ |
| 1147 | static kern_return_t\ |
| 1148 | RequireMaxBusStall_Invoke(const IORPC rpc,\ |
| 1149 | OSMetaClassBase * target,\ |
| 1150 | RequireMaxBusStall_Handler func);\ |
| 1151 | \ |
| 1152 | typedef kern_return_t (*AdjustBusy_Handler)(OSMetaClassBase * target, IOService_AdjustBusy_Args);\ |
| 1153 | static kern_return_t\ |
| 1154 | AdjustBusy_Invoke(const IORPC rpc,\ |
| 1155 | OSMetaClassBase * target,\ |
| 1156 | AdjustBusy_Handler func);\ |
| 1157 | \ |
| 1158 | typedef kern_return_t (*GetBusyState_Handler)(OSMetaClassBase * target, IOService_GetBusyState_Args);\ |
| 1159 | static kern_return_t\ |
| 1160 | GetBusyState_Invoke(const IORPC rpc,\ |
| 1161 | OSMetaClassBase * target,\ |
| 1162 | GetBusyState_Handler func);\ |
| 1163 | \ |
| 1164 | typedef kern_return_t (*CoreAnalyticsSendEvent_Handler)(OSMetaClassBase * target, IOService_CoreAnalyticsSendEvent_Args);\ |
| 1165 | static kern_return_t\ |
| 1166 | CoreAnalyticsSendEvent_Invoke(const IORPC rpc,\ |
| 1167 | OSMetaClassBase * target,\ |
| 1168 | CoreAnalyticsSendEvent_Handler func);\ |
| 1169 | \ |
| 1170 | typedef IOReturn (*UpdateReport_Handler)(OSMetaClassBase * target, IOService_UpdateReport_Args);\ |
| 1171 | static kern_return_t\ |
| 1172 | UpdateReport_Invoke(const IORPC rpc,\ |
| 1173 | OSMetaClassBase * target,\ |
| 1174 | UpdateReport_Handler func);\ |
| 1175 | \ |
| 1176 | typedef IOReturn (*ConfigureReport_Handler)(OSMetaClassBase * target, IOService_ConfigureReport_Args);\ |
| 1177 | static kern_return_t\ |
| 1178 | ConfigureReport_Invoke(const IORPC rpc,\ |
| 1179 | OSMetaClassBase * target,\ |
| 1180 | ConfigureReport_Handler func);\ |
| 1181 | \ |
| 1182 | typedef IOReturn (*SetLegend_Handler)(OSMetaClassBase * target, IOService_SetLegend_Args);\ |
| 1183 | static kern_return_t\ |
| 1184 | SetLegend_Invoke(const IORPC rpc,\ |
| 1185 | OSMetaClassBase * target,\ |
| 1186 | SetLegend_Handler func);\ |
| 1187 | \ |
| 1188 | typedef kern_return_t (*CopyName_Handler)(OSMetaClassBase * target, IOService_CopyName_Args);\ |
| 1189 | static kern_return_t\ |
| 1190 | CopyName_Invoke(const IORPC rpc,\ |
| 1191 | OSMetaClassBase * target,\ |
| 1192 | CopyName_Handler func);\ |
| 1193 | \ |
| 1194 | typedef kern_return_t (*StringFromReturn_Handler)(OSMetaClassBase * target, IOService_StringFromReturn_Args);\ |
| 1195 | static kern_return_t\ |
| 1196 | StringFromReturn_Invoke(const IORPC rpc,\ |
| 1197 | OSMetaClassBase * target,\ |
| 1198 | StringFromReturn_Handler func);\ |
| 1199 | \ |
| 1200 | typedef kern_return_t (*_ClaimSystemWakeEvent_Handler)(OSMetaClassBase * target, IOService__ClaimSystemWakeEvent_Args);\ |
| 1201 | static kern_return_t\ |
| 1202 | _ClaimSystemWakeEvent_Invoke(const IORPC rpc,\ |
| 1203 | OSMetaClassBase * target,\ |
| 1204 | _ClaimSystemWakeEvent_Handler func);\ |
| 1205 | \ |
| 1206 | typedef kern_return_t (*UserSetProperties_Handler)(OSMetaClassBase * target, IOService_UserSetProperties_Args);\ |
| 1207 | static kern_return_t\ |
| 1208 | UserSetProperties_Invoke(const IORPC rpc,\ |
| 1209 | OSMetaClassBase * target,\ |
| 1210 | UserSetProperties_Handler func);\ |
| 1211 | \ |
| 1212 | typedef kern_return_t (*SendIOMessageServicePropertyChange_Handler)(OSMetaClassBase * targetIOService_SendIOMessageServicePropertyChange_Args);\ |
| 1213 | static kern_return_t\ |
| 1214 | SendIOMessageServicePropertyChange_Invoke(const IORPC rpc,\ |
| 1215 | OSMetaClassBase * target,\ |
| 1216 | SendIOMessageServicePropertyChange_Handler func);\ |
| 1217 | \ |
| 1218 | typedef kern_return_t (*RemoveProperty_Handler)(OSMetaClassBase * target, IOService_RemoveProperty_Args);\ |
| 1219 | static kern_return_t\ |
| 1220 | RemoveProperty_Invoke(const IORPC rpc,\ |
| 1221 | OSMetaClassBase * target,\ |
| 1222 | RemoveProperty_Handler func);\ |
| 1223 | \ |
| 1224 | typedef kern_return_t (*CopySystemStateNotificationService_Handler)(OSMetaClassBase * target, IOService_CopySystemStateNotificationService_Args);\ |
| 1225 | static kern_return_t\ |
| 1226 | CopySystemStateNotificationService_Invoke(const IORPC rpc,\ |
| 1227 | OSMetaClassBase * target,\ |
| 1228 | CopySystemStateNotificationService_Handler func);\ |
| 1229 | \ |
| 1230 | typedef kern_return_t (*StateNotificationItemCreate_Handler)(OSMetaClassBase * target, IOService_StateNotificationItemCreate_Args);\ |
| 1231 | static kern_return_t\ |
| 1232 | StateNotificationItemCreate_Invoke(const IORPC rpc,\ |
| 1233 | OSMetaClassBase * target,\ |
| 1234 | StateNotificationItemCreate_Handler func);\ |
| 1235 | \ |
| 1236 | typedef kern_return_t (*StateNotificationItemSet_Handler)(OSMetaClassBase * target, IOService_StateNotificationItemSet_Args);\ |
| 1237 | static kern_return_t\ |
| 1238 | StateNotificationItemSet_Invoke(const IORPC rpc,\ |
| 1239 | OSMetaClassBase * target,\ |
| 1240 | StateNotificationItemSet_Handler func);\ |
| 1241 | \ |
| 1242 | typedef kern_return_t (*StateNotificationItemCopy_Handler)(OSMetaClassBase * target, IOService_StateNotificationItemCopy_Args);\ |
| 1243 | static kern_return_t\ |
| 1244 | StateNotificationItemCopy_Invoke(const IORPC rpc,\ |
| 1245 | OSMetaClassBase * target,\ |
| 1246 | StateNotificationItemCopy_Handler func);\ |
| 1247 | \ |
| 1248 | typedef void (*Stop_async_Handler)(OSMetaClassBase * target, IOService_Stop_async_Args);\ |
| 1249 | static kern_return_t\ |
| 1250 | Stop_async_Invoke(const IORPC rpc,\ |
| 1251 | OSMetaClassBase * target,\ |
| 1252 | Stop_async_Handler func);\ |
| 1253 | \ |
| 1254 | typedef kern_return_t (*_NewUserClient_Handler)(OSMetaClassBase * target, IOService__NewUserClient_Args);\ |
| 1255 | static kern_return_t\ |
| 1256 | _NewUserClient_Invoke(const IORPC rpc,\ |
| 1257 | OSMetaClassBase * target,\ |
| 1258 | _NewUserClient_Handler func);\ |
| 1259 | \ |
| 1260 | |
| 1261 | |
| 1262 | #define IOService_KernelMethods \ |
| 1263 | \ |
| 1264 | protected:\ |
| 1265 | /* _Impl methods */\ |
| 1266 | \ |
| 1267 | kern_return_t\ |
| 1268 | ClientCrashed_Impl(IOService_ClientCrashed_Args);\ |
| 1269 | \ |
| 1270 | kern_return_t\ |
| 1271 | SetName_Impl(IOService_SetName_Args);\ |
| 1272 | \ |
| 1273 | kern_return_t\ |
| 1274 | RegisterService_Impl(IOService_RegisterService_Args);\ |
| 1275 | \ |
| 1276 | kern_return_t\ |
| 1277 | CopyDispatchQueue_Impl(OSObject_CopyDispatchQueue_Args);\ |
| 1278 | \ |
| 1279 | kern_return_t\ |
| 1280 | CopyProperties_Impl(IOService_CopyProperties_Args);\ |
| 1281 | \ |
| 1282 | kern_return_t\ |
| 1283 | SearchProperty_Impl(IOService_SearchProperty_Args);\ |
| 1284 | \ |
| 1285 | kern_return_t\ |
| 1286 | SetProperties_Impl(IOService_SetProperties_Args);\ |
| 1287 | \ |
| 1288 | kern_return_t\ |
| 1289 | JoinPMTree_Impl(IOService_JoinPMTree_Args);\ |
| 1290 | \ |
| 1291 | kern_return_t\ |
| 1292 | ChangePowerState_Impl(IOService_ChangePowerState_Args);\ |
| 1293 | \ |
| 1294 | kern_return_t\ |
| 1295 | NewUserClient_Impl(IOService_NewUserClient_Args);\ |
| 1296 | \ |
| 1297 | kern_return_t\ |
| 1298 | Terminate_Impl(IOService_Terminate_Args);\ |
| 1299 | \ |
| 1300 | kern_return_t\ |
| 1301 | CopyProviderProperties_Impl(IOService_CopyProviderProperties_Args);\ |
| 1302 | \ |
| 1303 | kern_return_t\ |
| 1304 | RequireMaxBusStall_Impl(IOService_RequireMaxBusStall_Args);\ |
| 1305 | \ |
| 1306 | kern_return_t\ |
| 1307 | AdjustBusy_Impl(IOService_AdjustBusy_Args);\ |
| 1308 | \ |
| 1309 | kern_return_t\ |
| 1310 | GetBusyState_Impl(IOService_GetBusyState_Args);\ |
| 1311 | \ |
| 1312 | kern_return_t\ |
| 1313 | CoreAnalyticsSendEvent_Impl(IOService_CoreAnalyticsSendEvent_Args);\ |
| 1314 | \ |
| 1315 | IOReturn\ |
| 1316 | UpdateReport_Impl(IOService_UpdateReport_Args);\ |
| 1317 | \ |
| 1318 | IOReturn\ |
| 1319 | ConfigureReport_Impl(IOService_ConfigureReport_Args);\ |
| 1320 | \ |
| 1321 | IOReturn\ |
| 1322 | SetLegend_Impl(IOService_SetLegend_Args);\ |
| 1323 | \ |
| 1324 | kern_return_t\ |
| 1325 | CopyName_Impl(IOService_CopyName_Args);\ |
| 1326 | \ |
| 1327 | kern_return_t\ |
| 1328 | StringFromReturn_Impl(IOService_StringFromReturn_Args);\ |
| 1329 | \ |
| 1330 | kern_return_t\ |
| 1331 | _ClaimSystemWakeEvent_Impl(IOService__ClaimSystemWakeEvent_Args);\ |
| 1332 | \ |
| 1333 | kern_return_t\ |
| 1334 | SendIOMessageServicePropertyChange_Impl(IOService_SendIOMessageServicePropertyChange_Args);\ |
| 1335 | \ |
| 1336 | kern_return_t\ |
| 1337 | RemoveProperty_Impl(IOService_RemoveProperty_Args);\ |
| 1338 | \ |
| 1339 | kern_return_t\ |
| 1340 | CopySystemStateNotificationService_Impl(IOService_CopySystemStateNotificationService_Args);\ |
| 1341 | \ |
| 1342 | kern_return_t\ |
| 1343 | StateNotificationItemCreate_Impl(IOService_StateNotificationItemCreate_Args);\ |
| 1344 | \ |
| 1345 | kern_return_t\ |
| 1346 | StateNotificationItemSet_Impl(IOService_StateNotificationItemSet_Args);\ |
| 1347 | \ |
| 1348 | kern_return_t\ |
| 1349 | StateNotificationItemCopy_Impl(IOService_StateNotificationItemCopy_Args);\ |
| 1350 | \ |
| 1351 | |
| 1352 | |
| 1353 | #define IOService_VirtualMethods \ |
| 1354 | \ |
| 1355 | public:\ |
| 1356 | \ |
| 1357 | virtual bool\ |
| 1358 | init(\ |
| 1359 | ) APPLE_KEXT_OVERRIDE;\ |
| 1360 | \ |
| 1361 | virtual void\ |
| 1362 | free(\ |
| 1363 | ) APPLE_KEXT_OVERRIDE;\ |
| 1364 | \ |
| 1365 | |
| 1366 | |
| 1367 | #if !KERNEL |
| 1368 | |
| 1369 | extern OSMetaClass * gIOServiceMetaClass; |
| 1370 | extern const OSClassLoadInformation IOService_Class; |
| 1371 | |
| 1372 | class IOServiceMetaClass : public OSMetaClass |
| 1373 | { |
| 1374 | public: |
| 1375 | virtual kern_return_t |
| 1376 | New(OSObject * instance) override; |
| 1377 | virtual kern_return_t |
| 1378 | Dispatch(const IORPC rpc) override; |
| 1379 | }; |
| 1380 | |
| 1381 | #endif /* !KERNEL */ |
| 1382 | |
| 1383 | #if !KERNEL |
| 1384 | |
| 1385 | class IOServiceInterface : public OSInterface |
| 1386 | { |
| 1387 | public: |
| 1388 | }; |
| 1389 | |
| 1390 | struct IOService_IVars; |
| 1391 | struct IOService_LocalIVars; |
| 1392 | |
| 1393 | class IOService : public OSObject, public IOServiceInterface |
| 1394 | { |
| 1395 | #if !KERNEL |
| 1396 | friend class IOServiceMetaClass; |
| 1397 | #endif /* !KERNEL */ |
| 1398 | |
| 1399 | #if !KERNEL |
| 1400 | public: |
| 1401 | #ifdef IOService_DECLARE_IVARS |
| 1402 | IOService_DECLARE_IVARS |
| 1403 | #else /* IOService_DECLARE_IVARS */ |
| 1404 | union |
| 1405 | { |
| 1406 | IOService_IVars * ivars; |
| 1407 | IOService_LocalIVars * lvars; |
| 1408 | }; |
| 1409 | #endif /* IOService_DECLARE_IVARS */ |
| 1410 | #endif /* !KERNEL */ |
| 1411 | |
| 1412 | #if !KERNEL |
| 1413 | static OSMetaClass * |
| 1414 | sGetMetaClass() { return gIOServiceMetaClass; }; |
| 1415 | #endif /* KERNEL */ |
| 1416 | |
| 1417 | using super = OSObject; |
| 1418 | |
| 1419 | #if !KERNEL |
| 1420 | IOService_Methods |
| 1421 | IOService_VirtualMethods |
| 1422 | #endif /* !KERNEL */ |
| 1423 | |
| 1424 | }; |
| 1425 | #endif /* !KERNEL */ |
| 1426 | |
| 1427 | |
| 1428 | #endif /* !__DOCUMENTATION__ */ |
| 1429 | |
| 1430 | /* IOService.iig:553- */ |
| 1431 | |
| 1432 | #endif /* ! _IOKIT_UIOSERVICE_H */ |
| 1433 | |