1 /****************************************************************************** 2 * 3 * Name: acinterp.h - Interpreter subcomponent prototypes and defines 4 * 5 *****************************************************************************/ 6 7 /* 8 * Copyright (C) 2000 - 2004, R. Byron Moore 9 * All rights reserved. 10 * 11 * Redistribution and use in source and binary forms, with or without 12 * modification, are permitted provided that the following conditions 13 * are met: 14 * 1. Redistributions of source code must retain the above copyright 15 * notice, this list of conditions, and the following disclaimer, 16 * without modification. 17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer 18 * substantially similar to the "NO WARRANTY" disclaimer below 19 * ("Disclaimer") and any redistribution must be conditioned upon 20 * including a substantially similar Disclaimer requirement for further 21 * binary redistribution. 22 * 3. Neither the names of the above-listed copyright holders nor the names 23 * of any contributors may be used to endorse or promote products derived 24 * from this software without specific prior written permission. 25 * 26 * Alternatively, this software may be distributed under the terms of the 27 * GNU General Public License ("GPL") version 2 as published by the Free 28 * Software Foundation. 29 * 30 * NO WARRANTY 31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR 34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 41 * POSSIBILITY OF SUCH DAMAGES. 42 */ 43 44 #ifndef __ACINTERP_H__ 45 #define __ACINTERP_H__ 46 47 48 #define ACPI_WALK_OPERANDS (&(walk_state->operands [walk_state->num_operands -1])) 49 50 51 acpi_status 52 acpi_ex_resolve_operands ( 53 u16 opcode, 54 union acpi_operand_object **stack_ptr, 55 struct acpi_walk_state *walk_state); 56 57 acpi_status 58 acpi_ex_check_object_type ( 59 acpi_object_type type_needed, 60 acpi_object_type this_type, 61 void *object); 62 63 /* 64 * exxface - External interpreter interfaces 65 */ 66 67 acpi_status 68 acpi_ex_load_table ( 69 acpi_table_type table_id); 70 71 acpi_status 72 acpi_ex_execute_method ( 73 struct acpi_namespace_node *method_node, 74 union acpi_operand_object **params, 75 union acpi_operand_object **return_obj_desc); 76 77 78 /* 79 * exconvrt - object conversion 80 */ 81 82 acpi_status 83 acpi_ex_convert_to_integer ( 84 union acpi_operand_object *obj_desc, 85 union acpi_operand_object **result_desc, 86 struct acpi_walk_state *walk_state); 87 88 acpi_status 89 acpi_ex_convert_to_buffer ( 90 union acpi_operand_object *obj_desc, 91 union acpi_operand_object **result_desc, 92 struct acpi_walk_state *walk_state); 93 94 acpi_status 95 acpi_ex_convert_to_string ( 96 union acpi_operand_object *obj_desc, 97 union acpi_operand_object **result_desc, 98 u32 base, 99 u32 max_length, 100 struct acpi_walk_state *walk_state); 101 102 acpi_status 103 acpi_ex_convert_to_target_type ( 104 acpi_object_type destination_type, 105 union acpi_operand_object *source_desc, 106 union acpi_operand_object **result_desc, 107 struct acpi_walk_state *walk_state); 108 109 u32 110 acpi_ex_convert_to_ascii ( 111 acpi_integer integer, 112 u32 base, 113 u8 *string, 114 u8 max_length); 115 116 /* 117 * exfield - ACPI AML (p-code) execution - field manipulation 118 */ 119 120 acpi_status 121 acpi_ex_extract_from_field ( 122 union acpi_operand_object *obj_desc, 123 void *buffer, 124 u32 buffer_length); 125 126 acpi_status 127 acpi_ex_insert_into_field ( 128 union acpi_operand_object *obj_desc, 129 void *buffer, 130 u32 buffer_length); 131 132 acpi_status 133 acpi_ex_setup_region ( 134 union acpi_operand_object *obj_desc, 135 u32 field_datum_byte_offset); 136 137 acpi_status 138 acpi_ex_access_region ( 139 union acpi_operand_object *obj_desc, 140 u32 field_datum_byte_offset, 141 acpi_integer *value, 142 u32 read_write); 143 144 u8 145 acpi_ex_register_overflow ( 146 union acpi_operand_object *obj_desc, 147 acpi_integer value); 148 149 acpi_status 150 acpi_ex_field_datum_io ( 151 union acpi_operand_object *obj_desc, 152 u32 field_datum_byte_offset, 153 acpi_integer *value, 154 u32 read_write); 155 156 acpi_status 157 acpi_ex_write_with_update_rule ( 158 union acpi_operand_object *obj_desc, 159 acpi_integer mask, 160 acpi_integer field_value, 161 u32 field_datum_byte_offset); 162 163 void 164 acpi_ex_get_buffer_datum( 165 acpi_integer *datum, 166 void *buffer, 167 u32 buffer_length, 168 u32 byte_granularity, 169 u32 buffer_offset); 170 171 void 172 acpi_ex_set_buffer_datum ( 173 acpi_integer merged_datum, 174 void *buffer, 175 u32 buffer_length, 176 u32 byte_granularity, 177 u32 buffer_offset); 178 179 acpi_status 180 acpi_ex_read_data_from_field ( 181 struct acpi_walk_state *walk_state, 182 union acpi_operand_object *obj_desc, 183 union acpi_operand_object **ret_buffer_desc); 184 185 acpi_status 186 acpi_ex_write_data_to_field ( 187 union acpi_operand_object *source_desc, 188 union acpi_operand_object *obj_desc, 189 union acpi_operand_object **result_desc); 190 191 /* 192 * exmisc - ACPI AML (p-code) execution - specific opcodes 193 */ 194 195 acpi_status 196 acpi_ex_opcode_3A_0T_0R ( 197 struct acpi_walk_state *walk_state); 198 199 acpi_status 200 acpi_ex_opcode_3A_1T_1R ( 201 struct acpi_walk_state *walk_state); 202 203 acpi_status 204 acpi_ex_opcode_6A_0T_1R ( 205 struct acpi_walk_state *walk_state); 206 207 u8 208 acpi_ex_do_match ( 209 u32 match_op, 210 acpi_integer package_value, 211 acpi_integer match_value); 212 213 acpi_status 214 acpi_ex_get_object_reference ( 215 union acpi_operand_object *obj_desc, 216 union acpi_operand_object **return_desc, 217 struct acpi_walk_state *walk_state); 218 219 acpi_status 220 acpi_ex_resolve_multiple ( 221 struct acpi_walk_state *walk_state, 222 union acpi_operand_object *operand, 223 acpi_object_type *return_type, 224 union acpi_operand_object **return_desc); 225 226 acpi_status 227 acpi_ex_concat_template ( 228 union acpi_operand_object *obj_desc, 229 union acpi_operand_object *obj_desc2, 230 union acpi_operand_object **actual_return_desc, 231 struct acpi_walk_state *walk_state); 232 233 acpi_status 234 acpi_ex_do_concatenate ( 235 union acpi_operand_object *obj_desc, 236 union acpi_operand_object *obj_desc2, 237 union acpi_operand_object **actual_return_desc, 238 struct acpi_walk_state *walk_state); 239 240 u8 241 acpi_ex_do_logical_op ( 242 u16 opcode, 243 acpi_integer operand0, 244 acpi_integer operand1); 245 246 acpi_integer 247 acpi_ex_do_math_op ( 248 u16 opcode, 249 acpi_integer operand0, 250 acpi_integer operand1); 251 252 acpi_status 253 acpi_ex_create_mutex ( 254 struct acpi_walk_state *walk_state); 255 256 acpi_status 257 acpi_ex_create_processor ( 258 struct acpi_walk_state *walk_state); 259 260 acpi_status 261 acpi_ex_create_power_resource ( 262 struct acpi_walk_state *walk_state); 263 264 acpi_status 265 acpi_ex_create_region ( 266 u8 *aml_start, 267 u32 aml_length, 268 u8 region_space, 269 struct acpi_walk_state *walk_state); 270 271 acpi_status 272 acpi_ex_create_table_region ( 273 struct acpi_walk_state *walk_state); 274 275 acpi_status 276 acpi_ex_create_event ( 277 struct acpi_walk_state *walk_state); 278 279 acpi_status 280 acpi_ex_create_alias ( 281 struct acpi_walk_state *walk_state); 282 283 acpi_status 284 acpi_ex_create_method ( 285 u8 *aml_start, 286 u32 aml_length, 287 struct acpi_walk_state *walk_state); 288 289 290 /* 291 * exconfig - dynamic table load/unload 292 */ 293 294 acpi_status 295 acpi_ex_add_table ( 296 struct acpi_table_header *table, 297 struct acpi_namespace_node *parent_node, 298 union acpi_operand_object **ddb_handle); 299 300 acpi_status 301 acpi_ex_load_op ( 302 union acpi_operand_object *obj_desc, 303 union acpi_operand_object *target, 304 struct acpi_walk_state *walk_state); 305 306 acpi_status 307 acpi_ex_load_table_op ( 308 struct acpi_walk_state *walk_state, 309 union acpi_operand_object **return_desc); 310 311 acpi_status 312 acpi_ex_unload_table ( 313 union acpi_operand_object *ddb_handle); 314 315 316 /* 317 * exmutex - mutex support 318 */ 319 320 acpi_status 321 acpi_ex_acquire_mutex ( 322 union acpi_operand_object *time_desc, 323 union acpi_operand_object *obj_desc, 324 struct acpi_walk_state *walk_state); 325 326 acpi_status 327 acpi_ex_release_mutex ( 328 union acpi_operand_object *obj_desc, 329 struct acpi_walk_state *walk_state); 330 331 void 332 acpi_ex_release_all_mutexes ( 333 struct acpi_thread_state *thread); 334 335 void 336 acpi_ex_unlink_mutex ( 337 union acpi_operand_object *obj_desc); 338 339 void 340 acpi_ex_link_mutex ( 341 union acpi_operand_object *obj_desc, 342 struct acpi_thread_state *thread); 343 344 /* 345 * exprep - ACPI AML (p-code) execution - prep utilities 346 */ 347 348 acpi_status 349 acpi_ex_prep_common_field_object ( 350 union acpi_operand_object *obj_desc, 351 u8 field_flags, 352 u8 field_attribute, 353 u32 field_bit_position, 354 u32 field_bit_length); 355 356 acpi_status 357 acpi_ex_prep_field_value ( 358 struct acpi_create_field_info *info); 359 360 /* 361 * exsystem - Interface to OS services 362 */ 363 364 acpi_status 365 acpi_ex_system_do_notify_op ( 366 union acpi_operand_object *value, 367 union acpi_operand_object *obj_desc); 368 369 acpi_status 370 acpi_ex_system_do_suspend( 371 u32 time); 372 373 acpi_status 374 acpi_ex_system_do_stall ( 375 u32 time); 376 377 acpi_status 378 acpi_ex_system_acquire_mutex( 379 union acpi_operand_object *time, 380 union acpi_operand_object *obj_desc); 381 382 acpi_status 383 acpi_ex_system_release_mutex( 384 union acpi_operand_object *obj_desc); 385 386 acpi_status 387 acpi_ex_system_signal_event( 388 union acpi_operand_object *obj_desc); 389 390 acpi_status 391 acpi_ex_system_wait_event( 392 union acpi_operand_object *time, 393 union acpi_operand_object *obj_desc); 394 395 acpi_status 396 acpi_ex_system_reset_event( 397 union acpi_operand_object *obj_desc); 398 399 acpi_status 400 acpi_ex_system_wait_semaphore ( 401 acpi_handle semaphore, 402 u16 timeout); 403 404 405 /* 406 * exmonadic - ACPI AML (p-code) execution, monadic operators 407 */ 408 409 acpi_status 410 acpi_ex_opcode_1A_0T_0R ( 411 struct acpi_walk_state *walk_state); 412 413 acpi_status 414 acpi_ex_opcode_1A_0T_1R ( 415 struct acpi_walk_state *walk_state); 416 417 acpi_status 418 acpi_ex_opcode_1A_1T_1R ( 419 struct acpi_walk_state *walk_state); 420 421 acpi_status 422 acpi_ex_opcode_1A_1T_0R ( 423 struct acpi_walk_state *walk_state); 424 425 /* 426 * exdyadic - ACPI AML (p-code) execution, dyadic operators 427 */ 428 429 acpi_status 430 acpi_ex_opcode_2A_0T_0R ( 431 struct acpi_walk_state *walk_state); 432 433 acpi_status 434 acpi_ex_opcode_2A_0T_1R ( 435 struct acpi_walk_state *walk_state); 436 437 acpi_status 438 acpi_ex_opcode_2A_1T_1R ( 439 struct acpi_walk_state *walk_state); 440 441 acpi_status 442 acpi_ex_opcode_2A_2T_1R ( 443 struct acpi_walk_state *walk_state); 444 445 446 /* 447 * exresolv - Object resolution and get value functions 448 */ 449 450 acpi_status 451 acpi_ex_resolve_to_value ( 452 union acpi_operand_object **stack_ptr, 453 struct acpi_walk_state *walk_state); 454 455 acpi_status 456 acpi_ex_resolve_node_to_value ( 457 struct acpi_namespace_node **stack_ptr, 458 struct acpi_walk_state *walk_state); 459 460 acpi_status 461 acpi_ex_resolve_object_to_value ( 462 union acpi_operand_object **stack_ptr, 463 struct acpi_walk_state *walk_state); 464 465 466 /* 467 * exdump - Scanner debug output routines 468 */ 469 470 void 471 acpi_ex_dump_operand ( 472 union acpi_operand_object *entry_desc); 473 474 void 475 acpi_ex_dump_operands ( 476 union acpi_operand_object **operands, 477 acpi_interpreter_mode interpreter_mode, 478 char *ident, 479 u32 num_levels, 480 char *note, 481 char *module_name, 482 u32 line_number); 483 484 void 485 acpi_ex_dump_object_descriptor ( 486 union acpi_operand_object *object, 487 u32 flags); 488 489 void 490 acpi_ex_dump_node ( 491 struct acpi_namespace_node *node, 492 u32 flags); 493 494 void 495 acpi_ex_out_string ( 496 char *title, 497 char *value); 498 499 void 500 acpi_ex_out_pointer ( 501 char *title, 502 void *value); 503 504 void 505 acpi_ex_out_integer ( 506 char *title, 507 u32 value); 508 509 void 510 acpi_ex_out_address ( 511 char *title, 512 acpi_physical_address value); 513 514 515 /* 516 * exnames - interpreter/scanner name load/execute 517 */ 518 519 char * 520 acpi_ex_allocate_name_string ( 521 u32 prefix_count, 522 u32 num_name_segs); 523 524 u32 525 acpi_ex_good_char ( 526 u32 character); 527 528 acpi_status 529 acpi_ex_name_segment ( 530 u8 **in_aml_address, 531 char *name_string); 532 533 acpi_status 534 acpi_ex_get_name_string ( 535 acpi_object_type data_type, 536 u8 *in_aml_address, 537 char **out_name_string, 538 u32 *out_name_length); 539 540 acpi_status 541 acpi_ex_do_name ( 542 acpi_object_type data_type, 543 acpi_interpreter_mode load_exec_mode); 544 545 546 /* 547 * exstore - Object store support 548 */ 549 550 acpi_status 551 acpi_ex_store ( 552 union acpi_operand_object *val_desc, 553 union acpi_operand_object *dest_desc, 554 struct acpi_walk_state *walk_state); 555 556 acpi_status 557 acpi_ex_store_object_to_index ( 558 union acpi_operand_object *val_desc, 559 union acpi_operand_object *dest_desc, 560 struct acpi_walk_state *walk_state); 561 562 acpi_status 563 acpi_ex_store_object_to_node ( 564 union acpi_operand_object *source_desc, 565 struct acpi_namespace_node *node, 566 struct acpi_walk_state *walk_state); 567 568 569 /* 570 * exstoren 571 */ 572 573 acpi_status 574 acpi_ex_resolve_object ( 575 union acpi_operand_object **source_desc_ptr, 576 acpi_object_type target_type, 577 struct acpi_walk_state *walk_state); 578 579 acpi_status 580 acpi_ex_store_object_to_object ( 581 union acpi_operand_object *source_desc, 582 union acpi_operand_object *dest_desc, 583 union acpi_operand_object **new_desc, 584 struct acpi_walk_state *walk_state); 585 586 587 /* 588 * excopy - object copy 589 */ 590 591 acpi_status 592 acpi_ex_store_buffer_to_buffer ( 593 union acpi_operand_object *source_desc, 594 union acpi_operand_object *target_desc); 595 596 acpi_status 597 acpi_ex_store_string_to_string ( 598 union acpi_operand_object *source_desc, 599 union acpi_operand_object *target_desc); 600 601 acpi_status 602 acpi_ex_copy_integer_to_index_field ( 603 union acpi_operand_object *source_desc, 604 union acpi_operand_object *target_desc); 605 606 acpi_status 607 acpi_ex_copy_integer_to_bank_field ( 608 union acpi_operand_object *source_desc, 609 union acpi_operand_object *target_desc); 610 611 acpi_status 612 acpi_ex_copy_data_to_named_field ( 613 union acpi_operand_object *source_desc, 614 struct acpi_namespace_node *node); 615 616 acpi_status 617 acpi_ex_copy_integer_to_buffer_field ( 618 union acpi_operand_object *source_desc, 619 union acpi_operand_object *target_desc); 620 621 /* 622 * exutils - interpreter/scanner utilities 623 */ 624 625 acpi_status 626 acpi_ex_enter_interpreter ( 627 void); 628 629 void 630 acpi_ex_exit_interpreter ( 631 void); 632 633 void 634 acpi_ex_truncate_for32bit_table ( 635 union acpi_operand_object *obj_desc); 636 637 u8 638 acpi_ex_acquire_global_lock ( 639 u32 rule); 640 641 void 642 acpi_ex_release_global_lock ( 643 u8 locked); 644 645 u32 646 acpi_ex_digits_needed ( 647 acpi_integer value, 648 u32 base); 649 650 void 651 acpi_ex_eisa_id_to_string ( 652 u32 numeric_id, 653 char *out_string); 654 655 void 656 acpi_ex_unsigned_integer_to_string ( 657 acpi_integer value, 658 char *out_string); 659 660 661 /* 662 * exregion - default op_region handlers 663 */ 664 665 acpi_status 666 acpi_ex_system_memory_space_handler ( 667 u32 function, 668 acpi_physical_address address, 669 u32 bit_width, 670 acpi_integer *value, 671 void *handler_context, 672 void *region_context); 673 674 acpi_status 675 acpi_ex_system_io_space_handler ( 676 u32 function, 677 acpi_physical_address address, 678 u32 bit_width, 679 acpi_integer *value, 680 void *handler_context, 681 void *region_context); 682 683 acpi_status 684 acpi_ex_pci_config_space_handler ( 685 u32 function, 686 acpi_physical_address address, 687 u32 bit_width, 688 acpi_integer *value, 689 void *handler_context, 690 void *region_context); 691 692 acpi_status 693 acpi_ex_cmos_space_handler ( 694 u32 function, 695 acpi_physical_address address, 696 u32 bit_width, 697 acpi_integer *value, 698 void *handler_context, 699 void *region_context); 700 701 acpi_status 702 acpi_ex_pci_bar_space_handler ( 703 u32 function, 704 acpi_physical_address address, 705 u32 bit_width, 706 acpi_integer *value, 707 void *handler_context, 708 void *region_context); 709 710 acpi_status 711 acpi_ex_embedded_controller_space_handler ( 712 u32 function, 713 acpi_physical_address address, 714 u32 bit_width, 715 acpi_integer *value, 716 void *handler_context, 717 void *region_context); 718 719 acpi_status 720 acpi_ex_sm_bus_space_handler ( 721 u32 function, 722 acpi_physical_address address, 723 u32 bit_width, 724 acpi_integer *value, 725 void *handler_context, 726 void *region_context); 727 728 729 acpi_status 730 acpi_ex_data_table_space_handler ( 731 u32 function, 732 acpi_physical_address address, 733 u32 bit_width, 734 acpi_integer *value, 735 void *handler_context, 736 void *region_context); 737 738 #endif /* __INTERP_H__ */ 739