at v2.6.12-rc4 765 lines 21 kB view raw
1/****************************************************************************** 2 * 3 * Name: acinterp.h - Interpreter subcomponent prototypes and defines 4 * 5 *****************************************************************************/ 6 7/* 8 * Copyright (C) 2000 - 2005, 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 51acpi_status 52acpi_ex_resolve_operands ( 53 u16 opcode, 54 union acpi_operand_object **stack_ptr, 55 struct acpi_walk_state *walk_state); 56 57acpi_status 58acpi_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 67acpi_status 68acpi_ex_load_table ( 69 acpi_table_type table_id); 70 71acpi_status 72acpi_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 82acpi_status 83acpi_ex_convert_to_integer ( 84 union acpi_operand_object *obj_desc, 85 union acpi_operand_object **result_desc, 86 u32 flags); 87 88acpi_status 89acpi_ex_convert_to_buffer ( 90 union acpi_operand_object *obj_desc, 91 union acpi_operand_object **result_desc); 92 93acpi_status 94acpi_ex_convert_to_string ( 95 union acpi_operand_object *obj_desc, 96 union acpi_operand_object **result_desc, 97 u32 type); 98 99/* Types for ->String conversion */ 100 101#define ACPI_EXPLICIT_BYTE_COPY 0x00000000 102#define ACPI_EXPLICIT_CONVERT_HEX 0x00000001 103#define ACPI_IMPLICIT_CONVERT_HEX 0x00000002 104#define ACPI_EXPLICIT_CONVERT_DECIMAL 0x00000003 105 106acpi_status 107acpi_ex_convert_to_target_type ( 108 acpi_object_type destination_type, 109 union acpi_operand_object *source_desc, 110 union acpi_operand_object **result_desc, 111 struct acpi_walk_state *walk_state); 112 113u32 114acpi_ex_convert_to_ascii ( 115 acpi_integer integer, 116 u16 base, 117 u8 *string, 118 u8 max_length); 119 120/* 121 * exfield - ACPI AML (p-code) execution - field manipulation 122 */ 123 124acpi_status 125acpi_ex_common_buffer_setup ( 126 union acpi_operand_object *obj_desc, 127 u32 buffer_length, 128 u32 *datum_count); 129 130acpi_status 131acpi_ex_extract_from_field ( 132 union acpi_operand_object *obj_desc, 133 void *buffer, 134 u32 buffer_length); 135 136acpi_status 137acpi_ex_insert_into_field ( 138 union acpi_operand_object *obj_desc, 139 void *buffer, 140 u32 buffer_length); 141 142acpi_status 143acpi_ex_setup_region ( 144 union acpi_operand_object *obj_desc, 145 u32 field_datum_byte_offset); 146 147acpi_status 148acpi_ex_access_region ( 149 union acpi_operand_object *obj_desc, 150 u32 field_datum_byte_offset, 151 acpi_integer *value, 152 u32 read_write); 153 154u8 155acpi_ex_register_overflow ( 156 union acpi_operand_object *obj_desc, 157 acpi_integer value); 158 159acpi_status 160acpi_ex_field_datum_io ( 161 union acpi_operand_object *obj_desc, 162 u32 field_datum_byte_offset, 163 acpi_integer *value, 164 u32 read_write); 165 166acpi_status 167acpi_ex_write_with_update_rule ( 168 union acpi_operand_object *obj_desc, 169 acpi_integer mask, 170 acpi_integer field_value, 171 u32 field_datum_byte_offset); 172 173void 174acpi_ex_get_buffer_datum( 175 acpi_integer *datum, 176 void *buffer, 177 u32 buffer_length, 178 u32 byte_granularity, 179 u32 buffer_offset); 180 181void 182acpi_ex_set_buffer_datum ( 183 acpi_integer merged_datum, 184 void *buffer, 185 u32 buffer_length, 186 u32 byte_granularity, 187 u32 buffer_offset); 188 189acpi_status 190acpi_ex_read_data_from_field ( 191 struct acpi_walk_state *walk_state, 192 union acpi_operand_object *obj_desc, 193 union acpi_operand_object **ret_buffer_desc); 194 195acpi_status 196acpi_ex_write_data_to_field ( 197 union acpi_operand_object *source_desc, 198 union acpi_operand_object *obj_desc, 199 union acpi_operand_object **result_desc); 200 201/* 202 * exmisc - ACPI AML (p-code) execution - specific opcodes 203 */ 204 205acpi_status 206acpi_ex_opcode_3A_0T_0R ( 207 struct acpi_walk_state *walk_state); 208 209acpi_status 210acpi_ex_opcode_3A_1T_1R ( 211 struct acpi_walk_state *walk_state); 212 213acpi_status 214acpi_ex_opcode_6A_0T_1R ( 215 struct acpi_walk_state *walk_state); 216 217u8 218acpi_ex_do_match ( 219 u32 match_op, 220 union acpi_operand_object *package_obj, 221 union acpi_operand_object *match_obj); 222 223acpi_status 224acpi_ex_get_object_reference ( 225 union acpi_operand_object *obj_desc, 226 union acpi_operand_object **return_desc, 227 struct acpi_walk_state *walk_state); 228 229acpi_status 230acpi_ex_resolve_multiple ( 231 struct acpi_walk_state *walk_state, 232 union acpi_operand_object *operand, 233 acpi_object_type *return_type, 234 union acpi_operand_object **return_desc); 235 236acpi_status 237acpi_ex_concat_template ( 238 union acpi_operand_object *obj_desc, 239 union acpi_operand_object *obj_desc2, 240 union acpi_operand_object **actual_return_desc, 241 struct acpi_walk_state *walk_state); 242 243acpi_status 244acpi_ex_do_concatenate ( 245 union acpi_operand_object *obj_desc, 246 union acpi_operand_object *obj_desc2, 247 union acpi_operand_object **actual_return_desc, 248 struct acpi_walk_state *walk_state); 249 250acpi_status 251acpi_ex_do_logical_numeric_op ( 252 u16 opcode, 253 acpi_integer integer0, 254 acpi_integer integer1, 255 u8 *logical_result); 256 257acpi_status 258acpi_ex_do_logical_op ( 259 u16 opcode, 260 union acpi_operand_object *operand0, 261 union acpi_operand_object *operand1, 262 u8 *logical_result); 263 264acpi_integer 265acpi_ex_do_math_op ( 266 u16 opcode, 267 acpi_integer operand0, 268 acpi_integer operand1); 269 270acpi_status 271acpi_ex_create_mutex ( 272 struct acpi_walk_state *walk_state); 273 274acpi_status 275acpi_ex_create_processor ( 276 struct acpi_walk_state *walk_state); 277 278acpi_status 279acpi_ex_create_power_resource ( 280 struct acpi_walk_state *walk_state); 281 282acpi_status 283acpi_ex_create_region ( 284 u8 *aml_start, 285 u32 aml_length, 286 u8 region_space, 287 struct acpi_walk_state *walk_state); 288 289acpi_status 290acpi_ex_create_table_region ( 291 struct acpi_walk_state *walk_state); 292 293acpi_status 294acpi_ex_create_event ( 295 struct acpi_walk_state *walk_state); 296 297acpi_status 298acpi_ex_create_alias ( 299 struct acpi_walk_state *walk_state); 300 301acpi_status 302acpi_ex_create_method ( 303 u8 *aml_start, 304 u32 aml_length, 305 struct acpi_walk_state *walk_state); 306 307 308/* 309 * exconfig - dynamic table load/unload 310 */ 311 312acpi_status 313acpi_ex_add_table ( 314 struct acpi_table_header *table, 315 struct acpi_namespace_node *parent_node, 316 union acpi_operand_object **ddb_handle); 317 318acpi_status 319acpi_ex_load_op ( 320 union acpi_operand_object *obj_desc, 321 union acpi_operand_object *target, 322 struct acpi_walk_state *walk_state); 323 324acpi_status 325acpi_ex_load_table_op ( 326 struct acpi_walk_state *walk_state, 327 union acpi_operand_object **return_desc); 328 329acpi_status 330acpi_ex_unload_table ( 331 union acpi_operand_object *ddb_handle); 332 333 334/* 335 * exmutex - mutex support 336 */ 337 338acpi_status 339acpi_ex_acquire_mutex ( 340 union acpi_operand_object *time_desc, 341 union acpi_operand_object *obj_desc, 342 struct acpi_walk_state *walk_state); 343 344acpi_status 345acpi_ex_release_mutex ( 346 union acpi_operand_object *obj_desc, 347 struct acpi_walk_state *walk_state); 348 349void 350acpi_ex_release_all_mutexes ( 351 struct acpi_thread_state *thread); 352 353void 354acpi_ex_unlink_mutex ( 355 union acpi_operand_object *obj_desc); 356 357void 358acpi_ex_link_mutex ( 359 union acpi_operand_object *obj_desc, 360 struct acpi_thread_state *thread); 361 362/* 363 * exprep - ACPI AML (p-code) execution - prep utilities 364 */ 365 366acpi_status 367acpi_ex_prep_common_field_object ( 368 union acpi_operand_object *obj_desc, 369 u8 field_flags, 370 u8 field_attribute, 371 u32 field_bit_position, 372 u32 field_bit_length); 373 374acpi_status 375acpi_ex_prep_field_value ( 376 struct acpi_create_field_info *info); 377 378/* 379 * exsystem - Interface to OS services 380 */ 381 382acpi_status 383acpi_ex_system_do_notify_op ( 384 union acpi_operand_object *value, 385 union acpi_operand_object *obj_desc); 386 387acpi_status 388acpi_ex_system_do_suspend( 389 acpi_integer time); 390 391acpi_status 392acpi_ex_system_do_stall ( 393 u32 time); 394 395acpi_status 396acpi_ex_system_acquire_mutex( 397 union acpi_operand_object *time, 398 union acpi_operand_object *obj_desc); 399 400acpi_status 401acpi_ex_system_release_mutex( 402 union acpi_operand_object *obj_desc); 403 404acpi_status 405acpi_ex_system_signal_event( 406 union acpi_operand_object *obj_desc); 407 408acpi_status 409acpi_ex_system_wait_event( 410 union acpi_operand_object *time, 411 union acpi_operand_object *obj_desc); 412 413acpi_status 414acpi_ex_system_reset_event( 415 union acpi_operand_object *obj_desc); 416 417acpi_status 418acpi_ex_system_wait_semaphore ( 419 acpi_handle semaphore, 420 u16 timeout); 421 422 423/* 424 * exmonadic - ACPI AML (p-code) execution, monadic operators 425 */ 426 427acpi_status 428acpi_ex_opcode_0A_0T_1R ( 429 struct acpi_walk_state *walk_state); 430 431acpi_status 432acpi_ex_opcode_1A_0T_0R ( 433 struct acpi_walk_state *walk_state); 434 435acpi_status 436acpi_ex_opcode_1A_0T_1R ( 437 struct acpi_walk_state *walk_state); 438 439acpi_status 440acpi_ex_opcode_1A_1T_1R ( 441 struct acpi_walk_state *walk_state); 442 443acpi_status 444acpi_ex_opcode_1A_1T_0R ( 445 struct acpi_walk_state *walk_state); 446 447/* 448 * exdyadic - ACPI AML (p-code) execution, dyadic operators 449 */ 450 451acpi_status 452acpi_ex_opcode_2A_0T_0R ( 453 struct acpi_walk_state *walk_state); 454 455acpi_status 456acpi_ex_opcode_2A_0T_1R ( 457 struct acpi_walk_state *walk_state); 458 459acpi_status 460acpi_ex_opcode_2A_1T_1R ( 461 struct acpi_walk_state *walk_state); 462 463acpi_status 464acpi_ex_opcode_2A_2T_1R ( 465 struct acpi_walk_state *walk_state); 466 467 468/* 469 * exresolv - Object resolution and get value functions 470 */ 471 472acpi_status 473acpi_ex_resolve_to_value ( 474 union acpi_operand_object **stack_ptr, 475 struct acpi_walk_state *walk_state); 476 477acpi_status 478acpi_ex_resolve_node_to_value ( 479 struct acpi_namespace_node **stack_ptr, 480 struct acpi_walk_state *walk_state); 481 482acpi_status 483acpi_ex_resolve_object_to_value ( 484 union acpi_operand_object **stack_ptr, 485 struct acpi_walk_state *walk_state); 486 487 488/* 489 * exdump - Interpreter debug output routines 490 */ 491 492void 493acpi_ex_dump_operand ( 494 union acpi_operand_object *obj_desc, 495 u32 depth); 496 497void 498acpi_ex_dump_operands ( 499 union acpi_operand_object **operands, 500 acpi_interpreter_mode interpreter_mode, 501 char *ident, 502 u32 num_levels, 503 char *note, 504 char *module_name, 505 u32 line_number); 506 507#ifdef ACPI_FUTURE_USAGE 508void 509acpi_ex_dump_object_descriptor ( 510 union acpi_operand_object *object, 511 u32 flags); 512 513void 514acpi_ex_dump_node ( 515 struct acpi_namespace_node *node, 516 u32 flags); 517 518void 519acpi_ex_out_string ( 520 char *title, 521 char *value); 522 523void 524acpi_ex_out_pointer ( 525 char *title, 526 void *value); 527 528void 529acpi_ex_out_integer ( 530 char *title, 531 u32 value); 532 533void 534acpi_ex_out_address ( 535 char *title, 536 acpi_physical_address value); 537#endif /* ACPI_FUTURE_USAGE */ 538 539/* 540 * exnames - interpreter/scanner name load/execute 541 */ 542 543char * 544acpi_ex_allocate_name_string ( 545 u32 prefix_count, 546 u32 num_name_segs); 547 548u32 549acpi_ex_good_char ( 550 u32 character); 551 552acpi_status 553acpi_ex_name_segment ( 554 u8 **in_aml_address, 555 char *name_string); 556 557acpi_status 558acpi_ex_get_name_string ( 559 acpi_object_type data_type, 560 u8 *in_aml_address, 561 char **out_name_string, 562 u32 *out_name_length); 563 564acpi_status 565acpi_ex_do_name ( 566 acpi_object_type data_type, 567 acpi_interpreter_mode load_exec_mode); 568 569 570/* 571 * exstore - Object store support 572 */ 573 574acpi_status 575acpi_ex_store ( 576 union acpi_operand_object *val_desc, 577 union acpi_operand_object *dest_desc, 578 struct acpi_walk_state *walk_state); 579 580acpi_status 581acpi_ex_store_object_to_index ( 582 union acpi_operand_object *val_desc, 583 union acpi_operand_object *dest_desc, 584 struct acpi_walk_state *walk_state); 585 586acpi_status 587acpi_ex_store_object_to_node ( 588 union acpi_operand_object *source_desc, 589 struct acpi_namespace_node *node, 590 struct acpi_walk_state *walk_state, 591 u8 implicit_conversion); 592 593#define ACPI_IMPLICIT_CONVERSION TRUE 594#define ACPI_NO_IMPLICIT_CONVERSION FALSE 595 596/* 597 * exstoren 598 */ 599 600acpi_status 601acpi_ex_resolve_object ( 602 union acpi_operand_object **source_desc_ptr, 603 acpi_object_type target_type, 604 struct acpi_walk_state *walk_state); 605 606acpi_status 607acpi_ex_store_object_to_object ( 608 union acpi_operand_object *source_desc, 609 union acpi_operand_object *dest_desc, 610 union acpi_operand_object **new_desc, 611 struct acpi_walk_state *walk_state); 612 613 614/* 615 * excopy - object copy 616 */ 617 618acpi_status 619acpi_ex_store_buffer_to_buffer ( 620 union acpi_operand_object *source_desc, 621 union acpi_operand_object *target_desc); 622 623acpi_status 624acpi_ex_store_string_to_string ( 625 union acpi_operand_object *source_desc, 626 union acpi_operand_object *target_desc); 627 628acpi_status 629acpi_ex_copy_integer_to_index_field ( 630 union acpi_operand_object *source_desc, 631 union acpi_operand_object *target_desc); 632 633acpi_status 634acpi_ex_copy_integer_to_bank_field ( 635 union acpi_operand_object *source_desc, 636 union acpi_operand_object *target_desc); 637 638acpi_status 639acpi_ex_copy_data_to_named_field ( 640 union acpi_operand_object *source_desc, 641 struct acpi_namespace_node *node); 642 643acpi_status 644acpi_ex_copy_integer_to_buffer_field ( 645 union acpi_operand_object *source_desc, 646 union acpi_operand_object *target_desc); 647 648/* 649 * exutils - interpreter/scanner utilities 650 */ 651 652acpi_status 653acpi_ex_enter_interpreter ( 654 void); 655 656void 657acpi_ex_exit_interpreter ( 658 void); 659 660void 661acpi_ex_truncate_for32bit_table ( 662 union acpi_operand_object *obj_desc); 663 664u8 665acpi_ex_acquire_global_lock ( 666 u32 rule); 667 668void 669acpi_ex_release_global_lock ( 670 u8 locked); 671 672u32 673acpi_ex_digits_needed ( 674 acpi_integer value, 675 u32 base); 676 677void 678acpi_ex_eisa_id_to_string ( 679 u32 numeric_id, 680 char *out_string); 681 682void 683acpi_ex_unsigned_integer_to_string ( 684 acpi_integer value, 685 char *out_string); 686 687 688/* 689 * exregion - default op_region handlers 690 */ 691 692acpi_status 693acpi_ex_system_memory_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 701acpi_status 702acpi_ex_system_io_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 710acpi_status 711acpi_ex_pci_config_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 719acpi_status 720acpi_ex_cmos_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 728acpi_status 729acpi_ex_pci_bar_space_handler ( 730 u32 function, 731 acpi_physical_address address, 732 u32 bit_width, 733 acpi_integer *value, 734 void *handler_context, 735 void *region_context); 736 737acpi_status 738acpi_ex_embedded_controller_space_handler ( 739 u32 function, 740 acpi_physical_address address, 741 u32 bit_width, 742 acpi_integer *value, 743 void *handler_context, 744 void *region_context); 745 746acpi_status 747acpi_ex_sm_bus_space_handler ( 748 u32 function, 749 acpi_physical_address address, 750 u32 bit_width, 751 acpi_integer *value, 752 void *handler_context, 753 void *region_context); 754 755 756acpi_status 757acpi_ex_data_table_space_handler ( 758 u32 function, 759 acpi_physical_address address, 760 u32 bit_width, 761 acpi_integer *value, 762 void *handler_context, 763 void *region_context); 764 765#endif /* __INTERP_H__ */