Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /****************************************************************************** |
| 2 | * |
| 3 | * Name: acdispat.h - dispatcher (parser to interpreter interface) |
| 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 | |
| 45 | #ifndef _ACDISPAT_H_ |
| 46 | #define _ACDISPAT_H_ |
| 47 | |
| 48 | |
| 49 | #define NAMEOF_LOCAL_NTE "__L0" |
| 50 | #define NAMEOF_ARG_NTE "__A0" |
| 51 | |
| 52 | |
| 53 | /* Common interfaces */ |
| 54 | |
| 55 | acpi_status |
| 56 | acpi_ds_obj_stack_push ( |
| 57 | void *object, |
| 58 | struct acpi_walk_state *walk_state); |
| 59 | |
| 60 | acpi_status |
| 61 | acpi_ds_obj_stack_pop ( |
| 62 | u32 pop_count, |
| 63 | struct acpi_walk_state *walk_state); |
| 64 | |
| 65 | #ifdef ACPI_FUTURE_USAGE |
| 66 | void * |
| 67 | acpi_ds_obj_stack_get_value ( |
| 68 | u32 index, |
| 69 | struct acpi_walk_state *walk_state); |
| 70 | #endif |
| 71 | |
| 72 | acpi_status |
| 73 | acpi_ds_obj_stack_pop_object ( |
| 74 | union acpi_operand_object **object, |
| 75 | struct acpi_walk_state *walk_state); |
| 76 | |
| 77 | |
| 78 | /* dsopcode - support for late evaluation */ |
| 79 | |
| 80 | acpi_status |
| 81 | acpi_ds_execute_arguments ( |
| 82 | struct acpi_namespace_node *node, |
| 83 | struct acpi_namespace_node *scope_node, |
| 84 | u32 aml_length, |
| 85 | u8 *aml_start); |
| 86 | |
| 87 | acpi_status |
| 88 | acpi_ds_get_buffer_field_arguments ( |
| 89 | union acpi_operand_object *obj_desc); |
| 90 | |
| 91 | acpi_status |
| 92 | acpi_ds_get_region_arguments ( |
| 93 | union acpi_operand_object *rgn_desc); |
| 94 | |
| 95 | acpi_status |
| 96 | acpi_ds_get_buffer_arguments ( |
| 97 | union acpi_operand_object *obj_desc); |
| 98 | |
| 99 | acpi_status |
| 100 | acpi_ds_get_package_arguments ( |
| 101 | union acpi_operand_object *obj_desc); |
| 102 | |
| 103 | acpi_status |
| 104 | acpi_ds_init_buffer_field ( |
| 105 | u16 aml_opcode, |
| 106 | union acpi_operand_object *obj_desc, |
| 107 | union acpi_operand_object *buffer_desc, |
| 108 | union acpi_operand_object *offset_desc, |
| 109 | union acpi_operand_object *length_desc, |
| 110 | union acpi_operand_object *result_desc); |
| 111 | |
| 112 | acpi_status |
| 113 | acpi_ds_eval_buffer_field_operands ( |
| 114 | struct acpi_walk_state *walk_state, |
| 115 | union acpi_parse_object *op); |
| 116 | |
| 117 | acpi_status |
| 118 | acpi_ds_eval_region_operands ( |
| 119 | struct acpi_walk_state *walk_state, |
| 120 | union acpi_parse_object *op); |
| 121 | |
| 122 | acpi_status |
| 123 | acpi_ds_eval_data_object_operands ( |
| 124 | struct acpi_walk_state *walk_state, |
| 125 | union acpi_parse_object *op, |
| 126 | union acpi_operand_object *obj_desc); |
| 127 | |
| 128 | acpi_status |
| 129 | acpi_ds_initialize_region ( |
| 130 | acpi_handle obj_handle); |
| 131 | |
| 132 | |
| 133 | /* dsctrl - Parser/Interpreter interface, control stack routines */ |
| 134 | |
| 135 | |
| 136 | acpi_status |
| 137 | acpi_ds_exec_begin_control_op ( |
| 138 | struct acpi_walk_state *walk_state, |
| 139 | union acpi_parse_object *op); |
| 140 | |
| 141 | acpi_status |
| 142 | acpi_ds_exec_end_control_op ( |
| 143 | struct acpi_walk_state *walk_state, |
| 144 | union acpi_parse_object *op); |
| 145 | |
| 146 | |
| 147 | /* dsexec - Parser/Interpreter interface, method execution callbacks */ |
| 148 | |
| 149 | |
| 150 | acpi_status |
| 151 | acpi_ds_get_predicate_value ( |
| 152 | struct acpi_walk_state *walk_state, |
| 153 | union acpi_operand_object *result_obj); |
| 154 | |
| 155 | acpi_status |
| 156 | acpi_ds_exec_begin_op ( |
| 157 | struct acpi_walk_state *walk_state, |
| 158 | union acpi_parse_object **out_op); |
| 159 | |
| 160 | acpi_status |
| 161 | acpi_ds_exec_end_op ( |
| 162 | struct acpi_walk_state *state); |
| 163 | |
| 164 | |
| 165 | /* dsfield - Parser/Interpreter interface for AML fields */ |
| 166 | |
| 167 | acpi_status |
| 168 | acpi_ds_get_field_names ( |
| 169 | struct acpi_create_field_info *info, |
| 170 | struct acpi_walk_state *walk_state, |
| 171 | union acpi_parse_object *arg); |
| 172 | |
| 173 | acpi_status |
| 174 | acpi_ds_create_field ( |
| 175 | union acpi_parse_object *op, |
| 176 | struct acpi_namespace_node *region_node, |
| 177 | struct acpi_walk_state *walk_state); |
| 178 | |
| 179 | acpi_status |
| 180 | acpi_ds_create_bank_field ( |
| 181 | union acpi_parse_object *op, |
| 182 | struct acpi_namespace_node *region_node, |
| 183 | struct acpi_walk_state *walk_state); |
| 184 | |
| 185 | acpi_status |
| 186 | acpi_ds_create_index_field ( |
| 187 | union acpi_parse_object *op, |
| 188 | struct acpi_namespace_node *region_node, |
| 189 | struct acpi_walk_state *walk_state); |
| 190 | |
| 191 | acpi_status |
| 192 | acpi_ds_create_buffer_field ( |
| 193 | union acpi_parse_object *op, |
| 194 | struct acpi_walk_state *walk_state); |
| 195 | |
| 196 | acpi_status |
| 197 | acpi_ds_init_field_objects ( |
| 198 | union acpi_parse_object *op, |
| 199 | struct acpi_walk_state *walk_state); |
| 200 | |
| 201 | |
| 202 | /* dsload - Parser/Interpreter interface, namespace load callbacks */ |
| 203 | |
| 204 | acpi_status |
| 205 | acpi_ds_load1_begin_op ( |
| 206 | struct acpi_walk_state *walk_state, |
| 207 | union acpi_parse_object **out_op); |
| 208 | |
| 209 | acpi_status |
| 210 | acpi_ds_load1_end_op ( |
| 211 | struct acpi_walk_state *walk_state); |
| 212 | |
| 213 | acpi_status |
| 214 | acpi_ds_load2_begin_op ( |
| 215 | struct acpi_walk_state *walk_state, |
| 216 | union acpi_parse_object **out_op); |
| 217 | |
| 218 | acpi_status |
| 219 | acpi_ds_load2_end_op ( |
| 220 | struct acpi_walk_state *walk_state); |
| 221 | |
| 222 | acpi_status |
| 223 | acpi_ds_init_callbacks ( |
| 224 | struct acpi_walk_state *walk_state, |
| 225 | u32 pass_number); |
| 226 | |
| 227 | |
| 228 | /* dsmthdat - method data (locals/args) */ |
| 229 | |
| 230 | |
| 231 | acpi_status |
| 232 | acpi_ds_store_object_to_local ( |
| 233 | u16 opcode, |
| 234 | u32 index, |
| 235 | union acpi_operand_object *src_desc, |
| 236 | struct acpi_walk_state *walk_state); |
| 237 | |
| 238 | acpi_status |
| 239 | acpi_ds_method_data_get_entry ( |
| 240 | u16 opcode, |
| 241 | u32 index, |
| 242 | struct acpi_walk_state *walk_state, |
| 243 | union acpi_operand_object ***node); |
| 244 | |
| 245 | void |
| 246 | acpi_ds_method_data_delete_all ( |
| 247 | struct acpi_walk_state *walk_state); |
| 248 | |
| 249 | u8 |
| 250 | acpi_ds_is_method_value ( |
| 251 | union acpi_operand_object *obj_desc); |
| 252 | |
| 253 | #ifdef ACPI_FUTURE_USAGE |
| 254 | acpi_object_type |
| 255 | acpi_ds_method_data_get_type ( |
| 256 | u16 opcode, |
| 257 | u32 index, |
| 258 | struct acpi_walk_state *walk_state); |
| 259 | #endif |
| 260 | |
| 261 | acpi_status |
| 262 | acpi_ds_method_data_get_value ( |
| 263 | u16 opcode, |
| 264 | u32 index, |
| 265 | struct acpi_walk_state *walk_state, |
| 266 | union acpi_operand_object **dest_desc); |
| 267 | |
| 268 | void |
| 269 | acpi_ds_method_data_delete_value ( |
| 270 | u16 opcode, |
| 271 | u32 index, |
| 272 | struct acpi_walk_state *walk_state); |
| 273 | |
| 274 | acpi_status |
| 275 | acpi_ds_method_data_init_args ( |
| 276 | union acpi_operand_object **params, |
| 277 | u32 max_param_count, |
| 278 | struct acpi_walk_state *walk_state); |
| 279 | |
| 280 | acpi_status |
| 281 | acpi_ds_method_data_get_node ( |
| 282 | u16 opcode, |
| 283 | u32 index, |
| 284 | struct acpi_walk_state *walk_state, |
| 285 | struct acpi_namespace_node **node); |
| 286 | |
| 287 | void |
| 288 | acpi_ds_method_data_init ( |
| 289 | struct acpi_walk_state *walk_state); |
| 290 | |
| 291 | acpi_status |
| 292 | acpi_ds_method_data_set_value ( |
| 293 | u16 opcode, |
| 294 | u32 index, |
| 295 | union acpi_operand_object *object, |
| 296 | struct acpi_walk_state *walk_state); |
| 297 | |
| 298 | |
| 299 | /* dsmethod - Parser/Interpreter interface - control method parsing */ |
| 300 | |
| 301 | acpi_status |
| 302 | acpi_ds_parse_method ( |
| 303 | acpi_handle obj_handle); |
| 304 | |
| 305 | acpi_status |
| 306 | acpi_ds_call_control_method ( |
| 307 | struct acpi_thread_state *thread, |
| 308 | struct acpi_walk_state *walk_state, |
| 309 | union acpi_parse_object *op); |
| 310 | |
| 311 | acpi_status |
| 312 | acpi_ds_restart_control_method ( |
| 313 | struct acpi_walk_state *walk_state, |
| 314 | union acpi_operand_object *return_desc); |
| 315 | |
| 316 | acpi_status |
| 317 | acpi_ds_terminate_control_method ( |
| 318 | struct acpi_walk_state *walk_state); |
| 319 | |
| 320 | acpi_status |
| 321 | acpi_ds_begin_method_execution ( |
| 322 | struct acpi_namespace_node *method_node, |
| 323 | union acpi_operand_object *obj_desc, |
| 324 | struct acpi_namespace_node *calling_method_node); |
| 325 | |
| 326 | |
| 327 | /* dsobj - Parser/Interpreter interface - object initialization and conversion */ |
| 328 | |
| 329 | acpi_status |
| 330 | acpi_ds_init_one_object ( |
| 331 | acpi_handle obj_handle, |
| 332 | u32 level, |
| 333 | void *context, |
| 334 | void **return_value); |
| 335 | |
| 336 | acpi_status |
| 337 | acpi_ds_initialize_objects ( |
| 338 | struct acpi_table_desc *table_desc, |
| 339 | struct acpi_namespace_node *start_node); |
| 340 | |
| 341 | acpi_status |
| 342 | acpi_ds_build_internal_buffer_obj ( |
| 343 | struct acpi_walk_state *walk_state, |
| 344 | union acpi_parse_object *op, |
| 345 | u32 buffer_length, |
| 346 | union acpi_operand_object **obj_desc_ptr); |
| 347 | |
| 348 | acpi_status |
| 349 | acpi_ds_build_internal_package_obj ( |
| 350 | struct acpi_walk_state *walk_state, |
| 351 | union acpi_parse_object *op, |
| 352 | u32 package_length, |
| 353 | union acpi_operand_object **obj_desc); |
| 354 | |
| 355 | acpi_status |
| 356 | acpi_ds_build_internal_object ( |
| 357 | struct acpi_walk_state *walk_state, |
| 358 | union acpi_parse_object *op, |
| 359 | union acpi_operand_object **obj_desc_ptr); |
| 360 | |
| 361 | acpi_status |
| 362 | acpi_ds_init_object_from_op ( |
| 363 | struct acpi_walk_state *walk_state, |
| 364 | union acpi_parse_object *op, |
| 365 | u16 opcode, |
| 366 | union acpi_operand_object **obj_desc); |
| 367 | |
| 368 | acpi_status |
| 369 | acpi_ds_create_node ( |
| 370 | struct acpi_walk_state *walk_state, |
| 371 | struct acpi_namespace_node *node, |
| 372 | union acpi_parse_object *op); |
| 373 | |
| 374 | |
| 375 | /* dsutils - Parser/Interpreter interface utility routines */ |
| 376 | |
| 377 | void |
| 378 | acpi_ds_clear_implicit_return ( |
| 379 | struct acpi_walk_state *walk_state); |
| 380 | |
| 381 | u8 |
| 382 | acpi_ds_do_implicit_return ( |
| 383 | union acpi_operand_object *return_desc, |
| 384 | struct acpi_walk_state *walk_state, |
| 385 | u8 add_reference); |
| 386 | |
| 387 | u8 |
| 388 | acpi_ds_is_result_used ( |
| 389 | union acpi_parse_object *op, |
| 390 | struct acpi_walk_state *walk_state); |
| 391 | |
| 392 | void |
| 393 | acpi_ds_delete_result_if_not_used ( |
| 394 | union acpi_parse_object *op, |
| 395 | union acpi_operand_object *result_obj, |
| 396 | struct acpi_walk_state *walk_state); |
| 397 | |
| 398 | acpi_status |
| 399 | acpi_ds_create_operand ( |
| 400 | struct acpi_walk_state *walk_state, |
| 401 | union acpi_parse_object *arg, |
| 402 | u32 args_remaining); |
| 403 | |
| 404 | acpi_status |
| 405 | acpi_ds_create_operands ( |
| 406 | struct acpi_walk_state *walk_state, |
| 407 | union acpi_parse_object *first_arg); |
| 408 | |
| 409 | acpi_status |
| 410 | acpi_ds_resolve_operands ( |
| 411 | struct acpi_walk_state *walk_state); |
| 412 | |
| 413 | void |
| 414 | acpi_ds_clear_operands ( |
| 415 | struct acpi_walk_state *walk_state); |
| 416 | |
| 417 | |
| 418 | /* |
| 419 | * dswscope - Scope Stack manipulation |
| 420 | */ |
| 421 | |
| 422 | acpi_status |
| 423 | acpi_ds_scope_stack_push ( |
| 424 | struct acpi_namespace_node *node, |
| 425 | acpi_object_type type, |
| 426 | struct acpi_walk_state *walk_state); |
| 427 | |
| 428 | |
| 429 | acpi_status |
| 430 | acpi_ds_scope_stack_pop ( |
| 431 | struct acpi_walk_state *walk_state); |
| 432 | |
| 433 | void |
| 434 | acpi_ds_scope_stack_clear ( |
| 435 | struct acpi_walk_state *walk_state); |
| 436 | |
| 437 | |
| 438 | /* dswstate - parser WALK_STATE management routines */ |
| 439 | |
| 440 | struct acpi_walk_state * |
| 441 | acpi_ds_create_walk_state ( |
| 442 | acpi_owner_id owner_id, |
| 443 | union acpi_parse_object *origin, |
| 444 | union acpi_operand_object *mth_desc, |
| 445 | struct acpi_thread_state *thread); |
| 446 | |
| 447 | acpi_status |
| 448 | acpi_ds_init_aml_walk ( |
| 449 | struct acpi_walk_state *walk_state, |
| 450 | union acpi_parse_object *op, |
| 451 | struct acpi_namespace_node *method_node, |
| 452 | u8 *aml_start, |
| 453 | u32 aml_length, |
| 454 | struct acpi_parameter_info *info, |
| 455 | u32 pass_number); |
| 456 | |
| 457 | #ifdef ACPI_FUTURE_USAGE |
| 458 | acpi_status |
| 459 | acpi_ds_obj_stack_delete_all ( |
| 460 | struct acpi_walk_state *walk_state); |
| 461 | #endif |
| 462 | |
| 463 | acpi_status |
| 464 | acpi_ds_obj_stack_pop_and_delete ( |
| 465 | u32 pop_count, |
| 466 | struct acpi_walk_state *walk_state); |
| 467 | |
| 468 | void |
| 469 | acpi_ds_delete_walk_state ( |
| 470 | struct acpi_walk_state *walk_state); |
| 471 | |
| 472 | struct acpi_walk_state * |
| 473 | acpi_ds_pop_walk_state ( |
| 474 | struct acpi_thread_state *thread); |
| 475 | |
| 476 | void |
| 477 | acpi_ds_push_walk_state ( |
| 478 | struct acpi_walk_state *walk_state, |
| 479 | struct acpi_thread_state *thread); |
| 480 | |
| 481 | acpi_status |
| 482 | acpi_ds_result_stack_pop ( |
| 483 | struct acpi_walk_state *walk_state); |
| 484 | |
| 485 | acpi_status |
| 486 | acpi_ds_result_stack_push ( |
| 487 | struct acpi_walk_state *walk_state); |
| 488 | |
| 489 | acpi_status |
| 490 | acpi_ds_result_stack_clear ( |
| 491 | struct acpi_walk_state *walk_state); |
| 492 | |
| 493 | struct acpi_walk_state * |
| 494 | acpi_ds_get_current_walk_state ( |
| 495 | struct acpi_thread_state *thread); |
| 496 | |
| 497 | #ifdef ACPI_ENABLE_OBJECT_CACHE |
| 498 | void |
| 499 | acpi_ds_delete_walk_state_cache ( |
| 500 | void); |
| 501 | #endif |
| 502 | |
| 503 | #ifdef ACPI_FUTURE_USAGE |
| 504 | acpi_status |
| 505 | acpi_ds_result_insert ( |
| 506 | void *object, |
| 507 | u32 index, |
| 508 | struct acpi_walk_state *walk_state); |
| 509 | |
| 510 | acpi_status |
| 511 | acpi_ds_result_remove ( |
| 512 | union acpi_operand_object **object, |
| 513 | u32 index, |
| 514 | struct acpi_walk_state *walk_state); |
| 515 | #endif |
| 516 | |
| 517 | acpi_status |
| 518 | acpi_ds_result_pop ( |
| 519 | union acpi_operand_object **object, |
| 520 | struct acpi_walk_state *walk_state); |
| 521 | |
| 522 | acpi_status |
| 523 | acpi_ds_result_push ( |
| 524 | union acpi_operand_object *object, |
| 525 | struct acpi_walk_state *walk_state); |
| 526 | |
| 527 | acpi_status |
| 528 | acpi_ds_result_pop_from_bottom ( |
| 529 | union acpi_operand_object **object, |
| 530 | struct acpi_walk_state *walk_state); |
| 531 | |
| 532 | #endif /* _ACDISPAT_H_ */ |