aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/dispatcher/dswload.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/dispatcher/dswload.c')
-rw-r--r--drivers/acpi/dispatcher/dswload.c67
1 files changed, 53 insertions, 14 deletions
diff --git a/drivers/acpi/dispatcher/dswload.c b/drivers/acpi/dispatcher/dswload.c
index d3d24da31c81..35074399c617 100644
--- a/drivers/acpi/dispatcher/dswload.c
+++ b/drivers/acpi/dispatcher/dswload.c
@@ -127,7 +127,7 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state,
127 char *path; 127 char *path;
128 u32 flags; 128 u32 flags;
129 129
130 ACPI_FUNCTION_TRACE("ds_load1_begin_op"); 130 ACPI_FUNCTION_TRACE(ds_load1_begin_op);
131 131
132 op = walk_state->op; 132 op = walk_state->op;
133 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, 133 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op,
@@ -178,12 +178,12 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state,
178 * Target of Scope() not found. Generate an External for it, and 178 * Target of Scope() not found. Generate an External for it, and
179 * insert the name into the namespace. 179 * insert the name into the namespace.
180 */ 180 */
181 acpi_dm_add_to_external_list(path); 181 acpi_dm_add_to_external_list(path, ACPI_TYPE_DEVICE, 0);
182 status = 182 status =
183 acpi_ns_lookup(walk_state->scope_info, path, 183 acpi_ns_lookup(walk_state->scope_info, path,
184 object_type, ACPI_IMODE_LOAD_PASS1, 184 object_type, ACPI_IMODE_LOAD_PASS1,
185 ACPI_NS_SEARCH_PARENT, walk_state, 185 ACPI_NS_SEARCH_PARENT, walk_state,
186 &(node)); 186 &node);
187 } 187 }
188#endif 188#endif
189 if (ACPI_FAILURE(status)) { 189 if (ACPI_FAILURE(status)) {
@@ -261,6 +261,7 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state,
261 */ 261 */
262 262
263 if (walk_state->deferred_node) { 263 if (walk_state->deferred_node) {
264
264 /* This name is already in the namespace, get the node */ 265 /* This name is already in the namespace, get the node */
265 266
266 node = walk_state->deferred_node; 267 node = walk_state->deferred_node;
@@ -300,10 +301,41 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state,
300 status = 301 status =
301 acpi_ns_lookup(walk_state->scope_info, path, object_type, 302 acpi_ns_lookup(walk_state->scope_info, path, object_type,
302 ACPI_IMODE_LOAD_PASS1, flags, walk_state, 303 ACPI_IMODE_LOAD_PASS1, flags, walk_state,
303 &(node)); 304 &node);
304 if (ACPI_FAILURE(status)) { 305 if (ACPI_FAILURE(status)) {
305 ACPI_ERROR_NAMESPACE(path, status); 306 if (status == AE_ALREADY_EXISTS) {
306 return_ACPI_STATUS(status); 307
308 /* The name already exists in this scope */
309
310 if (node->flags & ANOBJ_IS_EXTERNAL) {
311 /*
312 * Allow one create on an object or segment that was
313 * previously declared External
314 */
315 node->flags &= ~ANOBJ_IS_EXTERNAL;
316 node->type = (u8) object_type;
317
318 /* Just retyped a node, probably will need to open a scope */
319
320 if (acpi_ns_opens_scope(object_type)) {
321 status =
322 acpi_ds_scope_stack_push
323 (node, object_type,
324 walk_state);
325 if (ACPI_FAILURE(status)) {
326 return_ACPI_STATUS
327 (status);
328 }
329 }
330 status = AE_OK;
331 }
332 }
333
334 if (ACPI_FAILURE(status)) {
335
336 ACPI_ERROR_NAMESPACE(path, status);
337 return_ACPI_STATUS(status);
338 }
307 } 339 }
308 break; 340 break;
309 } 341 }
@@ -311,6 +343,7 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state,
311 /* Common exit */ 343 /* Common exit */
312 344
313 if (!op) { 345 if (!op) {
346
314 /* Create a new op */ 347 /* Create a new op */
315 348
316 op = acpi_ps_alloc_op(walk_state->opcode); 349 op = acpi_ps_alloc_op(walk_state->opcode);
@@ -359,7 +392,7 @@ acpi_status acpi_ds_load1_end_op(struct acpi_walk_state *walk_state)
359 acpi_object_type object_type; 392 acpi_object_type object_type;
360 acpi_status status = AE_OK; 393 acpi_status status = AE_OK;
361 394
362 ACPI_FUNCTION_TRACE("ds_load1_end_op"); 395 ACPI_FUNCTION_TRACE(ds_load1_end_op);
363 396
364 op = walk_state->op; 397 op = walk_state->op;
365 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, 398 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op,
@@ -413,6 +446,7 @@ acpi_status acpi_ds_load1_end_op(struct acpi_walk_state *walk_state)
413#endif 446#endif
414 447
415 if (op->common.aml_opcode == AML_NAME_OP) { 448 if (op->common.aml_opcode == AML_NAME_OP) {
449
416 /* For Name opcode, get the object type from the argument */ 450 /* For Name opcode, get the object type from the argument */
417 451
418 if (op->common.value.arg) { 452 if (op->common.value.arg) {
@@ -445,7 +479,7 @@ acpi_status acpi_ds_load1_end_op(struct acpi_walk_state *walk_state)
445 * arguments.) 479 * arguments.)
446 */ 480 */
447 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, 481 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
448 "LOADING-Method: State=%p Op=%p named_obj=%p\n", 482 "LOADING-Method: State=%p Op=%p NamedObj=%p\n",
449 walk_state, op, op->named.node)); 483 walk_state, op, op->named.node));
450 484
451 if (!acpi_ns_get_attached_object(op->named.node)) { 485 if (!acpi_ns_get_attached_object(op->named.node)) {
@@ -511,7 +545,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state,
511 acpi_object_type object_type; 545 acpi_object_type object_type;
512 char *buffer_ptr; 546 char *buffer_ptr;
513 547
514 ACPI_FUNCTION_TRACE("ds_load2_begin_op"); 548 ACPI_FUNCTION_TRACE(ds_load2_begin_op);
515 549
516 op = walk_state->op; 550 op = walk_state->op;
517 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, 551 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op,
@@ -521,6 +555,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state,
521 if ((walk_state->control_state) && 555 if ((walk_state->control_state) &&
522 (walk_state->control_state->common.state == 556 (walk_state->control_state->common.state ==
523 ACPI_CONTROL_CONDITIONAL_EXECUTING)) { 557 ACPI_CONTROL_CONDITIONAL_EXECUTING)) {
558
524 /* We are executing a while loop outside of a method */ 559 /* We are executing a while loop outside of a method */
525 560
526 status = acpi_ds_exec_begin_op(walk_state, out_op); 561 status = acpi_ds_exec_begin_op(walk_state, out_op);
@@ -554,10 +589,12 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state,
554 /* Get the name we are going to enter or lookup in the namespace */ 589 /* Get the name we are going to enter or lookup in the namespace */
555 590
556 if (walk_state->opcode == AML_INT_NAMEPATH_OP) { 591 if (walk_state->opcode == AML_INT_NAMEPATH_OP) {
592
557 /* For Namepath op, get the path string */ 593 /* For Namepath op, get the path string */
558 594
559 buffer_ptr = op->common.value.string; 595 buffer_ptr = op->common.value.string;
560 if (!buffer_ptr) { 596 if (!buffer_ptr) {
597
561 /* No name, just exit */ 598 /* No name, just exit */
562 599
563 return_ACPI_STATUS(AE_OK); 600 return_ACPI_STATUS(AE_OK);
@@ -680,6 +717,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state,
680 /* All other opcodes */ 717 /* All other opcodes */
681 718
682 if (op && op->common.node) { 719 if (op && op->common.node) {
720
683 /* This op/node was previously entered into the namespace */ 721 /* This op/node was previously entered into the namespace */
684 722
685 node = op->common.node; 723 node = op->common.node;
@@ -705,6 +743,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state,
705 * Note: Name may already exist if we are executing a deferred opcode. 743 * Note: Name may already exist if we are executing a deferred opcode.
706 */ 744 */
707 if (walk_state->deferred_node) { 745 if (walk_state->deferred_node) {
746
708 /* This name is already in the namespace, get the node */ 747 /* This name is already in the namespace, get the node */
709 748
710 node = walk_state->deferred_node; 749 node = walk_state->deferred_node;
@@ -727,6 +766,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state,
727 } 766 }
728 767
729 if (!op) { 768 if (!op) {
769
730 /* Create a new op */ 770 /* Create a new op */
731 771
732 op = acpi_ps_alloc_op(walk_state->opcode); 772 op = acpi_ps_alloc_op(walk_state->opcode);
@@ -776,7 +816,7 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state)
776 u32 i; 816 u32 i;
777#endif 817#endif
778 818
779 ACPI_FUNCTION_TRACE("ds_load2_end_op"); 819 ACPI_FUNCTION_TRACE(ds_load2_end_op);
780 820
781 op = walk_state->op; 821 op = walk_state->op;
782 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Opcode [%s] Op %p State %p\n", 822 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Opcode [%s] Op %p State %p\n",
@@ -870,7 +910,7 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state)
870 */ 910 */
871 911
872 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, 912 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
873 "Create-Load [%s] State=%p Op=%p named_obj=%p\n", 913 "Create-Load [%s] State=%p Op=%p NamedObj=%p\n",
874 acpi_ps_get_opcode_name(op->common.aml_opcode), 914 acpi_ps_get_opcode_name(op->common.aml_opcode),
875 walk_state, op, node)); 915 walk_state, op, node));
876 916
@@ -1045,7 +1085,7 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state)
1045 * arguments.) 1085 * arguments.)
1046 */ 1086 */
1047 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, 1087 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
1048 "LOADING-Method: State=%p Op=%p named_obj=%p\n", 1088 "LOADING-Method: State=%p Op=%p NamedObj=%p\n",
1049 walk_state, op, op->named.node)); 1089 walk_state, op, op->named.node));
1050 1090
1051 if (!acpi_ns_get_attached_object(op->named.node)) { 1091 if (!acpi_ns_get_attached_object(op->named.node)) {
@@ -1090,7 +1130,7 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state)
1090 case AML_CLASS_METHOD_CALL: 1130 case AML_CLASS_METHOD_CALL:
1091 1131
1092 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, 1132 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
1093 "RESOLVING-method_call: State=%p Op=%p named_obj=%p\n", 1133 "RESOLVING-MethodCall: State=%p Op=%p NamedObj=%p\n",
1094 walk_state, op, node)); 1134 walk_state, op, node));
1095 1135
1096 /* 1136 /*
@@ -1104,7 +1144,6 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state)
1104 ACPI_NS_DONT_OPEN_SCOPE, walk_state, 1144 ACPI_NS_DONT_OPEN_SCOPE, walk_state,
1105 &(new_node)); 1145 &(new_node));
1106 if (ACPI_SUCCESS(status)) { 1146 if (ACPI_SUCCESS(status)) {
1107
1108 /* 1147 /*
1109 * Make sure that what we found is indeed a method 1148 * Make sure that what we found is indeed a method
1110 * We didn't search for a method on purpose, to see if the name 1149 * We didn't search for a method on purpose, to see if the name