aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/dispatcher
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/dispatcher')
-rw-r--r--drivers/acpi/dispatcher/dsinit.c26
-rw-r--r--drivers/acpi/dispatcher/dsmethod.c67
-rw-r--r--drivers/acpi/dispatcher/dsmthdat.c15
-rw-r--r--drivers/acpi/dispatcher/dsobject.c3
-rw-r--r--drivers/acpi/dispatcher/dsopcode.c15
-rw-r--r--drivers/acpi/dispatcher/dswload.c63
-rw-r--r--drivers/acpi/dispatcher/dswstate.c40
7 files changed, 115 insertions, 114 deletions
diff --git a/drivers/acpi/dispatcher/dsinit.c b/drivers/acpi/dispatcher/dsinit.c
index d7790db50178..bcd1d472b90f 100644
--- a/drivers/acpi/dispatcher/dsinit.c
+++ b/drivers/acpi/dispatcher/dsinit.c
@@ -86,20 +86,20 @@ acpi_ds_init_one_object (
86 void *context, 86 void *context,
87 void **return_value) 87 void **return_value)
88{ 88{
89 struct acpi_init_walk_info *info = (struct acpi_init_walk_info *) context;
90 struct acpi_namespace_node *node = (struct acpi_namespace_node *) obj_handle;
89 acpi_object_type type; 91 acpi_object_type type;
90 acpi_status status; 92 acpi_status status;
91 struct acpi_init_walk_info *info = (struct acpi_init_walk_info *) context;
92 93
93 94
94 ACPI_FUNCTION_NAME ("ds_init_one_object"); 95 ACPI_FUNCTION_NAME ("ds_init_one_object");
95 96
96 97
97 /* 98 /*
98 * We are only interested in objects owned by the table that 99 * We are only interested in NS nodes owned by the table that
99 * was just loaded 100 * was just loaded
100 */ 101 */
101 if (((struct acpi_namespace_node *) obj_handle)->owner_id != 102 if (node->owner_id != info->table_desc->owner_id) {
102 info->table_desc->table_id) {
103 return (AE_OK); 103 return (AE_OK);
104 } 104 }
105 105
@@ -126,8 +126,6 @@ acpi_ds_init_one_object (
126 126
127 case ACPI_TYPE_METHOD: 127 case ACPI_TYPE_METHOD:
128 128
129 info->method_count++;
130
131 /* 129 /*
132 * Print a dot for each method unless we are going to print 130 * Print a dot for each method unless we are going to print
133 * the entire pathname 131 * the entire pathname
@@ -143,7 +141,7 @@ acpi_ds_init_one_object (
143 * on a per-table basis. Currently, we just use a global for the width. 141 * on a per-table basis. Currently, we just use a global for the width.
144 */ 142 */
145 if (info->table_desc->pointer->revision == 1) { 143 if (info->table_desc->pointer->revision == 1) {
146 ((struct acpi_namespace_node *) obj_handle)->flags |= ANOBJ_DATA_WIDTH_32; 144 node->flags |= ANOBJ_DATA_WIDTH_32;
147 } 145 }
148 146
149 /* 147 /*
@@ -153,22 +151,14 @@ acpi_ds_init_one_object (
153 status = acpi_ds_parse_method (obj_handle); 151 status = acpi_ds_parse_method (obj_handle);
154 if (ACPI_FAILURE (status)) { 152 if (ACPI_FAILURE (status)) {
155 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 153 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
156 "Method %p [%4.4s] - parse failure, %s\n", 154 "\n+Method %p [%4.4s] - parse failure, %s\n",
157 obj_handle, acpi_ut_get_node_name (obj_handle), 155 obj_handle, acpi_ut_get_node_name (obj_handle),
158 acpi_format_exception (status))); 156 acpi_format_exception (status)));
159 157
160 /* This parse failed, but we will continue parsing more methods */ 158 /* This parse failed, but we will continue parsing more methods */
161
162 break;
163 } 159 }
164 160
165 /* 161 info->method_count++;
166 * Delete the parse tree. We simply re-parse the method
167 * for every execution since there isn't much overhead
168 */
169 acpi_ns_delete_namespace_subtree (obj_handle);
170 acpi_ns_delete_namespace_by_owner (
171 ((struct acpi_namespace_node *) obj_handle)->object->method.owning_id);
172 break; 162 break;
173 163
174 164
@@ -237,7 +227,7 @@ acpi_ds_initialize_objects (
237 227
238 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, 228 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
239 "\nTable [%4.4s](id %4.4X) - %hd Objects with %hd Devices %hd Methods %hd Regions\n", 229 "\nTable [%4.4s](id %4.4X) - %hd Objects with %hd Devices %hd Methods %hd Regions\n",
240 table_desc->pointer->signature, table_desc->table_id, info.object_count, 230 table_desc->pointer->signature, table_desc->owner_id, info.object_count,
241 info.device_count, info.method_count, info.op_region_count)); 231 info.device_count, info.method_count, info.op_region_count));
242 232
243 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, 233 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
diff --git a/drivers/acpi/dispatcher/dsmethod.c b/drivers/acpi/dispatcher/dsmethod.c
index 9fc3f4c033eb..e344c06ed33f 100644
--- a/drivers/acpi/dispatcher/dsmethod.c
+++ b/drivers/acpi/dispatcher/dsmethod.c
@@ -58,12 +58,11 @@
58 * 58 *
59 * FUNCTION: acpi_ds_parse_method 59 * FUNCTION: acpi_ds_parse_method
60 * 60 *
61 * PARAMETERS: obj_handle - Method node 61 * PARAMETERS: Node - Method node
62 * 62 *
63 * RETURN: Status 63 * RETURN: Status
64 * 64 *
65 * DESCRIPTION: Call the parser and parse the AML that is associated with the 65 * DESCRIPTION: Parse the AML that is associated with the method.
66 * method.
67 * 66 *
68 * MUTEX: Assumes parser is locked 67 * MUTEX: Assumes parser is locked
69 * 68 *
@@ -71,31 +70,28 @@
71 70
72acpi_status 71acpi_status
73acpi_ds_parse_method ( 72acpi_ds_parse_method (
74 acpi_handle obj_handle) 73 struct acpi_namespace_node *node)
75{ 74{
76 acpi_status status; 75 acpi_status status;
77 union acpi_operand_object *obj_desc; 76 union acpi_operand_object *obj_desc;
78 union acpi_parse_object *op; 77 union acpi_parse_object *op;
79 struct acpi_namespace_node *node;
80 acpi_owner_id owner_id;
81 struct acpi_walk_state *walk_state; 78 struct acpi_walk_state *walk_state;
82 79
83 80
84 ACPI_FUNCTION_TRACE_PTR ("ds_parse_method", obj_handle); 81 ACPI_FUNCTION_TRACE_PTR ("ds_parse_method", node);
85 82
86 83
87 /* Parameter Validation */ 84 /* Parameter Validation */
88 85
89 if (!obj_handle) { 86 if (!node) {
90 return_ACPI_STATUS (AE_NULL_ENTRY); 87 return_ACPI_STATUS (AE_NULL_ENTRY);
91 } 88 }
92 89
93 ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Parsing [%4.4s] **** named_obj=%p\n", 90 ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Parsing [%4.4s] **** named_obj=%p\n",
94 acpi_ut_get_node_name (obj_handle), obj_handle)); 91 acpi_ut_get_node_name (node), node));
95 92
96 /* Extract the method object from the method Node */ 93 /* Extract the method object from the method Node */
97 94
98 node = (struct acpi_namespace_node *) obj_handle;
99 obj_desc = acpi_ns_get_attached_object (node); 95 obj_desc = acpi_ns_get_attached_object (node);
100 if (!obj_desc) { 96 if (!obj_desc) {
101 return_ACPI_STATUS (AE_NULL_OBJECT); 97 return_ACPI_STATUS (AE_NULL_OBJECT);
@@ -132,14 +128,18 @@ acpi_ds_parse_method (
132 * objects (such as Operation Regions) can be created during the 128 * objects (such as Operation Regions) can be created during the
133 * first pass parse. 129 * first pass parse.
134 */ 130 */
135 owner_id = acpi_ut_allocate_owner_id (ACPI_OWNER_TYPE_METHOD); 131 status = acpi_ut_allocate_owner_id (&obj_desc->method.owner_id);
136 obj_desc->method.owning_id = owner_id; 132 if (ACPI_FAILURE (status)) {
133 goto cleanup;
134 }
137 135
138 /* Create and initialize a new walk state */ 136 /* Create and initialize a new walk state */
139 137
140 walk_state = acpi_ds_create_walk_state (owner_id, NULL, NULL, NULL); 138 walk_state = acpi_ds_create_walk_state (
139 obj_desc->method.owner_id, NULL, NULL, NULL);
141 if (!walk_state) { 140 if (!walk_state) {
142 return_ACPI_STATUS (AE_NO_MEMORY); 141 status = AE_NO_MEMORY;
142 goto cleanup2;
143 } 143 }
144 144
145 status = acpi_ds_init_aml_walk (walk_state, op, node, 145 status = acpi_ds_init_aml_walk (walk_state, op, node,
@@ -147,7 +147,7 @@ acpi_ds_parse_method (
147 obj_desc->method.aml_length, NULL, 1); 147 obj_desc->method.aml_length, NULL, 1);
148 if (ACPI_FAILURE (status)) { 148 if (ACPI_FAILURE (status)) {
149 acpi_ds_delete_walk_state (walk_state); 149 acpi_ds_delete_walk_state (walk_state);
150 return_ACPI_STATUS (status); 150 goto cleanup2;
151 } 151 }
152 152
153 /* 153 /*
@@ -161,13 +161,25 @@ acpi_ds_parse_method (
161 */ 161 */
162 status = acpi_ps_parse_aml (walk_state); 162 status = acpi_ps_parse_aml (walk_state);
163 if (ACPI_FAILURE (status)) { 163 if (ACPI_FAILURE (status)) {
164 return_ACPI_STATUS (status); 164 goto cleanup2;
165 } 165 }
166 166
167 ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, 167 ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
168 "**** [%4.4s] Parsed **** named_obj=%p Op=%p\n", 168 "**** [%4.4s] Parsed **** named_obj=%p Op=%p\n",
169 acpi_ut_get_node_name (obj_handle), obj_handle, op)); 169 acpi_ut_get_node_name (node), node, op));
170
171 /*
172 * Delete the parse tree. We simply re-parse the method for every
173 * execution since there isn't much overhead (compared to keeping lots
174 * of parse trees around)
175 */
176 acpi_ns_delete_namespace_subtree (node);
177 acpi_ns_delete_namespace_by_owner (obj_desc->method.owner_id);
178
179cleanup2:
180 acpi_ut_release_owner_id (&obj_desc->method.owner_id);
170 181
182cleanup:
171 acpi_ps_delete_parse_tree (op); 183 acpi_ps_delete_parse_tree (op);
172 return_ACPI_STATUS (status); 184 return_ACPI_STATUS (status);
173} 185}
@@ -263,7 +275,7 @@ acpi_ds_call_control_method (
263{ 275{
264 acpi_status status; 276 acpi_status status;
265 struct acpi_namespace_node *method_node; 277 struct acpi_namespace_node *method_node;
266 struct acpi_walk_state *next_walk_state; 278 struct acpi_walk_state *next_walk_state = NULL;
267 union acpi_operand_object *obj_desc; 279 union acpi_operand_object *obj_desc;
268 struct acpi_parameter_info info; 280 struct acpi_parameter_info info;
269 u32 i; 281 u32 i;
@@ -287,20 +299,23 @@ acpi_ds_call_control_method (
287 return_ACPI_STATUS (AE_NULL_OBJECT); 299 return_ACPI_STATUS (AE_NULL_OBJECT);
288 } 300 }
289 301
290 obj_desc->method.owning_id = acpi_ut_allocate_owner_id (ACPI_OWNER_TYPE_METHOD); 302 status = acpi_ut_allocate_owner_id (&obj_desc->method.owner_id);
303 if (ACPI_FAILURE (status)) {
304 return_ACPI_STATUS (status);
305 }
291 306
292 /* Init for new method, wait on concurrency semaphore */ 307 /* Init for new method, wait on concurrency semaphore */
293 308
294 status = acpi_ds_begin_method_execution (method_node, obj_desc, 309 status = acpi_ds_begin_method_execution (method_node, obj_desc,
295 this_walk_state->method_node); 310 this_walk_state->method_node);
296 if (ACPI_FAILURE (status)) { 311 if (ACPI_FAILURE (status)) {
297 return_ACPI_STATUS (status); 312 goto cleanup;
298 } 313 }
299 314
300 if (!(obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY)) { 315 if (!(obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY)) {
301 /* 1) Parse: Create a new walk state for the preempting walk */ 316 /* 1) Parse: Create a new walk state for the preempting walk */
302 317
303 next_walk_state = acpi_ds_create_walk_state (obj_desc->method.owning_id, 318 next_walk_state = acpi_ds_create_walk_state (obj_desc->method.owner_id,
304 op, obj_desc, NULL); 319 op, obj_desc, NULL);
305 if (!next_walk_state) { 320 if (!next_walk_state) {
306 return_ACPI_STATUS (AE_NO_MEMORY); 321 return_ACPI_STATUS (AE_NO_MEMORY);
@@ -330,7 +345,7 @@ acpi_ds_call_control_method (
330 345
331 /* 2) Execute: Create a new state for the preempting walk */ 346 /* 2) Execute: Create a new state for the preempting walk */
332 347
333 next_walk_state = acpi_ds_create_walk_state (obj_desc->method.owning_id, 348 next_walk_state = acpi_ds_create_walk_state (obj_desc->method.owner_id,
334 NULL, obj_desc, thread); 349 NULL, obj_desc, thread);
335 if (!next_walk_state) { 350 if (!next_walk_state) {
336 status = AE_NO_MEMORY; 351 status = AE_NO_MEMORY;
@@ -381,6 +396,7 @@ acpi_ds_call_control_method (
381 /* On error, we must delete the new walk state */ 396 /* On error, we must delete the new walk state */
382 397
383cleanup: 398cleanup:
399 acpi_ut_release_owner_id (&obj_desc->method.owner_id);
384 if (next_walk_state && (next_walk_state->method_desc)) { 400 if (next_walk_state && (next_walk_state->method_desc)) {
385 /* Decrement the thread count on the method parse tree */ 401 /* Decrement the thread count on the method parse tree */
386 402
@@ -552,8 +568,7 @@ acpi_ds_terminate_control_method (
552 */ 568 */
553 if ((walk_state->method_desc->method.concurrency == 1) && 569 if ((walk_state->method_desc->method.concurrency == 1) &&
554 (!walk_state->method_desc->method.semaphore)) { 570 (!walk_state->method_desc->method.semaphore)) {
555 status = acpi_os_create_semaphore (1, 571 status = acpi_os_create_semaphore (1, 1,
556 1,
557 &walk_state->method_desc->method.semaphore); 572 &walk_state->method_desc->method.semaphore);
558 } 573 }
559 574
@@ -582,8 +597,10 @@ acpi_ds_terminate_control_method (
582 * Delete any namespace entries created anywhere else within 597 * Delete any namespace entries created anywhere else within
583 * the namespace 598 * the namespace
584 */ 599 */
585 acpi_ns_delete_namespace_by_owner (walk_state->method_desc->method.owning_id); 600 acpi_ns_delete_namespace_by_owner (walk_state->method_desc->method.owner_id);
586 status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); 601 status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
602 acpi_ut_release_owner_id (&walk_state->method_desc->method.owner_id);
603
587 if (ACPI_FAILURE (status)) { 604 if (ACPI_FAILURE (status)) {
588 return_ACPI_STATUS (status); 605 return_ACPI_STATUS (status);
589 } 606 }
diff --git a/drivers/acpi/dispatcher/dsmthdat.c b/drivers/acpi/dispatcher/dsmthdat.c
index f7998306f756..c83d53fd6398 100644
--- a/drivers/acpi/dispatcher/dsmthdat.c
+++ b/drivers/acpi/dispatcher/dsmthdat.c
@@ -633,22 +633,11 @@ acpi_ds_store_object_to_local (
633 */ 633 */
634 if (opcode == AML_ARG_OP) { 634 if (opcode == AML_ARG_OP) {
635 /* 635 /*
636 * Make sure that the object is the correct type. This may be
637 * overkill, butit is here because references were NS nodes in
638 * the past. Now they are operand objects of type Reference.
639 */
640 if (ACPI_GET_DESCRIPTOR_TYPE (current_obj_desc) != ACPI_DESC_TYPE_OPERAND) {
641 ACPI_REPORT_ERROR ((
642 "Invalid descriptor type while storing to method arg: [%s]\n",
643 acpi_ut_get_descriptor_name (current_obj_desc)));
644 return_ACPI_STATUS (AE_AML_INTERNAL);
645 }
646
647 /*
648 * If we have a valid reference object that came from ref_of(), 636 * If we have a valid reference object that came from ref_of(),
649 * do the indirect store 637 * do the indirect store
650 */ 638 */
651 if ((current_obj_desc->common.type == ACPI_TYPE_LOCAL_REFERENCE) && 639 if ((ACPI_GET_DESCRIPTOR_TYPE (current_obj_desc) == ACPI_DESC_TYPE_OPERAND) &&
640 (current_obj_desc->common.type == ACPI_TYPE_LOCAL_REFERENCE) &&
652 (current_obj_desc->reference.opcode == AML_REF_OF_OP)) { 641 (current_obj_desc->reference.opcode == AML_REF_OF_OP)) {
653 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, 642 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
654 "Arg (%p) is an obj_ref(Node), storing in node %p\n", 643 "Arg (%p) is an obj_ref(Node), storing in node %p\n",
diff --git a/drivers/acpi/dispatcher/dsobject.c b/drivers/acpi/dispatcher/dsobject.c
index bfbae4e4c667..1eee2d54180f 100644
--- a/drivers/acpi/dispatcher/dsobject.c
+++ b/drivers/acpi/dispatcher/dsobject.c
@@ -547,6 +547,9 @@ acpi_ds_init_object_from_op (
547 case AML_TYPE_LITERAL: 547 case AML_TYPE_LITERAL:
548 548
549 obj_desc->integer.value = op->common.value.integer; 549 obj_desc->integer.value = op->common.value.integer;
550#ifndef ACPI_NO_METHOD_EXECUTION
551 acpi_ex_truncate_for32bit_table (obj_desc);
552#endif
550 break; 553 break;
551 554
552 555
diff --git a/drivers/acpi/dispatcher/dsopcode.c b/drivers/acpi/dispatcher/dsopcode.c
index ba13bca28bee..750bdb1ac344 100644
--- a/drivers/acpi/dispatcher/dsopcode.c
+++ b/drivers/acpi/dispatcher/dsopcode.c
@@ -119,14 +119,15 @@ acpi_ds_execute_arguments (
119 119
120 walk_state = acpi_ds_create_walk_state (0, NULL, NULL, NULL); 120 walk_state = acpi_ds_create_walk_state (0, NULL, NULL, NULL);
121 if (!walk_state) { 121 if (!walk_state) {
122 return_ACPI_STATUS (AE_NO_MEMORY); 122 status = AE_NO_MEMORY;
123 goto cleanup;
123 } 124 }
124 125
125 status = acpi_ds_init_aml_walk (walk_state, op, NULL, aml_start, 126 status = acpi_ds_init_aml_walk (walk_state, op, NULL, aml_start,
126 aml_length, NULL, 1); 127 aml_length, NULL, 1);
127 if (ACPI_FAILURE (status)) { 128 if (ACPI_FAILURE (status)) {
128 acpi_ds_delete_walk_state (walk_state); 129 acpi_ds_delete_walk_state (walk_state);
129 return_ACPI_STATUS (status); 130 goto cleanup;
130 } 131 }
131 132
132 /* Mark this parse as a deferred opcode */ 133 /* Mark this parse as a deferred opcode */
@@ -138,8 +139,7 @@ acpi_ds_execute_arguments (
138 139
139 status = acpi_ps_parse_aml (walk_state); 140 status = acpi_ps_parse_aml (walk_state);
140 if (ACPI_FAILURE (status)) { 141 if (ACPI_FAILURE (status)) {
141 acpi_ps_delete_parse_tree (op); 142 goto cleanup;
142 return_ACPI_STATUS (status);
143 } 143 }
144 144
145 /* Get and init the Op created above */ 145 /* Get and init the Op created above */
@@ -160,7 +160,8 @@ acpi_ds_execute_arguments (
160 160
161 walk_state = acpi_ds_create_walk_state (0, NULL, NULL, NULL); 161 walk_state = acpi_ds_create_walk_state (0, NULL, NULL, NULL);
162 if (!walk_state) { 162 if (!walk_state) {
163 return_ACPI_STATUS (AE_NO_MEMORY); 163 status = AE_NO_MEMORY;
164 goto cleanup;
164 } 165 }
165 166
166 /* Execute the opcode and arguments */ 167 /* Execute the opcode and arguments */
@@ -169,13 +170,15 @@ acpi_ds_execute_arguments (
169 aml_length, NULL, 3); 170 aml_length, NULL, 3);
170 if (ACPI_FAILURE (status)) { 171 if (ACPI_FAILURE (status)) {
171 acpi_ds_delete_walk_state (walk_state); 172 acpi_ds_delete_walk_state (walk_state);
172 return_ACPI_STATUS (status); 173 goto cleanup;
173 } 174 }
174 175
175 /* Mark this execution as a deferred opcode */ 176 /* Mark this execution as a deferred opcode */
176 177
177 walk_state->deferred_node = node; 178 walk_state->deferred_node = node;
178 status = acpi_ps_parse_aml (walk_state); 179 status = acpi_ps_parse_aml (walk_state);
180
181cleanup:
179 acpi_ps_delete_parse_tree (op); 182 acpi_ps_delete_parse_tree (op);
180 return_ACPI_STATUS (status); 183 return_ACPI_STATUS (status);
181} 184}
diff --git a/drivers/acpi/dispatcher/dswload.c b/drivers/acpi/dispatcher/dswload.c
index d11620018421..9100c0bda470 100644
--- a/drivers/acpi/dispatcher/dswload.c
+++ b/drivers/acpi/dispatcher/dswload.c
@@ -50,7 +50,7 @@
50#include <acpi/acnamesp.h> 50#include <acpi/acnamesp.h>
51#include <acpi/acevents.h> 51#include <acpi/acevents.h>
52 52
53#ifdef _ACPI_ASL_COMPILER 53#ifdef ACPI_ASL_COMPILER
54#include <acpi/acdisasm.h> 54#include <acpi/acdisasm.h>
55#endif 55#endif
56 56
@@ -145,15 +145,6 @@ acpi_ds_load1_begin_op (
145 145
146 if (op) { 146 if (op) {
147 if (!(walk_state->op_info->flags & AML_NAMED)) { 147 if (!(walk_state->op_info->flags & AML_NAMED)) {
148#if 0
149 if ((walk_state->op_info->class == AML_CLASS_EXECUTE) ||
150 (walk_state->op_info->class == AML_CLASS_CONTROL)) {
151 acpi_os_printf ("\n\n***EXECUTABLE OPCODE %s***\n\n",
152 walk_state->op_info->name);
153 *out_op = op;
154 return (AE_CTRL_SKIP);
155 }
156#endif
157 *out_op = op; 148 *out_op = op;
158 return (AE_OK); 149 return (AE_OK);
159 } 150 }
@@ -185,7 +176,7 @@ acpi_ds_load1_begin_op (
185 */ 176 */
186 status = acpi_ns_lookup (walk_state->scope_info, path, object_type, 177 status = acpi_ns_lookup (walk_state->scope_info, path, object_type,
187 ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, walk_state, &(node)); 178 ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, walk_state, &(node));
188#ifdef _ACPI_ASL_COMPILER 179#ifdef ACPI_ASL_COMPILER
189 if (status == AE_NOT_FOUND) { 180 if (status == AE_NOT_FOUND) {
190 /* 181 /*
191 * Table disassembly: 182 * Table disassembly:
@@ -486,11 +477,31 @@ acpi_ds_load2_begin_op (
486 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, walk_state)); 477 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, walk_state));
487 478
488 if (op) { 479 if (op) {
480 if ((walk_state->control_state) &&
481 (walk_state->control_state->common.state ==
482 ACPI_CONTROL_CONDITIONAL_EXECUTING)) {
483 /* We are executing a while loop outside of a method */
484
485 status = acpi_ds_exec_begin_op (walk_state, out_op);
486 return_ACPI_STATUS (status);
487 }
488
489 /* We only care about Namespace opcodes here */ 489 /* We only care about Namespace opcodes here */
490 490
491 if ((!(walk_state->op_info->flags & AML_NSOPCODE) && 491 if ((!(walk_state->op_info->flags & AML_NSOPCODE) &&
492 (walk_state->opcode != AML_INT_NAMEPATH_OP)) || 492 (walk_state->opcode != AML_INT_NAMEPATH_OP)) ||
493 (!(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_DEBUG_PRINT ((ACPI_DB_DISPATCH,
497 "Begin/EXEC: %s (fl %8.8X)\n", walk_state->op_info->name,
498 walk_state->op_info->flags));
499
500 /* Executing a type1 or type2 opcode outside of a method */
501
502 status = acpi_ds_exec_begin_op (walk_state, out_op);
503 return_ACPI_STATUS (status);
504 }
494 return_ACPI_STATUS (AE_OK); 505 return_ACPI_STATUS (AE_OK);
495 } 506 }
496 507
@@ -558,7 +569,7 @@ acpi_ds_load2_begin_op (
558 ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, 569 ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
559 walk_state, &(node)); 570 walk_state, &(node));
560 if (ACPI_FAILURE (status)) { 571 if (ACPI_FAILURE (status)) {
561#ifdef _ACPI_ASL_COMPILER 572#ifdef ACPI_ASL_COMPILER
562 if (status == AE_NOT_FOUND) { 573 if (status == AE_NOT_FOUND) {
563 status = AE_OK; 574 status = AE_OK;
564 } 575 }
@@ -651,8 +662,10 @@ acpi_ds_load2_begin_op (
651 break; 662 break;
652 } 663 }
653 664
665 /* Add new entry into namespace */
666
654 status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, object_type, 667 status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, object_type,
655 ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, 668 ACPI_IMODE_LOAD_PASS2, ACPI_NS_NO_UPSEARCH,
656 walk_state, &(node)); 669 walk_state, &(node));
657 break; 670 break;
658 } 671 }
@@ -662,7 +675,6 @@ acpi_ds_load2_begin_op (
662 return_ACPI_STATUS (status); 675 return_ACPI_STATUS (status);
663 } 676 }
664 677
665
666 if (!op) { 678 if (!op) {
667 /* Create a new op */ 679 /* Create a new op */
668 680
@@ -676,9 +688,7 @@ acpi_ds_load2_begin_op (
676 if (node) { 688 if (node) {
677 op->named.name = node->name.integer; 689 op->named.name = node->name.integer;
678 } 690 }
679 if (out_op) { 691 *out_op = op;
680 *out_op = op;
681 }
682 } 692 }
683 693
684 /* 694 /*
@@ -725,9 +735,24 @@ acpi_ds_load2_end_op (
725 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Opcode [%s] Op %p State %p\n", 735 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Opcode [%s] Op %p State %p\n",
726 walk_state->op_info->name, op, walk_state)); 736 walk_state->op_info->name, op, walk_state));
727 737
728 /* Only interested in opcodes that have namespace objects */ 738 /* Check if opcode had an associated namespace object */
729 739
730 if (!(walk_state->op_info->flags & AML_NSOBJECT)) { 740 if (!(walk_state->op_info->flags & AML_NSOBJECT)) {
741#ifndef ACPI_NO_METHOD_EXECUTION
742 /* No namespace object. Executable opcode? */
743
744 if ((walk_state->op_info->class == AML_CLASS_EXECUTE) ||
745 (walk_state->op_info->class == AML_CLASS_CONTROL)) {
746 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
747 "End/EXEC: %s (fl %8.8X)\n", walk_state->op_info->name,
748 walk_state->op_info->flags));
749
750 /* Executing a type1 or type2 opcode outside of a method */
751
752 status = acpi_ds_exec_end_op (walk_state);
753 return_ACPI_STATUS (status);
754 }
755#endif
731 return_ACPI_STATUS (AE_OK); 756 return_ACPI_STATUS (AE_OK);
732 } 757 }
733 758
@@ -736,7 +761,6 @@ acpi_ds_load2_end_op (
736 "Ending scope Op=%p State=%p\n", op, walk_state)); 761 "Ending scope Op=%p State=%p\n", op, walk_state));
737 } 762 }
738 763
739
740 object_type = walk_state->op_info->object_type; 764 object_type = walk_state->op_info->object_type;
741 765
742 /* 766 /*
@@ -959,6 +983,7 @@ acpi_ds_load2_end_op (
959 ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, 983 ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
960 walk_state, &(new_node)); 984 walk_state, &(new_node));
961 if (ACPI_SUCCESS (status)) { 985 if (ACPI_SUCCESS (status)) {
986
962 /* 987 /*
963 * Make sure that what we found is indeed a method 988 * Make sure that what we found is indeed a method
964 * We didn't search for a method on purpose, to see if the name 989 * We didn't search for a method on purpose, to see if the name
diff --git a/drivers/acpi/dispatcher/dswstate.c b/drivers/acpi/dispatcher/dswstate.c
index 9cd3db652b31..5621665991b5 100644
--- a/drivers/acpi/dispatcher/dswstate.c
+++ b/drivers/acpi/dispatcher/dswstate.c
@@ -261,12 +261,12 @@ acpi_ds_result_pop_from_bottom (
261 261
262 if (!*object) { 262 if (!*object) {
263 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 263 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
264 "Null operand! State=%p #Ops=%X, Index=%X\n", 264 "Null operand! State=%p #Ops=%X Index=%X\n",
265 walk_state, state->results.num_results, (u32) index)); 265 walk_state, state->results.num_results, (u32) index));
266 return (AE_AML_NO_RETURN_VALUE); 266 return (AE_AML_NO_RETURN_VALUE);
267 } 267 }
268 268
269 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s], Results=%p State=%p\n", 269 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] Results=%p State=%p\n",
270 *object, (*object) ? acpi_ut_get_object_type_name (*object) : "NULL", 270 *object, (*object) ? acpi_ut_get_object_type_name (*object) : "NULL",
271 state, walk_state)); 271 state, walk_state));
272 272
@@ -681,7 +681,7 @@ acpi_ds_create_walk_state (
681 ACPI_FUNCTION_TRACE ("ds_create_walk_state"); 681 ACPI_FUNCTION_TRACE ("ds_create_walk_state");
682 682
683 683
684 walk_state = acpi_ut_acquire_from_cache (ACPI_MEM_LIST_WALK); 684 walk_state = ACPI_MEM_CALLOCATE (sizeof (struct acpi_walk_state));
685 if (!walk_state) { 685 if (!walk_state) {
686 return_PTR (NULL); 686 return_PTR (NULL);
687 } 687 }
@@ -704,7 +704,7 @@ acpi_ds_create_walk_state (
704 704
705 status = acpi_ds_result_stack_push (walk_state); 705 status = acpi_ds_result_stack_push (walk_state);
706 if (ACPI_FAILURE (status)) { 706 if (ACPI_FAILURE (status)) {
707 acpi_ut_release_to_cache (ACPI_MEM_LIST_WALK, walk_state); 707 ACPI_MEM_FREE (walk_state);
708 return_PTR (NULL); 708 return_PTR (NULL);
709 } 709 }
710 710
@@ -744,7 +744,7 @@ acpi_ds_init_aml_walk (
744 u8 *aml_start, 744 u8 *aml_start,
745 u32 aml_length, 745 u32 aml_length,
746 struct acpi_parameter_info *info, 746 struct acpi_parameter_info *info,
747 u32 pass_number) 747 u8 pass_number)
748{ 748{
749 acpi_status status; 749 acpi_status status;
750 struct acpi_parse_state *parser_state = &walk_state->parser_state; 750 struct acpi_parse_state *parser_state = &walk_state->parser_state;
@@ -762,6 +762,7 @@ acpi_ds_init_aml_walk (
762 /* The next_op of the next_walk will be the beginning of the method */ 762 /* The next_op of the next_walk will be the beginning of the method */
763 763
764 walk_state->next_op = NULL; 764 walk_state->next_op = NULL;
765 walk_state->pass_number = pass_number;
765 766
766 if (info) { 767 if (info) {
767 if (info->parameter_type == ACPI_PARAM_GPE) { 768 if (info->parameter_type == ACPI_PARAM_GPE) {
@@ -899,38 +900,11 @@ acpi_ds_delete_walk_state (
899 acpi_ut_delete_generic_state (state); 900 acpi_ut_delete_generic_state (state);
900 } 901 }
901 902
902 acpi_ut_release_to_cache (ACPI_MEM_LIST_WALK, walk_state); 903 ACPI_MEM_FREE (walk_state);
903 return_VOID; 904 return_VOID;
904} 905}
905 906
906 907
907#ifdef ACPI_ENABLE_OBJECT_CACHE
908/******************************************************************************
909 *
910 * FUNCTION: acpi_ds_delete_walk_state_cache
911 *
912 * PARAMETERS: None
913 *
914 * RETURN: None
915 *
916 * DESCRIPTION: Purge the global state object cache. Used during subsystem
917 * termination.
918 *
919 ******************************************************************************/
920
921void
922acpi_ds_delete_walk_state_cache (
923 void)
924{
925 ACPI_FUNCTION_TRACE ("ds_delete_walk_state_cache");
926
927
928 acpi_ut_delete_generic_cache (ACPI_MEM_LIST_WALK);
929 return_VOID;
930}
931#endif
932
933
934#ifdef ACPI_OBSOLETE_FUNCTIONS 908#ifdef ACPI_OBSOLETE_FUNCTIONS
935/******************************************************************************* 909/*******************************************************************************
936 * 910 *