]> git.saurik.com Git - apple/xnu.git/blob - osfmk/device/device.defs
xnu-2782.40.9.tar.gz
[apple/xnu.git] / osfmk / device / device.defs
1 /*
2 * Copyright (c) 1998-2014 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
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.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
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.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28 /*
29 * @OSF_COPYRIGHT@
30 */
31 /*
32 * Mach Operating System
33 * Copyright (c) 1991,1990,1989 Carnegie Mellon University
34 * All Rights Reserved.
35 *
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.
41 *
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.
45 *
46 * Carnegie Mellon requests users of this software to return to
47 *
48 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
49 * School of Computer Science
50 * Carnegie Mellon University
51 * Pittsburgh PA 15213-3890
52 *
53 * any improvements or extensions that they make and grant Carnegie Mellon
54 * the rights to redistribute these changes.
55 */
56 /*
57 * File: device/device.defs
58 * Author: Douglas Orr
59 * Feb 10, 1988
60 * Abstract:
61 * Mach device support. Mach devices are accessed through
62 * block and character device interfaces to the kernel.
63 */
64
65 subsystem
66 #if KERNEL_SERVER
67 KernelServer
68 #endif /* KERNEL_SERVER */
69 iokit 2800;
70
71 #if IOKITSIMD || KERNEL_SERVER
72 #define IOKIT_ALL_IPC 1
73 #endif
74
75 #include <mach/std_types.defs>
76 #include <mach/mach_types.defs>
77 #include <mach/clock_types.defs>
78 #include <mach/clock_types.defs>
79
80 #if !__LP64__
81 # define __ILP32__ 1
82 #endif
83
84 import <device/device_types.h>;
85
86 serverprefix is_;
87
88 type reply_port_t = MACH_MSG_TYPE_MAKE_SEND_ONCE | polymorphic
89 ctype: mach_port_t;
90
91 #if IOKIT
92
93 type io_name_t = c_string[*:128];
94 type io_string_t = c_string[*:512];
95 type io_struct_inband_t = array[*:4096] of char;
96 type io_buf_ptr_t = ^array[] of MACH_MSG_TYPE_INTEGER_8;
97 type NDR_record_t = struct[8] of char;
98
99 #if KERNEL
100 type io_user_scalar_t = uint64_t;
101 type io_user_reference_t = uint64_t;
102 type io_scalar_inband_t = array[*:16] of int;
103 // must be the same type as OSAsyncReference
104 type io_async_ref_t = array[*:8] of natural_t;
105 type io_scalar_inband64_t = array[*:16] of io_user_scalar_t;
106 type io_async_ref64_t = array[*:8] of io_user_reference_t;
107 #elif __LP64__
108 type io_user_scalar_t = uint64_t;
109 type io_user_reference_t = uint64_t;
110 type io_scalar_inband_t = array[*:16] of io_user_scalar_t;
111 type io_async_ref_t = array[*:8] of io_user_reference_t;
112 type io_scalar_inband64_t = array[*:16] of io_user_scalar_t;
113 type io_async_ref64_t = array[*:8] of io_user_reference_t;
114 #else
115 type io_user_scalar_t = int;
116 type io_user_reference_t = natural_t;
117 type io_scalar_inband_t = array[*:16] of io_user_scalar_t;
118 type io_async_ref_t = array[*:8] of io_user_reference_t;
119 type io_scalar_inband64_t = array[*:16] of uint64_t;
120 type io_async_ref64_t = array[*:8] of uint64_t;
121 #endif // __LP64__
122
123 type io_object_t = mach_port_t
124 ctype: mach_port_t
125 #if KERNEL_SERVER
126 intran: io_object_t iokit_lookup_object_port(mach_port_t)
127 outtran: mach_port_t iokit_make_object_port(io_object_t)
128 destructor: iokit_remove_reference(io_object_t)
129 #endif /* KERNEL_SERVER */
130 ;
131
132 type io_connect_t = mach_port_t
133 ctype: mach_port_t
134 #if KERNEL_SERVER
135 intran: io_connect_t iokit_lookup_connect_port(mach_port_t)
136 outtran: mach_port_t iokit_make_connect_port(io_connect_t)
137 destructor: iokit_remove_reference(io_connect_t)
138 #endif /* KERNEL_SERVER */
139 ;
140
141 routine io_object_get_class(
142 object : io_object_t;
143 out className : io_name_t
144 );
145
146 routine io_object_conforms_to(
147 object : io_object_t;
148 in className : io_name_t;
149 out conforms : boolean_t
150 );
151
152 routine io_iterator_next(
153 iterator : io_object_t;
154 out object : io_object_t
155 );
156
157 routine io_iterator_reset(
158 iterator : io_object_t
159 );
160
161 routine io_service_get_matching_services(
162 master_port : mach_port_t;
163 in matching : io_string_t;
164 out existing : io_object_t
165 );
166
167 routine io_registry_entry_get_property(
168 registry_entry : io_object_t;
169 in property_name : io_name_t;
170 out properties : io_buf_ptr_t, physicalcopy
171 );
172
173 routine io_registry_create_iterator(
174 master_port : mach_port_t;
175 in plane : io_name_t;
176 in options : uint32_t;
177 out iterator : io_object_t
178 );
179
180 routine io_registry_iterator_enter_entry(
181 iterator : io_object_t
182 );
183
184 routine io_registry_iterator_exit_entry(
185 iterator : io_object_t
186 );
187
188 routine io_registry_entry_from_path(
189 master_port : mach_port_t;
190 in path : io_string_t;
191 out registry_entry : io_object_t
192 );
193
194 routine io_registry_entry_get_name(
195 registry_entry : io_object_t;
196 out name : io_name_t
197 );
198
199 routine io_registry_entry_get_properties(
200 registry_entry : io_object_t;
201 out properties : io_buf_ptr_t, physicalcopy
202 );
203
204 routine io_registry_entry_get_property_bytes(
205 registry_entry : io_object_t;
206 in property_name : io_name_t;
207 out data : io_struct_inband_t, CountInOut
208 );
209
210 routine io_registry_entry_get_child_iterator(
211 registry_entry : io_object_t;
212 in plane : io_name_t;
213 out iterator : io_object_t
214 );
215
216 routine io_registry_entry_get_parent_iterator(
217 registry_entry : io_object_t;
218 in plane : io_name_t;
219 out iterator : io_object_t
220 );
221
222 skip;
223 /* was routine io_service_open
224 service : io_object_t;
225 in owningTask : task_t;
226 in connect_type : uint32_t;
227 out connection : io_connect_t
228 );
229 */
230
231 routine io_service_close(
232 connection : io_connect_t
233 );
234
235 routine io_connect_get_service(
236 connection : io_connect_t;
237 out service : io_object_t
238 );
239
240 #if IOKIT_ALL_IPC || __ILP32__
241 routine io_connect_set_notification_port(
242 connection : io_connect_t;
243 in notification_type : uint32_t;
244 in port : mach_port_make_send_t;
245 in reference : uint32_t
246 );
247
248 routine io_connect_map_memory(
249 connection : io_connect_t;
250 in memory_type : uint32_t;
251 in into_task : task_t;
252 #if IOKIT_ALL_IPC
253 inout address : uint32_t;
254 inout size : uint32_t;
255 #else
256 inout address : vm_address_t;
257 inout size : vm_size_t;
258 #endif
259 in flags : uint32_t
260 );
261 #else
262 skip;
263 skip;
264 #endif
265
266 routine io_connect_add_client(
267 connection : io_connect_t;
268 in connect_to : io_connect_t
269 );
270
271 routine io_connect_set_properties(
272 connection : io_connect_t;
273 in properties : io_buf_ptr_t, physicalcopy;
274 out result : kern_return_t
275 );
276
277 #if IOKIT_ALL_IPC || __ILP32__
278 routine io_connect_method_scalarI_scalarO(
279 connection : io_connect_t;
280 in selector : uint32_t;
281 in input : io_scalar_inband_t;
282 out output : io_scalar_inband_t, CountInOut
283 );
284
285 routine io_connect_method_scalarI_structureO(
286 connection : io_connect_t;
287 in selector : uint32_t;
288 in input : io_scalar_inband_t;
289 out output : io_struct_inband_t, CountInOut
290 );
291
292 routine io_connect_method_scalarI_structureI(
293 connection : io_connect_t;
294 in selector : uint32_t;
295 in input : io_scalar_inband_t;
296 in inputStruct : io_struct_inband_t
297 );
298
299 routine io_connect_method_structureI_structureO(
300 connection : io_connect_t;
301 in selector : uint32_t;
302 in input : io_struct_inband_t;
303 out output : io_struct_inband_t, CountInOut
304 );
305 #else
306 skip;
307 skip;
308 skip;
309 skip;
310 #endif
311
312 routine io_registry_entry_get_path(
313 registry_entry : io_object_t;
314 in plane : io_name_t;
315 out path : io_string_t
316 );
317
318 routine io_registry_get_root_entry(
319 master_port : mach_port_t;
320 out root : io_object_t
321 );
322
323 routine io_registry_entry_set_properties(
324 registry_entry : io_object_t;
325 in properties : io_buf_ptr_t, physicalcopy;
326 out result : kern_return_t
327 );
328
329 routine io_registry_entry_in_plane(
330 registry_entry : io_object_t;
331 in plane : io_name_t;
332 out inPlane : boolean_t
333 );
334
335 routine io_object_get_retain_count(
336 object : io_object_t;
337 out retainCount : uint32_t
338 );
339
340 routine io_service_get_busy_state(
341 service : io_object_t;
342 out busyState : uint32_t
343 );
344
345 routine io_service_wait_quiet(
346 service : io_object_t;
347 wait_time : mach_timespec_t
348 );
349
350 routine io_registry_entry_create_iterator(
351 registry_entry : io_object_t;
352 in plane : io_name_t;
353 in options : uint32_t;
354 out iterator : io_object_t
355 );
356
357 routine io_iterator_is_valid(
358 iterator : io_object_t;
359 out is_valid : boolean_t
360 );
361
362 skip;
363 /* was routine io_make_matching(
364 master_port : mach_port_t;
365 in of_type : uint32_t;
366 in options : uint32_t;
367 in input : io_struct_inband_t;
368 out matching : io_string_t
369 );
370 */
371
372 routine io_catalog_send_data(
373 master_port : mach_port_t;
374 in flag : uint32_t;
375 in inData : io_buf_ptr_t;
376 out result : kern_return_t
377 );
378
379 routine io_catalog_terminate(
380 master_port : mach_port_t;
381 in flag : uint32_t;
382 in name : io_name_t
383 );
384
385 routine io_catalog_get_data(
386 master_port : mach_port_t;
387 in flag : uint32_t;
388 out outData : io_buf_ptr_t
389 );
390
391 routine io_catalog_get_gen_count(
392 master_port : mach_port_t;
393 out genCount : uint32_t
394 );
395
396 routine io_catalog_module_loaded(
397 master_port : mach_port_t;
398 in name : io_name_t
399 );
400
401 routine io_catalog_reset(
402 master_port : mach_port_t;
403 in flag : uint32_t
404 );
405
406 routine io_service_request_probe(
407 service : io_object_t;
408 in options : uint32_t
409 );
410
411 routine io_registry_entry_get_name_in_plane(
412 registry_entry : io_object_t;
413 in plane : io_name_t;
414 out name : io_name_t
415 );
416
417 routine io_service_match_property_table(
418 service : io_object_t;
419 in matching : io_string_t;
420 out matches : boolean_t
421 );
422
423 #if IOKIT_ALL_IPC || __ILP32__
424 routine io_async_method_scalarI_scalarO(
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_scalar_inband_t, CountInOut
431 );
432 routine io_async_method_scalarI_structureO(
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 out output : io_struct_inband_t, CountInOut
439 );
440 routine io_async_method_scalarI_structureI(
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_scalar_inband_t;
446 in inputStruct : io_struct_inband_t
447 );
448 routine io_async_method_structureI_structureO(
449 connection : io_connect_t;
450 in wake_port : mach_port_make_send_t;
451 in reference : io_async_ref_t;
452 in selector : uint32_t;
453 in input : io_struct_inband_t;
454 out output : io_struct_inband_t, CountInOut
455 );
456 #else
457 skip;
458 skip;
459 skip;
460 skip;
461 #endif
462
463 #if IOKIT_ALL_IPC || __ILP32__
464 routine io_service_add_notification(
465 master_port : mach_port_t;
466 in notification_type : io_name_t;
467 in matching : io_string_t;
468 in wake_port : mach_port_make_send_t;
469 in reference : io_async_ref_t;
470 out notification : io_object_t
471 );
472 routine io_service_add_interest_notification(
473 service : io_object_t;
474 in type_of_interest : io_name_t;
475 in wake_port : mach_port_make_send_t;
476 in reference : io_async_ref_t;
477 out notification : io_object_t
478 );
479 routine io_service_acknowledge_notification(
480 service : io_object_t;
481 in notify_ref : natural_t;
482 in response : natural_t
483 );
484 #else
485 skip;
486 skip;
487 skip;
488 #endif
489
490 routine io_connect_get_notification_semaphore(
491 connection : io_connect_t;
492 in notification_type : natural_t;
493 out semaphore : semaphore_t
494 );
495
496 #if IOKIT_ALL_IPC || __ILP32__
497 routine io_connect_unmap_memory(
498 connection : io_connect_t;
499 in memory_type : uint32_t;
500 in into_task : task_t;
501 #if IOKIT_ALL_IPC
502 in address : uint32_t
503 #else
504 in address : vm_address_t
505 #endif
506 );
507 #else
508 skip;
509 #endif
510
511 routine io_registry_entry_get_location_in_plane(
512 registry_entry : io_object_t;
513 in plane : io_name_t;
514 out location : io_name_t
515 );
516
517 routine io_registry_entry_get_property_recursively(
518 registry_entry : io_object_t;
519 in plane : io_name_t;
520 in property_name : io_name_t;
521 in options : uint32_t;
522 out properties : io_buf_ptr_t, physicalcopy
523 );
524
525 routine io_service_get_state(
526 service : io_object_t;
527 out state : uint64_t;
528 out busy_state : uint32_t;
529 out accumulated_busy_time : uint64_t
530 );
531
532 routine io_service_get_matching_services_ool(
533 master_port : mach_port_t;
534 in matching : io_buf_ptr_t, physicalcopy;
535 out result : kern_return_t;
536 out existing : io_object_t
537 );
538
539 routine io_service_match_property_table_ool(
540 service : io_object_t;
541 in matching : io_buf_ptr_t, physicalcopy;
542 out result : kern_return_t;
543 out matches : boolean_t
544 );
545
546 #if IOKIT_ALL_IPC || __ILP32__
547 routine io_service_add_notification_ool(
548 master_port : mach_port_t;
549 in notification_type : io_name_t;
550 in matching : io_buf_ptr_t, physicalcopy;
551 in wake_port : mach_port_make_send_t;
552 in reference : io_async_ref_t;
553 out result : kern_return_t;
554 out notification : io_object_t
555 );
556 #else
557 skip;
558 #endif
559
560 routine io_object_get_superclass(
561 master_port : mach_port_t;
562 in obj_name : io_name_t;
563 out class_name : io_name_t
564 );
565
566 routine io_object_get_bundle_identifier(
567 master_port : mach_port_t;
568 in obj_name : io_name_t;
569 out class_name : io_name_t
570 );
571
572 routine io_service_open_extended(
573 service : io_object_t;
574 in owningTask : task_t;
575 in connect_type : uint32_t;
576 in ndr : NDR_record_t;
577 in properties : io_buf_ptr_t, physicalcopy;
578 out result : kern_return_t;
579 out connection : io_connect_t
580 );
581
582
583 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
584
585 routine io_connect_map_memory_into_task(
586 connection : io_connect_t;
587 in memory_type : uint32_t;
588 in into_task : task_t;
589 inout address : mach_vm_address_t;
590 inout size : mach_vm_size_t;
591 in flags : uint32_t
592 );
593
594 routine io_connect_unmap_memory_from_task(
595 connection : io_connect_t;
596 in memory_type : uint32_t;
597 in from_task : task_t;
598 in address : mach_vm_address_t
599 );
600
601 routine io_connect_method(
602 connection : io_connect_t;
603 in selector : uint32_t;
604
605 in scalar_input : io_scalar_inband64_t;
606 in inband_input : io_struct_inband_t;
607 in ool_input : mach_vm_address_t;
608 in ool_input_size : mach_vm_size_t;
609
610 out inband_output : io_struct_inband_t, CountInOut;
611 out scalar_output : io_scalar_inband64_t, CountInOut;
612 in ool_output : mach_vm_address_t;
613 inout ool_output_size : mach_vm_size_t
614 );
615
616 routine io_connect_async_method(
617 connection : io_connect_t;
618 in wake_port : mach_port_make_send_t;
619 in reference : io_async_ref64_t;
620 in selector : uint32_t;
621
622 in scalar_input : io_scalar_inband64_t;
623 in inband_input : io_struct_inband_t;
624 in ool_input : mach_vm_address_t;
625 in ool_input_size : mach_vm_size_t;
626
627 out inband_output : io_struct_inband_t, CountInOut;
628 out scalar_output : io_scalar_inband64_t, CountInOut;
629 in ool_output : mach_vm_address_t;
630 inout ool_output_size : mach_vm_size_t
631 );
632
633
634 #if IOKIT_ALL_IPC || __LP64__
635
636 #if IOKIT_ALL_IPC
637 #define FUNC_NAME(name) name ## _64
638 #else
639 #define FUNC_NAME(name) name
640 #endif
641
642 routine FUNC_NAME(io_connect_set_notification_port)(
643 connection : io_connect_t;
644 in notification_type : uint32_t;
645 in port : mach_port_make_send_t;
646 in reference : io_user_reference_t
647 );
648
649 routine FUNC_NAME(io_service_add_notification)(
650 master_port : mach_port_t;
651 in notification_type : io_name_t;
652 in matching : io_string_t;
653 in wake_port : mach_port_make_send_t;
654 in reference : io_async_ref64_t;
655 out notification : io_object_t
656 );
657
658 routine FUNC_NAME(io_service_add_interest_notification)(
659 service : io_object_t;
660 in type_of_interest : io_name_t;
661 in wake_port : mach_port_make_send_t;
662 in reference : io_async_ref64_t;
663 out notification : io_object_t
664 );
665
666 routine FUNC_NAME(io_service_add_notification_ool)(
667 master_port : mach_port_t;
668 in notification_type : io_name_t;
669 in matching : io_buf_ptr_t, physicalcopy;
670 in wake_port : mach_port_make_send_t;
671 in reference : io_async_ref64_t;
672 out result : kern_return_t;
673 out notification : io_object_t
674 );
675
676 #else
677
678 skip;
679 skip;
680 skip;
681 skip;
682
683 #endif /* IOKIT_ALL_IPC || __LP64__ */
684
685 routine io_registry_entry_get_registry_entry_id(
686 registry_entry : io_object_t;
687 out entry_id : uint64_t
688 );
689
690 routine io_connect_method_var_output(
691 connection : io_connect_t;
692 in selector : uint32_t;
693
694 in scalar_input : io_scalar_inband64_t;
695 in inband_input : io_struct_inband_t;
696 in ool_input : mach_vm_address_t;
697 in ool_input_size : mach_vm_size_t;
698
699 out inband_output : io_struct_inband_t, CountInOut;
700 out scalar_output : io_scalar_inband64_t, CountInOut;
701 out var_output : io_buf_ptr_t, physicalcopy
702 );
703
704 routine io_service_get_matching_service(
705 master_port : mach_port_t;
706 in matching : io_string_t;
707 out service : io_object_t
708 );
709
710 routine io_service_get_matching_service_ool(
711 master_port : mach_port_t;
712 in matching : io_buf_ptr_t, physicalcopy;
713 out result : kern_return_t;
714 out service : io_object_t
715 );
716
717 routine io_service_get_authorization_id(
718 service : io_object_t;
719 out authorization_id : uint64_t
720 );
721
722 routine io_service_set_authorization_id(
723 service : io_object_t;
724 in authorization_id : uint64_t
725 );
726
727 /* */
728
729 routine io_server_version(
730 master_port : mach_port_t;
731 out version : uint64_t
732 );
733
734 routine io_registry_entry_get_properties_bin(
735 registry_entry : io_object_t;
736 out properties : io_buf_ptr_t, physicalcopy
737 );
738
739 routine io_registry_entry_get_property_bin(
740 registry_entry : io_object_t;
741 in plane : io_name_t;
742 in property_name : io_name_t;
743 in options : uint32_t;
744 out properties : io_buf_ptr_t, physicalcopy
745 );
746
747 routine io_service_get_matching_service_bin(
748 master_port : mach_port_t;
749 in matching : io_struct_inband_t;
750 out service : io_object_t
751 );
752
753 routine io_service_get_matching_services_bin(
754 master_port : mach_port_t;
755 in matching : io_struct_inband_t;
756 out existing : io_object_t
757 );
758
759 routine io_service_match_property_table_bin(
760 service : io_object_t;
761 in matching : io_struct_inband_t;
762 out matches : boolean_t
763 );
764
765 #if IOKIT_ALL_IPC || __ILP32__
766 routine io_service_add_notification_bin(
767 master_port : mach_port_t;
768 in notification_type : io_name_t;
769 in matching : io_struct_inband_t;
770 in wake_port : mach_port_make_send_t;
771 in reference : io_async_ref_t;
772 out notification : io_object_t
773 );
774 #else
775 skip;
776 #endif
777
778 #if IOKIT_ALL_IPC || __LP64__
779 routine FUNC_NAME(io_service_add_notification_bin)(
780 master_port : mach_port_t;
781 in notification_type : io_name_t;
782 in matching : io_struct_inband_t;
783 in wake_port : mach_port_make_send_t;
784 in reference : io_async_ref64_t;
785 out notification : io_object_t
786 );
787 #else
788 skip;
789 #endif
790
791 #endif /* IOKIT */
792
793 /* vim: set ft=c : */