diff options
author | Len Brown <len.brown@intel.com> | 2007-05-10 02:49:21 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2007-05-10 02:49:21 -0400 |
commit | 3dd6786f55219f87fd33e153669600d715ca9270 (patch) | |
tree | 305f8389a93bf86df79f4cf8fb0050b1d6008939 /drivers/acpi | |
parent | f697b677620d04d8c77841745727de85f7e948b1 (diff) | |
parent | 88db5e1489f23876a226f5393fd978ddc09dc5f9 (diff) |
Pull bugzilla-8385 into release branch
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/dispatcher/dsmethod.c | 12 | ||||
-rw-r--r-- | drivers/acpi/events/evmisc.c | 11 | ||||
-rw-r--r-- | drivers/acpi/events/evregion.c | 15 | ||||
-rw-r--r-- | drivers/acpi/events/evxface.c | 6 | ||||
-rw-r--r-- | drivers/acpi/executer/excreate.c | 5 | ||||
-rw-r--r-- | drivers/acpi/executer/exdump.c | 2 | ||||
-rw-r--r-- | drivers/acpi/executer/exmutex.c | 36 | ||||
-rw-r--r-- | drivers/acpi/executer/exsystem.c | 30 | ||||
-rw-r--r-- | drivers/acpi/executer/exutils.c | 104 | ||||
-rw-r--r-- | drivers/acpi/namespace/nseval.c | 11 | ||||
-rw-r--r-- | drivers/acpi/namespace/nsinit.c | 7 | ||||
-rw-r--r-- | drivers/acpi/namespace/nsxfeval.c | 11 | ||||
-rw-r--r-- | drivers/acpi/osl.c | 45 | ||||
-rw-r--r-- | drivers/acpi/utilities/utdelete.c | 1 |
14 files changed, 174 insertions, 122 deletions
diff --git a/drivers/acpi/dispatcher/dsmethod.c b/drivers/acpi/dispatcher/dsmethod.c index 1683e5c5b94c..1cbe61905824 100644 --- a/drivers/acpi/dispatcher/dsmethod.c +++ b/drivers/acpi/dispatcher/dsmethod.c | |||
@@ -231,8 +231,10 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node, | |||
231 | * Obtain the method mutex if necessary. Do not acquire mutex for a | 231 | * Obtain the method mutex if necessary. Do not acquire mutex for a |
232 | * recursive call. | 232 | * recursive call. |
233 | */ | 233 | */ |
234 | if (acpi_os_get_thread_id() != | 234 | if (!walk_state || |
235 | obj_desc->method.mutex->mutex.owner_thread_id) { | 235 | !obj_desc->method.mutex->mutex.owner_thread || |
236 | (walk_state->thread != | ||
237 | obj_desc->method.mutex->mutex.owner_thread)) { | ||
236 | /* | 238 | /* |
237 | * Acquire the method mutex. This releases the interpreter if we | 239 | * Acquire the method mutex. This releases the interpreter if we |
238 | * block (and reacquires it before it returns) | 240 | * block (and reacquires it before it returns) |
@@ -246,14 +248,14 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node, | |||
246 | } | 248 | } |
247 | 249 | ||
248 | /* Update the mutex and walk info and save the original sync_level */ | 250 | /* Update the mutex and walk info and save the original sync_level */ |
249 | obj_desc->method.mutex->mutex.owner_thread_id = | ||
250 | acpi_os_get_thread_id(); | ||
251 | 251 | ||
252 | if (walk_state) { | 252 | if (walk_state) { |
253 | obj_desc->method.mutex->mutex. | 253 | obj_desc->method.mutex->mutex. |
254 | original_sync_level = | 254 | original_sync_level = |
255 | walk_state->thread->current_sync_level; | 255 | walk_state->thread->current_sync_level; |
256 | 256 | ||
257 | obj_desc->method.mutex->mutex.owner_thread = | ||
258 | walk_state->thread; | ||
257 | walk_state->thread->current_sync_level = | 259 | walk_state->thread->current_sync_level = |
258 | obj_desc->method.sync_level; | 260 | obj_desc->method.sync_level; |
259 | } else { | 261 | } else { |
@@ -567,7 +569,7 @@ acpi_ds_terminate_control_method(union acpi_operand_object *method_desc, | |||
567 | 569 | ||
568 | acpi_os_release_mutex(method_desc->method.mutex->mutex. | 570 | acpi_os_release_mutex(method_desc->method.mutex->mutex. |
569 | os_mutex); | 571 | os_mutex); |
570 | method_desc->method.mutex->mutex.owner_thread_id = ACPI_MUTEX_NOT_ACQUIRED; | 572 | method_desc->method.mutex->mutex.owner_thread = NULL; |
571 | } | 573 | } |
572 | } | 574 | } |
573 | 575 | ||
diff --git a/drivers/acpi/events/evmisc.c b/drivers/acpi/events/evmisc.c index cae786ca8600..ad447b1d97a3 100644 --- a/drivers/acpi/events/evmisc.c +++ b/drivers/acpi/events/evmisc.c | |||
@@ -196,15 +196,12 @@ acpi_ev_queue_notify_request(struct acpi_namespace_node * node, | |||
196 | notify_info->notify.value = (u16) notify_value; | 196 | notify_info->notify.value = (u16) notify_value; |
197 | notify_info->notify.handler_obj = handler_obj; | 197 | notify_info->notify.handler_obj = handler_obj; |
198 | 198 | ||
199 | acpi_ex_exit_interpreter(); | 199 | status = |
200 | 200 | acpi_os_execute(OSL_NOTIFY_HANDLER, acpi_ev_notify_dispatch, | |
201 | acpi_ev_notify_dispatch(notify_info); | 201 | notify_info); |
202 | |||
203 | status = acpi_ex_enter_interpreter(); | ||
204 | if (ACPI_FAILURE(status)) { | 202 | if (ACPI_FAILURE(status)) { |
205 | return_ACPI_STATUS(status); | 203 | acpi_ut_delete_generic_state(notify_info); |
206 | } | 204 | } |
207 | |||
208 | } | 205 | } |
209 | 206 | ||
210 | if (!handler_obj) { | 207 | if (!handler_obj) { |
diff --git a/drivers/acpi/events/evregion.c b/drivers/acpi/events/evregion.c index 96b0e8431748..e99f0c435a47 100644 --- a/drivers/acpi/events/evregion.c +++ b/drivers/acpi/events/evregion.c | |||
@@ -291,7 +291,6 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, | |||
291 | u32 bit_width, acpi_integer * value) | 291 | u32 bit_width, acpi_integer * value) |
292 | { | 292 | { |
293 | acpi_status status; | 293 | acpi_status status; |
294 | acpi_status status2; | ||
295 | acpi_adr_space_handler handler; | 294 | acpi_adr_space_handler handler; |
296 | acpi_adr_space_setup region_setup; | 295 | acpi_adr_space_setup region_setup; |
297 | union acpi_operand_object *handler_desc; | 296 | union acpi_operand_object *handler_desc; |
@@ -345,7 +344,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, | |||
345 | * setup will potentially execute control methods | 344 | * setup will potentially execute control methods |
346 | * (e.g., _REG method for this region) | 345 | * (e.g., _REG method for this region) |
347 | */ | 346 | */ |
348 | acpi_ex_exit_interpreter(); | 347 | acpi_ex_relinquish_interpreter(); |
349 | 348 | ||
350 | status = region_setup(region_obj, ACPI_REGION_ACTIVATE, | 349 | status = region_setup(region_obj, ACPI_REGION_ACTIVATE, |
351 | handler_desc->address_space.context, | 350 | handler_desc->address_space.context, |
@@ -353,10 +352,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, | |||
353 | 352 | ||
354 | /* Re-enter the interpreter */ | 353 | /* Re-enter the interpreter */ |
355 | 354 | ||
356 | status2 = acpi_ex_enter_interpreter(); | 355 | acpi_ex_reacquire_interpreter(); |
357 | if (ACPI_FAILURE(status2)) { | ||
358 | return_ACPI_STATUS(status2); | ||
359 | } | ||
360 | 356 | ||
361 | /* Check for failure of the Region Setup */ | 357 | /* Check for failure of the Region Setup */ |
362 | 358 | ||
@@ -409,7 +405,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, | |||
409 | * exit the interpreter because the handler *might* block -- we don't | 405 | * exit the interpreter because the handler *might* block -- we don't |
410 | * know what it will do, so we can't hold the lock on the intepreter. | 406 | * know what it will do, so we can't hold the lock on the intepreter. |
411 | */ | 407 | */ |
412 | acpi_ex_exit_interpreter(); | 408 | acpi_ex_relinquish_interpreter(); |
413 | } | 409 | } |
414 | 410 | ||
415 | /* Call the handler */ | 411 | /* Call the handler */ |
@@ -430,10 +426,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, | |||
430 | * We just returned from a non-default handler, we must re-enter the | 426 | * We just returned from a non-default handler, we must re-enter the |
431 | * interpreter | 427 | * interpreter |
432 | */ | 428 | */ |
433 | status2 = acpi_ex_enter_interpreter(); | 429 | acpi_ex_reacquire_interpreter(); |
434 | if (ACPI_FAILURE(status2)) { | ||
435 | return_ACPI_STATUS(status2); | ||
436 | } | ||
437 | } | 430 | } |
438 | 431 | ||
439 | return_ACPI_STATUS(status); | 432 | return_ACPI_STATUS(status); |
diff --git a/drivers/acpi/events/evxface.c b/drivers/acpi/events/evxface.c index a3379bafa676..685a103a3587 100644 --- a/drivers/acpi/events/evxface.c +++ b/drivers/acpi/events/evxface.c | |||
@@ -768,11 +768,9 @@ acpi_status acpi_acquire_global_lock(u16 timeout, u32 * handle) | |||
768 | return (AE_BAD_PARAMETER); | 768 | return (AE_BAD_PARAMETER); |
769 | } | 769 | } |
770 | 770 | ||
771 | status = acpi_ex_enter_interpreter(); | 771 | /* Must lock interpreter to prevent race conditions */ |
772 | if (ACPI_FAILURE(status)) { | ||
773 | return (status); | ||
774 | } | ||
775 | 772 | ||
773 | acpi_ex_enter_interpreter(); | ||
776 | status = acpi_ev_acquire_global_lock(timeout); | 774 | status = acpi_ev_acquire_global_lock(timeout); |
777 | acpi_ex_exit_interpreter(); | 775 | acpi_ex_exit_interpreter(); |
778 | 776 | ||
diff --git a/drivers/acpi/executer/excreate.c b/drivers/acpi/executer/excreate.c index ae97812681a3..7c38528a7e83 100644 --- a/drivers/acpi/executer/excreate.c +++ b/drivers/acpi/executer/excreate.c | |||
@@ -583,10 +583,7 @@ acpi_ex_create_method(u8 * aml_start, | |||
583 | * Get the sync_level. If method is serialized, a mutex will be | 583 | * Get the sync_level. If method is serialized, a mutex will be |
584 | * created for this method when it is parsed. | 584 | * created for this method when it is parsed. |
585 | */ | 585 | */ |
586 | if (acpi_gbl_all_methods_serialized) { | 586 | if (method_flags & AML_METHOD_SERIALIZED) { |
587 | obj_desc->method.sync_level = 0; | ||
588 | obj_desc->method.method_flags |= AML_METHOD_SERIALIZED; | ||
589 | } else if (method_flags & AML_METHOD_SERIALIZED) { | ||
590 | /* | 587 | /* |
591 | * ACPI 1.0: sync_level = 0 | 588 | * ACPI 1.0: sync_level = 0 |
592 | * ACPI 2.0: sync_level = sync_level in method declaration | 589 | * ACPI 2.0: sync_level = sync_level in method declaration |
diff --git a/drivers/acpi/executer/exdump.c b/drivers/acpi/executer/exdump.c index 1a73c14df2c5..68d283fd60e7 100644 --- a/drivers/acpi/executer/exdump.c +++ b/drivers/acpi/executer/exdump.c | |||
@@ -134,7 +134,7 @@ static struct acpi_exdump_info acpi_ex_dump_method[8] = { | |||
134 | static struct acpi_exdump_info acpi_ex_dump_mutex[5] = { | 134 | static struct acpi_exdump_info acpi_ex_dump_mutex[5] = { |
135 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_mutex), NULL}, | 135 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_mutex), NULL}, |
136 | {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(mutex.sync_level), "Sync Level"}, | 136 | {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(mutex.sync_level), "Sync Level"}, |
137 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(mutex.owner_thread_id), "Owner Thread"}, | 137 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(mutex.owner_thread), "Owner Thread"}, |
138 | {ACPI_EXD_UINT16, ACPI_EXD_OFFSET(mutex.acquisition_depth), | 138 | {ACPI_EXD_UINT16, ACPI_EXD_OFFSET(mutex.acquisition_depth), |
139 | "Acquire Depth"}, | 139 | "Acquire Depth"}, |
140 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(mutex.os_mutex), "OsMutex"} | 140 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(mutex.os_mutex), "OsMutex"} |
diff --git a/drivers/acpi/executer/exmutex.c b/drivers/acpi/executer/exmutex.c index 4eb883bda6ae..5101bad5baf8 100644 --- a/drivers/acpi/executer/exmutex.c +++ b/drivers/acpi/executer/exmutex.c | |||
@@ -66,9 +66,10 @@ acpi_ex_link_mutex(union acpi_operand_object *obj_desc, | |||
66 | * | 66 | * |
67 | ******************************************************************************/ | 67 | ******************************************************************************/ |
68 | 68 | ||
69 | void acpi_ex_unlink_mutex(union acpi_operand_object *obj_desc, | 69 | void acpi_ex_unlink_mutex(union acpi_operand_object *obj_desc) |
70 | struct acpi_thread_state *thread) | ||
71 | { | 70 | { |
71 | struct acpi_thread_state *thread = obj_desc->mutex.owner_thread; | ||
72 | |||
72 | if (!thread) { | 73 | if (!thread) { |
73 | return; | 74 | return; |
74 | } | 75 | } |
@@ -173,13 +174,16 @@ acpi_ex_acquire_mutex(union acpi_operand_object *time_desc, | |||
173 | 174 | ||
174 | /* Support for multiple acquires by the owning thread */ | 175 | /* Support for multiple acquires by the owning thread */ |
175 | 176 | ||
176 | if (obj_desc->mutex.owner_thread_id == acpi_os_get_thread_id()) { | 177 | if (obj_desc->mutex.owner_thread) { |
177 | /* | 178 | if (obj_desc->mutex.owner_thread->thread_id == |
178 | * The mutex is already owned by this thread, just increment the | 179 | walk_state->thread->thread_id) { |
179 | * acquisition depth | 180 | /* |
180 | */ | 181 | * The mutex is already owned by this thread, just increment the |
181 | obj_desc->mutex.acquisition_depth++; | 182 | * acquisition depth |
182 | return_ACPI_STATUS(AE_OK); | 183 | */ |
184 | obj_desc->mutex.acquisition_depth++; | ||
185 | return_ACPI_STATUS(AE_OK); | ||
186 | } | ||
183 | } | 187 | } |
184 | 188 | ||
185 | /* Acquire the mutex, wait if necessary. Special case for Global Lock */ | 189 | /* Acquire the mutex, wait if necessary. Special case for Global Lock */ |
@@ -202,7 +206,7 @@ acpi_ex_acquire_mutex(union acpi_operand_object *time_desc, | |||
202 | 206 | ||
203 | /* Have the mutex: update mutex and walk info and save the sync_level */ | 207 | /* Have the mutex: update mutex and walk info and save the sync_level */ |
204 | 208 | ||
205 | obj_desc->mutex.owner_thread_id = acpi_os_get_thread_id(); | 209 | obj_desc->mutex.owner_thread = walk_state->thread; |
206 | obj_desc->mutex.acquisition_depth = 1; | 210 | obj_desc->mutex.acquisition_depth = 1; |
207 | obj_desc->mutex.original_sync_level = | 211 | obj_desc->mutex.original_sync_level = |
208 | walk_state->thread->current_sync_level; | 212 | walk_state->thread->current_sync_level; |
@@ -242,7 +246,7 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc, | |||
242 | 246 | ||
243 | /* The mutex must have been previously acquired in order to release it */ | 247 | /* The mutex must have been previously acquired in order to release it */ |
244 | 248 | ||
245 | if (!obj_desc->mutex.owner_thread_id) { | 249 | if (!obj_desc->mutex.owner_thread) { |
246 | ACPI_ERROR((AE_INFO, | 250 | ACPI_ERROR((AE_INFO, |
247 | "Cannot release Mutex [%4.4s], not acquired", | 251 | "Cannot release Mutex [%4.4s], not acquired", |
248 | acpi_ut_get_node_name(obj_desc->mutex.node))); | 252 | acpi_ut_get_node_name(obj_desc->mutex.node))); |
@@ -262,14 +266,14 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc, | |||
262 | * The Mutex is owned, but this thread must be the owner. | 266 | * The Mutex is owned, but this thread must be the owner. |
263 | * Special case for Global Lock, any thread can release | 267 | * Special case for Global Lock, any thread can release |
264 | */ | 268 | */ |
265 | if ((obj_desc->mutex.owner_thread_id != | 269 | if ((obj_desc->mutex.owner_thread->thread_id != |
266 | walk_state->thread->thread_id) | 270 | walk_state->thread->thread_id) |
267 | && (obj_desc->mutex.os_mutex != acpi_gbl_global_lock_mutex)) { | 271 | && (obj_desc->mutex.os_mutex != acpi_gbl_global_lock_mutex)) { |
268 | ACPI_ERROR((AE_INFO, | 272 | ACPI_ERROR((AE_INFO, |
269 | "Thread %lX cannot release Mutex [%4.4s] acquired by thread %lX", | 273 | "Thread %lX cannot release Mutex [%4.4s] acquired by thread %lX", |
270 | (unsigned long)walk_state->thread->thread_id, | 274 | (unsigned long)walk_state->thread->thread_id, |
271 | acpi_ut_get_node_name(obj_desc->mutex.node), | 275 | acpi_ut_get_node_name(obj_desc->mutex.node), |
272 | (unsigned long)obj_desc->mutex.owner_thread_id)); | 276 | (unsigned long)obj_desc->mutex.owner_thread->thread_id)); |
273 | return_ACPI_STATUS(AE_AML_NOT_OWNER); | 277 | return_ACPI_STATUS(AE_AML_NOT_OWNER); |
274 | } | 278 | } |
275 | 279 | ||
@@ -296,7 +300,7 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc, | |||
296 | 300 | ||
297 | /* Unlink the mutex from the owner's list */ | 301 | /* Unlink the mutex from the owner's list */ |
298 | 302 | ||
299 | acpi_ex_unlink_mutex(obj_desc, walk_state->thread); | 303 | acpi_ex_unlink_mutex(obj_desc); |
300 | 304 | ||
301 | /* Release the mutex, special case for Global Lock */ | 305 | /* Release the mutex, special case for Global Lock */ |
302 | 306 | ||
@@ -308,7 +312,7 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc, | |||
308 | 312 | ||
309 | /* Update the mutex and restore sync_level */ | 313 | /* Update the mutex and restore sync_level */ |
310 | 314 | ||
311 | obj_desc->mutex.owner_thread_id = ACPI_MUTEX_NOT_ACQUIRED; | 315 | obj_desc->mutex.owner_thread = NULL; |
312 | walk_state->thread->current_sync_level = | 316 | walk_state->thread->current_sync_level = |
313 | obj_desc->mutex.original_sync_level; | 317 | obj_desc->mutex.original_sync_level; |
314 | 318 | ||
@@ -363,7 +367,7 @@ void acpi_ex_release_all_mutexes(struct acpi_thread_state *thread) | |||
363 | 367 | ||
364 | /* Mark mutex unowned */ | 368 | /* Mark mutex unowned */ |
365 | 369 | ||
366 | obj_desc->mutex.owner_thread_id = ACPI_MUTEX_NOT_ACQUIRED; | 370 | obj_desc->mutex.owner_thread = NULL; |
367 | 371 | ||
368 | /* Update Thread sync_level (Last mutex is the important one) */ | 372 | /* Update Thread sync_level (Last mutex is the important one) */ |
369 | 373 | ||
diff --git a/drivers/acpi/executer/exsystem.c b/drivers/acpi/executer/exsystem.c index b2edf620ba89..9460baff3032 100644 --- a/drivers/acpi/executer/exsystem.c +++ b/drivers/acpi/executer/exsystem.c | |||
@@ -66,7 +66,6 @@ ACPI_MODULE_NAME("exsystem") | |||
66 | acpi_status acpi_ex_system_wait_semaphore(acpi_semaphore semaphore, u16 timeout) | 66 | acpi_status acpi_ex_system_wait_semaphore(acpi_semaphore semaphore, u16 timeout) |
67 | { | 67 | { |
68 | acpi_status status; | 68 | acpi_status status; |
69 | acpi_status status2; | ||
70 | 69 | ||
71 | ACPI_FUNCTION_TRACE(ex_system_wait_semaphore); | 70 | ACPI_FUNCTION_TRACE(ex_system_wait_semaphore); |
72 | 71 | ||
@@ -79,7 +78,7 @@ acpi_status acpi_ex_system_wait_semaphore(acpi_semaphore semaphore, u16 timeout) | |||
79 | 78 | ||
80 | /* We must wait, so unlock the interpreter */ | 79 | /* We must wait, so unlock the interpreter */ |
81 | 80 | ||
82 | acpi_ex_exit_interpreter(); | 81 | acpi_ex_relinquish_interpreter(); |
83 | 82 | ||
84 | status = acpi_os_wait_semaphore(semaphore, 1, timeout); | 83 | status = acpi_os_wait_semaphore(semaphore, 1, timeout); |
85 | 84 | ||
@@ -89,13 +88,7 @@ acpi_status acpi_ex_system_wait_semaphore(acpi_semaphore semaphore, u16 timeout) | |||
89 | 88 | ||
90 | /* Reacquire the interpreter */ | 89 | /* Reacquire the interpreter */ |
91 | 90 | ||
92 | status2 = acpi_ex_enter_interpreter(); | 91 | acpi_ex_reacquire_interpreter(); |
93 | if (ACPI_FAILURE(status2)) { | ||
94 | |||
95 | /* Report fatal error, could not acquire interpreter */ | ||
96 | |||
97 | return_ACPI_STATUS(status2); | ||
98 | } | ||
99 | } | 92 | } |
100 | 93 | ||
101 | return_ACPI_STATUS(status); | 94 | return_ACPI_STATUS(status); |
@@ -119,7 +112,6 @@ acpi_status acpi_ex_system_wait_semaphore(acpi_semaphore semaphore, u16 timeout) | |||
119 | acpi_status acpi_ex_system_wait_mutex(acpi_mutex mutex, u16 timeout) | 112 | acpi_status acpi_ex_system_wait_mutex(acpi_mutex mutex, u16 timeout) |
120 | { | 113 | { |
121 | acpi_status status; | 114 | acpi_status status; |
122 | acpi_status status2; | ||
123 | 115 | ||
124 | ACPI_FUNCTION_TRACE(ex_system_wait_mutex); | 116 | ACPI_FUNCTION_TRACE(ex_system_wait_mutex); |
125 | 117 | ||
@@ -132,7 +124,7 @@ acpi_status acpi_ex_system_wait_mutex(acpi_mutex mutex, u16 timeout) | |||
132 | 124 | ||
133 | /* We must wait, so unlock the interpreter */ | 125 | /* We must wait, so unlock the interpreter */ |
134 | 126 | ||
135 | acpi_ex_exit_interpreter(); | 127 | acpi_ex_relinquish_interpreter(); |
136 | 128 | ||
137 | status = acpi_os_acquire_mutex(mutex, timeout); | 129 | status = acpi_os_acquire_mutex(mutex, timeout); |
138 | 130 | ||
@@ -142,13 +134,7 @@ acpi_status acpi_ex_system_wait_mutex(acpi_mutex mutex, u16 timeout) | |||
142 | 134 | ||
143 | /* Reacquire the interpreter */ | 135 | /* Reacquire the interpreter */ |
144 | 136 | ||
145 | status2 = acpi_ex_enter_interpreter(); | 137 | acpi_ex_reacquire_interpreter(); |
146 | if (ACPI_FAILURE(status2)) { | ||
147 | |||
148 | /* Report fatal error, could not acquire interpreter */ | ||
149 | |||
150 | return_ACPI_STATUS(status2); | ||
151 | } | ||
152 | } | 138 | } |
153 | 139 | ||
154 | return_ACPI_STATUS(status); | 140 | return_ACPI_STATUS(status); |
@@ -209,20 +195,18 @@ acpi_status acpi_ex_system_do_stall(u32 how_long) | |||
209 | 195 | ||
210 | acpi_status acpi_ex_system_do_suspend(acpi_integer how_long) | 196 | acpi_status acpi_ex_system_do_suspend(acpi_integer how_long) |
211 | { | 197 | { |
212 | acpi_status status; | ||
213 | |||
214 | ACPI_FUNCTION_ENTRY(); | 198 | ACPI_FUNCTION_ENTRY(); |
215 | 199 | ||
216 | /* Since this thread will sleep, we must release the interpreter */ | 200 | /* Since this thread will sleep, we must release the interpreter */ |
217 | 201 | ||
218 | acpi_ex_exit_interpreter(); | 202 | acpi_ex_relinquish_interpreter(); |
219 | 203 | ||
220 | acpi_os_sleep(how_long); | 204 | acpi_os_sleep(how_long); |
221 | 205 | ||
222 | /* And now we must get the interpreter again */ | 206 | /* And now we must get the interpreter again */ |
223 | 207 | ||
224 | status = acpi_ex_enter_interpreter(); | 208 | acpi_ex_reacquire_interpreter(); |
225 | return (status); | 209 | return (AE_OK); |
226 | } | 210 | } |
227 | 211 | ||
228 | /******************************************************************************* | 212 | /******************************************************************************* |
diff --git a/drivers/acpi/executer/exutils.c b/drivers/acpi/executer/exutils.c index aea461f3a48c..6b0aeccbb69b 100644 --- a/drivers/acpi/executer/exutils.c +++ b/drivers/acpi/executer/exutils.c | |||
@@ -76,14 +76,15 @@ static u32 acpi_ex_digits_needed(acpi_integer value, u32 base); | |||
76 | * | 76 | * |
77 | * PARAMETERS: None | 77 | * PARAMETERS: None |
78 | * | 78 | * |
79 | * RETURN: Status | 79 | * RETURN: None |
80 | * | 80 | * |
81 | * DESCRIPTION: Enter the interpreter execution region. Failure to enter | 81 | * DESCRIPTION: Enter the interpreter execution region. Failure to enter |
82 | * the interpreter region is a fatal system error | 82 | * the interpreter region is a fatal system error. Used in |
83 | * conjunction with exit_interpreter. | ||
83 | * | 84 | * |
84 | ******************************************************************************/ | 85 | ******************************************************************************/ |
85 | 86 | ||
86 | acpi_status acpi_ex_enter_interpreter(void) | 87 | void acpi_ex_enter_interpreter(void) |
87 | { | 88 | { |
88 | acpi_status status; | 89 | acpi_status status; |
89 | 90 | ||
@@ -91,31 +92,55 @@ acpi_status acpi_ex_enter_interpreter(void) | |||
91 | 92 | ||
92 | status = acpi_ut_acquire_mutex(ACPI_MTX_INTERPRETER); | 93 | status = acpi_ut_acquire_mutex(ACPI_MTX_INTERPRETER); |
93 | if (ACPI_FAILURE(status)) { | 94 | if (ACPI_FAILURE(status)) { |
94 | ACPI_ERROR((AE_INFO, "Could not acquire interpreter mutex")); | 95 | ACPI_ERROR((AE_INFO, |
96 | "Could not acquire AML Interpreter mutex")); | ||
95 | } | 97 | } |
96 | 98 | ||
97 | return_ACPI_STATUS(status); | 99 | return_VOID; |
98 | } | 100 | } |
99 | 101 | ||
100 | /******************************************************************************* | 102 | /******************************************************************************* |
101 | * | 103 | * |
102 | * FUNCTION: acpi_ex_exit_interpreter | 104 | * FUNCTION: acpi_ex_reacquire_interpreter |
103 | * | 105 | * |
104 | * PARAMETERS: None | 106 | * PARAMETERS: None |
105 | * | 107 | * |
106 | * RETURN: None | 108 | * RETURN: None |
107 | * | 109 | * |
108 | * DESCRIPTION: Exit the interpreter execution region | 110 | * DESCRIPTION: Reacquire the interpreter execution region from within the |
111 | * interpreter code. Failure to enter the interpreter region is a | ||
112 | * fatal system error. Used in conjuction with | ||
113 | * relinquish_interpreter | ||
114 | * | ||
115 | ******************************************************************************/ | ||
116 | |||
117 | void acpi_ex_reacquire_interpreter(void) | ||
118 | { | ||
119 | ACPI_FUNCTION_TRACE(ex_reacquire_interpreter); | ||
120 | |||
121 | /* | ||
122 | * If the global serialized flag is set, do not release the interpreter, | ||
123 | * since it was not actually released by acpi_ex_relinquish_interpreter. | ||
124 | * This forces the interpreter to be single threaded. | ||
125 | */ | ||
126 | if (!acpi_gbl_all_methods_serialized) { | ||
127 | acpi_ex_enter_interpreter(); | ||
128 | } | ||
129 | |||
130 | return_VOID; | ||
131 | } | ||
132 | |||
133 | /******************************************************************************* | ||
134 | * | ||
135 | * FUNCTION: acpi_ex_exit_interpreter | ||
136 | * | ||
137 | * PARAMETERS: None | ||
138 | * | ||
139 | * RETURN: None | ||
109 | * | 140 | * |
110 | * Cases where the interpreter is unlocked: | 141 | * DESCRIPTION: Exit the interpreter execution region. This is the top level |
111 | * 1) Completion of the execution of a control method | 142 | * routine used to exit the interpreter when all processing has |
112 | * 2) Method blocked on a Sleep() AML opcode | 143 | * been completed. |
113 | * 3) Method blocked on an Acquire() AML opcode | ||
114 | * 4) Method blocked on a Wait() AML opcode | ||
115 | * 5) Method blocked to acquire the global lock | ||
116 | * 6) Method blocked to execute a serialized control method that is | ||
117 | * already executing | ||
118 | * 7) About to invoke a user-installed opregion handler | ||
119 | * | 144 | * |
120 | ******************************************************************************/ | 145 | ******************************************************************************/ |
121 | 146 | ||
@@ -127,7 +152,46 @@ void acpi_ex_exit_interpreter(void) | |||
127 | 152 | ||
128 | status = acpi_ut_release_mutex(ACPI_MTX_INTERPRETER); | 153 | status = acpi_ut_release_mutex(ACPI_MTX_INTERPRETER); |
129 | if (ACPI_FAILURE(status)) { | 154 | if (ACPI_FAILURE(status)) { |
130 | ACPI_ERROR((AE_INFO, "Could not release interpreter mutex")); | 155 | ACPI_ERROR((AE_INFO, |
156 | "Could not release AML Interpreter mutex")); | ||
157 | } | ||
158 | |||
159 | return_VOID; | ||
160 | } | ||
161 | |||
162 | /******************************************************************************* | ||
163 | * | ||
164 | * FUNCTION: acpi_ex_relinquish_interpreter | ||
165 | * | ||
166 | * PARAMETERS: None | ||
167 | * | ||
168 | * RETURN: None | ||
169 | * | ||
170 | * DESCRIPTION: Exit the interpreter execution region, from within the | ||
171 | * interpreter - before attempting an operation that will possibly | ||
172 | * block the running thread. | ||
173 | * | ||
174 | * Cases where the interpreter is unlocked internally | ||
175 | * 1) Method to be blocked on a Sleep() AML opcode | ||
176 | * 2) Method to be blocked on an Acquire() AML opcode | ||
177 | * 3) Method to be blocked on a Wait() AML opcode | ||
178 | * 4) Method to be blocked to acquire the global lock | ||
179 | * 5) Method to be blocked waiting to execute a serialized control method | ||
180 | * that is currently executing | ||
181 | * 6) About to invoke a user-installed opregion handler | ||
182 | * | ||
183 | ******************************************************************************/ | ||
184 | |||
185 | void acpi_ex_relinquish_interpreter(void) | ||
186 | { | ||
187 | ACPI_FUNCTION_TRACE(ex_relinquish_interpreter); | ||
188 | |||
189 | /* | ||
190 | * If the global serialized flag is set, do not release the interpreter. | ||
191 | * This forces the interpreter to be single threaded. | ||
192 | */ | ||
193 | if (!acpi_gbl_all_methods_serialized) { | ||
194 | acpi_ex_exit_interpreter(); | ||
131 | } | 195 | } |
132 | 196 | ||
133 | return_VOID; | 197 | return_VOID; |
@@ -141,8 +205,8 @@ void acpi_ex_exit_interpreter(void) | |||
141 | * | 205 | * |
142 | * RETURN: none | 206 | * RETURN: none |
143 | * | 207 | * |
144 | * DESCRIPTION: Truncate a number to 32-bits if the currently executing method | 208 | * DESCRIPTION: Truncate an ACPI Integer to 32 bits if the execution mode is |
145 | * belongs to a 32-bit ACPI table. | 209 | * 32-bit, as determined by the revision of the DSDT. |
146 | * | 210 | * |
147 | ******************************************************************************/ | 211 | ******************************************************************************/ |
148 | 212 | ||
diff --git a/drivers/acpi/namespace/nseval.c b/drivers/acpi/namespace/nseval.c index 26fd0dd6953d..aa6370c67ec1 100644 --- a/drivers/acpi/namespace/nseval.c +++ b/drivers/acpi/namespace/nseval.c | |||
@@ -154,11 +154,7 @@ acpi_status acpi_ns_evaluate(struct acpi_evaluate_info *info) | |||
154 | * Execute the method via the interpreter. The interpreter is locked | 154 | * Execute the method via the interpreter. The interpreter is locked |
155 | * here before calling into the AML parser | 155 | * here before calling into the AML parser |
156 | */ | 156 | */ |
157 | status = acpi_ex_enter_interpreter(); | 157 | acpi_ex_enter_interpreter(); |
158 | if (ACPI_FAILURE(status)) { | ||
159 | return_ACPI_STATUS(status); | ||
160 | } | ||
161 | |||
162 | status = acpi_ps_execute_method(info); | 158 | status = acpi_ps_execute_method(info); |
163 | acpi_ex_exit_interpreter(); | 159 | acpi_ex_exit_interpreter(); |
164 | } else { | 160 | } else { |
@@ -182,10 +178,7 @@ acpi_status acpi_ns_evaluate(struct acpi_evaluate_info *info) | |||
182 | * resolution, we must lock it because we could access an opregion. | 178 | * resolution, we must lock it because we could access an opregion. |
183 | * The opregion access code assumes that the interpreter is locked. | 179 | * The opregion access code assumes that the interpreter is locked. |
184 | */ | 180 | */ |
185 | status = acpi_ex_enter_interpreter(); | 181 | acpi_ex_enter_interpreter(); |
186 | if (ACPI_FAILURE(status)) { | ||
187 | return_ACPI_STATUS(status); | ||
188 | } | ||
189 | 182 | ||
190 | /* Function has a strange interface */ | 183 | /* Function has a strange interface */ |
191 | 184 | ||
diff --git a/drivers/acpi/namespace/nsinit.c b/drivers/acpi/namespace/nsinit.c index c4ab615f77fe..33db2241044e 100644 --- a/drivers/acpi/namespace/nsinit.c +++ b/drivers/acpi/namespace/nsinit.c | |||
@@ -214,7 +214,7 @@ acpi_ns_init_one_object(acpi_handle obj_handle, | |||
214 | u32 level, void *context, void **return_value) | 214 | u32 level, void *context, void **return_value) |
215 | { | 215 | { |
216 | acpi_object_type type; | 216 | acpi_object_type type; |
217 | acpi_status status; | 217 | acpi_status status = AE_OK; |
218 | struct acpi_init_walk_info *info = | 218 | struct acpi_init_walk_info *info = |
219 | (struct acpi_init_walk_info *)context; | 219 | (struct acpi_init_walk_info *)context; |
220 | struct acpi_namespace_node *node = | 220 | struct acpi_namespace_node *node = |
@@ -268,10 +268,7 @@ acpi_ns_init_one_object(acpi_handle obj_handle, | |||
268 | /* | 268 | /* |
269 | * Must lock the interpreter before executing AML code | 269 | * Must lock the interpreter before executing AML code |
270 | */ | 270 | */ |
271 | status = acpi_ex_enter_interpreter(); | 271 | acpi_ex_enter_interpreter(); |
272 | if (ACPI_FAILURE(status)) { | ||
273 | return (status); | ||
274 | } | ||
275 | 272 | ||
276 | /* | 273 | /* |
277 | * Each of these types can contain executable AML code within the | 274 | * Each of these types can contain executable AML code within the |
diff --git a/drivers/acpi/namespace/nsxfeval.c b/drivers/acpi/namespace/nsxfeval.c index 8904d0fae6a2..7ac6ace50059 100644 --- a/drivers/acpi/namespace/nsxfeval.c +++ b/drivers/acpi/namespace/nsxfeval.c | |||
@@ -170,7 +170,6 @@ acpi_evaluate_object(acpi_handle handle, | |||
170 | struct acpi_buffer *return_buffer) | 170 | struct acpi_buffer *return_buffer) |
171 | { | 171 | { |
172 | acpi_status status; | 172 | acpi_status status; |
173 | acpi_status status2; | ||
174 | struct acpi_evaluate_info *info; | 173 | struct acpi_evaluate_info *info; |
175 | acpi_size buffer_space_needed; | 174 | acpi_size buffer_space_needed; |
176 | u32 i; | 175 | u32 i; |
@@ -329,14 +328,12 @@ acpi_evaluate_object(acpi_handle handle, | |||
329 | * Delete the internal return object. NOTE: Interpreter must be | 328 | * Delete the internal return object. NOTE: Interpreter must be |
330 | * locked to avoid race condition. | 329 | * locked to avoid race condition. |
331 | */ | 330 | */ |
332 | status2 = acpi_ex_enter_interpreter(); | 331 | acpi_ex_enter_interpreter(); |
333 | if (ACPI_SUCCESS(status2)) { | ||
334 | 332 | ||
335 | /* Remove one reference on the return object (should delete it) */ | 333 | /* Remove one reference on the return object (should delete it) */ |
336 | 334 | ||
337 | acpi_ut_remove_reference(info->return_object); | 335 | acpi_ut_remove_reference(info->return_object); |
338 | acpi_ex_exit_interpreter(); | 336 | acpi_ex_exit_interpreter(); |
339 | } | ||
340 | } | 337 | } |
341 | 338 | ||
342 | cleanup: | 339 | cleanup: |
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index c2bed56915e1..b998340e23d4 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c | |||
@@ -71,6 +71,7 @@ static unsigned int acpi_irq_irq; | |||
71 | static acpi_osd_handler acpi_irq_handler; | 71 | static acpi_osd_handler acpi_irq_handler; |
72 | static void *acpi_irq_context; | 72 | static void *acpi_irq_context; |
73 | static struct workqueue_struct *kacpid_wq; | 73 | static struct workqueue_struct *kacpid_wq; |
74 | static struct workqueue_struct *kacpi_notify_wq; | ||
74 | 75 | ||
75 | static void __init acpi_request_region (struct acpi_generic_address *addr, | 76 | static void __init acpi_request_region (struct acpi_generic_address *addr, |
76 | unsigned int length, char *desc) | 77 | unsigned int length, char *desc) |
@@ -137,8 +138,9 @@ acpi_status acpi_os_initialize1(void) | |||
137 | return AE_NULL_ENTRY; | 138 | return AE_NULL_ENTRY; |
138 | } | 139 | } |
139 | kacpid_wq = create_singlethread_workqueue("kacpid"); | 140 | kacpid_wq = create_singlethread_workqueue("kacpid"); |
141 | kacpi_notify_wq = create_singlethread_workqueue("kacpi_notify"); | ||
140 | BUG_ON(!kacpid_wq); | 142 | BUG_ON(!kacpid_wq); |
141 | 143 | BUG_ON(!kacpi_notify_wq); | |
142 | return AE_OK; | 144 | return AE_OK; |
143 | } | 145 | } |
144 | 146 | ||
@@ -150,6 +152,7 @@ acpi_status acpi_os_terminate(void) | |||
150 | } | 152 | } |
151 | 153 | ||
152 | destroy_workqueue(kacpid_wq); | 154 | destroy_workqueue(kacpid_wq); |
155 | destroy_workqueue(kacpi_notify_wq); | ||
153 | 156 | ||
154 | return AE_OK; | 157 | return AE_OK; |
155 | } | 158 | } |
@@ -603,6 +606,23 @@ void acpi_os_derive_pci_id(acpi_handle rhandle, /* upper bound */ | |||
603 | static void acpi_os_execute_deferred(struct work_struct *work) | 606 | static void acpi_os_execute_deferred(struct work_struct *work) |
604 | { | 607 | { |
605 | struct acpi_os_dpc *dpc = container_of(work, struct acpi_os_dpc, work); | 608 | struct acpi_os_dpc *dpc = container_of(work, struct acpi_os_dpc, work); |
609 | if (!dpc) { | ||
610 | printk(KERN_ERR PREFIX "Invalid (NULL) context\n"); | ||
611 | return; | ||
612 | } | ||
613 | |||
614 | dpc->function(dpc->context); | ||
615 | kfree(dpc); | ||
616 | |||
617 | /* Yield cpu to notify thread */ | ||
618 | cond_resched(); | ||
619 | |||
620 | return; | ||
621 | } | ||
622 | |||
623 | static void acpi_os_execute_notify(struct work_struct *work) | ||
624 | { | ||
625 | struct acpi_os_dpc *dpc = container_of(work, struct acpi_os_dpc, work); | ||
606 | 626 | ||
607 | if (!dpc) { | 627 | if (!dpc) { |
608 | printk(KERN_ERR PREFIX "Invalid (NULL) context\n"); | 628 | printk(KERN_ERR PREFIX "Invalid (NULL) context\n"); |
@@ -637,14 +657,12 @@ acpi_status acpi_os_execute(acpi_execute_type type, | |||
637 | acpi_status status = AE_OK; | 657 | acpi_status status = AE_OK; |
638 | struct acpi_os_dpc *dpc; | 658 | struct acpi_os_dpc *dpc; |
639 | 659 | ||
640 | ACPI_FUNCTION_TRACE("os_queue_for_execution"); | ||
641 | |||
642 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 660 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
643 | "Scheduling function [%p(%p)] for deferred execution.\n", | 661 | "Scheduling function [%p(%p)] for deferred execution.\n", |
644 | function, context)); | 662 | function, context)); |
645 | 663 | ||
646 | if (!function) | 664 | if (!function) |
647 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 665 | return AE_BAD_PARAMETER; |
648 | 666 | ||
649 | /* | 667 | /* |
650 | * Allocate/initialize DPC structure. Note that this memory will be | 668 | * Allocate/initialize DPC structure. Note that this memory will be |
@@ -662,14 +680,21 @@ acpi_status acpi_os_execute(acpi_execute_type type, | |||
662 | dpc->function = function; | 680 | dpc->function = function; |
663 | dpc->context = context; | 681 | dpc->context = context; |
664 | 682 | ||
665 | INIT_WORK(&dpc->work, acpi_os_execute_deferred); | 683 | if (type == OSL_NOTIFY_HANDLER) { |
666 | if (!queue_work(kacpid_wq, &dpc->work)) { | 684 | INIT_WORK(&dpc->work, acpi_os_execute_notify); |
667 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 685 | if (!queue_work(kacpi_notify_wq, &dpc->work)) { |
686 | status = AE_ERROR; | ||
687 | kfree(dpc); | ||
688 | } | ||
689 | } else { | ||
690 | INIT_WORK(&dpc->work, acpi_os_execute_deferred); | ||
691 | if (!queue_work(kacpid_wq, &dpc->work)) { | ||
692 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | ||
668 | "Call to queue_work() failed.\n")); | 693 | "Call to queue_work() failed.\n")); |
669 | kfree(dpc); | 694 | status = AE_ERROR; |
670 | status = AE_ERROR; | 695 | kfree(dpc); |
696 | } | ||
671 | } | 697 | } |
672 | |||
673 | return_ACPI_STATUS(status); | 698 | return_ACPI_STATUS(status); |
674 | } | 699 | } |
675 | 700 | ||
diff --git a/drivers/acpi/utilities/utdelete.c b/drivers/acpi/utilities/utdelete.c index 673a0caa4073..f777cebdc46d 100644 --- a/drivers/acpi/utilities/utdelete.c +++ b/drivers/acpi/utilities/utdelete.c | |||
@@ -170,6 +170,7 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object) | |||
170 | acpi_os_delete_mutex(object->mutex.os_mutex); | 170 | acpi_os_delete_mutex(object->mutex.os_mutex); |
171 | acpi_gbl_global_lock_mutex = NULL; | 171 | acpi_gbl_global_lock_mutex = NULL; |
172 | } else { | 172 | } else { |
173 | acpi_ex_unlink_mutex(object); | ||
173 | acpi_os_delete_mutex(object->mutex.os_mutex); | 174 | acpi_os_delete_mutex(object->mutex.os_mutex); |
174 | } | 175 | } |
175 | break; | 176 | break; |