]> git.saurik.com Git - apple/xnu.git/blob - osfmk/device/device.defs
xnu-1228.7.58.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 type io_async_ref_t = array[*:8] of natural_t;
100 type io_scalar_inband64_t = array[*:16] of io_user_scalar_t;
101 type io_async_ref64_t = array[*:8] of io_user_reference_t;
102 #elif __LP64__
103 type io_user_scalar_t = uint64_t;
104 type io_user_reference_t = uint64_t;
105 type io_scalar_inband_t = array[*:16] of io_user_scalar_t;
106 type io_async_ref_t = array[*:8] of io_user_reference_t;
107 type io_scalar_inband64_t = array[*:16] of io_user_scalar_t;
108 type io_async_ref64_t = array[*:8] of io_user_reference_t;
109 #else
110 type io_user_scalar_t = int;
111 type io_user_reference_t = natural_t;
112 type io_scalar_inband_t = array[*:16] of io_user_scalar_t;
113 type io_async_ref_t = array[*:8] of io_user_reference_t;
114 type io_scalar_inband64_t = array[*:16] of uint64_t;
115 type io_async_ref64_t = array[*:8] of uint64_t;
116 #endif // __LP64__
117
118 type io_object_t = mach_port_t
119 ctype: mach_port_t
120 #if KERNEL_SERVER
121 intran: io_object_t iokit_lookup_object_port(mach_port_t)
122 outtran: mach_port_t iokit_make_object_port(io_object_t)
123 destructor: iokit_remove_reference(io_object_t)
124 #endif /* KERNEL_SERVER */
125 ;
126
127 type io_connect_t = mach_port_t
128 ctype: mach_port_t
129 #if KERNEL_SERVER
130 intran: io_connect_t iokit_lookup_connect_port(mach_port_t)
131 outtran: mach_port_t iokit_make_connect_port(io_connect_t)
132 destructor: iokit_remove_reference(io_connect_t)
133 #endif /* KERNEL_SERVER */
134 ;
135
136 routine io_object_get_class(
137 object : io_object_t;
138 out className : io_name_t
139 );
140
141 routine io_object_conforms_to(
142 object : io_object_t;
143 in className : io_name_t;
144 out conforms : boolean_t
145 );
146
147 routine io_iterator_next(
148 iterator : io_object_t;
149 out object : io_object_t
150 );
151
152 routine io_iterator_reset(
153 iterator : io_object_t
154 );
155
156 routine io_service_get_matching_services(
157 master_port : mach_port_t;
158 in matching : io_string_t;
159 out existing : io_object_t
160 );
161
162 routine io_registry_entry_get_property(
163 registry_entry : io_object_t;
164 in property_name : io_name_t;
165 out properties : io_buf_ptr_t, physicalcopy
166 );
167
168 routine io_registry_create_iterator(
169 master_port : mach_port_t;
170 in plane : io_name_t;
171 in options : uint32_t;
172 out iterator : io_object_t
173 );
174
175 routine io_registry_iterator_enter_entry(
176 iterator : io_object_t
177 );
178
179 routine io_registry_iterator_exit_entry(
180 iterator : io_object_t
181 );
182
183 routine io_registry_entry_from_path(
184 master_port : mach_port_t;
185 in path : io_string_t;
186 out registry_entry : io_object_t
187 );
188
189 routine io_registry_entry_get_name(
190 registry_entry : io_object_t;
191 out name : io_name_t
192 );
193
194 routine io_registry_entry_get_properties(
195 registry_entry : io_object_t;
196 out properties : io_buf_ptr_t, physicalcopy
197 );
198
199 routine io_registry_entry_get_property_bytes(
200 registry_entry : io_object_t;
201 in property_name : io_name_t;
202 out data : io_struct_inband_t, CountInOut
203 );
204
205 routine io_registry_entry_get_child_iterator(
206 registry_entry : io_object_t;
207 in plane : io_name_t;
208 out iterator : io_object_t
209 );
210
211 routine io_registry_entry_get_parent_iterator(
212 registry_entry : io_object_t;
213 in plane : io_name_t;
214 out iterator : io_object_t
215 );
216
217 routine io_service_open(
218 service : io_object_t;
219 in owningTask : task_t;
220 in connect_type : uint32_t;
221 out connection : io_connect_t
222 );
223
224 routine io_service_close(
225 connection : io_connect_t
226 );
227
228 routine io_connect_get_service(
229 connection : io_connect_t;
230 out service : io_object_t
231 );
232
233 #if KERNEL_SERVER || __ILP32__
234 routine io_connect_set_notification_port(
235 connection : io_connect_t;
236 in notification_type : uint32_t;
237 in port : mach_port_make_send_t;
238 in reference : uint32_t
239 );
240
241 routine io_connect_map_memory(
242 connection : io_connect_t;
243 in memory_type : uint32_t;
244 in into_task : task_t;
245 inout address : vm_address_t;
246 inout size : vm_size_t;
247 in flags : uint32_t
248 );
249 #else
250 skip;
251 skip;
252 #endif
253
254 routine io_connect_add_client(
255 connection : io_connect_t;
256 in connect_to : io_connect_t
257 );
258
259 routine io_connect_set_properties(
260 connection : io_connect_t;
261 in properties : io_buf_ptr_t, physicalcopy;
262 out result : kern_return_t
263 );
264
265 #if KERNEL_SERVER || (__ILP32__ && !MAP_32B_METHODS)
266 routine io_connect_method_scalarI_scalarO(
267 connection : io_connect_t;
268 in selector : uint32_t;
269 in input : io_scalar_inband_t;
270 out output : io_scalar_inband_t, CountInOut
271 );
272
273 routine io_connect_method_scalarI_structureO(
274 connection : io_connect_t;
275 in selector : uint32_t;
276 in input : io_scalar_inband_t;
277 out output : io_struct_inband_t, CountInOut
278 );
279
280 routine io_connect_method_scalarI_structureI(
281 connection : io_connect_t;
282 in selector : uint32_t;
283 in input : io_scalar_inband_t;
284 in inputStruct : io_struct_inband_t
285 );
286
287 routine io_connect_method_structureI_structureO(
288 connection : io_connect_t;
289 in selector : uint32_t;
290 in input : io_struct_inband_t;
291 out output : io_struct_inband_t, CountInOut
292 );
293 #else
294 skip;
295 skip;
296 skip;
297 skip;
298 #endif
299
300 routine io_registry_entry_get_path(
301 registry_entry : io_object_t;
302 in plane : io_name_t;
303 out path : io_string_t
304 );
305
306 routine io_registry_get_root_entry(
307 master_port : mach_port_t;
308 out root : io_object_t
309 );
310
311 routine io_registry_entry_set_properties(
312 registry_entry : io_object_t;
313 in properties : io_buf_ptr_t, physicalcopy;
314 out result : kern_return_t
315 );
316
317 routine io_registry_entry_in_plane(
318 registry_entry : io_object_t;
319 in plane : io_name_t;
320 out inPlane : boolean_t
321 );
322
323 routine io_object_get_retain_count(
324 object : io_object_t;
325 out retainCount : uint32_t
326 );
327
328 routine io_service_get_busy_state(
329 service : io_object_t;
330 out busyState : uint32_t
331 );
332
333 routine io_service_wait_quiet(
334 service : io_object_t;
335 wait_time : mach_timespec_t
336 );
337
338 routine io_registry_entry_create_iterator(
339 registry_entry : io_object_t;
340 in plane : io_name_t;
341 in options : uint32_t;
342 out iterator : io_object_t
343 );
344
345 routine io_iterator_is_valid(
346 iterator : io_object_t;
347 out is_valid : boolean_t
348 );
349
350 routine io_make_matching(
351 master_port : mach_port_t;
352 in of_type : uint32_t;
353 in options : uint32_t;
354 in input : io_struct_inband_t;
355 out matching : io_string_t
356 );
357
358 routine io_catalog_send_data(
359 master_port : mach_port_t;
360 in flag : uint32_t;
361 in inData : io_buf_ptr_t;
362 out result : kern_return_t
363 );
364
365 routine io_catalog_terminate(
366 master_port : mach_port_t;
367 in flag : uint32_t;
368 in name : io_name_t
369 );
370
371 routine io_catalog_get_data(
372 master_port : mach_port_t;
373 in flag : uint32_t;
374 out outData : io_buf_ptr_t
375 );
376
377 routine io_catalog_get_gen_count(
378 master_port : mach_port_t;
379 out genCount : uint32_t
380 );
381
382 routine io_catalog_module_loaded(
383 master_port : mach_port_t;
384 in name : io_name_t
385 );
386
387 routine io_catalog_reset(
388 master_port : mach_port_t;
389 in flag : uint32_t
390 );
391
392 routine io_service_request_probe(
393 service : io_object_t;
394 in options : uint32_t
395 );
396
397 routine io_registry_entry_get_name_in_plane(
398 registry_entry : io_object_t;
399 in plane : io_name_t;
400 out name : io_name_t
401 );
402
403 routine io_service_match_property_table(
404 service : io_object_t;
405 in matching : io_string_t;
406 out matches : boolean_t
407 );
408
409 #if KERNEL_SERVER || (__ILP32__ && !MAP_32B_ASYNC_METHODS)
410 routine io_async_method_scalarI_scalarO(
411 connection : io_connect_t;
412 in wake_port : mach_port_make_send_t;
413 in reference : io_async_ref_t;
414 in selector : uint32_t;
415 in input : io_scalar_inband_t;
416 out output : io_scalar_inband_t, CountInOut
417 );
418 routine io_async_method_scalarI_structureO(
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_struct_inband_t, CountInOut
425 );
426 routine io_async_method_scalarI_structureI(
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 in inputStruct : io_struct_inband_t
433 );
434 routine io_async_method_structureI_structureO(
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_struct_inband_t;
440 out output : io_struct_inband_t, CountInOut
441 );
442 #else
443 skip;
444 skip;
445 skip;
446 skip;
447 #endif
448
449 #if KERNEL_SERVER || __ILP32__
450 routine io_service_add_notification(
451 master_port : mach_port_t;
452 in notification_type : io_name_t;
453 in matching : io_string_t;
454 in wake_port : mach_port_make_send_t;
455 in reference : io_async_ref_t;
456 out notification : io_object_t
457 );
458 routine io_service_add_interest_notification(
459 service : io_object_t;
460 in type_of_interest : io_name_t;
461 in wake_port : mach_port_make_send_t;
462 in reference : io_async_ref_t;
463 out notification : io_object_t
464 );
465 routine io_service_acknowledge_notification(
466 service : io_object_t;
467 in notify_ref : natural_t;
468 in response : natural_t
469 );
470 #else
471 skip;
472 skip;
473 skip;
474 #endif
475
476 routine io_connect_get_notification_semaphore(
477 connection : io_connect_t;
478 in notification_type : natural_t;
479 out semaphore : semaphore_t
480 );
481
482 #if KERNEL_SERVER || __ILP32__
483 routine io_connect_unmap_memory(
484 connection : io_connect_t;
485 in memory_type : uint32_t;
486 in into_task : task_t;
487 in address : vm_address_t
488 );
489 #else
490 skip;
491 #endif
492
493 routine io_registry_entry_get_location_in_plane(
494 registry_entry : io_object_t;
495 in plane : io_name_t;
496 out location : io_name_t
497 );
498
499 routine io_registry_entry_get_property_recursively(
500 registry_entry : io_object_t;
501 in plane : io_name_t;
502 in property_name : io_name_t;
503 in options : uint32_t;
504 out properties : io_buf_ptr_t, physicalcopy
505 );
506
507
508 routine io_service_get_state(
509 service : io_object_t;
510 out state : uint64_t
511 );
512
513 routine io_service_get_matching_services_ool(
514 master_port : mach_port_t;
515 in matching : io_buf_ptr_t, physicalcopy;
516 out result : kern_return_t;
517 out existing : io_object_t
518 );
519
520 routine io_service_match_property_table_ool(
521 service : io_object_t;
522 in matching : io_buf_ptr_t, physicalcopy;
523 out result : kern_return_t;
524 out matches : boolean_t
525 );
526
527 #if KERNEL_SERVER || __ILP32__
528 routine io_service_add_notification_ool(
529 master_port : mach_port_t;
530 in notification_type : io_name_t;
531 in matching : io_buf_ptr_t, physicalcopy;
532 in wake_port : mach_port_make_send_t;
533 in reference : io_async_ref_t;
534 out result : kern_return_t;
535 out notification : io_object_t
536 );
537 #else
538 skip;
539 #endif
540
541 routine io_object_get_superclass(
542 master_port : mach_port_t;
543 in obj_name : io_name_t;
544 out class_name : io_name_t
545 );
546
547 routine io_object_get_bundle_identifier(
548 master_port : mach_port_t;
549 in obj_name : io_name_t;
550 out class_name : io_name_t
551 );
552
553 routine io_service_open_extended(
554 service : io_object_t;
555 in owningTask : task_t;
556 in connect_type : uint32_t;
557 in ndr : NDR_record_t;
558 in properties : io_buf_ptr_t, physicalcopy;
559 out result : kern_return_t;
560 out connection : io_connect_t
561 );
562
563
564 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
565
566 routine io_connect_map_memory_into_task(
567 connection : io_connect_t;
568 in memory_type : uint32_t;
569 in into_task : task_t;
570 inout address : mach_vm_address_t;
571 inout size : mach_vm_size_t;
572 in flags : uint32_t
573 );
574
575 routine io_connect_unmap_memory_from_task(
576 connection : io_connect_t;
577 in memory_type : uint32_t;
578 in from_task : task_t;
579 in address : mach_vm_address_t
580 );
581
582 routine io_connect_method(
583 connection : io_connect_t;
584 in selector : uint32_t;
585
586 in scalar_input : io_scalar_inband64_t;
587 in inband_input : io_struct_inband_t;
588 in ool_input : mach_vm_address_t;
589 in ool_input_size : mach_vm_size_t;
590
591 out scalar_output : io_scalar_inband64_t, CountInOut;
592 out inband_output : io_struct_inband_t, CountInOut;
593 in ool_output : mach_vm_address_t;
594 inout ool_output_size : mach_vm_size_t
595 );
596
597 routine io_connect_async_method(
598 connection : io_connect_t;
599 in wake_port : mach_port_make_send_t;
600 in reference : io_async_ref64_t;
601 in selector : uint32_t;
602
603 in scalar_input : io_scalar_inband64_t;
604 in inband_input : io_struct_inband_t;
605 in ool_input : mach_vm_address_t;
606 in ool_input_size : mach_vm_size_t;
607
608 out scalar_output : io_scalar_inband64_t, CountInOut;
609 out inband_output : io_struct_inband_t, CountInOut;
610 in ool_output : mach_vm_address_t;
611 inout ool_output_size : mach_vm_size_t
612 );
613
614
615 #if KERNEL_SERVER || __LP64__
616
617 #if KERNEL_SERVER
618 #define FUNC_NAME(name) name ## _64
619 #else
620 #define FUNC_NAME(name) name
621 #endif
622
623 routine FUNC_NAME(io_connect_set_notification_port)(
624 connection : io_connect_t;
625 in notification_type : uint32_t;
626 in port : mach_port_make_send_t;
627 in reference : io_user_reference_t
628 );
629
630 routine FUNC_NAME(io_service_add_notification)(
631 master_port : mach_port_t;
632 in notification_type : io_name_t;
633 in matching : io_string_t;
634 in wake_port : mach_port_make_send_t;
635 in reference : io_async_ref64_t;
636 out notification : io_object_t
637 );
638
639 routine FUNC_NAME(io_service_add_interest_notification)(
640 service : io_object_t;
641 in type_of_interest : io_name_t;
642 in wake_port : mach_port_make_send_t;
643 in reference : io_async_ref64_t;
644 out notification : io_object_t
645 );
646
647 routine FUNC_NAME(io_service_add_notification_ool)(
648 master_port : mach_port_t;
649 in notification_type : io_name_t;
650 in matching : io_buf_ptr_t, physicalcopy;
651 in wake_port : mach_port_make_send_t;
652 in reference : io_async_ref64_t;
653 out result : kern_return_t;
654 out notification : io_object_t
655 );
656
657
658 #endif /* KERNEL_SERVER || __LP64__ */
659
660 #endif /* IOKIT */
661
662 /* vim: set ft=c : */