diff options
Diffstat (limited to 'drivers/acpi/dispatcher/dswload.c')
-rw-r--r-- | drivers/acpi/dispatcher/dswload.c | 118 |
1 files changed, 72 insertions, 46 deletions
diff --git a/drivers/acpi/dispatcher/dswload.c b/drivers/acpi/dispatcher/dswload.c index 06d758679588..1ac197ccfc80 100644 --- a/drivers/acpi/dispatcher/dswload.c +++ b/drivers/acpi/dispatcher/dswload.c | |||
@@ -79,20 +79,23 @@ acpi_ds_init_callbacks ( | |||
79 | 79 | ||
80 | switch (pass_number) { | 80 | switch (pass_number) { |
81 | case 1: | 81 | case 1: |
82 | walk_state->parse_flags = ACPI_PARSE_LOAD_PASS1 | ACPI_PARSE_DELETE_TREE; | 82 | walk_state->parse_flags = ACPI_PARSE_LOAD_PASS1 | |
83 | ACPI_PARSE_DELETE_TREE; | ||
83 | walk_state->descending_callback = acpi_ds_load1_begin_op; | 84 | walk_state->descending_callback = acpi_ds_load1_begin_op; |
84 | walk_state->ascending_callback = acpi_ds_load1_end_op; | 85 | walk_state->ascending_callback = acpi_ds_load1_end_op; |
85 | break; | 86 | break; |
86 | 87 | ||
87 | case 2: | 88 | case 2: |
88 | walk_state->parse_flags = ACPI_PARSE_LOAD_PASS1 | ACPI_PARSE_DELETE_TREE; | 89 | walk_state->parse_flags = ACPI_PARSE_LOAD_PASS1 | |
90 | ACPI_PARSE_DELETE_TREE; | ||
89 | walk_state->descending_callback = acpi_ds_load2_begin_op; | 91 | walk_state->descending_callback = acpi_ds_load2_begin_op; |
90 | walk_state->ascending_callback = acpi_ds_load2_end_op; | 92 | walk_state->ascending_callback = acpi_ds_load2_end_op; |
91 | break; | 93 | break; |
92 | 94 | ||
93 | case 3: | 95 | case 3: |
94 | #ifndef ACPI_NO_METHOD_EXECUTION | 96 | #ifndef ACPI_NO_METHOD_EXECUTION |
95 | walk_state->parse_flags |= ACPI_PARSE_EXECUTE | ACPI_PARSE_DELETE_TREE; | 97 | walk_state->parse_flags |= ACPI_PARSE_EXECUTE | |
98 | ACPI_PARSE_DELETE_TREE; | ||
96 | walk_state->descending_callback = acpi_ds_exec_begin_op; | 99 | walk_state->descending_callback = acpi_ds_exec_begin_op; |
97 | walk_state->ascending_callback = acpi_ds_exec_end_op; | 100 | walk_state->ascending_callback = acpi_ds_exec_end_op; |
98 | #endif | 101 | #endif |
@@ -111,8 +114,7 @@ acpi_ds_init_callbacks ( | |||
111 | * FUNCTION: acpi_ds_load1_begin_op | 114 | * FUNCTION: acpi_ds_load1_begin_op |
112 | * | 115 | * |
113 | * PARAMETERS: walk_state - Current state of the parse tree walk | 116 | * PARAMETERS: walk_state - Current state of the parse tree walk |
114 | * Op - Op that has been just been reached in the | 117 | * out_op - Where to return op if a new one is created |
115 | * walk; Arguments have not been evaluated yet. | ||
116 | * | 118 | * |
117 | * RETURN: Status | 119 | * RETURN: Status |
118 | * | 120 | * |
@@ -146,7 +148,8 @@ acpi_ds_load1_begin_op ( | |||
146 | #if 0 | 148 | #if 0 |
147 | if ((walk_state->op_info->class == AML_CLASS_EXECUTE) || | 149 | if ((walk_state->op_info->class == AML_CLASS_EXECUTE) || |
148 | (walk_state->op_info->class == AML_CLASS_CONTROL)) { | 150 | (walk_state->op_info->class == AML_CLASS_CONTROL)) { |
149 | acpi_os_printf ("\n\n***EXECUTABLE OPCODE %s***\n\n", walk_state->op_info->name); | 151 | acpi_os_printf ("\n\n***EXECUTABLE OPCODE %s***\n\n", |
152 | walk_state->op_info->name); | ||
150 | *out_op = op; | 153 | *out_op = op; |
151 | return (AE_CTRL_SKIP); | 154 | return (AE_CTRL_SKIP); |
152 | } | 155 | } |
@@ -191,7 +194,8 @@ acpi_ds_load1_begin_op ( | |||
191 | */ | 194 | */ |
192 | acpi_dm_add_to_external_list (path); | 195 | acpi_dm_add_to_external_list (path); |
193 | status = acpi_ns_lookup (walk_state->scope_info, path, object_type, | 196 | status = acpi_ns_lookup (walk_state->scope_info, path, object_type, |
194 | ACPI_IMODE_LOAD_PASS1, ACPI_NS_SEARCH_PARENT, walk_state, &(node)); | 197 | ACPI_IMODE_LOAD_PASS1, ACPI_NS_SEARCH_PARENT, |
198 | walk_state, &(node)); | ||
195 | } | 199 | } |
196 | #endif | 200 | #endif |
197 | if (ACPI_FAILURE (status)) { | 201 | if (ACPI_FAILURE (status)) { |
@@ -224,10 +228,12 @@ acpi_ds_load1_begin_op ( | |||
224 | * Name (DEB, 0) | 228 | * Name (DEB, 0) |
225 | * Scope (DEB) { ... } | 229 | * Scope (DEB) { ... } |
226 | * | 230 | * |
227 | * Note: silently change the type here. On the second pass, we will report a warning | 231 | * Note: silently change the type here. On the second pass, we will report |
232 | * a warning | ||
228 | */ | 233 | */ |
229 | 234 | ||
230 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n", | 235 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, |
236 | "Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n", | ||
231 | path, acpi_ut_get_type_name (node->type))); | 237 | path, acpi_ut_get_type_name (node->type))); |
232 | 238 | ||
233 | node->type = ACPI_TYPE_ANY; | 239 | node->type = ACPI_TYPE_ANY; |
@@ -238,7 +244,8 @@ acpi_ds_load1_begin_op ( | |||
238 | 244 | ||
239 | /* All other types are an error */ | 245 | /* All other types are an error */ |
240 | 246 | ||
241 | ACPI_REPORT_ERROR (("Invalid type (%s) for target of Scope operator [%4.4s] (Cannot override)\n", | 247 | ACPI_REPORT_ERROR (( |
248 | "Invalid type (%s) for target of Scope operator [%4.4s] (Cannot override)\n", | ||
242 | acpi_ut_get_type_name (node->type), path)); | 249 | acpi_ut_get_type_name (node->type), path)); |
243 | 250 | ||
244 | return (AE_AML_OPERAND_TYPE); | 251 | return (AE_AML_OPERAND_TYPE); |
@@ -249,7 +256,8 @@ acpi_ds_load1_begin_op ( | |||
249 | default: | 256 | default: |
250 | 257 | ||
251 | /* | 258 | /* |
252 | * For all other named opcodes, we will enter the name into the namespace. | 259 | * For all other named opcodes, we will enter the name into |
260 | * the namespace. | ||
253 | * | 261 | * |
254 | * Setup the search flags. | 262 | * Setup the search flags. |
255 | * Since we are entering a name into the namespace, we do not want to | 263 | * Since we are entering a name into the namespace, we do not want to |
@@ -279,14 +287,16 @@ acpi_ds_load1_begin_op ( | |||
279 | acpi_ut_get_type_name (object_type))); | 287 | acpi_ut_get_type_name (object_type))); |
280 | } | 288 | } |
281 | else { | 289 | else { |
282 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[%s] Both Find or Create allowed\n", | 290 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, |
291 | "[%s] Both Find or Create allowed\n", | ||
283 | acpi_ut_get_type_name (object_type))); | 292 | acpi_ut_get_type_name (object_type))); |
284 | } | 293 | } |
285 | 294 | ||
286 | /* | 295 | /* |
287 | * Enter the named type into the internal namespace. We enter the name | 296 | * Enter the named type into the internal namespace. We enter the name |
288 | * as we go downward in the parse tree. Any necessary subobjects that involve | 297 | * as we go downward in the parse tree. Any necessary subobjects that |
289 | * arguments to the opcode must be created as we go back up the parse tree later. | 298 | * involve arguments to the opcode must be created as we go back up the |
299 | * parse tree later. | ||
290 | */ | 300 | */ |
291 | status = acpi_ns_lookup (walk_state->scope_info, path, object_type, | 301 | status = acpi_ns_lookup (walk_state->scope_info, path, object_type, |
292 | ACPI_IMODE_LOAD_PASS1, flags, walk_state, &(node)); | 302 | ACPI_IMODE_LOAD_PASS1, flags, walk_state, &(node)); |
@@ -335,8 +345,6 @@ acpi_ds_load1_begin_op ( | |||
335 | * FUNCTION: acpi_ds_load1_end_op | 345 | * FUNCTION: acpi_ds_load1_end_op |
336 | * | 346 | * |
337 | * PARAMETERS: walk_state - Current state of the parse tree walk | 347 | * PARAMETERS: walk_state - Current state of the parse tree walk |
338 | * Op - Op that has been just been completed in the | ||
339 | * walk; Arguments have now been evaluated. | ||
340 | * | 348 | * |
341 | * RETURN: Status | 349 | * RETURN: Status |
342 | * | 350 | * |
@@ -383,7 +391,9 @@ acpi_ds_load1_end_op ( | |||
383 | 391 | ||
384 | if (op->common.aml_opcode == AML_REGION_OP) { | 392 | if (op->common.aml_opcode == AML_REGION_OP) { |
385 | status = acpi_ex_create_region (op->named.data, op->named.length, | 393 | status = acpi_ex_create_region (op->named.data, op->named.length, |
386 | (acpi_adr_space_type) ((op->common.value.arg)->common.value.integer), walk_state); | 394 | (acpi_adr_space_type) |
395 | ((op->common.value.arg)->common.value.integer), | ||
396 | walk_state); | ||
387 | if (ACPI_FAILURE (status)) { | 397 | if (ACPI_FAILURE (status)) { |
388 | return (status); | 398 | return (status); |
389 | } | 399 | } |
@@ -394,7 +404,8 @@ acpi_ds_load1_end_op ( | |||
394 | /* For Name opcode, get the object type from the argument */ | 404 | /* For Name opcode, get the object type from the argument */ |
395 | 405 | ||
396 | if (op->common.value.arg) { | 406 | if (op->common.value.arg) { |
397 | object_type = (acpi_ps_get_opcode_info ((op->common.value.arg)->common.aml_opcode))->object_type; | 407 | object_type = (acpi_ps_get_opcode_info ( |
408 | (op->common.value.arg)->common.aml_opcode))->object_type; | ||
398 | op->common.node->type = (u8) object_type; | 409 | op->common.node->type = (u8) object_type; |
399 | } | 410 | } |
400 | } | 411 | } |
@@ -448,8 +459,7 @@ acpi_ds_load1_end_op ( | |||
448 | * FUNCTION: acpi_ds_load2_begin_op | 459 | * FUNCTION: acpi_ds_load2_begin_op |
449 | * | 460 | * |
450 | * PARAMETERS: walk_state - Current state of the parse tree walk | 461 | * PARAMETERS: walk_state - Current state of the parse tree walk |
451 | * Op - Op that has been just been reached in the | 462 | * out_op - Wher to return op if a new one is created |
452 | * walk; Arguments have not been evaluated yet. | ||
453 | * | 463 | * |
454 | * RETURN: Status | 464 | * RETURN: Status |
455 | * | 465 | * |
@@ -478,14 +488,20 @@ acpi_ds_load2_begin_op ( | |||
478 | if (op) { | 488 | if (op) { |
479 | /* We only care about Namespace opcodes here */ | 489 | /* We only care about Namespace opcodes here */ |
480 | 490 | ||
481 | if ((!(walk_state->op_info->flags & AML_NSOPCODE) && (walk_state->opcode != AML_INT_NAMEPATH_OP)) || | 491 | if ((!(walk_state->op_info->flags & AML_NSOPCODE) && |
492 | (walk_state->opcode != AML_INT_NAMEPATH_OP)) || | ||
482 | (!(walk_state->op_info->flags & AML_NAMED))) { | 493 | (!(walk_state->op_info->flags & AML_NAMED))) { |
494 | if ((walk_state->op_info->class == AML_CLASS_EXECUTE) || | ||
495 | (walk_state->op_info->class == AML_CLASS_CONTROL)) { | ||
496 | ACPI_REPORT_WARNING (( | ||
497 | "Encountered executable code at module level, [%s]\n", | ||
498 | acpi_ps_get_opcode_name (walk_state->opcode))); | ||
499 | } | ||
483 | return_ACPI_STATUS (AE_OK); | 500 | return_ACPI_STATUS (AE_OK); |
484 | } | 501 | } |
485 | 502 | ||
486 | /* | 503 | /* Get the name we are going to enter or lookup in the namespace */ |
487 | * Get the name we are going to enter or lookup in the namespace | 504 | |
488 | */ | ||
489 | if (walk_state->opcode == AML_INT_NAMEPATH_OP) { | 505 | if (walk_state->opcode == AML_INT_NAMEPATH_OP) { |
490 | /* For Namepath op, get the path string */ | 506 | /* For Namepath op, get the path string */ |
491 | 507 | ||
@@ -528,21 +544,25 @@ acpi_ds_load2_begin_op ( | |||
528 | case AML_INT_NAMEPATH_OP: | 544 | case AML_INT_NAMEPATH_OP: |
529 | 545 | ||
530 | /* | 546 | /* |
531 | * The name_path is an object reference to an existing object. Don't enter the | 547 | * The name_path is an object reference to an existing object. |
532 | * name into the namespace, but look it up for use later | 548 | * Don't enter the name into the namespace, but look it up |
549 | * for use later. | ||
533 | */ | 550 | */ |
534 | status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, object_type, | 551 | status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, object_type, |
535 | ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, walk_state, &(node)); | 552 | ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, |
553 | walk_state, &(node)); | ||
536 | break; | 554 | break; |
537 | 555 | ||
538 | case AML_SCOPE_OP: | 556 | case AML_SCOPE_OP: |
539 | 557 | ||
540 | /* | 558 | /* |
541 | * The Path is an object reference to an existing object. Don't enter the | 559 | * The Path is an object reference to an existing object. |
542 | * name into the namespace, but look it up for use later | 560 | * Don't enter the name into the namespace, but look it up |
561 | * for use later. | ||
543 | */ | 562 | */ |
544 | status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, object_type, | 563 | status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, object_type, |
545 | ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, walk_state, &(node)); | 564 | ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, |
565 | walk_state, &(node)); | ||
546 | if (ACPI_FAILURE (status)) { | 566 | if (ACPI_FAILURE (status)) { |
547 | #ifdef _ACPI_ASL_COMPILER | 567 | #ifdef _ACPI_ASL_COMPILER |
548 | if (status == AE_NOT_FOUND) { | 568 | if (status == AE_NOT_FOUND) { |
@@ -582,7 +602,8 @@ acpi_ds_load2_begin_op ( | |||
582 | * Scope (DEB) { ... } | 602 | * Scope (DEB) { ... } |
583 | */ | 603 | */ |
584 | 604 | ||
585 | ACPI_REPORT_WARNING (("Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n", | 605 | ACPI_REPORT_WARNING (( |
606 | "Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n", | ||
586 | buffer_ptr, acpi_ut_get_type_name (node->type))); | 607 | buffer_ptr, acpi_ut_get_type_name (node->type))); |
587 | 608 | ||
588 | node->type = ACPI_TYPE_ANY; | 609 | node->type = ACPI_TYPE_ANY; |
@@ -593,7 +614,8 @@ acpi_ds_load2_begin_op ( | |||
593 | 614 | ||
594 | /* All other types are an error */ | 615 | /* All other types are an error */ |
595 | 616 | ||
596 | ACPI_REPORT_ERROR (("Invalid type (%s) for target of Scope operator [%4.4s]\n", | 617 | ACPI_REPORT_ERROR (( |
618 | "Invalid type (%s) for target of Scope operator [%4.4s]\n", | ||
597 | acpi_ut_get_type_name (node->type), buffer_ptr)); | 619 | acpi_ut_get_type_name (node->type), buffer_ptr)); |
598 | 620 | ||
599 | return (AE_AML_OPERAND_TYPE); | 621 | return (AE_AML_OPERAND_TYPE); |
@@ -621,8 +643,9 @@ acpi_ds_load2_begin_op ( | |||
621 | 643 | ||
622 | /* | 644 | /* |
623 | * Enter the named type into the internal namespace. We enter the name | 645 | * Enter the named type into the internal namespace. We enter the name |
624 | * as we go downward in the parse tree. Any necessary subobjects that involve | 646 | * as we go downward in the parse tree. Any necessary subobjects that |
625 | * arguments to the opcode must be created as we go back up the parse tree later. | 647 | * involve arguments to the opcode must be created as we go back up the |
648 | * parse tree later. | ||
626 | * | 649 | * |
627 | * Note: Name may already exist if we are executing a deferred opcode. | 650 | * Note: Name may already exist if we are executing a deferred opcode. |
628 | */ | 651 | */ |
@@ -635,7 +658,8 @@ acpi_ds_load2_begin_op ( | |||
635 | } | 658 | } |
636 | 659 | ||
637 | status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, object_type, | 660 | status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, object_type, |
638 | ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, walk_state, &(node)); | 661 | ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, |
662 | walk_state, &(node)); | ||
639 | break; | 663 | break; |
640 | } | 664 | } |
641 | 665 | ||
@@ -678,8 +702,6 @@ acpi_ds_load2_begin_op ( | |||
678 | * FUNCTION: acpi_ds_load2_end_op | 702 | * FUNCTION: acpi_ds_load2_end_op |
679 | * | 703 | * |
680 | * PARAMETERS: walk_state - Current state of the parse tree walk | 704 | * PARAMETERS: walk_state - Current state of the parse tree walk |
681 | * Op - Op that has been just been completed in the | ||
682 | * walk; Arguments have now been evaluated. | ||
683 | * | 705 | * |
684 | * RETURN: Status | 706 | * RETURN: Status |
685 | * | 707 | * |
@@ -738,7 +760,8 @@ acpi_ds_load2_end_op ( | |||
738 | 760 | ||
739 | /* Pop the scope stack */ | 761 | /* Pop the scope stack */ |
740 | 762 | ||
741 | if (acpi_ns_opens_scope (object_type) && (op->common.aml_opcode != AML_INT_METHODCALL_OP)) { | 763 | if (acpi_ns_opens_scope (object_type) && |
764 | (op->common.aml_opcode != AML_INT_METHODCALL_OP)) { | ||
742 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s) Popping scope for Op %p\n", | 765 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s) Popping scope for Op %p\n", |
743 | acpi_ut_get_type_name (object_type), op)); | 766 | acpi_ut_get_type_name (object_type), op)); |
744 | 767 | ||
@@ -803,7 +826,7 @@ acpi_ds_load2_end_op ( | |||
803 | case AML_INDEX_FIELD_OP: | 826 | case AML_INDEX_FIELD_OP: |
804 | 827 | ||
805 | status = acpi_ds_create_index_field (op, (acpi_handle) arg->common.node, | 828 | status = acpi_ds_create_index_field (op, (acpi_handle) arg->common.node, |
806 | walk_state); | 829 | walk_state); |
807 | break; | 830 | break; |
808 | 831 | ||
809 | case AML_BANK_FIELD_OP: | 832 | case AML_BANK_FIELD_OP: |
@@ -884,14 +907,16 @@ acpi_ds_load2_end_op ( | |||
884 | #ifndef ACPI_NO_METHOD_EXECUTION | 907 | #ifndef ACPI_NO_METHOD_EXECUTION |
885 | case AML_REGION_OP: | 908 | case AML_REGION_OP: |
886 | /* | 909 | /* |
887 | * The op_region is not fully parsed at this time. Only valid argument is the space_id. | 910 | * The op_region is not fully parsed at this time. Only valid |
888 | * (We must save the address of the AML of the address and length operands) | 911 | * argument is the space_id. (We must save the address of the |
912 | * AML of the address and length operands) | ||
889 | */ | 913 | */ |
890 | /* | 914 | /* |
891 | * If we have a valid region, initialize it | 915 | * If we have a valid region, initialize it |
892 | * Namespace is NOT locked at this point. | 916 | * Namespace is NOT locked at this point. |
893 | */ | 917 | */ |
894 | status = acpi_ev_initialize_region (acpi_ns_get_attached_object (node), FALSE); | 918 | status = acpi_ev_initialize_region (acpi_ns_get_attached_object (node), |
919 | FALSE); | ||
895 | if (ACPI_FAILURE (status)) { | 920 | if (ACPI_FAILURE (status)) { |
896 | /* | 921 | /* |
897 | * If AE_NOT_EXIST is returned, it is not fatal | 922 | * If AE_NOT_EXIST is returned, it is not fatal |
@@ -942,15 +967,16 @@ acpi_ds_load2_end_op ( | |||
942 | if (ACPI_SUCCESS (status)) { | 967 | if (ACPI_SUCCESS (status)) { |
943 | /* | 968 | /* |
944 | * Make sure that what we found is indeed a method | 969 | * Make sure that what we found is indeed a method |
945 | * We didn't search for a method on purpose, to see if the name would resolve | 970 | * We didn't search for a method on purpose, to see if the name |
971 | * would resolve | ||
946 | */ | 972 | */ |
947 | if (new_node->type != ACPI_TYPE_METHOD) { | 973 | if (new_node->type != ACPI_TYPE_METHOD) { |
948 | status = AE_AML_OPERAND_TYPE; | 974 | status = AE_AML_OPERAND_TYPE; |
949 | } | 975 | } |
950 | 976 | ||
951 | /* We could put the returned object (Node) on the object stack for later, but | 977 | /* We could put the returned object (Node) on the object stack for |
952 | * for now, we will put it in the "op" object that the parser uses, so we | 978 | * later, but for now, we will put it in the "op" object that the |
953 | * can get it again at the end of this scope | 979 | * parser uses, so we can get it again at the end of this scope |
954 | */ | 980 | */ |
955 | op->common.node = new_node; | 981 | op->common.node = new_node; |
956 | } | 982 | } |