|
Lines 471-476
AcpiExReleaseMutex (
Link Here
|
| 471 |
{ |
471 |
{ |
| 472 |
ACPI_STATUS Status = AE_OK; |
472 |
ACPI_STATUS Status = AE_OK; |
| 473 |
UINT8 PreviousSyncLevel; |
473 |
UINT8 PreviousSyncLevel; |
|
|
474 |
ACPI_THREAD_STATE *OwnerThread; |
| 474 |
|
475 |
|
| 475 |
|
476 |
|
| 476 |
ACPI_FUNCTION_TRACE (ExReleaseMutex); |
477 |
ACPI_FUNCTION_TRACE (ExReleaseMutex); |
|
Lines 481-489
AcpiExReleaseMutex (
Link Here
|
| 481 |
return_ACPI_STATUS (AE_BAD_PARAMETER); |
482 |
return_ACPI_STATUS (AE_BAD_PARAMETER); |
| 482 |
} |
483 |
} |
| 483 |
|
484 |
|
|
|
485 |
OwnerThread = ObjDesc->Mutex.OwnerThread; |
| 486 |
|
| 484 |
/* The mutex must have been previously acquired in order to release it */ |
487 |
/* The mutex must have been previously acquired in order to release it */ |
| 485 |
|
488 |
|
| 486 |
if (!ObjDesc->Mutex.OwnerThread) |
489 |
if (!OwnerThread) |
| 487 |
{ |
490 |
{ |
| 488 |
ACPI_ERROR ((AE_INFO, "Cannot release Mutex [%4.4s], not acquired", |
491 |
ACPI_ERROR ((AE_INFO, "Cannot release Mutex [%4.4s], not acquired", |
| 489 |
AcpiUtGetNodeName (ObjDesc->Mutex.Node))); |
492 |
AcpiUtGetNodeName (ObjDesc->Mutex.Node))); |
|
Lines 503-516
AcpiExReleaseMutex (
Link Here
|
| 503 |
* The Mutex is owned, but this thread must be the owner. |
506 |
* The Mutex is owned, but this thread must be the owner. |
| 504 |
* Special case for Global Lock, any thread can release |
507 |
* Special case for Global Lock, any thread can release |
| 505 |
*/ |
508 |
*/ |
| 506 |
if ((ObjDesc->Mutex.OwnerThread->ThreadId != WalkState->Thread->ThreadId) && |
509 |
if ((OwnerThread->ThreadId != WalkState->Thread->ThreadId) && |
| 507 |
(ObjDesc != AcpiGbl_GlobalLockMutex)) |
510 |
(ObjDesc != AcpiGbl_GlobalLockMutex)) |
| 508 |
{ |
511 |
{ |
| 509 |
ACPI_ERROR ((AE_INFO, |
512 |
ACPI_ERROR ((AE_INFO, |
| 510 |
"Thread %p cannot release Mutex [%4.4s] acquired by thread %p", |
513 |
"Thread %p cannot release Mutex [%4.4s] acquired by thread %p", |
| 511 |
ACPI_CAST_PTR (void, WalkState->Thread->ThreadId), |
514 |
ACPI_CAST_PTR (void, WalkState->Thread->ThreadId), |
| 512 |
AcpiUtGetNodeName (ObjDesc->Mutex.Node), |
515 |
AcpiUtGetNodeName (ObjDesc->Mutex.Node), |
| 513 |
ACPI_CAST_PTR (void, ObjDesc->Mutex.OwnerThread->ThreadId))); |
516 |
ACPI_CAST_PTR (void, OwnerThread->ThreadId))); |
| 514 |
return_ACPI_STATUS (AE_AML_NOT_OWNER); |
517 |
return_ACPI_STATUS (AE_AML_NOT_OWNER); |
| 515 |
} |
518 |
} |
| 516 |
|
519 |
|
|
Lines 521-527
AcpiExReleaseMutex (
Link Here
|
| 521 |
* different level can only mean that the mutex ordering rule is being |
524 |
* different level can only mean that the mutex ordering rule is being |
| 522 |
* violated. This behavior is clarified in ACPI 4.0 specification. |
525 |
* violated. This behavior is clarified in ACPI 4.0 specification. |
| 523 |
*/ |
526 |
*/ |
| 524 |
if (ObjDesc->Mutex.SyncLevel != WalkState->Thread->CurrentSyncLevel) |
527 |
if (ObjDesc->Mutex.SyncLevel != OwnerThread->CurrentSyncLevel) |
| 525 |
{ |
528 |
{ |
| 526 |
ACPI_ERROR ((AE_INFO, |
529 |
ACPI_ERROR ((AE_INFO, |
| 527 |
"Cannot release Mutex [%4.4s], SyncLevel mismatch: mutex %d current %d", |
530 |
"Cannot release Mutex [%4.4s], SyncLevel mismatch: mutex %d current %d", |
|
Lines 536-542
AcpiExReleaseMutex (
Link Here
|
| 536 |
* acquired, but are not released in reverse order. |
539 |
* acquired, but are not released in reverse order. |
| 537 |
*/ |
540 |
*/ |
| 538 |
PreviousSyncLevel = |
541 |
PreviousSyncLevel = |
| 539 |
WalkState->Thread->AcquiredMutexList->Mutex.OriginalSyncLevel; |
542 |
OwnerThread->AcquiredMutexList->Mutex.OriginalSyncLevel; |
| 540 |
|
543 |
|
| 541 |
Status = AcpiExReleaseMutexObject (ObjDesc); |
544 |
Status = AcpiExReleaseMutexObject (ObjDesc); |
| 542 |
if (ACPI_FAILURE (Status)) |
545 |
if (ACPI_FAILURE (Status)) |
|
Lines 548-554
AcpiExReleaseMutex (
Link Here
|
| 548 |
{ |
551 |
{ |
| 549 |
/* Restore the previous SyncLevel */ |
552 |
/* Restore the previous SyncLevel */ |
| 550 |
|
553 |
|
| 551 |
WalkState->Thread->CurrentSyncLevel = PreviousSyncLevel; |
554 |
OwnerThread->CurrentSyncLevel = PreviousSyncLevel; |
| 552 |
} |
555 |
} |
| 553 |
return_ACPI_STATUS (Status); |
556 |
return_ACPI_STATUS (Status); |
| 554 |
} |
557 |
} |