Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /****************************************************************************** |
2 | * | |
3 | * Module Name: exmutex - ASL Mutex Acquire/Release functions | |
4 | * | |
5 | *****************************************************************************/ | |
6 | ||
7 | /* | |
77848130 | 8 | * Copyright (C) 2000 - 2012, Intel Corp. |
1da177e4 LT |
9 | * All rights reserved. |
10 | * | |
11 | * Redistribution and use in source and binary forms, with or without | |
12 | * modification, are permitted provided that the following conditions | |
13 | * are met: | |
14 | * 1. Redistributions of source code must retain the above copyright | |
15 | * notice, this list of conditions, and the following disclaimer, | |
16 | * without modification. | |
17 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer | |
18 | * substantially similar to the "NO WARRANTY" disclaimer below | |
19 | * ("Disclaimer") and any redistribution must be conditioned upon | |
20 | * including a substantially similar Disclaimer requirement for further | |
21 | * binary redistribution. | |
22 | * 3. Neither the names of the above-listed copyright holders nor the names | |
23 | * of any contributors may be used to endorse or promote products derived | |
24 | * from this software without specific prior written permission. | |
25 | * | |
26 | * Alternatively, this software may be distributed under the terms of the | |
27 | * GNU General Public License ("GPL") version 2 as published by the Free | |
28 | * Software Foundation. | |
29 | * | |
30 | * NO WARRANTY | |
31 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
32 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
33 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR | |
34 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
35 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
36 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
37 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
38 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | |
39 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | |
40 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
41 | * POSSIBILITY OF SUCH DAMAGES. | |
42 | */ | |
43 | ||
1da177e4 | 44 | #include <acpi/acpi.h> |
e2f7a777 LB |
45 | #include "accommon.h" |
46 | #include "acinterp.h" | |
47 | #include "acevents.h" | |
1da177e4 LT |
48 | |
49 | #define _COMPONENT ACPI_EXECUTER | |
4be44fcd | 50 | ACPI_MODULE_NAME("exmutex") |
1da177e4 | 51 | |
44f6c012 | 52 | /* Local prototypes */ |
44f6c012 | 53 | static void |
4be44fcd LB |
54 | acpi_ex_link_mutex(union acpi_operand_object *obj_desc, |
55 | struct acpi_thread_state *thread); | |
1da177e4 LT |
56 | |
57 | /******************************************************************************* | |
58 | * | |
59 | * FUNCTION: acpi_ex_unlink_mutex | |
60 | * | |
61 | * PARAMETERS: obj_desc - The mutex to be unlinked | |
62 | * | |
44f6c012 | 63 | * RETURN: None |
1da177e4 | 64 | * |
b229cf92 | 65 | * DESCRIPTION: Remove a mutex from the "AcquiredMutex" list |
1da177e4 LT |
66 | * |
67 | ******************************************************************************/ | |
68 | ||
262a7a28 | 69 | void acpi_ex_unlink_mutex(union acpi_operand_object *obj_desc) |
1da177e4 | 70 | { |
262a7a28 LB |
71 | struct acpi_thread_state *thread = obj_desc->mutex.owner_thread; |
72 | ||
1da177e4 LT |
73 | if (!thread) { |
74 | return; | |
75 | } | |
76 | ||
77 | /* Doubly linked list */ | |
78 | ||
79 | if (obj_desc->mutex.next) { | |
80 | (obj_desc->mutex.next)->mutex.prev = obj_desc->mutex.prev; | |
81 | } | |
82 | ||
83 | if (obj_desc->mutex.prev) { | |
84 | (obj_desc->mutex.prev)->mutex.next = obj_desc->mutex.next; | |
10a3b461 BM |
85 | |
86 | /* | |
a7499bc8 BM |
87 | * Migrate the previous sync level associated with this mutex to |
88 | * the previous mutex on the list so that it may be preserved. | |
89 | * This handles the case where several mutexes have been acquired | |
90 | * at the same level, but are not released in opposite order. | |
10a3b461 BM |
91 | */ |
92 | (obj_desc->mutex.prev)->mutex.original_sync_level = | |
93 | obj_desc->mutex.original_sync_level; | |
4be44fcd | 94 | } else { |
1da177e4 LT |
95 | thread->acquired_mutex_list = obj_desc->mutex.next; |
96 | } | |
97 | } | |
98 | ||
1da177e4 LT |
99 | /******************************************************************************* |
100 | * | |
101 | * FUNCTION: acpi_ex_link_mutex | |
102 | * | |
a7499bc8 | 103 | * PARAMETERS: obj_desc - The mutex to be linked |
ba494bee | 104 | * thread - Current executing thread object |
1da177e4 | 105 | * |
44f6c012 | 106 | * RETURN: None |
1da177e4 | 107 | * |
b229cf92 | 108 | * DESCRIPTION: Add a mutex to the "AcquiredMutex" list for this walk |
1da177e4 LT |
109 | * |
110 | ******************************************************************************/ | |
111 | ||
44f6c012 | 112 | static void |
4be44fcd LB |
113 | acpi_ex_link_mutex(union acpi_operand_object *obj_desc, |
114 | struct acpi_thread_state *thread) | |
1da177e4 | 115 | { |
4be44fcd | 116 | union acpi_operand_object *list_head; |
1da177e4 LT |
117 | |
118 | list_head = thread->acquired_mutex_list; | |
119 | ||
120 | /* This object will be the first object in the list */ | |
121 | ||
122 | obj_desc->mutex.prev = NULL; | |
123 | obj_desc->mutex.next = list_head; | |
124 | ||
125 | /* Update old first object to point back to this object */ | |
126 | ||
127 | if (list_head) { | |
128 | list_head->mutex.prev = obj_desc; | |
129 | } | |
130 | ||
131 | /* Update list head */ | |
132 | ||
133 | thread->acquired_mutex_list = obj_desc; | |
134 | } | |
135 | ||
ba886cd4 BM |
136 | /******************************************************************************* |
137 | * | |
138 | * FUNCTION: acpi_ex_acquire_mutex_object | |
139 | * | |
ba494bee | 140 | * PARAMETERS: timeout - Timeout in milliseconds |
ba886cd4 | 141 | * obj_desc - Mutex object |
a7499bc8 | 142 | * thread_id - Current thread state |
ba886cd4 BM |
143 | * |
144 | * RETURN: Status | |
145 | * | |
91e38d10 BM |
146 | * DESCRIPTION: Acquire an AML mutex, low-level interface. Provides a common |
147 | * path that supports multiple acquires by the same thread. | |
148 | * | |
149 | * MUTEX: Interpreter must be locked | |
150 | * | |
151 | * NOTE: This interface is called from three places: | |
152 | * 1) From acpi_ex_acquire_mutex, via an AML Acquire() operator | |
153 | * 2) From acpi_ex_acquire_global_lock when an AML Field access requires the | |
154 | * global lock | |
155 | * 3) From the external interface, acpi_acquire_global_lock | |
ba886cd4 BM |
156 | * |
157 | ******************************************************************************/ | |
158 | ||
159 | acpi_status | |
160 | acpi_ex_acquire_mutex_object(u16 timeout, | |
161 | union acpi_operand_object *obj_desc, | |
162 | acpi_thread_id thread_id) | |
163 | { | |
164 | acpi_status status; | |
165 | ||
166 | ACPI_FUNCTION_TRACE_PTR(ex_acquire_mutex_object, obj_desc); | |
167 | ||
f02e9fa1 BM |
168 | if (!obj_desc) { |
169 | return_ACPI_STATUS(AE_BAD_PARAMETER); | |
170 | } | |
171 | ||
ba886cd4 BM |
172 | /* Support for multiple acquires by the owning thread */ |
173 | ||
174 | if (obj_desc->mutex.thread_id == thread_id) { | |
175 | /* | |
176 | * The mutex is already owned by this thread, just increment the | |
177 | * acquisition depth | |
178 | */ | |
179 | obj_desc->mutex.acquisition_depth++; | |
180 | return_ACPI_STATUS(AE_OK); | |
181 | } | |
182 | ||
183 | /* Acquire the mutex, wait if necessary. Special case for Global Lock */ | |
184 | ||
185 | if (obj_desc == acpi_gbl_global_lock_mutex) { | |
186 | status = acpi_ev_acquire_global_lock(timeout); | |
187 | } else { | |
188 | status = acpi_ex_system_wait_mutex(obj_desc->mutex.os_mutex, | |
189 | timeout); | |
190 | } | |
191 | ||
192 | if (ACPI_FAILURE(status)) { | |
193 | ||
194 | /* Includes failure from a timeout on time_desc */ | |
195 | ||
196 | return_ACPI_STATUS(status); | |
197 | } | |
198 | ||
91e38d10 | 199 | /* Acquired the mutex: update mutex object */ |
ba886cd4 BM |
200 | |
201 | obj_desc->mutex.thread_id = thread_id; | |
202 | obj_desc->mutex.acquisition_depth = 1; | |
203 | obj_desc->mutex.original_sync_level = 0; | |
204 | obj_desc->mutex.owner_thread = NULL; /* Used only for AML Acquire() */ | |
205 | ||
206 | return_ACPI_STATUS(AE_OK); | |
207 | } | |
208 | ||
1da177e4 LT |
209 | /******************************************************************************* |
210 | * | |
211 | * FUNCTION: acpi_ex_acquire_mutex | |
212 | * | |
44f6c012 RM |
213 | * PARAMETERS: time_desc - Timeout integer |
214 | * obj_desc - Mutex object | |
215 | * walk_state - Current method execution state | |
1da177e4 LT |
216 | * |
217 | * RETURN: Status | |
218 | * | |
219 | * DESCRIPTION: Acquire an AML mutex | |
220 | * | |
221 | ******************************************************************************/ | |
222 | ||
223 | acpi_status | |
4be44fcd LB |
224 | acpi_ex_acquire_mutex(union acpi_operand_object *time_desc, |
225 | union acpi_operand_object *obj_desc, | |
226 | struct acpi_walk_state *walk_state) | |
1da177e4 | 227 | { |
4be44fcd | 228 | acpi_status status; |
1da177e4 | 229 | |
b229cf92 | 230 | ACPI_FUNCTION_TRACE_PTR(ex_acquire_mutex, obj_desc); |
1da177e4 LT |
231 | |
232 | if (!obj_desc) { | |
4be44fcd | 233 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
1da177e4 LT |
234 | } |
235 | ||
a7499bc8 | 236 | /* Must have a valid thread state struct */ |
1da177e4 LT |
237 | |
238 | if (!walk_state->thread) { | |
b8e4d893 BM |
239 | ACPI_ERROR((AE_INFO, |
240 | "Cannot acquire Mutex [%4.4s], null thread info", | |
241 | acpi_ut_get_node_name(obj_desc->mutex.node))); | |
4be44fcd | 242 | return_ACPI_STATUS(AE_AML_INTERNAL); |
1da177e4 LT |
243 | } |
244 | ||
245 | /* | |
91e38d10 | 246 | * Current sync level must be less than or equal to the sync level of the |
967440e3 | 247 | * mutex. This mechanism provides some deadlock prevention |
1da177e4 LT |
248 | */ |
249 | if (walk_state->thread->current_sync_level > obj_desc->mutex.sync_level) { | |
b8e4d893 | 250 | ACPI_ERROR((AE_INFO, |
f6a22b0b | 251 | "Cannot acquire Mutex [%4.4s], current SyncLevel is too large (%u)", |
967440e3 BM |
252 | acpi_ut_get_node_name(obj_desc->mutex.node), |
253 | walk_state->thread->current_sync_level)); | |
4be44fcd | 254 | return_ACPI_STATUS(AE_AML_MUTEX_ORDER); |
1da177e4 LT |
255 | } |
256 | ||
ba886cd4 BM |
257 | status = acpi_ex_acquire_mutex_object((u16) time_desc->integer.value, |
258 | obj_desc, | |
259 | walk_state->thread->thread_id); | |
260 | if (ACPI_SUCCESS(status) && obj_desc->mutex.acquisition_depth == 1) { | |
91e38d10 BM |
261 | |
262 | /* Save Thread object, original/current sync levels */ | |
263 | ||
ba886cd4 BM |
264 | obj_desc->mutex.owner_thread = walk_state->thread; |
265 | obj_desc->mutex.original_sync_level = | |
266 | walk_state->thread->current_sync_level; | |
267 | walk_state->thread->current_sync_level = | |
268 | obj_desc->mutex.sync_level; | |
1da177e4 | 269 | |
ba886cd4 BM |
270 | /* Link the mutex to the current thread for force-unlock at method exit */ |
271 | ||
272 | acpi_ex_link_mutex(obj_desc, walk_state->thread); | |
1da177e4 LT |
273 | } |
274 | ||
ba886cd4 BM |
275 | return_ACPI_STATUS(status); |
276 | } | |
c81da666 | 277 | |
ba886cd4 BM |
278 | /******************************************************************************* |
279 | * | |
280 | * FUNCTION: acpi_ex_release_mutex_object | |
281 | * | |
282 | * PARAMETERS: obj_desc - The object descriptor for this op | |
283 | * | |
284 | * RETURN: Status | |
285 | * | |
286 | * DESCRIPTION: Release a previously acquired Mutex, low level interface. | |
91e38d10 BM |
287 | * Provides a common path that supports multiple releases (after |
288 | * previous multiple acquires) by the same thread. | |
289 | * | |
290 | * MUTEX: Interpreter must be locked | |
291 | * | |
292 | * NOTE: This interface is called from three places: | |
293 | * 1) From acpi_ex_release_mutex, via an AML Acquire() operator | |
294 | * 2) From acpi_ex_release_global_lock when an AML Field access requires the | |
295 | * global lock | |
296 | * 3) From the external interface, acpi_release_global_lock | |
ba886cd4 BM |
297 | * |
298 | ******************************************************************************/ | |
1da177e4 | 299 | |
ba886cd4 BM |
300 | acpi_status acpi_ex_release_mutex_object(union acpi_operand_object *obj_desc) |
301 | { | |
302 | acpi_status status = AE_OK; | |
52fc0b02 | 303 | |
ba886cd4 | 304 | ACPI_FUNCTION_TRACE(ex_release_mutex_object); |
1da177e4 | 305 | |
f02e9fa1 | 306 | if (obj_desc->mutex.acquisition_depth == 0) { |
68aafc35 | 307 | return_ACPI_STATUS(AE_NOT_ACQUIRED); |
f02e9fa1 BM |
308 | } |
309 | ||
ba886cd4 BM |
310 | /* Match multiple Acquires with multiple Releases */ |
311 | ||
312 | obj_desc->mutex.acquisition_depth--; | |
313 | if (obj_desc->mutex.acquisition_depth != 0) { | |
314 | ||
315 | /* Just decrement the depth and return */ | |
316 | ||
317 | return_ACPI_STATUS(AE_OK); | |
1da177e4 LT |
318 | } |
319 | ||
ba886cd4 | 320 | if (obj_desc->mutex.owner_thread) { |
1da177e4 | 321 | |
ba886cd4 BM |
322 | /* Unlink the mutex from the owner's list */ |
323 | ||
324 | acpi_ex_unlink_mutex(obj_desc); | |
325 | obj_desc->mutex.owner_thread = NULL; | |
326 | } | |
1da177e4 | 327 | |
ba886cd4 | 328 | /* Release the mutex, special case for Global Lock */ |
1da177e4 | 329 | |
ba886cd4 BM |
330 | if (obj_desc == acpi_gbl_global_lock_mutex) { |
331 | status = acpi_ev_release_global_lock(); | |
332 | } else { | |
333 | acpi_os_release_mutex(obj_desc->mutex.os_mutex); | |
334 | } | |
1da177e4 | 335 | |
91e38d10 BM |
336 | /* Clear mutex info */ |
337 | ||
28eb3fcf | 338 | obj_desc->mutex.thread_id = 0; |
ba886cd4 | 339 | return_ACPI_STATUS(status); |
1da177e4 LT |
340 | } |
341 | ||
1da177e4 LT |
342 | /******************************************************************************* |
343 | * | |
344 | * FUNCTION: acpi_ex_release_mutex | |
345 | * | |
346 | * PARAMETERS: obj_desc - The object descriptor for this op | |
44f6c012 | 347 | * walk_state - Current method execution state |
1da177e4 LT |
348 | * |
349 | * RETURN: Status | |
350 | * | |
351 | * DESCRIPTION: Release a previously acquired Mutex. | |
352 | * | |
353 | ******************************************************************************/ | |
354 | ||
355 | acpi_status | |
4be44fcd LB |
356 | acpi_ex_release_mutex(union acpi_operand_object *obj_desc, |
357 | struct acpi_walk_state *walk_state) | |
1da177e4 | 358 | { |
c81da666 | 359 | acpi_status status = AE_OK; |
10a3b461 | 360 | u8 previous_sync_level; |
e0f40281 | 361 | struct acpi_thread_state *owner_thread; |
1da177e4 | 362 | |
b229cf92 | 363 | ACPI_FUNCTION_TRACE(ex_release_mutex); |
1da177e4 LT |
364 | |
365 | if (!obj_desc) { | |
4be44fcd | 366 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
1da177e4 LT |
367 | } |
368 | ||
e0f40281 LM |
369 | owner_thread = obj_desc->mutex.owner_thread; |
370 | ||
1da177e4 LT |
371 | /* The mutex must have been previously acquired in order to release it */ |
372 | ||
e0f40281 | 373 | if (!owner_thread) { |
b8e4d893 BM |
374 | ACPI_ERROR((AE_INFO, |
375 | "Cannot release Mutex [%4.4s], not acquired", | |
376 | acpi_ut_get_node_name(obj_desc->mutex.node))); | |
4be44fcd | 377 | return_ACPI_STATUS(AE_AML_MUTEX_NOT_ACQUIRED); |
1da177e4 LT |
378 | } |
379 | ||
38bcb37a | 380 | /* Must have a valid thread. */ |
fbc3be2a DC |
381 | if (!walk_state->thread) { |
382 | ACPI_ERROR((AE_INFO, | |
383 | "Cannot release Mutex [%4.4s], null thread info", | |
384 | acpi_ut_get_node_name(obj_desc->mutex.node))); | |
385 | return_ACPI_STATUS(AE_AML_INTERNAL); | |
386 | } | |
387 | ||
1da177e4 LT |
388 | /* |
389 | * The Mutex is owned, but this thread must be the owner. | |
390 | * Special case for Global Lock, any thread can release | |
391 | */ | |
e0f40281 LM |
392 | if ((owner_thread->thread_id != walk_state->thread->thread_id) && |
393 | (obj_desc != acpi_gbl_global_lock_mutex)) { | |
b8e4d893 | 394 | ACPI_ERROR((AE_INFO, |
28eb3fcf LM |
395 | "Thread %u cannot release Mutex [%4.4s] acquired by thread %u", |
396 | (u32)walk_state->thread->thread_id, | |
b8e4d893 | 397 | acpi_ut_get_node_name(obj_desc->mutex.node), |
28eb3fcf | 398 | (u32)owner_thread->thread_id)); |
4be44fcd | 399 | return_ACPI_STATUS(AE_AML_NOT_OWNER); |
1da177e4 LT |
400 | } |
401 | ||
402 | /* | |
315c7288 BM |
403 | * The sync level of the mutex must be equal to the current sync level. In |
404 | * other words, the current level means that at least one mutex at that | |
405 | * level is currently being held. Attempting to release a mutex of a | |
406 | * different level can only mean that the mutex ordering rule is being | |
407 | * violated. This behavior is clarified in ACPI 4.0 specification. | |
1da177e4 | 408 | */ |
e0f40281 | 409 | if (obj_desc->mutex.sync_level != owner_thread->current_sync_level) { |
b8e4d893 | 410 | ACPI_ERROR((AE_INFO, |
f6a22b0b | 411 | "Cannot release Mutex [%4.4s], SyncLevel mismatch: mutex %u current %u", |
f02e9fa1 BM |
412 | acpi_ut_get_node_name(obj_desc->mutex.node), |
413 | obj_desc->mutex.sync_level, | |
414 | walk_state->thread->current_sync_level)); | |
4be44fcd | 415 | return_ACPI_STATUS(AE_AML_MUTEX_ORDER); |
1da177e4 LT |
416 | } |
417 | ||
10a3b461 BM |
418 | /* |
419 | * Get the previous sync_level from the head of the acquired mutex list. | |
420 | * This handles the case where several mutexes at the same level have been | |
421 | * acquired, but are not released in reverse order. | |
422 | */ | |
423 | previous_sync_level = | |
e0f40281 | 424 | owner_thread->acquired_mutex_list->mutex.original_sync_level; |
10a3b461 | 425 | |
ba886cd4 | 426 | status = acpi_ex_release_mutex_object(obj_desc); |
315c7288 BM |
427 | if (ACPI_FAILURE(status)) { |
428 | return_ACPI_STATUS(status); | |
429 | } | |
1da177e4 | 430 | |
f02e9fa1 | 431 | if (obj_desc->mutex.acquisition_depth == 0) { |
1da177e4 | 432 | |
315c7288 | 433 | /* Restore the previous sync_level */ |
f02e9fa1 | 434 | |
e0f40281 | 435 | owner_thread->current_sync_level = previous_sync_level; |
f02e9fa1 | 436 | } |
a7499bc8 | 437 | |
4be44fcd | 438 | return_ACPI_STATUS(status); |
1da177e4 LT |
439 | } |
440 | ||
1da177e4 LT |
441 | /******************************************************************************* |
442 | * | |
443 | * FUNCTION: acpi_ex_release_all_mutexes | |
444 | * | |
ba494bee | 445 | * PARAMETERS: thread - Current executing thread object |
1da177e4 LT |
446 | * |
447 | * RETURN: Status | |
448 | * | |
44f6c012 | 449 | * DESCRIPTION: Release all mutexes held by this thread |
1da177e4 | 450 | * |
f70a5e7b BM |
451 | * NOTE: This function is called as the thread is exiting the interpreter. |
452 | * Mutexes are not released when an individual control method is exited, but | |
453 | * only when the parent thread actually exits the interpreter. This allows one | |
454 | * method to acquire a mutex, and a different method to release it, as long as | |
455 | * this is performed underneath a single parent control method. | |
456 | * | |
1da177e4 LT |
457 | ******************************************************************************/ |
458 | ||
4be44fcd | 459 | void acpi_ex_release_all_mutexes(struct acpi_thread_state *thread) |
1da177e4 | 460 | { |
4be44fcd | 461 | union acpi_operand_object *next = thread->acquired_mutex_list; |
c81da666 | 462 | union acpi_operand_object *obj_desc; |
1da177e4 | 463 | |
2489ef01 | 464 | ACPI_FUNCTION_NAME(ex_release_all_mutexes); |
1da177e4 LT |
465 | |
466 | /* Traverse the list of owned mutexes, releasing each one */ | |
467 | ||
468 | while (next) { | |
c81da666 BM |
469 | obj_desc = next; |
470 | next = obj_desc->mutex.next; | |
471 | ||
472 | obj_desc->mutex.prev = NULL; | |
473 | obj_desc->mutex.next = NULL; | |
f70a5e7b | 474 | obj_desc->mutex.acquisition_depth = 0; |
c81da666 | 475 | |
2489ef01 BM |
476 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
477 | "Force-releasing held mutex: %p\n", | |
478 | obj_desc)); | |
479 | ||
c81da666 | 480 | /* Release the mutex, special case for Global Lock */ |
1da177e4 | 481 | |
ba886cd4 | 482 | if (obj_desc == acpi_gbl_global_lock_mutex) { |
1da177e4 | 483 | |
c81da666 | 484 | /* Ignore errors */ |
1da177e4 | 485 | |
c81da666 BM |
486 | (void)acpi_ev_release_global_lock(); |
487 | } else { | |
488 | acpi_os_release_mutex(obj_desc->mutex.os_mutex); | |
1da177e4 LT |
489 | } |
490 | ||
491 | /* Mark mutex unowned */ | |
492 | ||
262a7a28 | 493 | obj_desc->mutex.owner_thread = NULL; |
28eb3fcf | 494 | obj_desc->mutex.thread_id = 0; |
1da177e4 LT |
495 | |
496 | /* Update Thread sync_level (Last mutex is the important one) */ | |
497 | ||
c81da666 BM |
498 | thread->current_sync_level = |
499 | obj_desc->mutex.original_sync_level; | |
1da177e4 LT |
500 | } |
501 | } |