2 * Copyright (c) 1998-2011 Apple Computer, Inc. All rights reserved.
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
29 * Copyright (c) 1998 Apple Computer, Inc. All rights reserved.
36 * Internal definitions used between the iokit user library and
40 #ifndef _IOKIT_IOKITSERVER_H
41 #define _IOKIT_IOKITSERVER_H
43 #include <IOKit/IOTypes.h>
44 #include <IOKit/IOKitKeys.h>
45 #include <IOKit/OSMessageNotification.h>
50 #include <mach/kmod.h>
55 // IOCatalogueSendData
57 * @enum IOCatalogueSendData user-client flags.
58 * @constant kIOCatalogAddDrivers Signals a call to the addDrivers function in IOCatalogue.
59 * @constant kIOCatalogAddDriversNoMatch Signals a call to the addDrivers function in IOCatalogue but does not start a matching thread.
60 * @constant kIOCatalogRemoveDrivers Signals a call to the removeDrivers function in IOCatalogue.
61 * @constant kIOCatalogRemoveDriversNoMatch Signals a call to the removedrivers function in IOCatalogue but does not start a matching thread.
62 * @constant kIOCatalogStartMatching Signals the IOCatalogue to start an IOService matching thread.
63 * @constant kIOCatalogRemoveKernelLinker Deprecated; does nothing.
64 * @constant kIOCatalogKextdActive Signals the kernel that kextd is running.
65 * @constant kIOCatalogKextdFinishedLaunching Signals the IOCatalogue that kextd has finished sending it information at startup.
66 * @constant kIOCatalogResetDrivers Resets the IOCatalogue with a new set of personalities.
67 * @constant kIOCatalogResetDriversNoMatch Resets the IOCatalogue with a new set of personalities but does not start a matching thread.
70 kIOCatalogAddDrivers
= 1,
71 kIOCatalogAddDriversNoMatch
,
72 kIOCatalogRemoveDrivers
,
73 kIOCatalogRemoveDriversNoMatch
,
74 kIOCatalogStartMatching__Removed
,
75 kIOCatalogRemoveKernelLinker__Removed
,
76 kIOCatalogKextdActive
,
77 kIOCatalogKextdFinishedLaunching
,
78 kIOCatalogResetDrivers
,
79 kIOCatalogResetDriversNoMatch
84 * @enum IOCatalogueGetData user-client flags
85 * @constant kIOCatalogGetContents Returns a snapshot of the database to the caller.
88 kIOCatalogGetContents
= 1,
89 kIOCatalogGetModuleDemandList
= 2,
90 kIOCatalogGetCacheMissList
= 3,
91 kIOCatalogGetROMMkextList
= 4
96 * @enum IOCatalogueReset user-client flag
97 * @constant kIOCatalogResetDefault Removes all entries from IOCatalogue except those used for booting the system.
100 kIOCatalogResetDefault
= 1
103 // IOCatalogueTerminate
105 * @enum IOCatalogueTerminate user-client flags.
106 * @constant kIOCatalogModuleUnload Terminates all services which depend on a particular module and unloads the module.
107 * @constant kIOCatalogModuleTerminate Terminates all services which depend on a particular module but does not unload the module.
108 * @constant kIOCatalogServiceTerminate Terminates a particular service by name.
111 kIOCatalogModuleUnload
= 1,
112 kIOCatalogModuleTerminate
,
113 kIOCatalogServiceTerminate
117 #ifdef XNU_KERNEL_PRIVATE
121 #endif /* __cplusplus */
123 #include <kern/ipc_kobject.h>
126 * Functions in iokit:IOUserClient.cpp
129 extern void iokit_add_reference( io_object_t obj
, ipc_kobject_type_t type
);
131 extern ipc_port_t
iokit_port_for_object( io_object_t obj
,
132 ipc_kobject_type_t type
);
134 extern kern_return_t
iokit_client_died( io_object_t obj
,
135 ipc_port_t port
, ipc_kobject_type_t type
, mach_port_mscount_t
* mscount
);
138 iokit_client_memory_for_type(
141 unsigned int * flags
,
142 vm_address_t
* address
,
146 * Functions in osfmk:iokit_rpc.c
149 extern ipc_port_t
iokit_alloc_object_port( io_object_t obj
,
150 ipc_kobject_type_t type
);
152 extern kern_return_t
iokit_destroy_object_port( ipc_port_t port
);
154 extern mach_port_name_t
iokit_make_send_right( task_t task
,
155 io_object_t obj
, ipc_kobject_type_t type
);
157 extern mach_port_t
ipc_port_make_send(mach_port_t
);
158 extern void ipc_port_release_send(ipc_port_t port
);
160 extern io_object_t
iokit_lookup_io_object(ipc_port_t port
, ipc_kobject_type_t type
);
162 extern kern_return_t
iokit_mod_send_right( task_t task
, mach_port_name_t name
, mach_port_delta_t delta
);
164 extern io_object_t
iokit_lookup_object_with_port_name(mach_port_name_t name
, ipc_kobject_type_t type
, task_t task
);
166 extern io_object_t
iokit_lookup_connect_ref_current_task(mach_port_name_t name
);
167 extern io_object_t
iokit_lookup_uext_ref_current_task(mach_port_name_t name
);
169 extern void iokit_retain_port( ipc_port_t port
);
170 extern void iokit_release_port( ipc_port_t port
);
171 extern void iokit_release_port_send( ipc_port_t port
);
173 extern void iokit_lock_port(ipc_port_t port
);
174 extern void iokit_unlock_port(ipc_port_t port
);
176 extern kern_return_t
iokit_switch_object_port( ipc_port_t port
, io_object_t obj
, ipc_kobject_type_t type
);
178 #ifndef MACH_KERNEL_PRIVATE
179 typedef struct ipc_kmsg
* ipc_kmsg_t
;
180 extern ipc_kmsg_t
ipc_kmsg_alloc(size_t);
181 extern void ipc_kmsg_destroy(ipc_kmsg_t
);
182 extern mach_msg_header_t
* ipc_kmsg_msg_header(ipc_kmsg_t
);
183 #endif /* MACH_KERNEL_PRIVATE */
186 uext_server(ipc_kmsg_t request
, ipc_kmsg_t
* preply
);
190 * Functions imported by iokit:IOMemoryDescriptor.cpp
193 extern ppnum_t
IOGetLastPageNumber(void);
195 extern kern_return_t
IOMapPages(vm_map_t map
, mach_vm_address_t va
, mach_vm_address_t pa
,
196 mach_vm_size_t length
, unsigned int mapFlags
);
198 extern kern_return_t
IOUnmapPages(vm_map_t map
, mach_vm_address_t va
, mach_vm_size_t length
);
200 extern kern_return_t
IOProtectCacheMode(vm_map_t map
, mach_vm_address_t va
,
201 mach_vm_size_t length
, unsigned int options
);
203 extern unsigned int IODefaultCacheBits(addr64_t pa
);
207 #endif /* __cplusplus */
209 #endif /* MACH_KERNEL_PRIVATE */
211 #endif /* ! _IOKIT_IOKITSERVER_H */