]> git.saurik.com Git - apple/xnu.git/blob - osfmk/device/device.defs
xnu-1504.15.3.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 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
223 );
224
225 routine io_service_close(
226 connection : io_connect_t
227 );
228
229 routine io_connect_get_service(
230 connection : io_connect_t;
231 out service : io_object_t
232 );
233
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
240 );
241
242 routine io_connect_map_memory(
243 connection : io_connect_t;
244 in memory_type : uint32_t;
245 in into_task : task_t;
246 #if KERNEL_SERVER
247 inout address : uint32_t;
248 inout size : uint32_t;
249 #else
250 inout address : vm_address_t;
251 inout size : vm_size_t;
252 #endif
253 in flags : uint32_t
254 );
255 #else
256 skip;
257 skip;
258 #endif
259
260 routine io_connect_add_client(
261 connection : io_connect_t;
262 in connect_to : io_connect_t
263 );
264
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
269 );
270
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
277 );
278
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
284 );
285
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
291 );
292
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
298 );
299 #else
300 skip;
301 skip;
302 skip;
303 skip;
304 #endif
305
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
310 );
311
312 routine io_registry_get_root_entry(
313 master_port : mach_port_t;
314 out root : io_object_t
315 );
316
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
321 );
322
323 routine io_registry_entry_in_plane(
324 registry_entry : io_object_t;
325 in plane : io_name_t;
326 out inPlane : boolean_t
327 );
328
329 routine io_object_get_retain_count(
330 object : io_object_t;
331 out retainCount : uint32_t
332 );
333
334 routine io_service_get_busy_state(
335 service : io_object_t;
336 out busyState : uint32_t
337 );
338
339 routine io_service_wait_quiet(
340 service : io_object_t;
341 wait_time : mach_timespec_t
342 );
343
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
349 );
350
351 routine io_iterator_is_valid(
352 iterator : io_object_t;
353 out is_valid : boolean_t
354 );
355
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
362 );
363
364 routine io_catalog_send_data(
365 master_port : mach_port_t;
366 in flag : uint32_t;
367 in inData : io_buf_ptr_t;
368 out result : kern_return_t
369 );
370
371 routine io_catalog_terminate(
372 master_port : mach_port_t;
373 in flag : uint32_t;
374 in name : io_name_t
375 );
376
377 routine io_catalog_get_data(
378 master_port : mach_port_t;
379 in flag : uint32_t;
380 out outData : io_buf_ptr_t
381 );
382
383 routine io_catalog_get_gen_count(
384 master_port : mach_port_t;
385 out genCount : uint32_t
386 );
387
388 routine io_catalog_module_loaded(
389 master_port : mach_port_t;
390 in name : io_name_t
391 );
392
393 routine io_catalog_reset(
394 master_port : mach_port_t;
395 in flag : uint32_t
396 );
397
398 routine io_service_request_probe(
399 service : io_object_t;
400 in options : uint32_t
401 );
402
403 routine io_registry_entry_get_name_in_plane(
404 registry_entry : io_object_t;
405 in plane : io_name_t;
406 out name : io_name_t
407 );
408
409 routine io_service_match_property_table(
410 service : io_object_t;
411 in matching : io_string_t;
412 out matches : boolean_t
413 );
414
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
423 );
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
431 );
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
439 );
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
447 );
448 #else
449 skip;
450 skip;
451 skip;
452 skip;
453 #endif
454
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
463 );
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
470 );
471 routine io_service_acknowledge_notification(
472 service : io_object_t;
473 in notify_ref : natural_t;
474 in response : natural_t
475 );
476 #else
477 skip;
478 skip;
479 skip;
480 #endif
481
482 routine io_connect_get_notification_semaphore(
483 connection : io_connect_t;
484 in notification_type : natural_t;
485 out semaphore : semaphore_t
486 );
487
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;
493 #if KERNEL_SERVER
494 in address : uint32_t
495 #else
496 in address : vm_address_t
497 #endif
498 );
499 #else
500 skip;
501 #endif
502
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
507 );
508
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
515 );
516
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
522 );
523
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
529 );
530
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
536 );
537
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
547 );
548 #else
549 skip;
550 #endif
551
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
556 );
557
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
562 );
563
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
572 );
573
574
575 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
576
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;
583 in flags : uint32_t
584 );
585
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
591 );
592
593 routine io_connect_method(
594 connection : io_connect_t;
595 in selector : uint32_t;
596
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;
601
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
606 );
607
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;
613
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;
618
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
623 );
624
625
626 #if KERNEL_SERVER || __LP64__
627
628 #if KERNEL_SERVER
629 #define FUNC_NAME(name) name ## _64
630 #else
631 #define FUNC_NAME(name) name
632 #endif
633
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
639 );
640
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
648 );
649
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
656 );
657
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
666 );
667
668 #else
669
670 skip;
671 skip;
672 skip;
673 skip;
674
675 #endif /* KERNEL_SERVER || __LP64__ */
676
677 routine io_registry_entry_get_registry_entry_id(
678 registry_entry : io_object_t;
679 out entry_id : uint64_t
680 );
681
682 #endif /* IOKIT */
683
684 /* vim: set ft=c : */