aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/dispatcher/dsmethod.c65
-rw-r--r--drivers/acpi/dispatcher/dsobject.c81
-rw-r--r--drivers/acpi/dispatcher/dswexec.c33
-rw-r--r--drivers/acpi/dispatcher/dswload.c110
-rw-r--r--drivers/acpi/executer/exoparg3.c4
-rw-r--r--drivers/acpi/hardware/hwregs.c3
-rw-r--r--drivers/acpi/namespace/nsinit.c85
-rw-r--r--drivers/acpi/namespace/nssearch.c17
-rw-r--r--drivers/acpi/namespace/nsxfeval.c4
-rw-r--r--drivers/acpi/parser/psargs.c198
-rw-r--r--drivers/acpi/parser/psloop.c9
-rw-r--r--drivers/acpi/parser/psparse.c17
-rw-r--r--drivers/acpi/resources/rsdump.c1
-rw-r--r--drivers/acpi/utilities/utalloc.c4
-rw-r--r--drivers/acpi/utilities/uteval.c20
-rw-r--r--drivers/acpi/utilities/utglobal.c9
-rw-r--r--drivers/acpi/utilities/utmisc.c2
-rw-r--r--drivers/acpi/utilities/utresrc.c109
18 files changed, 520 insertions, 251 deletions
diff --git a/drivers/acpi/dispatcher/dsmethod.c b/drivers/acpi/dispatcher/dsmethod.c
index 58ad00b31ee9..e7ce86b8d954 100644
--- a/drivers/acpi/dispatcher/dsmethod.c
+++ b/drivers/acpi/dispatcher/dsmethod.c
@@ -47,12 +47,70 @@
47#include <acpi/acdispat.h> 47#include <acpi/acdispat.h>
48#include <acpi/acinterp.h> 48#include <acpi/acinterp.h>
49#include <acpi/acnamesp.h> 49#include <acpi/acnamesp.h>
50#include <acpi/acdisasm.h>
50 51
51#define _COMPONENT ACPI_DISPATCHER 52#define _COMPONENT ACPI_DISPATCHER
52ACPI_MODULE_NAME("dsmethod") 53ACPI_MODULE_NAME("dsmethod")
53 54
54/******************************************************************************* 55/*******************************************************************************
55 * 56 *
57 * FUNCTION: acpi_ds_method_error
58 *
59 * PARAMETERS: Status - Execution status
60 * walk_state - Current state
61 *
62 * RETURN: Status
63 *
64 * DESCRIPTION: Called on method error. Invoke the global exception handler if
65 * present, dump the method data if the disassembler is configured
66 *
67 * Note: Allows the exception handler to change the status code
68 *
69 ******************************************************************************/
70acpi_status
71acpi_ds_method_error(acpi_status status, struct acpi_walk_state *walk_state)
72{
73 ACPI_FUNCTION_ENTRY();
74
75 /* Ignore AE_OK and control exception codes */
76
77 if (ACPI_SUCCESS(status) || (status & AE_CODE_CONTROL)) {
78 return (status);
79 }
80
81 /* Invoke the global exception handler */
82
83 if (acpi_gbl_exception_handler) {
84 /* Exit the interpreter, allow handler to execute methods */
85
86 acpi_ex_exit_interpreter();
87
88 /*
89 * Handler can map the exception code to anything it wants, including
90 * AE_OK, in which case the executing method will not be aborted.
91 */
92 status = acpi_gbl_exception_handler(status,
93 walk_state->method_node ?
94 walk_state->method_node->
95 name.integer : 0,
96 walk_state->opcode,
97 walk_state->aml_offset,
98 NULL);
99 (void)acpi_ex_enter_interpreter();
100 }
101#ifdef ACPI_DISASSEMBLER
102 if (ACPI_FAILURE(status)) {
103 /* Display method locals/args if disassembler is present */
104
105 acpi_dm_dump_method_info(status, walk_state, walk_state->op);
106 }
107#endif
108
109 return (status);
110}
111
112/*******************************************************************************
113 *
56 * FUNCTION: acpi_ds_begin_method_execution 114 * FUNCTION: acpi_ds_begin_method_execution
57 * 115 *
58 * PARAMETERS: method_node - Node of the method 116 * PARAMETERS: method_node - Node of the method
@@ -66,10 +124,11 @@ ACPI_MODULE_NAME("dsmethod")
66 * for clearance to execute. 124 * for clearance to execute.
67 * 125 *
68 ******************************************************************************/ 126 ******************************************************************************/
127
69acpi_status 128acpi_status
70acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node, 129acpi_ds_begin_method_execution(struct acpi_namespace_node * method_node,
71 union acpi_operand_object *obj_desc, 130 union acpi_operand_object * obj_desc,
72 struct acpi_namespace_node *calling_method_node) 131 struct acpi_namespace_node * calling_method_node)
73{ 132{
74 acpi_status status = AE_OK; 133 acpi_status status = AE_OK;
75 134
diff --git a/drivers/acpi/dispatcher/dsobject.c b/drivers/acpi/dispatcher/dsobject.c
index 8ac0cd93adb5..905a84e4b145 100644
--- a/drivers/acpi/dispatcher/dsobject.c
+++ b/drivers/acpi/dispatcher/dsobject.c
@@ -51,6 +51,7 @@
51#define _COMPONENT ACPI_DISPATCHER 51#define _COMPONENT ACPI_DISPATCHER
52ACPI_MODULE_NAME("dsobject") 52ACPI_MODULE_NAME("dsobject")
53 53
54/* Local prototypes */
54static acpi_status 55static acpi_status
55acpi_ds_build_internal_object(struct acpi_walk_state *walk_state, 56acpi_ds_build_internal_object(struct acpi_walk_state *walk_state,
56 union acpi_parse_object *op, 57 union acpi_parse_object *op,
@@ -85,7 +86,7 @@ acpi_ds_build_internal_object(struct acpi_walk_state *walk_state,
85 *obj_desc_ptr = NULL; 86 *obj_desc_ptr = NULL;
86 if (op->common.aml_opcode == AML_INT_NAMEPATH_OP) { 87 if (op->common.aml_opcode == AML_INT_NAMEPATH_OP) {
87 /* 88 /*
88 * This is an named object reference. If this name was 89 * This is a named object reference. If this name was
89 * previously looked up in the namespace, it was stored in this op. 90 * previously looked up in the namespace, it was stored in this op.
90 * Otherwise, go ahead and look it up now 91 * Otherwise, go ahead and look it up now
91 */ 92 */
@@ -96,18 +97,48 @@ acpi_ds_build_internal_object(struct acpi_walk_state *walk_state,
96 ACPI_IMODE_EXECUTE, 97 ACPI_IMODE_EXECUTE,
97 ACPI_NS_SEARCH_PARENT | 98 ACPI_NS_SEARCH_PARENT |
98 ACPI_NS_DONT_OPEN_SCOPE, NULL, 99 ACPI_NS_DONT_OPEN_SCOPE, NULL,
99 (struct acpi_namespace_node **) 100 ACPI_CAST_INDIRECT_PTR(struct
100 &(op->common.node)); 101 acpi_namespace_node,
101 102 &(op->
103 common.
104 node)));
102 if (ACPI_FAILURE(status)) { 105 if (ACPI_FAILURE(status)) {
103 ACPI_REPORT_NSERROR(op->common.value.string, 106 /* Check if we are resolving a named reference within a package */
104 status); 107
108 if ((status == AE_NOT_FOUND)
109 && (acpi_gbl_enable_interpreter_slack)
110 &&
111 ((op->common.parent->common.aml_opcode ==
112 AML_PACKAGE_OP)
113 || (op->common.parent->common.aml_opcode ==
114 AML_VAR_PACKAGE_OP))) {
115 /*
116 * We didn't find the target and we are populating elements
117 * of a package - ignore if slack enabled. Some ASL code
118 * contains dangling invalid references in packages and
119 * expects that no exception will be issued. Leave the
120 * element as a null element. It cannot be used, but it
121 * can be overwritten by subsequent ASL code - this is
122 * typically the case.
123 */
124 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
125 "Ignoring unresolved reference in package [%4.4s]\n",
126 walk_state->
127 scope_info->scope.
128 node->name.ascii));
129
130 return_ACPI_STATUS(AE_OK);
131 } else {
132 ACPI_REPORT_NSERROR(op->common.value.
133 string, status);
134 }
135
105 return_ACPI_STATUS(status); 136 return_ACPI_STATUS(status);
106 } 137 }
107 } 138 }
108 } 139 }
109 140
110 /* Create and init the internal ACPI object */ 141 /* Create and init a new internal ACPI object */
111 142
112 obj_desc = acpi_ut_create_internal_object((acpi_ps_get_opcode_info 143 obj_desc = acpi_ut_create_internal_object((acpi_ps_get_opcode_info
113 (op->common.aml_opcode))-> 144 (op->common.aml_opcode))->
@@ -157,13 +188,13 @@ acpi_ds_build_internal_buffer_obj(struct acpi_walk_state *walk_state,
157 188
158 ACPI_FUNCTION_TRACE("ds_build_internal_buffer_obj"); 189 ACPI_FUNCTION_TRACE("ds_build_internal_buffer_obj");
159 190
191 /*
192 * If we are evaluating a Named buffer object "Name (xxxx, Buffer)".
193 * The buffer object already exists (from the NS node), otherwise it must
194 * be created.
195 */
160 obj_desc = *obj_desc_ptr; 196 obj_desc = *obj_desc_ptr;
161 if (obj_desc) { 197 if (!obj_desc) {
162 /*
163 * We are evaluating a Named buffer object "Name (xxxx, Buffer)".
164 * The buffer object already exists (from the NS node)
165 */
166 } else {
167 /* Create a new buffer object */ 198 /* Create a new buffer object */
168 199
169 obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_BUFFER); 200 obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_BUFFER);
@@ -259,7 +290,7 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state,
259 union acpi_operand_object *obj_desc = NULL; 290 union acpi_operand_object *obj_desc = NULL;
260 u32 package_list_length; 291 u32 package_list_length;
261 acpi_status status = AE_OK; 292 acpi_status status = AE_OK;
262 u32 i; 293 acpi_native_uint i;
263 294
264 ACPI_FUNCTION_TRACE("ds_build_internal_package_obj"); 295 ACPI_FUNCTION_TRACE("ds_build_internal_package_obj");
265 296
@@ -271,13 +302,12 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state,
271 parent = parent->common.parent; 302 parent = parent->common.parent;
272 } 303 }
273 304
305 /*
306 * If we are evaluating a Named package object "Name (xxxx, Package)",
307 * the package object already exists, otherwise it must be created.
308 */
274 obj_desc = *obj_desc_ptr; 309 obj_desc = *obj_desc_ptr;
275 if (obj_desc) { 310 if (!obj_desc) {
276 /*
277 * We are evaluating a Named package object "Name (xxxx, Package)".
278 * Get the existing package object from the NS node
279 */
280 } else {
281 obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_PACKAGE); 311 obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_PACKAGE);
282 *obj_desc_ptr = obj_desc; 312 *obj_desc_ptr = obj_desc;
283 if (!obj_desc) { 313 if (!obj_desc) {
@@ -291,11 +321,9 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state,
291 321
292 /* Count the number of items in the package list */ 322 /* Count the number of items in the package list */
293 323
294 package_list_length = 0;
295 arg = op->common.value.arg; 324 arg = op->common.value.arg;
296 arg = arg->common.next; 325 arg = arg->common.next;
297 while (arg) { 326 for (package_list_length = 0; arg; package_list_length++) {
298 package_list_length++;
299 arg = arg->common.next; 327 arg = arg->common.next;
300 } 328 }
301 329
@@ -322,12 +350,11 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state,
322 } 350 }
323 351
324 /* 352 /*
325 * Now init the elements of the package 353 * Initialize all elements of the package
326 */ 354 */
327 i = 0;
328 arg = op->common.value.arg; 355 arg = op->common.value.arg;
329 arg = arg->common.next; 356 arg = arg->common.next;
330 while (arg) { 357 for (i = 0; arg; i++) {
331 if (arg->common.aml_opcode == AML_INT_RETURN_VALUE_OP) { 358 if (arg->common.aml_opcode == AML_INT_RETURN_VALUE_OP) {
332 /* Object (package or buffer) is already built */ 359 /* Object (package or buffer) is already built */
333 360
@@ -340,8 +367,6 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state,
340 package. 367 package.
341 elements[i]); 368 elements[i]);
342 } 369 }
343
344 i++;
345 arg = arg->common.next; 370 arg = arg->common.next;
346 } 371 }
347 372
diff --git a/drivers/acpi/dispatcher/dswexec.c b/drivers/acpi/dispatcher/dswexec.c
index e522763bb692..74f6996db2d7 100644
--- a/drivers/acpi/dispatcher/dswexec.c
+++ b/drivers/acpi/dispatcher/dswexec.c
@@ -314,12 +314,13 @@ acpi_ds_exec_begin_op(struct acpi_walk_state *walk_state,
314 314
315 case AML_CLASS_EXECUTE: 315 case AML_CLASS_EXECUTE:
316 case AML_CLASS_CREATE: 316 case AML_CLASS_CREATE:
317
318 /* 317 /*
319 * Most operators with arguments. 318 * Most operators with arguments.
320 * Start a new result/operand state 319 * Start a new result/operand state
321 */ 320 */
322 status = acpi_ds_result_stack_push(walk_state); 321 if (walk_state->opcode != AML_CREATE_FIELD_OP) {
322 status = acpi_ds_result_stack_push(walk_state);
323 }
323 break; 324 break;
324 325
325 default: 326 default:
@@ -723,20 +724,6 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state)
723 724
724 cleanup: 725 cleanup:
725 726
726 /* Invoke exception handler on error */
727
728 if (ACPI_FAILURE(status) &&
729 acpi_gbl_exception_handler && !(status & AE_CODE_CONTROL)) {
730 acpi_ex_exit_interpreter();
731 status = acpi_gbl_exception_handler(status,
732 walk_state->method_node->
733 name.integer,
734 walk_state->opcode,
735 walk_state->aml_offset,
736 NULL);
737 (void)acpi_ex_enter_interpreter();
738 }
739
740 if (walk_state->result_obj) { 727 if (walk_state->result_obj) {
741 /* Break to debugger to display result */ 728 /* Break to debugger to display result */
742 729
@@ -758,18 +745,14 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state)
758 } 745 }
759#endif 746#endif
760 747
761 /* Always clear the object stack */ 748 /* Invoke exception handler on error */
762
763 walk_state->num_operands = 0;
764
765#ifdef ACPI_DISASSEMBLER
766
767 /* On error, display method locals/args */
768 749
769 if (ACPI_FAILURE(status)) { 750 if (ACPI_FAILURE(status)) {
770 acpi_dm_dump_method_info(status, walk_state, op); 751 status = acpi_ds_method_error(status, walk_state);
771 } 752 }
772#endif
773 753
754 /* Always clear the object stack */
755
756 walk_state->num_operands = 0;
774 return_ACPI_STATUS(status); 757 return_ACPI_STATUS(status);
775} 758}
diff --git a/drivers/acpi/dispatcher/dswload.c b/drivers/acpi/dispatcher/dswload.c
index 44d4f4bb2f92..441931cab08a 100644
--- a/drivers/acpi/dispatcher/dswload.c
+++ b/drivers/acpi/dispatcher/dswload.c
@@ -428,43 +428,54 @@ acpi_status acpi_ds_load1_end_op(struct acpi_walk_state *walk_state)
428 } 428 }
429 } 429 }
430 430
431 if (op->common.aml_opcode == AML_METHOD_OP) { 431 /*
432 /* 432 * If we are executing a method, do not create any namespace objects
433 * method_op pkg_length name_string method_flags term_list 433 * during the load phase, only during execution.
434 * 434 */
435 * Note: We must create the method node/object pair as soon as we 435 if (!walk_state->method_node) {
436 * see the method declaration. This allows later pass1 parsing 436 if (op->common.aml_opcode == AML_METHOD_OP) {
437 * of invocations of the method (need to know the number of 437 /*
438 * arguments.) 438 * method_op pkg_length name_string method_flags term_list
439 */ 439 *
440 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, 440 * Note: We must create the method node/object pair as soon as we
441 "LOADING-Method: State=%p Op=%p named_obj=%p\n", 441 * see the method declaration. This allows later pass1 parsing
442 walk_state, op, op->named.node)); 442 * of invocations of the method (need to know the number of
443 * arguments.)
444 */
445 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
446 "LOADING-Method: State=%p Op=%p named_obj=%p\n",
447 walk_state, op, op->named.node));
443 448
444 if (!acpi_ns_get_attached_object(op->named.node)) { 449 if (!acpi_ns_get_attached_object(op->named.node)) {
445 walk_state->operands[0] = (void *)op->named.node; 450 walk_state->operands[0] =
446 walk_state->num_operands = 1; 451 ACPI_CAST_PTR(void, op->named.node);
452 walk_state->num_operands = 1;
447 453
448 status = 454 status =
449 acpi_ds_create_operands(walk_state, 455 acpi_ds_create_operands(walk_state,
450 op->common.value.arg); 456 op->common.value.
451 if (ACPI_SUCCESS(status)) { 457 arg);
452 status = acpi_ex_create_method(op->named.data, 458 if (ACPI_SUCCESS(status)) {
453 op->named.length, 459 status =
454 walk_state); 460 acpi_ex_create_method(op->named.
455 } 461 data,
456 walk_state->operands[0] = NULL; 462 op->named.
457 walk_state->num_operands = 0; 463 length,
464 walk_state);
465 }
466 walk_state->operands[0] = NULL;
467 walk_state->num_operands = 0;
458 468
459 if (ACPI_FAILURE(status)) { 469 if (ACPI_FAILURE(status)) {
460 return_ACPI_STATUS(status); 470 return_ACPI_STATUS(status);
471 }
461 } 472 }
462 } 473 }
463 } 474 }
464 475
465 /* Pop the scope stack */ 476 /* Pop the scope stack (only if loading a table) */
466 477
467 if (acpi_ns_opens_scope(object_type)) { 478 if (!walk_state->method_node && acpi_ns_opens_scope(object_type)) {
468 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, 479 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
469 "(%s): Popping scope for Op %p\n", 480 "(%s): Popping scope for Op %p\n",
470 acpi_ut_get_type_name(object_type), op)); 481 acpi_ut_get_type_name(object_type), op));
@@ -1015,11 +1026,50 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state)
1015 1026
1016 status = acpi_ds_create_node(walk_state, node, op); 1027 status = acpi_ds_create_node(walk_state, node, op);
1017 break; 1028 break;
1029
1030 case AML_METHOD_OP:
1031 /*
1032 * method_op pkg_length name_string method_flags term_list
1033 *
1034 * Note: We must create the method node/object pair as soon as we
1035 * see the method declaration. This allows later pass1 parsing
1036 * of invocations of the method (need to know the number of
1037 * arguments.)
1038 */
1039 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
1040 "LOADING-Method: State=%p Op=%p named_obj=%p\n",
1041 walk_state, op, op->named.node));
1042
1043 if (!acpi_ns_get_attached_object(op->named.node)) {
1044 walk_state->operands[0] =
1045 ACPI_CAST_PTR(void, op->named.node);
1046 walk_state->num_operands = 1;
1047
1048 status =
1049 acpi_ds_create_operands(walk_state,
1050 op->common.value.
1051 arg);
1052 if (ACPI_SUCCESS(status)) {
1053 status =
1054 acpi_ex_create_method(op->named.
1055 data,
1056 op->named.
1057 length,
1058 walk_state);
1059 }
1060 walk_state->operands[0] = NULL;
1061 walk_state->num_operands = 0;
1062
1063 if (ACPI_FAILURE(status)) {
1064 return_ACPI_STATUS(status);
1065 }
1066 }
1067 break;
1068
1018#endif /* ACPI_NO_METHOD_EXECUTION */ 1069#endif /* ACPI_NO_METHOD_EXECUTION */
1019 1070
1020 default: 1071 default:
1021 /* All NAMED_COMPLEX opcodes must be handled above */ 1072 /* All NAMED_COMPLEX opcodes must be handled above */
1022 /* Note: Method objects were already created in Pass 1 */
1023 break; 1073 break;
1024 } 1074 }
1025 break; 1075 break;
diff --git a/drivers/acpi/executer/exoparg3.c b/drivers/acpi/executer/exoparg3.c
index 483365777670..2ea1c322970b 100644
--- a/drivers/acpi/executer/exoparg3.c
+++ b/drivers/acpi/executer/exoparg3.c
@@ -223,8 +223,8 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state)
223 goto cleanup; 223 goto cleanup;
224 } 224 }
225 225
226 if (length > 0) { 226 if (buffer) {
227 /* Copy the portion requested */ 227 /* We have a buffer, copy the portion requested */
228 228
229 ACPI_MEMCPY(buffer, operand[0]->string.pointer + index, 229 ACPI_MEMCPY(buffer, operand[0]->string.pointer + index,
230 length); 230 length);
diff --git a/drivers/acpi/hardware/hwregs.c b/drivers/acpi/hardware/hwregs.c
index 536a7aea80c9..b243f20708b7 100644
--- a/drivers/acpi/hardware/hwregs.c
+++ b/drivers/acpi/hardware/hwregs.c
@@ -144,7 +144,8 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 * sleep_type_a, u8 * sleep_type_b)
144 144
145 info.parameters = NULL; 145 info.parameters = NULL;
146 info.return_object = NULL; 146 info.return_object = NULL;
147 sleep_state_name = (char *)acpi_gbl_sleep_state_names[sleep_state]; 147 sleep_state_name =
148 ACPI_CAST_PTR(char, acpi_gbl_sleep_state_names[sleep_state]);
148 149
149 status = acpi_ns_evaluate_by_name(sleep_state_name, &info); 150 status = acpi_ns_evaluate_by_name(sleep_state_name, &info);
150 if (ACPI_FAILURE(status)) { 151 if (ACPI_FAILURE(status)) {
diff --git a/drivers/acpi/namespace/nsinit.c b/drivers/acpi/namespace/nsinit.c
index 0a08d2f04a06..efa3f4233736 100644
--- a/drivers/acpi/namespace/nsinit.c
+++ b/drivers/acpi/namespace/nsinit.c
@@ -336,23 +336,22 @@ acpi_ns_init_one_device(acpi_handle obj_handle,
336 struct acpi_parameter_info pinfo; 336 struct acpi_parameter_info pinfo;
337 u32 flags; 337 u32 flags;
338 acpi_status status; 338 acpi_status status;
339 struct acpi_namespace_node *ini_node;
340 struct acpi_namespace_node *device_node;
339 341
340 ACPI_FUNCTION_TRACE("ns_init_one_device"); 342 ACPI_FUNCTION_TRACE("ns_init_one_device");
341 343
342 pinfo.parameters = NULL; 344 device_node = acpi_ns_map_handle_to_node(obj_handle);
343 pinfo.parameter_type = ACPI_PARAM_ARGS; 345 if (!device_node) {
344
345 pinfo.node = acpi_ns_map_handle_to_node(obj_handle);
346 if (!pinfo.node) {
347 return_ACPI_STATUS(AE_BAD_PARAMETER); 346 return_ACPI_STATUS(AE_BAD_PARAMETER);
348 } 347 }
349 348
350 /* 349 /*
351 * We will run _STA/_INI on Devices, Processors and thermal_zones only 350 * We will run _STA/_INI on Devices, Processors and thermal_zones only
352 */ 351 */
353 if ((pinfo.node->type != ACPI_TYPE_DEVICE) && 352 if ((device_node->type != ACPI_TYPE_DEVICE) &&
354 (pinfo.node->type != ACPI_TYPE_PROCESSOR) && 353 (device_node->type != ACPI_TYPE_PROCESSOR) &&
355 (pinfo.node->type != ACPI_TYPE_THERMAL)) { 354 (device_node->type != ACPI_TYPE_THERMAL)) {
356 return_ACPI_STATUS(AE_OK); 355 return_ACPI_STATUS(AE_OK);
357 } 356 }
358 357
@@ -364,57 +363,69 @@ acpi_ns_init_one_device(acpi_handle obj_handle,
364 info->device_count++; 363 info->device_count++;
365 364
366 /* 365 /*
367 * Run _STA to determine if we can run _INI on the device. 366 * Check if the _INI method exists for this device -
367 * if _INI does not exist, there is no need to run _STA
368 * No _INI means device requires no initialization
369 */
370 status = acpi_ns_search_node(*ACPI_CAST_PTR(u32, METHOD_NAME__INI),
371 device_node, ACPI_TYPE_METHOD, &ini_node);
372 if (ACPI_FAILURE(status)) {
373 /* No _INI method found - move on to next device */
374
375 return_ACPI_STATUS(AE_OK);
376 }
377
378 /*
379 * Run _STA to determine if we can run _INI on the device -
380 * the device must be present before _INI can be run.
381 * However, _STA is not required - assume device present if no _STA
368 */ 382 */
369 ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname(ACPI_TYPE_METHOD, 383 ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname(ACPI_TYPE_METHOD,
370 pinfo.node, 384 device_node,
371 METHOD_NAME__STA)); 385 METHOD_NAME__STA));
372 status = acpi_ut_execute_STA(pinfo.node, &flags);
373 386
387 pinfo.node = device_node;
388 pinfo.parameters = NULL;
389 pinfo.parameter_type = ACPI_PARAM_ARGS;
390
391 status = acpi_ut_execute_STA(pinfo.node, &flags);
374 if (ACPI_FAILURE(status)) { 392 if (ACPI_FAILURE(status)) {
375 if (pinfo.node->type == ACPI_TYPE_DEVICE) { 393 /* Ignore error and move on to next device */
376 /* Ignore error and move on to next device */
377 394
378 return_ACPI_STATUS(AE_OK); 395 return_ACPI_STATUS(AE_OK);
379 } 396 }
380 397
381 /* _STA is not required for Processor or thermal_zone objects */ 398 if (flags != ACPI_UINT32_MAX) {
382 } else {
383 info->num_STA++; 399 info->num_STA++;
400 }
384 401
385 if (!(flags & 0x01)) { 402 if (!(flags & ACPI_STA_DEVICE_PRESENT)) {
386 /* Don't look at children of a not present device */ 403 /* Don't look at children of a not present device */
387 404
388 return_ACPI_STATUS(AE_CTRL_DEPTH); 405 return_ACPI_STATUS(AE_CTRL_DEPTH);
389 }
390 } 406 }
391 407
392 /* 408 /*
393 * The device is present. Run _INI. 409 * The device is present and _INI exists. Run the _INI method.
410 * (We already have the _INI node from above)
394 */ 411 */
395 ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname(ACPI_TYPE_METHOD, 412 ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname(ACPI_TYPE_METHOD,
396 pinfo.node, 413 pinfo.node,
397 METHOD_NAME__INI)); 414 METHOD_NAME__INI));
398 status = acpi_ns_evaluate_relative(METHOD_NAME__INI, &pinfo);
399 if (ACPI_FAILURE(status)) {
400 /* No _INI (AE_NOT_FOUND) means device requires no initialization */
401 415
402 if (status != AE_NOT_FOUND) { 416 pinfo.node = ini_node;
403 /* Ignore error and move on to next device */ 417 status = acpi_ns_evaluate_by_handle(&pinfo);
418 if (ACPI_FAILURE(status)) {
419 /* Ignore error and move on to next device */
404 420
405#ifdef ACPI_DEBUG_OUTPUT 421#ifdef ACPI_DEBUG_OUTPUT
406 char *scope_name = 422 char *scope_name = acpi_ns_get_external_pathname(ini_node);
407 acpi_ns_get_external_pathname(pinfo.node);
408 423
409 ACPI_DEBUG_PRINT((ACPI_DB_WARN, "%s._INI failed: %s\n", 424 ACPI_DEBUG_PRINT((ACPI_DB_WARN, "%s._INI failed: %s\n",
410 scope_name, 425 scope_name, acpi_format_exception(status)));
411 acpi_format_exception(status)));
412 426
413 ACPI_MEM_FREE(scope_name); 427 ACPI_MEM_FREE(scope_name);
414#endif 428#endif
415 }
416
417 status = AE_OK;
418 } else { 429 } else {
419 /* Delete any return object (especially if implicit_return is enabled) */ 430 /* Delete any return object (especially if implicit_return is enabled) */
420 431
@@ -434,5 +445,5 @@ acpi_ns_init_one_device(acpi_handle obj_handle,
434 acpi_gbl_init_handler(pinfo.node, ACPI_INIT_DEVICE_INI); 445 acpi_gbl_init_handler(pinfo.node, ACPI_INIT_DEVICE_INI);
435 } 446 }
436 447
437 return_ACPI_STATUS(status); 448 return_ACPI_STATUS(AE_OK);
438} 449}
diff --git a/drivers/acpi/namespace/nssearch.c b/drivers/acpi/namespace/nssearch.c
index 50a3ca5470ed..c1b1943d4670 100644
--- a/drivers/acpi/namespace/nssearch.c
+++ b/drivers/acpi/namespace/nssearch.c
@@ -99,8 +99,8 @@ acpi_ns_search_node(u32 target_name,
99 if (scope_name) { 99 if (scope_name) {
100 ACPI_DEBUG_PRINT((ACPI_DB_NAMES, 100 ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
101 "Searching %s (%p) For [%4.4s] (%s)\n", 101 "Searching %s (%p) For [%4.4s] (%s)\n",
102 scope_name, node, 102 scope_name, node, ACPI_CAST_PTR(char,
103 (char *)&target_name, 103 &target_name),
104 acpi_ut_get_type_name(type))); 104 acpi_ut_get_type_name(type)));
105 105
106 ACPI_MEM_FREE(scope_name); 106 ACPI_MEM_FREE(scope_name);
@@ -131,7 +131,7 @@ acpi_ns_search_node(u32 target_name,
131 */ 131 */
132 ACPI_DEBUG_PRINT((ACPI_DB_NAMES, 132 ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
133 "Name [%4.4s] (%s) %p found in scope [%4.4s] %p\n", 133 "Name [%4.4s] (%s) %p found in scope [%4.4s] %p\n",
134 (char *)&target_name, 134 ACPI_CAST_PTR(char, &target_name),
135 acpi_ut_get_type_name(next_node-> 135 acpi_ut_get_type_name(next_node->
136 type), 136 type),
137 next_node, 137 next_node,
@@ -160,7 +160,8 @@ acpi_ns_search_node(u32 target_name,
160 160
161 ACPI_DEBUG_PRINT((ACPI_DB_NAMES, 161 ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
162 "Name [%4.4s] (%s) not found in search in scope [%4.4s] %p first child %p\n", 162 "Name [%4.4s] (%s) not found in search in scope [%4.4s] %p first child %p\n",
163 (char *)&target_name, acpi_ut_get_type_name(type), 163 ACPI_CAST_PTR(char, &target_name),
164 acpi_ut_get_type_name(type),
164 acpi_ut_get_node_name(node), node, node->child)); 165 acpi_ut_get_node_name(node), node, node->child));
165 166
166 return_ACPI_STATUS(AE_NOT_FOUND); 167 return_ACPI_STATUS(AE_NOT_FOUND);
@@ -210,14 +211,14 @@ acpi_ns_search_parent_tree(u32 target_name,
210 */ 211 */
211 if (!parent_node) { 212 if (!parent_node) {
212 ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "[%4.4s] has no parent\n", 213 ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "[%4.4s] has no parent\n",
213 (char *)&target_name)); 214 ACPI_CAST_PTR(char, &target_name)));
214 return_ACPI_STATUS(AE_NOT_FOUND); 215 return_ACPI_STATUS(AE_NOT_FOUND);
215 } 216 }
216 217
217 if (acpi_ns_local(type)) { 218 if (acpi_ns_local(type)) {
218 ACPI_DEBUG_PRINT((ACPI_DB_NAMES, 219 ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
219 "[%4.4s] type [%s] must be local to this scope (no parent search)\n", 220 "[%4.4s] type [%s] must be local to this scope (no parent search)\n",
220 (char *)&target_name, 221 ACPI_CAST_PTR(char, &target_name),
221 acpi_ut_get_type_name(type))); 222 acpi_ut_get_type_name(type)));
222 return_ACPI_STATUS(AE_NOT_FOUND); 223 return_ACPI_STATUS(AE_NOT_FOUND);
223 } 224 }
@@ -227,7 +228,7 @@ acpi_ns_search_parent_tree(u32 target_name,
227 ACPI_DEBUG_PRINT((ACPI_DB_NAMES, 228 ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
228 "Searching parent [%4.4s] for [%4.4s]\n", 229 "Searching parent [%4.4s] for [%4.4s]\n",
229 acpi_ut_get_node_name(parent_node), 230 acpi_ut_get_node_name(parent_node),
230 (char *)&target_name)); 231 ACPI_CAST_PTR(char, &target_name)));
231 232
232 /* 233 /*
233 * Search parents until target is found or we have backed up to the root 234 * Search parents until target is found or we have backed up to the root
@@ -360,7 +361,7 @@ acpi_ns_search_and_enter(u32 target_name,
360 if (interpreter_mode == ACPI_IMODE_EXECUTE) { 361 if (interpreter_mode == ACPI_IMODE_EXECUTE) {
361 ACPI_DEBUG_PRINT((ACPI_DB_NAMES, 362 ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
362 "%4.4s Not found in %p [Not adding]\n", 363 "%4.4s Not found in %p [Not adding]\n",
363 (char *)&target_name, node)); 364 ACPI_CAST_PTR(char, &target_name), node));
364 365
365 return_ACPI_STATUS(AE_NOT_FOUND); 366 return_ACPI_STATUS(AE_NOT_FOUND);
366 } 367 }
diff --git a/drivers/acpi/namespace/nsxfeval.c b/drivers/acpi/namespace/nsxfeval.c
index 8167af1fa57b..75b137a6a3c9 100644
--- a/drivers/acpi/namespace/nsxfeval.c
+++ b/drivers/acpi/namespace/nsxfeval.c
@@ -473,8 +473,8 @@ acpi_ns_get_device_callback(acpi_handle obj_handle,
473 return (AE_CTRL_DEPTH); 473 return (AE_CTRL_DEPTH);
474 } 474 }
475 475
476 if (!(flags & 0x01)) { 476 if (!(flags & ACPI_STA_DEVICE_PRESENT)) {
477 /* Don't return at the device or children of the device if not there */ 477 /* Don't examine children of the device if not present */
478 478
479 return (AE_CTRL_DEPTH); 479 return (AE_CTRL_DEPTH);
480 } 480 }
diff --git a/drivers/acpi/parser/psargs.c b/drivers/acpi/parser/psargs.c
index 6eae35febccd..e6d4cb9fd303 100644
--- a/drivers/acpi/parser/psargs.c
+++ b/drivers/acpi/parser/psargs.c
@@ -45,6 +45,7 @@
45#include <acpi/acparser.h> 45#include <acpi/acparser.h>
46#include <acpi/amlcode.h> 46#include <acpi/amlcode.h>
47#include <acpi/acnamesp.h> 47#include <acpi/acnamesp.h>
48#include <acpi/acdispat.h>
48 49
49#define _COMPONENT ACPI_PARSER 50#define _COMPONENT ACPI_PARSER
50ACPI_MODULE_NAME("psargs") 51ACPI_MODULE_NAME("psargs")
@@ -211,7 +212,7 @@ char *acpi_ps_get_next_namestring(struct acpi_parse_state *parser_state)
211 * Arg - Where the namepath will be stored 212 * Arg - Where the namepath will be stored
212 * arg_count - If the namepath points to a control method 213 * arg_count - If the namepath points to a control method
213 * the method's argument is returned here. 214 * the method's argument is returned here.
214 * method_call - Whether the namepath can possibly be the 215 * possible_method_call - Whether the namepath can possibly be the
215 * start of a method call 216 * start of a method call
216 * 217 *
217 * RETURN: Status 218 * RETURN: Status
@@ -227,11 +228,11 @@ char *acpi_ps_get_next_namestring(struct acpi_parse_state *parser_state)
227acpi_status 228acpi_status
228acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state, 229acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state,
229 struct acpi_parse_state *parser_state, 230 struct acpi_parse_state *parser_state,
230 union acpi_parse_object *arg, u8 method_call) 231 union acpi_parse_object *arg, u8 possible_method_call)
231{ 232{
232 char *path; 233 char *path;
233 union acpi_parse_object *name_op; 234 union acpi_parse_object *name_op;
234 acpi_status status = AE_OK; 235 acpi_status status;
235 union acpi_operand_object *method_desc; 236 union acpi_operand_object *method_desc;
236 struct acpi_namespace_node *node; 237 struct acpi_namespace_node *node;
237 union acpi_generic_state scope_info; 238 union acpi_generic_state scope_info;
@@ -239,114 +240,127 @@ acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state,
239 ACPI_FUNCTION_TRACE("ps_get_next_namepath"); 240 ACPI_FUNCTION_TRACE("ps_get_next_namepath");
240 241
241 path = acpi_ps_get_next_namestring(parser_state); 242 path = acpi_ps_get_next_namestring(parser_state);
243 acpi_ps_init_op(arg, AML_INT_NAMEPATH_OP);
242 244
243 /* Null path case is allowed */ 245 /* Null path case is allowed, just exit */
244 246
245 if (path) { 247 if (!path) {
246 /* 248 arg->common.value.name = path;
247 * Lookup the name in the internal namespace 249 return_ACPI_STATUS(AE_OK);
248 */ 250 }
249 scope_info.scope.node = NULL;
250 node = parser_state->start_node;
251 if (node) {
252 scope_info.scope.node = node;
253 }
254 251
255 /* 252 /* Setup search scope info */
256 * Lookup object. We don't want to add anything new to the namespace 253
257 * here, however. So we use MODE_EXECUTE. Allow searching of the 254 scope_info.scope.node = NULL;
258 * parent tree, but don't open a new scope -- we just want to lookup the 255 node = parser_state->start_node;
259 * object (MUST BE mode EXECUTE to perform upsearch) 256 if (node) {
260 */ 257 scope_info.scope.node = node;
261 status = acpi_ns_lookup(&scope_info, path, ACPI_TYPE_ANY, 258 }
262 ACPI_IMODE_EXECUTE,
263 ACPI_NS_SEARCH_PARENT |
264 ACPI_NS_DONT_OPEN_SCOPE, NULL, &node);
265 if (ACPI_SUCCESS(status) && method_call) {
266 if (node->type == ACPI_TYPE_METHOD) {
267 /* This name is actually a control method invocation */
268
269 method_desc = acpi_ns_get_attached_object(node);
270 ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
271 "Control Method - %p Desc %p Path=%p\n",
272 node, method_desc, path));
273
274 name_op = acpi_ps_alloc_op(AML_INT_NAMEPATH_OP);
275 if (!name_op) {
276 return_ACPI_STATUS(AE_NO_MEMORY);
277 }
278 259
279 /* Change arg into a METHOD CALL and attach name to it */ 260 /*
261 * Lookup the name in the internal namespace. We don't want to add
262 * anything new to the namespace here, however, so we use MODE_EXECUTE.
263 * Allow searching of the parent tree, but don't open a new scope -
264 * we just want to lookup the object (must be mode EXECUTE to perform
265 * the upsearch)
266 */
267 status =
268 acpi_ns_lookup(&scope_info, path, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
269 ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
270 NULL, &node);
280 271
281 acpi_ps_init_op(arg, AML_INT_METHODCALL_OP); 272 /*
282 name_op->common.value.name = path; 273 * If this name is a control method invocation, we must
274 * setup the method call
275 */
276 if (ACPI_SUCCESS(status) &&
277 possible_method_call && (node->type == ACPI_TYPE_METHOD)) {
278 /* This name is actually a control method invocation */
283 279
284 /* Point METHODCALL/NAME to the METHOD Node */ 280 method_desc = acpi_ns_get_attached_object(node);
281 ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
282 "Control Method - %p Desc %p Path=%p\n", node,
283 method_desc, path));
285 284
286 name_op->common.node = node; 285 name_op = acpi_ps_alloc_op(AML_INT_NAMEPATH_OP);
287 acpi_ps_append_arg(arg, name_op); 286 if (!name_op) {
287 return_ACPI_STATUS(AE_NO_MEMORY);
288 }
288 289
289 if (!method_desc) { 290 /* Change Arg into a METHOD CALL and attach name to it */
290 ACPI_REPORT_ERROR(("ps_get_next_namepath: Control Method %p has no attached object\n", node));
291 return_ACPI_STATUS(AE_AML_INTERNAL);
292 }
293 291
294 ACPI_DEBUG_PRINT((ACPI_DB_PARSE, 292 acpi_ps_init_op(arg, AML_INT_METHODCALL_OP);
295 "Control Method - %p Args %X\n", 293 name_op->common.value.name = path;
296 node,
297 method_desc->method.
298 param_count));
299 294
300 /* Get the number of arguments to expect */ 295 /* Point METHODCALL/NAME to the METHOD Node */
301 296
302 walk_state->arg_count = 297 name_op->common.node = node;
303 method_desc->method.param_count; 298 acpi_ps_append_arg(arg, name_op);
304 return_ACPI_STATUS(AE_OK);
305 }
306 299
307 /* 300 if (!method_desc) {
308 * Else this is normal named object reference. 301 ACPI_REPORT_ERROR(("ps_get_next_namepath: Control Method %p has no attached object\n", node));
309 * Just init the NAMEPATH object with the pathname. 302 return_ACPI_STATUS(AE_AML_INTERNAL);
310 * (See code below)
311 */
312 } 303 }
313 304
314 if (ACPI_FAILURE(status)) { 305 ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
315 /* 306 "Control Method - %p Args %X\n",
316 * 1) Any error other than NOT_FOUND is always severe 307 node, method_desc->method.param_count));
317 * 2) NOT_FOUND is only important if we are executing a method. 308
318 * 3) If executing a cond_ref_of opcode, NOT_FOUND is ok. 309 /* Get the number of arguments to expect */
319 */ 310
320 if ((((walk_state-> 311 walk_state->arg_count = method_desc->method.param_count;
321 parse_flags & ACPI_PARSE_MODE_MASK) == 312 return_ACPI_STATUS(AE_OK);
322 ACPI_PARSE_EXECUTE) && (status == AE_NOT_FOUND)
323 && (walk_state->op->common.aml_opcode !=
324 AML_COND_REF_OF_OP))
325 || (status != AE_NOT_FOUND)) {
326 ACPI_REPORT_NSERROR(path, status);
327
328 acpi_os_printf
329 ("search_node %p start_node %p return_node %p\n",
330 scope_info.scope.node,
331 parser_state->start_node, node);
332 } else {
333 /*
334 * We got a NOT_FOUND during table load or we encountered
335 * a cond_ref_of(x) where the target does not exist.
336 * Either case is ok
337 */
338 status = AE_OK;
339 }
340 }
341 } 313 }
342 314
343 /* 315 /*
344 * Regardless of success/failure above, 316 * Special handling if the name was not found during the lookup -
345 * Just initialize the Op with the pathname. 317 * some not_found cases are allowed
346 */ 318 */
347 acpi_ps_init_op(arg, AML_INT_NAMEPATH_OP); 319 if (status == AE_NOT_FOUND) {
348 arg->common.value.name = path; 320 /* 1) not_found is ok during load pass 1/2 (allow forward references) */
321
322 if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) !=
323 ACPI_PARSE_EXECUTE) {
324 status = AE_OK;
325 }
326
327 /* 2) not_found during a cond_ref_of(x) is ok by definition */
328
329 else if (walk_state->op->common.aml_opcode ==
330 AML_COND_REF_OF_OP) {
331 status = AE_OK;
332 }
333
334 /*
335 * 3) not_found while building a Package is ok at this point, we
336 * may flag as an error later if slack mode is not enabled.
337 * (Some ASL code depends on allowing this behavior)
338 */
339 else if ((arg->common.parent) &&
340 ((arg->common.parent->common.aml_opcode ==
341 AML_PACKAGE_OP)
342 || (arg->common.parent->common.aml_opcode ==
343 AML_VAR_PACKAGE_OP))) {
344 status = AE_OK;
345 }
346 }
347
348 /* Final exception check (may have been changed from code above) */
349
350 if (ACPI_FAILURE(status)) {
351 ACPI_REPORT_NSERROR(path, status);
352
353 if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) ==
354 ACPI_PARSE_EXECUTE) {
355 /* Report a control method execution error */
349 356
357 status = acpi_ds_method_error(status, walk_state);
358 }
359 }
360
361 /* Save the namepath */
362
363 arg->common.value.name = path;
350 return_ACPI_STATUS(status); 364 return_ACPI_STATUS(status);
351} 365}
352 366
diff --git a/drivers/acpi/parser/psloop.c b/drivers/acpi/parser/psloop.c
index 088d33999d90..e81e51b8b3ae 100644
--- a/drivers/acpi/parser/psloop.c
+++ b/drivers/acpi/parser/psloop.c
@@ -704,6 +704,15 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state)
704 acpi_ps_pop_scope(parser_state, &op, 704 acpi_ps_pop_scope(parser_state, &op,
705 &walk_state->arg_types, 705 &walk_state->arg_types,
706 &walk_state->arg_count); 706 &walk_state->arg_count);
707
708 if (op->common.aml_opcode != AML_WHILE_OP) {
709 status2 =
710 acpi_ds_result_stack_pop
711 (walk_state);
712 if (ACPI_FAILURE(status2)) {
713 return_ACPI_STATUS(status2);
714 }
715 }
707 } 716 }
708 717
709 /* Close this iteration of the While loop */ 718 /* Close this iteration of the While loop */
diff --git a/drivers/acpi/parser/psparse.c b/drivers/acpi/parser/psparse.c
index 7cfa7eb0dfc7..f0979b2956f2 100644
--- a/drivers/acpi/parser/psparse.c
+++ b/drivers/acpi/parser/psparse.c
@@ -333,7 +333,6 @@ acpi_ps_next_parse_state(struct acpi_walk_state *walk_state,
333 333
334 switch (callback_status) { 334 switch (callback_status) {
335 case AE_CTRL_TERMINATE: 335 case AE_CTRL_TERMINATE:
336
337 /* 336 /*
338 * A control method was terminated via a RETURN statement. 337 * A control method was terminated via a RETURN statement.
339 * The walk of this method is complete. 338 * The walk of this method is complete.
@@ -346,13 +345,19 @@ acpi_ps_next_parse_state(struct acpi_walk_state *walk_state,
346 345
347 parser_state->aml = walk_state->aml_last_while; 346 parser_state->aml = walk_state->aml_last_while;
348 walk_state->control_state->common.value = FALSE; 347 walk_state->control_state->common.value = FALSE;
349 status = AE_CTRL_BREAK; 348 status = acpi_ds_result_stack_pop(walk_state);
349 if (ACPI_SUCCESS(status)) {
350 status = AE_CTRL_BREAK;
351 }
350 break; 352 break;
351 353
352 case AE_CTRL_CONTINUE: 354 case AE_CTRL_CONTINUE:
353 355
354 parser_state->aml = walk_state->aml_last_while; 356 parser_state->aml = walk_state->aml_last_while;
355 status = AE_CTRL_CONTINUE; 357 status = acpi_ds_result_stack_pop(walk_state);
358 if (ACPI_SUCCESS(status)) {
359 status = AE_CTRL_CONTINUE;
360 }
356 break; 361 break;
357 362
358 case AE_CTRL_PENDING: 363 case AE_CTRL_PENDING:
@@ -369,16 +374,18 @@ acpi_ps_next_parse_state(struct acpi_walk_state *walk_state,
369#endif 374#endif
370 375
371 case AE_CTRL_TRUE: 376 case AE_CTRL_TRUE:
372
373 /* 377 /*
374 * Predicate of an IF was true, and we are at the matching ELSE. 378 * Predicate of an IF was true, and we are at the matching ELSE.
375 * Just close out this package 379 * Just close out this package
376 */ 380 */
377 parser_state->aml = acpi_ps_get_next_package_end(parser_state); 381 parser_state->aml = acpi_ps_get_next_package_end(parser_state);
382 status = acpi_ds_result_stack_pop(walk_state);
383 if (ACPI_SUCCESS(status)) {
384 status = AE_CTRL_PENDING;
385 }
378 break; 386 break;
379 387
380 case AE_CTRL_FALSE: 388 case AE_CTRL_FALSE:
381
382 /* 389 /*
383 * Either an IF/WHILE Predicate was false or we encountered a BREAK 390 * Either an IF/WHILE Predicate was false or we encountered a BREAK
384 * opcode. In both cases, we do not execute the rest of the 391 * opcode. In both cases, we do not execute the rest of the
diff --git a/drivers/acpi/resources/rsdump.c b/drivers/acpi/resources/rsdump.c
index cebd890d3db5..c24e3eb658c3 100644
--- a/drivers/acpi/resources/rsdump.c
+++ b/drivers/acpi/resources/rsdump.c
@@ -43,7 +43,6 @@
43 43
44#include <acpi/acpi.h> 44#include <acpi/acpi.h>
45#include <acpi/acresrc.h> 45#include <acpi/acresrc.h>
46#include <acpi/acdisasm.h>
47 46
48#define _COMPONENT ACPI_RESOURCES 47#define _COMPONENT ACPI_RESOURCES
49ACPI_MODULE_NAME("rsdump") 48ACPI_MODULE_NAME("rsdump")
diff --git a/drivers/acpi/utilities/utalloc.c b/drivers/acpi/utilities/utalloc.c
index e04b6119a4d7..b11b7ed788c6 100644
--- a/drivers/acpi/utilities/utalloc.c
+++ b/drivers/acpi/utilities/utalloc.c
@@ -47,7 +47,7 @@
47ACPI_MODULE_NAME("utalloc") 47ACPI_MODULE_NAME("utalloc")
48 48
49/* Local prototypes */ 49/* Local prototypes */
50#ifdef ACPI_DBG_TRACK_ALLOCATIONS 50#ifdef ACPI_DBG_TRACK_ALLOCATIONS
51static struct acpi_debug_mem_block *acpi_ut_find_allocation(void *allocation); 51static struct acpi_debug_mem_block *acpi_ut_find_allocation(void *allocation);
52 52
53static acpi_status 53static acpi_status
@@ -58,9 +58,7 @@ acpi_ut_track_allocation(struct acpi_debug_mem_block *address,
58static acpi_status 58static acpi_status
59acpi_ut_remove_allocation(struct acpi_debug_mem_block *address, 59acpi_ut_remove_allocation(struct acpi_debug_mem_block *address,
60 u32 component, char *module, u32 line); 60 u32 component, char *module, u32 line);
61#endif /* ACPI_DBG_TRACK_ALLOCATIONS */
62 61
63#ifdef ACPI_DBG_TRACK_ALLOCATIONS
64static acpi_status 62static acpi_status
65acpi_ut_create_list(char *list_name, 63acpi_ut_create_list(char *list_name,
66 u16 object_size, struct acpi_memory_list **return_cache); 64 u16 object_size, struct acpi_memory_list **return_cache);
diff --git a/drivers/acpi/utilities/uteval.c b/drivers/acpi/utilities/uteval.c
index 7b81d5ef3c32..cd63a2d93fe3 100644
--- a/drivers/acpi/utilities/uteval.c
+++ b/drivers/acpi/utilities/uteval.c
@@ -95,7 +95,9 @@ acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state)
95 95
96 for (i = 0; i < ACPI_NUM_OSI_STRINGS; i++) { 96 for (i = 0; i < ACPI_NUM_OSI_STRINGS; i++) {
97 if (!ACPI_STRCMP(string_desc->string.pointer, 97 if (!ACPI_STRCMP(string_desc->string.pointer,
98 (char *)acpi_gbl_valid_osi_strings[i])) { 98 ACPI_CAST_PTR(char,
99 acpi_gbl_valid_osi_strings[i])))
100 {
99 /* This string is supported */ 101 /* This string is supported */
100 102
101 return_desc->integer.value = 0xFFFFFFFF; 103 return_desc->integer.value = 0xFFFFFFFF;
@@ -592,7 +594,7 @@ acpi_ut_execute_STA(struct acpi_namespace_node *device_node, u32 * flags)
592 "_STA on %4.4s was not found, assuming device is present\n", 594 "_STA on %4.4s was not found, assuming device is present\n",
593 acpi_ut_get_node_name(device_node))); 595 acpi_ut_get_node_name(device_node)));
594 596
595 *flags = 0x0F; 597 *flags = ACPI_UINT32_MAX;
596 status = AE_OK; 598 status = AE_OK;
597 } 599 }
598 600
@@ -637,17 +639,17 @@ acpi_ut_execute_sxds(struct acpi_namespace_node *device_node, u8 * highest)
637 for (i = 0; i < 4; i++) { 639 for (i = 0; i < 4; i++) {
638 highest[i] = 0xFF; 640 highest[i] = 0xFF;
639 status = acpi_ut_evaluate_object(device_node, 641 status = acpi_ut_evaluate_object(device_node,
640 (char *) 642 ACPI_CAST_PTR(char,
641 acpi_gbl_highest_dstate_names 643 acpi_gbl_highest_dstate_names
642 [i], ACPI_BTYPE_INTEGER, 644 [i]),
643 &obj_desc); 645 ACPI_BTYPE_INTEGER, &obj_desc);
644 if (ACPI_FAILURE(status)) { 646 if (ACPI_FAILURE(status)) {
645 if (status != AE_NOT_FOUND) { 647 if (status != AE_NOT_FOUND) {
646 ACPI_DEBUG_PRINT((ACPI_DB_EXEC, 648 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
647 "%s on Device %4.4s, %s\n", 649 "%s on Device %4.4s, %s\n",
648 (char *) 650 ACPI_CAST_PTR(char,
649 acpi_gbl_highest_dstate_names 651 acpi_gbl_highest_dstate_names
650 [i], 652 [i]),
651 acpi_ut_get_node_name 653 acpi_ut_get_node_name
652 (device_node), 654 (device_node),
653 acpi_format_exception 655 acpi_format_exception
diff --git a/drivers/acpi/utilities/utglobal.c b/drivers/acpi/utilities/utglobal.c
index 6828c7aefa8a..7c59c2b0d953 100644
--- a/drivers/acpi/utilities/utglobal.c
+++ b/drivers/acpi/utilities/utglobal.c
@@ -485,7 +485,7 @@ char *acpi_ut_get_region_name(u8 space_id)
485 return ("invalid_space_id"); 485 return ("invalid_space_id");
486 } 486 }
487 487
488 return ((char *)acpi_gbl_region_types[space_id]); 488 return (ACPI_CAST_PTR(char, acpi_gbl_region_types[space_id]));
489} 489}
490 490
491/******************************************************************************* 491/*******************************************************************************
@@ -690,11 +690,12 @@ char *acpi_ut_get_descriptor_name(void *object)
690 } 690 }
691 691
692 if (ACPI_GET_DESCRIPTOR_TYPE(object) > ACPI_DESC_TYPE_MAX) { 692 if (ACPI_GET_DESCRIPTOR_TYPE(object) > ACPI_DESC_TYPE_MAX) {
693 return ((char *)acpi_gbl_bad_type); 693 return (ACPI_CAST_PTR(char, acpi_gbl_bad_type));
694 } 694 }
695 695
696 return ((char *) 696 return (ACPI_CAST_PTR(char,
697 acpi_gbl_desc_type_names[ACPI_GET_DESCRIPTOR_TYPE(object)]); 697 acpi_gbl_desc_type_names[ACPI_GET_DESCRIPTOR_TYPE
698 (object)]));
698 699
699} 700}
700 701
diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c
index 64dd64b1aa18..48d511d5c04b 100644
--- a/drivers/acpi/utilities/utmisc.c
+++ b/drivers/acpi/utilities/utmisc.c
@@ -179,7 +179,7 @@ void acpi_ut_release_owner_id(acpi_owner_id * owner_id_ptr)
179 179
180 /* Zero is not a valid owner_iD */ 180 /* Zero is not a valid owner_iD */
181 181
182 if ((owner_id == 0) || (owner_id > 255)) { 182 if (owner_id == 0) {
183 ACPI_REPORT_ERROR(("Invalid owner_id: %2.2X\n", owner_id)); 183 ACPI_REPORT_ERROR(("Invalid owner_id: %2.2X\n", owner_id));
184 return_VOID; 184 return_VOID;
185 } 185 }
diff --git a/drivers/acpi/utilities/utresrc.c b/drivers/acpi/utilities/utresrc.c
index 6c0ce7b12194..eaf0edec6efe 100644
--- a/drivers/acpi/utilities/utresrc.c
+++ b/drivers/acpi/utilities/utresrc.c
@@ -47,6 +47,115 @@
47#define _COMPONENT ACPI_UTILITIES 47#define _COMPONENT ACPI_UTILITIES
48ACPI_MODULE_NAME("utmisc") 48ACPI_MODULE_NAME("utmisc")
49 49
50#if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUGGER)
51/*
52 * Strings used to decode resource descriptors.
53 * Used by both the disasssembler and the debugger resource dump routines
54 */
55const char *acpi_gbl_BMdecode[2] = {
56 "not_bus_master",
57 "bus_master"
58};
59
60const char *acpi_gbl_config_decode[4] = {
61 "0 - Good Configuration",
62 "1 - Acceptable Configuration",
63 "2 - Suboptimal Configuration",
64 "3 - ***Invalid Configuration***",
65};
66
67const char *acpi_gbl_consume_decode[2] = {
68 "resource_producer",
69 "resource_consumer"
70};
71
72const char *acpi_gbl_DECdecode[2] = {
73 "pos_decode",
74 "sub_decode"
75};
76
77const char *acpi_gbl_HEdecode[2] = {
78 "Level",
79 "Edge"
80};
81
82const char *acpi_gbl_io_decode[2] = {
83 "Decode10",
84 "Decode16"
85};
86
87const char *acpi_gbl_LLdecode[2] = {
88 "active_high",
89 "active_low"
90};
91
92const char *acpi_gbl_max_decode[2] = {
93 "max_not_fixed",
94 "max_fixed"
95};
96
97const char *acpi_gbl_MEMdecode[4] = {
98 "non_cacheable",
99 "Cacheable",
100 "write_combining",
101 "Prefetchable"
102};
103
104const char *acpi_gbl_min_decode[2] = {
105 "min_not_fixed",
106 "min_fixed"
107};
108
109const char *acpi_gbl_MTPdecode[4] = {
110 "address_range_memory",
111 "address_range_reserved",
112 "address_range_aCPI",
113 "address_range_nVS"
114};
115
116const char *acpi_gbl_RNGdecode[4] = {
117 "invalid_ranges",
118 "non_iSAonly_ranges",
119 "ISAonly_ranges",
120 "entire_range"
121};
122
123const char *acpi_gbl_RWdecode[2] = {
124 "read_only",
125 "read_write"
126};
127
128const char *acpi_gbl_SHRdecode[2] = {
129 "Exclusive",
130 "Shared"
131};
132
133const char *acpi_gbl_SIZdecode[4] = {
134 "Transfer8",
135 "Transfer8_16",
136 "Transfer16",
137 "invalid_size"
138};
139
140const char *acpi_gbl_TRSdecode[2] = {
141 "dense_translation",
142 "sparse_translation"
143};
144
145const char *acpi_gbl_TTPdecode[2] = {
146 "type_static",
147 "type_translation"
148};
149
150const char *acpi_gbl_TYPdecode[4] = {
151 "Compatibility",
152 "type_a",
153 "type_b",
154 "type_f"
155};
156
157#endif
158
50/* 159/*
51 * Base sizes of the raw AML resource descriptors, indexed by resource type. 160 * Base sizes of the raw AML resource descriptors, indexed by resource type.
52 * Zero indicates a reserved (and therefore invalid) resource type. 161 * Zero indicates a reserved (and therefore invalid) resource type.