diff options
Diffstat (limited to 'drivers/acpi/dispatcher/dsobject.c')
-rw-r--r-- | drivers/acpi/dispatcher/dsobject.c | 79 |
1 files changed, 50 insertions, 29 deletions
diff --git a/drivers/acpi/dispatcher/dsobject.c b/drivers/acpi/dispatcher/dsobject.c index eb8af4785bcb..bfbae4e4c667 100644 --- a/drivers/acpi/dispatcher/dsobject.c +++ b/drivers/acpi/dispatcher/dsobject.c | |||
@@ -52,9 +52,15 @@ | |||
52 | #define _COMPONENT ACPI_DISPATCHER | 52 | #define _COMPONENT ACPI_DISPATCHER |
53 | ACPI_MODULE_NAME ("dsobject") | 53 | ACPI_MODULE_NAME ("dsobject") |
54 | 54 | ||
55 | static acpi_status | ||
56 | acpi_ds_build_internal_object ( | ||
57 | struct acpi_walk_state *walk_state, | ||
58 | union acpi_parse_object *op, | ||
59 | union acpi_operand_object **obj_desc_ptr); | ||
60 | |||
55 | 61 | ||
56 | #ifndef ACPI_NO_METHOD_EXECUTION | 62 | #ifndef ACPI_NO_METHOD_EXECUTION |
57 | /***************************************************************************** | 63 | /******************************************************************************* |
58 | * | 64 | * |
59 | * FUNCTION: acpi_ds_build_internal_object | 65 | * FUNCTION: acpi_ds_build_internal_object |
60 | * | 66 | * |
@@ -67,9 +73,9 @@ | |||
67 | * DESCRIPTION: Translate a parser Op object to the equivalent namespace object | 73 | * DESCRIPTION: Translate a parser Op object to the equivalent namespace object |
68 | * Simple objects are any objects other than a package object! | 74 | * Simple objects are any objects other than a package object! |
69 | * | 75 | * |
70 | ****************************************************************************/ | 76 | ******************************************************************************/ |
71 | 77 | ||
72 | acpi_status | 78 | static acpi_status |
73 | acpi_ds_build_internal_object ( | 79 | acpi_ds_build_internal_object ( |
74 | struct acpi_walk_state *walk_state, | 80 | struct acpi_walk_state *walk_state, |
75 | union acpi_parse_object *op, | 81 | union acpi_parse_object *op, |
@@ -90,9 +96,11 @@ acpi_ds_build_internal_object ( | |||
90 | * Otherwise, go ahead and look it up now | 96 | * Otherwise, go ahead and look it up now |
91 | */ | 97 | */ |
92 | if (!op->common.node) { | 98 | if (!op->common.node) { |
93 | status = acpi_ns_lookup (walk_state->scope_info, op->common.value.string, | 99 | status = acpi_ns_lookup (walk_state->scope_info, |
100 | op->common.value.string, | ||
94 | ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, | 101 | ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, |
95 | ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, NULL, | 102 | ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, |
103 | NULL, | ||
96 | (struct acpi_namespace_node **) &(op->common.node)); | 104 | (struct acpi_namespace_node **) &(op->common.node)); |
97 | 105 | ||
98 | if (ACPI_FAILURE (status)) { | 106 | if (ACPI_FAILURE (status)) { |
@@ -104,12 +112,14 @@ acpi_ds_build_internal_object ( | |||
104 | 112 | ||
105 | /* Create and init the internal ACPI object */ | 113 | /* Create and init the internal ACPI object */ |
106 | 114 | ||
107 | obj_desc = acpi_ut_create_internal_object ((acpi_ps_get_opcode_info (op->common.aml_opcode))->object_type); | 115 | obj_desc = acpi_ut_create_internal_object ( |
116 | (acpi_ps_get_opcode_info (op->common.aml_opcode))->object_type); | ||
108 | if (!obj_desc) { | 117 | if (!obj_desc) { |
109 | return_ACPI_STATUS (AE_NO_MEMORY); | 118 | return_ACPI_STATUS (AE_NO_MEMORY); |
110 | } | 119 | } |
111 | 120 | ||
112 | status = acpi_ds_init_object_from_op (walk_state, op, op->common.aml_opcode, &obj_desc); | 121 | status = acpi_ds_init_object_from_op (walk_state, op, op->common.aml_opcode, |
122 | &obj_desc); | ||
113 | if (ACPI_FAILURE (status)) { | 123 | if (ACPI_FAILURE (status)) { |
114 | acpi_ut_remove_reference (obj_desc); | 124 | acpi_ut_remove_reference (obj_desc); |
115 | return_ACPI_STATUS (status); | 125 | return_ACPI_STATUS (status); |
@@ -120,7 +130,7 @@ acpi_ds_build_internal_object ( | |||
120 | } | 130 | } |
121 | 131 | ||
122 | 132 | ||
123 | /***************************************************************************** | 133 | /******************************************************************************* |
124 | * | 134 | * |
125 | * FUNCTION: acpi_ds_build_internal_buffer_obj | 135 | * FUNCTION: acpi_ds_build_internal_buffer_obj |
126 | * | 136 | * |
@@ -134,7 +144,7 @@ acpi_ds_build_internal_object ( | |||
134 | * DESCRIPTION: Translate a parser Op package object to the equivalent | 144 | * DESCRIPTION: Translate a parser Op package object to the equivalent |
135 | * namespace object | 145 | * namespace object |
136 | * | 146 | * |
137 | ****************************************************************************/ | 147 | ******************************************************************************/ |
138 | 148 | ||
139 | acpi_status | 149 | acpi_status |
140 | acpi_ds_build_internal_buffer_obj ( | 150 | acpi_ds_build_internal_buffer_obj ( |
@@ -229,7 +239,7 @@ acpi_ds_build_internal_buffer_obj ( | |||
229 | } | 239 | } |
230 | 240 | ||
231 | 241 | ||
232 | /***************************************************************************** | 242 | /******************************************************************************* |
233 | * | 243 | * |
234 | * FUNCTION: acpi_ds_build_internal_package_obj | 244 | * FUNCTION: acpi_ds_build_internal_package_obj |
235 | * | 245 | * |
@@ -243,7 +253,7 @@ acpi_ds_build_internal_buffer_obj ( | |||
243 | * DESCRIPTION: Translate a parser Op package object to the equivalent | 253 | * DESCRIPTION: Translate a parser Op package object to the equivalent |
244 | * namespace object | 254 | * namespace object |
245 | * | 255 | * |
246 | ****************************************************************************/ | 256 | ******************************************************************************/ |
247 | 257 | ||
248 | acpi_status | 258 | acpi_status |
249 | acpi_ds_build_internal_package_obj ( | 259 | acpi_ds_build_internal_package_obj ( |
@@ -331,11 +341,12 @@ acpi_ds_build_internal_package_obj ( | |||
331 | if (arg->common.aml_opcode == AML_INT_RETURN_VALUE_OP) { | 341 | if (arg->common.aml_opcode == AML_INT_RETURN_VALUE_OP) { |
332 | /* Object (package or buffer) is already built */ | 342 | /* Object (package or buffer) is already built */ |
333 | 343 | ||
334 | obj_desc->package.elements[i] = ACPI_CAST_PTR (union acpi_operand_object, arg->common.node); | 344 | obj_desc->package.elements[i] = |
345 | ACPI_CAST_PTR (union acpi_operand_object, arg->common.node); | ||
335 | } | 346 | } |
336 | else { | 347 | else { |
337 | status = acpi_ds_build_internal_object (walk_state, arg, | 348 | status = acpi_ds_build_internal_object (walk_state, arg, |
338 | &obj_desc->package.elements[i]); | 349 | &obj_desc->package.elements[i]); |
339 | } | 350 | } |
340 | 351 | ||
341 | i++; | 352 | i++; |
@@ -348,7 +359,7 @@ acpi_ds_build_internal_package_obj ( | |||
348 | } | 359 | } |
349 | 360 | ||
350 | 361 | ||
351 | /***************************************************************************** | 362 | /******************************************************************************* |
352 | * | 363 | * |
353 | * FUNCTION: acpi_ds_create_node | 364 | * FUNCTION: acpi_ds_create_node |
354 | * | 365 | * |
@@ -360,7 +371,7 @@ acpi_ds_build_internal_package_obj ( | |||
360 | * | 371 | * |
361 | * DESCRIPTION: Create the object to be associated with a namespace node | 372 | * DESCRIPTION: Create the object to be associated with a namespace node |
362 | * | 373 | * |
363 | ****************************************************************************/ | 374 | ******************************************************************************/ |
364 | 375 | ||
365 | acpi_status | 376 | acpi_status |
366 | acpi_ds_create_node ( | 377 | acpi_ds_create_node ( |
@@ -392,7 +403,8 @@ acpi_ds_create_node ( | |||
392 | 403 | ||
393 | /* Build an internal object for the argument(s) */ | 404 | /* Build an internal object for the argument(s) */ |
394 | 405 | ||
395 | status = acpi_ds_build_internal_object (walk_state, op->common.value.arg, &obj_desc); | 406 | status = acpi_ds_build_internal_object (walk_state, op->common.value.arg, |
407 | &obj_desc); | ||
396 | if (ACPI_FAILURE (status)) { | 408 | if (ACPI_FAILURE (status)) { |
397 | return_ACPI_STATUS (status); | 409 | return_ACPI_STATUS (status); |
398 | } | 410 | } |
@@ -414,7 +426,7 @@ acpi_ds_create_node ( | |||
414 | #endif /* ACPI_NO_METHOD_EXECUTION */ | 426 | #endif /* ACPI_NO_METHOD_EXECUTION */ |
415 | 427 | ||
416 | 428 | ||
417 | /***************************************************************************** | 429 | /******************************************************************************* |
418 | * | 430 | * |
419 | * FUNCTION: acpi_ds_init_object_from_op | 431 | * FUNCTION: acpi_ds_init_object_from_op |
420 | * | 432 | * |
@@ -429,7 +441,7 @@ acpi_ds_create_node ( | |||
429 | * associated arguments. The namespace object is a more compact | 441 | * associated arguments. The namespace object is a more compact |
430 | * representation of the Op and its arguments. | 442 | * representation of the Op and its arguments. |
431 | * | 443 | * |
432 | ****************************************************************************/ | 444 | ******************************************************************************/ |
433 | 445 | ||
434 | acpi_status | 446 | acpi_status |
435 | acpi_ds_init_object_from_op ( | 447 | acpi_ds_init_object_from_op ( |
@@ -462,7 +474,8 @@ acpi_ds_init_object_from_op ( | |||
462 | /* | 474 | /* |
463 | * Defer evaluation of Buffer term_arg operand | 475 | * Defer evaluation of Buffer term_arg operand |
464 | */ | 476 | */ |
465 | obj_desc->buffer.node = (struct acpi_namespace_node *) walk_state->operands[0]; | 477 | obj_desc->buffer.node = (struct acpi_namespace_node *) |
478 | walk_state->operands[0]; | ||
466 | obj_desc->buffer.aml_start = op->named.data; | 479 | obj_desc->buffer.aml_start = op->named.data; |
467 | obj_desc->buffer.aml_length = op->named.length; | 480 | obj_desc->buffer.aml_length = op->named.length; |
468 | break; | 481 | break; |
@@ -473,7 +486,8 @@ acpi_ds_init_object_from_op ( | |||
473 | /* | 486 | /* |
474 | * Defer evaluation of Package term_arg operand | 487 | * Defer evaluation of Package term_arg operand |
475 | */ | 488 | */ |
476 | obj_desc->package.node = (struct acpi_namespace_node *) walk_state->operands[0]; | 489 | obj_desc->package.node = (struct acpi_namespace_node *) |
490 | walk_state->operands[0]; | ||
477 | obj_desc->package.aml_start = op->named.data; | 491 | obj_desc->package.aml_start = op->named.data; |
478 | obj_desc->package.aml_length = op->named.length; | 492 | obj_desc->package.aml_length = op->named.length; |
479 | break; | 493 | break; |
@@ -486,9 +500,10 @@ acpi_ds_init_object_from_op ( | |||
486 | /* | 500 | /* |
487 | * Resolve AML Constants here - AND ONLY HERE! | 501 | * Resolve AML Constants here - AND ONLY HERE! |
488 | * All constants are integers. | 502 | * All constants are integers. |
489 | * We mark the integer with a flag that indicates that it started life | 503 | * We mark the integer with a flag that indicates that it started |
490 | * as a constant -- so that stores to constants will perform as expected (noop). | 504 | * life as a constant -- so that stores to constants will perform |
491 | * (zero_op is used as a placeholder for optional target operands.) | 505 | * as expected (noop). zero_op is used as a placeholder for optional |
506 | * target operands. | ||
492 | */ | 507 | */ |
493 | obj_desc->common.flags = AOPOBJ_AML_CONSTANT; | 508 | obj_desc->common.flags = AOPOBJ_AML_CONSTANT; |
494 | 509 | ||
@@ -521,7 +536,8 @@ acpi_ds_init_object_from_op ( | |||
521 | 536 | ||
522 | default: | 537 | default: |
523 | 538 | ||
524 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown constant opcode %X\n", opcode)); | 539 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
540 | "Unknown constant opcode %X\n", opcode)); | ||
525 | status = AE_AML_OPERAND_TYPE; | 541 | status = AE_AML_OPERAND_TYPE; |
526 | break; | 542 | break; |
527 | } | 543 | } |
@@ -535,7 +551,8 @@ acpi_ds_init_object_from_op ( | |||
535 | 551 | ||
536 | 552 | ||
537 | default: | 553 | default: |
538 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Integer type %X\n", op_info->type)); | 554 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Integer type %X\n", |
555 | op_info->type)); | ||
539 | status = AE_AML_OPERAND_TYPE; | 556 | status = AE_AML_OPERAND_TYPE; |
540 | break; | 557 | break; |
541 | } | 558 | } |
@@ -570,8 +587,10 @@ acpi_ds_init_object_from_op ( | |||
570 | obj_desc->reference.offset = opcode - AML_LOCAL_OP; | 587 | obj_desc->reference.offset = opcode - AML_LOCAL_OP; |
571 | 588 | ||
572 | #ifndef ACPI_NO_METHOD_EXECUTION | 589 | #ifndef ACPI_NO_METHOD_EXECUTION |
573 | status = acpi_ds_method_data_get_node (AML_LOCAL_OP, obj_desc->reference.offset, | 590 | status = acpi_ds_method_data_get_node (AML_LOCAL_OP, |
574 | walk_state, (struct acpi_namespace_node **) &obj_desc->reference.object); | 591 | obj_desc->reference.offset, |
592 | walk_state, | ||
593 | (struct acpi_namespace_node **) &obj_desc->reference.object); | ||
575 | #endif | 594 | #endif |
576 | break; | 595 | break; |
577 | 596 | ||
@@ -584,8 +603,10 @@ acpi_ds_init_object_from_op ( | |||
584 | obj_desc->reference.offset = opcode - AML_ARG_OP; | 603 | obj_desc->reference.offset = opcode - AML_ARG_OP; |
585 | 604 | ||
586 | #ifndef ACPI_NO_METHOD_EXECUTION | 605 | #ifndef ACPI_NO_METHOD_EXECUTION |
587 | status = acpi_ds_method_data_get_node (AML_ARG_OP, obj_desc->reference.offset, | 606 | status = acpi_ds_method_data_get_node (AML_ARG_OP, |
588 | walk_state, (struct acpi_namespace_node **) &obj_desc->reference.object); | 607 | obj_desc->reference.offset, |
608 | walk_state, | ||
609 | (struct acpi_namespace_node **) &obj_desc->reference.object); | ||
589 | #endif | 610 | #endif |
590 | break; | 611 | break; |
591 | 612 | ||