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 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 76#if !__LP64__ 77# define __ILP32__ 1 78#endif 79 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 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; 99// must be the same type as OSAsyncReference 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__ 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 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 167 ); 168 169routine 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 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 200routine 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 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 218skip; 219/* was routine io_service_open 220 service : io_object_t; 221 in owningTask : task_t; 222 in connect_type : uint32_t; 223 out connection : io_connect_t 224 ); 225*/ 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 236#if KERNEL_SERVER || __ILP32__ 237routine io_connect_set_notification_port( 238 connection : io_connect_t; 239 in notification_type : uint32_t; 240 in port : mach_port_make_send_t; 241 in reference : uint32_t 242 ); 243 244routine io_connect_map_memory( 245 connection : io_connect_t; 246 in memory_type : uint32_t; 247 in into_task : task_t; 248#if KERNEL_SERVER 249 inout address : uint32_t; 250 inout size : uint32_t; 251#else 252 inout address : vm_address_t; 253 inout size : vm_size_t; 254#endif 255 in flags : uint32_t 256 ); 257#else 258skip; 259skip; 260#endif 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; 270 out result : kern_return_t 271 ); 272 273#if KERNEL_SERVER || (__ILP32__ && !MAP_32B_METHODS) 274routine io_connect_method_scalarI_scalarO( 275 connection : io_connect_t; 276 in selector : uint32_t; 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; 283 in selector : uint32_t; 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; 290 in selector : uint32_t; 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; 297 in selector : uint32_t; 298 in input : io_struct_inband_t; 299 out output : io_struct_inband_t, CountInOut 300 ); 301#else 302skip; 303skip; 304skip; 305skip; 306#endif 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; 322 out result : kern_return_t 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; 333 out retainCount : uint32_t 334 ); 335 336routine io_service_get_busy_state( 337 service : io_object_t; 338 out busyState : uint32_t 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; 349 in options : uint32_t; 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 358skip; 359/* was routine io_make_matching( 360 master_port : mach_port_t; 361 in of_type : uint32_t; 362 in options : uint32_t; 363 in input : io_struct_inband_t; 364 out matching : io_string_t 365 ); 366*/ 367 368routine io_catalog_send_data( 369 master_port : mach_port_t; 370 in flag : uint32_t; 371 in inData : io_buf_ptr_t; 372 out result : kern_return_t 373 ); 374 375routine io_catalog_terminate( 376 master_port : mach_port_t; 377 in flag : uint32_t; 378 in name : io_name_t 379 ); 380 381routine io_catalog_get_data( 382 master_port : mach_port_t; 383 in flag : uint32_t; 384 out outData : io_buf_ptr_t 385 ); 386 387routine io_catalog_get_gen_count( 388 master_port : mach_port_t; 389 out genCount : uint32_t 390 ); 391 392routine io_catalog_module_loaded( 393 master_port : mach_port_t; 394 in name : io_name_t 395 ); 396 397routine io_catalog_reset( 398 master_port : mach_port_t; 399 in flag : uint32_t 400 ); 401 402routine io_service_request_probe( 403 service : io_object_t; 404 in options : uint32_t 405 ); 406 407routine io_registry_entry_get_name_in_plane( 408 registry_entry : io_object_t; 409 in plane : io_name_t; 410 out name : io_name_t 411 ); 412 413routine io_service_match_property_table( 414 service : io_object_t; 415 in matching : io_string_t; 416 out matches : boolean_t 417 ); 418 419#if KERNEL_SERVER || (__ILP32__ && !MAP_32B_ASYNC_METHODS) 420routine io_async_method_scalarI_scalarO( 421 connection : io_connect_t; 422 in wake_port : mach_port_make_send_t; 423 in reference : io_async_ref_t; 424 in selector : uint32_t; 425 in input : io_scalar_inband_t; 426 out output : io_scalar_inband_t, CountInOut 427 ); 428routine io_async_method_scalarI_structureO( 429 connection : io_connect_t; 430 in wake_port : mach_port_make_send_t; 431 in reference : io_async_ref_t; 432 in selector : uint32_t; 433 in input : io_scalar_inband_t; 434 out output : io_struct_inband_t, CountInOut 435 ); 436routine io_async_method_scalarI_structureI( 437 connection : io_connect_t; 438 in wake_port : mach_port_make_send_t; 439 in reference : io_async_ref_t; 440 in selector : uint32_t; 441 in input : io_scalar_inband_t; 442 in inputStruct : io_struct_inband_t 443 ); 444routine io_async_method_structureI_structureO( 445 connection : io_connect_t; 446 in wake_port : mach_port_make_send_t; 447 in reference : io_async_ref_t; 448 in selector : uint32_t; 449 in input : io_struct_inband_t; 450 out output : io_struct_inband_t, CountInOut 451 ); 452#else 453skip; 454skip; 455skip; 456skip; 457#endif 458 459#if KERNEL_SERVER || __ILP32__ 460routine io_service_add_notification( 461 master_port : mach_port_t; 462 in notification_type : io_name_t; 463 in matching : io_string_t; 464 in wake_port : mach_port_make_send_t; 465 in reference : io_async_ref_t; 466 out notification : io_object_t 467 ); 468routine io_service_add_interest_notification( 469 service : io_object_t; 470 in type_of_interest : io_name_t; 471 in wake_port : mach_port_make_send_t; 472 in reference : io_async_ref_t; 473 out notification : io_object_t 474 ); 475routine io_service_acknowledge_notification( 476 service : io_object_t; 477 in notify_ref : natural_t; 478 in response : natural_t 479 ); 480#else 481skip; 482skip; 483skip; 484#endif 485 486routine io_connect_get_notification_semaphore( 487 connection : io_connect_t; 488 in notification_type : natural_t; 489 out semaphore : semaphore_t 490 ); 491 492#if KERNEL_SERVER || __ILP32__ 493routine io_connect_unmap_memory( 494 connection : io_connect_t; 495 in memory_type : uint32_t; 496 in into_task : task_t; 497#if KERNEL_SERVER 498 in address : uint32_t 499#else 500 in address : vm_address_t 501#endif 502 ); 503#else 504skip; 505#endif 506 507routine io_registry_entry_get_location_in_plane( 508 registry_entry : io_object_t; 509 in plane : io_name_t; 510 out location : io_name_t 511 ); 512 513routine io_registry_entry_get_property_recursively( 514 registry_entry : io_object_t; 515 in plane : io_name_t; 516 in property_name : io_name_t; 517 in options : uint32_t; 518 out properties : io_buf_ptr_t, physicalcopy 519 ); 520 521routine io_service_get_state( 522 service : io_object_t; 523 out state : uint64_t; 524 out busy_state : uint32_t; 525 out accumulated_busy_time : uint64_t 526 ); 527 528routine io_service_get_matching_services_ool( 529 master_port : mach_port_t; 530 in matching : io_buf_ptr_t, physicalcopy; 531 out result : kern_return_t; 532 out existing : io_object_t 533 ); 534 535routine io_service_match_property_table_ool( 536 service : io_object_t; 537 in matching : io_buf_ptr_t, physicalcopy; 538 out result : kern_return_t; 539 out matches : boolean_t 540 ); 541 542#if KERNEL_SERVER || __ILP32__ 543routine io_service_add_notification_ool( 544 master_port : mach_port_t; 545 in notification_type : io_name_t; 546 in matching : io_buf_ptr_t, physicalcopy; 547 in wake_port : mach_port_make_send_t; 548 in reference : io_async_ref_t; 549 out result : kern_return_t; 550 out notification : io_object_t 551 ); 552#else 553skip; 554#endif 555 556routine io_object_get_superclass( 557 master_port : mach_port_t; 558 in obj_name : io_name_t; 559 out class_name : io_name_t 560 ); 561 562routine io_object_get_bundle_identifier( 563 master_port : mach_port_t; 564 in obj_name : io_name_t; 565 out class_name : io_name_t 566 ); 567 568routine io_service_open_extended( 569 service : io_object_t; 570 in owningTask : task_t; 571 in connect_type : uint32_t; 572 in ndr : NDR_record_t; 573 in properties : io_buf_ptr_t, physicalcopy; 574 out result : kern_return_t; 575 out connection : io_connect_t 576 ); 577 578 579/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 580 581routine io_connect_map_memory_into_task( 582 connection : io_connect_t; 583 in memory_type : uint32_t; 584 in into_task : task_t; 585 inout address : mach_vm_address_t; 586 inout size : mach_vm_size_t; 587 in flags : uint32_t 588 ); 589 590routine io_connect_unmap_memory_from_task( 591 connection : io_connect_t; 592 in memory_type : uint32_t; 593 in from_task : task_t; 594 in address : mach_vm_address_t 595 ); 596 597routine io_connect_method( 598 connection : io_connect_t; 599 in selector : uint32_t; 600 601 in scalar_input : io_scalar_inband64_t; 602 in inband_input : io_struct_inband_t; 603 in ool_input : mach_vm_address_t; 604 in ool_input_size : mach_vm_size_t; 605 606 out inband_output : io_struct_inband_t, CountInOut; 607 out scalar_output : io_scalar_inband64_t, CountInOut; 608 in ool_output : mach_vm_address_t; 609 inout ool_output_size : mach_vm_size_t 610 ); 611 612routine io_connect_async_method( 613 connection : io_connect_t; 614 in wake_port : mach_port_make_send_t; 615 in reference : io_async_ref64_t; 616 in selector : uint32_t; 617 618 in scalar_input : io_scalar_inband64_t; 619 in inband_input : io_struct_inband_t; 620 in ool_input : mach_vm_address_t; 621 in ool_input_size : mach_vm_size_t; 622 623 out inband_output : io_struct_inband_t, CountInOut; 624 out scalar_output : io_scalar_inband64_t, CountInOut; 625 in ool_output : mach_vm_address_t; 626 inout ool_output_size : mach_vm_size_t 627 ); 628 629 630#if KERNEL_SERVER || __LP64__ 631 632#if KERNEL_SERVER 633#define FUNC_NAME(name) name ## _64 634#else 635#define FUNC_NAME(name) name 636#endif 637 638routine FUNC_NAME(io_connect_set_notification_port)( 639 connection : io_connect_t; 640 in notification_type : uint32_t; 641 in port : mach_port_make_send_t; 642 in reference : io_user_reference_t 643 ); 644 645routine FUNC_NAME(io_service_add_notification)( 646 master_port : mach_port_t; 647 in notification_type : io_name_t; 648 in matching : io_string_t; 649 in wake_port : mach_port_make_send_t; 650 in reference : io_async_ref64_t; 651 out notification : io_object_t 652 ); 653 654routine FUNC_NAME(io_service_add_interest_notification)( 655 service : io_object_t; 656 in type_of_interest : io_name_t; 657 in wake_port : mach_port_make_send_t; 658 in reference : io_async_ref64_t; 659 out notification : io_object_t 660 ); 661 662routine FUNC_NAME(io_service_add_notification_ool)( 663 master_port : mach_port_t; 664 in notification_type : io_name_t; 665 in matching : io_buf_ptr_t, physicalcopy; 666 in wake_port : mach_port_make_send_t; 667 in reference : io_async_ref64_t; 668 out result : kern_return_t; 669 out notification : io_object_t 670 ); 671 672#else 673 674 skip; 675 skip; 676 skip; 677 skip; 678 679#endif /* KERNEL_SERVER || __LP64__ */ 680 681routine io_registry_entry_get_registry_entry_id( 682 registry_entry : io_object_t; 683 out entry_id : uint64_t 684 ); 685 686routine io_connect_method_var_output( 687 connection : io_connect_t; 688 in selector : uint32_t; 689 690 in scalar_input : io_scalar_inband64_t; 691 in inband_input : io_struct_inband_t; 692 in ool_input : mach_vm_address_t; 693 in ool_input_size : mach_vm_size_t; 694 695 out inband_output : io_struct_inband_t, CountInOut; 696 out scalar_output : io_scalar_inband64_t, CountInOut; 697 out var_output : io_buf_ptr_t, physicalcopy 698 ); 699 700routine io_service_get_matching_service( 701 master_port : mach_port_t; 702 in matching : io_string_t; 703 out service : io_object_t 704 ); 705 706routine io_service_get_matching_service_ool( 707 master_port : mach_port_t; 708 in matching : io_buf_ptr_t, physicalcopy; 709 out result : kern_return_t; 710 out service : io_object_t 711 ); 712 713 714#endif /* IOKIT */ 715 716/* vim: set ft=c : */ 717