Lines Matching full:method

3  * Module Name: dsmethod - Parser/Interpreter interface - control method parsing
181 * PARAMETERS: Node - Namespace Node of the method
182 * ObjDesc - Method object attached to node
186 * DESCRIPTION: Parse a control method AML to scan for control methods that
190 * there is only a problem if the method actually blocks during execution.
193 * detect whether a method will block or not, so we simply mark all suspicious
197 * control method.
215 "Method auto-serialization parse [%4.4s] %p\n", in AcpiDsAutoSerializeMethod()
218 /* Create/Init a root op for the method parse tree */ in AcpiDsAutoSerializeMethod()
220 Op = AcpiPsAllocOp (AML_METHOD_OP, ObjDesc->Method.AmlStart); in AcpiDsAutoSerializeMethod()
239 ObjDesc->Method.AmlStart, ObjDesc->Method.AmlLength, NULL, 0); in AcpiDsAutoSerializeMethod()
249 /* Parse the method, scan for creation of named objects */ in AcpiDsAutoSerializeMethod()
291 * Mark the method as serialized. Later code will create a mutex for in AcpiDsDetectNamedOpcodes()
292 * this method to enforce serialization. in AcpiDsDetectNamedOpcodes()
295 * Sync Level mechanism for this method, even though it is now serialized. in AcpiDsDetectNamedOpcodes()
299 WalkState->MethodDesc->Method.SyncLevel = 0; in AcpiDsDetectNamedOpcodes()
300 WalkState->MethodDesc->Method.InfoFlags |= in AcpiDsDetectNamedOpcodes()
304 "Method serialized [%4.4s] %p - [%s] (%4.4X)\n", in AcpiDsDetectNamedOpcodes()
308 /* Abort the parse, no need to examine this method any further */ in AcpiDsDetectNamedOpcodes()
323 * DESCRIPTION: Called on method error. Invoke the global exception handler if
324 * present, dump the method data if the debugger is configured
360 * AE_OK, in which case the executing method will not be aborted. in AcpiDsMethodError()
385 /* Display method locals/args if debugger is present */ in AcpiDsMethodError()
400 * PARAMETERS: ObjDesc - The method object
404 * DESCRIPTION: Create a mutex object for a serialized control method
436 MutexDesc->Mutex.SyncLevel = MethodDesc->Method.SyncLevel; in AcpiDsCreateMethodMutex()
437 MethodDesc->Method.Mutex = MutexDesc; in AcpiDsCreateMethodMutex()
446 * PARAMETERS: MethodNode - Node of the method
447 * ObjDesc - The method object
449 * a method.
453 * DESCRIPTION: Prepare a method for execution. Parses the method if necessary,
454 * increments the thread count, and waits at the method semaphore
480 if (ObjDesc->Method.ThreadCount == ACPI_UINT8_MAX) in AcpiDsBeginMethodExecution()
483 "Method reached maximum reentrancy limit (255)")); in AcpiDsBeginMethodExecution()
488 * If this method is serialized, we need to acquire the method mutex. in AcpiDsBeginMethodExecution()
490 if (ObjDesc->Method.InfoFlags & ACPI_METHOD_SERIALIZED) in AcpiDsBeginMethodExecution()
493 * Create a mutex for the method if it is defined to be Serialized in AcpiDsBeginMethodExecution()
495 * until a method is actually executed, to minimize the object count in AcpiDsBeginMethodExecution()
497 if (!ObjDesc->Method.Mutex) in AcpiDsBeginMethodExecution()
508 * the sync level of the method. This mechanism provides some in AcpiDsBeginMethodExecution()
511 * If the method was auto-serialized, we just ignore the sync level in AcpiDsBeginMethodExecution()
515 * Top-level method invocation has no walk state at this point in AcpiDsBeginMethodExecution()
518 (!(ObjDesc->Method.InfoFlags & ACPI_METHOD_IGNORE_SYNC_LEVEL)) && in AcpiDsBeginMethodExecution()
520 ObjDesc->Method.Mutex->Mutex.SyncLevel)) in AcpiDsBeginMethodExecution()
523 "Cannot acquire Mutex for method [%4.4s]" in AcpiDsBeginMethodExecution()
532 * Obtain the method mutex if necessary. Do not acquire mutex for a in AcpiDsBeginMethodExecution()
536 !ObjDesc->Method.Mutex->Mutex.ThreadId || in AcpiDsBeginMethodExecution()
538 ObjDesc->Method.Mutex->Mutex.ThreadId)) in AcpiDsBeginMethodExecution()
541 * Acquire the method mutex. This releases the interpreter if we in AcpiDsBeginMethodExecution()
545 ObjDesc->Method.Mutex->Mutex.OsMutex, ACPI_WAIT_FOREVER); in AcpiDsBeginMethodExecution()
555 ObjDesc->Method.Mutex->Mutex.OriginalSyncLevel = in AcpiDsBeginMethodExecution()
558 ObjDesc->Method.Mutex->Mutex.ThreadId = in AcpiDsBeginMethodExecution()
563 * serialized method. In the auto case, we have to ignore in AcpiDsBeginMethodExecution()
564 * the sync level for the method mutex (created for the in AcpiDsBeginMethodExecution()
568 if (!(ObjDesc->Method.InfoFlags & in AcpiDsBeginMethodExecution()
572 ObjDesc->Method.SyncLevel; in AcpiDsBeginMethodExecution()
577 ObjDesc->Method.Mutex->Mutex.OriginalSyncLevel = in AcpiDsBeginMethodExecution()
578 ObjDesc->Method.Mutex->Mutex.SyncLevel; in AcpiDsBeginMethodExecution()
580 ObjDesc->Method.Mutex->Mutex.ThreadId = in AcpiDsBeginMethodExecution()
587 ObjDesc->Method.Mutex->Mutex.AcquisitionDepth++; in AcpiDsBeginMethodExecution()
591 * Allocate an Owner ID for this method, only if this is the first thread in AcpiDsBeginMethodExecution()
593 * method is invoked recursively. in AcpiDsBeginMethodExecution()
595 if (!ObjDesc->Method.OwnerId) in AcpiDsBeginMethodExecution()
597 Status = AcpiUtAllocateOwnerId (&ObjDesc->Method.OwnerId); in AcpiDsBeginMethodExecution()
605 * Increment the method parse tree thread count since it has been in AcpiDsBeginMethodExecution()
608 ObjDesc->Method.ThreadCount++; in AcpiDsBeginMethodExecution()
614 /* On error, must release the method mutex (if present) */ in AcpiDsBeginMethodExecution()
616 if (ObjDesc->Method.Mutex) in AcpiDsBeginMethodExecution()
618 AcpiOsReleaseMutex (ObjDesc->Method.Mutex->Mutex.OsMutex); in AcpiDsBeginMethodExecution()
634 * DESCRIPTION: Transfer execution to a called control method
655 "Calling method %p, currentstate=%p\n", in AcpiDsCallControlMethod()
659 * Get the namespace entry for the control method we are about to call in AcpiDsCallControlMethod()
673 /* Init for new method, possibly wait on method mutex */ in AcpiDsCallControlMethod()
682 /* Begin method parse/execution. Create a new walk state */ in AcpiDsCallControlMethod()
685 ObjDesc->Method.OwnerId, NULL, ObjDesc, Thread); in AcpiDsCallControlMethod()
714 ObjDesc->Method.AmlStart, ObjDesc->Method.AmlLength, in AcpiDsCallControlMethod()
729 for (i = 0; i < ObjDesc->Method.ParamCount; i++) in AcpiDsCallControlMethod()
749 "%-26s: %*s%s\n", " Nested method call", in AcpiDsCallControlMethod()
753 /* Invoke an internal method if necessary */ in AcpiDsCallControlMethod()
755 if (ObjDesc->Method.InfoFlags & ACPI_METHOD_INTERNAL_ONLY) in AcpiDsCallControlMethod()
757 Status = ObjDesc->Method.Dispatch.Implementation (NextWalkState); in AcpiDsCallControlMethod()
775 /* On error, we must terminate the method properly */ in AcpiDsCallControlMethod()
788 * PARAMETERS: WalkState - State for preempted method (caller)
789 * ReturnDesc - Return value from the called method
793 * DESCRIPTION: Restart a method that was preempted by another (nested) method
820 /* Did the called method return a value? */ in AcpiDsRestartControlMethod()
832 /* Save the return value from the previous method */ in AcpiDsRestartControlMethod()
842 * Save as THIS method's return value in case it is returned in AcpiDsRestartControlMethod()
843 * immediately to yet another method in AcpiDsRestartControlMethod()
851 * method is "implicitly" returned to the caller, in the absence of an in AcpiDsRestartControlMethod()
854 * Just save the last result of the method as the return value. in AcpiDsRestartControlMethod()
864 * calling method or remove one reference if the explicit return in AcpiDsRestartControlMethod()
879 * PARAMETERS: MethodDesc - Method object
880 * WalkState - State associated with the method
884 * DESCRIPTION: Terminate a control method. Delete everything that the method
916 * namespace by the execution of this method. Unless: in AcpiDsTerminateControlMethod()
917 * 1) This method is a module-level executable code method, in which in AcpiDsTerminateControlMethod()
919 * 2) There are other threads executing the method, in which case we in AcpiDsTerminateControlMethod()
922 if (!(MethodDesc->Method.InfoFlags & ACPI_METHOD_MODULE_LEVEL) && in AcpiDsTerminateControlMethod()
923 (MethodDesc->Method.ThreadCount == 1)) in AcpiDsTerminateControlMethod()
925 /* Delete any direct children of (created by) this method */ in AcpiDsTerminateControlMethod()
932 * Delete any objects that were created by this method in AcpiDsTerminateControlMethod()
936 * namespace walk for every control method execution. in AcpiDsTerminateControlMethod()
938 if (MethodDesc->Method.InfoFlags & ACPI_METHOD_MODIFIED_NAMESPACE) in AcpiDsTerminateControlMethod()
941 AcpiNsDeleteNamespaceByOwner (MethodDesc->Method.OwnerId); in AcpiDsTerminateControlMethod()
943 MethodDesc->Method.InfoFlags &= in AcpiDsTerminateControlMethod()
949 * If method is serialized, release the mutex and restore the in AcpiDsTerminateControlMethod()
952 if (MethodDesc->Method.Mutex) in AcpiDsTerminateControlMethod()
956 MethodDesc->Method.Mutex->Mutex.AcquisitionDepth--; in AcpiDsTerminateControlMethod()
957 if (!MethodDesc->Method.Mutex->Mutex.AcquisitionDepth) in AcpiDsTerminateControlMethod()
960 MethodDesc->Method.Mutex->Mutex.OriginalSyncLevel; in AcpiDsTerminateControlMethod()
963 MethodDesc->Method.Mutex->Mutex.OsMutex); in AcpiDsTerminateControlMethod()
964 MethodDesc->Method.Mutex->Mutex.ThreadId = 0; in AcpiDsTerminateControlMethod()
969 /* Decrement the thread count on the method */ in AcpiDsTerminateControlMethod()
971 if (MethodDesc->Method.ThreadCount) in AcpiDsTerminateControlMethod()
973 MethodDesc->Method.ThreadCount--; in AcpiDsTerminateControlMethod()
978 "Invalid zero thread count in method")); in AcpiDsTerminateControlMethod()
981 /* Are there any other threads currently executing this method? */ in AcpiDsTerminateControlMethod()
983 if (MethodDesc->Method.ThreadCount) in AcpiDsTerminateControlMethod()
987 * we immediately reuse it for the next thread executing this method in AcpiDsTerminateControlMethod()
991 MethodDesc->Method.ThreadCount)); in AcpiDsTerminateControlMethod()
995 /* This is the only executing thread for this method */ in AcpiDsTerminateControlMethod()
998 * Support to dynamically change a method from NotSerialized to in AcpiDsTerminateControlMethod()
999 * Serialized if it appears that the method is incorrectly written and in AcpiDsTerminateControlMethod()
1001 * is if such a method creates namespace objects and blocks. A second in AcpiDsTerminateControlMethod()
1005 * before marking the method as serialized. in AcpiDsTerminateControlMethod()
1007 if (MethodDesc->Method.InfoFlags & ACPI_METHOD_SERIALIZED_PENDING) in AcpiDsTerminateControlMethod()
1012 "Marking method %4.4s as Serialized " in AcpiDsTerminateControlMethod()
1018 * Method tried to create an object twice and was marked as in AcpiDsTerminateControlMethod()
1019 * "pending serialized". The probable cause is that the method in AcpiDsTerminateControlMethod()
1022 * The method was created as NotSerialized, but it tried to create in AcpiDsTerminateControlMethod()
1025 * marking the method permanently as Serialized when the last in AcpiDsTerminateControlMethod()
1028 MethodDesc->Method.InfoFlags &= in AcpiDsTerminateControlMethod()
1031 MethodDesc->Method.InfoFlags |= in AcpiDsTerminateControlMethod()
1033 MethodDesc->Method.SyncLevel = 0; in AcpiDsTerminateControlMethod()
1038 if (!(MethodDesc->Method.InfoFlags & ACPI_METHOD_MODULE_LEVEL)) in AcpiDsTerminateControlMethod()
1040 AcpiUtReleaseOwnerId (&MethodDesc->Method.OwnerId); in AcpiDsTerminateControlMethod()
1044 AcpiExStopTraceMethod ((ACPI_NAMESPACE_NODE *) MethodDesc->Method.Node, in AcpiDsTerminateControlMethod()