diff options
Diffstat (limited to 'drivers/acpi/events/evmisc.c')
-rw-r--r-- | drivers/acpi/events/evmisc.c | 97 |
1 files changed, 63 insertions, 34 deletions
diff --git a/drivers/acpi/events/evmisc.c b/drivers/acpi/events/evmisc.c index 2548efa7a45f..659e90956112 100644 --- a/drivers/acpi/events/evmisc.c +++ b/drivers/acpi/events/evmisc.c | |||
@@ -50,6 +50,35 @@ | |||
50 | ACPI_MODULE_NAME ("evmisc") | 50 | ACPI_MODULE_NAME ("evmisc") |
51 | 51 | ||
52 | 52 | ||
53 | #ifdef ACPI_DEBUG_OUTPUT | ||
54 | static const char *acpi_notify_value_names[] = | ||
55 | { | ||
56 | "Bus Check", | ||
57 | "Device Check", | ||
58 | "Device Wake", | ||
59 | "Eject request", | ||
60 | "Device Check Light", | ||
61 | "Frequency Mismatch", | ||
62 | "Bus Mode Mismatch", | ||
63 | "Power Fault" | ||
64 | }; | ||
65 | #endif | ||
66 | |||
67 | /* Local prototypes */ | ||
68 | |||
69 | static void ACPI_SYSTEM_XFACE | ||
70 | acpi_ev_notify_dispatch ( | ||
71 | void *context); | ||
72 | |||
73 | static void ACPI_SYSTEM_XFACE | ||
74 | acpi_ev_global_lock_thread ( | ||
75 | void *context); | ||
76 | |||
77 | static u32 | ||
78 | acpi_ev_global_lock_handler ( | ||
79 | void *context); | ||
80 | |||
81 | |||
53 | /******************************************************************************* | 82 | /******************************************************************************* |
54 | * | 83 | * |
55 | * FUNCTION: acpi_ev_is_notify_object | 84 | * FUNCTION: acpi_ev_is_notify_object |
@@ -98,20 +127,6 @@ acpi_ev_is_notify_object ( | |||
98 | * | 127 | * |
99 | ******************************************************************************/ | 128 | ******************************************************************************/ |
100 | 129 | ||
101 | #ifdef ACPI_DEBUG_OUTPUT | ||
102 | static const char *acpi_notify_value_names[] = | ||
103 | { | ||
104 | "Bus Check", | ||
105 | "Device Check", | ||
106 | "Device Wake", | ||
107 | "Eject request", | ||
108 | "Device Check Light", | ||
109 | "Frequency Mismatch", | ||
110 | "Bus Mode Mismatch", | ||
111 | "Power Fault" | ||
112 | }; | ||
113 | #endif | ||
114 | |||
115 | acpi_status | 130 | acpi_status |
116 | acpi_ev_queue_notify_request ( | 131 | acpi_ev_queue_notify_request ( |
117 | struct acpi_namespace_node *node, | 132 | struct acpi_namespace_node *node, |
@@ -128,9 +143,10 @@ acpi_ev_queue_notify_request ( | |||
128 | 143 | ||
129 | /* | 144 | /* |
130 | * For value 3 (Ejection Request), some device method may need to be run. | 145 | * For value 3 (Ejection Request), some device method may need to be run. |
131 | * For value 2 (Device Wake) if _PRW exists, the _PS0 method may need to be run. | 146 | * For value 2 (Device Wake) if _PRW exists, the _PS0 method may need |
147 | * to be run. | ||
132 | * For value 0x80 (Status Change) on the power button or sleep button, | 148 | * For value 0x80 (Status Change) on the power button or sleep button, |
133 | * initiate soft-off or sleep operation? | 149 | * initiate soft-off or sleep operation? |
134 | */ | 150 | */ |
135 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, | 151 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, |
136 | "Dispatching Notify(%X) on node %p\n", notify_value, node)); | 152 | "Dispatching Notify(%X) on node %p\n", notify_value, node)); |
@@ -140,8 +156,9 @@ acpi_ev_queue_notify_request ( | |||
140 | acpi_notify_value_names[notify_value])); | 156 | acpi_notify_value_names[notify_value])); |
141 | } | 157 | } |
142 | else { | 158 | else { |
143 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Notify value: 0x%2.2X **Device Specific**\n", | 159 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, |
144 | notify_value)); | 160 | "Notify value: 0x%2.2X **Device Specific**\n", |
161 | notify_value)); | ||
145 | } | 162 | } |
146 | 163 | ||
147 | /* Get the notify object attached to the NS Node */ | 164 | /* Get the notify object attached to the NS Node */ |
@@ -210,7 +227,7 @@ acpi_ev_queue_notify_request ( | |||
210 | * | 227 | * |
211 | * FUNCTION: acpi_ev_notify_dispatch | 228 | * FUNCTION: acpi_ev_notify_dispatch |
212 | * | 229 | * |
213 | * PARAMETERS: Context - To be passsed to the notify handler | 230 | * PARAMETERS: Context - To be passed to the notify handler |
214 | * | 231 | * |
215 | * RETURN: None. | 232 | * RETURN: None. |
216 | * | 233 | * |
@@ -219,7 +236,7 @@ acpi_ev_queue_notify_request ( | |||
219 | * | 236 | * |
220 | ******************************************************************************/ | 237 | ******************************************************************************/ |
221 | 238 | ||
222 | void ACPI_SYSTEM_XFACE | 239 | static void ACPI_SYSTEM_XFACE |
223 | acpi_ev_notify_dispatch ( | 240 | acpi_ev_notify_dispatch ( |
224 | void *context) | 241 | void *context) |
225 | { | 242 | { |
@@ -234,7 +251,8 @@ acpi_ev_notify_dispatch ( | |||
234 | 251 | ||
235 | /* | 252 | /* |
236 | * We will invoke a global notify handler if installed. | 253 | * We will invoke a global notify handler if installed. |
237 | * This is done _before_ we invoke the per-device handler attached to the device. | 254 | * This is done _before_ we invoke the per-device handler attached |
255 | * to the device. | ||
238 | */ | 256 | */ |
239 | if (notify_info->notify.value <= ACPI_MAX_SYS_NOTIFY) { | 257 | if (notify_info->notify.value <= ACPI_MAX_SYS_NOTIFY) { |
240 | /* Global system notification handler */ | 258 | /* Global system notification handler */ |
@@ -256,15 +274,17 @@ acpi_ev_notify_dispatch ( | |||
256 | /* Invoke the system handler first, if present */ | 274 | /* Invoke the system handler first, if present */ |
257 | 275 | ||
258 | if (global_handler) { | 276 | if (global_handler) { |
259 | global_handler (notify_info->notify.node, notify_info->notify.value, global_context); | 277 | global_handler (notify_info->notify.node, notify_info->notify.value, |
278 | global_context); | ||
260 | } | 279 | } |
261 | 280 | ||
262 | /* Now invoke the per-device handler, if present */ | 281 | /* Now invoke the per-device handler, if present */ |
263 | 282 | ||
264 | handler_obj = notify_info->notify.handler_obj; | 283 | handler_obj = notify_info->notify.handler_obj; |
265 | if (handler_obj) { | 284 | if (handler_obj) { |
266 | handler_obj->notify.handler (notify_info->notify.node, notify_info->notify.value, | 285 | handler_obj->notify.handler (notify_info->notify.node, |
267 | handler_obj->notify.context); | 286 | notify_info->notify.value, |
287 | handler_obj->notify.context); | ||
268 | } | 288 | } |
269 | 289 | ||
270 | /* All done with the info object */ | 290 | /* All done with the info object */ |
@@ -370,7 +390,8 @@ acpi_ev_global_lock_handler ( | |||
370 | ******************************************************************************/ | 390 | ******************************************************************************/ |
371 | 391 | ||
372 | acpi_status | 392 | acpi_status |
373 | acpi_ev_init_global_lock_handler (void) | 393 | acpi_ev_init_global_lock_handler ( |
394 | void) | ||
374 | { | 395 | { |
375 | acpi_status status; | 396 | acpi_status status; |
376 | 397 | ||
@@ -380,7 +401,7 @@ acpi_ev_init_global_lock_handler (void) | |||
380 | 401 | ||
381 | acpi_gbl_global_lock_present = TRUE; | 402 | acpi_gbl_global_lock_present = TRUE; |
382 | status = acpi_install_fixed_event_handler (ACPI_EVENT_GLOBAL, | 403 | status = acpi_install_fixed_event_handler (ACPI_EVENT_GLOBAL, |
383 | acpi_ev_global_lock_handler, NULL); | 404 | acpi_ev_global_lock_handler, NULL); |
384 | 405 | ||
385 | /* | 406 | /* |
386 | * If the global lock does not exist on this platform, the attempt | 407 | * If the global lock does not exist on this platform, the attempt |
@@ -433,8 +454,10 @@ acpi_ev_acquire_global_lock ( | |||
433 | 454 | ||
434 | acpi_gbl_global_lock_thread_count++; | 455 | acpi_gbl_global_lock_thread_count++; |
435 | 456 | ||
436 | /* If we (OS side vs. BIOS side) have the hardware lock already, we are done */ | 457 | /* |
437 | 458 | * If we (OS side vs. BIOS side) have the hardware lock already, | |
459 | * we are done | ||
460 | */ | ||
438 | if (acpi_gbl_global_lock_acquired) { | 461 | if (acpi_gbl_global_lock_acquired) { |
439 | return_ACPI_STATUS (AE_OK); | 462 | return_ACPI_STATUS (AE_OK); |
440 | } | 463 | } |
@@ -480,7 +503,8 @@ acpi_ev_acquire_global_lock ( | |||
480 | ******************************************************************************/ | 503 | ******************************************************************************/ |
481 | 504 | ||
482 | acpi_status | 505 | acpi_status |
483 | acpi_ev_release_global_lock (void) | 506 | acpi_ev_release_global_lock ( |
507 | void) | ||
484 | { | 508 | { |
485 | u8 pending = FALSE; | 509 | u8 pending = FALSE; |
486 | acpi_status status = AE_OK; | 510 | acpi_status status = AE_OK; |
@@ -490,7 +514,8 @@ acpi_ev_release_global_lock (void) | |||
490 | 514 | ||
491 | 515 | ||
492 | if (!acpi_gbl_global_lock_thread_count) { | 516 | if (!acpi_gbl_global_lock_thread_count) { |
493 | ACPI_REPORT_WARNING(("Cannot release HW Global Lock, it has not been acquired\n")); | 517 | ACPI_REPORT_WARNING(( |
518 | "Cannot release HW Global Lock, it has not been acquired\n")); | ||
494 | return_ACPI_STATUS (AE_NOT_ACQUIRED); | 519 | return_ACPI_STATUS (AE_NOT_ACQUIRED); |
495 | } | 520 | } |
496 | 521 | ||
@@ -515,7 +540,8 @@ acpi_ev_release_global_lock (void) | |||
515 | * register | 540 | * register |
516 | */ | 541 | */ |
517 | if (pending) { | 542 | if (pending) { |
518 | status = acpi_set_register (ACPI_BITREG_GLOBAL_LOCK_RELEASE, 1, ACPI_MTX_LOCK); | 543 | status = acpi_set_register (ACPI_BITREG_GLOBAL_LOCK_RELEASE, |
544 | 1, ACPI_MTX_LOCK); | ||
519 | } | 545 | } |
520 | 546 | ||
521 | return_ACPI_STATUS (status); | 547 | return_ACPI_STATUS (status); |
@@ -535,7 +561,8 @@ acpi_ev_release_global_lock (void) | |||
535 | ******************************************************************************/ | 561 | ******************************************************************************/ |
536 | 562 | ||
537 | void | 563 | void |
538 | acpi_ev_terminate (void) | 564 | acpi_ev_terminate ( |
565 | void) | ||
539 | { | 566 | { |
540 | acpi_native_uint i; | 567 | acpi_native_uint i; |
541 | acpi_status status; | 568 | acpi_status status; |
@@ -555,7 +582,8 @@ acpi_ev_terminate (void) | |||
555 | for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) { | 582 | for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) { |
556 | status = acpi_disable_event ((u32) i, 0); | 583 | status = acpi_disable_event ((u32) i, 0); |
557 | if (ACPI_FAILURE (status)) { | 584 | if (ACPI_FAILURE (status)) { |
558 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not disable fixed event %d\n", (u32) i)); | 585 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
586 | "Could not disable fixed event %d\n", (u32) i)); | ||
559 | } | 587 | } |
560 | } | 588 | } |
561 | 589 | ||
@@ -567,7 +595,8 @@ acpi_ev_terminate (void) | |||
567 | 595 | ||
568 | status = acpi_ev_remove_sci_handler (); | 596 | status = acpi_ev_remove_sci_handler (); |
569 | if (ACPI_FAILURE(status)) { | 597 | if (ACPI_FAILURE(status)) { |
570 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not remove SCI handler\n")); | 598 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
599 | "Could not remove SCI handler\n")); | ||
571 | } | 600 | } |
572 | } | 601 | } |
573 | 602 | ||