]> git.saurik.com Git - apple/xnu.git/blame - osfmk/device/device.defs
xnu-1228.15.4.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;
99type io_async_ref_t = array[*:8] of natural_t;
100type io_scalar_inband64_t = array[*:16] of io_user_scalar_t;
101type io_async_ref64_t = array[*:8] of io_user_reference_t;
102#elif __LP64__
103type io_user_scalar_t = uint64_t;
104type io_user_reference_t = uint64_t;
105type io_scalar_inband_t = array[*:16] of io_user_scalar_t;
106type io_async_ref_t = array[*:8] of io_user_reference_t;
107type io_scalar_inband64_t = array[*:16] of io_user_scalar_t;
108type io_async_ref64_t = array[*:8] of io_user_reference_t;
109#else
110type io_user_scalar_t = int;
111type io_user_reference_t = natural_t;
112type io_scalar_inband_t = array[*:16] of io_user_scalar_t;
113type io_async_ref_t = array[*:8] of io_user_reference_t;
114type io_scalar_inband64_t = array[*:16] of uint64_t;
115type io_async_ref64_t = array[*:8] of uint64_t;
116#endif // __LP64__
1c79356b
A
117
118type 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
127type 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
136routine io_object_get_class(
137 object : io_object_t;
138 out className : io_name_t
139 );
140
141routine io_object_conforms_to(
142 object : io_object_t;
143 in className : io_name_t;
144 out conforms : boolean_t
145 );
146
147routine io_iterator_next(
148 iterator : io_object_t;
149 out object : io_object_t
150 );
151
152routine io_iterator_reset(
153 iterator : io_object_t
154 );
155
156routine 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
0b4e3aa0
A
162routine 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
1c79356b
A
166 );
167
168routine io_registry_create_iterator(
169 master_port : mach_port_t;
170 in plane : io_name_t;
2d21ac55 171 in options : uint32_t;
1c79356b
A
172 out iterator : io_object_t
173 );
174
175routine io_registry_iterator_enter_entry(
176 iterator : io_object_t
177 );
178
179routine io_registry_iterator_exit_entry(
180 iterator : io_object_t
181 );
182
183routine 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
189routine io_registry_entry_get_name(
190 registry_entry : io_object_t;
191 out name : io_name_t
192 );
193
194routine io_registry_entry_get_properties(
195 registry_entry : io_object_t;
196 out properties : io_buf_ptr_t, physicalcopy
197 );
198
0b4e3aa0 199routine io_registry_entry_get_property_bytes(
1c79356b
A
200 registry_entry : io_object_t;
201 in property_name : io_name_t;
202 out data : io_struct_inband_t, CountInOut
203 );
204
205routine 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
211routine 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
217routine io_service_open(
218 service : io_object_t;
219 in owningTask : task_t;
2d21ac55 220 in connect_type : uint32_t;
1c79356b
A
221 out connection : io_connect_t
222 );
223
224routine io_service_close(
225 connection : io_connect_t
226 );
227
228routine io_connect_get_service(
229 connection : io_connect_t;
230 out service : io_object_t
231 );
232
2d21ac55 233#if KERNEL_SERVER || __ILP32__
1c79356b
A
234routine io_connect_set_notification_port(
235 connection : io_connect_t;
2d21ac55 236 in notification_type : uint32_t;
1c79356b 237 in port : mach_port_make_send_t;
2d21ac55 238 in reference : uint32_t
1c79356b
A
239 );
240
241routine io_connect_map_memory(
242 connection : io_connect_t;
2d21ac55 243 in memory_type : uint32_t;
1c79356b
A
244 in into_task : task_t;
245 inout address : vm_address_t;
246 inout size : vm_size_t;
2d21ac55 247 in flags : uint32_t
1c79356b 248 );
2d21ac55
A
249#else
250skip;
251skip;
252#endif
1c79356b
A
253
254routine io_connect_add_client(
255 connection : io_connect_t;
256 in connect_to : io_connect_t
257 );
258
259routine io_connect_set_properties(
260 connection : io_connect_t;
261 in properties : io_buf_ptr_t, physicalcopy;
2d21ac55 262 out result : kern_return_t
1c79356b
A
263 );
264
2d21ac55 265#if KERNEL_SERVER || (__ILP32__ && !MAP_32B_METHODS)
1c79356b
A
266routine io_connect_method_scalarI_scalarO(
267 connection : io_connect_t;
2d21ac55 268 in selector : uint32_t;
1c79356b
A
269 in input : io_scalar_inband_t;
270 out output : io_scalar_inband_t, CountInOut
271 );
272
273routine io_connect_method_scalarI_structureO(
274 connection : io_connect_t;
2d21ac55 275 in selector : uint32_t;
1c79356b
A
276 in input : io_scalar_inband_t;
277 out output : io_struct_inband_t, CountInOut
278 );
279
280routine io_connect_method_scalarI_structureI(
281 connection : io_connect_t;
2d21ac55 282 in selector : uint32_t;
1c79356b
A
283 in input : io_scalar_inband_t;
284 in inputStruct : io_struct_inband_t
285 );
286
287routine io_connect_method_structureI_structureO(
288 connection : io_connect_t;
2d21ac55 289 in selector : uint32_t;
1c79356b
A
290 in input : io_struct_inband_t;
291 out output : io_struct_inband_t, CountInOut
292 );
2d21ac55
A
293#else
294skip;
295skip;
296skip;
297skip;
298#endif
1c79356b
A
299
300routine 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
306routine io_registry_get_root_entry(
307 master_port : mach_port_t;
308 out root : io_object_t
309 );
310
311routine io_registry_entry_set_properties(
312 registry_entry : io_object_t;
313 in properties : io_buf_ptr_t, physicalcopy;
2d21ac55 314 out result : kern_return_t
1c79356b
A
315 );
316
317routine io_registry_entry_in_plane(
318 registry_entry : io_object_t;
319 in plane : io_name_t;
320 out inPlane : boolean_t
321 );
322
323routine io_object_get_retain_count(
324 object : io_object_t;
2d21ac55 325 out retainCount : uint32_t
1c79356b
A
326 );
327
328routine io_service_get_busy_state(
329 service : io_object_t;
2d21ac55 330 out busyState : uint32_t
1c79356b
A
331 );
332
333routine io_service_wait_quiet(
334 service : io_object_t;
335 wait_time : mach_timespec_t
336 );
337
338routine io_registry_entry_create_iterator(
339 registry_entry : io_object_t;
340 in plane : io_name_t;
2d21ac55 341 in options : uint32_t;
1c79356b
A
342 out iterator : io_object_t
343 );
344
345routine io_iterator_is_valid(
346 iterator : io_object_t;
347 out is_valid : boolean_t
348 );
349
350routine io_make_matching(
351 master_port : mach_port_t;
2d21ac55
A
352 in of_type : uint32_t;
353 in options : uint32_t;
1c79356b
A
354 in input : io_struct_inband_t;
355 out matching : io_string_t
356 );
357
358routine io_catalog_send_data(
359 master_port : mach_port_t;
2d21ac55 360 in flag : uint32_t;
1c79356b 361 in inData : io_buf_ptr_t;
2d21ac55 362 out result : kern_return_t
1c79356b
A
363 );
364
365routine io_catalog_terminate(
366 master_port : mach_port_t;
2d21ac55 367 in flag : uint32_t;
1c79356b
A
368 in name : io_name_t
369 );
370
371routine io_catalog_get_data(
372 master_port : mach_port_t;
2d21ac55 373 in flag : uint32_t;
1c79356b
A
374 out outData : io_buf_ptr_t
375 );
376
377routine io_catalog_get_gen_count(
378 master_port : mach_port_t;
2d21ac55 379 out genCount : uint32_t
1c79356b
A
380 );
381
382routine io_catalog_module_loaded(
383 master_port : mach_port_t;
384 in name : io_name_t
385 );
386
387routine io_catalog_reset(
388 master_port : mach_port_t;
2d21ac55 389 in flag : uint32_t
1c79356b
A
390 );
391
392routine io_service_request_probe(
393 service : io_object_t;
2d21ac55 394 in options : uint32_t
1c79356b
A
395 );
396
397routine 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
403routine io_service_match_property_table(
404 service : io_object_t;
405 in matching : io_string_t;
406 out matches : boolean_t
407 );
408
2d21ac55 409#if KERNEL_SERVER || (__ILP32__ && !MAP_32B_ASYNC_METHODS)
1c79356b
A
410routine 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;
2d21ac55 414 in selector : uint32_t;
1c79356b
A
415 in input : io_scalar_inband_t;
416 out output : io_scalar_inband_t, CountInOut
417 );
1c79356b
A
418routine 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;
2d21ac55 422 in selector : uint32_t;
1c79356b
A
423 in input : io_scalar_inband_t;
424 out output : io_struct_inband_t, CountInOut
425 );
1c79356b
A
426routine 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;
2d21ac55 430 in selector : uint32_t;
1c79356b
A
431 in input : io_scalar_inband_t;
432 in inputStruct : io_struct_inband_t
433 );
1c79356b
A
434routine 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;
2d21ac55 438 in selector : uint32_t;
1c79356b
A
439 in input : io_struct_inband_t;
440 out output : io_struct_inband_t, CountInOut
441 );
2d21ac55
A
442#else
443skip;
444skip;
445skip;
446skip;
447#endif
1c79356b 448
2d21ac55 449#if KERNEL_SERVER || __ILP32__
1c79356b
A
450routine 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 );
1c79356b
A
458routine 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
2d21ac55 464 );
1c79356b 465routine io_service_acknowledge_notification(
2d21ac55
A
466 service : io_object_t;
467 in notify_ref : natural_t;
468 in response : natural_t
469 );
470#else
471skip;
472skip;
473skip;
474#endif
1c79356b
A
475
476routine io_connect_get_notification_semaphore(
477 connection : io_connect_t;
478 in notification_type : natural_t;
479 out semaphore : semaphore_t
480 );
481
2d21ac55 482#if KERNEL_SERVER || __ILP32__
1c79356b
A
483routine io_connect_unmap_memory(
484 connection : io_connect_t;
2d21ac55 485 in memory_type : uint32_t;
1c79356b
A
486 in into_task : task_t;
487 in address : vm_address_t
488 );
2d21ac55
A
489#else
490skip;
491#endif
1c79356b 492
0b4e3aa0
A
493routine 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
499routine 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;
2d21ac55 503 in options : uint32_t;
0b4e3aa0
A
504 out properties : io_buf_ptr_t, physicalcopy
505 );
506
55e303ae
A
507
508routine io_service_get_state(
509 service : io_object_t;
510 out state : uint64_t
511 );
512
513routine io_service_get_matching_services_ool(
514 master_port : mach_port_t;
515 in matching : io_buf_ptr_t, physicalcopy;
2d21ac55 516 out result : kern_return_t;
55e303ae
A
517 out existing : io_object_t
518 );
519
520routine io_service_match_property_table_ool(
521 service : io_object_t;
522 in matching : io_buf_ptr_t, physicalcopy;
2d21ac55 523 out result : kern_return_t;
55e303ae
A
524 out matches : boolean_t
525 );
526
2d21ac55 527#if KERNEL_SERVER || __ILP32__
55e303ae
A
528routine 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;
2d21ac55 534 out result : kern_return_t;
55e303ae
A
535 out notification : io_object_t
536 );
2d21ac55
A
537#else
538skip;
539#endif
55e303ae 540
91447636
A
541routine 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
547routine 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 );
55e303ae 552
0c530ab8
A
553routine io_service_open_extended(
554 service : io_object_t;
555 in owningTask : task_t;
2d21ac55 556 in connect_type : uint32_t;
0c530ab8
A
557 in ndr : NDR_record_t;
558 in properties : io_buf_ptr_t, physicalcopy;
2d21ac55 559 out result : kern_return_t;
0c530ab8
A
560 out connection : io_connect_t
561 );
562
2d21ac55
A
563
564/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
565
566routine 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
575routine 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
582routine 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
597routine 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
1c79356b
A
621#endif
622
2d21ac55
A
623routine 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
630routine 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
639routine 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
647routine 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 */
1c79356b 661
2d21ac55 662/* vim: set ft=c : */