aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/events/evmisc.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/events/evmisc.c')
-rw-r--r--drivers/acpi/events/evmisc.c294
1 files changed, 126 insertions, 168 deletions
diff --git a/drivers/acpi/events/evmisc.c b/drivers/acpi/events/evmisc.c
index 3df3ada4b9e7..7e57b8470f55 100644
--- a/drivers/acpi/events/evmisc.c
+++ b/drivers/acpi/events/evmisc.c
@@ -47,12 +47,10 @@
47#include <acpi/acinterp.h> 47#include <acpi/acinterp.h>
48 48
49#define _COMPONENT ACPI_EVENTS 49#define _COMPONENT ACPI_EVENTS
50 ACPI_MODULE_NAME ("evmisc") 50ACPI_MODULE_NAME("evmisc")
51
52 51
53#ifdef ACPI_DEBUG_OUTPUT 52#ifdef ACPI_DEBUG_OUTPUT
54static const char *acpi_notify_value_names[] = 53static const char *acpi_notify_value_names[] = {
55{
56 "Bus Check", 54 "Bus Check",
57 "Device Check", 55 "Device Check",
58 "Device Wake", 56 "Device Wake",
@@ -66,18 +64,11 @@ static const char *acpi_notify_value_names[] =
66 64
67/* Local prototypes */ 65/* Local prototypes */
68 66
69static void ACPI_SYSTEM_XFACE 67static void ACPI_SYSTEM_XFACE acpi_ev_notify_dispatch(void *context);
70acpi_ev_notify_dispatch (
71 void *context);
72
73static void ACPI_SYSTEM_XFACE
74acpi_ev_global_lock_thread (
75 void *context);
76 68
77static u32 69static void ACPI_SYSTEM_XFACE acpi_ev_global_lock_thread(void *context);
78acpi_ev_global_lock_handler (
79 void *context);
80 70
71static u32 acpi_ev_global_lock_handler(void *context);
81 72
82/******************************************************************************* 73/*******************************************************************************
83 * 74 *
@@ -93,9 +84,7 @@ acpi_ev_global_lock_handler (
93 * 84 *
94 ******************************************************************************/ 85 ******************************************************************************/
95 86
96u8 87u8 acpi_ev_is_notify_object(struct acpi_namespace_node *node)
97acpi_ev_is_notify_object (
98 struct acpi_namespace_node *node)
99{ 88{
100 switch (node->type) { 89 switch (node->type) {
101 case ACPI_TYPE_DEVICE: 90 case ACPI_TYPE_DEVICE:
@@ -112,7 +101,6 @@ acpi_ev_is_notify_object (
112 } 101 }
113} 102}
114 103
115
116/******************************************************************************* 104/*******************************************************************************
117 * 105 *
118 * FUNCTION: acpi_ev_queue_notify_request 106 * FUNCTION: acpi_ev_queue_notify_request
@@ -128,18 +116,15 @@ acpi_ev_is_notify_object (
128 ******************************************************************************/ 116 ******************************************************************************/
129 117
130acpi_status 118acpi_status
131acpi_ev_queue_notify_request ( 119acpi_ev_queue_notify_request(struct acpi_namespace_node * node,
132 struct acpi_namespace_node *node, 120 u32 notify_value)
133 u32 notify_value)
134{ 121{
135 union acpi_operand_object *obj_desc; 122 union acpi_operand_object *obj_desc;
136 union acpi_operand_object *handler_obj = NULL; 123 union acpi_operand_object *handler_obj = NULL;
137 union acpi_generic_state *notify_info; 124 union acpi_generic_state *notify_info;
138 acpi_status status = AE_OK; 125 acpi_status status = AE_OK;
139
140
141 ACPI_FUNCTION_NAME ("ev_queue_notify_request");
142 126
127 ACPI_FUNCTION_NAME("ev_queue_notify_request");
143 128
144 /* 129 /*
145 * For value 3 (Ejection Request), some device method may need to be run. 130 * For value 3 (Ejection Request), some device method may need to be run.
@@ -148,22 +133,22 @@ acpi_ev_queue_notify_request (
148 * For value 0x80 (Status Change) on the power button or sleep button, 133 * For value 0x80 (Status Change) on the power button or sleep button,
149 * initiate soft-off or sleep operation? 134 * initiate soft-off or sleep operation?
150 */ 135 */
151 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, 136 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
152 "Dispatching Notify(%X) on node %p\n", notify_value, node)); 137 "Dispatching Notify(%X) on node %p\n", notify_value,
138 node));
153 139
154 if (notify_value <= 7) { 140 if (notify_value <= 7) {
155 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Notify value: %s\n", 141 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Notify value: %s\n",
156 acpi_notify_value_names[notify_value])); 142 acpi_notify_value_names[notify_value]));
157 } 143 } else {
158 else { 144 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
159 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, 145 "Notify value: 0x%2.2X **Device Specific**\n",
160 "Notify value: 0x%2.2X **Device Specific**\n", 146 notify_value));
161 notify_value));
162 } 147 }
163 148
164 /* Get the notify object attached to the NS Node */ 149 /* Get the notify object attached to the NS Node */
165 150
166 obj_desc = acpi_ns_get_attached_object (node); 151 obj_desc = acpi_ns_get_attached_object(node);
167 if (obj_desc) { 152 if (obj_desc) {
168 /* We have the notify object, Get the right handler */ 153 /* We have the notify object, Get the right handler */
169 154
@@ -174,10 +159,11 @@ acpi_ev_queue_notify_request (
174 case ACPI_TYPE_POWER: 159 case ACPI_TYPE_POWER:
175 160
176 if (notify_value <= ACPI_MAX_SYS_NOTIFY) { 161 if (notify_value <= ACPI_MAX_SYS_NOTIFY) {
177 handler_obj = obj_desc->common_notify.system_notify; 162 handler_obj =
178 } 163 obj_desc->common_notify.system_notify;
179 else { 164 } else {
180 handler_obj = obj_desc->common_notify.device_notify; 165 handler_obj =
166 obj_desc->common_notify.device_notify;
181 } 167 }
182 break; 168 break;
183 169
@@ -189,23 +175,25 @@ acpi_ev_queue_notify_request (
189 175
190 /* If there is any handler to run, schedule the dispatcher */ 176 /* If there is any handler to run, schedule the dispatcher */
191 177
192 if ((acpi_gbl_system_notify.handler && (notify_value <= ACPI_MAX_SYS_NOTIFY)) || 178 if ((acpi_gbl_system_notify.handler
193 (acpi_gbl_device_notify.handler && (notify_value > ACPI_MAX_SYS_NOTIFY)) || 179 && (notify_value <= ACPI_MAX_SYS_NOTIFY))
194 handler_obj) { 180 || (acpi_gbl_device_notify.handler
195 notify_info = acpi_ut_create_generic_state (); 181 && (notify_value > ACPI_MAX_SYS_NOTIFY)) || handler_obj) {
182 notify_info = acpi_ut_create_generic_state();
196 if (!notify_info) { 183 if (!notify_info) {
197 return (AE_NO_MEMORY); 184 return (AE_NO_MEMORY);
198 } 185 }
199 186
200 notify_info->common.data_type = ACPI_DESC_TYPE_STATE_NOTIFY; 187 notify_info->common.data_type = ACPI_DESC_TYPE_STATE_NOTIFY;
201 notify_info->notify.node = node; 188 notify_info->notify.node = node;
202 notify_info->notify.value = (u16) notify_value; 189 notify_info->notify.value = (u16) notify_value;
203 notify_info->notify.handler_obj = handler_obj; 190 notify_info->notify.handler_obj = handler_obj;
204 191
205 status = acpi_os_queue_for_execution (OSD_PRIORITY_HIGH, 192 status = acpi_os_queue_for_execution(OSD_PRIORITY_HIGH,
206 acpi_ev_notify_dispatch, notify_info); 193 acpi_ev_notify_dispatch,
207 if (ACPI_FAILURE (status)) { 194 notify_info);
208 acpi_ut_delete_generic_state (notify_info); 195 if (ACPI_FAILURE(status)) {
196 acpi_ut_delete_generic_state(notify_info);
209 } 197 }
210 } 198 }
211 199
@@ -214,15 +202,15 @@ acpi_ev_queue_notify_request (
214 * There is no per-device notify handler for this device. 202 * There is no per-device notify handler for this device.
215 * This may or may not be a problem. 203 * This may or may not be a problem.
216 */ 204 */
217 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, 205 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
218 "No notify handler for Notify(%4.4s, %X) node %p\n", 206 "No notify handler for Notify(%4.4s, %X) node %p\n",
219 acpi_ut_get_node_name (node), notify_value, node)); 207 acpi_ut_get_node_name(node), notify_value,
208 node));
220 } 209 }
221 210
222 return (status); 211 return (status);
223} 212}
224 213
225
226/******************************************************************************* 214/*******************************************************************************
227 * 215 *
228 * FUNCTION: acpi_ev_notify_dispatch 216 * FUNCTION: acpi_ev_notify_dispatch
@@ -236,18 +224,15 @@ acpi_ev_queue_notify_request (
236 * 224 *
237 ******************************************************************************/ 225 ******************************************************************************/
238 226
239static void ACPI_SYSTEM_XFACE 227static void ACPI_SYSTEM_XFACE acpi_ev_notify_dispatch(void *context)
240acpi_ev_notify_dispatch (
241 void *context)
242{ 228{
243 union acpi_generic_state *notify_info = (union acpi_generic_state *) context; 229 union acpi_generic_state *notify_info =
244 acpi_notify_handler global_handler = NULL; 230 (union acpi_generic_state *)context;
245 void *global_context = NULL; 231 acpi_notify_handler global_handler = NULL;
246 union acpi_operand_object *handler_obj; 232 void *global_context = NULL;
247 233 union acpi_operand_object *handler_obj;
248
249 ACPI_FUNCTION_ENTRY ();
250 234
235 ACPI_FUNCTION_ENTRY();
251 236
252 /* 237 /*
253 * We will invoke a global notify handler if installed. 238 * We will invoke a global notify handler if installed.
@@ -261,8 +246,7 @@ acpi_ev_notify_dispatch (
261 global_handler = acpi_gbl_system_notify.handler; 246 global_handler = acpi_gbl_system_notify.handler;
262 global_context = acpi_gbl_system_notify.context; 247 global_context = acpi_gbl_system_notify.context;
263 } 248 }
264 } 249 } else {
265 else {
266 /* Global driver notification handler */ 250 /* Global driver notification handler */
267 251
268 if (acpi_gbl_device_notify.handler) { 252 if (acpi_gbl_device_notify.handler) {
@@ -274,25 +258,24 @@ acpi_ev_notify_dispatch (
274 /* Invoke the system handler first, if present */ 258 /* Invoke the system handler first, if present */
275 259
276 if (global_handler) { 260 if (global_handler) {
277 global_handler (notify_info->notify.node, notify_info->notify.value, 261 global_handler(notify_info->notify.node,
278 global_context); 262 notify_info->notify.value, global_context);
279 } 263 }
280 264
281 /* Now invoke the per-device handler, if present */ 265 /* Now invoke the per-device handler, if present */
282 266
283 handler_obj = notify_info->notify.handler_obj; 267 handler_obj = notify_info->notify.handler_obj;
284 if (handler_obj) { 268 if (handler_obj) {
285 handler_obj->notify.handler (notify_info->notify.node, 269 handler_obj->notify.handler(notify_info->notify.node,
286 notify_info->notify.value, 270 notify_info->notify.value,
287 handler_obj->notify.context); 271 handler_obj->notify.context);
288 } 272 }
289 273
290 /* All done with the info object */ 274 /* All done with the info object */
291 275
292 acpi_ut_delete_generic_state (notify_info); 276 acpi_ut_delete_generic_state(notify_info);
293} 277}
294 278
295
296/******************************************************************************* 279/*******************************************************************************
297 * 280 *
298 * FUNCTION: acpi_ev_global_lock_thread 281 * FUNCTION: acpi_ev_global_lock_thread
@@ -307,27 +290,24 @@ acpi_ev_notify_dispatch (
307 * 290 *
308 ******************************************************************************/ 291 ******************************************************************************/
309 292
310static void ACPI_SYSTEM_XFACE 293static void ACPI_SYSTEM_XFACE acpi_ev_global_lock_thread(void *context)
311acpi_ev_global_lock_thread (
312 void *context)
313{ 294{
314 acpi_status status; 295 acpi_status status;
315
316 296
317 /* Signal threads that are waiting for the lock */ 297 /* Signal threads that are waiting for the lock */
318 298
319 if (acpi_gbl_global_lock_thread_count) { 299 if (acpi_gbl_global_lock_thread_count) {
320 /* Send sufficient units to the semaphore */ 300 /* Send sufficient units to the semaphore */
321 301
322 status = acpi_os_signal_semaphore (acpi_gbl_global_lock_semaphore, 302 status =
323 acpi_gbl_global_lock_thread_count); 303 acpi_os_signal_semaphore(acpi_gbl_global_lock_semaphore,
324 if (ACPI_FAILURE (status)) { 304 acpi_gbl_global_lock_thread_count);
325 ACPI_REPORT_ERROR (("Could not signal Global Lock semaphore\n")); 305 if (ACPI_FAILURE(status)) {
306 ACPI_REPORT_ERROR(("Could not signal Global Lock semaphore\n"));
326 } 307 }
327 } 308 }
328} 309}
329 310
330
331/******************************************************************************* 311/*******************************************************************************
332 * 312 *
333 * FUNCTION: acpi_ev_global_lock_handler 313 * FUNCTION: acpi_ev_global_lock_handler
@@ -342,20 +322,17 @@ acpi_ev_global_lock_thread (
342 * 322 *
343 ******************************************************************************/ 323 ******************************************************************************/
344 324
345static u32 325static u32 acpi_ev_global_lock_handler(void *context)
346acpi_ev_global_lock_handler (
347 void *context)
348{ 326{
349 u8 acquired = FALSE; 327 u8 acquired = FALSE;
350 acpi_status status; 328 acpi_status status;
351
352 329
353 /* 330 /*
354 * Attempt to get the lock 331 * Attempt to get the lock
355 * If we don't get it now, it will be marked pending and we will 332 * If we don't get it now, it will be marked pending and we will
356 * take another interrupt when it becomes free. 333 * take another interrupt when it becomes free.
357 */ 334 */
358 ACPI_ACQUIRE_GLOBAL_LOCK (acpi_gbl_common_fACS.global_lock, acquired); 335 ACPI_ACQUIRE_GLOBAL_LOCK(acpi_gbl_common_fACS.global_lock, acquired);
359 if (acquired) { 336 if (acquired) {
360 /* Got the lock, now wake all threads waiting for it */ 337 /* Got the lock, now wake all threads waiting for it */
361 338
@@ -363,11 +340,11 @@ acpi_ev_global_lock_handler (
363 340
364 /* Run the Global Lock thread which will signal all waiting threads */ 341 /* Run the Global Lock thread which will signal all waiting threads */
365 342
366 status = acpi_os_queue_for_execution (OSD_PRIORITY_HIGH, 343 status = acpi_os_queue_for_execution(OSD_PRIORITY_HIGH,
367 acpi_ev_global_lock_thread, context); 344 acpi_ev_global_lock_thread,
368 if (ACPI_FAILURE (status)) { 345 context);
369 ACPI_REPORT_ERROR (("Could not queue Global Lock thread, %s\n", 346 if (ACPI_FAILURE(status)) {
370 acpi_format_exception (status))); 347 ACPI_REPORT_ERROR(("Could not queue Global Lock thread, %s\n", acpi_format_exception(status)));
371 348
372 return (ACPI_INTERRUPT_NOT_HANDLED); 349 return (ACPI_INTERRUPT_NOT_HANDLED);
373 } 350 }
@@ -376,7 +353,6 @@ acpi_ev_global_lock_handler (
376 return (ACPI_INTERRUPT_HANDLED); 353 return (ACPI_INTERRUPT_HANDLED);
377} 354}
378 355
379
380/******************************************************************************* 356/*******************************************************************************
381 * 357 *
382 * FUNCTION: acpi_ev_init_global_lock_handler 358 * FUNCTION: acpi_ev_init_global_lock_handler
@@ -389,19 +365,16 @@ acpi_ev_global_lock_handler (
389 * 365 *
390 ******************************************************************************/ 366 ******************************************************************************/
391 367
392acpi_status 368acpi_status acpi_ev_init_global_lock_handler(void)
393acpi_ev_init_global_lock_handler (
394 void)
395{ 369{
396 acpi_status status; 370 acpi_status status;
397
398
399 ACPI_FUNCTION_TRACE ("ev_init_global_lock_handler");
400 371
372 ACPI_FUNCTION_TRACE("ev_init_global_lock_handler");
401 373
402 acpi_gbl_global_lock_present = TRUE; 374 acpi_gbl_global_lock_present = TRUE;
403 status = acpi_install_fixed_event_handler (ACPI_EVENT_GLOBAL, 375 status = acpi_install_fixed_event_handler(ACPI_EVENT_GLOBAL,
404 acpi_ev_global_lock_handler, NULL); 376 acpi_ev_global_lock_handler,
377 NULL);
405 378
406 /* 379 /*
407 * If the global lock does not exist on this platform, the attempt 380 * If the global lock does not exist on this platform, the attempt
@@ -411,17 +384,15 @@ acpi_ev_init_global_lock_handler (
411 * with an error. 384 * with an error.
412 */ 385 */
413 if (status == AE_NO_HARDWARE_RESPONSE) { 386 if (status == AE_NO_HARDWARE_RESPONSE) {
414 ACPI_REPORT_ERROR (( 387 ACPI_REPORT_ERROR(("No response from Global Lock hardware, disabling lock\n"));
415 "No response from Global Lock hardware, disabling lock\n"));
416 388
417 acpi_gbl_global_lock_present = FALSE; 389 acpi_gbl_global_lock_present = FALSE;
418 status = AE_OK; 390 status = AE_OK;
419 } 391 }
420 392
421 return_ACPI_STATUS (status); 393 return_ACPI_STATUS(status);
422} 394}
423 395
424
425/****************************************************************************** 396/******************************************************************************
426 * 397 *
427 * FUNCTION: acpi_ev_acquire_global_lock 398 * FUNCTION: acpi_ev_acquire_global_lock
@@ -434,22 +405,18 @@ acpi_ev_init_global_lock_handler (
434 * 405 *
435 *****************************************************************************/ 406 *****************************************************************************/
436 407
437acpi_status 408acpi_status acpi_ev_acquire_global_lock(u16 timeout)
438acpi_ev_acquire_global_lock (
439 u16 timeout)
440{ 409{
441 acpi_status status = AE_OK; 410 acpi_status status = AE_OK;
442 u8 acquired = FALSE; 411 u8 acquired = FALSE;
443
444
445 ACPI_FUNCTION_TRACE ("ev_acquire_global_lock");
446 412
413 ACPI_FUNCTION_TRACE("ev_acquire_global_lock");
447 414
448#ifndef ACPI_APPLICATION 415#ifndef ACPI_APPLICATION
449 /* Make sure that we actually have a global lock */ 416 /* Make sure that we actually have a global lock */
450 417
451 if (!acpi_gbl_global_lock_present) { 418 if (!acpi_gbl_global_lock_present) {
452 return_ACPI_STATUS (AE_NO_GLOBAL_LOCK); 419 return_ACPI_STATUS(AE_NO_GLOBAL_LOCK);
453 } 420 }
454#endif 421#endif
455 422
@@ -462,37 +429,37 @@ acpi_ev_acquire_global_lock (
462 * we are done 429 * we are done
463 */ 430 */
464 if (acpi_gbl_global_lock_acquired) { 431 if (acpi_gbl_global_lock_acquired) {
465 return_ACPI_STATUS (AE_OK); 432 return_ACPI_STATUS(AE_OK);
466 } 433 }
467 434
468 /* We must acquire the actual hardware lock */ 435 /* We must acquire the actual hardware lock */
469 436
470 ACPI_ACQUIRE_GLOBAL_LOCK (acpi_gbl_common_fACS.global_lock, acquired); 437 ACPI_ACQUIRE_GLOBAL_LOCK(acpi_gbl_common_fACS.global_lock, acquired);
471 if (acquired) { 438 if (acquired) {
472 /* We got the lock */ 439 /* We got the lock */
473 440
474 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Acquired the HW Global Lock\n")); 441 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
442 "Acquired the HW Global Lock\n"));
475 443
476 acpi_gbl_global_lock_acquired = TRUE; 444 acpi_gbl_global_lock_acquired = TRUE;
477 return_ACPI_STATUS (AE_OK); 445 return_ACPI_STATUS(AE_OK);
478 } 446 }
479 447
480 /* 448 /*
481 * Did not get the lock. The pending bit was set above, and we must now 449 * Did not get the lock. The pending bit was set above, and we must now
482 * wait until we get the global lock released interrupt. 450 * wait until we get the global lock released interrupt.
483 */ 451 */
484 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Waiting for the HW Global Lock\n")); 452 ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Waiting for the HW Global Lock\n"));
485 453
486 /* 454 /*
487 * Acquire the global lock semaphore first. 455 * Acquire the global lock semaphore first.
488 * Since this wait will block, we must release the interpreter 456 * Since this wait will block, we must release the interpreter
489 */ 457 */
490 status = acpi_ex_system_wait_semaphore (acpi_gbl_global_lock_semaphore, 458 status = acpi_ex_system_wait_semaphore(acpi_gbl_global_lock_semaphore,
491 timeout); 459 timeout);
492 return_ACPI_STATUS (status); 460 return_ACPI_STATUS(status);
493} 461}
494 462
495
496/******************************************************************************* 463/*******************************************************************************
497 * 464 *
498 * FUNCTION: acpi_ev_release_global_lock 465 * FUNCTION: acpi_ev_release_global_lock
@@ -505,21 +472,16 @@ acpi_ev_acquire_global_lock (
505 * 472 *
506 ******************************************************************************/ 473 ******************************************************************************/
507 474
508acpi_status 475acpi_status acpi_ev_release_global_lock(void)
509acpi_ev_release_global_lock (
510 void)
511{ 476{
512 u8 pending = FALSE; 477 u8 pending = FALSE;
513 acpi_status status = AE_OK; 478 acpi_status status = AE_OK;
514
515
516 ACPI_FUNCTION_TRACE ("ev_release_global_lock");
517 479
480 ACPI_FUNCTION_TRACE("ev_release_global_lock");
518 481
519 if (!acpi_gbl_global_lock_thread_count) { 482 if (!acpi_gbl_global_lock_thread_count) {
520 ACPI_REPORT_WARNING(( 483 ACPI_REPORT_WARNING(("Cannot release HW Global Lock, it has not been acquired\n"));
521 "Cannot release HW Global Lock, it has not been acquired\n")); 484 return_ACPI_STATUS(AE_NOT_ACQUIRED);
522 return_ACPI_STATUS (AE_NOT_ACQUIRED);
523 } 485 }
524 486
525 /* One fewer thread has the global lock */ 487 /* One fewer thread has the global lock */
@@ -528,14 +490,14 @@ acpi_ev_release_global_lock (
528 if (acpi_gbl_global_lock_thread_count) { 490 if (acpi_gbl_global_lock_thread_count) {
529 /* There are still some threads holding the lock, cannot release */ 491 /* There are still some threads holding the lock, cannot release */
530 492
531 return_ACPI_STATUS (AE_OK); 493 return_ACPI_STATUS(AE_OK);
532 } 494 }
533 495
534 /* 496 /*
535 * No more threads holding lock, we can do the actual hardware 497 * No more threads holding lock, we can do the actual hardware
536 * release 498 * release
537 */ 499 */
538 ACPI_RELEASE_GLOBAL_LOCK (acpi_gbl_common_fACS.global_lock, pending); 500 ACPI_RELEASE_GLOBAL_LOCK(acpi_gbl_common_fACS.global_lock, pending);
539 acpi_gbl_global_lock_acquired = FALSE; 501 acpi_gbl_global_lock_acquired = FALSE;
540 502
541 /* 503 /*
@@ -543,14 +505,13 @@ acpi_ev_release_global_lock (
543 * register 505 * register
544 */ 506 */
545 if (pending) { 507 if (pending) {
546 status = acpi_set_register (ACPI_BITREG_GLOBAL_LOCK_RELEASE, 508 status = acpi_set_register(ACPI_BITREG_GLOBAL_LOCK_RELEASE,
547 1, ACPI_MTX_LOCK); 509 1, ACPI_MTX_LOCK);
548 } 510 }
549 511
550 return_ACPI_STATUS (status); 512 return_ACPI_STATUS(status);
551} 513}
552 514
553
554/****************************************************************************** 515/******************************************************************************
555 * 516 *
556 * FUNCTION: acpi_ev_terminate 517 * FUNCTION: acpi_ev_terminate
@@ -563,16 +524,12 @@ acpi_ev_release_global_lock (
563 * 524 *
564 ******************************************************************************/ 525 ******************************************************************************/
565 526
566void 527void acpi_ev_terminate(void)
567acpi_ev_terminate (
568 void)
569{ 528{
570 acpi_native_uint i; 529 acpi_native_uint i;
571 acpi_status status; 530 acpi_status status;
572
573
574 ACPI_FUNCTION_TRACE ("ev_terminate");
575 531
532 ACPI_FUNCTION_TRACE("ev_terminate");
576 533
577 if (acpi_gbl_events_initialized) { 534 if (acpi_gbl_events_initialized) {
578 /* 535 /*
@@ -583,38 +540,39 @@ acpi_ev_terminate (
583 /* Disable all fixed events */ 540 /* Disable all fixed events */
584 541
585 for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) { 542 for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) {
586 status = acpi_disable_event ((u32) i, 0); 543 status = acpi_disable_event((u32) i, 0);
587 if (ACPI_FAILURE (status)) { 544 if (ACPI_FAILURE(status)) {
588 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 545 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
589 "Could not disable fixed event %d\n", (u32) i)); 546 "Could not disable fixed event %d\n",
547 (u32) i));
590 } 548 }
591 } 549 }
592 550
593 /* Disable all GPEs in all GPE blocks */ 551 /* Disable all GPEs in all GPE blocks */
594 552
595 status = acpi_ev_walk_gpe_list (acpi_hw_disable_gpe_block); 553 status = acpi_ev_walk_gpe_list(acpi_hw_disable_gpe_block);
596 554
597 /* Remove SCI handler */ 555 /* Remove SCI handler */
598 556
599 status = acpi_ev_remove_sci_handler (); 557 status = acpi_ev_remove_sci_handler();
600 if (ACPI_FAILURE(status)) { 558 if (ACPI_FAILURE(status)) {
601 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 559 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
602 "Could not remove SCI handler\n")); 560 "Could not remove SCI handler\n"));
603 } 561 }
604 } 562 }
605 563
606 /* Deallocate all handler objects installed within GPE info structs */ 564 /* Deallocate all handler objects installed within GPE info structs */
607 565
608 status = acpi_ev_walk_gpe_list (acpi_ev_delete_gpe_handlers); 566 status = acpi_ev_walk_gpe_list(acpi_ev_delete_gpe_handlers);
609 567
610 /* Return to original mode if necessary */ 568 /* Return to original mode if necessary */
611 569
612 if (acpi_gbl_original_mode == ACPI_SYS_MODE_LEGACY) { 570 if (acpi_gbl_original_mode == ACPI_SYS_MODE_LEGACY) {
613 status = acpi_disable (); 571 status = acpi_disable();
614 if (ACPI_FAILURE (status)) { 572 if (ACPI_FAILURE(status)) {
615 ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "acpi_disable failed\n")); 573 ACPI_DEBUG_PRINT((ACPI_DB_WARN,
574 "acpi_disable failed\n"));
616 } 575 }
617 } 576 }
618 return_VOID; 577 return_VOID;
619} 578}
620