diff options
Diffstat (limited to 'drivers/acpi/executer/exsystem.c')
-rw-r--r-- | drivers/acpi/executer/exsystem.c | 82 |
1 files changed, 68 insertions, 14 deletions
diff --git a/drivers/acpi/executer/exsystem.c b/drivers/acpi/executer/exsystem.c index 52beee3674a0..6b5d1e6ce94b 100644 --- a/drivers/acpi/executer/exsystem.c +++ b/drivers/acpi/executer/exsystem.c | |||
@@ -63,14 +63,14 @@ ACPI_MODULE_NAME("exsystem") | |||
63 | * interpreter is released. | 63 | * interpreter is released. |
64 | * | 64 | * |
65 | ******************************************************************************/ | 65 | ******************************************************************************/ |
66 | acpi_status acpi_ex_system_wait_semaphore(acpi_handle 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; | 69 | acpi_status status2; |
70 | 70 | ||
71 | ACPI_FUNCTION_TRACE(ex_system_wait_semaphore); | 71 | ACPI_FUNCTION_TRACE(ex_system_wait_semaphore); |
72 | 72 | ||
73 | status = acpi_os_wait_semaphore(semaphore, 1, 0); | 73 | status = acpi_os_wait_semaphore(semaphore, 1, ACPI_DO_NOT_WAIT); |
74 | if (ACPI_SUCCESS(status)) { | 74 | if (ACPI_SUCCESS(status)) { |
75 | return_ACPI_STATUS(status); | 75 | return_ACPI_STATUS(status); |
76 | } | 76 | } |
@@ -103,6 +103,59 @@ acpi_status acpi_ex_system_wait_semaphore(acpi_handle semaphore, u16 timeout) | |||
103 | 103 | ||
104 | /******************************************************************************* | 104 | /******************************************************************************* |
105 | * | 105 | * |
106 | * FUNCTION: acpi_ex_system_wait_mutex | ||
107 | * | ||
108 | * PARAMETERS: Mutex - Mutex to wait on | ||
109 | * Timeout - Max time to wait | ||
110 | * | ||
111 | * RETURN: Status | ||
112 | * | ||
113 | * DESCRIPTION: Implements a semaphore wait with a check to see if the | ||
114 | * semaphore is available immediately. If it is not, the | ||
115 | * interpreter is released. | ||
116 | * | ||
117 | ******************************************************************************/ | ||
118 | |||
119 | acpi_status acpi_ex_system_wait_mutex(acpi_mutex mutex, u16 timeout) | ||
120 | { | ||
121 | acpi_status status; | ||
122 | acpi_status status2; | ||
123 | |||
124 | ACPI_FUNCTION_TRACE(ex_system_wait_mutex); | ||
125 | |||
126 | status = acpi_os_acquire_mutex(mutex, ACPI_DO_NOT_WAIT); | ||
127 | if (ACPI_SUCCESS(status)) { | ||
128 | return_ACPI_STATUS(status); | ||
129 | } | ||
130 | |||
131 | if (status == AE_TIME) { | ||
132 | |||
133 | /* We must wait, so unlock the interpreter */ | ||
134 | |||
135 | acpi_ex_exit_interpreter(); | ||
136 | |||
137 | status = acpi_os_acquire_mutex(mutex, timeout); | ||
138 | |||
139 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | ||
140 | "*** Thread awake after blocking, %s\n", | ||
141 | acpi_format_exception(status))); | ||
142 | |||
143 | /* Reacquire the interpreter */ | ||
144 | |||
145 | status2 = acpi_ex_enter_interpreter(); | ||
146 | if (ACPI_FAILURE(status2)) { | ||
147 | |||
148 | /* Report fatal error, could not acquire interpreter */ | ||
149 | |||
150 | return_ACPI_STATUS(status2); | ||
151 | } | ||
152 | } | ||
153 | |||
154 | return_ACPI_STATUS(status); | ||
155 | } | ||
156 | |||
157 | /******************************************************************************* | ||
158 | * | ||
106 | * FUNCTION: acpi_ex_system_do_stall | 159 | * FUNCTION: acpi_ex_system_do_stall |
107 | * | 160 | * |
108 | * PARAMETERS: how_long - The amount of time to stall, | 161 | * PARAMETERS: how_long - The amount of time to stall, |
@@ -176,7 +229,7 @@ acpi_status acpi_ex_system_do_suspend(acpi_integer how_long) | |||
176 | * | 229 | * |
177 | * FUNCTION: acpi_ex_system_acquire_mutex | 230 | * FUNCTION: acpi_ex_system_acquire_mutex |
178 | * | 231 | * |
179 | * PARAMETERS: time_desc - The 'time to delay' object descriptor | 232 | * PARAMETERS: time_desc - Maximum time to wait for the mutex |
180 | * obj_desc - The object descriptor for this op | 233 | * obj_desc - The object descriptor for this op |
181 | * | 234 | * |
182 | * RETURN: Status | 235 | * RETURN: Status |
@@ -201,14 +254,14 @@ acpi_ex_system_acquire_mutex(union acpi_operand_object * time_desc, | |||
201 | 254 | ||
202 | /* Support for the _GL_ Mutex object -- go get the global lock */ | 255 | /* Support for the _GL_ Mutex object -- go get the global lock */ |
203 | 256 | ||
204 | if (obj_desc->mutex.semaphore == acpi_gbl_global_lock_semaphore) { | 257 | if (obj_desc->mutex.os_mutex == ACPI_GLOBAL_LOCK) { |
205 | status = | 258 | status = |
206 | acpi_ev_acquire_global_lock((u16) time_desc->integer.value); | 259 | acpi_ev_acquire_global_lock((u16) time_desc->integer.value); |
207 | return_ACPI_STATUS(status); | 260 | return_ACPI_STATUS(status); |
208 | } | 261 | } |
209 | 262 | ||
210 | status = acpi_ex_system_wait_semaphore(obj_desc->mutex.semaphore, | 263 | status = acpi_ex_system_wait_mutex(obj_desc->mutex.os_mutex, |
211 | (u16) time_desc->integer.value); | 264 | (u16) time_desc->integer.value); |
212 | return_ACPI_STATUS(status); | 265 | return_ACPI_STATUS(status); |
213 | } | 266 | } |
214 | 267 | ||
@@ -239,13 +292,13 @@ acpi_status acpi_ex_system_release_mutex(union acpi_operand_object *obj_desc) | |||
239 | 292 | ||
240 | /* Support for the _GL_ Mutex object -- release the global lock */ | 293 | /* Support for the _GL_ Mutex object -- release the global lock */ |
241 | 294 | ||
242 | if (obj_desc->mutex.semaphore == acpi_gbl_global_lock_semaphore) { | 295 | if (obj_desc->mutex.os_mutex == ACPI_GLOBAL_LOCK) { |
243 | status = acpi_ev_release_global_lock(); | 296 | status = acpi_ev_release_global_lock(); |
244 | return_ACPI_STATUS(status); | 297 | return_ACPI_STATUS(status); |
245 | } | 298 | } |
246 | 299 | ||
247 | status = acpi_os_signal_semaphore(obj_desc->mutex.semaphore, 1); | 300 | acpi_os_release_mutex(obj_desc->mutex.os_mutex); |
248 | return_ACPI_STATUS(status); | 301 | return_ACPI_STATUS(AE_OK); |
249 | } | 302 | } |
250 | 303 | ||
251 | /******************************************************************************* | 304 | /******************************************************************************* |
@@ -268,7 +321,8 @@ acpi_status acpi_ex_system_signal_event(union acpi_operand_object *obj_desc) | |||
268 | ACPI_FUNCTION_TRACE(ex_system_signal_event); | 321 | ACPI_FUNCTION_TRACE(ex_system_signal_event); |
269 | 322 | ||
270 | if (obj_desc) { | 323 | if (obj_desc) { |
271 | status = acpi_os_signal_semaphore(obj_desc->event.semaphore, 1); | 324 | status = |
325 | acpi_os_signal_semaphore(obj_desc->event.os_semaphore, 1); | ||
272 | } | 326 | } |
273 | 327 | ||
274 | return_ACPI_STATUS(status); | 328 | return_ACPI_STATUS(status); |
@@ -299,7 +353,7 @@ acpi_ex_system_wait_event(union acpi_operand_object *time_desc, | |||
299 | 353 | ||
300 | if (obj_desc) { | 354 | if (obj_desc) { |
301 | status = | 355 | status = |
302 | acpi_ex_system_wait_semaphore(obj_desc->event.semaphore, | 356 | acpi_ex_system_wait_semaphore(obj_desc->event.os_semaphore, |
303 | (u16) time_desc->integer. | 357 | (u16) time_desc->integer. |
304 | value); | 358 | value); |
305 | } | 359 | } |
@@ -322,7 +376,7 @@ acpi_ex_system_wait_event(union acpi_operand_object *time_desc, | |||
322 | acpi_status acpi_ex_system_reset_event(union acpi_operand_object *obj_desc) | 376 | acpi_status acpi_ex_system_reset_event(union acpi_operand_object *obj_desc) |
323 | { | 377 | { |
324 | acpi_status status = AE_OK; | 378 | acpi_status status = AE_OK; |
325 | void *temp_semaphore; | 379 | acpi_semaphore temp_semaphore; |
326 | 380 | ||
327 | ACPI_FUNCTION_ENTRY(); | 381 | ACPI_FUNCTION_ENTRY(); |
328 | 382 | ||
@@ -333,8 +387,8 @@ acpi_status acpi_ex_system_reset_event(union acpi_operand_object *obj_desc) | |||
333 | status = | 387 | status = |
334 | acpi_os_create_semaphore(ACPI_NO_UNIT_LIMIT, 0, &temp_semaphore); | 388 | acpi_os_create_semaphore(ACPI_NO_UNIT_LIMIT, 0, &temp_semaphore); |
335 | if (ACPI_SUCCESS(status)) { | 389 | if (ACPI_SUCCESS(status)) { |
336 | (void)acpi_os_delete_semaphore(obj_desc->event.semaphore); | 390 | (void)acpi_os_delete_semaphore(obj_desc->event.os_semaphore); |
337 | obj_desc->event.semaphore = temp_semaphore; | 391 | obj_desc->event.os_semaphore = temp_semaphore; |
338 | } | 392 | } |
339 | 393 | ||
340 | return (status); | 394 | return (status); |