1 /* $NetBSD: mach_iokit.h,v 1.25 2005/12/11 12:20:20 christos Exp $ */
4 * Copyright (c) 2003 The NetBSD Foundation, Inc.
7 * This code is derived from software contributed to The NetBSD Foundation
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
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 */
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
;
45 } mach_io_service_get_matching_services_request_t
;
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 */
57 mach_msg_header_t req_msgh
;
58 } mach_io_iterator_next_request_t
;
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 */
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
;
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 */
87 mach_msg_header_t req_msgh
;
88 mach_ndr_record_t req_ndr
;
90 mach_msg_type_number_t req_incount
;
92 mach_msg_type_number_t req_outcount
;
93 } mach_io_connect_method_scalari_scalaro_request_t
;
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
;
101 mach_msg_trailer_t rep_trailer
;
102 } mach_io_connect_method_scalari_scalaro_reply_t
;
104 /* io_connect_get_service */
107 mach_msg_header_t req_msgh
;
108 } mach_io_connect_get_service_request_t
;
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 */
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
;
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
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
;
147 } mach_io_registry_entry_create_iterator_request_t
;
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 */
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
;
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 */
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
;
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 */
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
;
204 } mach_io_connect_set_notification_port_request_t
;
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 */
216 mach_msg_header_t req_msgh
;
217 } mach_io_registry_get_root_entry_request_t
;
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 */
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
;
234 } mach_io_registry_entry_get_child_iterator_request_t
;
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 */
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
;
251 } mach_io_registry_entry_get_name_in_plane_request_t
;
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
;
260 mach_msg_trailer_t rep_trailer
;
261 } mach_io_registry_entry_get_name_in_plane_reply_t
;
263 /* io_object_get_class */
266 mach_msg_header_t req_msgh
;
267 } mach_io_object_get_class_request_t
;
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
;
276 mach_msg_trailer_t rep_trailer
;
277 } mach_io_object_get_class_reply_t
;
279 /* io_registry_entry_get_location_in_plane */
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
;
287 } mach_io_registry_entry_get_location_in_plane_request_t
;
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 */
302 mach_msg_header_t req_msgh
;
303 } mach_io_registry_entry_get_properties_request_t
;
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 */
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
;
322 } mach_io_registry_entry_get_path_request_t
;
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
;
331 mach_msg_trailer_t rep_trailer
;
332 } mach_io_registry_entry_get_path_reply_t
;
334 /* io_connect_map_memory */
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
;
342 mach_vm_address_t req_addr
;
343 mach_vm_size_t req_len
;
345 } mach_io_connect_map_memory_request_t
;
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 */
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
;
364 } mach_io_iterator_reset_request_t
;
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 */
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
;
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 */
394 mach_msg_header_t req_msgh
;
395 mach_ndr_record_t req_ndr
;
397 mach_msg_type_number_t req_incount
;
399 mach_msg_type_number_t req_outcount
;
400 } mach_io_connect_method_scalari_structo_request_t
;
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
;
408 mach_msg_trailer_t rep_trailer
;
409 } mach_io_connect_method_scalari_structo_reply_t
;
411 /* io_connect_method_structi_structo */
414 mach_msg_header_t req_msgh
;
415 mach_ndr_record_t req_ndr
;
417 mach_msg_type_number_t req_incount
;
419 mach_msg_type_number_t req_outcount
;
420 } mach_io_connect_method_structi_structo_request_t
;
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
;
428 mach_msg_trailer_t rep_trailer
;
429 } mach_io_connect_method_structi_structo_reply_t
;
431 /* io_service_close */
434 mach_msg_header_t req_msgh
;
435 } mach_io_service_close_request_t
;
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 */
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
;
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 */
462 mach_msg_header_t req_msgh
;
463 mach_ndr_record_t req_ndr
;
465 mach_msg_type_number_t req_incount
;
467 mach_msg_type_number_t req_instructcount
;
468 char req_instruct
[0];
469 } mach_io_connect_method_scalari_structi_request_t
;
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 */
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
;
486 } mach_io_registry_entry_from_path_request_t
;
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 */
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
;
503 } mach_io_registry_entry_get_parent_iterator_request_t
;
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
{
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_ */