]> git.saurik.com Git - apple/xnu.git/blame - osfmk/device/device.defs
xnu-1699.32.7.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
6d2010ae
A
218skip;
219/* was routine io_service_open
1c79356b
A
220 service : io_object_t;
221 in owningTask : task_t;
2d21ac55 222 in connect_type : uint32_t;
1c79356b
A
223 out connection : io_connect_t
224 );
6d2010ae 225*/
1c79356b
A
226
227routine io_service_close(
228 connection : io_connect_t
229 );
230
231routine io_connect_get_service(
232 connection : io_connect_t;
233 out service : io_object_t
234 );
235
2d21ac55 236#if KERNEL_SERVER || __ILP32__
1c79356b
A
237routine io_connect_set_notification_port(
238 connection : io_connect_t;
2d21ac55 239 in notification_type : uint32_t;
1c79356b 240 in port : mach_port_make_send_t;
2d21ac55 241 in reference : uint32_t
1c79356b
A
242 );
243
244routine io_connect_map_memory(
245 connection : io_connect_t;
2d21ac55 246 in memory_type : uint32_t;
1c79356b 247 in into_task : task_t;
b0d623f7
A
248#if KERNEL_SERVER
249 inout address : uint32_t;
250 inout size : uint32_t;
251#else
1c79356b
A
252 inout address : vm_address_t;
253 inout size : vm_size_t;
b0d623f7 254#endif
2d21ac55 255 in flags : uint32_t
1c79356b 256 );
2d21ac55
A
257#else
258skip;
259skip;
260#endif
1c79356b
A
261
262routine io_connect_add_client(
263 connection : io_connect_t;
264 in connect_to : io_connect_t
265 );
266
267routine io_connect_set_properties(
268 connection : io_connect_t;
269 in properties : io_buf_ptr_t, physicalcopy;
2d21ac55 270 out result : kern_return_t
1c79356b
A
271 );
272
2d21ac55 273#if KERNEL_SERVER || (__ILP32__ && !MAP_32B_METHODS)
1c79356b
A
274routine io_connect_method_scalarI_scalarO(
275 connection : io_connect_t;
2d21ac55 276 in selector : uint32_t;
1c79356b
A
277 in input : io_scalar_inband_t;
278 out output : io_scalar_inband_t, CountInOut
279 );
280
281routine io_connect_method_scalarI_structureO(
282 connection : io_connect_t;
2d21ac55 283 in selector : uint32_t;
1c79356b
A
284 in input : io_scalar_inband_t;
285 out output : io_struct_inband_t, CountInOut
286 );
287
288routine io_connect_method_scalarI_structureI(
289 connection : io_connect_t;
2d21ac55 290 in selector : uint32_t;
1c79356b
A
291 in input : io_scalar_inband_t;
292 in inputStruct : io_struct_inband_t
293 );
294
295routine io_connect_method_structureI_structureO(
296 connection : io_connect_t;
2d21ac55 297 in selector : uint32_t;
1c79356b
A
298 in input : io_struct_inband_t;
299 out output : io_struct_inband_t, CountInOut
300 );
2d21ac55
A
301#else
302skip;
303skip;
304skip;
305skip;
306#endif
1c79356b
A
307
308routine 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
314routine io_registry_get_root_entry(
315 master_port : mach_port_t;
316 out root : io_object_t
317 );
318
319routine io_registry_entry_set_properties(
320 registry_entry : io_object_t;
321 in properties : io_buf_ptr_t, physicalcopy;
2d21ac55 322 out result : kern_return_t
1c79356b
A
323 );
324
325routine io_registry_entry_in_plane(
326 registry_entry : io_object_t;
327 in plane : io_name_t;
328 out inPlane : boolean_t
329 );
330
331routine io_object_get_retain_count(
332 object : io_object_t;
2d21ac55 333 out retainCount : uint32_t
1c79356b
A
334 );
335
336routine io_service_get_busy_state(
337 service : io_object_t;
2d21ac55 338 out busyState : uint32_t
1c79356b
A
339 );
340
341routine io_service_wait_quiet(
342 service : io_object_t;
343 wait_time : mach_timespec_t
344 );
345
346routine io_registry_entry_create_iterator(
347 registry_entry : io_object_t;
348 in plane : io_name_t;
2d21ac55 349 in options : uint32_t;
1c79356b
A
350 out iterator : io_object_t
351 );
352
353routine io_iterator_is_valid(
354 iterator : io_object_t;
355 out is_valid : boolean_t
356 );
357
358routine io_make_matching(
359 master_port : mach_port_t;
2d21ac55
A
360 in of_type : uint32_t;
361 in options : uint32_t;
1c79356b
A
362 in input : io_struct_inband_t;
363 out matching : io_string_t
364 );
365
366routine io_catalog_send_data(
367 master_port : mach_port_t;
2d21ac55 368 in flag : uint32_t;
1c79356b 369 in inData : io_buf_ptr_t;
2d21ac55 370 out result : kern_return_t
1c79356b
A
371 );
372
373routine io_catalog_terminate(
374 master_port : mach_port_t;
2d21ac55 375 in flag : uint32_t;
1c79356b
A
376 in name : io_name_t
377 );
378
379routine io_catalog_get_data(
380 master_port : mach_port_t;
2d21ac55 381 in flag : uint32_t;
1c79356b
A
382 out outData : io_buf_ptr_t
383 );
384
385routine io_catalog_get_gen_count(
386 master_port : mach_port_t;
2d21ac55 387 out genCount : uint32_t
1c79356b
A
388 );
389
390routine io_catalog_module_loaded(
391 master_port : mach_port_t;
392 in name : io_name_t
393 );
394
395routine io_catalog_reset(
396 master_port : mach_port_t;
2d21ac55 397 in flag : uint32_t
1c79356b
A
398 );
399
400routine io_service_request_probe(
401 service : io_object_t;
2d21ac55 402 in options : uint32_t
1c79356b
A
403 );
404
405routine 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
411routine io_service_match_property_table(
412 service : io_object_t;
413 in matching : io_string_t;
414 out matches : boolean_t
415 );
416
2d21ac55 417#if KERNEL_SERVER || (__ILP32__ && !MAP_32B_ASYNC_METHODS)
1c79356b
A
418routine 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;
2d21ac55 422 in selector : uint32_t;
1c79356b
A
423 in input : io_scalar_inband_t;
424 out output : io_scalar_inband_t, CountInOut
425 );
1c79356b
A
426routine 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;
2d21ac55 430 in selector : uint32_t;
1c79356b
A
431 in input : io_scalar_inband_t;
432 out output : io_struct_inband_t, CountInOut
433 );
1c79356b
A
434routine 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;
2d21ac55 438 in selector : uint32_t;
1c79356b
A
439 in input : io_scalar_inband_t;
440 in inputStruct : io_struct_inband_t
441 );
1c79356b
A
442routine 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;
2d21ac55 446 in selector : uint32_t;
1c79356b
A
447 in input : io_struct_inband_t;
448 out output : io_struct_inband_t, CountInOut
449 );
2d21ac55
A
450#else
451skip;
452skip;
453skip;
454skip;
455#endif
1c79356b 456
2d21ac55 457#if KERNEL_SERVER || __ILP32__
1c79356b
A
458routine 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 );
1c79356b
A
466routine 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
2d21ac55 472 );
1c79356b 473routine io_service_acknowledge_notification(
2d21ac55
A
474 service : io_object_t;
475 in notify_ref : natural_t;
476 in response : natural_t
477 );
478#else
479skip;
480skip;
481skip;
482#endif
1c79356b
A
483
484routine io_connect_get_notification_semaphore(
485 connection : io_connect_t;
486 in notification_type : natural_t;
487 out semaphore : semaphore_t
488 );
489
2d21ac55 490#if KERNEL_SERVER || __ILP32__
1c79356b
A
491routine io_connect_unmap_memory(
492 connection : io_connect_t;
2d21ac55 493 in memory_type : uint32_t;
1c79356b 494 in into_task : task_t;
b0d623f7
A
495#if KERNEL_SERVER
496 in address : uint32_t
497#else
1c79356b 498 in address : vm_address_t
b0d623f7 499#endif
1c79356b 500 );
2d21ac55
A
501#else
502skip;
503#endif
1c79356b 504
0b4e3aa0
A
505routine 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
511routine 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;
2d21ac55 515 in options : uint32_t;
0b4e3aa0
A
516 out properties : io_buf_ptr_t, physicalcopy
517 );
518
55e303ae
A
519routine io_service_get_state(
520 service : io_object_t;
b0d623f7
A
521 out state : uint64_t;
522 out busy_state : uint32_t;
523 out accumulated_busy_time : uint64_t
55e303ae
A
524 );
525
526routine io_service_get_matching_services_ool(
527 master_port : mach_port_t;
528 in matching : io_buf_ptr_t, physicalcopy;
2d21ac55 529 out result : kern_return_t;
55e303ae
A
530 out existing : io_object_t
531 );
532
533routine io_service_match_property_table_ool(
534 service : io_object_t;
535 in matching : io_buf_ptr_t, physicalcopy;
2d21ac55 536 out result : kern_return_t;
55e303ae
A
537 out matches : boolean_t
538 );
539
2d21ac55 540#if KERNEL_SERVER || __ILP32__
55e303ae
A
541routine 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;
2d21ac55 547 out result : kern_return_t;
55e303ae
A
548 out notification : io_object_t
549 );
2d21ac55
A
550#else
551skip;
552#endif
55e303ae 553
91447636
A
554routine 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
560routine 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 );
55e303ae 565
0c530ab8
A
566routine io_service_open_extended(
567 service : io_object_t;
568 in owningTask : task_t;
2d21ac55 569 in connect_type : uint32_t;
0c530ab8
A
570 in ndr : NDR_record_t;
571 in properties : io_buf_ptr_t, physicalcopy;
2d21ac55 572 out result : kern_return_t;
0c530ab8
A
573 out connection : io_connect_t
574 );
575
2d21ac55
A
576
577/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
578
579routine 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
588routine 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
595routine 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
2d21ac55 604 out inband_output : io_struct_inband_t, CountInOut;
6d2010ae 605 out scalar_output : io_scalar_inband64_t, CountInOut;
2d21ac55
A
606 in ool_output : mach_vm_address_t;
607 inout ool_output_size : mach_vm_size_t
608 );
609
610routine 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
2d21ac55 621 out inband_output : io_struct_inband_t, CountInOut;
6d2010ae 622 out scalar_output : io_scalar_inband64_t, CountInOut;
2d21ac55
A
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
1c79356b
A
634#endif
635
2d21ac55
A
636routine 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
643routine 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
652routine 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
660routine 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
0b4c1975
A
670#else
671
672 skip;
673 skip;
674 skip;
675 skip;
2d21ac55
A
676
677#endif /* KERNEL_SERVER || __LP64__ */
678
b0d623f7
A
679routine io_registry_entry_get_registry_entry_id(
680 registry_entry : io_object_t;
681 out entry_id : uint64_t
682 );
683
ebb1b9f4
A
684routine 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
2d21ac55 698#endif /* IOKIT */
1c79356b 699
2d21ac55 700/* vim: set ft=c : */