]> git.saurik.com Git - apple/xnu.git/blob - osfmk/device/device.defs
xnu-1699.32.7.tar.gz
[apple/xnu.git] / osfmk / device / device.defs
1 /*
2 * Copyright (c) 2000 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 #include <mach/std_types.defs>
72 #include <mach/mach_types.defs>
73 #include <mach/clock_types.defs>
74 #include <mach/clock_types.defs>
75
76 #if !__LP64__
77 # define __ILP32__ 1
78 #endif
79
80 import <device/device_types.h>;
81
82 serverprefix is_;
83
84 type reply_port_t = MACH_MSG_TYPE_MAKE_SEND_ONCE | polymorphic
85 ctype: mach_port_t;
86
87 #if IOKIT
88
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;
94
95 #if KERNEL
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;
103 #elif __LP64__
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;
110 #else
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;
117 #endif // __LP64__
118
119 type io_object_t = mach_port_t
120 ctype: mach_port_t
121 #if KERNEL_SERVER
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 */
126 ;
127
128 type io_connect_t = mach_port_t
129 ctype: mach_port_t
130 #if KERNEL_SERVER
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 */
135 ;
136
137 routine io_object_get_class(
138 object : io_object_t;
139 out className : io_name_t
140 );
141
142 routine io_object_conforms_to(
143 object : io_object_t;
144 in className : io_name_t;
145 out conforms : boolean_t
146 );
147
148 routine io_iterator_next(
149 iterator : io_object_t;
150 out object : io_object_t
151 );
152
153 routine io_iterator_reset(
154 iterator : io_object_t
155 );
156
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
161 );
162
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
167 );
168
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
174 );
175
176 routine io_registry_iterator_enter_entry(
177 iterator : io_object_t
178 );
179
180 routine io_registry_iterator_exit_entry(
181 iterator : io_object_t
182 );
183
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
188 );
189
190 routine io_registry_entry_get_name(
191 registry_entry : io_object_t;
192 out name : io_name_t
193 );
194
195 routine io_registry_entry_get_properties(
196 registry_entry : io_object_t;
197 out properties : io_buf_ptr_t, physicalcopy
198 );
199
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
204 );
205
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
210 );
211
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
216 );
217
218 skip;
219 /* was routine io_service_open
220 service : io_object_t;
221 in owningTask : task_t;
222 in connect_type : uint32_t;
223 out connection : io_connect_t
224 );
225 */
226
227 routine io_service_close(
228 connection : io_connect_t
229 );
230
231 routine io_connect_get_service(
232 connection : io_connect_t;
233 out service : io_object_t
234 );
235
236 #if KERNEL_SERVER || __ILP32__
237 routine io_connect_set_notification_port(
238 connection : io_connect_t;
239 in notification_type : uint32_t;
240 in port : mach_port_make_send_t;
241 in reference : uint32_t
242 );
243
244 routine io_connect_map_memory(
245 connection : io_connect_t;
246 in memory_type : uint32_t;
247 in into_task : task_t;
248 #if KERNEL_SERVER
249 inout address : uint32_t;
250 inout size : uint32_t;
251 #else
252 inout address : vm_address_t;
253 inout size : vm_size_t;
254 #endif
255 in flags : uint32_t
256 );
257 #else
258 skip;
259 skip;
260 #endif
261
262 routine io_connect_add_client(
263 connection : io_connect_t;
264 in connect_to : io_connect_t
265 );
266
267 routine io_connect_set_properties(
268 connection : io_connect_t;
269 in properties : io_buf_ptr_t, physicalcopy;
270 out result : kern_return_t
271 );
272
273 #if KERNEL_SERVER || (__ILP32__ && !MAP_32B_METHODS)
274 routine io_connect_method_scalarI_scalarO(
275 connection : io_connect_t;
276 in selector : uint32_t;
277 in input : io_scalar_inband_t;
278 out output : io_scalar_inband_t, CountInOut
279 );
280
281 routine io_connect_method_scalarI_structureO(
282 connection : io_connect_t;
283 in selector : uint32_t;
284 in input : io_scalar_inband_t;
285 out output : io_struct_inband_t, CountInOut
286 );
287
288 routine io_connect_method_scalarI_structureI(
289 connection : io_connect_t;
290 in selector : uint32_t;
291 in input : io_scalar_inband_t;
292 in inputStruct : io_struct_inband_t
293 );
294
295 routine io_connect_method_structureI_structureO(
296 connection : io_connect_t;
297 in selector : uint32_t;
298 in input : io_struct_inband_t;
299 out output : io_struct_inband_t, CountInOut
300 );
301 #else
302 skip;
303 skip;
304 skip;
305 skip;
306 #endif
307
308 routine io_registry_entry_get_path(
309 registry_entry : io_object_t;
310 in plane : io_name_t;
311 out path : io_string_t
312 );
313
314 routine io_registry_get_root_entry(
315 master_port : mach_port_t;
316 out root : io_object_t
317 );
318
319 routine io_registry_entry_set_properties(
320 registry_entry : io_object_t;
321 in properties : io_buf_ptr_t, physicalcopy;
322 out result : kern_return_t
323 );
324
325 routine io_registry_entry_in_plane(
326 registry_entry : io_object_t;
327 in plane : io_name_t;
328 out inPlane : boolean_t
329 );
330
331 routine io_object_get_retain_count(
332 object : io_object_t;
333 out retainCount : uint32_t
334 );
335
336 routine io_service_get_busy_state(
337 service : io_object_t;
338 out busyState : uint32_t
339 );
340
341 routine io_service_wait_quiet(
342 service : io_object_t;
343 wait_time : mach_timespec_t
344 );
345
346 routine io_registry_entry_create_iterator(
347 registry_entry : io_object_t;
348 in plane : io_name_t;
349 in options : uint32_t;
350 out iterator : io_object_t
351 );
352
353 routine io_iterator_is_valid(
354 iterator : io_object_t;
355 out is_valid : boolean_t
356 );
357
358 routine io_make_matching(
359 master_port : mach_port_t;
360 in of_type : uint32_t;
361 in options : uint32_t;
362 in input : io_struct_inband_t;
363 out matching : io_string_t
364 );
365
366 routine io_catalog_send_data(
367 master_port : mach_port_t;
368 in flag : uint32_t;
369 in inData : io_buf_ptr_t;
370 out result : kern_return_t
371 );
372
373 routine io_catalog_terminate(
374 master_port : mach_port_t;
375 in flag : uint32_t;
376 in name : io_name_t
377 );
378
379 routine io_catalog_get_data(
380 master_port : mach_port_t;
381 in flag : uint32_t;
382 out outData : io_buf_ptr_t
383 );
384
385 routine io_catalog_get_gen_count(
386 master_port : mach_port_t;
387 out genCount : uint32_t
388 );
389
390 routine io_catalog_module_loaded(
391 master_port : mach_port_t;
392 in name : io_name_t
393 );
394
395 routine io_catalog_reset(
396 master_port : mach_port_t;
397 in flag : uint32_t
398 );
399
400 routine io_service_request_probe(
401 service : io_object_t;
402 in options : uint32_t
403 );
404
405 routine io_registry_entry_get_name_in_plane(
406 registry_entry : io_object_t;
407 in plane : io_name_t;
408 out name : io_name_t
409 );
410
411 routine io_service_match_property_table(
412 service : io_object_t;
413 in matching : io_string_t;
414 out matches : boolean_t
415 );
416
417 #if KERNEL_SERVER || (__ILP32__ && !MAP_32B_ASYNC_METHODS)
418 routine io_async_method_scalarI_scalarO(
419 connection : io_connect_t;
420 in wake_port : mach_port_make_send_t;
421 in reference : io_async_ref_t;
422 in selector : uint32_t;
423 in input : io_scalar_inband_t;
424 out output : io_scalar_inband_t, CountInOut
425 );
426 routine io_async_method_scalarI_structureO(
427 connection : io_connect_t;
428 in wake_port : mach_port_make_send_t;
429 in reference : io_async_ref_t;
430 in selector : uint32_t;
431 in input : io_scalar_inband_t;
432 out output : io_struct_inband_t, CountInOut
433 );
434 routine io_async_method_scalarI_structureI(
435 connection : io_connect_t;
436 in wake_port : mach_port_make_send_t;
437 in reference : io_async_ref_t;
438 in selector : uint32_t;
439 in input : io_scalar_inband_t;
440 in inputStruct : io_struct_inband_t
441 );
442 routine io_async_method_structureI_structureO(
443 connection : io_connect_t;
444 in wake_port : mach_port_make_send_t;
445 in reference : io_async_ref_t;
446 in selector : uint32_t;
447 in input : io_struct_inband_t;
448 out output : io_struct_inband_t, CountInOut
449 );
450 #else
451 skip;
452 skip;
453 skip;
454 skip;
455 #endif
456
457 #if KERNEL_SERVER || __ILP32__
458 routine io_service_add_notification(
459 master_port : mach_port_t;
460 in notification_type : io_name_t;
461 in matching : io_string_t;
462 in wake_port : mach_port_make_send_t;
463 in reference : io_async_ref_t;
464 out notification : io_object_t
465 );
466 routine io_service_add_interest_notification(
467 service : io_object_t;
468 in type_of_interest : io_name_t;
469 in wake_port : mach_port_make_send_t;
470 in reference : io_async_ref_t;
471 out notification : io_object_t
472 );
473 routine io_service_acknowledge_notification(
474 service : io_object_t;
475 in notify_ref : natural_t;
476 in response : natural_t
477 );
478 #else
479 skip;
480 skip;
481 skip;
482 #endif
483
484 routine io_connect_get_notification_semaphore(
485 connection : io_connect_t;
486 in notification_type : natural_t;
487 out semaphore : semaphore_t
488 );
489
490 #if KERNEL_SERVER || __ILP32__
491 routine io_connect_unmap_memory(
492 connection : io_connect_t;
493 in memory_type : uint32_t;
494 in into_task : task_t;
495 #if KERNEL_SERVER
496 in address : uint32_t
497 #else
498 in address : vm_address_t
499 #endif
500 );
501 #else
502 skip;
503 #endif
504
505 routine io_registry_entry_get_location_in_plane(
506 registry_entry : io_object_t;
507 in plane : io_name_t;
508 out location : io_name_t
509 );
510
511 routine io_registry_entry_get_property_recursively(
512 registry_entry : io_object_t;
513 in plane : io_name_t;
514 in property_name : io_name_t;
515 in options : uint32_t;
516 out properties : io_buf_ptr_t, physicalcopy
517 );
518
519 routine io_service_get_state(
520 service : io_object_t;
521 out state : uint64_t;
522 out busy_state : uint32_t;
523 out accumulated_busy_time : uint64_t
524 );
525
526 routine io_service_get_matching_services_ool(
527 master_port : mach_port_t;
528 in matching : io_buf_ptr_t, physicalcopy;
529 out result : kern_return_t;
530 out existing : io_object_t
531 );
532
533 routine io_service_match_property_table_ool(
534 service : io_object_t;
535 in matching : io_buf_ptr_t, physicalcopy;
536 out result : kern_return_t;
537 out matches : boolean_t
538 );
539
540 #if KERNEL_SERVER || __ILP32__
541 routine io_service_add_notification_ool(
542 master_port : mach_port_t;
543 in notification_type : io_name_t;
544 in matching : io_buf_ptr_t, physicalcopy;
545 in wake_port : mach_port_make_send_t;
546 in reference : io_async_ref_t;
547 out result : kern_return_t;
548 out notification : io_object_t
549 );
550 #else
551 skip;
552 #endif
553
554 routine io_object_get_superclass(
555 master_port : mach_port_t;
556 in obj_name : io_name_t;
557 out class_name : io_name_t
558 );
559
560 routine io_object_get_bundle_identifier(
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_service_open_extended(
567 service : io_object_t;
568 in owningTask : task_t;
569 in connect_type : uint32_t;
570 in ndr : NDR_record_t;
571 in properties : io_buf_ptr_t, physicalcopy;
572 out result : kern_return_t;
573 out connection : io_connect_t
574 );
575
576
577 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
578
579 routine io_connect_map_memory_into_task(
580 connection : io_connect_t;
581 in memory_type : uint32_t;
582 in into_task : task_t;
583 inout address : mach_vm_address_t;
584 inout size : mach_vm_size_t;
585 in flags : uint32_t
586 );
587
588 routine io_connect_unmap_memory_from_task(
589 connection : io_connect_t;
590 in memory_type : uint32_t;
591 in from_task : task_t;
592 in address : mach_vm_address_t
593 );
594
595 routine io_connect_method(
596 connection : io_connect_t;
597 in selector : uint32_t;
598
599 in scalar_input : io_scalar_inband64_t;
600 in inband_input : io_struct_inband_t;
601 in ool_input : mach_vm_address_t;
602 in ool_input_size : mach_vm_size_t;
603
604 out inband_output : io_struct_inband_t, CountInOut;
605 out scalar_output : io_scalar_inband64_t, CountInOut;
606 in ool_output : mach_vm_address_t;
607 inout ool_output_size : mach_vm_size_t
608 );
609
610 routine io_connect_async_method(
611 connection : io_connect_t;
612 in wake_port : mach_port_make_send_t;
613 in reference : io_async_ref64_t;
614 in selector : uint32_t;
615
616 in scalar_input : io_scalar_inband64_t;
617 in inband_input : io_struct_inband_t;
618 in ool_input : mach_vm_address_t;
619 in ool_input_size : mach_vm_size_t;
620
621 out inband_output : io_struct_inband_t, CountInOut;
622 out scalar_output : io_scalar_inband64_t, CountInOut;
623 in ool_output : mach_vm_address_t;
624 inout ool_output_size : mach_vm_size_t
625 );
626
627
628 #if KERNEL_SERVER || __LP64__
629
630 #if KERNEL_SERVER
631 #define FUNC_NAME(name) name ## _64
632 #else
633 #define FUNC_NAME(name) name
634 #endif
635
636 routine FUNC_NAME(io_connect_set_notification_port)(
637 connection : io_connect_t;
638 in notification_type : uint32_t;
639 in port : mach_port_make_send_t;
640 in reference : io_user_reference_t
641 );
642
643 routine FUNC_NAME(io_service_add_notification)(
644 master_port : mach_port_t;
645 in notification_type : io_name_t;
646 in matching : io_string_t;
647 in wake_port : mach_port_make_send_t;
648 in reference : io_async_ref64_t;
649 out notification : io_object_t
650 );
651
652 routine FUNC_NAME(io_service_add_interest_notification)(
653 service : io_object_t;
654 in type_of_interest : io_name_t;
655 in wake_port : mach_port_make_send_t;
656 in reference : io_async_ref64_t;
657 out notification : io_object_t
658 );
659
660 routine FUNC_NAME(io_service_add_notification_ool)(
661 master_port : mach_port_t;
662 in notification_type : io_name_t;
663 in matching : io_buf_ptr_t, physicalcopy;
664 in wake_port : mach_port_make_send_t;
665 in reference : io_async_ref64_t;
666 out result : kern_return_t;
667 out notification : io_object_t
668 );
669
670 #else
671
672 skip;
673 skip;
674 skip;
675 skip;
676
677 #endif /* KERNEL_SERVER || __LP64__ */
678
679 routine io_registry_entry_get_registry_entry_id(
680 registry_entry : io_object_t;
681 out entry_id : uint64_t
682 );
683
684 routine io_connect_method_var_output(
685 connection : io_connect_t;
686 in selector : uint32_t;
687
688 in scalar_input : io_scalar_inband64_t;
689 in inband_input : io_struct_inband_t;
690 in ool_input : mach_vm_address_t;
691 in ool_input_size : mach_vm_size_t;
692
693 out inband_output : io_struct_inband_t, CountInOut;
694 out scalar_output : io_scalar_inband64_t, CountInOut;
695 out var_output : io_buf_ptr_t, physicalcopy
696 );
697
698 #endif /* IOKIT */
699
700 /* vim: set ft=c : */