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