]> git.saurik.com Git - apple/xnu.git/blame - osfmk/device/device.defs
xnu-1504.15.3.tar.gz
[apple/xnu.git] / osfmk / device / device.defs
CommitLineData
1c79356b
A
1/*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
2d21ac55 4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
1c79356b 5 *
2d21ac55
A
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.
8f6c56a5 14 *
2d21ac55
A
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
8f6c56a5
A
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
2d21ac55
A
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.
8f6c56a5 25 *
2d21ac55 26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
1c79356b
A
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
65subsystem
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
2d21ac55
A
76#if !__LP64__
77# define __ILP32__ 1
78#endif
79
1c79356b
A
80import <device/device_types.h>;
81
82serverprefix is_;
83
84type reply_port_t = MACH_MSG_TYPE_MAKE_SEND_ONCE | polymorphic
85 ctype: mach_port_t;
86
87#if IOKIT
88
2d21ac55
A
89type io_name_t = c_string[*:128];
90type io_string_t = c_string[*:512];
91type io_struct_inband_t = array[*:4096] of char;
92type io_buf_ptr_t = ^array[] of MACH_MSG_TYPE_INTEGER_8;
93type NDR_record_t = struct[8] of char;
94
95#if KERNEL
96type io_user_scalar_t = uint64_t;
97type io_user_reference_t = uint64_t;
98type io_scalar_inband_t = array[*:16] of int;
b0d623f7 99// must be the same type as OSAsyncReference
2d21ac55
A
100type io_async_ref_t = array[*:8] of natural_t;
101type io_scalar_inband64_t = array[*:16] of io_user_scalar_t;
102type io_async_ref64_t = array[*:8] of io_user_reference_t;
103#elif __LP64__
104type io_user_scalar_t = uint64_t;
105type io_user_reference_t = uint64_t;
106type io_scalar_inband_t = array[*:16] of io_user_scalar_t;
107type io_async_ref_t = array[*:8] of io_user_reference_t;
108type io_scalar_inband64_t = array[*:16] of io_user_scalar_t;
109type io_async_ref64_t = array[*:8] of io_user_reference_t;
110#else
111type io_user_scalar_t = int;
112type io_user_reference_t = natural_t;
113type io_scalar_inband_t = array[*:16] of io_user_scalar_t;
114type io_async_ref_t = array[*:8] of io_user_reference_t;
115type io_scalar_inband64_t = array[*:16] of uint64_t;
116type io_async_ref64_t = array[*:8] of uint64_t;
117#endif // __LP64__
1c79356b
A
118
119type 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
128type 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
137routine io_object_get_class(
138 object : io_object_t;
139 out className : io_name_t
140 );
141
142routine io_object_conforms_to(
143 object : io_object_t;
144 in className : io_name_t;
145 out conforms : boolean_t
146 );
147
148routine io_iterator_next(
149 iterator : io_object_t;
150 out object : io_object_t
151 );
152
153routine io_iterator_reset(
154 iterator : io_object_t
155 );
156
157routine 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
0b4e3aa0
A
163routine 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
1c79356b
A
167 );
168
169routine io_registry_create_iterator(
170 master_port : mach_port_t;
171 in plane : io_name_t;
2d21ac55 172 in options : uint32_t;
1c79356b
A
173 out iterator : io_object_t
174 );
175
176routine io_registry_iterator_enter_entry(
177 iterator : io_object_t
178 );
179
180routine io_registry_iterator_exit_entry(
181 iterator : io_object_t
182 );
183
184routine 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
190routine io_registry_entry_get_name(
191 registry_entry : io_object_t;
192 out name : io_name_t
193 );
194
195routine io_registry_entry_get_properties(
196 registry_entry : io_object_t;
197 out properties : io_buf_ptr_t, physicalcopy
198 );
199
0b4e3aa0 200routine io_registry_entry_get_property_bytes(
1c79356b
A
201 registry_entry : io_object_t;
202 in property_name : io_name_t;
203 out data : io_struct_inband_t, CountInOut
204 );
205
206routine 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
212routine 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
218routine io_service_open(
219 service : io_object_t;
220 in owningTask : task_t;
2d21ac55 221 in connect_type : uint32_t;
1c79356b
A
222 out connection : io_connect_t
223 );
224
225routine io_service_close(
226 connection : io_connect_t
227 );
228
229routine io_connect_get_service(
230 connection : io_connect_t;
231 out service : io_object_t
232 );
233
2d21ac55 234#if KERNEL_SERVER || __ILP32__
1c79356b
A
235routine io_connect_set_notification_port(
236 connection : io_connect_t;
2d21ac55 237 in notification_type : uint32_t;
1c79356b 238 in port : mach_port_make_send_t;
2d21ac55 239 in reference : uint32_t
1c79356b
A
240 );
241
242routine io_connect_map_memory(
243 connection : io_connect_t;
2d21ac55 244 in memory_type : uint32_t;
1c79356b 245 in into_task : task_t;
b0d623f7
A
246#if KERNEL_SERVER
247 inout address : uint32_t;
248 inout size : uint32_t;
249#else
1c79356b
A
250 inout address : vm_address_t;
251 inout size : vm_size_t;
b0d623f7 252#endif
2d21ac55 253 in flags : uint32_t
1c79356b 254 );
2d21ac55
A
255#else
256skip;
257skip;
258#endif
1c79356b
A
259
260routine io_connect_add_client(
261 connection : io_connect_t;
262 in connect_to : io_connect_t
263 );
264
265routine io_connect_set_properties(
266 connection : io_connect_t;
267 in properties : io_buf_ptr_t, physicalcopy;
2d21ac55 268 out result : kern_return_t
1c79356b
A
269 );
270
2d21ac55 271#if KERNEL_SERVER || (__ILP32__ && !MAP_32B_METHODS)
1c79356b
A
272routine io_connect_method_scalarI_scalarO(
273 connection : io_connect_t;
2d21ac55 274 in selector : uint32_t;
1c79356b
A
275 in input : io_scalar_inband_t;
276 out output : io_scalar_inband_t, CountInOut
277 );
278
279routine io_connect_method_scalarI_structureO(
280 connection : io_connect_t;
2d21ac55 281 in selector : uint32_t;
1c79356b
A
282 in input : io_scalar_inband_t;
283 out output : io_struct_inband_t, CountInOut
284 );
285
286routine io_connect_method_scalarI_structureI(
287 connection : io_connect_t;
2d21ac55 288 in selector : uint32_t;
1c79356b
A
289 in input : io_scalar_inband_t;
290 in inputStruct : io_struct_inband_t
291 );
292
293routine io_connect_method_structureI_structureO(
294 connection : io_connect_t;
2d21ac55 295 in selector : uint32_t;
1c79356b
A
296 in input : io_struct_inband_t;
297 out output : io_struct_inband_t, CountInOut
298 );
2d21ac55
A
299#else
300skip;
301skip;
302skip;
303skip;
304#endif
1c79356b
A
305
306routine 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
312routine io_registry_get_root_entry(
313 master_port : mach_port_t;
314 out root : io_object_t
315 );
316
317routine io_registry_entry_set_properties(
318 registry_entry : io_object_t;
319 in properties : io_buf_ptr_t, physicalcopy;
2d21ac55 320 out result : kern_return_t
1c79356b
A
321 );
322
323routine io_registry_entry_in_plane(
324 registry_entry : io_object_t;
325 in plane : io_name_t;
326 out inPlane : boolean_t
327 );
328
329routine io_object_get_retain_count(
330 object : io_object_t;
2d21ac55 331 out retainCount : uint32_t
1c79356b
A
332 );
333
334routine io_service_get_busy_state(
335 service : io_object_t;
2d21ac55 336 out busyState : uint32_t
1c79356b
A
337 );
338
339routine io_service_wait_quiet(
340 service : io_object_t;
341 wait_time : mach_timespec_t
342 );
343
344routine io_registry_entry_create_iterator(
345 registry_entry : io_object_t;
346 in plane : io_name_t;
2d21ac55 347 in options : uint32_t;
1c79356b
A
348 out iterator : io_object_t
349 );
350
351routine io_iterator_is_valid(
352 iterator : io_object_t;
353 out is_valid : boolean_t
354 );
355
356routine io_make_matching(
357 master_port : mach_port_t;
2d21ac55
A
358 in of_type : uint32_t;
359 in options : uint32_t;
1c79356b
A
360 in input : io_struct_inband_t;
361 out matching : io_string_t
362 );
363
364routine io_catalog_send_data(
365 master_port : mach_port_t;
2d21ac55 366 in flag : uint32_t;
1c79356b 367 in inData : io_buf_ptr_t;
2d21ac55 368 out result : kern_return_t
1c79356b
A
369 );
370
371routine io_catalog_terminate(
372 master_port : mach_port_t;
2d21ac55 373 in flag : uint32_t;
1c79356b
A
374 in name : io_name_t
375 );
376
377routine io_catalog_get_data(
378 master_port : mach_port_t;
2d21ac55 379 in flag : uint32_t;
1c79356b
A
380 out outData : io_buf_ptr_t
381 );
382
383routine io_catalog_get_gen_count(
384 master_port : mach_port_t;
2d21ac55 385 out genCount : uint32_t
1c79356b
A
386 );
387
388routine io_catalog_module_loaded(
389 master_port : mach_port_t;
390 in name : io_name_t
391 );
392
393routine io_catalog_reset(
394 master_port : mach_port_t;
2d21ac55 395 in flag : uint32_t
1c79356b
A
396 );
397
398routine io_service_request_probe(
399 service : io_object_t;
2d21ac55 400 in options : uint32_t
1c79356b
A
401 );
402
403routine 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
409routine io_service_match_property_table(
410 service : io_object_t;
411 in matching : io_string_t;
412 out matches : boolean_t
413 );
414
2d21ac55 415#if KERNEL_SERVER || (__ILP32__ && !MAP_32B_ASYNC_METHODS)
1c79356b
A
416routine 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;
2d21ac55 420 in selector : uint32_t;
1c79356b
A
421 in input : io_scalar_inband_t;
422 out output : io_scalar_inband_t, CountInOut
423 );
1c79356b
A
424routine 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;
2d21ac55 428 in selector : uint32_t;
1c79356b
A
429 in input : io_scalar_inband_t;
430 out output : io_struct_inband_t, CountInOut
431 );
1c79356b
A
432routine 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;
2d21ac55 436 in selector : uint32_t;
1c79356b
A
437 in input : io_scalar_inband_t;
438 in inputStruct : io_struct_inband_t
439 );
1c79356b
A
440routine 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;
2d21ac55 444 in selector : uint32_t;
1c79356b
A
445 in input : io_struct_inband_t;
446 out output : io_struct_inband_t, CountInOut
447 );
2d21ac55
A
448#else
449skip;
450skip;
451skip;
452skip;
453#endif
1c79356b 454
2d21ac55 455#if KERNEL_SERVER || __ILP32__
1c79356b
A
456routine 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 );
1c79356b
A
464routine 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
2d21ac55 470 );
1c79356b 471routine io_service_acknowledge_notification(
2d21ac55
A
472 service : io_object_t;
473 in notify_ref : natural_t;
474 in response : natural_t
475 );
476#else
477skip;
478skip;
479skip;
480#endif
1c79356b
A
481
482routine io_connect_get_notification_semaphore(
483 connection : io_connect_t;
484 in notification_type : natural_t;
485 out semaphore : semaphore_t
486 );
487
2d21ac55 488#if KERNEL_SERVER || __ILP32__
1c79356b
A
489routine io_connect_unmap_memory(
490 connection : io_connect_t;
2d21ac55 491 in memory_type : uint32_t;
1c79356b 492 in into_task : task_t;
b0d623f7
A
493#if KERNEL_SERVER
494 in address : uint32_t
495#else
1c79356b 496 in address : vm_address_t
b0d623f7 497#endif
1c79356b 498 );
2d21ac55
A
499#else
500skip;
501#endif
1c79356b 502
0b4e3aa0
A
503routine 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
509routine 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;
2d21ac55 513 in options : uint32_t;
0b4e3aa0
A
514 out properties : io_buf_ptr_t, physicalcopy
515 );
516
55e303ae
A
517routine io_service_get_state(
518 service : io_object_t;
b0d623f7
A
519 out state : uint64_t;
520 out busy_state : uint32_t;
521 out accumulated_busy_time : uint64_t
55e303ae
A
522 );
523
524routine io_service_get_matching_services_ool(
525 master_port : mach_port_t;
526 in matching : io_buf_ptr_t, physicalcopy;
2d21ac55 527 out result : kern_return_t;
55e303ae
A
528 out existing : io_object_t
529 );
530
531routine io_service_match_property_table_ool(
532 service : io_object_t;
533 in matching : io_buf_ptr_t, physicalcopy;
2d21ac55 534 out result : kern_return_t;
55e303ae
A
535 out matches : boolean_t
536 );
537
2d21ac55 538#if KERNEL_SERVER || __ILP32__
55e303ae
A
539routine 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;
2d21ac55 545 out result : kern_return_t;
55e303ae
A
546 out notification : io_object_t
547 );
2d21ac55
A
548#else
549skip;
550#endif
55e303ae 551
91447636
A
552routine 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
558routine 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 );
55e303ae 563
0c530ab8
A
564routine io_service_open_extended(
565 service : io_object_t;
566 in owningTask : task_t;
2d21ac55 567 in connect_type : uint32_t;
0c530ab8
A
568 in ndr : NDR_record_t;
569 in properties : io_buf_ptr_t, physicalcopy;
2d21ac55 570 out result : kern_return_t;
0c530ab8
A
571 out connection : io_connect_t
572 );
573
2d21ac55
A
574
575/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
576
577routine 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
586routine 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
593routine 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
608routine 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
1c79356b
A
632#endif
633
2d21ac55
A
634routine 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
641routine 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
650routine 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
658routine 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
0b4c1975
A
668#else
669
670 skip;
671 skip;
672 skip;
673 skip;
2d21ac55
A
674
675#endif /* KERNEL_SERVER || __LP64__ */
676
b0d623f7
A
677routine io_registry_entry_get_registry_entry_id(
678 registry_entry : io_object_t;
679 out entry_id : uint64_t
680 );
681
2d21ac55 682#endif /* IOKIT */
1c79356b 683
2d21ac55 684/* vim: set ft=c : */