Lines Matching full:mutex

3  * Module Name: exmutex - ASL Mutex Acquire/Release functions
172 * PARAMETERS: ObjDesc - The mutex to be unlinked
176 * DESCRIPTION: Remove a mutex from the "AcquiredMutex" list
184 ACPI_THREAD_STATE *Thread = ObjDesc->Mutex.OwnerThread; in AcpiExUnlinkMutex()
194 if (ObjDesc->Mutex.Next) in AcpiExUnlinkMutex()
196 (ObjDesc->Mutex.Next)->Mutex.Prev = ObjDesc->Mutex.Prev; in AcpiExUnlinkMutex()
199 if (ObjDesc->Mutex.Prev) in AcpiExUnlinkMutex()
201 (ObjDesc->Mutex.Prev)->Mutex.Next = ObjDesc->Mutex.Next; in AcpiExUnlinkMutex()
204 * Migrate the previous sync level associated with this mutex to in AcpiExUnlinkMutex()
205 * the previous mutex on the list so that it may be preserved. in AcpiExUnlinkMutex()
209 (ObjDesc->Mutex.Prev)->Mutex.OriginalSyncLevel = in AcpiExUnlinkMutex()
210 ObjDesc->Mutex.OriginalSyncLevel; in AcpiExUnlinkMutex()
214 Thread->AcquiredMutexList = ObjDesc->Mutex.Next; in AcpiExUnlinkMutex()
223 * PARAMETERS: ObjDesc - The mutex to be linked
228 * DESCRIPTION: Add a mutex to the "AcquiredMutex" list for this walk
244 ObjDesc->Mutex.Prev = NULL; in AcpiExLinkMutex()
245 ObjDesc->Mutex.Next = ListHead; in AcpiExLinkMutex()
251 ListHead->Mutex.Prev = ObjDesc; in AcpiExLinkMutex()
265 * ObjDesc - Mutex object
270 * DESCRIPTION: Acquire an AML mutex, low-level interface. Provides a common
273 * MUTEX: Interpreter must be locked
302 if (ObjDesc->Mutex.ThreadId == ThreadId) in AcpiExAcquireMutexObject()
305 * The mutex is already owned by this thread, just increment the in AcpiExAcquireMutexObject()
308 ObjDesc->Mutex.AcquisitionDepth++; in AcpiExAcquireMutexObject()
312 /* Acquire the mutex, wait if necessary. Special case for Global Lock */ in AcpiExAcquireMutexObject()
320 Status = AcpiExSystemWaitMutex (ObjDesc->Mutex.OsMutex, Timeout); in AcpiExAcquireMutexObject()
330 /* Acquired the mutex: update mutex object */ in AcpiExAcquireMutexObject()
332 ObjDesc->Mutex.ThreadId = ThreadId; in AcpiExAcquireMutexObject()
333 ObjDesc->Mutex.AcquisitionDepth = 1; in AcpiExAcquireMutexObject()
334 ObjDesc->Mutex.OriginalSyncLevel = 0; in AcpiExAcquireMutexObject()
335 ObjDesc->Mutex.OwnerThread = NULL; /* Used only for AML Acquire() */ in AcpiExAcquireMutexObject()
346 * ObjDesc - Mutex object
351 * DESCRIPTION: Acquire an AML mutex
377 "Cannot acquire Mutex [%4.4s], null thread info", in AcpiExAcquireMutex()
378 AcpiUtGetNodeName (ObjDesc->Mutex.Node))); in AcpiExAcquireMutex()
384 * of the mutex. This mechanism provides some deadlock prevention. in AcpiExAcquireMutex()
386 if (WalkState->Thread->CurrentSyncLevel > ObjDesc->Mutex.SyncLevel) in AcpiExAcquireMutex()
389 "Cannot acquire Mutex [%4.4s], " in AcpiExAcquireMutex()
391 AcpiUtGetNodeName (ObjDesc->Mutex.Node), in AcpiExAcquireMutex()
397 "Acquiring: Mutex SyncLevel %u, Thread SyncLevel %u, " in AcpiExAcquireMutex()
399 ObjDesc->Mutex.SyncLevel, WalkState->Thread->CurrentSyncLevel, in AcpiExAcquireMutex()
400 ObjDesc->Mutex.AcquisitionDepth, WalkState->Thread)); in AcpiExAcquireMutex()
405 if (ACPI_SUCCESS (Status) && ObjDesc->Mutex.AcquisitionDepth == 1) in AcpiExAcquireMutex()
409 ObjDesc->Mutex.OwnerThread = WalkState->Thread; in AcpiExAcquireMutex()
410 ObjDesc->Mutex.OriginalSyncLevel = in AcpiExAcquireMutex()
413 ObjDesc->Mutex.SyncLevel; in AcpiExAcquireMutex()
415 /* Link the mutex to the current thread for force-unlock at method exit */ in AcpiExAcquireMutex()
421 "Acquired: Mutex SyncLevel %u, Thread SyncLevel %u, Depth %u\n", in AcpiExAcquireMutex()
422 ObjDesc->Mutex.SyncLevel, WalkState->Thread->CurrentSyncLevel, in AcpiExAcquireMutex()
423 ObjDesc->Mutex.AcquisitionDepth)); in AcpiExAcquireMutex()
437 * DESCRIPTION: Release a previously acquired Mutex, low level interface.
441 * MUTEX: Interpreter must be locked
461 if (ObjDesc->Mutex.AcquisitionDepth == 0) in AcpiExReleaseMutexObject()
468 ObjDesc->Mutex.AcquisitionDepth--; in AcpiExReleaseMutexObject()
469 if (ObjDesc->Mutex.AcquisitionDepth != 0) in AcpiExReleaseMutexObject()
476 if (ObjDesc->Mutex.OwnerThread) in AcpiExReleaseMutexObject()
478 /* Unlink the mutex from the owner's list */ in AcpiExReleaseMutexObject()
481 ObjDesc->Mutex.OwnerThread = NULL; in AcpiExReleaseMutexObject()
484 /* Release the mutex, special case for Global Lock */ in AcpiExReleaseMutexObject()
492 AcpiOsReleaseMutex (ObjDesc->Mutex.OsMutex); in AcpiExReleaseMutexObject()
495 /* Clear mutex info */ in AcpiExReleaseMutexObject()
497 ObjDesc->Mutex.ThreadId = 0; in AcpiExReleaseMutexObject()
511 * DESCRIPTION: Release a previously acquired Mutex.
533 OwnerThread = ObjDesc->Mutex.OwnerThread; in AcpiExReleaseMutex()
535 /* The mutex must have been previously acquired in order to release it */ in AcpiExReleaseMutex()
540 "Cannot release Mutex [%4.4s], not acquired", in AcpiExReleaseMutex()
541 AcpiUtGetNodeName (ObjDesc->Mutex.Node))); in AcpiExReleaseMutex()
550 "Cannot release Mutex [%4.4s], null thread info", in AcpiExReleaseMutex()
551 AcpiUtGetNodeName (ObjDesc->Mutex.Node))); in AcpiExReleaseMutex()
556 * The Mutex is owned, but this thread must be the owner. in AcpiExReleaseMutex()
563 "Thread %u cannot release Mutex [%4.4s] acquired by thread %u", in AcpiExReleaseMutex()
565 AcpiUtGetNodeName (ObjDesc->Mutex.Node), in AcpiExReleaseMutex()
571 * The sync level of the mutex must be equal to the current sync level. In in AcpiExReleaseMutex()
572 * other words, the current level means that at least one mutex at that in AcpiExReleaseMutex()
573 * level is currently being held. Attempting to release a mutex of a in AcpiExReleaseMutex()
574 * different level can only mean that the mutex ordering rule is being in AcpiExReleaseMutex()
577 if (ObjDesc->Mutex.SyncLevel != OwnerThread->CurrentSyncLevel) in AcpiExReleaseMutex()
580 "Cannot release Mutex [%4.4s], SyncLevel mismatch: " in AcpiExReleaseMutex()
581 "mutex %u current %u", in AcpiExReleaseMutex()
582 AcpiUtGetNodeName (ObjDesc->Mutex.Node), in AcpiExReleaseMutex()
583 ObjDesc->Mutex.SyncLevel, WalkState->Thread->CurrentSyncLevel)); in AcpiExReleaseMutex()
588 * Get the previous SyncLevel from the head of the acquired mutex list. in AcpiExReleaseMutex()
593 OwnerThread->AcquiredMutexList->Mutex.OriginalSyncLevel; in AcpiExReleaseMutex()
598 ObjDesc->Mutex.SyncLevel, WalkState->Thread->CurrentSyncLevel, in AcpiExReleaseMutex()
599 PreviousSyncLevel, ObjDesc->Mutex.AcquisitionDepth, in AcpiExReleaseMutex()
608 if (ObjDesc->Mutex.AcquisitionDepth == 0) in AcpiExReleaseMutex()
618 ObjDesc->Mutex.SyncLevel, WalkState->Thread->CurrentSyncLevel, in AcpiExReleaseMutex()
619 PreviousSyncLevel, ObjDesc->Mutex.AcquisitionDepth)); in AcpiExReleaseMutex()
638 * method to acquire a mutex, and a different method to release it, as long as
660 "Mutex [%4.4s] force-release, SyncLevel %u Depth %u\n", in AcpiExReleaseAllMutexes()
661 ObjDesc->Mutex.Node->Name.Ascii, ObjDesc->Mutex.SyncLevel, in AcpiExReleaseAllMutexes()
662 ObjDesc->Mutex.AcquisitionDepth)); in AcpiExReleaseAllMutexes()
664 /* Release the mutex, special case for Global Lock */ in AcpiExReleaseAllMutexes()
674 AcpiOsReleaseMutex (ObjDesc->Mutex.OsMutex); in AcpiExReleaseAllMutexes()
677 /* Update Thread SyncLevel (Last mutex is the important one) */ in AcpiExReleaseAllMutexes()
679 Thread->CurrentSyncLevel = ObjDesc->Mutex.OriginalSyncLevel; in AcpiExReleaseAllMutexes()
681 /* Mark mutex unowned */ in AcpiExReleaseAllMutexes()
683 Next = ObjDesc->Mutex.Next; in AcpiExReleaseAllMutexes()
685 ObjDesc->Mutex.Prev = NULL; in AcpiExReleaseAllMutexes()
686 ObjDesc->Mutex.Next = NULL; in AcpiExReleaseAllMutexes()
687 ObjDesc->Mutex.AcquisitionDepth = 0; in AcpiExReleaseAllMutexes()
688 ObjDesc->Mutex.OwnerThread = NULL; in AcpiExReleaseAllMutexes()
689 ObjDesc->Mutex.ThreadId = 0; in AcpiExReleaseAllMutexes()