Lines Matching full:method
4 * Module Name: dsmethod - Parser/Interpreter interface - control method parsing
34 * PARAMETERS: node - Namespace Node of the method
35 * obj_desc - Method object attached to node
39 * DESCRIPTION: Parse a control method AML to scan for control methods that
43 * there is only a problem if the method actually blocks during execution.
46 * detect whether a method will block or not, so we simply mark all suspicious
50 * control method.
65 "Method auto-serialization parse [%4.4s] %p\n", in acpi_ds_auto_serialize_method()
68 /* Create/Init a root op for the method parse tree */ in acpi_ds_auto_serialize_method()
70 op = acpi_ps_alloc_op(AML_METHOD_OP, obj_desc->method.aml_start); in acpi_ds_auto_serialize_method()
88 obj_desc->method.aml_start, in acpi_ds_auto_serialize_method()
89 obj_desc->method.aml_length, NULL, 0); in acpi_ds_auto_serialize_method()
98 /* Parse the method, scan for creation of named objects */ in acpi_ds_auto_serialize_method()
138 * Mark the method as serialized. Later code will create a mutex for in acpi_ds_detect_named_opcodes()
139 * this method to enforce serialization. in acpi_ds_detect_named_opcodes()
142 * Sync Level mechanism for this method, even though it is now serialized. in acpi_ds_detect_named_opcodes()
146 walk_state->method_desc->method.sync_level = 0; in acpi_ds_detect_named_opcodes()
147 walk_state->method_desc->method.info_flags |= in acpi_ds_detect_named_opcodes()
151 "Method serialized [%4.4s] %p - [%s] (%4.4X)\n", in acpi_ds_detect_named_opcodes()
156 /* Abort the parse, no need to examine this method any further */ in acpi_ds_detect_named_opcodes()
170 * DESCRIPTION: Called on method error. Invoke the global exception handler if
171 * present, dump the method data if the debugger is configured
201 * AE_OK, in which case the executing method will not be aborted. in acpi_ds_method_error()
224 /* Display method locals/args if debugger is present */ in acpi_ds_method_error()
238 * PARAMETERS: obj_desc - The method object
242 * DESCRIPTION: Create a mutex object for a serialized control method
269 mutex_desc->mutex.sync_level = method_desc->method.sync_level; in acpi_ds_create_method_mutex()
270 method_desc->method.mutex = mutex_desc; in acpi_ds_create_method_mutex()
278 * PARAMETERS: method_node - Node of the method
279 * obj_desc - The method object
281 * a method.
285 * DESCRIPTION: Prepare a method for execution. Parses the method if necessary,
286 * increments the thread count, and waits at the method semaphore
308 if (obj_desc->method.thread_count == ACPI_UINT8_MAX) { in acpi_ds_begin_method_execution()
310 "Method reached maximum reentrancy limit (255)")); in acpi_ds_begin_method_execution()
315 * If this method is serialized, we need to acquire the method mutex. in acpi_ds_begin_method_execution()
317 if (obj_desc->method.info_flags & ACPI_METHOD_SERIALIZED) { in acpi_ds_begin_method_execution()
319 * Create a mutex for the method if it is defined to be Serialized in acpi_ds_begin_method_execution()
321 * until a method is actually executed, to minimize the object count in acpi_ds_begin_method_execution()
323 if (!obj_desc->method.mutex) { in acpi_ds_begin_method_execution()
332 * the sync level of the method. This mechanism provides some in acpi_ds_begin_method_execution()
335 * If the method was auto-serialized, we just ignore the sync level in acpi_ds_begin_method_execution()
339 * Top-level method invocation has no walk state at this point in acpi_ds_begin_method_execution()
342 (!(obj_desc->method. in acpi_ds_begin_method_execution()
345 obj_desc->method.mutex->mutex.sync_level)) { in acpi_ds_begin_method_execution()
347 "Cannot acquire Mutex for method [%4.4s]" in acpi_ds_begin_method_execution()
356 * Obtain the method mutex if necessary. Do not acquire mutex for a in acpi_ds_begin_method_execution()
360 !obj_desc->method.mutex->mutex.thread_id || in acpi_ds_begin_method_execution()
362 obj_desc->method.mutex->mutex.thread_id)) { in acpi_ds_begin_method_execution()
364 * Acquire the method mutex. This releases the interpreter if we in acpi_ds_begin_method_execution()
368 acpi_ex_system_wait_mutex(obj_desc->method.mutex-> in acpi_ds_begin_method_execution()
378 obj_desc->method.mutex->mutex. in acpi_ds_begin_method_execution()
382 obj_desc->method.mutex->mutex.thread_id = in acpi_ds_begin_method_execution()
387 * serialized method. In the auto case, we have to ignore in acpi_ds_begin_method_execution()
388 * the sync level for the method mutex (created for the in acpi_ds_begin_method_execution()
392 if (!(obj_desc->method.info_flags & in acpi_ds_begin_method_execution()
395 obj_desc->method.sync_level; in acpi_ds_begin_method_execution()
398 obj_desc->method.mutex->mutex. in acpi_ds_begin_method_execution()
400 obj_desc->method.mutex->mutex.sync_level; in acpi_ds_begin_method_execution()
402 obj_desc->method.mutex->mutex.thread_id = in acpi_ds_begin_method_execution()
409 obj_desc->method.mutex->mutex.acquisition_depth++; in acpi_ds_begin_method_execution()
413 * Allocate an Owner ID for this method, only if this is the first thread in acpi_ds_begin_method_execution()
415 * method is invoked recursively. in acpi_ds_begin_method_execution()
417 if (!obj_desc->method.owner_id) { in acpi_ds_begin_method_execution()
418 status = acpi_ut_allocate_owner_id(&obj_desc->method.owner_id); in acpi_ds_begin_method_execution()
425 * Increment the method parse tree thread count since it has been in acpi_ds_begin_method_execution()
428 obj_desc->method.thread_count++; in acpi_ds_begin_method_execution()
433 /* On error, must release the method mutex (if present) */ in acpi_ds_begin_method_execution()
435 if (obj_desc->method.mutex) { in acpi_ds_begin_method_execution()
436 acpi_os_release_mutex(obj_desc->method.mutex->mutex.os_mutex); in acpi_ds_begin_method_execution()
451 * DESCRIPTION: Transfer execution to a called control method
470 "Calling method %p, currentstate=%p\n", in acpi_ds_call_control_method()
474 * Get the namespace entry for the control method we are about to call in acpi_ds_call_control_method()
486 /* Init for new method, possibly wait on method mutex */ in acpi_ds_call_control_method()
495 /* Begin method parse/execution. Create a new walk state */ in acpi_ds_call_control_method()
498 acpi_ds_create_walk_state(obj_desc->method.owner_id, NULL, obj_desc, in acpi_ds_call_control_method()
526 obj_desc->method.aml_start, in acpi_ds_call_control_method()
527 obj_desc->method.aml_length, info, in acpi_ds_call_control_method()
542 for (i = 0; i < obj_desc->method.param_count; i++) { in acpi_ds_call_control_method()
562 "%-26s: %*s%s\n", " Nested method call", in acpi_ds_call_control_method()
566 /* Invoke an internal method if necessary */ in acpi_ds_call_control_method()
568 if (obj_desc->method.info_flags & ACPI_METHOD_INTERNAL_ONLY) { in acpi_ds_call_control_method()
570 obj_desc->method.dispatch.implementation(next_walk_state); in acpi_ds_call_control_method()
580 /* On error, we must terminate the method properly */ in acpi_ds_call_control_method()
592 * PARAMETERS: walk_state - State for preempted method (caller)
593 * return_desc - Return value from the called method
597 * DESCRIPTION: Restart a method that was preempted by another (nested) method
621 /* Did the called method return a value? */ in acpi_ds_restart_control_method()
634 /* Save the return value from the previous method */ in acpi_ds_restart_control_method()
643 * Save as THIS method's return value in case it is returned in acpi_ds_restart_control_method()
644 * immediately to yet another method in acpi_ds_restart_control_method()
652 * method is "implicitly" returned to the caller, in the absence of an in acpi_ds_restart_control_method()
655 * Just save the last result of the method as the return value. in acpi_ds_restart_control_method()
665 * calling method or remove one reference if the explicit return in acpi_ds_restart_control_method()
679 * PARAMETERS: method_desc - Method object
680 * walk_state - State associated with the method
684 * DESCRIPTION: Terminate a control method. Delete everything that the method
713 * namespace by the execution of this method. Unless: in acpi_ds_terminate_control_method()
714 * 1) This method is a module-level executable code method, in which in acpi_ds_terminate_control_method()
716 * 2) There are other threads executing the method, in which case we in acpi_ds_terminate_control_method()
719 if (!(method_desc->method.info_flags & ACPI_METHOD_MODULE_LEVEL) in acpi_ds_terminate_control_method()
720 && (method_desc->method.thread_count == 1)) { in acpi_ds_terminate_control_method()
722 /* Delete any direct children of (created by) this method */ in acpi_ds_terminate_control_method()
730 * Delete any objects that were created by this method in acpi_ds_terminate_control_method()
734 * namespace walk for every control method execution. in acpi_ds_terminate_control_method()
736 if (method_desc->method. in acpi_ds_terminate_control_method()
740 method. in acpi_ds_terminate_control_method()
743 method_desc->method.info_flags &= in acpi_ds_terminate_control_method()
749 * If method is serialized, release the mutex and restore the in acpi_ds_terminate_control_method()
752 if (method_desc->method.mutex) { in acpi_ds_terminate_control_method()
756 method_desc->method.mutex->mutex.acquisition_depth--; in acpi_ds_terminate_control_method()
757 if (!method_desc->method.mutex->mutex.acquisition_depth) { in acpi_ds_terminate_control_method()
759 method_desc->method.mutex->mutex. in acpi_ds_terminate_control_method()
762 acpi_os_release_mutex(method_desc->method. in acpi_ds_terminate_control_method()
764 method_desc->method.mutex->mutex.thread_id = 0; in acpi_ds_terminate_control_method()
769 /* Decrement the thread count on the method */ in acpi_ds_terminate_control_method()
771 if (method_desc->method.thread_count) { in acpi_ds_terminate_control_method()
772 method_desc->method.thread_count--; in acpi_ds_terminate_control_method()
774 ACPI_ERROR((AE_INFO, "Invalid zero thread count in method")); in acpi_ds_terminate_control_method()
777 /* Are there any other threads currently executing this method? */ in acpi_ds_terminate_control_method()
779 if (method_desc->method.thread_count) { in acpi_ds_terminate_control_method()
782 * we immediately reuse it for the next thread executing this method in acpi_ds_terminate_control_method()
786 method_desc->method.thread_count)); in acpi_ds_terminate_control_method()
788 /* This is the only executing thread for this method */ in acpi_ds_terminate_control_method()
791 * Support to dynamically change a method from not_serialized to in acpi_ds_terminate_control_method()
792 * Serialized if it appears that the method is incorrectly written and in acpi_ds_terminate_control_method()
794 * is if such a method creates namespace objects and blocks. A second in acpi_ds_terminate_control_method()
798 * before marking the method as serialized. in acpi_ds_terminate_control_method()
800 if (method_desc->method. in acpi_ds_terminate_control_method()
803 ACPI_INFO(("Marking method %4.4s as Serialized " in acpi_ds_terminate_control_method()
810 * Method tried to create an object twice and was marked as in acpi_ds_terminate_control_method()
811 * "pending serialized". The probable cause is that the method in acpi_ds_terminate_control_method()
814 * The method was created as not_serialized, but it tried to create in acpi_ds_terminate_control_method()
817 * marking the method permanently as Serialized when the last in acpi_ds_terminate_control_method()
820 method_desc->method.info_flags &= in acpi_ds_terminate_control_method()
823 method_desc->method.info_flags |= in acpi_ds_terminate_control_method()
826 method_desc->method.sync_level = 0; in acpi_ds_terminate_control_method()
832 (method_desc->method. in acpi_ds_terminate_control_method()
834 acpi_ut_release_owner_id(&method_desc->method.owner_id); in acpi_ds_terminate_control_method()
839 method.node, method_desc, walk_state); in acpi_ds_terminate_control_method()