Fix allowable release order for ASL mutex objects.

The ACPI 4.0 specification has been changed to make the SyncLevel
for mutex objects more useful. When releasing a mutex, the synclevel
of the mutex must now be the same as the current sync level. This
makes more sense. This change updates the code to match the spec.
This commit is contained in:
Robert Moore 2009-05-01 15:00:05 -07:00
parent 95b36bc38b
commit 506914294f

View File

@ -515,10 +515,13 @@ AcpiExReleaseMutex (
}
/*
* The sync level of the mutex must be less than or equal to the current
* sync level
* The sync level of the mutex must be equal to the current sync level. In
* other words, the current level means that at least one mutex at that
* level is currently being held. Attempting to release a mutex of a
* different level can only mean that the mutex ordering rule is being
* violated. This behavior is clarified in ACPI 4.0 specification.
*/
if (ObjDesc->Mutex.SyncLevel > WalkState->Thread->CurrentSyncLevel)
if (ObjDesc->Mutex.SyncLevel != WalkState->Thread->CurrentSyncLevel)
{
ACPI_ERROR ((AE_INFO,
"Cannot release Mutex [%4.4s], SyncLevel mismatch: mutex %d current %d",
@ -536,10 +539,14 @@ AcpiExReleaseMutex (
WalkState->Thread->AcquiredMutexList->Mutex.OriginalSyncLevel;
Status = AcpiExReleaseMutexObject (ObjDesc);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
if (ObjDesc->Mutex.AcquisitionDepth == 0)
{
/* Restore the original SyncLevel */
/* Restore the previous SyncLevel */
WalkState->Thread->CurrentSyncLevel = PreviousSyncLevel;
}