Sync usage with man page.
[netbsd-mini2440.git] / sys / compat / mach / mach_iokit.h
blob57300602d3842c0973e7b969c53d9e8eb4285586
1 /* $NetBSD: mach_iokit.h,v 1.25 2005/12/11 12:20:20 christos Exp $ */
3 /*-
4 * Copyright (c) 2003 The NetBSD Foundation, Inc.
5 * All rights reserved.
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Emmanuel Dreyfus
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
32 #ifndef _MACH_IOKIT_H_
33 #define _MACH_IOKIT_H_
35 typedef struct mach_io_object *mach_io_object_t;
37 /* mach_io_service_get_matching_services */
39 typedef struct {
40 mach_msg_header_t req_msgh;
41 mach_ndr_record_t req_ndr;
42 mach_io_object_t req_io_master;
43 mach_msg_size_t req_size;
44 char req_string[0];
45 } mach_io_service_get_matching_services_request_t;
47 typedef struct {
48 mach_msg_header_t rep_msgh;
49 mach_msg_body_t rep_body;
50 mach_msg_port_descriptor_t rep_match;
51 mach_msg_trailer_t rep_trailer;
52 } mach_io_service_get_matching_services_reply_t;
54 /* mach_io_iterator_next */
56 typedef struct {
57 mach_msg_header_t req_msgh;
58 } mach_io_iterator_next_request_t;
60 typedef struct {
61 mach_msg_header_t rep_msgh;
62 mach_msg_body_t rep_body;
63 mach_msg_port_descriptor_t rep_object;
64 mach_msg_trailer_t rep_trailer;
65 } mach_io_iterator_next_reply_t;
67 /* mach_io_service_open */
69 typedef struct {
70 mach_msg_header_t req_msgh;
71 mach_msg_body_t req_body;
72 mach_msg_port_descriptor_t req_owningtask;
73 mach_ndr_record_t req_ndr;
74 int mach_connect_type;
75 } mach_io_service_open_request_t;
77 typedef struct {
78 mach_msg_header_t rep_msgh;
79 mach_msg_body_t rep_body;
80 mach_msg_port_descriptor_t rep_connect;
81 mach_msg_trailer_t rep_trailer;
82 } mach_io_service_open_reply_t;
84 /* mach_io_connect_method_scalari_scalaro */
86 typedef struct {
87 mach_msg_header_t req_msgh;
88 mach_ndr_record_t req_ndr;
89 int req_selector;
90 mach_msg_type_number_t req_incount;
91 int req_in[0];
92 mach_msg_type_number_t req_outcount;
93 } mach_io_connect_method_scalari_scalaro_request_t;
95 typedef struct {
96 mach_msg_header_t rep_msgh;
97 mach_ndr_record_t rep_ndr;
98 mach_kern_return_t rep_retval;
99 mach_msg_type_number_t rep_outcount;
100 int rep_out[16];
101 mach_msg_trailer_t rep_trailer;
102 } mach_io_connect_method_scalari_scalaro_reply_t;
104 /* io_connect_get_service */
106 typedef struct {
107 mach_msg_header_t req_msgh;
108 } mach_io_connect_get_service_request_t;
110 typedef struct {
111 mach_msg_header_t rep_msgh;
112 mach_msg_body_t rep_body;
113 mach_msg_port_descriptor_t rep_service;
114 mach_msg_trailer_t rep_trailer;
115 } mach_io_connect_get_service_reply_t;
117 /* io_registry_entry_get_property */
119 typedef struct {
120 mach_msg_header_t req_msgh;
121 mach_ndr_record_t req_ndr;
122 mach_msg_type_number_t req_property_nameoffset;
123 mach_msg_type_number_t req_property_namecount;
124 char req_property_name[0];
125 } mach_io_registry_entry_get_property_request_t;
127 typedef struct {
128 mach_msg_header_t rep_msgh;
129 mach_msg_body_t rep_body;
130 mach_msg_ool_descriptor_t rep_properties;
131 mach_ndr_record_t rep_ndr;
132 mach_msg_type_number_t rep_properties_count;
133 mach_msg_trailer_t rep_trailer;
134 } mach_io_registry_entry_get_property_reply_t;
136 /* io_registry_entry_create_iterator */
138 #define MACH_IOKIT_RECURSIVE_ITERATOR 1
139 #define MACH_IOKIT_PARENT_ITERATOR 2
140 typedef struct {
141 mach_msg_header_t req_msgh;
142 mach_ndr_record_t req_ndr;
143 mach_msg_type_number_t req_planeoffset;
144 mach_msg_type_number_t req_planecount;
145 char req_plane[0];
146 int req_options;
147 } mach_io_registry_entry_create_iterator_request_t;
149 typedef struct {
150 mach_msg_header_t rep_msgh;
151 mach_msg_body_t rep_body;
152 mach_msg_port_descriptor_t rep_iterator;
153 mach_msg_trailer_t rep_trailer;
154 } mach_io_registry_entry_create_iterator_reply_t;
156 /* io_object_conforms_to */
158 typedef struct {
159 mach_msg_header_t req_msgh;
160 mach_ndr_record_t req_ndr;
161 mach_msg_type_number_t req_classnameoffset;
162 mach_msg_type_number_t req_classnamecount;
163 char req_classname[0];
164 } mach_io_object_conforms_to_request_t;
166 typedef struct {
167 mach_msg_header_t rep_msgh;
168 mach_ndr_record_t rep_ndr;
169 mach_kern_return_t rep_retval;
170 mach_boolean_t rep_conforms;
171 mach_msg_trailer_t rep_trailer;
172 } mach_io_object_conforms_to_reply_t;
174 /* io_service_add_interest_notification */
176 typedef struct {
177 mach_msg_header_t req_msgh;
178 mach_msg_body_t req_body;
179 mach_msg_port_descriptor_t req_wake_port;
180 mach_ndr_record_t req_ndr;
181 mach_msg_type_number_t req_typeofinterestoffset;
182 mach_msg_type_number_t req_typeofinterestcount;
183 char req_typeofinterest[0];
184 mach_msg_type_number_t req_refcount;
185 mach_natural_t req_ref[0];
186 } mach_io_service_add_interest_notification_request_t;
188 typedef struct {
189 mach_msg_header_t rep_msgh;
190 mach_msg_body_t rep_body;
191 mach_msg_port_descriptor_t rep_notification;
192 mach_msg_trailer_t rep_trailer;
193 } mach_io_service_add_interest_notification_reply_t;
195 /* io_connect_set_notification_port */
197 typedef struct {
198 mach_msg_header_t req_msgh;
199 mach_msg_body_t req_body;
200 mach_msg_port_descriptor_t req_port;
201 mach_ndr_record_t req_ndr;
202 int req_notification_type;
203 int req_reference;
204 } mach_io_connect_set_notification_port_request_t;
206 typedef struct {
207 mach_msg_header_t rep_msgh;
208 mach_ndr_record_t rep_ndr;
209 mach_kern_return_t rep_retval;
210 mach_msg_trailer_t rep_trailer;
211 } mach_io_connect_set_notification_port_reply_t;
213 /* io_registry_get_root_entry */
215 typedef struct {
216 mach_msg_header_t req_msgh;
217 } mach_io_registry_get_root_entry_request_t;
219 typedef struct {
220 mach_msg_header_t rep_msgh;
221 mach_msg_body_t rep_body;
222 mach_msg_port_descriptor_t rep_root;
223 mach_msg_trailer_t rep_trailer;
224 } mach_io_registry_get_root_entry_reply_t;
226 /* io_registry_entry_get_child_iterator */
228 typedef struct {
229 mach_msg_header_t req_msgh;
230 mach_ndr_record_t req_ndr;
231 mach_msg_type_number_t req_planeoffset;
232 mach_msg_type_number_t req_planecount;
233 char req_plane[0];
234 } mach_io_registry_entry_get_child_iterator_request_t;
236 typedef struct {
237 mach_msg_header_t rep_msgh;
238 mach_msg_body_t rep_body;
239 mach_msg_port_descriptor_t rep_iterator;
240 mach_msg_trailer_t rep_trailer;
241 } mach_io_registry_entry_get_child_iterator_reply_t;
243 /* io_registry_entry_get_name_in_plane */
245 typedef struct {
246 mach_msg_header_t req_msgh;
247 mach_ndr_record_t req_ndr;
248 mach_msg_type_number_t req_planeoffset;
249 mach_msg_type_number_t req_planecount;
250 char req_plane[0];
251 } mach_io_registry_entry_get_name_in_plane_request_t;
253 typedef struct {
254 mach_msg_header_t rep_msgh;
255 mach_ndr_record_t rep_ndr;
256 mach_kern_return_t rep_retval;
257 mach_msg_type_number_t rep_nameoffset;
258 mach_msg_type_number_t rep_namecount;
259 char rep_name[128];
260 mach_msg_trailer_t rep_trailer;
261 } mach_io_registry_entry_get_name_in_plane_reply_t;
263 /* io_object_get_class */
265 typedef struct {
266 mach_msg_header_t req_msgh;
267 } mach_io_object_get_class_request_t;
269 typedef struct {
270 mach_msg_header_t rep_msgh;
271 mach_ndr_record_t rep_ndr;
272 mach_kern_return_t rep_retval;
273 mach_msg_type_number_t rep_nameoffset;
274 mach_msg_type_number_t rep_namecount;
275 char rep_name[128];
276 mach_msg_trailer_t rep_trailer;
277 } mach_io_object_get_class_reply_t;
279 /* io_registry_entry_get_location_in_plane */
281 typedef struct {
282 mach_msg_header_t req_msgh;
283 mach_ndr_record_t req_ndr;
284 mach_msg_type_number_t req_nameoffset;
285 mach_msg_type_number_t req_namecount;
286 char req_plane[0];
287 } mach_io_registry_entry_get_location_in_plane_request_t;
289 typedef struct {
290 mach_msg_header_t rep_msgh;
291 mach_ndr_record_t rep_ndr;
292 mach_kern_return_t rep_retval;
293 mach_msg_type_number_t rep_locationoffset;
294 mach_msg_type_number_t rep_locationcount;
295 char rep_location[128];
296 mach_msg_trailer_t rep_trailer;
297 } mach_io_registry_entry_get_location_in_plane_reply_t;
299 /* io_registry_entry_get_properties */
301 typedef struct {
302 mach_msg_header_t req_msgh;
303 } mach_io_registry_entry_get_properties_request_t;
305 typedef struct {
306 mach_msg_header_t rep_msgh;
307 mach_msg_body_t rep_body;
308 mach_msg_ool_descriptor_t rep_properties;
309 mach_ndr_record_t rep_ndr;
310 mach_msg_type_number_t rep_count;
311 mach_msg_trailer_t rep_trailer;
312 } mach_io_registry_entry_get_properties_reply_t;
314 /* io_registry_entry_get_path */
316 typedef struct {
317 mach_msg_header_t req_msgh;
318 mach_ndr_record_t req_ndr;
319 mach_msg_type_number_t req_offset;
320 mach_msg_type_number_t req_count;
321 char req_plane[0];
322 } mach_io_registry_entry_get_path_request_t;
324 typedef struct {
325 mach_msg_header_t rep_msgh;
326 mach_ndr_record_t rep_ndr;
327 mach_kern_return_t rep_retval;
328 mach_msg_type_number_t rep_offset;
329 mach_msg_type_number_t rep_count;
330 char rep_path[512];
331 mach_msg_trailer_t rep_trailer;
332 } mach_io_registry_entry_get_path_reply_t;
334 /* io_connect_map_memory */
336 typedef struct {
337 mach_msg_header_t req_msgh;
338 mach_msg_body_t req_body;
339 mach_msg_port_descriptor_t req_task;
340 mach_ndr_record_t req_ndr;
341 int req_memtype;
342 mach_vm_address_t req_addr;
343 mach_vm_size_t req_len;
344 int req_flags;
345 } mach_io_connect_map_memory_request_t;
347 typedef struct {
348 mach_msg_header_t rep_msgh;
349 mach_ndr_record_t rep_ndr;
350 mach_kern_return_t rep_retval;
351 mach_vm_address_t rep_addr;
352 mach_vm_size_t rep_len;
353 mach_msg_trailer_t rep_trailer;
354 } mach_io_connect_map_memory_reply_t;
356 /* io_iterator_reset */
358 typedef struct {
359 mach_msg_header_t req_msgh;
360 #if 0 /* Is it optional? Darwin don't include them */
361 mach_ndr_record_t req_ndr;
362 int req_flags;
363 #endif
364 } mach_io_iterator_reset_request_t;
366 typedef struct {
367 mach_msg_header_t rep_msgh;
368 mach_ndr_record_t rep_ndr;
369 mach_kern_return_t rep_retval;
370 mach_msg_trailer_t rep_trailer;
371 } mach_io_iterator_reset_reply_t;
373 /* io_connect_set_properties */
375 typedef struct {
376 mach_msg_header_t req_msgh;
377 mach_msg_body_t req_body;
378 mach_msg_ool_descriptor_t req_properties;
379 mach_ndr_record_t req_ndr;
380 mach_msg_type_number_t req_count;
381 } mach_io_connect_set_properties_request_t;
383 typedef struct {
384 mach_msg_header_t rep_msgh;
385 mach_ndr_record_t rep_ndr;
386 mach_kern_return_t rep_retval;
387 mach_natural_t rep_result;
388 mach_msg_trailer_t rep_trailer;
389 } mach_io_connect_set_properties_reply_t;
391 /* io_connect_method_scalari_structo */
393 typedef struct {
394 mach_msg_header_t req_msgh;
395 mach_ndr_record_t req_ndr;
396 int req_selector;
397 mach_msg_type_number_t req_incount;
398 int req_in[0];
399 mach_msg_type_number_t req_outcount;
400 } mach_io_connect_method_scalari_structo_request_t;
402 typedef struct {
403 mach_msg_header_t rep_msgh;
404 mach_ndr_record_t rep_ndr;
405 mach_kern_return_t rep_retval;
406 mach_msg_type_number_t rep_outcount;
407 char rep_out[4096];
408 mach_msg_trailer_t rep_trailer;
409 } mach_io_connect_method_scalari_structo_reply_t;
411 /* io_connect_method_structi_structo */
413 typedef struct {
414 mach_msg_header_t req_msgh;
415 mach_ndr_record_t req_ndr;
416 int req_selector;
417 mach_msg_type_number_t req_incount;
418 char req_in[0];
419 mach_msg_type_number_t req_outcount;
420 } mach_io_connect_method_structi_structo_request_t;
422 typedef struct {
423 mach_msg_header_t rep_msgh;
424 mach_ndr_record_t rep_ndr;
425 mach_kern_return_t rep_retval;
426 mach_msg_type_number_t rep_outcount;
427 char rep_out[4096];
428 mach_msg_trailer_t rep_trailer;
429 } mach_io_connect_method_structi_structo_reply_t;
431 /* io_service_close */
433 typedef struct {
434 mach_msg_header_t req_msgh;
435 } mach_io_service_close_request_t;
437 typedef struct {
438 mach_msg_header_t rep_msgh;
439 mach_ndr_record_t rep_ndr;
440 mach_kern_return_t rep_retval;
441 mach_msg_trailer_t rep_trailer;
442 } mach_io_service_close_reply_t;
444 /* io_connect_add_client */
446 typedef struct {
447 mach_msg_header_t req_msgh;
448 mach_msg_body_t req_body;
449 mach_msg_port_descriptor_t req_connect;
450 } mach_io_connect_add_client_request_t;
452 typedef struct {
453 mach_msg_header_t rep_msgh;
454 mach_ndr_record_t rep_ndr;
455 mach_kern_return_t rep_retval;
456 mach_msg_trailer_t rep_trailer;
457 } mach_io_connect_add_client_reply_t;
459 /* io_connect_method_scalari_structi */
461 typedef struct {
462 mach_msg_header_t req_msgh;
463 mach_ndr_record_t req_ndr;
464 int req_selector;
465 mach_msg_type_number_t req_incount;
466 int req_in[0];
467 mach_msg_type_number_t req_instructcount;
468 char req_instruct[0];
469 } mach_io_connect_method_scalari_structi_request_t;
471 typedef struct {
472 mach_msg_header_t rep_msgh;
473 mach_ndr_record_t rep_ndr;
474 mach_kern_return_t rep_retval;
475 mach_msg_trailer_t rep_trailer;
476 } mach_io_connect_method_scalari_structi_reply_t;
478 /* io_registry_entry_from_path */
480 typedef struct {
481 mach_msg_header_t req_msgh;
482 mach_ndr_record_t req_ndr;
483 mach_msg_type_number_t req_pathoffset;
484 mach_msg_type_number_t req_pathcount;
485 char req_path[0];
486 } mach_io_registry_entry_from_path_request_t;
488 typedef struct {
489 mach_msg_header_t rep_msgh;
490 mach_msg_body_t rep_body;
491 mach_msg_port_descriptor_t rep_entry;
492 mach_msg_trailer_t rep_trailer;
493 } mach_io_registry_entry_from_path_reply_t;
495 /* io_registry_entry_get_parent_iterator */
497 typedef struct {
498 mach_msg_header_t req_msgh;
499 mach_ndr_record_t req_ndr;
500 mach_msg_type_number_t req_offset;
501 mach_msg_type_number_t req_count;
502 char req_plane[0];
503 } mach_io_registry_entry_get_parent_iterator_request_t;
505 typedef struct {
506 mach_msg_header_t rep_msgh;
507 mach_msg_body_t rep_body;
508 mach_msg_port_descriptor_t rep_iterator;
509 mach_msg_trailer_t rep_trailer;
510 } mach_io_registry_entry_get_parent_iterator_reply_t;
513 /* Kernel-private structures */
515 extern struct mach_iokit_devclass *mach_iokit_devclasses[];
517 struct mach_iokit_property {
518 const char *mip_name;
519 const char *mip_value;
522 struct mach_device_iterator {
523 int mdi_current;
524 struct mach_iokit_devclass *mdi_devices[1];
527 /* Make this dynamic if it ever gets useful */
528 #define MACH_IOKIT_MAX_PARENTS 8
529 struct mach_iokit_devclass {
530 const char *mid_string;
531 struct mach_iokit_devclass *mid_parent[MACH_IOKIT_MAX_PARENTS];
532 const char *mid_properties;
533 struct mach_iokit_property *mid_properties_array;
534 int (*mid_connect_method_scalari_scalaro)(struct mach_trap_args *);
535 int (*mid_connect_method_scalari_structo)(struct mach_trap_args *);
536 int (*mid_connect_method_structi_structo)(struct mach_trap_args *);
537 int (*mid_connect_method_scalari_structi)(struct mach_trap_args *);
538 int (*mid_connect_map_memory)(struct mach_trap_args *);
539 const char *mid_name;
540 struct mach_right *mid_notify;
543 extern struct mach_iokit_devclass mach_ioroot_devclass;
545 void mach_iokit_cleanup_notify(struct mach_right *);
547 #endif /* _MACH_IOKIT_H_ */