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