diff options
Diffstat (limited to 'drivers/acpi/dispatcher/dsmethod.c')
-rw-r--r-- | drivers/acpi/dispatcher/dsmethod.c | 232 |
1 files changed, 142 insertions, 90 deletions
diff --git a/drivers/acpi/dispatcher/dsmethod.c b/drivers/acpi/dispatcher/dsmethod.c index c475546535b6..bc9aca4e7401 100644 --- a/drivers/acpi/dispatcher/dsmethod.c +++ b/drivers/acpi/dispatcher/dsmethod.c | |||
@@ -81,6 +81,7 @@ acpi_ds_method_error(acpi_status status, struct acpi_walk_state *walk_state) | |||
81 | /* Invoke the global exception handler */ | 81 | /* Invoke the global exception handler */ |
82 | 82 | ||
83 | if (acpi_gbl_exception_handler) { | 83 | if (acpi_gbl_exception_handler) { |
84 | |||
84 | /* Exit the interpreter, allow handler to execute methods */ | 85 | /* Exit the interpreter, allow handler to execute methods */ |
85 | 86 | ||
86 | acpi_ex_exit_interpreter(); | 87 | acpi_ex_exit_interpreter(); |
@@ -100,6 +101,7 @@ acpi_ds_method_error(acpi_status status, struct acpi_walk_state *walk_state) | |||
100 | } | 101 | } |
101 | #ifdef ACPI_DISASSEMBLER | 102 | #ifdef ACPI_DISASSEMBLER |
102 | if (ACPI_FAILURE(status)) { | 103 | if (ACPI_FAILURE(status)) { |
104 | |||
103 | /* Display method locals/args if disassembler is present */ | 105 | /* Display method locals/args if disassembler is present */ |
104 | 106 | ||
105 | acpi_dm_dump_method_info(status, walk_state, walk_state->op); | 107 | acpi_dm_dump_method_info(status, walk_state, walk_state->op); |
@@ -132,7 +134,7 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node * method_node, | |||
132 | { | 134 | { |
133 | acpi_status status = AE_OK; | 135 | acpi_status status = AE_OK; |
134 | 136 | ||
135 | ACPI_FUNCTION_TRACE_PTR("ds_begin_method_execution", method_node); | 137 | ACPI_FUNCTION_TRACE_PTR(ds_begin_method_execution, method_node); |
136 | 138 | ||
137 | if (!method_node) { | 139 | if (!method_node) { |
138 | return_ACPI_STATUS(AE_NULL_ENTRY); | 140 | return_ACPI_STATUS(AE_NULL_ENTRY); |
@@ -168,11 +170,14 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node * method_node, | |||
168 | 170 | ||
169 | /* | 171 | /* |
170 | * Get a unit from the method semaphore. This releases the | 172 | * Get a unit from the method semaphore. This releases the |
171 | * interpreter if we block | 173 | * interpreter if we block (then reacquires it) |
172 | */ | 174 | */ |
173 | status = | 175 | status = |
174 | acpi_ex_system_wait_semaphore(obj_desc->method.semaphore, | 176 | acpi_ex_system_wait_semaphore(obj_desc->method.semaphore, |
175 | ACPI_WAIT_FOREVER); | 177 | ACPI_WAIT_FOREVER); |
178 | if (ACPI_FAILURE(status)) { | ||
179 | return_ACPI_STATUS(status); | ||
180 | } | ||
176 | } | 181 | } |
177 | 182 | ||
178 | /* | 183 | /* |
@@ -183,7 +188,7 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node * method_node, | |||
183 | if (!obj_desc->method.owner_id) { | 188 | if (!obj_desc->method.owner_id) { |
184 | status = acpi_ut_allocate_owner_id(&obj_desc->method.owner_id); | 189 | status = acpi_ut_allocate_owner_id(&obj_desc->method.owner_id); |
185 | if (ACPI_FAILURE(status)) { | 190 | if (ACPI_FAILURE(status)) { |
186 | return_ACPI_STATUS(status); | 191 | goto cleanup; |
187 | } | 192 | } |
188 | } | 193 | } |
189 | 194 | ||
@@ -193,6 +198,14 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node * method_node, | |||
193 | */ | 198 | */ |
194 | obj_desc->method.thread_count++; | 199 | obj_desc->method.thread_count++; |
195 | return_ACPI_STATUS(status); | 200 | return_ACPI_STATUS(status); |
201 | |||
202 | cleanup: | ||
203 | /* On error, must signal the method semaphore if present */ | ||
204 | |||
205 | if (obj_desc->method.semaphore) { | ||
206 | (void)acpi_os_signal_semaphore(obj_desc->method.semaphore, 1); | ||
207 | } | ||
208 | return_ACPI_STATUS(status); | ||
196 | } | 209 | } |
197 | 210 | ||
198 | /******************************************************************************* | 211 | /******************************************************************************* |
@@ -218,10 +231,10 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread, | |||
218 | struct acpi_namespace_node *method_node; | 231 | struct acpi_namespace_node *method_node; |
219 | struct acpi_walk_state *next_walk_state = NULL; | 232 | struct acpi_walk_state *next_walk_state = NULL; |
220 | union acpi_operand_object *obj_desc; | 233 | union acpi_operand_object *obj_desc; |
221 | struct acpi_parameter_info info; | 234 | struct acpi_evaluate_info *info; |
222 | u32 i; | 235 | u32 i; |
223 | 236 | ||
224 | ACPI_FUNCTION_TRACE_PTR("ds_call_control_method", this_walk_state); | 237 | ACPI_FUNCTION_TRACE_PTR(ds_call_control_method, this_walk_state); |
225 | 238 | ||
226 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 239 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
227 | "Execute method %p, currentstate=%p\n", | 240 | "Execute method %p, currentstate=%p\n", |
@@ -240,25 +253,31 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread, | |||
240 | return_ACPI_STATUS(AE_NULL_OBJECT); | 253 | return_ACPI_STATUS(AE_NULL_OBJECT); |
241 | } | 254 | } |
242 | 255 | ||
243 | /* Init for new method, wait on concurrency semaphore */ | 256 | /* Init for new method, possibly wait on concurrency semaphore */ |
244 | 257 | ||
245 | status = acpi_ds_begin_method_execution(method_node, obj_desc, | 258 | status = acpi_ds_begin_method_execution(method_node, obj_desc, |
246 | this_walk_state->method_node); | 259 | this_walk_state->method_node); |
247 | if (ACPI_FAILURE(status)) { | 260 | if (ACPI_FAILURE(status)) { |
248 | goto cleanup; | 261 | return_ACPI_STATUS(status); |
249 | } | 262 | } |
250 | 263 | ||
264 | /* | ||
265 | * 1) Parse the method. All "normal" methods are parsed for each execution. | ||
266 | * Internal methods (_OSI, etc.) do not require parsing. | ||
267 | */ | ||
251 | if (!(obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY)) { | 268 | if (!(obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY)) { |
252 | /* 1) Parse: Create a new walk state for the preempting walk */ | 269 | |
270 | /* Create a new walk state for the parse */ | ||
253 | 271 | ||
254 | next_walk_state = | 272 | next_walk_state = |
255 | acpi_ds_create_walk_state(obj_desc->method.owner_id, op, | 273 | acpi_ds_create_walk_state(obj_desc->method.owner_id, op, |
256 | obj_desc, NULL); | 274 | obj_desc, NULL); |
257 | if (!next_walk_state) { | 275 | if (!next_walk_state) { |
258 | return_ACPI_STATUS(AE_NO_MEMORY); | 276 | status = AE_NO_MEMORY; |
277 | goto cleanup; | ||
259 | } | 278 | } |
260 | 279 | ||
261 | /* Create and init a Root Node */ | 280 | /* Create and init a parse tree root */ |
262 | 281 | ||
263 | op = acpi_ps_create_scope_op(); | 282 | op = acpi_ps_create_scope_op(); |
264 | if (!op) { | 283 | if (!op) { |
@@ -271,17 +290,20 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread, | |||
271 | obj_desc->method.aml_length, | 290 | obj_desc->method.aml_length, |
272 | NULL, 1); | 291 | NULL, 1); |
273 | if (ACPI_FAILURE(status)) { | 292 | if (ACPI_FAILURE(status)) { |
274 | acpi_ds_delete_walk_state(next_walk_state); | 293 | acpi_ps_delete_parse_tree(op); |
275 | goto cleanup; | 294 | goto cleanup; |
276 | } | 295 | } |
277 | 296 | ||
278 | /* Begin AML parse */ | 297 | /* Begin AML parse (deletes next_walk_state) */ |
279 | 298 | ||
280 | status = acpi_ps_parse_aml(next_walk_state); | 299 | status = acpi_ps_parse_aml(next_walk_state); |
281 | acpi_ps_delete_parse_tree(op); | 300 | acpi_ps_delete_parse_tree(op); |
301 | if (ACPI_FAILURE(status)) { | ||
302 | goto cleanup; | ||
303 | } | ||
282 | } | 304 | } |
283 | 305 | ||
284 | /* 2) Execute: Create a new state for the preempting walk */ | 306 | /* 2) Begin method execution. Create a new walk state */ |
285 | 307 | ||
286 | next_walk_state = acpi_ds_create_walk_state(obj_desc->method.owner_id, | 308 | next_walk_state = acpi_ds_create_walk_state(obj_desc->method.owner_id, |
287 | NULL, obj_desc, thread); | 309 | NULL, obj_desc, thread); |
@@ -289,6 +311,7 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread, | |||
289 | status = AE_NO_MEMORY; | 311 | status = AE_NO_MEMORY; |
290 | goto cleanup; | 312 | goto cleanup; |
291 | } | 313 | } |
314 | |||
292 | /* | 315 | /* |
293 | * The resolved arguments were put on the previous walk state's operand | 316 | * The resolved arguments were put on the previous walk state's operand |
294 | * stack. Operands on the previous walk state stack always | 317 | * stack. Operands on the previous walk state stack always |
@@ -296,12 +319,24 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread, | |||
296 | */ | 319 | */ |
297 | this_walk_state->operands[this_walk_state->num_operands] = NULL; | 320 | this_walk_state->operands[this_walk_state->num_operands] = NULL; |
298 | 321 | ||
299 | info.parameters = &this_walk_state->operands[0]; | 322 | /* |
300 | info.parameter_type = ACPI_PARAM_ARGS; | 323 | * Allocate and initialize the evaluation information block |
324 | * TBD: this is somewhat inefficient, should change interface to | ||
325 | * ds_init_aml_walk. For now, keeps this struct off the CPU stack | ||
326 | */ | ||
327 | info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info)); | ||
328 | if (!info) { | ||
329 | return_ACPI_STATUS(AE_NO_MEMORY); | ||
330 | } | ||
331 | |||
332 | info->parameters = &this_walk_state->operands[0]; | ||
333 | info->parameter_type = ACPI_PARAM_ARGS; | ||
301 | 334 | ||
302 | status = acpi_ds_init_aml_walk(next_walk_state, NULL, method_node, | 335 | status = acpi_ds_init_aml_walk(next_walk_state, NULL, method_node, |
303 | obj_desc->method.aml_start, | 336 | obj_desc->method.aml_start, |
304 | obj_desc->method.aml_length, &info, 3); | 337 | obj_desc->method.aml_length, info, 3); |
338 | |||
339 | ACPI_FREE(info); | ||
305 | if (ACPI_FAILURE(status)) { | 340 | if (ACPI_FAILURE(status)) { |
306 | goto cleanup; | 341 | goto cleanup; |
307 | } | 342 | } |
@@ -323,6 +358,8 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread, | |||
323 | "Starting nested execution, newstate=%p\n", | 358 | "Starting nested execution, newstate=%p\n", |
324 | next_walk_state)); | 359 | next_walk_state)); |
325 | 360 | ||
361 | /* Invoke an internal method if necessary */ | ||
362 | |||
326 | if (obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY) { | 363 | if (obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY) { |
327 | status = obj_desc->method.implementation(next_walk_state); | 364 | status = obj_desc->method.implementation(next_walk_state); |
328 | } | 365 | } |
@@ -330,16 +367,14 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread, | |||
330 | return_ACPI_STATUS(status); | 367 | return_ACPI_STATUS(status); |
331 | 368 | ||
332 | cleanup: | 369 | cleanup: |
333 | /* Decrement the thread count on the method parse tree */ | ||
334 | 370 | ||
335 | if (next_walk_state && (next_walk_state->method_desc)) { | 371 | /* On error, we must terminate the method properly */ |
336 | next_walk_state->method_desc->method.thread_count--; | ||
337 | } | ||
338 | 372 | ||
339 | /* On error, we must delete the new walk state */ | 373 | acpi_ds_terminate_control_method(obj_desc, next_walk_state); |
374 | if (next_walk_state) { | ||
375 | acpi_ds_delete_walk_state(next_walk_state); | ||
376 | } | ||
340 | 377 | ||
341 | acpi_ds_terminate_control_method(next_walk_state); | ||
342 | acpi_ds_delete_walk_state(next_walk_state); | ||
343 | return_ACPI_STATUS(status); | 378 | return_ACPI_STATUS(status); |
344 | } | 379 | } |
345 | 380 | ||
@@ -362,25 +397,33 @@ acpi_ds_restart_control_method(struct acpi_walk_state *walk_state, | |||
362 | union acpi_operand_object *return_desc) | 397 | union acpi_operand_object *return_desc) |
363 | { | 398 | { |
364 | acpi_status status; | 399 | acpi_status status; |
400 | int same_as_implicit_return; | ||
365 | 401 | ||
366 | ACPI_FUNCTION_TRACE_PTR("ds_restart_control_method", walk_state); | 402 | ACPI_FUNCTION_TRACE_PTR(ds_restart_control_method, walk_state); |
367 | 403 | ||
368 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 404 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
369 | "****Restart [%4.4s] Op %p return_value_from_callee %p\n", | 405 | "****Restart [%4.4s] Op %p ReturnValueFromCallee %p\n", |
370 | (char *)&walk_state->method_node->name, | 406 | (char *)&walk_state->method_node->name, |
371 | walk_state->method_call_op, return_desc)); | 407 | walk_state->method_call_op, return_desc)); |
372 | 408 | ||
373 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 409 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
374 | " return_from_this_method_used?=%X res_stack %p Walk %p\n", | 410 | " ReturnFromThisMethodUsed?=%X ResStack %p Walk %p\n", |
375 | walk_state->return_used, | 411 | walk_state->return_used, |
376 | walk_state->results, walk_state)); | 412 | walk_state->results, walk_state)); |
377 | 413 | ||
378 | /* Did the called method return a value? */ | 414 | /* Did the called method return a value? */ |
379 | 415 | ||
380 | if (return_desc) { | 416 | if (return_desc) { |
417 | |||
418 | /* Is the implicit return object the same as the return desc? */ | ||
419 | |||
420 | same_as_implicit_return = | ||
421 | (walk_state->implicit_return_obj == return_desc); | ||
422 | |||
381 | /* Are we actually going to use the return value? */ | 423 | /* Are we actually going to use the return value? */ |
382 | 424 | ||
383 | if (walk_state->return_used) { | 425 | if (walk_state->return_used) { |
426 | |||
384 | /* Save the return value from the previous method */ | 427 | /* Save the return value from the previous method */ |
385 | 428 | ||
386 | status = acpi_ds_result_push(return_desc, walk_state); | 429 | status = acpi_ds_result_push(return_desc, walk_state); |
@@ -397,18 +440,23 @@ acpi_ds_restart_control_method(struct acpi_walk_state *walk_state, | |||
397 | } | 440 | } |
398 | 441 | ||
399 | /* | 442 | /* |
400 | * The following code is the | 443 | * The following code is the optional support for the so-called |
401 | * optional support for a so-called "implicit return". Some AML code | 444 | * "implicit return". Some AML code assumes that the last value of the |
402 | * assumes that the last value of the method is "implicitly" returned | 445 | * method is "implicitly" returned to the caller, in the absence of an |
403 | * to the caller. Just save the last result as the return value. | 446 | * explicit return value. |
447 | * | ||
448 | * Just save the last result of the method as the return value. | ||
449 | * | ||
404 | * NOTE: this is optional because the ASL language does not actually | 450 | * NOTE: this is optional because the ASL language does not actually |
405 | * support this behavior. | 451 | * support this behavior. |
406 | */ | 452 | */ |
407 | else if (!acpi_ds_do_implicit_return | 453 | else if (!acpi_ds_do_implicit_return |
408 | (return_desc, walk_state, FALSE)) { | 454 | (return_desc, walk_state, FALSE) |
455 | || same_as_implicit_return) { | ||
409 | /* | 456 | /* |
410 | * Delete the return value if it will not be used by the | 457 | * Delete the return value if it will not be used by the |
411 | * calling method | 458 | * calling method or remove one reference if the explicit return |
459 | * is the same as the implicit return value. | ||
412 | */ | 460 | */ |
413 | acpi_ut_remove_reference(return_desc); | 461 | acpi_ut_remove_reference(return_desc); |
414 | } | 462 | } |
@@ -421,7 +469,8 @@ acpi_ds_restart_control_method(struct acpi_walk_state *walk_state, | |||
421 | * | 469 | * |
422 | * FUNCTION: acpi_ds_terminate_control_method | 470 | * FUNCTION: acpi_ds_terminate_control_method |
423 | * | 471 | * |
424 | * PARAMETERS: walk_state - State of the method | 472 | * PARAMETERS: method_desc - Method object |
473 | * walk_state - State associated with the method | ||
425 | * | 474 | * |
426 | * RETURN: None | 475 | * RETURN: None |
427 | * | 476 | * |
@@ -431,95 +480,100 @@ acpi_ds_restart_control_method(struct acpi_walk_state *walk_state, | |||
431 | * | 480 | * |
432 | ******************************************************************************/ | 481 | ******************************************************************************/ |
433 | 482 | ||
434 | void acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state) | 483 | void |
484 | acpi_ds_terminate_control_method(union acpi_operand_object *method_desc, | ||
485 | struct acpi_walk_state *walk_state) | ||
435 | { | 486 | { |
436 | union acpi_operand_object *obj_desc; | ||
437 | struct acpi_namespace_node *method_node; | 487 | struct acpi_namespace_node *method_node; |
438 | acpi_status status; | 488 | acpi_status status; |
439 | 489 | ||
440 | ACPI_FUNCTION_TRACE_PTR("ds_terminate_control_method", walk_state); | 490 | ACPI_FUNCTION_TRACE_PTR(ds_terminate_control_method, walk_state); |
441 | 491 | ||
442 | if (!walk_state) { | 492 | /* method_desc is required, walk_state is optional */ |
443 | return_VOID; | ||
444 | } | ||
445 | 493 | ||
446 | /* The current method object was saved in the walk state */ | 494 | if (!method_desc) { |
447 | |||
448 | obj_desc = walk_state->method_desc; | ||
449 | if (!obj_desc) { | ||
450 | return_VOID; | 495 | return_VOID; |
451 | } | 496 | } |
452 | 497 | ||
453 | /* Delete all arguments and locals */ | 498 | if (walk_state) { |
454 | 499 | ||
455 | acpi_ds_method_data_delete_all(walk_state); | 500 | /* Delete all arguments and locals */ |
501 | |||
502 | acpi_ds_method_data_delete_all(walk_state); | ||
503 | } | ||
456 | 504 | ||
457 | /* | 505 | /* |
458 | * Lock the parser while we terminate this method. | 506 | * Lock the parser while we terminate this method. |
459 | * If this is the last thread executing the method, | 507 | * If this is the last thread executing the method, |
460 | * we have additional cleanup to perform | 508 | * we have additional cleanup to perform |
461 | */ | 509 | */ |
462 | status = acpi_ut_acquire_mutex(ACPI_MTX_PARSER); | 510 | status = acpi_ut_acquire_mutex(ACPI_MTX_CONTROL_METHOD); |
463 | if (ACPI_FAILURE(status)) { | 511 | if (ACPI_FAILURE(status)) { |
464 | return_VOID; | 512 | return_VOID; |
465 | } | 513 | } |
466 | 514 | ||
467 | /* Signal completion of the execution of this method if necessary */ | 515 | /* Signal completion of the execution of this method if necessary */ |
468 | 516 | ||
469 | if (walk_state->method_desc->method.semaphore) { | 517 | if (method_desc->method.semaphore) { |
470 | status = | 518 | status = |
471 | acpi_os_signal_semaphore(walk_state->method_desc->method. | 519 | acpi_os_signal_semaphore(method_desc->method.semaphore, 1); |
472 | semaphore, 1); | ||
473 | if (ACPI_FAILURE(status)) { | 520 | if (ACPI_FAILURE(status)) { |
474 | ACPI_ERROR((AE_INFO, | ||
475 | "Could not signal method semaphore")); | ||
476 | 521 | ||
477 | /* Ignore error and continue cleanup */ | 522 | /* Ignore error and continue */ |
523 | |||
524 | ACPI_EXCEPTION((AE_INFO, status, | ||
525 | "Could not signal method semaphore")); | ||
478 | } | 526 | } |
479 | } | 527 | } |
480 | 528 | ||
481 | /* | 529 | if (walk_state) { |
482 | * There are no more threads executing this method. Perform | 530 | /* |
483 | * additional cleanup. | 531 | * Delete any objects created by this method during execution. |
484 | * | 532 | * The method Node is stored in the walk state |
485 | * The method Node is stored in the walk state | 533 | */ |
486 | */ | 534 | method_node = walk_state->method_node; |
487 | method_node = walk_state->method_node; | ||
488 | 535 | ||
489 | /* Lock namespace for possible update */ | 536 | /* Lock namespace for possible update */ |
490 | 537 | ||
491 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | 538 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); |
492 | if (ACPI_FAILURE(status)) { | 539 | if (ACPI_FAILURE(status)) { |
493 | goto exit; | 540 | goto exit; |
494 | } | 541 | } |
495 | 542 | ||
496 | /* | 543 | /* |
497 | * Delete any namespace entries created immediately underneath | 544 | * Delete any namespace entries created immediately underneath |
498 | * the method | 545 | * the method |
499 | */ | 546 | */ |
500 | if (method_node->child) { | 547 | if (method_node && method_node->child) { |
501 | acpi_ns_delete_namespace_subtree(method_node); | 548 | acpi_ns_delete_namespace_subtree(method_node); |
549 | } | ||
550 | |||
551 | /* | ||
552 | * Delete any namespace entries created anywhere else within | ||
553 | * the namespace by the execution of this method | ||
554 | */ | ||
555 | acpi_ns_delete_namespace_by_owner(method_desc->method.owner_id); | ||
556 | status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | ||
502 | } | 557 | } |
503 | 558 | ||
504 | /* | 559 | /* Decrement the thread count on the method */ |
505 | * Delete any namespace entries created anywhere else within | 560 | |
506 | * the namespace by the execution of this method | 561 | if (method_desc->method.thread_count) { |
507 | */ | 562 | method_desc->method.thread_count--; |
508 | acpi_ns_delete_namespace_by_owner(walk_state->method_desc->method. | 563 | } else { |
509 | owner_id); | 564 | ACPI_ERROR((AE_INFO, "Invalid zero thread count in method")); |
510 | status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | 565 | } |
511 | 566 | ||
512 | /* Are there any other threads currently executing this method? */ | 567 | /* Are there any other threads currently executing this method? */ |
513 | 568 | ||
514 | if (walk_state->method_desc->method.thread_count) { | 569 | if (method_desc->method.thread_count) { |
515 | /* | 570 | /* |
516 | * Additional threads. Do not release the owner_id in this case, | 571 | * Additional threads. Do not release the owner_id in this case, |
517 | * we immediately reuse it for the next thread executing this method | 572 | * we immediately reuse it for the next thread executing this method |
518 | */ | 573 | */ |
519 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 574 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
520 | "*** Completed execution of one thread, %d threads remaining\n", | 575 | "*** Completed execution of one thread, %d threads remaining\n", |
521 | walk_state->method_desc->method. | 576 | method_desc->method.thread_count)); |
522 | thread_count)); | ||
523 | } else { | 577 | } else { |
524 | /* This is the only executing thread for this method */ | 578 | /* This is the only executing thread for this method */ |
525 | 579 | ||
@@ -533,22 +587,20 @@ void acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state) | |||
533 | * This code is here because we must wait until the last thread exits | 587 | * This code is here because we must wait until the last thread exits |
534 | * before creating the synchronization semaphore. | 588 | * before creating the synchronization semaphore. |
535 | */ | 589 | */ |
536 | if ((walk_state->method_desc->method.concurrency == 1) && | 590 | if ((method_desc->method.concurrency == 1) && |
537 | (!walk_state->method_desc->method.semaphore)) { | 591 | (!method_desc->method.semaphore)) { |
538 | status = acpi_os_create_semaphore(1, 1, | 592 | status = acpi_os_create_semaphore(1, 1, |
539 | &walk_state-> | 593 | &method_desc->method. |
540 | method_desc->method. | ||
541 | semaphore); | 594 | semaphore); |
542 | } | 595 | } |
543 | 596 | ||
544 | /* No more threads, we can free the owner_id */ | 597 | /* No more threads, we can free the owner_id */ |
545 | 598 | ||
546 | acpi_ut_release_owner_id(&walk_state->method_desc->method. | 599 | acpi_ut_release_owner_id(&method_desc->method.owner_id); |
547 | owner_id); | ||
548 | } | 600 | } |
549 | 601 | ||
550 | exit: | 602 | exit: |
551 | (void)acpi_ut_release_mutex(ACPI_MTX_PARSER); | 603 | (void)acpi_ut_release_mutex(ACPI_MTX_CONTROL_METHOD); |
552 | return_VOID; | 604 | return_VOID; |
553 | } | 605 | } |
554 | 606 | ||
@@ -581,7 +633,7 @@ acpi_status acpi_ds_parse_method(struct acpi_namespace_node *node) | |||
581 | union acpi_parse_object *op; | 633 | union acpi_parse_object *op; |
582 | struct acpi_walk_state *walk_state; | 634 | struct acpi_walk_state *walk_state; |
583 | 635 | ||
584 | ACPI_FUNCTION_TRACE_PTR("ds_parse_method", node); | 636 | ACPI_FUNCTION_TRACE_PTR(ds_parse_method, node); |
585 | 637 | ||
586 | /* Parameter Validation */ | 638 | /* Parameter Validation */ |
587 | 639 | ||
@@ -590,7 +642,7 @@ acpi_status acpi_ds_parse_method(struct acpi_namespace_node *node) | |||
590 | } | 642 | } |
591 | 643 | ||
592 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, | 644 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, |
593 | "**** Parsing [%4.4s] **** named_obj=%p\n", | 645 | "**** Parsing [%4.4s] **** NamedObj=%p\n", |
594 | acpi_ut_get_node_name(node), node)); | 646 | acpi_ut_get_node_name(node), node)); |
595 | 647 | ||
596 | /* Extract the method object from the method Node */ | 648 | /* Extract the method object from the method Node */ |
@@ -669,7 +721,7 @@ acpi_status acpi_ds_parse_method(struct acpi_namespace_node *node) | |||
669 | } | 721 | } |
670 | 722 | ||
671 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, | 723 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, |
672 | "**** [%4.4s] Parsed **** named_obj=%p Op=%p\n", | 724 | "**** [%4.4s] Parsed **** NamedObj=%p Op=%p\n", |
673 | acpi_ut_get_node_name(node), node, op)); | 725 | acpi_ut_get_node_name(node), node, op)); |
674 | 726 | ||
675 | /* | 727 | /* |