2 * Copyright (c) 2000 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 #include <mach/std_types.defs>
72 #include <mach/mach_types.defs>
73 #include <mach/clock_types.defs>
74 #include <mach/clock_types.defs>
80 import <device/device_types.h>;
84 type reply_port_t = MACH_MSG_TYPE_MAKE_SEND_ONCE | polymorphic
89 type io_name_t = c_string[*:128];
90 type io_string_t = c_string[*:512];
91 type io_struct_inband_t = array[*:4096] of char;
92 type io_buf_ptr_t = ^array[] of MACH_MSG_TYPE_INTEGER_8;
93 type NDR_record_t = struct[8] of char;
96 type io_user_scalar_t = uint64_t;
97 type io_user_reference_t = uint64_t;
98 type io_scalar_inband_t = array[*:16] of int;
99 // must be the same type as OSAsyncReference
100 type io_async_ref_t = array[*:8] of natural_t;
101 type io_scalar_inband64_t = array[*:16] of io_user_scalar_t;
102 type io_async_ref64_t = array[*:8] of io_user_reference_t;
104 type io_user_scalar_t = uint64_t;
105 type io_user_reference_t = uint64_t;
106 type io_scalar_inband_t = array[*:16] of io_user_scalar_t;
107 type io_async_ref_t = array[*:8] of io_user_reference_t;
108 type io_scalar_inband64_t = array[*:16] of io_user_scalar_t;
109 type io_async_ref64_t = array[*:8] of io_user_reference_t;
111 type io_user_scalar_t = int;
112 type io_user_reference_t = natural_t;
113 type io_scalar_inband_t = array[*:16] of io_user_scalar_t;
114 type io_async_ref_t = array[*:8] of io_user_reference_t;
115 type io_scalar_inband64_t = array[*:16] of uint64_t;
116 type io_async_ref64_t = array[*:8] of uint64_t;
119 type io_object_t = mach_port_t
122 intran: io_object_t iokit_lookup_object_port(mach_port_t)
123 outtran: mach_port_t iokit_make_object_port(io_object_t)
124 destructor: iokit_remove_reference(io_object_t)
125 #endif /* KERNEL_SERVER */
128 type io_connect_t = mach_port_t
131 intran: io_connect_t iokit_lookup_connect_port(mach_port_t)
132 outtran: mach_port_t iokit_make_connect_port(io_connect_t)
133 destructor: iokit_remove_reference(io_connect_t)
134 #endif /* KERNEL_SERVER */
137 routine io_object_get_class(
138 object : io_object_t;
139 out className : io_name_t
142 routine io_object_conforms_to(
143 object : io_object_t;
144 in className : io_name_t;
145 out conforms : boolean_t
148 routine io_iterator_next(
149 iterator : io_object_t;
150 out object : io_object_t
153 routine io_iterator_reset(
154 iterator : io_object_t
157 routine io_service_get_matching_services(
158 master_port : mach_port_t;
159 in matching : io_string_t;
160 out existing : io_object_t
163 routine io_registry_entry_get_property(
164 registry_entry : io_object_t;
165 in property_name : io_name_t;
166 out properties : io_buf_ptr_t, physicalcopy
169 routine io_registry_create_iterator(
170 master_port : mach_port_t;
171 in plane : io_name_t;
172 in options : uint32_t;
173 out iterator : io_object_t
176 routine io_registry_iterator_enter_entry(
177 iterator : io_object_t
180 routine io_registry_iterator_exit_entry(
181 iterator : io_object_t
184 routine io_registry_entry_from_path(
185 master_port : mach_port_t;
186 in path : io_string_t;
187 out registry_entry : io_object_t
190 routine io_registry_entry_get_name(
191 registry_entry : io_object_t;
195 routine io_registry_entry_get_properties(
196 registry_entry : io_object_t;
197 out properties : io_buf_ptr_t, physicalcopy
200 routine io_registry_entry_get_property_bytes(
201 registry_entry : io_object_t;
202 in property_name : io_name_t;
203 out data : io_struct_inband_t, CountInOut
206 routine io_registry_entry_get_child_iterator(
207 registry_entry : io_object_t;
208 in plane : io_name_t;
209 out iterator : io_object_t
212 routine io_registry_entry_get_parent_iterator(
213 registry_entry : io_object_t;
214 in plane : io_name_t;
215 out iterator : io_object_t
218 routine io_service_open(
219 service : io_object_t;
220 in owningTask : task_t;
221 in connect_type : uint32_t;
222 out connection : io_connect_t
225 routine io_service_close(
226 connection : io_connect_t
229 routine io_connect_get_service(
230 connection : io_connect_t;
231 out service : io_object_t
234 #if KERNEL_SERVER || __ILP32__
235 routine io_connect_set_notification_port(
236 connection : io_connect_t;
237 in notification_type : uint32_t;
238 in port : mach_port_make_send_t;
239 in reference : uint32_t
242 routine io_connect_map_memory(
243 connection : io_connect_t;
244 in memory_type : uint32_t;
245 in into_task : task_t;
247 inout address : uint32_t;
248 inout size : uint32_t;
250 inout address : vm_address_t;
251 inout size : vm_size_t;
260 routine io_connect_add_client(
261 connection : io_connect_t;
262 in connect_to : io_connect_t
265 routine io_connect_set_properties(
266 connection : io_connect_t;
267 in properties : io_buf_ptr_t, physicalcopy;
268 out result : kern_return_t
271 #if KERNEL_SERVER || (__ILP32__ && !MAP_32B_METHODS)
272 routine io_connect_method_scalarI_scalarO(
273 connection : io_connect_t;
274 in selector : uint32_t;
275 in input : io_scalar_inband_t;
276 out output : io_scalar_inband_t, CountInOut
279 routine io_connect_method_scalarI_structureO(
280 connection : io_connect_t;
281 in selector : uint32_t;
282 in input : io_scalar_inband_t;
283 out output : io_struct_inband_t, CountInOut
286 routine io_connect_method_scalarI_structureI(
287 connection : io_connect_t;
288 in selector : uint32_t;
289 in input : io_scalar_inband_t;
290 in inputStruct : io_struct_inband_t
293 routine io_connect_method_structureI_structureO(
294 connection : io_connect_t;
295 in selector : uint32_t;
296 in input : io_struct_inband_t;
297 out output : io_struct_inband_t, CountInOut
306 routine io_registry_entry_get_path(
307 registry_entry : io_object_t;
308 in plane : io_name_t;
309 out path : io_string_t
312 routine io_registry_get_root_entry(
313 master_port : mach_port_t;
314 out root : io_object_t
317 routine io_registry_entry_set_properties(
318 registry_entry : io_object_t;
319 in properties : io_buf_ptr_t, physicalcopy;
320 out result : kern_return_t
323 routine io_registry_entry_in_plane(
324 registry_entry : io_object_t;
325 in plane : io_name_t;
326 out inPlane : boolean_t
329 routine io_object_get_retain_count(
330 object : io_object_t;
331 out retainCount : uint32_t
334 routine io_service_get_busy_state(
335 service : io_object_t;
336 out busyState : uint32_t
339 routine io_service_wait_quiet(
340 service : io_object_t;
341 wait_time : mach_timespec_t
344 routine io_registry_entry_create_iterator(
345 registry_entry : io_object_t;
346 in plane : io_name_t;
347 in options : uint32_t;
348 out iterator : io_object_t
351 routine io_iterator_is_valid(
352 iterator : io_object_t;
353 out is_valid : boolean_t
356 routine io_make_matching(
357 master_port : mach_port_t;
358 in of_type : uint32_t;
359 in options : uint32_t;
360 in input : io_struct_inband_t;
361 out matching : io_string_t
364 routine io_catalog_send_data(
365 master_port : mach_port_t;
367 in inData : io_buf_ptr_t;
368 out result : kern_return_t
371 routine io_catalog_terminate(
372 master_port : mach_port_t;
377 routine io_catalog_get_data(
378 master_port : mach_port_t;
380 out outData : io_buf_ptr_t
383 routine io_catalog_get_gen_count(
384 master_port : mach_port_t;
385 out genCount : uint32_t
388 routine io_catalog_module_loaded(
389 master_port : mach_port_t;
393 routine io_catalog_reset(
394 master_port : mach_port_t;
398 routine io_service_request_probe(
399 service : io_object_t;
400 in options : uint32_t
403 routine io_registry_entry_get_name_in_plane(
404 registry_entry : io_object_t;
405 in plane : io_name_t;
409 routine io_service_match_property_table(
410 service : io_object_t;
411 in matching : io_string_t;
412 out matches : boolean_t
415 #if KERNEL_SERVER || (__ILP32__ && !MAP_32B_ASYNC_METHODS)
416 routine io_async_method_scalarI_scalarO(
417 connection : io_connect_t;
418 in wake_port : mach_port_make_send_t;
419 in reference : io_async_ref_t;
420 in selector : uint32_t;
421 in input : io_scalar_inband_t;
422 out output : io_scalar_inband_t, CountInOut
424 routine io_async_method_scalarI_structureO(
425 connection : io_connect_t;
426 in wake_port : mach_port_make_send_t;
427 in reference : io_async_ref_t;
428 in selector : uint32_t;
429 in input : io_scalar_inband_t;
430 out output : io_struct_inband_t, CountInOut
432 routine io_async_method_scalarI_structureI(
433 connection : io_connect_t;
434 in wake_port : mach_port_make_send_t;
435 in reference : io_async_ref_t;
436 in selector : uint32_t;
437 in input : io_scalar_inband_t;
438 in inputStruct : io_struct_inband_t
440 routine io_async_method_structureI_structureO(
441 connection : io_connect_t;
442 in wake_port : mach_port_make_send_t;
443 in reference : io_async_ref_t;
444 in selector : uint32_t;
445 in input : io_struct_inband_t;
446 out output : io_struct_inband_t, CountInOut
455 #if KERNEL_SERVER || __ILP32__
456 routine io_service_add_notification(
457 master_port : mach_port_t;
458 in notification_type : io_name_t;
459 in matching : io_string_t;
460 in wake_port : mach_port_make_send_t;
461 in reference : io_async_ref_t;
462 out notification : io_object_t
464 routine io_service_add_interest_notification(
465 service : io_object_t;
466 in type_of_interest : io_name_t;
467 in wake_port : mach_port_make_send_t;
468 in reference : io_async_ref_t;
469 out notification : io_object_t
471 routine io_service_acknowledge_notification(
472 service : io_object_t;
473 in notify_ref : natural_t;
474 in response : natural_t
482 routine io_connect_get_notification_semaphore(
483 connection : io_connect_t;
484 in notification_type : natural_t;
485 out semaphore : semaphore_t
488 #if KERNEL_SERVER || __ILP32__
489 routine io_connect_unmap_memory(
490 connection : io_connect_t;
491 in memory_type : uint32_t;
492 in into_task : task_t;
494 in address : uint32_t
496 in address : vm_address_t
503 routine io_registry_entry_get_location_in_plane(
504 registry_entry : io_object_t;
505 in plane : io_name_t;
506 out location : io_name_t
509 routine io_registry_entry_get_property_recursively(
510 registry_entry : io_object_t;
511 in plane : io_name_t;
512 in property_name : io_name_t;
513 in options : uint32_t;
514 out properties : io_buf_ptr_t, physicalcopy
517 routine io_service_get_state(
518 service : io_object_t;
519 out state : uint64_t;
520 out busy_state : uint32_t;
521 out accumulated_busy_time : uint64_t
524 routine io_service_get_matching_services_ool(
525 master_port : mach_port_t;
526 in matching : io_buf_ptr_t, physicalcopy;
527 out result : kern_return_t;
528 out existing : io_object_t
531 routine io_service_match_property_table_ool(
532 service : io_object_t;
533 in matching : io_buf_ptr_t, physicalcopy;
534 out result : kern_return_t;
535 out matches : boolean_t
538 #if KERNEL_SERVER || __ILP32__
539 routine io_service_add_notification_ool(
540 master_port : mach_port_t;
541 in notification_type : io_name_t;
542 in matching : io_buf_ptr_t, physicalcopy;
543 in wake_port : mach_port_make_send_t;
544 in reference : io_async_ref_t;
545 out result : kern_return_t;
546 out notification : io_object_t
552 routine io_object_get_superclass(
553 master_port : mach_port_t;
554 in obj_name : io_name_t;
555 out class_name : io_name_t
558 routine io_object_get_bundle_identifier(
559 master_port : mach_port_t;
560 in obj_name : io_name_t;
561 out class_name : io_name_t
564 routine io_service_open_extended(
565 service : io_object_t;
566 in owningTask : task_t;
567 in connect_type : uint32_t;
568 in ndr : NDR_record_t;
569 in properties : io_buf_ptr_t, physicalcopy;
570 out result : kern_return_t;
571 out connection : io_connect_t
575 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
577 routine io_connect_map_memory_into_task(
578 connection : io_connect_t;
579 in memory_type : uint32_t;
580 in into_task : task_t;
581 inout address : mach_vm_address_t;
582 inout size : mach_vm_size_t;
586 routine io_connect_unmap_memory_from_task(
587 connection : io_connect_t;
588 in memory_type : uint32_t;
589 in from_task : task_t;
590 in address : mach_vm_address_t
593 routine io_connect_method(
594 connection : io_connect_t;
595 in selector : uint32_t;
597 in scalar_input : io_scalar_inband64_t;
598 in inband_input : io_struct_inband_t;
599 in ool_input : mach_vm_address_t;
600 in ool_input_size : mach_vm_size_t;
602 out scalar_output : io_scalar_inband64_t, CountInOut;
603 out inband_output : io_struct_inband_t, CountInOut;
604 in ool_output : mach_vm_address_t;
605 inout ool_output_size : mach_vm_size_t
608 routine io_connect_async_method(
609 connection : io_connect_t;
610 in wake_port : mach_port_make_send_t;
611 in reference : io_async_ref64_t;
612 in selector : uint32_t;
614 in scalar_input : io_scalar_inband64_t;
615 in inband_input : io_struct_inband_t;
616 in ool_input : mach_vm_address_t;
617 in ool_input_size : mach_vm_size_t;
619 out scalar_output : io_scalar_inband64_t, CountInOut;
620 out inband_output : io_struct_inband_t, CountInOut;
621 in ool_output : mach_vm_address_t;
622 inout ool_output_size : mach_vm_size_t
626 #if KERNEL_SERVER || __LP64__
629 #define FUNC_NAME(name) name ## _64
631 #define FUNC_NAME(name) name
634 routine FUNC_NAME(io_connect_set_notification_port)(
635 connection : io_connect_t;
636 in notification_type : uint32_t;
637 in port : mach_port_make_send_t;
638 in reference : io_user_reference_t
641 routine FUNC_NAME(io_service_add_notification)(
642 master_port : mach_port_t;
643 in notification_type : io_name_t;
644 in matching : io_string_t;
645 in wake_port : mach_port_make_send_t;
646 in reference : io_async_ref64_t;
647 out notification : io_object_t
650 routine FUNC_NAME(io_service_add_interest_notification)(
651 service : io_object_t;
652 in type_of_interest : io_name_t;
653 in wake_port : mach_port_make_send_t;
654 in reference : io_async_ref64_t;
655 out notification : io_object_t
658 routine FUNC_NAME(io_service_add_notification_ool)(
659 master_port : mach_port_t;
660 in notification_type : io_name_t;
661 in matching : io_buf_ptr_t, physicalcopy;
662 in wake_port : mach_port_make_send_t;
663 in reference : io_async_ref64_t;
664 out result : kern_return_t;
665 out notification : io_object_t
675 #endif /* KERNEL_SERVER || __LP64__ */
677 routine io_registry_entry_get_registry_entry_id(
678 registry_entry : io_object_t;
679 out entry_id : uint64_t
684 /* vim: set ft=c : */