1/****************************************************************************** 2 * 3 * Name: acinterp.h - Interpreter subcomponent prototypes and defines 4 * $Revision: 1.1.1.1 $ 5 * 6 *****************************************************************************/ 7 8/* 9 * Copyright (C) 2000, 2001 R. Byron Moore 10 * 11 * This program is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License as published by 13 * the Free Software Foundation; either version 2 of the License, or 14 * (at your option) any later version. 15 * 16 * This program is distributed in the hope that it will be useful, 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU General Public License for more details. 20 * 21 * You should have received a copy of the GNU General Public License 22 * along with this program; if not, write to the Free Software 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 */ 25 26#ifndef __ACINTERP_H__ 27#define __ACINTERP_H__ 28 29 30#define WALK_OPERANDS &(walk_state->operands [walk_state->num_operands -1]) 31 32 33/* Interpreter constants */ 34 35#define AML_END_OF_BLOCK -1 36#define PUSH_PKG_LENGTH 1 37#define DO_NOT_PUSH_PKG_LENGTH 0 38 39 40#define STACK_TOP 0 41#define STACK_BOTTOM (u32) -1 42 43/* Constants for global "When_to_parse_methods" */ 44 45#define METHOD_PARSE_AT_INIT 0x0 46#define METHOD_PARSE_JUST_IN_TIME 0x1 47#define METHOD_DELETE_AT_COMPLETION 0x2 48 49 50acpi_status 51acpi_ex_resolve_operands ( 52 u16 opcode, 53 acpi_operand_object **stack_ptr, 54 acpi_walk_state *walk_state); 55 56 57/* 58 * amxface - External interpreter interfaces 59 */ 60 61acpi_status 62acpi_ex_load_table ( 63 acpi_table_type table_id); 64 65acpi_status 66acpi_ex_execute_method ( 67 acpi_namespace_node *method_node, 68 acpi_operand_object **params, 69 acpi_operand_object **return_obj_desc); 70 71 72/* 73 * amconvrt - object conversion 74 */ 75 76acpi_status 77acpi_ex_convert_to_integer ( 78 acpi_operand_object *obj_desc, 79 acpi_operand_object **result_desc, 80 acpi_walk_state *walk_state); 81 82acpi_status 83acpi_ex_convert_to_buffer ( 84 acpi_operand_object *obj_desc, 85 acpi_operand_object **result_desc, 86 acpi_walk_state *walk_state); 87 88acpi_status 89acpi_ex_convert_to_string ( 90 acpi_operand_object *obj_desc, 91 acpi_operand_object **result_desc, 92 u32 base, 93 u32 max_length, 94 acpi_walk_state *walk_state); 95 96acpi_status 97acpi_ex_convert_to_target_type ( 98 acpi_object_type8 destination_type, 99 acpi_operand_object **obj_desc, 100 acpi_walk_state *walk_state); 101 102 103/* 104 * amfield - ACPI AML (p-code) execution - field manipulation 105 */ 106 107acpi_status 108acpi_ex_extract_from_field ( 109 acpi_operand_object *obj_desc, 110 void *buffer, 111 u32 buffer_length); 112 113acpi_status 114acpi_ex_insert_into_field ( 115 acpi_operand_object *obj_desc, 116 void *buffer, 117 u32 buffer_length); 118 119acpi_status 120acpi_ex_setup_field ( 121 acpi_operand_object *obj_desc, 122 u32 field_byte_offset); 123 124acpi_status 125acpi_ex_read_field_datum ( 126 acpi_operand_object *obj_desc, 127 u32 field_byte_offset, 128 u32 *value); 129 130acpi_status 131acpi_ex_common_access_field ( 132 u32 mode, 133 acpi_operand_object *obj_desc, 134 void *buffer, 135 u32 buffer_length); 136 137 138acpi_status 139acpi_ex_access_index_field ( 140 u32 mode, 141 acpi_operand_object *obj_desc, 142 void *buffer, 143 u32 buffer_length); 144 145acpi_status 146acpi_ex_access_bank_field ( 147 u32 mode, 148 acpi_operand_object *obj_desc, 149 void *buffer, 150 u32 buffer_length); 151 152acpi_status 153acpi_ex_access_region_field ( 154 u32 mode, 155 acpi_operand_object *obj_desc, 156 void *buffer, 157 u32 buffer_length); 158 159 160acpi_status 161acpi_ex_access_buffer_field ( 162 u32 mode, 163 acpi_operand_object *obj_desc, 164 void *buffer, 165 u32 buffer_length); 166 167acpi_status 168acpi_ex_read_data_from_field ( 169 acpi_operand_object *obj_desc, 170 acpi_operand_object **ret_buffer_desc); 171 172acpi_status 173acpi_ex_write_data_to_field ( 174 acpi_operand_object *source_desc, 175 acpi_operand_object *obj_desc); 176 177/* 178 * ammisc - ACPI AML (p-code) execution - specific opcodes 179 */ 180 181acpi_status 182acpi_ex_opcode_3A_0T_0R ( 183 acpi_walk_state *walk_state); 184 185acpi_status 186acpi_ex_opcode_3A_1T_1R ( 187 acpi_walk_state *walk_state); 188 189acpi_status 190acpi_ex_opcode_6A_0T_1R ( 191 acpi_walk_state *walk_state); 192 193acpi_status 194acpi_ex_get_object_reference ( 195 acpi_operand_object *obj_desc, 196 acpi_operand_object **return_desc, 197 acpi_walk_state *walk_state); 198 199acpi_status 200acpi_ex_do_concatenate ( 201 acpi_operand_object *obj_desc, 202 acpi_operand_object *obj_desc2, 203 acpi_operand_object **actual_return_desc, 204 acpi_walk_state *walk_state); 205 206u8 207acpi_ex_do_logical_op ( 208 u16 opcode, 209 acpi_integer operand0, 210 acpi_integer operand1); 211 212acpi_integer 213acpi_ex_do_math_op ( 214 u16 opcode, 215 acpi_integer operand0, 216 acpi_integer operand1); 217 218acpi_status 219acpi_ex_load_op ( 220 acpi_operand_object *rgn_desc, 221 acpi_operand_object *ddb_handle); 222 223acpi_status 224acpi_ex_unload_table ( 225 acpi_operand_object *ddb_handle); 226 227acpi_status 228acpi_ex_create_mutex ( 229 acpi_walk_state *walk_state); 230 231acpi_status 232acpi_ex_create_processor ( 233 acpi_walk_state *walk_state); 234 235acpi_status 236acpi_ex_create_power_resource ( 237 acpi_walk_state *walk_state); 238 239acpi_status 240acpi_ex_create_region ( 241 u8 *aml_start, 242 u32 aml_length, 243 u8 region_space, 244 acpi_walk_state *walk_state); 245 246acpi_status 247acpi_ex_create_table_region ( 248 acpi_walk_state *walk_state); 249 250acpi_status 251acpi_ex_create_event ( 252 acpi_walk_state *walk_state); 253 254acpi_status 255acpi_ex_create_alias ( 256 acpi_walk_state *walk_state); 257 258acpi_status 259acpi_ex_create_method ( 260 u8 *aml_start, 261 u32 aml_length, 262 acpi_walk_state *walk_state); 263 264 265/* 266 * ammutex - mutex support 267 */ 268 269acpi_status 270acpi_ex_acquire_mutex ( 271 acpi_operand_object *time_desc, 272 acpi_operand_object *obj_desc, 273 acpi_walk_state *walk_state); 274 275acpi_status 276acpi_ex_release_mutex ( 277 acpi_operand_object *obj_desc, 278 acpi_walk_state *walk_state); 279 280acpi_status 281acpi_ex_release_all_mutexes ( 282 acpi_operand_object *mutex_list); 283 284void 285acpi_ex_unlink_mutex ( 286 acpi_operand_object *obj_desc); 287 288 289/* 290 * amprep - ACPI AML (p-code) execution - prep utilities 291 */ 292 293acpi_status 294acpi_ex_prep_common_field_object ( 295 acpi_operand_object *obj_desc, 296 u8 field_flags, 297 u32 field_position, 298 u32 field_length); 299 300acpi_status 301acpi_ex_prep_region_field_value ( 302 acpi_namespace_node *node, 303 acpi_handle region, 304 u8 field_flags, 305 u32 field_position, 306 u32 field_length); 307 308acpi_status 309acpi_ex_prep_bank_field_value ( 310 acpi_namespace_node *node, 311 acpi_namespace_node *region_node, 312 acpi_namespace_node *bank_register_node, 313 u32 bank_val, 314 u8 field_flags, 315 u32 field_position, 316 u32 field_length); 317 318acpi_status 319acpi_ex_prep_index_field_value ( 320 acpi_namespace_node *node, 321 acpi_namespace_node *index_reg, 322 acpi_namespace_node *data_reg, 323 u8 field_flags, 324 u32 field_position, 325 u32 field_length); 326 327acpi_status 328acpi_ex_prep_field_value ( 329 ACPI_CREATE_FIELD_INFO *info); 330 331/* 332 * amsystem - Interface to OS services 333 */ 334 335acpi_status 336acpi_ex_system_do_notify_op ( 337 acpi_operand_object *value, 338 acpi_operand_object *obj_desc); 339 340void 341acpi_ex_system_do_suspend( 342 u32 time); 343 344void 345acpi_ex_system_do_stall ( 346 u32 time); 347 348acpi_status 349acpi_ex_system_acquire_mutex( 350 acpi_operand_object *time, 351 acpi_operand_object *obj_desc); 352 353acpi_status 354acpi_ex_system_release_mutex( 355 acpi_operand_object *obj_desc); 356 357acpi_status 358acpi_ex_system_signal_event( 359 acpi_operand_object *obj_desc); 360 361acpi_status 362acpi_ex_system_wait_event( 363 acpi_operand_object *time, 364 acpi_operand_object *obj_desc); 365 366acpi_status 367acpi_ex_system_reset_event( 368 acpi_operand_object *obj_desc); 369 370acpi_status 371acpi_ex_system_wait_semaphore ( 372 acpi_handle semaphore, 373 u32 timeout); 374 375 376/* 377 * ammonadic - ACPI AML (p-code) execution, monadic operators 378 */ 379 380acpi_status 381acpi_ex_opcode_1A_0T_0R ( 382 acpi_walk_state *walk_state); 383 384acpi_status 385acpi_ex_opcode_1A_0T_1R ( 386 acpi_walk_state *walk_state); 387 388acpi_status 389acpi_ex_opcode_1A_1T_1R ( 390 acpi_walk_state *walk_state); 391 392acpi_status 393acpi_ex_opcode_1A_1T_0R ( 394 acpi_walk_state *walk_state); 395 396/* 397 * amdyadic - ACPI AML (p-code) execution, dyadic operators 398 */ 399 400acpi_status 401acpi_ex_opcode_2A_0T_0R ( 402 acpi_walk_state *walk_state); 403 404acpi_status 405acpi_ex_opcode_2A_0T_1R ( 406 acpi_walk_state *walk_state); 407 408acpi_status 409acpi_ex_opcode_2A_1T_1R ( 410 acpi_walk_state *walk_state); 411 412acpi_status 413acpi_ex_opcode_2A_2T_1R ( 414 acpi_walk_state *walk_state); 415 416 417/* 418 * amresolv - Object resolution and get value functions 419 */ 420 421acpi_status 422acpi_ex_resolve_to_value ( 423 acpi_operand_object **stack_ptr, 424 acpi_walk_state *walk_state); 425 426acpi_status 427acpi_ex_resolve_node_to_value ( 428 acpi_namespace_node **stack_ptr, 429 acpi_walk_state *walk_state); 430 431acpi_status 432acpi_ex_resolve_object_to_value ( 433 acpi_operand_object **stack_ptr, 434 acpi_walk_state *walk_state); 435 436acpi_status 437acpi_ex_get_buffer_field_value ( 438 acpi_operand_object *field_desc, 439 acpi_operand_object *result_desc); 440 441 442/* 443 * amdump - Scanner debug output routines 444 */ 445 446void 447acpi_ex_show_hex_value ( 448 u32 byte_count, 449 u8 *aml_start, 450 u32 lead_space); 451 452 453acpi_status 454acpi_ex_dump_operand ( 455 acpi_operand_object *entry_desc); 456 457void 458acpi_ex_dump_operands ( 459 acpi_operand_object **operands, 460 operating_mode interpreter_mode, 461 NATIVE_CHAR *ident, 462 u32 num_levels, 463 NATIVE_CHAR *note, 464 NATIVE_CHAR *module_name, 465 u32 line_number); 466 467void 468acpi_ex_dump_object_descriptor ( 469 acpi_operand_object *object, 470 u32 flags); 471 472 473void 474acpi_ex_dump_node ( 475 acpi_namespace_node *node, 476 u32 flags); 477 478 479/* 480 * amnames - interpreter/scanner name load/execute 481 */ 482 483NATIVE_CHAR * 484acpi_ex_allocate_name_string ( 485 u32 prefix_count, 486 u32 num_name_segs); 487 488u32 489acpi_ex_good_char ( 490 u32 character); 491 492acpi_status 493acpi_ex_name_segment ( 494 u8 **in_aml_address, 495 NATIVE_CHAR *name_string); 496 497acpi_status 498acpi_ex_get_name_string ( 499 acpi_object_type8 data_type, 500 u8 *in_aml_address, 501 NATIVE_CHAR **out_name_string, 502 u32 *out_name_length); 503 504acpi_status 505acpi_ex_do_name ( 506 acpi_object_type data_type, 507 operating_mode load_exec_mode); 508 509 510/* 511 * amstore - Object store support 512 */ 513 514acpi_status 515acpi_ex_store ( 516 acpi_operand_object *val_desc, 517 acpi_operand_object *dest_desc, 518 acpi_walk_state *walk_state); 519 520acpi_status 521acpi_ex_store_object_to_index ( 522 acpi_operand_object *val_desc, 523 acpi_operand_object *dest_desc, 524 acpi_walk_state *walk_state); 525 526acpi_status 527acpi_ex_store_object_to_node ( 528 acpi_operand_object *source_desc, 529 acpi_namespace_node *node, 530 acpi_walk_state *walk_state); 531 532acpi_status 533acpi_ex_store_object_to_object ( 534 acpi_operand_object *source_desc, 535 acpi_operand_object *dest_desc, 536 acpi_walk_state *walk_state); 537 538 539/* 540 * 541 */ 542 543acpi_status 544acpi_ex_resolve_object ( 545 acpi_operand_object **source_desc_ptr, 546 acpi_object_type8 target_type, 547 acpi_walk_state *walk_state); 548 549acpi_status 550acpi_ex_store_object ( 551 acpi_operand_object *source_desc, 552 acpi_object_type8 target_type, 553 acpi_operand_object **target_desc_ptr, 554 acpi_walk_state *walk_state); 555 556 557/* 558 * amcopy - object copy 559 */ 560 561acpi_status 562acpi_ex_copy_buffer_to_buffer ( 563 acpi_operand_object *source_desc, 564 acpi_operand_object *target_desc); 565 566acpi_status 567acpi_ex_copy_string_to_string ( 568 acpi_operand_object *source_desc, 569 acpi_operand_object *target_desc); 570 571acpi_status 572acpi_ex_copy_integer_to_index_field ( 573 acpi_operand_object *source_desc, 574 acpi_operand_object *target_desc); 575 576acpi_status 577acpi_ex_copy_integer_to_bank_field ( 578 acpi_operand_object *source_desc, 579 acpi_operand_object *target_desc); 580 581acpi_status 582acpi_ex_copy_data_to_named_field ( 583 acpi_operand_object *source_desc, 584 acpi_namespace_node *node); 585 586acpi_status 587acpi_ex_copy_integer_to_buffer_field ( 588 acpi_operand_object *source_desc, 589 acpi_operand_object *target_desc); 590 591/* 592 * amutils - interpreter/scanner utilities 593 */ 594 595acpi_status 596acpi_ex_enter_interpreter ( 597 void); 598 599void 600acpi_ex_exit_interpreter ( 601 void); 602 603void 604acpi_ex_truncate_for32bit_table ( 605 acpi_operand_object *obj_desc, 606 acpi_walk_state *walk_state); 607 608u8 609acpi_ex_validate_object_type ( 610 acpi_object_type type); 611 612u8 613acpi_ex_acquire_global_lock ( 614 u32 rule); 615 616acpi_status 617acpi_ex_release_global_lock ( 618 u8 locked); 619 620u32 621acpi_ex_digits_needed ( 622 acpi_integer value, 623 u32 base); 624 625acpi_status 626acpi_ex_eisa_id_to_string ( 627 u32 numeric_id, 628 NATIVE_CHAR *out_string); 629 630acpi_status 631acpi_ex_unsigned_integer_to_string ( 632 acpi_integer value, 633 NATIVE_CHAR *out_string); 634 635 636/* 637 * amregion - default Op_region handlers 638 */ 639 640acpi_status 641acpi_ex_system_memory_space_handler ( 642 u32 function, 643 ACPI_PHYSICAL_ADDRESS address, 644 u32 bit_width, 645 u32 *value, 646 void *handler_context, 647 void *region_context); 648 649acpi_status 650acpi_ex_system_io_space_handler ( 651 u32 function, 652 ACPI_PHYSICAL_ADDRESS address, 653 u32 bit_width, 654 u32 *value, 655 void *handler_context, 656 void *region_context); 657 658acpi_status 659acpi_ex_pci_config_space_handler ( 660 u32 function, 661 ACPI_PHYSICAL_ADDRESS address, 662 u32 bit_width, 663 u32 *value, 664 void *handler_context, 665 void *region_context); 666 667acpi_status 668acpi_ex_cmos_space_handler ( 669 u32 function, 670 ACPI_PHYSICAL_ADDRESS address, 671 u32 bit_width, 672 u32 *value, 673 void *handler_context, 674 void *region_context); 675 676acpi_status 677acpi_ex_pci_bar_space_handler ( 678 u32 function, 679 ACPI_PHYSICAL_ADDRESS address, 680 u32 bit_width, 681 u32 *value, 682 void *handler_context, 683 void *region_context); 684 685acpi_status 686acpi_ex_embedded_controller_space_handler ( 687 u32 function, 688 ACPI_PHYSICAL_ADDRESS address, 689 u32 bit_width, 690 u32 *value, 691 void *handler_context, 692 void *region_context); 693 694acpi_status 695acpi_ex_sm_bus_space_handler ( 696 u32 function, 697 ACPI_PHYSICAL_ADDRESS address, 698 u32 bit_width, 699 u32 *value, 700 void *handler_context, 701 void *region_context); 702 703 704#endif /* __INTERP_H__ */ 705