exmutex.c (204773) | exmutex.c (206117) |
---|---|
1 2/****************************************************************************** 3 * 4 * Module Name: exmutex - ASL Mutex Acquire/Release functions 5 * 6 *****************************************************************************/ 7 8/****************************************************************************** --- 154 unchanged lines hidden (view full) --- 163 (ObjDesc->Mutex.Next)->Mutex.Prev = ObjDesc->Mutex.Prev; 164 } 165 166 if (ObjDesc->Mutex.Prev) 167 { 168 (ObjDesc->Mutex.Prev)->Mutex.Next = ObjDesc->Mutex.Next; 169 170 /* | 1 2/****************************************************************************** 3 * 4 * Module Name: exmutex - ASL Mutex Acquire/Release functions 5 * 6 *****************************************************************************/ 7 8/****************************************************************************** --- 154 unchanged lines hidden (view full) --- 163 (ObjDesc->Mutex.Next)->Mutex.Prev = ObjDesc->Mutex.Prev; 164 } 165 166 if (ObjDesc->Mutex.Prev) 167 { 168 (ObjDesc->Mutex.Prev)->Mutex.Next = ObjDesc->Mutex.Next; 169 170 /* |
171 * Migrate the previous sync level associated with this mutex to the 172 * previous mutex on the list so that it may be preserved. This handles 173 * the case where several mutexes have been acquired at the same level, 174 * but are not released in opposite order. | 171 * Migrate the previous sync level associated with this mutex to 172 * the previous mutex on the list so that it may be preserved. 173 * This handles the case where several mutexes have been acquired 174 * at the same level, but are not released in opposite order. |
175 */ 176 (ObjDesc->Mutex.Prev)->Mutex.OriginalSyncLevel = 177 ObjDesc->Mutex.OriginalSyncLevel; 178 } 179 else 180 { 181 Thread->AcquiredMutexList = ObjDesc->Mutex.Next; 182 } 183} 184 185 186/******************************************************************************* 187 * 188 * FUNCTION: AcpiExLinkMutex 189 * | 175 */ 176 (ObjDesc->Mutex.Prev)->Mutex.OriginalSyncLevel = 177 ObjDesc->Mutex.OriginalSyncLevel; 178 } 179 else 180 { 181 Thread->AcquiredMutexList = ObjDesc->Mutex.Next; 182 } 183} 184 185 186/******************************************************************************* 187 * 188 * FUNCTION: AcpiExLinkMutex 189 * |
190 * PARAMETERS: ObjDesc - The mutex to be linked 191 * Thread - Current executing thread object | 190 * PARAMETERS: ObjDesc - The mutex to be linked 191 * Thread - Current executing thread object |
192 * 193 * RETURN: None 194 * 195 * DESCRIPTION: Add a mutex to the "AcquiredMutex" list for this walk 196 * 197 ******************************************************************************/ 198 199static void --- 23 unchanged lines hidden (view full) --- 223 Thread->AcquiredMutexList = ObjDesc; 224} 225 226 227/******************************************************************************* 228 * 229 * FUNCTION: AcpiExAcquireMutexObject 230 * | 192 * 193 * RETURN: None 194 * 195 * DESCRIPTION: Add a mutex to the "AcquiredMutex" list for this walk 196 * 197 ******************************************************************************/ 198 199static void --- 23 unchanged lines hidden (view full) --- 223 Thread->AcquiredMutexList = ObjDesc; 224} 225 226 227/******************************************************************************* 228 * 229 * FUNCTION: AcpiExAcquireMutexObject 230 * |
231 * PARAMETERS: TimeDesc - Timeout in milliseconds | 231 * PARAMETERS: Timeout - Timeout in milliseconds |
232 * ObjDesc - Mutex object | 232 * ObjDesc - Mutex object |
233 * Thread - Current thread state | 233 * ThreadId - Current thread state |
234 * 235 * RETURN: Status 236 * 237 * DESCRIPTION: Acquire an AML mutex, low-level interface. Provides a common 238 * path that supports multiple acquires by the same thread. 239 * 240 * MUTEX: Interpreter must be locked 241 * --- 90 unchanged lines hidden (view full) --- 332 ACPI_FUNCTION_TRACE_PTR (ExAcquireMutex, ObjDesc); 333 334 335 if (!ObjDesc) 336 { 337 return_ACPI_STATUS (AE_BAD_PARAMETER); 338 } 339 | 234 * 235 * RETURN: Status 236 * 237 * DESCRIPTION: Acquire an AML mutex, low-level interface. Provides a common 238 * path that supports multiple acquires by the same thread. 239 * 240 * MUTEX: Interpreter must be locked 241 * --- 90 unchanged lines hidden (view full) --- 332 ACPI_FUNCTION_TRACE_PTR (ExAcquireMutex, ObjDesc); 333 334 335 if (!ObjDesc) 336 { 337 return_ACPI_STATUS (AE_BAD_PARAMETER); 338 } 339 |
340 /* Must have a valid thread ID */ | 340 /* Must have a valid thread state struct */ |
341 342 if (!WalkState->Thread) 343 { | 341 342 if (!WalkState->Thread) 343 { |
344 ACPI_ERROR ((AE_INFO, "Cannot acquire Mutex [%4.4s], null thread info", | 344 ACPI_ERROR ((AE_INFO, 345 "Cannot acquire Mutex [%4.4s], null thread info", |
345 AcpiUtGetNodeName (ObjDesc->Mutex.Node))); 346 return_ACPI_STATUS (AE_AML_INTERNAL); 347 } 348 349 /* 350 * Current sync level must be less than or equal to the sync level of the 351 * mutex. This mechanism provides some deadlock prevention 352 */ --- 130 unchanged lines hidden (view full) --- 483 } 484 485 OwnerThread = ObjDesc->Mutex.OwnerThread; 486 487 /* The mutex must have been previously acquired in order to release it */ 488 489 if (!OwnerThread) 490 { | 346 AcpiUtGetNodeName (ObjDesc->Mutex.Node))); 347 return_ACPI_STATUS (AE_AML_INTERNAL); 348 } 349 350 /* 351 * Current sync level must be less than or equal to the sync level of the 352 * mutex. This mechanism provides some deadlock prevention 353 */ --- 130 unchanged lines hidden (view full) --- 484 } 485 486 OwnerThread = ObjDesc->Mutex.OwnerThread; 487 488 /* The mutex must have been previously acquired in order to release it */ 489 490 if (!OwnerThread) 491 { |
491 ACPI_ERROR ((AE_INFO, "Cannot release Mutex [%4.4s], not acquired", | 492 ACPI_ERROR ((AE_INFO, 493 "Cannot release Mutex [%4.4s], not acquired", |
492 AcpiUtGetNodeName (ObjDesc->Mutex.Node))); 493 return_ACPI_STATUS (AE_AML_MUTEX_NOT_ACQUIRED); 494 } 495 496 /* Must have a valid thread ID */ 497 498 if (!WalkState->Thread) 499 { | 494 AcpiUtGetNodeName (ObjDesc->Mutex.Node))); 495 return_ACPI_STATUS (AE_AML_MUTEX_NOT_ACQUIRED); 496 } 497 498 /* Must have a valid thread ID */ 499 500 if (!WalkState->Thread) 501 { |
500 ACPI_ERROR ((AE_INFO, "Cannot release Mutex [%4.4s], null thread info", | 502 ACPI_ERROR ((AE_INFO, 503 "Cannot release Mutex [%4.4s], null thread info", |
501 AcpiUtGetNodeName (ObjDesc->Mutex.Node))); 502 return_ACPI_STATUS (AE_AML_INTERNAL); 503 } 504 505 /* 506 * The Mutex is owned, but this thread must be the owner. 507 * Special case for Global Lock, any thread can release 508 */ --- 39 unchanged lines hidden (view full) --- 548 } 549 550 if (ObjDesc->Mutex.AcquisitionDepth == 0) 551 { 552 /* Restore the previous SyncLevel */ 553 554 OwnerThread->CurrentSyncLevel = PreviousSyncLevel; 555 } | 504 AcpiUtGetNodeName (ObjDesc->Mutex.Node))); 505 return_ACPI_STATUS (AE_AML_INTERNAL); 506 } 507 508 /* 509 * The Mutex is owned, but this thread must be the owner. 510 * Special case for Global Lock, any thread can release 511 */ --- 39 unchanged lines hidden (view full) --- 551 } 552 553 if (ObjDesc->Mutex.AcquisitionDepth == 0) 554 { 555 /* Restore the previous SyncLevel */ 556 557 OwnerThread->CurrentSyncLevel = PreviousSyncLevel; 558 } |
559 |
|
556 return_ACPI_STATUS (Status); 557} 558 559 560/******************************************************************************* 561 * 562 * FUNCTION: AcpiExReleaseAllMutexes 563 * | 560 return_ACPI_STATUS (Status); 561} 562 563 564/******************************************************************************* 565 * 566 * FUNCTION: AcpiExReleaseAllMutexes 567 * |
564 * PARAMETERS: Thread - Current executing thread object | 568 * PARAMETERS: Thread - Current executing thread object |
565 * 566 * RETURN: Status 567 * 568 * DESCRIPTION: Release all mutexes held by this thread 569 * 570 * NOTE: This function is called as the thread is exiting the interpreter. 571 * Mutexes are not released when an individual control method is exited, but 572 * only when the parent thread actually exits the interpreter. This allows one --- 42 unchanged lines hidden (view full) --- 615 ObjDesc->Mutex.OwnerThread = NULL; 616 ObjDesc->Mutex.ThreadId = 0; 617 618 /* Update Thread SyncLevel (Last mutex is the important one) */ 619 620 Thread->CurrentSyncLevel = ObjDesc->Mutex.OriginalSyncLevel; 621 } 622} | 569 * 570 * RETURN: Status 571 * 572 * DESCRIPTION: Release all mutexes held by this thread 573 * 574 * NOTE: This function is called as the thread is exiting the interpreter. 575 * Mutexes are not released when an individual control method is exited, but 576 * only when the parent thread actually exits the interpreter. This allows one --- 42 unchanged lines hidden (view full) --- 619 ObjDesc->Mutex.OwnerThread = NULL; 620 ObjDesc->Mutex.ThreadId = 0; 621 622 /* Update Thread SyncLevel (Last mutex is the important one) */ 623 624 Thread->CurrentSyncLevel = ObjDesc->Mutex.OriginalSyncLevel; 625 } 626} |
623 624 | |