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