diff --git a/third_party/IOKit/IOKitLib.h b/third_party/IOKit/IOKitLib.h
new file mode 100644
index 0000000000000..85ab4d99439e1
--- /dev/null
+++ b/third_party/IOKit/IOKitLib.h
@@ -0,0 +1,1580 @@
+/*
+ * Copyright (c) 1998-2014 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ *
+ * 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, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * @APPLE_LICENSE_HEADER_END@
+ */
+/*
+ * HISTORY
+ *
+ */
+
+/*
+ * IOKit user library
+ */
+
+#ifndef _IOKIT_IOKITLIB_H
+#define _IOKIT_IOKITLIB_H
+
+#ifdef KERNEL
+#error This file is not for kernel use
+#endif
+
+#include "third_party/IOKit/IOTypes.h"
+
+__BEGIN_DECLS
+
+/*! @header IOKitLib
+IOKitLib implements non-kernel task access to common IOKit object types - IORegistryEntry, IOService, IOIterator etc. These functions are generic - families may provide API that is more specific.
+IOKitLib represents IOKit objects outside the kernel with the types io_object_t, io_registry_entry_t, io_service_t, & io_connect_t. Function names usually begin with the type of object they are compatible with - eg. IOObjectRelease can be used with any io_object_t. Inside the kernel, the c++ class hierarchy allows the subclasses of each object type to receive the same requests from user level clients, for example in the kernel, IOService is a subclass of IORegistryEntry, which means any of the IORegistryEntryXXX functions in IOKitLib may be used with io_service_t's as well as io_registry_t's. There are functions available to introspect the class of the kernel object which any io_object_t et al. represents.
+IOKit objects returned by all functions should be released with IOObjectRelease.
+*/
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+typedef struct IONotificationPort * IONotificationPortRef;
+
+
+/*! @typedef IOServiceMatchingCallback
+ @abstract Callback function to be notified of IOService publication.
+ @param refcon The refcon passed when the notification was installed.
+ @param iterator The notification iterator which now has new objects.
+*/
+typedef void
+(*IOServiceMatchingCallback)(
+ void * refcon,
+ io_iterator_t iterator );
+
+/*! @typedef IOServiceInterestCallback
+ @abstract Callback function to be notified of changes in state of an IOService.
+ @param refcon The refcon passed when the notification was installed.
+ @param service The IOService whose state has changed.
+ @param messageType A messageType enum, defined by IOKit/IOMessage.h or by the IOService's family.
+ @param messageArgument An argument for the message, dependent on the messageType. If the message data is larger than sizeof(void*), then messageArgument contains a pointer to the message data; otherwise, messageArgument contains the message data.
+*/
+
+typedef void
+(*IOServiceInterestCallback)(
+ void * refcon,
+ io_service_t service,
+ uint32_t messageType,
+ void * messageArgument );
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*! @const kIOMasterPortDefault
+ @abstract The default mach port used to initiate communication with IOKit.
+ @discussion When specifying a master port to IOKit functions, the NULL argument indicates "use the default". This is a synonym for NULL, if you'd rather use a named constant.
+*/
+
+extern
+const mach_port_t kIOMasterPortDefault;
+
+/*! @function IOMasterPort
+ @abstract Returns the mach port used to initiate communication with IOKit.
+ @discussion Functions that don't specify an existing object require the IOKit master port to be passed. This function obtains that port.
+ @param bootstrapPort Pass MACH_PORT_NULL for the default.
+ @param masterPort The master port is returned.
+ @result A kern_return_t error code. */
+
+kern_return_t
+IOMasterPort( mach_port_t bootstrapPort,
+ mach_port_t * masterPort );
+
+
+/*! @function IONotificationPortCreate
+ @abstract Creates and returns a notification object for receiving IOKit notifications of new devices or state changes.
+ @discussion Creates the notification object to receive notifications from IOKit of new device arrivals or state changes. The notification object can be supply a CFRunLoopSource, or mach_port_t to be used to listen for events.
+ @param masterPort The master port obtained from IOMasterPort(). Pass kIOMasterPortDefault to look up the default master port.
+ @result A reference to the notification object. */
+
+IONotificationPortRef
+IONotificationPortCreate(
+ mach_port_t masterPort );
+
+/*! @function IONotificationPortDestroy
+ @abstract Destroys a notification object created with IONotificationPortCreate.
+ Also destroys any mach_port's or CFRunLoopSources obatined from
+ @link IONotificationPortGetRunLoopSource @/link
+ or @link IONotificationPortGetMachPort @/link
+ @param notify A reference to the notification object. */
+
+void
+IONotificationPortDestroy(
+ IONotificationPortRef notify );
+
+/*! @function IONotificationPortGetRunLoopSource
+ @abstract Returns a CFRunLoopSource to be used to listen for notifications.
+ @discussion A notification object may deliver notifications to a CFRunLoop
+ by adding the run loop source returned by this function to the run loop.
+
+ The caller should not release this CFRunLoopSource. Just call
+ @link IONotificationPortDestroy @/link to dispose of the
+ IONotificationPortRef and the CFRunLoopSource when done.
+ @param notify The notification object.
+ @result A CFRunLoopSourceRef for the notification object. */
+
+CFRunLoopSourceRef
+IONotificationPortGetRunLoopSource(
+ IONotificationPortRef notify );
+
+/*! @function IONotificationPortGetMachPort
+ @abstract Returns a mach_port to be used to listen for notifications.
+ @discussion A notification object may deliver notifications to a mach messaging client
+ if they listen for messages on the port obtained from this function.
+ Callbacks associated with the notifications may be delivered by calling
+ IODispatchCalloutFromMessage with messages received.
+
+ The caller should not release this mach_port_t. Just call
+ @link IONotificationPortDestroy @/link to dispose of the
+ mach_port_t and IONotificationPortRef when done.
+ @param notify The notification object.
+ @result A mach_port for the notification object. */
+
+mach_port_t
+IONotificationPortGetMachPort(
+ IONotificationPortRef notify );
+
+/*! @function IONotificationPortSetImportanceReceiver
+ @abstract Configure a notification port to be an importance receiver.
+ @discussion Sets the MACH_PORT_IMPORTANCE_RECEIVER attribute on the underlying mach port.
+ Importance-donating messages sent to a notification port with this
+ attribute enabled will boost the importance of the receiving process for the
+ duration of the notification handler.
+ @param notify The notification object.
+ @result A kern_return_t error code. */
+
+kern_return_t
+IONotificationPortSetImportanceReceiver(
+ IONotificationPortRef notify );
+
+/*! @function IONotificationPortSetDispatchQueue
+ @abstract Sets a dispatch queue to be used to listen for notifications.
+ @discussion A notification object may deliver notifications to a dispatch client.
+ @param notify The notification object.
+ @param queue A dispatch queue. */
+
+void
+IONotificationPortSetDispatchQueue(
+ IONotificationPortRef notify, dispatch_queue_t queue )
+__OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_4_3);
+
+/*! @function IODispatchCalloutFromMessage
+ @abstract Dispatches callback notifications from a mach message.
+ @discussion A notification object may deliver notifications to a mach messaging client,
+ which should call this function to generate the callbacks associated with the notifications arriving on the port.
+ @param unused Not used, set to zero.
+ @param msg A pointer to the message received.
+ @param reference Pass the IONotificationPortRef for the object. */
+
+void
+IODispatchCalloutFromMessage(
+ void *unused,
+ mach_msg_header_t *msg,
+ void *reference );
+
+/*! @function IOCreateReceivePort
+ @abstract Creates and returns a mach port suitable for receiving IOKit messages of the specified type.
+ @discussion In the future IOKit may use specialized messages and ports
+ instead of the standard ports created by mach_port_allocate(). Use this
+ function instead of mach_port_allocate() to ensure compatibility with future
+ revisions of IOKit.
+ @param msgType Type of message to be sent to this port
+ (kOSNotificationMessageID or kOSAsyncCompleteMessageID)
+ @param recvPort The created port is returned.
+ @result A kern_return_t error code. */
+
+kern_return_t
+IOCreateReceivePort( uint32_t msgType, mach_port_t * recvPort );
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * IOObject
+ */
+
+/*! @function IOObjectRelease
+ @abstract Releases an object handle previously returned by IOKitLib.
+ @discussion All objects returned by IOKitLib should be released with this function when access to them is no longer needed. Using the object after it has been released may or may not return an error, depending on how many references the task has to the same object in the kernel.
+ @param object The IOKit object to release.
+ @result A kern_return_t error code. */
+
+kern_return_t
+IOObjectRelease(
+ io_object_t object );
+
+/*! @function IOObjectRetain
+ @abstract Retains an object handle previously returned by IOKitLib.
+ @discussion Gives the caller an additional reference to an existing object handle previously returned by IOKitLib.
+ @param object The IOKit object to retain.
+ @result A kern_return_t error code. */
+
+kern_return_t
+IOObjectRetain(
+ io_object_t object );
+
+/*! @function IOObjectGetClass
+ @abstract Return the class name of an IOKit object.
+ @discussion This function uses the OSMetaClass system in the kernel to derive the name of the class the object is an instance of.
+ @param object The IOKit object.
+ @param className Caller allocated buffer to receive the name string.
+ @result A kern_return_t error code. */
+
+kern_return_t
+IOObjectGetClass(
+ io_object_t object,
+ io_name_t className );
+
+/*! @function IOObjectCopyClass
+ @abstract Return the class name of an IOKit object.
+ @discussion This function does the same thing as IOObjectGetClass, but returns the result as a CFStringRef.
+ @param object The IOKit object.
+ @result The resulting CFStringRef. This should be released by the caller. If a valid object is not passed in, then NULL is returned.*/
+
+CFStringRef
+IOObjectCopyClass(io_object_t object)
+AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+
+/*! @function IOObjectCopySuperclassForClass
+ @abstract Return the superclass name of the given class.
+ @discussion This function uses the OSMetaClass system in the kernel to derive the name of the superclass of the class.
+ @param classname The name of the class as a CFString.
+ @result The resulting CFStringRef. This should be released by the caller. If there is no superclass, or a valid class name is not passed in, then NULL is returned.*/
+
+CFStringRef
+IOObjectCopySuperclassForClass(CFStringRef classname)
+AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+
+/*! @function IOObjectCopyBundleIdentifierForClass
+ @abstract Return the bundle identifier of the given class.
+ @discussion This function uses the OSMetaClass system in the kernel to derive the name of the kmod, which is the same as the bundle identifier.
+ @param classname The name of the class as a CFString.
+ @result The resulting CFStringRef. This should be released by the caller. If a valid class name is not passed in, then NULL is returned.*/
+
+CFStringRef
+IOObjectCopyBundleIdentifierForClass(CFStringRef classname)
+AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER;
+
+/*! @function IOObjectConformsTo
+ @abstract Performs an OSDynamicCast operation on an IOKit object.
+ @discussion This function uses the OSMetaClass system in the kernel to determine if the object will dynamic cast to a class, specified as a C-string. In other words, if the object is of that class or a subclass.
+ @param object An IOKit object.
+ @param className The name of the class, as a C-string.
+ @result If the object handle is valid, and represents an object in the kernel that dynamic casts to the class true is returned, otherwise false. */
+
+boolean_t
+IOObjectConformsTo(
+ io_object_t object,
+ const io_name_t className );
+
+/*! @function IOObjectIsEqualTo
+ @abstract Checks two object handles to see if they represent the same kernel object.
+ @discussion If two object handles are returned by IOKitLib functions, this function will compare them to see if they represent the same kernel object.
+ @param object An IOKit object.
+ @param anObject Another IOKit object.
+ @result If both object handles are valid, and represent the same object in the kernel true is returned, otherwise false. */
+
+boolean_t
+IOObjectIsEqualTo(
+ io_object_t object,
+ io_object_t anObject );
+
+/*! @function IOObjectGetKernelRetainCount
+ @abstract Returns kernel retain count of an IOKit object.
+ @discussion This function may be used in diagnostics to determine the current retain count of the kernel object at the kernel level.
+ @param object An IOKit object.
+ @result If the object handle is valid, the kernel objects retain count is returned, otherwise zero is returned. */
+
+uint32_t
+IOObjectGetKernelRetainCount(
+ io_object_t object )
+AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER;
+
+/*! @function IOObjectGetUserRetainCount
+ @abstract Returns the retain count for the current process of an IOKit object.
+ @discussion This function may be used in diagnostics to determine the current retain count for the calling process of the kernel object.
+ @param object An IOKit object.
+ @result If the object handle is valid, the objects user retain count is returned, otherwise zero is returned. */
+
+uint32_t
+IOObjectGetUserRetainCount(
+ io_object_t object )
+AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER;
+
+/*! @function IOObjectGetRetainCount
+ @abstract Returns kernel retain count of an IOKit object. Identical to IOObjectGetKernelRetainCount() but available prior to Mac OS 10.6.
+ @discussion This function may be used in diagnostics to determine the current retain count of the kernel object at the kernel level.
+ @param object An IOKit object.
+ @result If the object handle is valid, the kernel objects retain count is returned, otherwise zero is returned. */
+
+uint32_t
+IOObjectGetRetainCount(
+ io_object_t object );
+
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * IOIterator, subclass of IOObject
+ */
+
+/*! @function IOIteratorNext
+ @abstract Returns the next object in an iteration.
+ @discussion This function returns the next object in an iteration, or zero if no more remain or the iterator is invalid.
+ @param iterator An IOKit iterator handle.
+ @result If the iterator handle is valid, the next element in the iteration is returned, otherwise zero is returned. The element should be released by the caller when it is finished. */
+
+io_object_t
+IOIteratorNext(
+ io_iterator_t iterator );
+
+/*! @function IOIteratorReset
+ @abstract Resets an iteration back to the beginning.
+ @discussion If an iterator is invalid, or if the caller wants to start over, IOIteratorReset will set the iteration back to the beginning.
+ @param iterator An IOKit iterator handle. */
+
+void
+IOIteratorReset(
+ io_iterator_t iterator );
+
+/*! @function IOIteratorIsValid
+ @abstract Checks an iterator is still valid.
+ @discussion Some iterators will be made invalid if changes are made to the structure they are iterating over. This function checks the iterator is still valid and should be called when IOIteratorNext returns zero. An invalid iterator can be reset and the iteration restarted.
+ @param iterator An IOKit iterator handle.
+ @result True if the iterator handle is valid, otherwise false is returned. */
+
+boolean_t
+IOIteratorIsValid(
+ io_iterator_t iterator );
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * IOService, subclass of IORegistryEntry
+ */
+
+/*!
+ @function IOServiceGetMatchingService
+ @abstract Look up a registered IOService object that matches a matching dictionary.
+ @discussion This is the preferred method of finding IOService objects currently registered by IOKit (that is, objects that have had their registerService() methods invoked). To find IOService objects that aren't yet registered, use an iterator as created by IORegistryEntryCreateIterator(). IOServiceAddMatchingNotification can also supply this information and install a notification of new IOServices. The matching information used in the matching dictionary may vary depending on the class of service being looked up.
+ @param masterPort The master port obtained from IOMasterPort(). Pass kIOMasterPortDefault to look up the default master port.
+ @param matching A CF dictionary containing matching information, of which one reference is always consumed by this function (Note prior to the Tiger release there was a small chance that the dictionary might not be released if there was an error attempting to serialize the dictionary). IOKitLib can construct matching dictionaries for common criteria with helper functions such as IOServiceMatching, IOServiceNameMatching, IOBSDNameMatching.
+ @result The first service matched is returned on success. The service must be released by the caller.
+ */
+
+io_service_t
+IOServiceGetMatchingService(
+ mach_port_t masterPort,
+ CFDictionaryRef matching CF_RELEASES_ARGUMENT);
+
+/*! @function IOServiceGetMatchingServices
+ @abstract Look up registered IOService objects that match a matching dictionary.
+ @discussion This is the preferred method of finding IOService objects currently registered by IOKit (that is, objects that have had their registerService() methods invoked). To find IOService objects that aren't yet registered, use an iterator as created by IORegistryEntryCreateIterator(). IOServiceAddMatchingNotification can also supply this information and install a notification of new IOServices. The matching information used in the matching dictionary may vary depending on the class of service being looked up.
+ @param masterPort The master port obtained from IOMasterPort(). Pass kIOMasterPortDefault to look up the default master port.
+ @param matching A CF dictionary containing matching information, of which one reference is always consumed by this function (Note prior to the Tiger release there was a small chance that the dictionary might not be released if there was an error attempting to serialize the dictionary). IOKitLib can construct matching dictionaries for common criteria with helper functions such as IOServiceMatching, IOServiceNameMatching, IOBSDNameMatching.
+ @param existing An iterator handle, or NULL, is returned on success, and should be released by the caller when the iteration is finished. If NULL is returned, the iteration was successful but found no matching services.
+ @result A kern_return_t error code. */
+
+kern_return_t
+IOServiceGetMatchingServices(
+ mach_port_t masterPort,
+ CFDictionaryRef matching CF_RELEASES_ARGUMENT,
+ io_iterator_t * existing );
+
+
+kern_return_t
+IOServiceAddNotification(
+ mach_port_t masterPort,
+ const io_name_t notificationType,
+ CFDictionaryRef matching,
+ mach_port_t wakePort,
+ uintptr_t reference,
+ io_iterator_t * notification ) DEPRECATED_ATTRIBUTE;
+
+/*! @function IOServiceAddMatchingNotification
+ @abstract Look up registered IOService objects that match a matching dictionary, and install a notification request of new IOServices that match.
+ @discussion This is the preferred method of finding IOService objects that may arrive at any time. The type of notification specifies the state change the caller is interested in, on IOService's that match the match dictionary. Notification types are identified by name, and are defined in IOKitKeys.h. The matching information used in the matching dictionary may vary depending on the class of service being looked up.
+ @param notifyPort A IONotificationPortRef object that controls how messages will be sent when the armed notification is fired. When the notification is delivered, the io_iterator_t representing the notification should be iterated through to pick up all outstanding objects. When the iteration is finished the notification is rearmed. See IONotificationPortCreate.
+ @param notificationType A notification type from IOKitKeys.h
+
kIOPublishNotification Delivered when an IOService is registered.
+
kIOFirstPublishNotification Delivered when an IOService is registered, but only once per IOService instance. Some IOService's may be reregistered when their state is changed.
+
kIOMatchedNotification Delivered when an IOService has had all matching drivers in the kernel probed and started.
+
kIOFirstMatchNotification Delivered when an IOService has had all matching drivers in the kernel probed and started, but only once per IOService instance. Some IOService's may be reregistered when their state is changed.
+
kIOTerminatedNotification Delivered after an IOService has been terminated.
+ @param matching A CF dictionary containing matching information, of which one reference is always consumed by this function (Note prior to the Tiger release there was a small chance that the dictionary might not be released if there was an error attempting to serialize the dictionary). IOKitLib can construct matching dictionaries for common criteria with helper functions such as IOServiceMatching, IOServiceNameMatching, IOBSDNameMatching.
+ @param callback A callback function called when the notification fires.
+ @param refCon A reference constant for the callbacks use.
+ @param notification An iterator handle is returned on success, and should be released by the caller when the notification is to be destroyed. The notification is armed when the iterator is emptied by calls to IOIteratorNext - when no more objects are returned, the notification is armed. Note the notification is not armed when first created.
+ @result A kern_return_t error code. */
+
+kern_return_t
+IOServiceAddMatchingNotification(
+ IONotificationPortRef notifyPort,
+ const io_name_t notificationType,
+ CFDictionaryRef matching CF_RELEASES_ARGUMENT,
+ IOServiceMatchingCallback callback,
+ void * refCon,
+ io_iterator_t * notification );
+
+/*! @function IOServiceAddInterestNotification
+ @abstract Register for notification of state changes in an IOService.
+ @discussion IOService objects deliver notifications of their state changes to their clients via the IOService::messageClients API, and to other interested parties including callers of this function. Message types are defined IOKit/IOMessage.h.
+ @param notifyPort A IONotificationPortRef object that controls how messages will be sent when the notification is fired. See IONotificationPortCreate.
+ @param interestType A notification type from IOKitKeys.h
+
kIOGeneralInterest General state changes delivered via the IOService::messageClients API.
+
kIOBusyInterest Delivered when the IOService changes its busy state to or from zero. The message argument contains the new busy state causing the notification.
+ @param callback A callback function called when the notification fires, with messageType and messageArgument for the state change.
+ @param refCon A reference constant for the callbacks use.
+ @param notification An object handle is returned on success, and should be released by the caller when the notification is to be destroyed.
+ @result A kern_return_t error code. */
+
+kern_return_t
+IOServiceAddInterestNotification(
+ IONotificationPortRef notifyPort,
+ io_service_t service,
+ const io_name_t interestType,
+ IOServiceInterestCallback callback,
+ void * refCon,
+ io_object_t * notification );
+
+/*! @function IOServiceMatchPropertyTable
+ @abstract Match an IOService objects with matching dictionary.
+ @discussion This function calls the matching method of an IOService object and returns the boolean result.
+ @param service The IOService object to match.
+ @param matching A CF dictionary containing matching information. IOKitLib can construct matching dictionaries for common criteria with helper functions such as IOServiceMatching, IOServiceNameMatching, IOBSDNameMatching.
+ @param matches The boolean result is returned.
+ @result A kern_return_t error code. */
+
+kern_return_t
+IOServiceMatchPropertyTable(
+ io_service_t service,
+ CFDictionaryRef matching,
+ boolean_t * matches );
+
+/*! @function IOServiceGetBusyState
+ @abstract Returns the busyState of an IOService.
+ @discussion Many activities in IOService are asynchronous. When registration, matching, or termination is in progress on an IOService, its busyState is increased by one. Change in busyState to or from zero also changes the IOService's provider's busyState by one, which means that an IOService is marked busy when any of the above activities is ocurring on it or any of its clients.
+ @param service The IOService whose busyState to return.
+ @param busyState The busyState count is returned.
+ @result A kern_return_t error code. */
+
+kern_return_t
+IOServiceGetBusyState(
+ io_service_t service,
+ uint32_t * busyState );
+
+/*! @function IOServiceWaitQuiet
+ @abstract Wait for an IOService's busyState to be zero.
+ @discussion Blocks the caller until an IOService is non busy, see IOServiceGetBusyState.
+ @param service The IOService wait on.
+ @param waitTime Specifies a maximum time to wait.
+ @result Returns an error code if mach synchronization primitives fail, kIOReturnTimeout, or kIOReturnSuccess. */
+
+kern_return_t
+IOServiceWaitQuiet(
+ io_service_t service,
+ mach_timespec_t * waitTime );
+
+/*! @function IOKitGetBusyState
+ @abstract Returns the busyState of all IOServices.
+ @discussion Many activities in IOService are asynchronous. When registration, matching, or termination is in progress on an IOService, its busyState is increased by one. Change in busyState to or from zero also changes the IOService's provider's busyState by one, which means that an IOService is marked busy when any of the above activities is ocurring on it or any of its clients. IOKitGetBusyState returns the busy state of the root of the service plane which reflects the busy state of all IOServices.
+ @param masterPort The master port obtained from IOMasterPort(). Pass kIOMasterPortDefault to look up the default master port.
+ @param busyState The busyState count is returned.
+ @result A kern_return_t error code. */
+
+kern_return_t
+IOKitGetBusyState(
+ mach_port_t masterPort,
+ uint32_t * busyState );
+
+/*! @function IOKitWaitQuiet
+ @abstract Wait for a all IOServices' busyState to be zero.
+ @discussion Blocks the caller until all IOServices are non busy, see IOKitGetBusyState.
+ @param masterPort The master port obtained from IOMasterPort(). Pass kIOMasterPortDefault to look up the default master port.
+ @param waitTime Specifies a maximum time to wait.
+ @result Returns an error code if mach synchronization primitives fail, kIOReturnTimeout, or kIOReturnSuccess. */
+
+kern_return_t
+IOKitWaitQuiet(
+ mach_port_t masterPort,
+ mach_timespec_t * waitTime );
+
+/*! @function IOServiceOpen
+ @abstract A request to create a connection to an IOService.
+ @discussion A non kernel client may request a connection be opened via the IOServiceOpen() library function, which will call IOService::newUserClient in the kernel. The rules & capabilities of user level clients are family dependent, the default IOService implementation returns kIOReturnUnsupported.
+ @param service The IOService object to open a connection to, usually obtained via the IOServiceGetMatchingServices or IOServiceAddNotification APIs.
+ @param owningTask The mach task requesting the connection.
+ @param type A constant specifying the type of connection to be created, interpreted only by the IOService's family.
+ @param connect An io_connect_t handle is returned on success, to be used with the IOConnectXXX APIs. It should be destroyed with IOServiceClose().
+ @result A return code generated by IOService::newUserClient. */
+
+kern_return_t
+IOServiceOpen(
+ io_service_t service,
+ task_port_t owningTask,
+ uint32_t type,
+ io_connect_t * connect );
+
+/*! @function IOServiceRequestProbe
+ @abstract A request to rescan a bus for device changes.
+ @discussion A non kernel client may request a bus or controller rescan for added or removed devices, if the bus family does automatically notice such changes. For example, SCSI bus controllers do not notice device changes. The implementation of this routine is family dependent, and the default IOService implementation returns kIOReturnUnsupported.
+ @param service The IOService object to request a rescan, usually obtained via the IOServiceGetMatchingServices or IOServiceAddNotification APIs.
+ @param options An options mask, interpreted only by the IOService's family.
+ @result A return code generated by IOService::requestProbe. */
+
+kern_return_t
+IOServiceRequestProbe(
+ io_service_t service,
+ uint32_t options );
+
+// options for IOServiceAuthorize()
+enum {
+ kIOServiceInteractionAllowed = 0x00000001
+};
+
+/*! @function IOServiceAuthorize
+ @abstract Authorize access to an IOService.
+ @discussion Determine whether this application is authorized to invoke IOServiceOpen() for a given IOService, either by confirming that it has been previously authorized by the user, or by soliciting the console user.
+ @param service The IOService object to be authorized, usually obtained via the IOServiceGetMatchingServices or IOServiceAddNotification APIs.
+ @param options kIOServiceInteractionAllowed may be set to permit user interaction, if required.
+ @result kIOReturnSuccess if the IOService is authorized, kIOReturnNotPermitted if the IOService is not authorized. */
+
+kern_return_t
+IOServiceAuthorize(
+ io_service_t service,
+ uint32_t options );
+
+int
+IOServiceOpenAsFileDescriptor(
+ io_service_t service,
+ int oflag );
+
+/* * * * * * * * * * * * * * *ff * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * IOService connection
+ */
+
+/*! @function IOServiceClose
+ @abstract Close a connection to an IOService and destroy the connect handle.
+ @discussion A connection created with the IOServiceOpen should be closed when the connection is no longer to be used with IOServiceClose.
+ @param connect The connect handle created by IOServiceOpen. It will be destroyed by this function, and should not be released with IOObjectRelease.
+ @result A kern_return_t error code. */
+
+kern_return_t
+IOServiceClose(
+ io_connect_t connect );
+
+/*! @function IOConnectAddRef
+ @abstract Adds a reference to the connect handle.
+ @discussion Adds a reference to the connect handle.
+ @param connect The connect handle created by IOServiceOpen.
+ @result A kern_return_t error code. */
+
+kern_return_t
+IOConnectAddRef(
+ io_connect_t connect );
+
+/*! @function IOConnectRelease
+ @abstract Remove a reference to the connect handle.
+ @discussion Removes a reference to the connect handle. If the last reference is removed an implicit IOServiceClose is performed.
+ @param connect The connect handle created by IOServiceOpen.
+ @result A kern_return_t error code. */
+
+kern_return_t
+IOConnectRelease(
+ io_connect_t connect );
+
+/*! @function IOConnectGetService
+ @abstract Returns the IOService a connect handle was opened on.
+ @discussion Finds the service object a connection was opened on.
+ @param connect The connect handle created by IOServiceOpen.
+ @param service On succes, the service handle the connection was opened on, which should be released with IOObjectRelease.
+ @result A kern_return_t error code. */
+
+kern_return_t
+IOConnectGetService(
+ io_connect_t connect,
+ io_service_t * service );
+
+/*! @function IOConnectSetNotificationPort
+ @abstract Set a port to receive family specific notifications.
+ @discussion This is a generic method to pass a mach port send right to be be used by family specific notifications.
+ @param connect The connect handle created by IOServiceOpen.
+ @param type The type of notification requested, not interpreted by IOKit and family defined.
+ @param port The port to which to send notifications.
+ @param reference Some families may support passing a reference parameter for the callers use with the notification.
+ @result A kern_return_t error code. */
+
+kern_return_t
+IOConnectSetNotificationPort(
+ io_connect_t connect,
+ uint32_t type,
+ mach_port_t port,
+ uintptr_t reference );
+
+/*! @function IOConnectMapMemory
+ @abstract Map hardware or shared memory into the caller's task.
+ @discussion This is a generic method to create a mapping in the callers task. The family will interpret the type parameter to determine what sort of mapping is being requested. Cache modes and placed mappings may be requested by the caller.
+ @param connect The connect handle created by IOServiceOpen.
+ @param memoryType What is being requested to be mapped, not interpreted by IOKit and family defined. The family may support physical hardware or shared memory mappings.
+ @param intoTask The task port for the task in which to create the mapping. This may be different to the task which the opened the connection.
+ @param atAddress An in/out parameter - if the kIOMapAnywhere option is not set, the caller should pass the address where it requests the mapping be created, otherwise nothing need to set on input. The address of the mapping created is passed back on sucess.
+ @param ofSize The size of the mapping created is passed back on success.
+ @result A kern_return_t error code. */
+
+#if !__LP64__ || defined(IOCONNECT_MAPMEMORY_10_6)
+
+kern_return_t
+IOConnectMapMemory(
+ io_connect_t connect,
+ uint32_t memoryType,
+ task_port_t intoTask,
+ vm_address_t *atAddress,
+ vm_size_t *ofSize,
+ IOOptionBits options );
+
+#else
+
+kern_return_t
+IOConnectMapMemory(
+ io_connect_t connect,
+ uint32_t memoryType,
+ task_port_t intoTask,
+ mach_vm_address_t *atAddress,
+ mach_vm_size_t *ofSize,
+ IOOptionBits options );
+
+#endif /* !__LP64__ || defined(IOCONNECT_MAPMEMORY_10_6) */
+
+
+/*! @function IOConnectMapMemory64
+ @abstract Map hardware or shared memory into the caller's task.
+ @discussion This is a generic method to create a mapping in the callers task. The family will interpret the type parameter to determine what sort of mapping is being requested. Cache modes and placed mappings may be requested by the caller.
+ @param connect The connect handle created by IOServiceOpen.
+ @param memoryType What is being requested to be mapped, not interpreted by IOKit and family defined. The family may support physical hardware or shared memory mappings.
+ @param intoTask The task port for the task in which to create the mapping. This may be different to the task which the opened the connection.
+ @param atAddress An in/out parameter - if the kIOMapAnywhere option is not set, the caller should pass the address where it requests the mapping be created, otherwise nothing need to set on input. The address of the mapping created is passed back on sucess.
+ @param ofSize The size of the mapping created is passed back on success.
+ @result A kern_return_t error code. */
+
+kern_return_t IOConnectMapMemory64(
+ io_connect_t connect,
+ uint32_t memoryType,
+ task_port_t intoTask,
+ mach_vm_address_t *atAddress,
+ mach_vm_size_t *ofSize,
+ IOOptionBits options );
+
+/*! @function IOConnectUnmapMemory
+ @abstract Remove a mapping made with IOConnectMapMemory.
+ @discussion This is a generic method to remove a mapping in the callers task.
+ @param connect The connect handle created by IOServiceOpen.
+ @param memoryType The memory type originally requested in IOConnectMapMemory.
+ @param fromTask The task port for the task in which to remove the mapping. This may be different to the task which the opened the connection.
+ @param atAddress The address of the mapping to be removed.
+ @result A kern_return_t error code. */
+
+#if !__LP64__ || defined(IOCONNECT_MAPMEMORY_10_6)
+
+kern_return_t
+IOConnectUnmapMemory(
+ io_connect_t connect,
+ uint32_t memoryType,
+ task_port_t fromTask,
+ vm_address_t atAddress );
+
+#else
+
+kern_return_t
+IOConnectUnmapMemory(
+ io_connect_t connect,
+ uint32_t memoryType,
+ task_port_t fromTask,
+ mach_vm_address_t atAddress );
+
+
+#endif /* !__LP64__ || defined(IOCONNECT_MAPMEMORY_10_6) */
+
+/*! @function IOConnectUnmapMemory64
+ @abstract Remove a mapping made with IOConnectMapMemory64.
+ @discussion This is a generic method to remove a mapping in the callers task.
+ @param connect The connect handle created by IOServiceOpen.
+ @param memoryType The memory type originally requested in IOConnectMapMemory.
+ @param fromTask The task port for the task in which to remove the mapping. This may be different to the task which the opened the connection.
+ @param atAddress The address of the mapping to be removed.
+ @result A kern_return_t error code. */
+
+kern_return_t IOConnectUnmapMemory64(
+ io_connect_t connect,
+ uint32_t memoryType,
+ task_port_t fromTask,
+ mach_vm_address_t atAddress );
+
+
+/*! @function IOConnectSetCFProperties
+ @abstract Set CF container based properties on a connection.
+ @discussion This is a generic method to pass a CF container of properties to the connection. The properties are interpreted by the family and commonly represent configuration settings, but may be interpreted as anything.
+ @param connect The connect handle created by IOServiceOpen.
+ @param properties A CF container - commonly a CFDictionary but this is not enforced. The container should consist of objects which are understood by IOKit - these are currently : CFDictionary, CFArray, CFSet, CFString, CFData, CFNumber, CFBoolean, and are passed in the kernel as the corresponding OSDictionary etc. objects.
+ @result A kern_return_t error code returned by the family. */
+
+kern_return_t
+IOConnectSetCFProperties(
+ io_connect_t connect,
+ CFTypeRef properties );
+
+/*! @function IOConnectSetCFProperty
+ @abstract Set a CF container based property on a connection.
+ @discussion This is a generic method to pass a CF property to the connection. The property is interpreted by the family and commonly represent configuration settings, but may be interpreted as anything.
+ @param connect The connect handle created by IOServiceOpen.
+ @param propertyName The name of the property as a CFString.
+ @param property A CF container - should consist of objects which are understood by IOKit - these are currently : CFDictionary, CFArray, CFSet, CFString, CFData, CFNumber, CFBoolean, and are passed in the kernel as the corresponding OSDictionary etc. objects.
+ @result A kern_return_t error code returned by the object. */
+
+kern_return_t
+IOConnectSetCFProperty(
+ io_connect_t connect,
+ CFStringRef propertyName,
+ CFTypeRef property );
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+// Combined LP64 & ILP32 Extended IOUserClient::externalMethod
+
+kern_return_t
+IOConnectCallMethod(
+ mach_port_t connection, // In
+ uint32_t selector, // In
+ const uint64_t *input, // In
+ uint32_t inputCnt, // In
+ const void *inputStruct, // In
+ size_t inputStructCnt, // In
+ uint64_t *output, // Out
+ uint32_t *outputCnt, // In/Out
+ void *outputStruct, // Out
+ size_t *outputStructCnt) // In/Out
+AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+kern_return_t
+IOConnectCallAsyncMethod(
+ mach_port_t connection, // In
+ uint32_t selector, // In
+ mach_port_t wake_port, // In
+ uint64_t *reference, // In
+ uint32_t referenceCnt, // In
+ const uint64_t *input, // In
+ uint32_t inputCnt, // In
+ const void *inputStruct, // In
+ size_t inputStructCnt, // In
+ uint64_t *output, // Out
+ uint32_t *outputCnt, // In/Out
+ void *outputStruct, // Out
+ size_t *outputStructCnt) // In/Out
+AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+kern_return_t
+IOConnectCallStructMethod(
+ mach_port_t connection, // In
+ uint32_t selector, // In
+ const void *inputStruct, // In
+ size_t inputStructCnt, // In
+ void *outputStruct, // Out
+ size_t *outputStructCnt) // In/Out
+AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+kern_return_t
+IOConnectCallAsyncStructMethod(
+ mach_port_t connection, // In
+ uint32_t selector, // In
+ mach_port_t wake_port, // In
+ uint64_t *reference, // In
+ uint32_t referenceCnt, // In
+ const void *inputStruct, // In
+ size_t inputStructCnt, // In
+ void *outputStruct, // Out
+ size_t *outputStructCnt) // In/Out
+AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+kern_return_t
+IOConnectCallScalarMethod(
+ mach_port_t connection, // In
+ uint32_t selector, // In
+ const uint64_t *input, // In
+ uint32_t inputCnt, // In
+ uint64_t *output, // Out
+ uint32_t *outputCnt) // In/Out
+AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+kern_return_t
+IOConnectCallAsyncScalarMethod(
+ mach_port_t connection, // In
+ uint32_t selector, // In
+ mach_port_t wake_port, // In
+ uint64_t *reference, // In
+ uint32_t referenceCnt, // In
+ const uint64_t *input, // In
+ uint32_t inputCnt, // In
+ uint64_t *output, // Out
+ uint32_t *outputCnt) // In/Out
+AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+kern_return_t
+IOConnectTrap0(io_connect_t connect,
+ uint32_t index );
+
+kern_return_t
+IOConnectTrap1(io_connect_t connect,
+ uint32_t index,
+ uintptr_t p1 );
+
+kern_return_t
+IOConnectTrap2(io_connect_t connect,
+ uint32_t index,
+ uintptr_t p1,
+ uintptr_t p2);
+
+kern_return_t
+IOConnectTrap3(io_connect_t connect,
+ uint32_t index,
+ uintptr_t p1,
+ uintptr_t p2,
+ uintptr_t p3);
+
+kern_return_t
+IOConnectTrap4(io_connect_t connect,
+ uint32_t index,
+ uintptr_t p1,
+ uintptr_t p2,
+ uintptr_t p3,
+ uintptr_t p4);
+
+kern_return_t
+IOConnectTrap5(io_connect_t connect,
+ uint32_t index,
+ uintptr_t p1,
+ uintptr_t p2,
+ uintptr_t p3,
+ uintptr_t p4,
+ uintptr_t p5);
+
+kern_return_t
+IOConnectTrap6(io_connect_t connect,
+ uint32_t index,
+ uintptr_t p1,
+ uintptr_t p2,
+ uintptr_t p3,
+ uintptr_t p4,
+ uintptr_t p5,
+ uintptr_t p6);
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*! @function IOConnectAddClient
+ @abstract Inform a connection of a second connection.
+ @discussion This is a generic method to inform a family connection of a second connection, and is rarely used.
+ @param connect The connect handle created by IOServiceOpen.
+ @param client Another connect handle created by IOServiceOpen.
+ @result A kern_return_t error code returned by the family. */
+
+kern_return_t
+IOConnectAddClient(
+ io_connect_t connect,
+ io_connect_t client );
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * IORegistry accessors
+ */
+
+/*! @function IORegistryGetRootEntry
+ @abstract Return a handle to the registry root.
+ @discussion This method provides an accessor to the root of the registry for the machine. The root may be passed to a registry iterator when iterating a plane, and contains properties that describe the available planes, and diagnostic information for IOKit.
+ @param masterPort The master port obtained from IOMasterPort(). Pass kIOMasterPortDefault to look up the default master port.
+ @result A handle to the IORegistryEntry root instance, to be released with IOObjectRelease by the caller, or MACH_PORT_NULL on failure. */
+
+io_registry_entry_t
+IORegistryGetRootEntry(
+ mach_port_t masterPort );
+
+/*! @function IORegistryEntryFromPath
+ @abstract Looks up a registry entry by path.
+ @discussion This function parses paths to lookup registry entries. The path should begin with ':' If there are characters remaining unparsed after an entry has been looked up, this is considered an invalid lookup. Paths are further documented in IORegistryEntry.h
+ @param masterPort The master port obtained from IOMasterPort(). Pass kIOMasterPortDefault to look up the default master port.
+ @param path A C-string path.
+ @result A handle to the IORegistryEntry witch was found with the path, to be released with IOObjectRelease by the caller, or MACH_PORT_NULL on failure. */
+
+io_registry_entry_t
+IORegistryEntryFromPath(
+ mach_port_t masterPort,
+ const io_string_t path );
+
+
+/*! @function IORegistryEntryFromPathCFString
+ @abstract Looks up a registry entry by path.
+ @discussion This function parses paths to lookup registry entries. The path should begin with ':' If there are characters remaining unparsed after an entry has been looked up, this is considered an invalid lookup. Paths are further documented in IORegistryEntry.h
+ @param masterPort The master port obtained from IOMasterPort(). Pass kIOMasterPortDefault to look up the default master port.
+ @param path A CFString path.
+ @result A handle to the IORegistryEntry witch was found with the path, to be released with IOObjectRelease by the caller, or MACH_PORT_NULL on failure. */
+
+io_registry_entry_t
+IORegistryEntryCopyFromPath(
+ mach_port_t masterPort,
+ CFStringRef path )
+#if defined(__MAC_10_11)
+__OSX_AVAILABLE_STARTING(__MAC_10_11, __IPHONE_9_0)
+#endif
+;
+
+// options for IORegistryCreateIterator(), IORegistryEntryCreateIterator, IORegistryEntrySearchCFProperty()
+enum {
+ kIORegistryIterateRecursively = 0x00000001,
+ kIORegistryIterateParents = 0x00000002
+};
+
+/*! @function IORegistryCreateIterator
+ @abstract Create an iterator rooted at the registry root.
+ @discussion This method creates an IORegistryIterator in the kernel that is set up with options to iterate children of the registry root entry, and to recurse automatically into entries as they are returned, or only when instructed with calls to IORegistryIteratorEnterEntry. The iterator object keeps track of entries that have been recursed into previously to avoid loops.
+ @param masterPort The master port obtained from IOMasterPort(). Pass kIOMasterPortDefault to look up the default master port.
+ @param plane The name of an existing registry plane. Plane names are defined in IOKitKeys.h, eg. kIOServicePlane.
+ @param options kIORegistryIterateRecursively may be set to recurse automatically into each entry as it is returned from IOIteratorNext calls on the registry iterator.
+ @param iterator A created iterator handle, to be released by the caller when it has finished with it.
+ @result A kern_return_t error code. */
+
+kern_return_t
+IORegistryCreateIterator(
+ mach_port_t masterPort,
+ const io_name_t plane,
+ IOOptionBits options,
+ io_iterator_t * iterator );
+
+/*! @function IORegistryEntryCreateIterator
+ @abstract Create an iterator rooted at a given registry entry.
+ @discussion This method creates an IORegistryIterator in the kernel that is set up with options to iterate children or parents of a root entry, and to recurse automatically into entries as they are returned, or only when instructed with calls to IORegistryIteratorEnterEntry. The iterator object keeps track of entries that have been recursed into previously to avoid loops.
+ @param entry The root entry to begin the iteration at.
+ @param plane The name of an existing registry plane. Plane names are defined in IOKitKeys.h, eg. kIOServicePlane.
+ @param options kIORegistryIterateRecursively may be set to recurse automatically into each entry as it is returned from IOIteratorNext calls on the registry iterator. kIORegistryIterateParents may be set to iterate the parents of each entry, by default the children are iterated.
+ @param iterator A created iterator handle, to be released by the caller when it has finished with it.
+ @result A kern_return_t error code. */
+
+kern_return_t
+IORegistryEntryCreateIterator(
+ io_registry_entry_t entry,
+ const io_name_t plane,
+ IOOptionBits options,
+ io_iterator_t * iterator );
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * IORegistryIterator, subclass of IOIterator
+ */
+
+/*! @function IORegistryIteratorEnterEntry
+ @abstract Recurse into the current entry in the registry iteration.
+ @discussion This method makes the current entry, ie. the last entry returned by IOIteratorNext, the root in a new level of recursion.
+ @result A kern_return_t error code. */
+
+kern_return_t
+IORegistryIteratorEnterEntry(
+ io_iterator_t iterator );
+
+/*! @function IORegistryIteratorExitEntry
+ @abstract Exits a level of recursion, restoring the current entry.
+ @discussion This method undoes an IORegistryIteratorEnterEntry, restoring the current entry. If there are no more levels of recursion to exit false is returned, otherwise true is returned.
+ @result kIOReturnSuccess if a level of recursion was undone, kIOReturnNoDevice if no recursive levels are left in the iteration. */
+
+kern_return_t
+IORegistryIteratorExitEntry(
+ io_iterator_t iterator );
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * IORegistryEntry, subclass of IOObject
+ */
+
+/*! @function IORegistryEntryGetName
+ @abstract Returns a C-string name assigned to a registry entry.
+ @discussion Registry entries can be named in a particular plane, or globally. This function returns the entry's global name. The global name defaults to the entry's meta class name if it has not been named.
+ @param entry The registry entry handle whose name to look up.
+ @param name The caller's buffer to receive the name.
+ @result A kern_return_t error code. */
+
+kern_return_t
+IORegistryEntryGetName(
+ io_registry_entry_t entry,
+ io_name_t name );
+
+/*! @function IORegistryEntryGetNameInPlane
+ @abstract Returns a C-string name assigned to a registry entry, in a specified plane.
+ @discussion Registry entries can be named in a particular plane, or globally. This function returns the entry's name in the specified plane or global name if it has not been named in that plane. The global name defaults to the entry's meta class name if it has not been named.
+ @param entry The registry entry handle whose name to look up.
+ @param plane The name of an existing registry plane. Plane names are defined in IOKitKeys.h, eg. kIOServicePlane.
+ @param name The caller's buffer to receive the name.
+ @result A kern_return_t error code. */
+
+kern_return_t
+IORegistryEntryGetNameInPlane(
+ io_registry_entry_t entry,
+ const io_name_t plane,
+ io_name_t name );
+
+/*! @function IORegistryEntryGetLocationInPlane
+ @abstract Returns a C-string location assigned to a registry entry, in a specified plane.
+ @discussion Registry entries can given a location string in a particular plane, or globally. If the entry has had a location set in the specified plane that location string will be returned, otherwise the global location string is returned. If no global location string has been set, an error is returned.
+ @param entry The registry entry handle whose name to look up.
+ @param plane The name of an existing registry plane. Plane names are defined in IOKitKeys.h, eg. kIOServicePlane.
+ @param location The caller's buffer to receive the location string.
+ @result A kern_return_t error code. */
+
+kern_return_t
+IORegistryEntryGetLocationInPlane(
+ io_registry_entry_t entry,
+ const io_name_t plane,
+ io_name_t location );
+
+/*! @function IORegistryEntryGetPath
+ @abstract Create a path for a registry entry.
+ @discussion The path for a registry entry is copied to the caller's buffer. The path describes the entry's attachment in a particular plane, which must be specified. The path begins with the plane name followed by a colon, and then followed by '/' separated path components for each of the entries between the root and the registry entry. An alias may also exist for the entry, and will be returned if available.
+ @param entry The registry entry handle whose path to look up.
+ @param plane The name of an existing registry plane. Plane names are defined in IOKitKeys.h, eg. kIOServicePlane.
+ @param path A char buffer allocated by the caller.
+ @result IORegistryEntryGetPath will fail if the entry is not attached in the plane, or if the buffer is not large enough to contain the path. */
+
+kern_return_t
+IORegistryEntryGetPath(
+ io_registry_entry_t entry,
+ const io_name_t plane,
+ io_string_t path );
+
+/*! @function IORegistryEntryCopyPath
+ @abstract Create a path for a registry entry.
+ @discussion The path for a registry entry is returned as a CFString The path describes the entry's attachment in a particular plane, which must be specified. The path begins with the plane name followed by a colon, and then followed by '/' separated path components for each of the entries between the root and the registry entry. An alias may also exist for the entry, and will be returned if available.
+ @param entry The registry entry handle whose path to look up.
+ @param plane The name of an existing registry plane. Plane names are defined in IOKitKeys.h, eg. kIOServicePlane.
+ @result An instance of CFString on success, to be released by the caller. IORegistryEntryCopyPath will fail if the entry is not attached in the plane. */
+
+CFStringRef
+IORegistryEntryCopyPath(
+ io_registry_entry_t entry,
+ const io_name_t plane)
+#if defined(__MAC_10_11)
+__OSX_AVAILABLE_STARTING(__MAC_10_11, __IPHONE_9_0)
+#endif
+;
+
+/*! @function IORegistryEntryGetRegistryEntryID
+ @abstract Returns an ID for the registry entry that is global to all tasks.
+ @discussion The entry ID returned by IORegistryEntryGetRegistryEntryID can be used to identify a registry entry across all tasks. A registry entry may be looked up by its entryID by creating a matching dictionary with IORegistryEntryIDMatching() to be used with the IOKit matching functions. The ID is valid only until the machine reboots.
+ @param entry The registry entry handle whose ID to look up.
+ @param entryID The resulting ID.
+ @result A kern_return_t error code. */
+
+kern_return_t
+IORegistryEntryGetRegistryEntryID(
+ io_registry_entry_t entry,
+ uint64_t * entryID );
+
+/*! @function IORegistryEntryCreateCFProperties
+ @abstract Create a CF dictionary representation of a registry entry's property table.
+ @discussion This function creates an instantaneous snapshot of a registry entry's property table, creating a CFDictionary analogue in the caller's task. Not every object available in the kernel is represented as a CF container; currently OSDictionary, OSArray, OSSet, OSSymbol, OSString, OSData, OSNumber, OSBoolean are created as their CF counterparts.
+ @param entry The registry entry handle whose property table to copy.
+ @param properties A CFDictionary is created and returned the caller on success. The caller should release with CFRelease.
+ @param allocator The CF allocator to use when creating the CF containers.
+ @param options No options are currently defined.
+ @result A kern_return_t error code. */
+
+kern_return_t
+IORegistryEntryCreateCFProperties(
+ io_registry_entry_t entry,
+ CFMutableDictionaryRef * properties,
+ CFAllocatorRef allocator,
+ IOOptionBits options );
+
+/*! @function IORegistryEntryCreateCFProperty
+ @abstract Create a CF representation of a registry entry's property.
+ @discussion This function creates an instantaneous snapshot of a registry entry property, creating a CF container analogue in the caller's task. Not every object available in the kernel is represented as a CF container; currently OSDictionary, OSArray, OSSet, OSSymbol, OSString, OSData, OSNumber, OSBoolean are created as their CF counterparts.
+ @param entry The registry entry handle whose property to copy.
+ @param key A CFString specifying the property name.
+ @param allocator The CF allocator to use when creating the CF container.
+ @param options No options are currently defined.
+ @result A CF container is created and returned the caller on success. The caller should release with CFRelease. */
+
+CFTypeRef
+IORegistryEntryCreateCFProperty(
+ io_registry_entry_t entry,
+ CFStringRef key,
+ CFAllocatorRef allocator,
+ IOOptionBits options );
+
+/*! @function IORegistryEntrySearchCFProperty
+ @abstract Create a CF representation of a registry entry's property.
+ @discussion This function creates an instantaneous snapshot of a registry entry property, creating a CF container analogue in the caller's task. Not every object available in the kernel is represented as a CF container; currently OSDictionary, OSArray, OSSet, OSSymbol, OSString, OSData, OSNumber, OSBoolean are created as their CF counterparts.
+This function will search for a property, starting first with specified registry entry's property table, then iterating recusively through either the parent registry entries or the child registry entries of this entry. Once the first occurrence is found, it will lookup and return the value of the property, using the same semantics as IORegistryEntryCreateCFProperty. The iteration keeps track of entries that have been recursed into previously to avoid loops.
+ @param entry The registry entry at which to start the search.
+ @param plane The name of an existing registry plane. Plane names are defined in IOKitKeys.h, eg. kIOServicePlane.
+ @param key A CFString specifying the property name.
+ @param allocator The CF allocator to use when creating the CF container.
+ @param options kIORegistryIterateRecursively may be set to recurse automatically into the registry hierarchy. Without this option, this method degenerates into the standard IORegistryEntryCreateCFProperty() call. kIORegistryIterateParents may be set to iterate the parents of the entry, in place of the children.
+ @result A CF container is created and returned the caller on success. The caller should release with CFRelease. */
+
+CFTypeRef
+IORegistryEntrySearchCFProperty(
+ io_registry_entry_t entry,
+ const io_name_t plane,
+ CFStringRef key,
+ CFAllocatorRef allocator,
+ IOOptionBits options ) CF_RETURNS_RETAINED;
+
+/* @function IORegistryEntryGetProperty - deprecated,
+ use IORegistryEntryCreateCFProperty */
+
+kern_return_t
+IORegistryEntryGetProperty(
+ io_registry_entry_t entry,
+ const io_name_t propertyName,
+ io_struct_inband_t buffer,
+ uint32_t * size );
+
+/*! @function IORegistryEntrySetCFProperties
+ @abstract Set CF container based properties in a registry entry.
+ @discussion This is a generic method to pass a CF container of properties to an object in the registry. Setting properties in a registry entry is not generally supported, it is more common to support IOConnectSetCFProperties for connection based property setting. The properties are interpreted by the object.
+ @param entry The registry entry whose properties to set.
+ @param properties A CF container - commonly a CFDictionary but this is not enforced. The container should consist of objects which are understood by IOKit - these are currently : CFDictionary, CFArray, CFSet, CFString, CFData, CFNumber, CFBoolean, and are passed in the kernel as the corresponding OSDictionary etc. objects.
+ @result A kern_return_t error code returned by the object. */
+
+kern_return_t
+IORegistryEntrySetCFProperties(
+ io_registry_entry_t entry,
+ CFTypeRef properties );
+
+/*! @function IORegistryEntrySetCFProperty
+ @abstract Set a CF container based property in a registry entry.
+ @discussion This is a generic method to pass a CF container as a property to an object in the registry. Setting properties in a registry entry is not generally supported, it is more common to support IOConnectSetCFProperty for connection based property setting. The property is interpreted by the object.
+ @param entry The registry entry whose property to set.
+ @param propertyName The name of the property as a CFString.
+ @param property A CF container - should consist of objects which are understood by IOKit - these are currently : CFDictionary, CFArray, CFSet, CFString, CFData, CFNumber, CFBoolean, and are passed in the kernel as the corresponding OSDictionary etc. objects.
+ @result A kern_return_t error code returned by the object. */
+
+kern_return_t
+IORegistryEntrySetCFProperty(
+ io_registry_entry_t entry,
+ CFStringRef propertyName,
+ CFTypeRef property );
+
+/*! @function IORegistryEntryGetChildIterator
+ @abstract Returns an iterator over an registry entry's child entries in a plane.
+ @discussion This method creates an iterator which will return each of a registry entry's child entries in a specified plane.
+ @param entry The registry entry whose children to iterate over.
+ @param plane The name of an existing registry plane. Plane names are defined in IOKitKeys.h, eg. kIOServicePlane.
+ @param iterator The created iterator over the children of the entry, on success. The iterator must be released when the iteration is finished.
+ @result A kern_return_t error code. */
+
+kern_return_t
+IORegistryEntryGetChildIterator(
+ io_registry_entry_t entry,
+ const io_name_t plane,
+ io_iterator_t * iterator );
+
+/*! @function IORegistryEntryGetChildEntry
+ @abstract Returns the first child of a registry entry in a plane.
+ @discussion This function will return the child which first attached to a registry entry in a plane.
+ @param entry The registry entry whose child to look up.
+ @param plane The name of an existing registry plane. Plane names are defined in IOKitKeys.h, eg. kIOServicePlane.
+ @param child The first child of the registry entry, on success. The child must be released by the caller.
+ @result A kern_return_t error code. */
+
+kern_return_t
+IORegistryEntryGetChildEntry(
+ io_registry_entry_t entry,
+ const io_name_t plane,
+ io_registry_entry_t * child );
+
+/*! @function IORegistryEntryGetParentIterator
+ @abstract Returns an iterator over an registry entry's parent entries in a plane.
+ @discussion This method creates an iterator which will return each of a registry entry's parent entries in a specified plane.
+ @param entry The registry entry whose parents to iterate over.
+ @param plane The name of an existing registry plane. Plane names are defined in IOKitKeys.h, eg. kIOServicePlane.
+ @param iterator The created iterator over the parents of the entry, on success. The iterator must be released when the iteration is finished.
+ @result A kern_return_t error. */
+
+kern_return_t
+IORegistryEntryGetParentIterator(
+ io_registry_entry_t entry,
+ const io_name_t plane,
+ io_iterator_t * iterator );
+
+/*! @function IORegistryEntryGetParentEntry
+ @abstract Returns the first parent of a registry entry in a plane.
+ @discussion This function will return the parent to which the registry entry was first attached in a plane.
+ @param entry The registry entry whose parent to look up.
+ @param plane The name of an existing registry plane. Plane names are defined in IOKitKeys.h, eg. kIOServicePlane.
+ @param parent The first parent of the registry entry, on success. The parent must be released by the caller.
+ @result A kern_return_t error code. */
+
+kern_return_t
+IORegistryEntryGetParentEntry(
+ io_registry_entry_t entry,
+ const io_name_t plane,
+ io_registry_entry_t * parent );
+
+/*! @function IORegistryEntryInPlane
+ @abstract Determines if the registry entry is attached in a plane.
+ @discussion This method determines if the entry is attached in a plane to any other entry.
+ @param entry The registry entry.
+ @param plane The name of an existing registry plane. Plane names are defined in IOKitKeys.h, eg. kIOServicePlane.
+ @result If the entry has a parent in the plane, true is returned, otherwise false is returned. */
+
+boolean_t
+IORegistryEntryInPlane(
+ io_registry_entry_t entry,
+ const io_name_t plane );
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Matching dictionary creation helpers
+ */
+
+/*! @function IOServiceMatching
+ @abstract Create a matching dictionary that specifies an IOService class match.
+ @discussion A very common matching criteria for IOService is based on its class. IOServiceMatching will create a matching dictionary that specifies any IOService of a class, or its subclasses. The class is specified by C-string name.
+ @param name The class name, as a const C-string. Class matching is successful on IOService's of this class or any subclass.
+ @result The matching dictionary created, is returned on success, or zero on failure. The dictionary is commonly passed to IOServiceGetMatchingServices or IOServiceAddNotification which will consume a reference, otherwise it should be released with CFRelease by the caller. */
+
+CFMutableDictionaryRef
+IOServiceMatching(
+ const char * name ) CF_RETURNS_RETAINED;
+
+/*! @function IOServiceNameMatching
+ @abstract Create a matching dictionary that specifies an IOService name match.
+ @discussion A common matching criteria for IOService is based on its name. IOServiceNameMatching will create a matching dictionary that specifies an IOService with a given name. Some IOServices created from the device tree will perform name matching on the standard compatible, name, model properties.
+ @param name The IOService name, as a const C-string.
+ @result The matching dictionary created, is returned on success, or zero on failure. The dictionary is commonly passed to IOServiceGetMatchingServices or IOServiceAddNotification which will consume a reference, otherwise it should be released with CFRelease by the caller. */
+
+CFMutableDictionaryRef
+IOServiceNameMatching(
+ const char * name ) CF_RETURNS_RETAINED;
+
+/*! @function IOBSDNameMatching
+ @abstract Create a matching dictionary that specifies an IOService match based on BSD device name.
+ @discussion IOServices that represent BSD devices have an associated BSD name. This function creates a matching dictionary that will match IOService's with a given BSD name.
+ @param masterPort The master port obtained from IOMasterPort(). Pass kIOMasterPortDefault to look up the default master port.
+ @param options No options are currently defined.
+ @param bsdName The BSD name, as a const char *.
+ @result The matching dictionary created, is returned on success, or zero on failure. The dictionary is commonly passed to IOServiceGetMatchingServices or IOServiceAddNotification which will consume a reference, otherwise it should be released with CFRelease by the caller. */
+
+CFMutableDictionaryRef
+IOBSDNameMatching(
+ mach_port_t masterPort,
+ uint32_t options,
+ const char * bsdName ) CF_RETURNS_RETAINED;
+
+CFMutableDictionaryRef
+IOOpenFirmwarePathMatching(
+ mach_port_t masterPort,
+ uint32_t options,
+ const char * path ) DEPRECATED_ATTRIBUTE;
+
+/*! @function IORegistryEntryIDMatching
+ @abstract Create a matching dictionary that specifies an IOService match based on a registry entry ID.
+ @discussion This function creates a matching dictionary that will match a registered, active IOService found with the given registry entry ID. The entry ID for a registry entry is returned by IORegistryEntryGetRegistryEntryID().
+ @param entryID The registry entry ID to be found.
+ @result The matching dictionary created, is returned on success, or zero on failure. The dictionary is commonly passed to IOServiceGetMatchingServices or IOServiceAddNotification which will consume a reference, otherwise it should be released with CFRelease by the caller. */
+
+CFMutableDictionaryRef
+IORegistryEntryIDMatching(
+ uint64_t entryID ) CF_RETURNS_RETAINED;
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+kern_return_t
+IOServiceOFPathToBSDName(mach_port_t masterPort,
+ const io_name_t openFirmwarePath,
+ io_name_t bsdName) DEPRECATED_ATTRIBUTE;
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*! @typedef IOAsyncCallback0
+ @abstract standard callback function for asynchronous I/O requests with
+ no extra arguments beyond a refcon and result code.
+ @param refcon The refcon passed into the original I/O request
+ @param result The result of the I/O operation
+*/
+typedef void (*IOAsyncCallback0)(void *refcon, IOReturn result);
+
+/*! @typedef IOAsyncCallback1
+ @abstract standard callback function for asynchronous I/O requests with
+ one extra argument beyond a refcon and result code.
+ This is often a count of the number of bytes transferred
+ @param refcon The refcon passed into the original I/O request
+ @param result The result of the I/O operation
+ @param arg0 Extra argument
+*/
+typedef void (*IOAsyncCallback1)(void *refcon, IOReturn result, void *arg0);
+
+/*! @typedef IOAsyncCallback2
+ @abstract standard callback function for asynchronous I/O requests with
+ two extra arguments beyond a refcon and result code.
+ @param refcon The refcon passed into the original I/O request
+ @param result The result of the I/O operation
+ @param arg0 Extra argument
+ @param arg1 Extra argument
+*/
+typedef void (*IOAsyncCallback2)(void *refcon, IOReturn result, void *arg0, void *arg1);
+
+/*! @typedef IOAsyncCallback
+ @abstract standard callback function for asynchronous I/O requests with
+ lots of extra arguments beyond a refcon and result code.
+ @param refcon The refcon passed into the original I/O request
+ @param result The result of the I/O operation
+ @param args Array of extra arguments
+ @param numArgs Number of extra arguments
+*/
+typedef void (*IOAsyncCallback)(void *refcon, IOReturn result, void **args,
+ uint32_t numArgs);
+
+
+/* Internal use */
+
+kern_return_t
+OSGetNotificationFromMessage(
+ mach_msg_header_t * msg,
+ uint32_t index,
+ uint32_t * type,
+ uintptr_t * reference,
+ void ** content,
+ vm_size_t * size );
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* Internal use */
+
+kern_return_t
+IOCatalogueSendData(
+ mach_port_t masterPort,
+ uint32_t flag,
+ const char *buffer,
+ uint32_t size );
+
+kern_return_t
+IOCatalogueTerminate(
+ mach_port_t masterPort,
+ uint32_t flag,
+ io_name_t description );
+
+kern_return_t
+IOCatalogueGetData(
+ mach_port_t masterPort,
+ uint32_t flag,
+ char **buffer,
+ uint32_t *size );
+
+kern_return_t
+IOCatalogueModuleLoaded(
+ mach_port_t masterPort,
+ io_name_t name );
+
+/* Use IOCatalogueSendData(), with kIOCatalogResetDrivers, to replace catalogue
+ * rather than emptying it. Doing so keeps instance counts down by uniquing
+ * existing personalities.
+ */
+kern_return_t
+IOCatalogueReset(
+ mach_port_t masterPort,
+ uint32_t flag );
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+// obsolete API
+
+#if !defined(__LP64__)
+
+// for Power Mgt
+
+typedef struct IOObject IOObject;
+
+// for MacOS.app
+
+kern_return_t
+IORegistryDisposeEnumerator(
+ io_enumerator_t enumerator ) DEPRECATED_ATTRIBUTE;
+
+kern_return_t
+IOMapMemory(
+ io_connect_t connect,
+ uint32_t memoryType,
+ task_port_t intoTask,
+ vm_address_t * atAddress,
+ vm_size_t * ofSize,
+ uint32_t flags ) DEPRECATED_ATTRIBUTE;
+
+// for CGS
+
+kern_return_t
+IOCompatibiltyNumber(
+ mach_port_t connect,
+ uint32_t * objectNumber ) DEPRECATED_ATTRIBUTE;
+
+// Traditional IOUserClient transport routines
+kern_return_t
+IOConnectMethodScalarIScalarO(
+ io_connect_t connect,
+ uint32_t index,
+ IOItemCount scalarInputCount,
+ IOItemCount scalarOutputCount,
+ ... ) AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;
+
+kern_return_t
+IOConnectMethodScalarIStructureO(
+ io_connect_t connect,
+ uint32_t index,
+ IOItemCount scalarInputCount,
+ IOByteCount * structureSize,
+ ... ) AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;
+
+kern_return_t
+IOConnectMethodScalarIStructureI(
+ io_connect_t connect,
+ uint32_t index,
+ IOItemCount scalarInputCount,
+ IOByteCount structureSize,
+ ... ) AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;
+
+kern_return_t
+IOConnectMethodStructureIStructureO(
+ io_connect_t connect,
+ uint32_t index,
+ IOItemCount structureInputSize,
+ IOByteCount * structureOutputSize,
+ void * inputStructure,
+ void * ouputStructure ) AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_5;
+
+// Compatability with earlier Mig interface routines
+#if IOCONNECT_NO_32B_METHODS
+
+kern_return_t
+io_connect_map_memory(
+ io_connect_t connect,
+ uint32_t memoryType,
+ task_port_t intoTask,
+ vm_address_t *atAddress,
+ vm_size_t *ofSize,
+ IOOptionBits options) DEPRECATED_ATTRIBUTE;
+
+kern_return_t
+io_connect_unmap_memory(
+ io_connect_t connect,
+ uint32_t memoryType,
+ task_port_t fromTask,
+ vm_address_t atAddress) DEPRECATED_ATTRIBUTE;
+
+kern_return_t
+io_connect_method_scalarI_scalarO(
+ mach_port_t connection,
+ int selector,
+ io_scalar_inband_t input,
+ mach_msg_type_number_t inputCnt,
+ io_scalar_inband_t output,
+ mach_msg_type_number_t *outputCnt) DEPRECATED_ATTRIBUTE;
+
+kern_return_t
+io_connect_method_scalarI_structureO(
+ mach_port_t connection,
+ int selector,
+ io_scalar_inband_t input,
+ mach_msg_type_number_t inputCnt,
+ io_struct_inband_t output,
+ mach_msg_type_number_t *outputCnt) DEPRECATED_ATTRIBUTE;
+
+kern_return_t
+io_connect_method_scalarI_structureI(
+ mach_port_t connection,
+ int selector,
+ io_scalar_inband_t input,
+ mach_msg_type_number_t inputCnt,
+ io_struct_inband_t inputStruct,
+ mach_msg_type_number_t inputStructCnt) DEPRECATED_ATTRIBUTE;
+
+kern_return_t
+io_connect_method_structureI_structureO(
+ mach_port_t connection,
+ int selector,
+ io_struct_inband_t input,
+ mach_msg_type_number_t inputCnt,
+ io_struct_inband_t output,
+ mach_msg_type_number_t *outputCnt) DEPRECATED_ATTRIBUTE;
+
+kern_return_t
+io_async_method_scalarI_scalarO(
+ mach_port_t connection,
+ mach_port_t wake_port,
+ io_async_ref_t reference,
+ mach_msg_type_number_t referenceCnt,
+ int selector,
+ io_scalar_inband_t input,
+ mach_msg_type_number_t inputCnt,
+ io_scalar_inband_t output,
+ mach_msg_type_number_t *outputCnt) DEPRECATED_ATTRIBUTE;
+
+kern_return_t
+io_async_method_scalarI_structureO(
+ mach_port_t connection,
+ mach_port_t wake_port,
+ io_async_ref_t reference,
+ mach_msg_type_number_t referenceCnt,
+ int selector,
+ io_scalar_inband_t input,
+ mach_msg_type_number_t inputCnt,
+ io_struct_inband_t output,
+ mach_msg_type_number_t *outputCnt) DEPRECATED_ATTRIBUTE;
+
+kern_return_t
+io_async_method_scalarI_structureI(
+ mach_port_t connection,
+ mach_port_t wake_port,
+ io_async_ref_t reference,
+ mach_msg_type_number_t referenceCnt,
+ int selector,
+ io_scalar_inband_t input,
+ mach_msg_type_number_t inputCnt,
+ io_struct_inband_t inputStruct,
+ mach_msg_type_number_t inputStructCnt) DEPRECATED_ATTRIBUTE;
+
+kern_return_t
+io_async_method_structureI_structureO(
+ mach_port_t connection,
+ mach_port_t wake_port,
+ io_async_ref_t reference,
+ mach_msg_type_number_t referenceCnt,
+ int selector,
+ io_struct_inband_t input,
+ mach_msg_type_number_t inputCnt,
+ io_struct_inband_t output,
+ mach_msg_type_number_t *outputCnt) DEPRECATED_ATTRIBUTE;
+#endif // IOCONNECT_NO_32B_METHODS
+
+#endif /* defined(__LP64__) */
+
+__END_DECLS
+
+#endif /* ! _IOKIT_IOKITLIB_H */
diff --git a/third_party/IOKit/IOReturn.h b/third_party/IOKit/IOReturn.h
new file mode 100644
index 0000000000000..f0c0d2e698e84
--- /dev/null
+++ b/third_party/IOKit/IOReturn.h
@@ -0,0 +1,158 @@
+/*
+ * Copyright (c) 1998-2002 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ *
+ * 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. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ *
+ * 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, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+/*
+ * HISTORY
+ */
+
+/*
+ * Core IOReturn values. Others may be family defined.
+ */
+
+#ifndef __IOKIT_IORETURN_H
+#define __IOKIT_IORETURN_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#include
+
+
+typedef kern_return_t IOReturn;
+
+#ifndef sys_iokit
+#define sys_iokit err_system(0x38)
+#endif /* sys_iokit */
+#define sub_iokit_common err_sub(0)
+#define sub_iokit_usb err_sub(1)
+#define sub_iokit_firewire err_sub(2)
+#define sub_iokit_block_storage err_sub(4)
+#define sub_iokit_graphics err_sub(5)
+#define sub_iokit_networking err_sub(6)
+#define sub_iokit_bluetooth err_sub(8)
+#define sub_iokit_pmu err_sub(9)
+#define sub_iokit_acpi err_sub(10)
+#define sub_iokit_smbus err_sub(11)
+#define sub_iokit_ahci err_sub(12)
+#define sub_iokit_powermanagement err_sub(13)
+#define sub_iokit_hidsystem err_sub(14)
+#define sub_iokit_scsi err_sub(16)
+#define sub_iokit_usbaudio err_sub(17)
+#define sub_iokit_wirelesscharging err_sub(18)
+//#define sub_iokit_pccard err_sub(21)
+#define sub_iokit_thunderbolt err_sub(29)
+#define sub_iokit_graphics_acceleration err_sub(30)
+#define sub_iokit_keystore err_sub(31)
+#define sub_iokit_apfs err_sub(33)
+#define sub_iokit_acpiec err_sub(34)
+#define sub_iokit_timesync_avb err_sub(35)
+
+#define sub_iokit_platform err_sub(0x2A)
+#define sub_iokit_audio_video err_sub(0x45)
+#define sub_iokit_cec err_sub(0x46)
+#define sub_iokit_baseband err_sub(0x80)
+#define sub_iokit_HDA err_sub(0xFE)
+#define sub_iokit_hsic err_sub(0x147)
+#define sub_iokit_sdio err_sub(0x174)
+#define sub_iokit_wlan err_sub(0x208)
+#define sub_iokit_appleembeddedsleepwakehandler err_sub(0x209)
+#define sub_iokit_appleppm err_sub(0x20A)
+
+#define sub_iokit_vendor_specific err_sub(-2)
+#define sub_iokit_reserved err_sub(-1)
+
+#define iokit_common_err(return ) (sys_iokit|sub_iokit_common|return)
+#define iokit_family_err(sub, return ) (sys_iokit|sub|return)
+#define iokit_vendor_specific_err(return ) (sys_iokit|sub_iokit_vendor_specific|return)
+
+#define kIOReturnSuccess KERN_SUCCESS // OK
+#define kIOReturnError iokit_common_err(0x2bc) // general error
+#define kIOReturnNoMemory iokit_common_err(0x2bd) // can't allocate memory
+#define kIOReturnNoResources iokit_common_err(0x2be) // resource shortage
+#define kIOReturnIPCError iokit_common_err(0x2bf) // error during IPC
+#define kIOReturnNoDevice iokit_common_err(0x2c0) // no such device
+#define kIOReturnNotPrivileged iokit_common_err(0x2c1) // privilege violation
+#define kIOReturnBadArgument iokit_common_err(0x2c2) // invalid argument
+#define kIOReturnLockedRead iokit_common_err(0x2c3) // device read locked
+#define kIOReturnLockedWrite iokit_common_err(0x2c4) // device write locked
+#define kIOReturnExclusiveAccess iokit_common_err(0x2c5) // exclusive access and
+ // device already open
+#define kIOReturnBadMessageID iokit_common_err(0x2c6) // sent/received messages
+ // had different msg_id
+#define kIOReturnUnsupported iokit_common_err(0x2c7) // unsupported function
+#define kIOReturnVMError iokit_common_err(0x2c8) // misc. VM failure
+#define kIOReturnInternalError iokit_common_err(0x2c9) // internal error
+#define kIOReturnIOError iokit_common_err(0x2ca) // General I/O error
+//#define kIOReturn???Error iokit_common_err(0x2cb) // ???
+#define kIOReturnCannotLock iokit_common_err(0x2cc) // can't acquire lock
+#define kIOReturnNotOpen iokit_common_err(0x2cd) // device not open
+#define kIOReturnNotReadable iokit_common_err(0x2ce) // read not supported
+#define kIOReturnNotWritable iokit_common_err(0x2cf) // write not supported
+#define kIOReturnNotAligned iokit_common_err(0x2d0) // alignment error
+#define kIOReturnBadMedia iokit_common_err(0x2d1) // Media Error
+#define kIOReturnStillOpen iokit_common_err(0x2d2) // device(s) still open
+#define kIOReturnRLDError iokit_common_err(0x2d3) // rld failure
+#define kIOReturnDMAError iokit_common_err(0x2d4) // DMA failure
+#define kIOReturnBusy iokit_common_err(0x2d5) // Device Busy
+#define kIOReturnTimeout iokit_common_err(0x2d6) // I/O Timeout
+#define kIOReturnOffline iokit_common_err(0x2d7) // device offline
+#define kIOReturnNotReady iokit_common_err(0x2d8) // not ready
+#define kIOReturnNotAttached iokit_common_err(0x2d9) // device not attached
+#define kIOReturnNoChannels iokit_common_err(0x2da) // no DMA channels left
+#define kIOReturnNoSpace iokit_common_err(0x2db) // no space for data
+//#define kIOReturn???Error iokit_common_err(0x2dc) // ???
+#define kIOReturnPortExists iokit_common_err(0x2dd) // port already exists
+#define kIOReturnCannotWire iokit_common_err(0x2de) // can't wire down
+ // physical memory
+#define kIOReturnNoInterrupt iokit_common_err(0x2df) // no interrupt attached
+#define kIOReturnNoFrames iokit_common_err(0x2e0) // no DMA frames enqueued
+#define kIOReturnMessageTooLarge iokit_common_err(0x2e1) // oversized msg received
+ // on interrupt port
+#define kIOReturnNotPermitted iokit_common_err(0x2e2) // not permitted
+#define kIOReturnNoPower iokit_common_err(0x2e3) // no power to device
+#define kIOReturnNoMedia iokit_common_err(0x2e4) // media not present
+#define kIOReturnUnformattedMedia iokit_common_err(0x2e5)// media not formatted
+#define kIOReturnUnsupportedMode iokit_common_err(0x2e6) // no such mode
+#define kIOReturnUnderrun iokit_common_err(0x2e7) // data underrun
+#define kIOReturnOverrun iokit_common_err(0x2e8) // data overrun
+#define kIOReturnDeviceError iokit_common_err(0x2e9) // the device is not working properly!
+#define kIOReturnNoCompletion iokit_common_err(0x2ea) // a completion routine is required
+#define kIOReturnAborted iokit_common_err(0x2eb) // operation aborted
+#define kIOReturnNoBandwidth iokit_common_err(0x2ec) // bus bandwidth would be exceeded
+#define kIOReturnNotResponding iokit_common_err(0x2ed) // device not responding
+#define kIOReturnIsoTooOld iokit_common_err(0x2ee) // isochronous I/O request for distant past!
+#define kIOReturnIsoTooNew iokit_common_err(0x2ef) // isochronous I/O request for distant future
+#define kIOReturnNotFound iokit_common_err(0x2f0) // data was not found
+#define kIOReturnInvalid iokit_common_err(0x1) // should never be seen
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ! __IOKIT_IORETURN_H */
diff --git a/third_party/IOKit/IOTypes.h b/third_party/IOKit/IOTypes.h
new file mode 100644
index 0000000000000..8ebeb54838aaf
--- /dev/null
+++ b/third_party/IOKit/IOTypes.h
@@ -0,0 +1,246 @@
+/*
+ * Copyright (c) 1998-2012 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ *
+ * 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. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ *
+ * 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, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+#ifndef __IOKIT_IOTYPES_H
+#define __IOKIT_IOTYPES_H
+
+
+#ifndef IOKIT
+#define IOKIT 1
+#endif /* !IOKIT */
+
+#include
+#include
+
+#include "third_party/IOKit/IOReturn.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef NULL
+#if defined (__cplusplus)
+#if __cplusplus >= 201103L
+#define NULL nullptr
+#else
+#define NULL 0
+#endif
+#else
+#define NULL ((void *)0)
+#endif
+#endif
+
+/*
+ * Simple data types.
+ */
+#include
+
+typedef UInt32 IOOptionBits;
+typedef SInt32 IOFixed;
+typedef UInt32 IOVersion;
+typedef UInt32 IOItemCount;
+typedef UInt32 IOCacheMode;
+
+typedef UInt32 IOByteCount32;
+typedef UInt64 IOByteCount64;
+
+typedef UInt32 IOPhysicalAddress32;
+typedef UInt64 IOPhysicalAddress64;
+typedef UInt32 IOPhysicalLength32;
+typedef UInt64 IOPhysicalLength64;
+
+#if !defined(__arm__) && !defined(__i386__)
+typedef mach_vm_address_t IOVirtualAddress;
+#else
+typedef vm_address_t IOVirtualAddress;
+#endif
+
+#if !defined(__arm__) && !defined(__i386__) && !(defined(__x86_64__) && !defined(KERNEL)) && !(defined(__arm64__) && !defined(__LP64__))
+typedef IOByteCount64 IOByteCount;
+#else
+typedef IOByteCount32 IOByteCount;
+#endif
+
+typedef IOVirtualAddress IOLogicalAddress;
+
+#if !defined(__arm__) && !defined(__i386__) && !(defined(__x86_64__) && !defined(KERNEL))
+
+typedef IOPhysicalAddress64 IOPhysicalAddress;
+typedef IOPhysicalLength64 IOPhysicalLength;
+#define IOPhysical32( hi, lo ) ((UInt64) lo + ((UInt64)(hi) << 32))
+#define IOPhysSize 64
+
+#else
+
+typedef IOPhysicalAddress32 IOPhysicalAddress;
+typedef IOPhysicalLength32 IOPhysicalLength;
+#define IOPhysical32( hi, lo ) (lo)
+#define IOPhysSize 32
+
+#endif
+
+
+typedef struct{
+ IOPhysicalAddress address;
+ IOByteCount length;
+} IOPhysicalRange;
+
+typedef struct{
+ IOVirtualAddress address;
+ IOByteCount length;
+} IOVirtualRange;
+
+#if !defined(__arm__) && !defined(__i386__)
+typedef IOVirtualRange IOAddressRange;
+#else
+typedef struct{
+ mach_vm_address_t address;
+ mach_vm_size_t length;
+} IOAddressRange;
+#endif
+
+/*
+ * Map between #defined or enum'd constants and text description.
+ */
+typedef struct {
+ int value;
+ const char *name;
+} IONamedValue;
+
+
+/*
+ * Memory alignment -- specified as a power of two.
+ */
+typedef unsigned int IOAlignment;
+
+#define IO_NULL_VM_TASK ((vm_task_t)0)
+
+
+/*
+ * Pull in machine specific stuff.
+ */
+
+//#include
+
+#ifndef MACH_KERNEL
+
+#ifndef __IOKIT_PORTS_DEFINED__
+#define __IOKIT_PORTS_DEFINED__
+typedef mach_port_t io_object_t;
+#endif /* __IOKIT_PORTS_DEFINED__ */
+
+#include
+
+typedef io_object_t io_connect_t;
+typedef io_object_t io_enumerator_t;
+typedef io_object_t io_iterator_t;
+typedef io_object_t io_registry_entry_t;
+typedef io_object_t io_service_t;
+typedef io_object_t uext_object_t;
+
+#define IO_OBJECT_NULL ((io_object_t) 0)
+
+#endif /* MACH_KERNEL */
+
+// IOConnectMapMemory memoryTypes
+enum {
+ kIODefaultMemoryType = 0
+};
+
+enum {
+ kIODefaultCache = 0,
+ kIOInhibitCache = 1,
+ kIOWriteThruCache = 2,
+ kIOCopybackCache = 3,
+ kIOWriteCombineCache = 4,
+ kIOCopybackInnerCache = 5,
+ kIOPostedWrite = 6,
+ kIORealTimeCache = 7,
+ kIOPostedReordered = 8,
+ kIOPostedCombinedReordered = 9,
+};
+
+// IOMemory mapping options
+enum {
+ kIOMapAnywhere = 0x00000001,
+
+ kIOMapCacheMask = 0x00000f00,
+ kIOMapCacheShift = 8,
+ kIOMapDefaultCache = kIODefaultCache << kIOMapCacheShift,
+ kIOMapInhibitCache = kIOInhibitCache << kIOMapCacheShift,
+ kIOMapWriteThruCache = kIOWriteThruCache << kIOMapCacheShift,
+ kIOMapCopybackCache = kIOCopybackCache << kIOMapCacheShift,
+ kIOMapWriteCombineCache = kIOWriteCombineCache << kIOMapCacheShift,
+ kIOMapCopybackInnerCache = kIOCopybackInnerCache << kIOMapCacheShift,
+ kIOMapPostedWrite = kIOPostedWrite << kIOMapCacheShift,
+ kIOMapRealTimeCache = kIORealTimeCache << kIOMapCacheShift,
+ kIOMapPostedReordered = kIOPostedReordered << kIOMapCacheShift,
+ kIOMapPostedCombinedReordered = kIOPostedCombinedReordered << kIOMapCacheShift,
+
+ kIOMapUserOptionsMask = 0x00000fff,
+
+ kIOMapReadOnly = 0x00001000,
+
+ kIOMapStatic = 0x01000000,
+ kIOMapReference = 0x02000000,
+ kIOMapUnique = 0x04000000,
+ kIOMapPrefault = 0x10000000,
+ kIOMapOverwrite = 0x20000000
+};
+
+/*! @enum Scale Factors
+ * @discussion Used when a scale_factor parameter is required to define a unit of time.
+ * @constant kNanosecondScale Scale factor for nanosecond based times.
+ * @constant kMicrosecondScale Scale factor for microsecond based times.
+ * @constant kMillisecondScale Scale factor for millisecond based times.
+ * @constant kTickScale Scale factor for the standard (100Hz) tick.
+ * @constant kSecondScale Scale factor for second based times. */
+
+enum {
+ kNanosecondScale = 1,
+ kMicrosecondScale = 1000,
+ kMillisecondScale = 1000 * 1000,
+ kSecondScale = 1000 * 1000 * 1000,
+ kTickScale = (kSecondScale / 100)
+};
+
+enum {
+ kIOConnectMethodVarOutputSize = -3
+};
+
+/* compatibility types */
+
+
+typedef unsigned int IODeviceNumber;
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* ! __IOKIT_IOTYPES_H */
diff --git a/third_party/IOKit/LICENSE b/third_party/IOKit/LICENSE
new file mode 100644
index 0000000000000..b9ce99f6e67f7
--- /dev/null
+++ b/third_party/IOKit/LICENSE
@@ -0,0 +1,326 @@
+APPLE PUBLIC SOURCE LICENSE Version 2.0 - August 6, 2003
+
+Please read this License carefully before downloading this software. By
+downloading or using this software, you are agreeing to be bound by the terms of
+this License. If you do not or cannot agree to the terms of this License,
+please do not download or use the software.
+
+Apple Note: In January 2007, Apple changed its corporate name from "Apple
+Computer, Inc." to "Apple Inc." This change has been reflected below and
+copyright years updated, but no other changes have been made to the APSL 2.0.
+
+1. General; Definitions. This License applies to any program or other work
+which Apple Inc. ("Apple") makes publicly available and which contains a notice
+placed by Apple identifying such program or work as "Original Code" and stating
+that it is subject to the terms of this Apple Public Source License version 2.0
+("License"). As used in this License:
+
+1.1 "Applicable Patent Rights" mean: (a) in the case where Apple is the
+grantor of rights, (i) claims of patents that are now or hereafter acquired,
+owned by or assigned to Apple and (ii) that cover subject matter contained in
+the Original Code, but only to the extent necessary to use, reproduce and/or
+distribute the Original Code without infringement; and (b) in the case where You
+are the grantor of rights, (i) claims of patents that are now or hereafter
+acquired, owned by or assigned to You and (ii) that cover subject matter in Your
+Modifications, taken alone or in combination with Original Code.
+
+1.2 "Contributor" means any person or entity that creates or contributes to the
+creation of Modifications.
+
+1.3 "Covered Code" means the Original Code, Modifications, the combination of
+Original Code and any Modifications, and/or any respective portions thereof.
+
+1.4 "Externally Deploy" means: (a) to sublicense, distribute or otherwise make
+Covered Code available, directly or indirectly, to anyone other than You; and/or
+(b) to use Covered Code, alone or as part of a Larger Work, in any way to
+provide a service, including but not limited to delivery of content, through
+electronic communication with a client other than You.
+
+1.5 "Larger Work" means a work which combines Covered Code or portions thereof
+with code not governed by the terms of this License.
+
+1.6 "Modifications" mean any addition to, deletion from, and/or change to, the
+substance and/or structure of the Original Code, any previous Modifications, the
+combination of Original Code and any previous Modifications, and/or any
+respective portions thereof. When code is released as a series of files, a
+Modification is: (a) any addition to or deletion from the contents of a file
+containing Covered Code; and/or (b) any new file or other representation of
+computer program statements that contains any part of Covered Code.
+
+1.7 "Original Code" means (a) the Source Code of a program or other work as
+originally made available by Apple under this License, including the Source Code
+of any updates or upgrades to such programs or works made available by Apple
+under this License, and that has been expressly identified by Apple as such in
+the header file(s) of such work; and (b) the object code compiled from such
+Source Code and originally made available by Apple under this License
+
+1.8 "Source Code" means the human readable form of a program or other work that
+is suitable for making modifications to it, including all modules it contains,
+plus any associated interface definition files, scripts used to control
+compilation and installation of an executable (object code).
+
+1.9 "You" or "Your" means an individual or a legal entity exercising rights
+under this License. For legal entities, "You" or "Your" includes any entity
+which controls, is controlled by, or is under common control with, You, where
+"control" means (a) the power, direct or indirect, to cause the direction or
+management of such entity, whether by contract or otherwise, or (b) ownership of
+fifty percent (50%) or more of the outstanding shares or beneficial ownership of
+such entity.
+
+2. Permitted Uses; Conditions & Restrictions. Subject to the terms and
+conditions of this License, Apple hereby grants You, effective on the date You
+accept this License and download the Original Code, a world-wide, royalty-free,
+non-exclusive license, to the extent of Apple's Applicable Patent Rights and
+copyrights covering the Original Code, to do the following:
+
+2.1 Unmodified Code. You may use, reproduce, display, perform, internally
+distribute within Your organization, and Externally Deploy verbatim, unmodified
+copies of the Original Code, for commercial or non-commercial purposes, provided
+that in each instance:
+
+(a) You must retain and reproduce in all copies of Original Code the copyright
+and other proprietary notices and disclaimers of Apple as they appear in the
+Original Code, and keep intact all notices in the Original Code that refer to
+this License; and
+
+(b) You must include a copy of this License with every copy of Source Code of
+Covered Code and documentation You distribute or Externally Deploy, and You may
+not offer or impose any terms on such Source Code that alter or restrict this
+License or the recipients' rights hereunder, except as permitted under Section
+6.
+
+2.2 Modified Code. You may modify Covered Code and use, reproduce, display,
+perform, internally distribute within Your organization, and Externally Deploy
+Your Modifications and Covered Code, for commercial or non-commercial purposes,
+provided that in each instance You also meet all of these conditions:
+
+(a) You must satisfy all the conditions of Section 2.1 with respect to the
+Source Code of the Covered Code;
+
+(b) You must duplicate, to the extent it does not already exist, the notice in
+Exhibit A in each file of the Source Code of all Your Modifications, and cause
+the modified files to carry prominent notices stating that You changed the files
+and the date of any change; and
+
+(c) If You Externally Deploy Your Modifications, You must make Source Code of
+all Your Externally Deployed Modifications either available to those to whom You
+have Externally Deployed Your Modifications, or publicly available. Source Code
+of Your Externally Deployed Modifications must be released under the terms set
+forth in this License, including the license grants set forth in Section 3
+below, for as long as you Externally Deploy the Covered Code or twelve (12)
+months from the date of initial External Deployment, whichever is longer. You
+should preferably distribute the Source Code of Your Externally Deployed
+Modifications electronically (e.g. download from a web site).
+
+2.3 Distribution of Executable Versions. In addition, if You Externally Deploy
+Covered Code (Original Code and/or Modifications) in object code, executable
+form only, You must include a prominent notice, in the code itself as well as in
+related documentation, stating that Source Code of the Covered Code is available
+under the terms of this License with information on how and where to obtain such
+Source Code.
+
+2.4 Third Party Rights. You expressly acknowledge and agree that although Apple
+and each Contributor grants the licenses to their respective portions of the
+Covered Code set forth herein, no assurances are provided by Apple or any
+Contributor that the Covered Code does not infringe the patent or other
+intellectual property rights of any other entity. Apple and each Contributor
+disclaim any liability to You for claims brought by any other entity based on
+infringement of intellectual property rights or otherwise. As a condition to
+exercising the rights and licenses granted hereunder, You hereby assume sole
+responsibility to secure any other intellectual property rights needed, if any.
+For example, if a third party patent license is required to allow You to
+distribute the Covered Code, it is Your responsibility to acquire that license
+before distributing the Covered Code.
+
+3. Your Grants. In consideration of, and as a condition to, the licenses
+granted to You under this License, You hereby grant to any person or entity
+receiving or distributing Covered Code under this License a non-exclusive,
+royalty-free, perpetual, irrevocable license, under Your Applicable Patent
+Rights and other intellectual property rights (other than patent) owned or
+controlled by You, to use, reproduce, display, perform, modify, sublicense,
+distribute and Externally Deploy Your Modifications of the same scope and extent
+as Apple's licenses under Sections 2.1 and 2.2 above.
+
+4. Larger Works. You may create a Larger Work by combining Covered Code with
+other code not governed by the terms of this License and distribute the Larger
+Work as a single product. In each such instance, You must make sure the
+requirements of this License are fulfilled for the Covered Code or any portion
+thereof.
+
+5. Limitations on Patent License. Except as expressly stated in Section 2, no
+other patent rights, express or implied, are granted by Apple herein.
+Modifications and/or Larger Works may require additional patent licenses from
+Apple which Apple may grant in its sole discretion.
+
+6. Additional Terms. You may choose to offer, and to charge a fee for,
+warranty, support, indemnity or liability obligations and/or other rights
+consistent with the scope of the license granted herein ("Additional Terms") to
+one or more recipients of Covered Code. However, You may do so only on Your own
+behalf and as Your sole responsibility, and not on behalf of Apple or any
+Contributor. You must obtain the recipient's agreement that any such Additional
+Terms are offered by You alone, and You hereby agree to indemnify, defend and
+hold Apple and every Contributor harmless for any liability incurred by or
+claims asserted against Apple or such Contributor by reason of any such
+Additional Terms.
+
+7. Versions of the License. Apple may publish revised and/or new versions of
+this License from time to time. Each version will be given a distinguishing
+version number. Once Original Code has been published under a particular
+version of this License, You may continue to use it under the terms of that
+version. You may also choose to use such Original Code under the terms of any
+subsequent version of this License published by Apple. No one other than Apple
+has the right to modify the terms applicable to Covered Code created under this
+License.
+
+8. NO WARRANTY OR SUPPORT. The Covered Code may contain in whole or in part
+pre-release, untested, or not fully tested works. The Covered Code may contain
+errors that could cause failures or loss of data, and may be incomplete or
+contain inaccuracies. You expressly acknowledge and agree that use of the
+Covered Code, or any portion thereof, is at Your sole and entire risk. THE
+COVERED CODE IS PROVIDED "AS IS" AND WITHOUT WARRANTY, UPGRADES OR SUPPORT OF
+ANY KIND AND APPLE AND APPLE'S LICENSOR(S) (COLLECTIVELY REFERRED TO AS "APPLE"
+FOR THE PURPOSES OF SECTIONS 8 AND 9) AND ALL CONTRIBUTORS EXPRESSLY DISCLAIM
+ALL WARRANTIES AND/OR CONDITIONS, EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED
+TO, THE IMPLIED WARRANTIES AND/OR CONDITIONS OF MERCHANTABILITY, OF SATISFACTORY
+QUALITY, OF FITNESS FOR A PARTICULAR PURPOSE, OF ACCURACY, OF QUIET ENJOYMENT,
+AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. APPLE AND EACH CONTRIBUTOR DOES NOT
+WARRANT AGAINST INTERFERENCE WITH YOUR ENJOYMENT OF THE COVERED CODE, THAT THE
+FUNCTIONS CONTAINED IN THE COVERED CODE WILL MEET YOUR REQUIREMENTS, THAT THE
+OPERATION OF THE COVERED CODE WILL BE UNINTERRUPTED OR ERROR-FREE, OR THAT
+DEFECTS IN THE COVERED CODE WILL BE CORRECTED. NO ORAL OR WRITTEN INFORMATION
+OR ADVICE GIVEN BY APPLE, AN APPLE AUTHORIZED REPRESENTATIVE OR ANY CONTRIBUTOR
+SHALL CREATE A WARRANTY. You acknowledge that the Covered Code is not intended
+for use in the operation of nuclear facilities, aircraft navigation,
+communication systems, or air traffic control machines in which case the failure
+of the Covered Code could lead to death, personal injury, or severe physical or
+environmental damage.
+
+9. LIMITATION OF LIABILITY. TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT
+SHALL APPLE OR ANY CONTRIBUTOR BE LIABLE FOR ANY INCIDENTAL, SPECIAL, INDIRECT
+OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR RELATING TO THIS LICENSE OR YOUR USE
+OR INABILITY TO USE THE COVERED CODE, OR ANY PORTION THEREOF, WHETHER UNDER A
+THEORY OF CONTRACT, WARRANTY, TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR
+OTHERWISE, EVEN IF APPLE OR SUCH CONTRIBUTOR HAS BEEN ADVISED OF THE POSSIBILITY
+OF SUCH DAMAGES AND NOTWITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE OF ANY
+REMEDY. SOME JURISDICTIONS DO NOT ALLOW THE LIMITATION OF LIABILITY OF
+INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS LIMITATION MAY NOT APPLY TO YOU. In
+no event shall Apple's total liability to You for all damages (other than as may
+be required by applicable law) under this License exceed the amount of fifty
+dollars ($50.00).
+
+10. Trademarks. This License does not grant any rights to use the trademarks or
+trade names "Apple", "Mac", "Mac OS", "QuickTime", "QuickTime Streaming Server"
+or any other trademarks, service marks, logos or trade names belonging to Apple
+(collectively "Apple Marks") or to any trademark, service mark, logo or trade
+name belonging to any Contributor. You agree not to use any Apple Marks in or
+as part of the name of products derived from the Original Code or to endorse or
+promote products derived from the Original Code other than as expressly
+permitted by and in strict compliance at all times with Apple's third party
+trademark usage guidelines which are posted at
+http://www.apple.com/legal/guidelinesfor3rdparties.html.
+
+11. Ownership. Subject to the licenses granted under this License, each
+Contributor retains all rights, title and interest in and to any Modifications
+made by such Contributor. Apple retains all rights, title and interest in and
+to the Original Code and any Modifications made by or on behalf of Apple ("Apple
+Modifications"), and such Apple Modifications will not be automatically subject
+to this License. Apple may, at its sole discretion, choose to license such
+Apple Modifications under this License, or on different terms from those
+contained in this License or may choose not to license them at all.
+
+12. Termination.
+
+12.1 Termination. This License and the rights granted hereunder will terminate:
+
+(a) automatically without notice from Apple if You fail to comply with any
+term(s) of this License and fail to cure such breach within 30 days of becoming
+aware of such breach; (b) immediately in the event of the circumstances
+described in Section 13.5(b); or (c) automatically without notice from Apple if
+You, at any time during the term of this License, commence an action for patent
+infringement against Apple; provided that Apple did not first commence an action
+for patent infringement against You in that instance.
+
+12.2 Effect of Termination. Upon termination, You agree to immediately stop any
+further use, reproduction, modification, sublicensing and distribution of the
+Covered Code. All sublicenses to the Covered Code which have been properly
+granted prior to termination shall survive any termination of this License.
+Provisions which, by their nature, should remain in effect beyond the
+termination of this License shall survive, including but not limited to Sections
+3, 5, 8, 9, 10, 11, 12.2 and 13. No party will be liable to any other for
+compensation, indemnity or damages of any sort solely as a result of terminating
+this License in accordance with its terms, and termination of this License will
+be without prejudice to any other right or remedy of any party.
+
+13. Miscellaneous.
+
+13.1 Government End Users. The Covered Code is a "commercial item" as defined
+in FAR 2.101. Government software and technical data rights in the Covered Code
+include only those rights customarily provided to the public as defined in this
+License. This customary commercial license in technical data and software is
+provided in accordance with FAR 12.211 (Technical Data) and 12.212 (Computer
+Software) and, for Department of Defense purchases, DFAR 252.227-7015 (Technical
+Data -- Commercial Items) and 227.7202-3 (Rights in Commercial Computer Software
+or Computer Software Documentation). Accordingly, all U.S. Government End Users
+acquire Covered Code with only those rights set forth herein.
+
+13.2 Relationship of Parties. This License will not be construed as creating an
+agency, partnership, joint venture or any other form of legal association
+between or among You, Apple or any Contributor, and You will not represent to
+the contrary, whether expressly, by implication, appearance or otherwise.
+
+13.3 Independent Development. Nothing in this License will impair Apple's
+right to acquire, license, develop, have others develop for it, market and/or
+distribute technology or products that perform the same or similar functions as,
+or otherwise compete with, Modifications, Larger Works, technology or products
+that You may develop, produce, market or distribute.
+
+13.4 Waiver; Construction. Failure by Apple or any Contributor to enforce any
+provision of this License will not be deemed a waiver of future enforcement of
+that or any other provision. Any law or regulation which provides that the
+language of a contract shall be construed against the drafter will not apply to
+this License.
+
+13.5 Severability. (a) If for any reason a court of competent jurisdiction
+finds any provision of this License, or portion thereof, to be unenforceable,
+that provision of the License will be enforced to the maximum extent permissible
+so as to effect the economic benefits and intent of the parties, and the
+remainder of this License will continue in full force and effect. (b)
+Notwithstanding the foregoing, if applicable law prohibits or restricts You from
+fully and/or specifically complying with Sections 2 and/or 3 or prevents the
+enforceability of either of those Sections, this License will immediately
+terminate and You must immediately discontinue any use of the Covered Code and
+destroy all copies of it that are in your possession or control.
+
+13.6 Dispute Resolution. Any litigation or other dispute resolution between You
+and Apple relating to this License shall take place in the Northern District of
+California, and You and Apple hereby consent to the personal jurisdiction of,
+and venue in, the state and federal courts within that District with respect to
+this License. The application of the United Nations Convention on Contracts for
+the International Sale of Goods is expressly excluded.
+
+13.7 Entire Agreement; Governing Law. This License constitutes the entire
+agreement between the parties with respect to the subject matter hereof. This
+License shall be governed by the laws of the United States and the State of
+California, except that body of California law concerning conflicts of law.
+
+Where You are located in the province of Quebec, Canada, the following clause
+applies: The parties hereby confirm that they have requested that this License
+and all related documents be drafted in English. Les parties ont exigé que le
+présent contrat et tous les documents connexes soient rédigés en anglais.
+
+EXHIBIT A.
+
+"Portions Copyright (c) 1999-2007 Apple Inc. All Rights Reserved.
+
+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, QUIET
+ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the specific language
+governing rights and limitations under the License."