2 * Copyright (c) 1998-2014 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@
32 * Mach Operating System
33 * Copyright (c) 1991,1990,1989 Carnegie Mellon University
34 * All Rights Reserved.
36 * Permission to use, copy, modify and distribute this software and its
37 * documentation is hereby granted, provided that both the copyright
38 * notice and this permission notice appear in all copies of the
39 * software, derivative works or modified versions, and any portions
40 * thereof, and that both notices appear in supporting documentation.
42 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
43 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
44 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
46 * Carnegie Mellon requests users of this software to return to
48 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
49 * School of Computer Science
50 * Carnegie Mellon University
51 * Pittsburgh PA 15213-3890
53 * any improvements or extensions that they make and grant Carnegie Mellon
54 * the rights to redistribute these changes.
57 * File: device/device.defs
61 * Mach device support. Mach devices are accessed through
62 * block and character device interfaces to the kernel.
68 #endif /* KERNEL_SERVER */
71 #if IOKITSIMD || KERNEL_SERVER
72 #define IOKIT_ALL_IPC 1
75 #include <mach/std_types.defs>
76 #include <mach/mach_types.defs>
77 #include <mach/clock_types.defs>
78 #include <mach/clock_types.defs>
84 import <device/device_types.h>;
88 type reply_port_t = MACH_MSG_TYPE_MAKE_SEND_ONCE | polymorphic
93 type io_name_t = c_string[*:128];
94 type io_string_t = c_string[*:512];
95 type io_string_inband_t = c_string[*:4096];
96 type io_struct_inband_t = array[*:4096] of char;
97 type io_buf_ptr_t = ^array[] of MACH_MSG_TYPE_INTEGER_8;
98 type NDR_record_t = struct[8] of char;
101 type io_user_scalar_t = uint64_t;
102 type io_user_reference_t = uint64_t;
103 type io_scalar_inband_t = array[*:16] of int;
104 // must be the same type as OSAsyncReference
105 type io_async_ref_t = array[*:8] of natural_t;
106 type io_scalar_inband64_t = array[*:16] of io_user_scalar_t;
107 type io_async_ref64_t = array[*:8] of io_user_reference_t;
109 type io_user_scalar_t = uint64_t;
110 type io_user_reference_t = uint64_t;
111 type io_scalar_inband_t = array[*:16] of io_user_scalar_t;
112 type io_async_ref_t = array[*:8] of io_user_reference_t;
113 type io_scalar_inband64_t = array[*:16] of io_user_scalar_t;
114 type io_async_ref64_t = array[*:8] of io_user_reference_t;
116 type io_user_scalar_t = int;
117 type io_user_reference_t = natural_t;
118 type io_scalar_inband_t = array[*:16] of io_user_scalar_t;
119 type io_async_ref_t = array[*:8] of io_user_reference_t;
120 type io_scalar_inband64_t = array[*:16] of uint64_t;
121 type io_async_ref64_t = array[*:8] of uint64_t;
124 type io_object_t = mach_port_t
127 intran: io_object_t iokit_lookup_object_port(mach_port_t)
128 outtran: mach_port_t iokit_make_object_port(io_object_t)
129 destructor: iokit_remove_reference(io_object_t)
130 #endif /* KERNEL_SERVER */
133 type io_connect_t = mach_port_t
136 intran: io_connect_t iokit_lookup_connect_port(mach_port_t)
137 outtran: mach_port_t iokit_make_connect_port(io_connect_t)
138 destructor: iokit_remove_reference(io_connect_t)
139 #endif /* KERNEL_SERVER */
142 routine io_object_get_class(
143 object : io_object_t;
144 out className : io_name_t
147 routine io_object_conforms_to(
148 object : io_object_t;
149 in className : io_name_t;
150 out conforms : boolean_t
153 routine io_iterator_next(
154 iterator : io_object_t;
155 out object : io_object_t
158 routine io_iterator_reset(
159 iterator : io_object_t
162 routine io_service_get_matching_services(
163 master_port : mach_port_t;
164 in matching : io_string_t;
165 out existing : io_object_t
168 routine io_registry_entry_get_property(
169 registry_entry : io_object_t;
170 in property_name : io_name_t;
171 out properties : io_buf_ptr_t, physicalcopy
174 routine io_registry_create_iterator(
175 master_port : mach_port_t;
176 in plane : io_name_t;
177 in options : uint32_t;
178 out iterator : io_object_t
181 routine io_registry_iterator_enter_entry(
182 iterator : io_object_t
185 routine io_registry_iterator_exit_entry(
186 iterator : io_object_t
189 routine io_registry_entry_from_path(
190 master_port : mach_port_t;
191 in path : io_string_t;
192 out registry_entry : io_object_t
195 routine io_registry_entry_get_name(
196 registry_entry : io_object_t;
200 routine io_registry_entry_get_properties(
201 registry_entry : io_object_t;
202 out properties : io_buf_ptr_t, physicalcopy
205 routine io_registry_entry_get_property_bytes(
206 registry_entry : io_object_t;
207 in property_name : io_name_t;
208 out data : io_struct_inband_t, CountInOut
211 routine io_registry_entry_get_child_iterator(
212 registry_entry : io_object_t;
213 in plane : io_name_t;
214 out iterator : io_object_t
217 routine io_registry_entry_get_parent_iterator(
218 registry_entry : io_object_t;
219 in plane : io_name_t;
220 out iterator : io_object_t
224 /* was routine io_service_open
225 service : io_object_t;
226 in owningTask : task_t;
227 in connect_type : uint32_t;
228 out connection : io_connect_t
232 routine io_service_close(
233 connection : io_connect_t
236 routine io_connect_get_service(
237 connection : io_connect_t;
238 out service : io_object_t
241 #if IOKIT_ALL_IPC || __ILP32__
242 routine io_connect_set_notification_port(
243 connection : io_connect_t;
244 in notification_type : uint32_t;
245 in port : mach_port_make_send_t;
246 in reference : uint32_t
249 routine io_connect_map_memory(
250 connection : io_connect_t;
251 in memory_type : uint32_t;
252 in into_task : task_t;
254 inout address : uint32_t;
255 inout size : uint32_t;
257 inout address : vm_address_t;
258 inout size : vm_size_t;
267 routine io_connect_add_client(
268 connection : io_connect_t;
269 in connect_to : io_connect_t
272 routine io_connect_set_properties(
273 connection : io_connect_t;
274 in properties : io_buf_ptr_t, physicalcopy;
275 out result : kern_return_t
278 #if IOKIT_ALL_IPC || __ILP32__
279 routine io_connect_method_scalarI_scalarO(
280 connection : io_connect_t;
281 in selector : uint32_t;
282 in input : io_scalar_inband_t;
283 out output : io_scalar_inband_t, CountInOut
286 routine io_connect_method_scalarI_structureO(
287 connection : io_connect_t;
288 in selector : uint32_t;
289 in input : io_scalar_inband_t;
290 out output : io_struct_inband_t, CountInOut
293 routine io_connect_method_scalarI_structureI(
294 connection : io_connect_t;
295 in selector : uint32_t;
296 in input : io_scalar_inband_t;
297 in inputStruct : io_struct_inband_t
300 routine io_connect_method_structureI_structureO(
301 connection : io_connect_t;
302 in selector : uint32_t;
303 in input : io_struct_inband_t;
304 out output : io_struct_inband_t, CountInOut
313 routine io_registry_entry_get_path(
314 registry_entry : io_object_t;
315 in plane : io_name_t;
316 out path : io_string_t
319 routine io_registry_get_root_entry(
320 master_port : mach_port_t;
321 out root : io_object_t
324 routine io_registry_entry_set_properties(
325 registry_entry : io_object_t;
326 in properties : io_buf_ptr_t, physicalcopy;
327 out result : kern_return_t
330 routine io_registry_entry_in_plane(
331 registry_entry : io_object_t;
332 in plane : io_name_t;
333 out inPlane : boolean_t
336 routine io_object_get_retain_count(
337 object : io_object_t;
338 out retainCount : uint32_t
341 routine io_service_get_busy_state(
342 service : io_object_t;
343 out busyState : uint32_t
346 routine io_service_wait_quiet(
347 service : io_object_t;
348 wait_time : mach_timespec_t
351 routine io_registry_entry_create_iterator(
352 registry_entry : io_object_t;
353 in plane : io_name_t;
354 in options : uint32_t;
355 out iterator : io_object_t
358 routine io_iterator_is_valid(
359 iterator : io_object_t;
360 out is_valid : boolean_t
364 /* was routine io_make_matching(
365 master_port : mach_port_t;
366 in of_type : uint32_t;
367 in options : uint32_t;
368 in input : io_struct_inband_t;
369 out matching : io_string_t
373 routine io_catalog_send_data(
374 master_port : mach_port_t;
376 in inData : io_buf_ptr_t;
377 out result : kern_return_t
380 routine io_catalog_terminate(
381 master_port : mach_port_t;
386 routine io_catalog_get_data(
387 master_port : mach_port_t;
389 out outData : io_buf_ptr_t
392 routine io_catalog_get_gen_count(
393 master_port : mach_port_t;
394 out genCount : uint32_t
397 routine io_catalog_module_loaded(
398 master_port : mach_port_t;
402 routine io_catalog_reset(
403 master_port : mach_port_t;
407 routine io_service_request_probe(
408 service : io_object_t;
409 in options : uint32_t
412 routine io_registry_entry_get_name_in_plane(
413 registry_entry : io_object_t;
414 in plane : io_name_t;
418 routine io_service_match_property_table(
419 service : io_object_t;
420 in matching : io_string_t;
421 out matches : boolean_t
424 #if IOKIT_ALL_IPC || __ILP32__
425 routine io_async_method_scalarI_scalarO(
426 connection : io_connect_t;
427 in wake_port : mach_port_make_send_t;
428 in reference : io_async_ref_t;
429 in selector : uint32_t;
430 in input : io_scalar_inband_t;
431 out output : io_scalar_inband_t, CountInOut
433 routine io_async_method_scalarI_structureO(
434 connection : io_connect_t;
435 in wake_port : mach_port_make_send_t;
436 in reference : io_async_ref_t;
437 in selector : uint32_t;
438 in input : io_scalar_inband_t;
439 out output : io_struct_inband_t, CountInOut
441 routine io_async_method_scalarI_structureI(
442 connection : io_connect_t;
443 in wake_port : mach_port_make_send_t;
444 in reference : io_async_ref_t;
445 in selector : uint32_t;
446 in input : io_scalar_inband_t;
447 in inputStruct : io_struct_inband_t
449 routine io_async_method_structureI_structureO(
450 connection : io_connect_t;
451 in wake_port : mach_port_make_send_t;
452 in reference : io_async_ref_t;
453 in selector : uint32_t;
454 in input : io_struct_inband_t;
455 out output : io_struct_inband_t, CountInOut
464 #if IOKIT_ALL_IPC || __ILP32__
465 routine io_service_add_notification(
466 master_port : mach_port_t;
467 in notification_type : io_name_t;
468 in matching : io_string_t;
469 in wake_port : mach_port_make_send_t;
470 in reference : io_async_ref_t;
471 out notification : io_object_t
473 routine io_service_add_interest_notification(
474 service : io_object_t;
475 in type_of_interest : io_name_t;
476 in wake_port : mach_port_make_send_t;
477 in reference : io_async_ref_t;
478 out notification : io_object_t
480 routine io_service_acknowledge_notification(
481 service : io_object_t;
482 in notify_ref : natural_t;
483 in response : natural_t
491 routine io_connect_get_notification_semaphore(
492 connection : io_connect_t;
493 in notification_type : natural_t;
494 out semaphore : semaphore_t
497 #if IOKIT_ALL_IPC || __ILP32__
498 routine io_connect_unmap_memory(
499 connection : io_connect_t;
500 in memory_type : uint32_t;
501 in into_task : task_t;
503 in address : uint32_t
505 in address : vm_address_t
512 routine io_registry_entry_get_location_in_plane(
513 registry_entry : io_object_t;
514 in plane : io_name_t;
515 out location : io_name_t
518 routine io_registry_entry_get_property_recursively(
519 registry_entry : io_object_t;
520 in plane : io_name_t;
521 in property_name : io_name_t;
522 in options : uint32_t;
523 out properties : io_buf_ptr_t, physicalcopy
526 routine io_service_get_state(
527 service : io_object_t;
528 out state : uint64_t;
529 out busy_state : uint32_t;
530 out accumulated_busy_time : uint64_t
533 routine io_service_get_matching_services_ool(
534 master_port : mach_port_t;
535 in matching : io_buf_ptr_t, physicalcopy;
536 out result : kern_return_t;
537 out existing : io_object_t
540 routine io_service_match_property_table_ool(
541 service : io_object_t;
542 in matching : io_buf_ptr_t, physicalcopy;
543 out result : kern_return_t;
544 out matches : boolean_t
547 #if IOKIT_ALL_IPC || __ILP32__
548 routine io_service_add_notification_ool(
549 master_port : mach_port_t;
550 in notification_type : io_name_t;
551 in matching : io_buf_ptr_t, physicalcopy;
552 in wake_port : mach_port_make_send_t;
553 in reference : io_async_ref_t;
554 out result : kern_return_t;
555 out notification : io_object_t
561 routine io_object_get_superclass(
562 master_port : mach_port_t;
563 in obj_name : io_name_t;
564 out class_name : io_name_t
567 routine io_object_get_bundle_identifier(
568 master_port : mach_port_t;
569 in obj_name : io_name_t;
570 out class_name : io_name_t
573 routine io_service_open_extended(
574 service : io_object_t;
575 in owningTask : task_t;
576 in connect_type : uint32_t;
577 in ndr : NDR_record_t;
578 in properties : io_buf_ptr_t, physicalcopy;
579 out result : kern_return_t;
580 out connection : io_connect_t
584 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
586 routine io_connect_map_memory_into_task(
587 connection : io_connect_t;
588 in memory_type : uint32_t;
589 in into_task : task_t;
590 inout address : mach_vm_address_t;
591 inout size : mach_vm_size_t;
595 routine io_connect_unmap_memory_from_task(
596 connection : io_connect_t;
597 in memory_type : uint32_t;
598 in from_task : task_t;
599 in address : mach_vm_address_t
602 routine io_connect_method(
603 connection : io_connect_t;
604 in selector : uint32_t;
606 in scalar_input : io_scalar_inband64_t;
607 in inband_input : io_struct_inband_t;
608 in ool_input : mach_vm_address_t;
609 in ool_input_size : mach_vm_size_t;
611 out inband_output : io_struct_inband_t, CountInOut;
612 out scalar_output : io_scalar_inband64_t, CountInOut;
613 in ool_output : mach_vm_address_t;
614 inout ool_output_size : mach_vm_size_t
617 routine io_connect_async_method(
618 connection : io_connect_t;
619 in wake_port : mach_port_make_send_t;
620 in reference : io_async_ref64_t;
621 in selector : uint32_t;
623 in scalar_input : io_scalar_inband64_t;
624 in inband_input : io_struct_inband_t;
625 in ool_input : mach_vm_address_t;
626 in ool_input_size : mach_vm_size_t;
628 out inband_output : io_struct_inband_t, CountInOut;
629 out scalar_output : io_scalar_inband64_t, CountInOut;
630 in ool_output : mach_vm_address_t;
631 inout ool_output_size : mach_vm_size_t
635 #if IOKIT_ALL_IPC || __LP64__
638 #define FUNC_NAME(name) name ## _64
640 #define FUNC_NAME(name) name
643 routine FUNC_NAME(io_connect_set_notification_port)(
644 connection : io_connect_t;
645 in notification_type : uint32_t;
646 in port : mach_port_make_send_t;
647 in reference : io_user_reference_t
650 routine FUNC_NAME(io_service_add_notification)(
651 master_port : mach_port_t;
652 in notification_type : io_name_t;
653 in matching : io_string_t;
654 in wake_port : mach_port_make_send_t;
655 in reference : io_async_ref64_t;
656 out notification : io_object_t
659 routine FUNC_NAME(io_service_add_interest_notification)(
660 service : io_object_t;
661 in type_of_interest : io_name_t;
662 in wake_port : mach_port_make_send_t;
663 in reference : io_async_ref64_t;
664 out notification : io_object_t
667 routine FUNC_NAME(io_service_add_notification_ool)(
668 master_port : mach_port_t;
669 in notification_type : io_name_t;
670 in matching : io_buf_ptr_t, physicalcopy;
671 in wake_port : mach_port_make_send_t;
672 in reference : io_async_ref64_t;
673 out result : kern_return_t;
674 out notification : io_object_t
684 #endif /* IOKIT_ALL_IPC || __LP64__ */
686 routine io_registry_entry_get_registry_entry_id(
687 registry_entry : io_object_t;
688 out entry_id : uint64_t
691 routine io_connect_method_var_output(
692 connection : io_connect_t;
693 in selector : uint32_t;
695 in scalar_input : io_scalar_inband64_t;
696 in inband_input : io_struct_inband_t;
697 in ool_input : mach_vm_address_t;
698 in ool_input_size : mach_vm_size_t;
700 out inband_output : io_struct_inband_t, CountInOut;
701 out scalar_output : io_scalar_inband64_t, CountInOut;
702 out var_output : io_buf_ptr_t, physicalcopy
705 routine io_service_get_matching_service(
706 master_port : mach_port_t;
707 in matching : io_string_t;
708 out service : io_object_t
711 routine io_service_get_matching_service_ool(
712 master_port : mach_port_t;
713 in matching : io_buf_ptr_t, physicalcopy;
714 out result : kern_return_t;
715 out service : io_object_t
718 routine io_service_get_authorization_id(
719 service : io_object_t;
720 out authorization_id : uint64_t
723 routine io_service_set_authorization_id(
724 service : io_object_t;
725 in authorization_id : uint64_t
730 routine io_server_version(
731 master_port : mach_port_t;
732 out version : uint64_t
735 routine io_registry_entry_get_properties_bin(
736 registry_entry : io_object_t;
737 out properties : io_buf_ptr_t, physicalcopy
740 routine io_registry_entry_get_property_bin(
741 registry_entry : io_object_t;
742 in plane : io_name_t;
743 in property_name : io_name_t;
744 in options : uint32_t;
745 out properties : io_buf_ptr_t, physicalcopy
748 routine io_service_get_matching_service_bin(
749 master_port : mach_port_t;
750 in matching : io_struct_inband_t;
751 out service : io_object_t
754 routine io_service_get_matching_services_bin(
755 master_port : mach_port_t;
756 in matching : io_struct_inband_t;
757 out existing : io_object_t
760 routine io_service_match_property_table_bin(
761 service : io_object_t;
762 in matching : io_struct_inband_t;
763 out matches : boolean_t
766 #if IOKIT_ALL_IPC || __ILP32__
767 routine io_service_add_notification_bin(
768 master_port : mach_port_t;
769 in notification_type : io_name_t;
770 in matching : io_struct_inband_t;
771 in wake_port : mach_port_make_send_t;
772 in reference : io_async_ref_t;
773 out notification : io_object_t
779 #if IOKIT_ALL_IPC || __LP64__
780 routine FUNC_NAME(io_service_add_notification_bin)(
781 master_port : mach_port_t;
782 in notification_type : io_name_t;
783 in matching : io_struct_inband_t;
784 in wake_port : mach_port_make_send_t;
785 in reference : io_async_ref64_t;
786 out notification : io_object_t
794 routine io_registry_entry_get_path_ool(
795 registry_entry : io_object_t;
796 in plane : io_name_t;
797 out path : io_string_inband_t;
798 out path_ool : io_buf_ptr_t, physicalcopy
801 routine io_registry_entry_from_path_ool(
802 master_port : mach_port_t;
803 in path : io_string_inband_t;
804 in path_ool : io_buf_ptr_t, physicalcopy;
805 out result : kern_return_t;
806 out registry_entry : io_object_t
813 /* vim: set ft=c : */