]> git.saurik.com Git - apple/xnu.git/blame - iokit/IOKit/IOKitServer.h
xnu-7195.101.1.tar.gz
[apple/xnu.git] / iokit / IOKit / IOKitServer.h
CommitLineData
1c79356b 1/*
316670eb 2 * Copyright (c) 1998-2011 Apple Computer, Inc. All rights reserved.
1c79356b 3 *
2d21ac55 4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
0a7de745 5 *
2d21ac55
A
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.
0a7de745 14 *
2d21ac55
A
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
0a7de745 17 *
2d21ac55
A
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
8f6c56a5
A
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
2d21ac55
A
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.
0a7de745 25 *
2d21ac55 26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
1c79356b
A
27 */
28/*
0a7de745 29 * Copyright (c) 1998 Apple Computer, Inc. All rights reserved.
1c79356b
A
30 *
31 * HISTORY
32 *
33 */
34
35/*
36 * Internal definitions used between the iokit user library and
37 * server routines.
38 */
39
40#ifndef _IOKIT_IOKITSERVER_H
41#define _IOKIT_IOKITSERVER_H
42
43#include <IOKit/IOTypes.h>
44#include <IOKit/IOKitKeys.h>
45#include <IOKit/OSMessageNotification.h>
46
47#ifdef __cplusplus
48extern "C" {
49#endif
50#include <mach/kmod.h>
51#ifdef __cplusplus
52}
53#endif
54
1c79356b
A
55// IOCatalogueSendData
56/*!
0a7de745
A
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.
68 */
1c79356b 69enum {
0a7de745
A
70 kIOCatalogAddDrivers = 1,
71 kIOCatalogAddDriversNoMatch,
72 kIOCatalogRemoveDrivers,
73 kIOCatalogRemoveDriversNoMatch,
cb323159
A
74 kIOCatalogStartMatching__Removed,
75 kIOCatalogRemoveKernelLinker__Removed,
0a7de745
A
76 kIOCatalogKextdActive,
77 kIOCatalogKextdFinishedLaunching,
78 kIOCatalogResetDrivers,
79 kIOCatalogResetDriversNoMatch
1c79356b
A
80};
81
82// IOCatalogueGetData
83/*!
0a7de745
A
84 * @enum IOCatalogueGetData user-client flags
85 * @constant kIOCatalogGetContents Returns a snapshot of the database to the caller.
86 */
1c79356b 87enum {
0a7de745
A
88 kIOCatalogGetContents = 1,
89 kIOCatalogGetModuleDemandList = 2,
90 kIOCatalogGetCacheMissList = 3,
91 kIOCatalogGetROMMkextList = 4
1c79356b
A
92};
93
94// IOCatalogueReset
95/*!
0a7de745
A
96 * @enum IOCatalogueReset user-client flag
97 * @constant kIOCatalogResetDefault Removes all entries from IOCatalogue except those used for booting the system.
98 */
1c79356b 99enum {
0a7de745 100 kIOCatalogResetDefault = 1
1c79356b
A
101};
102
103// IOCatalogueTerminate
104/*!
0a7de745
A
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.
109 */
1c79356b 110enum {
0a7de745
A
111 kIOCatalogModuleUnload = 1,
112 kIOCatalogModuleTerminate,
113 kIOCatalogServiceTerminate
1c79356b
A
114};
115
a39ff7e2
A
116
117#ifdef XNU_KERNEL_PRIVATE
118
119#ifdef __cplusplus
120extern "C" {
121#endif /* __cplusplus */
122
123#include <kern/ipc_kobject.h>
124
125/*
126 * Functions in iokit:IOUserClient.cpp
127 */
128
129extern void iokit_add_reference( io_object_t obj, ipc_kobject_type_t type );
130
131extern ipc_port_t iokit_port_for_object( io_object_t obj,
0a7de745 132 ipc_kobject_type_t type );
a39ff7e2
A
133
134extern kern_return_t iokit_client_died( io_object_t obj,
0a7de745 135 ipc_port_t port, ipc_kobject_type_t type, mach_port_mscount_t * mscount );
a39ff7e2
A
136
137extern kern_return_t
138iokit_client_memory_for_type(
0a7de745
A
139 io_object_t connect,
140 unsigned int type,
141 unsigned int * flags,
142 vm_address_t * address,
143 vm_size_t * size );
a39ff7e2
A
144
145/*
146 * Functions in osfmk:iokit_rpc.c
147 */
148
149extern ipc_port_t iokit_alloc_object_port( io_object_t obj,
0a7de745 150 ipc_kobject_type_t type );
a39ff7e2
A
151
152extern kern_return_t iokit_destroy_object_port( ipc_port_t port );
153
154extern mach_port_name_t iokit_make_send_right( task_t task,
0a7de745 155 io_object_t obj, ipc_kobject_type_t type );
a39ff7e2 156
cb323159 157extern mach_port_t ipc_port_make_send(mach_port_t);
ea3f0419 158extern mach_port_t ipc_port_copy_send(mach_port_t);
cb323159
A
159extern void ipc_port_release_send(ipc_port_t port);
160
161extern io_object_t iokit_lookup_io_object(ipc_port_t port, ipc_kobject_type_t type);
162
a39ff7e2
A
163extern kern_return_t iokit_mod_send_right( task_t task, mach_port_name_t name, mach_port_delta_t delta );
164
165extern io_object_t iokit_lookup_object_with_port_name(mach_port_name_t name, ipc_kobject_type_t type, task_t task);
166
167extern io_object_t iokit_lookup_connect_ref_current_task(mach_port_name_t name);
cb323159 168extern io_object_t iokit_lookup_uext_ref_current_task(mach_port_name_t name);
a39ff7e2
A
169
170extern void iokit_retain_port( ipc_port_t port );
171extern void iokit_release_port( ipc_port_t port );
c3c9b80d 172extern void iokit_make_port_send( ipc_port_t port );
a39ff7e2
A
173extern void iokit_release_port_send( ipc_port_t port );
174
175extern void iokit_lock_port(ipc_port_t port);
176extern void iokit_unlock_port(ipc_port_t port);
177
178extern kern_return_t iokit_switch_object_port( ipc_port_t port, io_object_t obj, ipc_kobject_type_t type );
179
cb323159
A
180#ifndef MACH_KERNEL_PRIVATE
181typedef struct ipc_kmsg * ipc_kmsg_t;
182extern ipc_kmsg_t ipc_kmsg_alloc(size_t);
183extern void ipc_kmsg_destroy(ipc_kmsg_t);
184extern mach_msg_header_t * ipc_kmsg_msg_header(ipc_kmsg_t);
185#endif /* MACH_KERNEL_PRIVATE */
186
187extern kern_return_t
188uext_server(ipc_kmsg_t request, ipc_kmsg_t * preply);
189
ea3f0419
A
190extern kern_return_t
191iokit_label_dext_task(task_t task);
cb323159 192
a39ff7e2
A
193/*
194 * Functions imported by iokit:IOMemoryDescriptor.cpp
195 */
196
197extern ppnum_t IOGetLastPageNumber(void);
198
199extern kern_return_t IOMapPages(vm_map_t map, mach_vm_address_t va, mach_vm_address_t pa,
0a7de745 200 mach_vm_size_t length, unsigned int mapFlags);
a39ff7e2
A
201
202extern kern_return_t IOUnmapPages(vm_map_t map, mach_vm_address_t va, mach_vm_size_t length);
203
204extern kern_return_t IOProtectCacheMode(vm_map_t map, mach_vm_address_t va,
0a7de745 205 mach_vm_size_t length, unsigned int options);
a39ff7e2
A
206
207extern unsigned int IODefaultCacheBits(addr64_t pa);
208
209#ifdef __cplusplus
210} /* extern "C" */
211#endif /* __cplusplus */
212
213#endif /* MACH_KERNEL_PRIVATE */
214
1c79356b 215#endif /* ! _IOKIT_IOKITSERVER_H */