aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
authorBob Moore <robert.moore@intel.com>2008-11-12 03:01:56 -0500
committerLen Brown <len.brown@intel.com>2008-12-29 22:38:37 -0500
commit9f15fc666ef54afc7aff31dfa31edecf00e0d81a (patch)
treeb7fee548a54ac5c1a599035e16160a9ac2162e45 /drivers/acpi
parent009c4cbe99bea2da53f29ad685975a36f38c001c (diff)
ACPICA: Reformat comments, no functional changes
Reformat comments to use fewer lines. Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Lin Ming <ming.m.lin@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/events/evevent.c14
-rw-r--r--drivers/acpi/events/evgpe.c36
-rw-r--r--drivers/acpi/events/evgpeblk.c38
-rw-r--r--drivers/acpi/events/evmisc.c29
-rw-r--r--drivers/acpi/events/evregion.c133
-rw-r--r--drivers/acpi/events/evrgnini.c41
-rw-r--r--drivers/acpi/events/evsci.c10
-rw-r--r--drivers/acpi/events/evxface.c2
-rw-r--r--drivers/acpi/events/evxfevnt.c12
9 files changed, 152 insertions, 163 deletions
diff --git a/drivers/acpi/events/evevent.c b/drivers/acpi/events/evevent.c
index c56c5c6ea77b..6ddf938290f1 100644
--- a/drivers/acpi/events/evevent.c
+++ b/drivers/acpi/events/evevent.c
@@ -72,8 +72,8 @@ acpi_status acpi_ev_initialize_events(void)
72 72
73 /* 73 /*
74 * Initialize the Fixed and General Purpose Events. This is done prior to 74 * Initialize the Fixed and General Purpose Events. This is done prior to
75 * enabling SCIs to prevent interrupts from occurring before the handlers are 75 * enabling SCIs to prevent interrupts from occurring before the handlers
76 * installed. 76 * are installed.
77 */ 77 */
78 status = acpi_ev_fixed_event_initialize(); 78 status = acpi_ev_fixed_event_initialize();
79 if (ACPI_FAILURE(status)) { 79 if (ACPI_FAILURE(status)) {
@@ -192,8 +192,8 @@ static acpi_status acpi_ev_fixed_event_initialize(void)
192 acpi_status status; 192 acpi_status status;
193 193
194 /* 194 /*
195 * Initialize the structure that keeps track of fixed event handlers 195 * Initialize the structure that keeps track of fixed event handlers and
196 * and enable the fixed events. 196 * enable the fixed events.
197 */ 197 */
198 for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) { 198 for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) {
199 acpi_gbl_fixed_event_handlers[i].handler = NULL; 199 acpi_gbl_fixed_event_handlers[i].handler = NULL;
@@ -237,7 +237,7 @@ u32 acpi_ev_fixed_event_detect(void)
237 237
238 /* 238 /*
239 * Read the fixed feature status and enable registers, as all the cases 239 * Read the fixed feature status and enable registers, as all the cases
240 * depend on their values. Ignore errors here. 240 * depend on their values. Ignore errors here.
241 */ 241 */
242 (void)acpi_hw_register_read(ACPI_REGISTER_PM1_STATUS, &fixed_status); 242 (void)acpi_hw_register_read(ACPI_REGISTER_PM1_STATUS, &fixed_status);
243 (void)acpi_hw_register_read(ACPI_REGISTER_PM1_ENABLE, &fixed_enable); 243 (void)acpi_hw_register_read(ACPI_REGISTER_PM1_ENABLE, &fixed_enable);
@@ -291,8 +291,8 @@ static u32 acpi_ev_fixed_event_dispatch(u32 event)
291 status_register_id, 1); 291 status_register_id, 1);
292 292
293 /* 293 /*
294 * Make sure we've got a handler. If not, report an error. 294 * Make sure we've got a handler. If not, report an error. The event is
295 * The event is disabled to prevent further interrupts. 295 * disabled to prevent further interrupts.
296 */ 296 */
297 if (NULL == acpi_gbl_fixed_event_handlers[event].handler) { 297 if (NULL == acpi_gbl_fixed_event_handlers[event].handler) {
298 (void)acpi_set_register(acpi_gbl_fixed_event_info[event]. 298 (void)acpi_set_register(acpi_gbl_fixed_event_info[event].
diff --git a/drivers/acpi/events/evgpe.c b/drivers/acpi/events/evgpe.c
index f45c74fe745e..12b49d312ad3 100644
--- a/drivers/acpi/events/evgpe.c
+++ b/drivers/acpi/events/evgpe.c
@@ -125,7 +125,7 @@ acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info,
125 (1 << 125 (1 <<
126 (gpe_event_info->gpe_number - gpe_register_info->base_gpe_number)); 126 (gpe_event_info->gpe_number - gpe_register_info->base_gpe_number));
127 127
128 /* 1) Disable case. Simply clear all enable bits */ 128 /* 1) Disable case. Simply clear all enable bits */
129 129
130 if (type == ACPI_GPE_DISABLE) { 130 if (type == ACPI_GPE_DISABLE) {
131 ACPI_CLEAR_BIT(gpe_register_info->enable_for_wake, 131 ACPI_CLEAR_BIT(gpe_register_info->enable_for_wake,
@@ -134,7 +134,7 @@ acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info,
134 return_ACPI_STATUS(AE_OK); 134 return_ACPI_STATUS(AE_OK);
135 } 135 }
136 136
137 /* 2) Enable case. Set/Clear the appropriate enable bits */ 137 /* 2) Enable case. Set/Clear the appropriate enable bits */
138 138
139 switch (gpe_event_info->flags & ACPI_GPE_TYPE_MASK) { 139 switch (gpe_event_info->flags & ACPI_GPE_TYPE_MASK) {
140 case ACPI_GPE_TYPE_WAKE: 140 case ACPI_GPE_TYPE_WAKE:
@@ -295,7 +295,7 @@ acpi_status acpi_ev_disable_gpe(struct acpi_gpe_event_info *gpe_event_info)
295 * 295 *
296 * FUNCTION: acpi_ev_get_gpe_event_info 296 * FUNCTION: acpi_ev_get_gpe_event_info
297 * 297 *
298 * PARAMETERS: gpe_device - Device node. NULL for GPE0/GPE1 298 * PARAMETERS: gpe_device - Device node. NULL for GPE0/GPE1
299 * gpe_number - Raw GPE number 299 * gpe_number - Raw GPE number
300 * 300 *
301 * RETURN: A GPE event_info struct. NULL if not a valid GPE 301 * RETURN: A GPE event_info struct. NULL if not a valid GPE
@@ -372,7 +372,7 @@ struct acpi_gpe_event_info *acpi_ev_get_gpe_event_info(acpi_handle gpe_device,
372 * 372 *
373 * RETURN: INTERRUPT_HANDLED or INTERRUPT_NOT_HANDLED 373 * RETURN: INTERRUPT_HANDLED or INTERRUPT_NOT_HANDLED
374 * 374 *
375 * DESCRIPTION: Detect if any GP events have occurred. This function is 375 * DESCRIPTION: Detect if any GP events have occurred. This function is
376 * executed at interrupt level. 376 * executed at interrupt level.
377 * 377 *
378 ******************************************************************************/ 378 ******************************************************************************/
@@ -400,8 +400,8 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list)
400 400
401 /* 401 /*
402 * We need to obtain the GPE lock for both the data structs and registers 402 * We need to obtain the GPE lock for both the data structs and registers
403 * Note: Not necessary to obtain the hardware lock, since the GPE registers 403 * Note: Not necessary to obtain the hardware lock, since the GPE
404 * are owned by the gpe_lock. 404 * registers are owned by the gpe_lock.
405 */ 405 */
406 flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); 406 flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
407 407
@@ -410,9 +410,8 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list)
410 gpe_block = gpe_xrupt_list->gpe_block_list_head; 410 gpe_block = gpe_xrupt_list->gpe_block_list_head;
411 while (gpe_block) { 411 while (gpe_block) {
412 /* 412 /*
413 * Read all of the 8-bit GPE status and enable registers 413 * Read all of the 8-bit GPE status and enable registers in this GPE
414 * in this GPE block, saving all of them. 414 * block, saving all of them. Find all currently active GP events.
415 * Find all currently active GP events.
416 */ 415 */
417 for (i = 0; i < gpe_block->register_count; i++) { 416 for (i = 0; i < gpe_block->register_count; i++) {
418 417
@@ -527,8 +526,8 @@ static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context)
527 (void)acpi_ev_enable_gpe(gpe_event_info, FALSE); 526 (void)acpi_ev_enable_gpe(gpe_event_info, FALSE);
528 527
529 /* 528 /*
530 * Take a snapshot of the GPE info for this level - we copy the 529 * Take a snapshot of the GPE info for this level - we copy the info to
531 * info to prevent a race condition with remove_handler/remove_block. 530 * prevent a race condition with remove_handler/remove_block.
532 */ 531 */
533 ACPI_MEMCPY(&local_gpe_event_info, gpe_event_info, 532 ACPI_MEMCPY(&local_gpe_event_info, gpe_event_info,
534 sizeof(struct acpi_gpe_event_info)); 533 sizeof(struct acpi_gpe_event_info));
@@ -539,8 +538,8 @@ static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context)
539 } 538 }
540 539
541 /* 540 /*
542 * Must check for control method type dispatch one more 541 * Must check for control method type dispatch one more time to avoid a
543 * time to avoid race with ev_gpe_install_handler 542 * race with ev_gpe_install_handler
544 */ 543 */
545 if ((local_gpe_event_info.flags & ACPI_GPE_DISPATCH_MASK) == 544 if ((local_gpe_event_info.flags & ACPI_GPE_DISPATCH_MASK) ==
546 ACPI_GPE_DISPATCH_METHOD) { 545 ACPI_GPE_DISPATCH_METHOD) {
@@ -584,8 +583,8 @@ static void acpi_ev_asynch_enable_gpe(void *context)
584 if ((gpe_event_info->flags & ACPI_GPE_XRUPT_TYPE_MASK) == 583 if ((gpe_event_info->flags & ACPI_GPE_XRUPT_TYPE_MASK) ==
585 ACPI_GPE_LEVEL_TRIGGERED) { 584 ACPI_GPE_LEVEL_TRIGGERED) {
586 /* 585 /*
587 * GPE is level-triggered, we clear the GPE status bit after 586 * GPE is level-triggered, we clear the GPE status bit after handling
588 * handling the event. 587 * the event.
589 */ 588 */
590 status = acpi_hw_clear_gpe(gpe_event_info); 589 status = acpi_hw_clear_gpe(gpe_event_info);
591 if (ACPI_FAILURE(status)) { 590 if (ACPI_FAILURE(status)) {
@@ -624,7 +623,7 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number)
624 acpi_os_gpe_count(gpe_number); 623 acpi_os_gpe_count(gpe_number);
625 624
626 /* 625 /*
627 * If edge-triggered, clear the GPE status bit now. Note that 626 * If edge-triggered, clear the GPE status bit now. Note that
628 * level-triggered events are cleared after the GPE is serviced. 627 * level-triggered events are cleared after the GPE is serviced.
629 */ 628 */
630 if ((gpe_event_info->flags & ACPI_GPE_XRUPT_TYPE_MASK) == 629 if ((gpe_event_info->flags & ACPI_GPE_XRUPT_TYPE_MASK) ==
@@ -650,7 +649,8 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number)
650 649
651 /* 650 /*
652 * Invoke the installed handler (at interrupt level) 651 * Invoke the installed handler (at interrupt level)
653 * Ignore return status for now. TBD: leave GPE disabled on error? 652 * Ignore return status for now.
653 * TBD: leave GPE disabled on error?
654 */ 654 */
655 (void)gpe_event_info->dispatch.handler->address(gpe_event_info-> 655 (void)gpe_event_info->dispatch.handler->address(gpe_event_info->
656 dispatch. 656 dispatch.
@@ -708,7 +708,7 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number)
708 gpe_number)); 708 gpe_number));
709 709
710 /* 710 /*
711 * Disable the GPE. The GPE will remain disabled until the ACPI 711 * Disable the GPE. The GPE will remain disabled until the ACPICA
712 * Core Subsystem is restarted, or a handler is installed. 712 * Core Subsystem is restarted, or a handler is installed.
713 */ 713 */
714 status = acpi_ev_disable_gpe(gpe_event_info); 714 status = acpi_ev_disable_gpe(gpe_event_info);
diff --git a/drivers/acpi/events/evgpeblk.c b/drivers/acpi/events/evgpeblk.c
index 73c058e2f5c2..7537cda54050 100644
--- a/drivers/acpi/events/evgpeblk.c
+++ b/drivers/acpi/events/evgpeblk.c
@@ -309,17 +309,17 @@ acpi_ev_save_method_info(acpi_handle obj_handle,
309 (gpe_block->block_base_number + 309 (gpe_block->block_base_number +
310 (gpe_block->register_count * 8)))) { 310 (gpe_block->register_count * 8)))) {
311 /* 311 /*
312 * Not valid for this GPE block, just ignore it 312 * Not valid for this GPE block, just ignore it. However, it may be
313 * However, it may be valid for a different GPE block, since GPE0 and GPE1 313 * valid for a different GPE block, since GPE0 and GPE1 methods both
314 * methods both appear under \_GPE. 314 * appear under \_GPE.
315 */ 315 */
316 return_ACPI_STATUS(AE_OK); 316 return_ACPI_STATUS(AE_OK);
317 } 317 }
318 318
319 /* 319 /*
320 * Now we can add this information to the gpe_event_info block 320 * Now we can add this information to the gpe_event_info block for use
321 * for use during dispatch of this GPE. Default type is RUNTIME, although 321 * during dispatch of this GPE. Default type is RUNTIME, although this may
322 * this may change when the _PRW methods are executed later. 322 * change when the _PRW methods are executed later.
323 */ 323 */
324 gpe_event_info = 324 gpe_event_info =
325 &gpe_block->event_info[gpe_number - gpe_block->block_base_number]; 325 &gpe_block->event_info[gpe_number - gpe_block->block_base_number];
@@ -394,8 +394,8 @@ acpi_ev_match_prw_and_gpe(acpi_handle obj_handle,
394 gpe_block = gpe_info->gpe_block; 394 gpe_block = gpe_info->gpe_block;
395 395
396 /* 396 /*
397 * The _PRW object must return a package, we are only interested 397 * The _PRW object must return a package, we are only interested in the
398 * in the first element 398 * first element
399 */ 399 */
400 obj_desc = pkg_desc->package.elements[0]; 400 obj_desc = pkg_desc->package.elements[0];
401 401
@@ -434,7 +434,7 @@ acpi_ev_match_prw_and_gpe(acpi_handle obj_handle,
434 /* 434 /*
435 * Is this GPE within this block? 435 * Is this GPE within this block?
436 * 436 *
437 * TRUE iff these conditions are true: 437 * TRUE if and only if these conditions are true:
438 * 1) The GPE devices match. 438 * 1) The GPE devices match.
439 * 2) The GPE index(number) is within the range of the Gpe Block 439 * 2) The GPE index(number) is within the range of the Gpe Block
440 * associated with the GPE device. 440 * associated with the GPE device.
@@ -457,6 +457,7 @@ acpi_ev_match_prw_and_gpe(acpi_handle obj_handle,
457 if (ACPI_FAILURE(status)) { 457 if (ACPI_FAILURE(status)) {
458 goto cleanup; 458 goto cleanup;
459 } 459 }
460
460 status = 461 status =
461 acpi_ev_update_gpe_enable_masks(gpe_event_info, 462 acpi_ev_update_gpe_enable_masks(gpe_event_info,
462 ACPI_GPE_DISABLE); 463 ACPI_GPE_DISABLE);
@@ -476,9 +477,9 @@ acpi_ev_match_prw_and_gpe(acpi_handle obj_handle,
476 * RETURN: A GPE interrupt block 477 * RETURN: A GPE interrupt block
477 * 478 *
478 * DESCRIPTION: Get or Create a GPE interrupt block. There is one interrupt 479 * DESCRIPTION: Get or Create a GPE interrupt block. There is one interrupt
479 * block per unique interrupt level used for GPEs. 480 * block per unique interrupt level used for GPEs. Should be
480 * Should be called only when the GPE lists are semaphore locked 481 * called only when the GPE lists are semaphore locked and not
481 * and not subject to change. 482 * subject to change.
482 * 483 *
483 ******************************************************************************/ 484 ******************************************************************************/
484 485
@@ -608,8 +609,9 @@ acpi_ev_delete_gpe_xrupt(struct acpi_gpe_xrupt_info *gpe_xrupt)
608 * 609 *
609 * FUNCTION: acpi_ev_install_gpe_block 610 * FUNCTION: acpi_ev_install_gpe_block
610 * 611 *
611 * PARAMETERS: gpe_block - New GPE block 612 * PARAMETERS: gpe_block - New GPE block
612 * interrupt_number - Xrupt to be associated with this GPE block 613 * interrupt_number - Xrupt to be associated with this
614 * GPE block
613 * 615 *
614 * RETURN: Status 616 * RETURN: Status
615 * 617 *
@@ -666,7 +668,7 @@ acpi_ev_install_gpe_block(struct acpi_gpe_block_info *gpe_block,
666 * 668 *
667 * FUNCTION: acpi_ev_delete_gpe_block 669 * FUNCTION: acpi_ev_delete_gpe_block
668 * 670 *
669 * PARAMETERS: gpe_block - Existing GPE block 671 * PARAMETERS: gpe_block - Existing GPE block
670 * 672 *
671 * RETURN: Status 673 * RETURN: Status
672 * 674 *
@@ -786,9 +788,9 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block)
786 788
787 /* 789 /*
788 * Initialize the GPE Register and Event structures. A goal of these 790 * Initialize the GPE Register and Event structures. A goal of these
789 * tables is to hide the fact that there are two separate GPE register sets 791 * tables is to hide the fact that there are two separate GPE register
790 * in a given GPE hardware block, the status registers occupy the first half, 792 * sets in a given GPE hardware block, the status registers occupy the
791 * and the enable registers occupy the second half. 793 * first half, and the enable registers occupy the second half.
792 */ 794 */
793 this_register = gpe_register_info; 795 this_register = gpe_register_info;
794 this_event = gpe_event_info; 796 this_event = gpe_event_info;
diff --git a/drivers/acpi/events/evmisc.c b/drivers/acpi/events/evmisc.c
index 82c457fa5a1f..dbac5b3248a0 100644
--- a/drivers/acpi/events/evmisc.c
+++ b/drivers/acpi/events/evmisc.c
@@ -148,7 +148,9 @@ acpi_ev_queue_notify_request(struct acpi_namespace_node * node,
148 break; 148 break;
149 149
150 default: 150 default:
151
151 /* All other types are not supported */ 152 /* All other types are not supported */
153
152 return (AE_TYPE); 154 return (AE_TYPE);
153 } 155 }
154 } 156 }
@@ -189,9 +191,8 @@ acpi_ev_queue_notify_request(struct acpi_namespace_node * node,
189 acpi_ut_delete_generic_state(notify_info); 191 acpi_ut_delete_generic_state(notify_info);
190 } 192 }
191 } else { 193 } else {
192 /* 194 /* There is no notify handler (per-device or system) for this device */
193 * There is no notify handler (per-device or system) for this device. 195
194 */
195 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 196 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
196 "No notify handler for Notify (%4.4s, %X) node %p\n", 197 "No notify handler for Notify (%4.4s, %X) node %p\n",
197 acpi_ut_get_node_name(node), notify_value, 198 acpi_ut_get_node_name(node), notify_value,
@@ -225,9 +226,8 @@ static void ACPI_SYSTEM_XFACE acpi_ev_notify_dispatch(void *context)
225 ACPI_FUNCTION_ENTRY(); 226 ACPI_FUNCTION_ENTRY();
226 227
227 /* 228 /*
228 * We will invoke a global notify handler if installed. 229 * We will invoke a global notify handler if installed. This is done
229 * This is done _before_ we invoke the per-device handler attached 230 * _before_ we invoke the per-device handler attached to the device.
230 * to the device.
231 */ 231 */
232 if (notify_info->notify.value <= ACPI_MAX_SYS_NOTIFY) { 232 if (notify_info->notify.value <= ACPI_MAX_SYS_NOTIFY) {
233 233
@@ -339,11 +339,10 @@ acpi_status acpi_ev_init_global_lock_handler(void)
339 NULL); 339 NULL);
340 340
341 /* 341 /*
342 * If the global lock does not exist on this platform, the attempt 342 * If the global lock does not exist on this platform, the attempt to
343 * to enable GBL_STATUS will fail (the GBL_ENABLE bit will not stick) 343 * enable GBL_STATUS will fail (the GBL_ENABLE bit will not stick).
344 * Map to AE_OK, but mark global lock as not present. 344 * Map to AE_OK, but mark global lock as not present. Any attempt to
345 * Any attempt to actually use the global lock will be flagged 345 * actually use the global lock will be flagged with an error.
346 * with an error.
347 */ 346 */
348 if (status == AE_NO_HARDWARE_RESPONSE) { 347 if (status == AE_NO_HARDWARE_RESPONSE) {
349 ACPI_ERROR((AE_INFO, 348 ACPI_ERROR((AE_INFO,
@@ -452,8 +451,8 @@ acpi_status acpi_ev_acquire_global_lock(u16 timeout)
452 } 451 }
453 452
454 /* 453 /*
455 * Make sure that a global lock actually exists. If not, just treat 454 * Make sure that a global lock actually exists. If not, just treat the
456 * the lock as a standard mutex. 455 * lock as a standard mutex.
457 */ 456 */
458 if (!acpi_gbl_global_lock_present) { 457 if (!acpi_gbl_global_lock_present) {
459 acpi_gbl_global_lock_acquired = TRUE; 458 acpi_gbl_global_lock_acquired = TRUE;
@@ -572,8 +571,8 @@ void acpi_ev_terminate(void)
572 571
573 if (acpi_gbl_events_initialized) { 572 if (acpi_gbl_events_initialized) {
574 /* 573 /*
575 * Disable all event-related functionality. 574 * Disable all event-related functionality. In all cases, on error,
576 * In all cases, on error, print a message but obviously we don't abort. 575 * print a message but obviously we don't abort.
577 */ 576 */
578 577
579 /* Disable all fixed events */ 578 /* Disable all fixed events */
diff --git a/drivers/acpi/events/evregion.c b/drivers/acpi/events/evregion.c
index 236fbd1ca438..3ddddbfa8db7 100644
--- a/drivers/acpi/events/evregion.c
+++ b/drivers/acpi/events/evregion.c
@@ -48,16 +48,8 @@
48 48
49#define _COMPONENT ACPI_EVENTS 49#define _COMPONENT ACPI_EVENTS
50ACPI_MODULE_NAME("evregion") 50ACPI_MODULE_NAME("evregion")
51#define ACPI_NUM_DEFAULT_SPACES 4
52static u8 acpi_gbl_default_address_spaces[ACPI_NUM_DEFAULT_SPACES] = {
53 ACPI_ADR_SPACE_SYSTEM_MEMORY,
54 ACPI_ADR_SPACE_SYSTEM_IO,
55 ACPI_ADR_SPACE_PCI_CONFIG,
56 ACPI_ADR_SPACE_DATA_TABLE
57};
58 51
59/* Local prototypes */ 52/* Local prototypes */
60
61static acpi_status 53static acpi_status
62acpi_ev_reg_run(acpi_handle obj_handle, 54acpi_ev_reg_run(acpi_handle obj_handle,
63 u32 level, void *context, void **return_value); 55 u32 level, void *context, void **return_value);
@@ -66,6 +58,17 @@ static acpi_status
66acpi_ev_install_handler(acpi_handle obj_handle, 58acpi_ev_install_handler(acpi_handle obj_handle,
67 u32 level, void *context, void **return_value); 59 u32 level, void *context, void **return_value);
68 60
61/* These are the address spaces that will get default handlers */
62
63#define ACPI_NUM_DEFAULT_SPACES 4
64
65static u8 acpi_gbl_default_address_spaces[ACPI_NUM_DEFAULT_SPACES] = {
66 ACPI_ADR_SPACE_SYSTEM_MEMORY,
67 ACPI_ADR_SPACE_SYSTEM_IO,
68 ACPI_ADR_SPACE_PCI_CONFIG,
69 ACPI_ADR_SPACE_DATA_TABLE
70};
71
69/******************************************************************************* 72/*******************************************************************************
70 * 73 *
71 * FUNCTION: acpi_ev_install_region_handlers 74 * FUNCTION: acpi_ev_install_region_handlers
@@ -91,18 +94,19 @@ acpi_status acpi_ev_install_region_handlers(void)
91 } 94 }
92 95
93 /* 96 /*
94 * All address spaces (PCI Config, EC, SMBus) are scope dependent 97 * All address spaces (PCI Config, EC, SMBus) are scope dependent and
95 * and registration must occur for a specific device. 98 * registration must occur for a specific device.
96 * 99 *
97 * In the case of the system memory and IO address spaces there is currently 100 * In the case of the system memory and IO address spaces there is
98 * no device associated with the address space. For these we use the root. 101 * currently no device associated with the address space. For these we
102 * use the root.
99 * 103 *
100 * We install the default PCI config space handler at the root so 104 * We install the default PCI config space handler at the root so that
101 * that this space is immediately available even though the we have 105 * this space is immediately available even though the we have not
102 * not enumerated all the PCI Root Buses yet. This is to conform 106 * enumerated all the PCI Root Buses yet. This is to conform to the ACPI
103 * to the ACPI specification which states that the PCI config 107 * specification which states that the PCI config space must be always
104 * space must be always available -- even though we are nowhere 108 * available -- even though we are nowhere near ready to find the PCI root
105 * near ready to find the PCI root buses at this point. 109 * buses at this point.
106 * 110 *
107 * NOTE: We ignore AE_ALREADY_EXISTS because this means that a handler 111 * NOTE: We ignore AE_ALREADY_EXISTS because this means that a handler
108 * has already been installed (via acpi_install_address_space_handler). 112 * has already been installed (via acpi_install_address_space_handler).
@@ -160,12 +164,11 @@ acpi_status acpi_ev_initialize_op_regions(void)
160 return_ACPI_STATUS(status); 164 return_ACPI_STATUS(status);
161 } 165 }
162 166
163 /* 167 /* Run the _REG methods for op_regions in each default address space */
164 * Run the _REG methods for op_regions in each default address space
165 */
166 for (i = 0; i < ACPI_NUM_DEFAULT_SPACES; i++) {
167 168
168 /* TBD: Make sure handler is the DEFAULT handler, otherwise 169 for (i = 0; i < ACPI_NUM_DEFAULT_SPACES; i++) {
170 /*
171 * TBD: Make sure handler is the DEFAULT handler, otherwise
169 * _REG will have already been run. 172 * _REG will have already been run.
170 */ 173 */
171 status = acpi_ev_execute_reg_methods(acpi_gbl_root_node, 174 status = acpi_ev_execute_reg_methods(acpi_gbl_root_node,
@@ -318,13 +321,13 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
318 } 321 }
319 322
320 /* 323 /*
321 * It may be the case that the region has never been initialized 324 * It may be the case that the region has never been initialized.
322 * Some types of regions require special init code 325 * Some types of regions require special init code
323 */ 326 */
324 if (!(region_obj->region.flags & AOPOBJ_SETUP_COMPLETE)) { 327 if (!(region_obj->region.flags & AOPOBJ_SETUP_COMPLETE)) {
325 /* 328
326 * This region has not been initialized yet, do it 329 /* This region has not been initialized yet, do it */
327 */ 330
328 region_setup = handler_desc->address_space.setup; 331 region_setup = handler_desc->address_space.setup;
329 if (!region_setup) { 332 if (!region_setup) {
330 333
@@ -339,9 +342,9 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
339 } 342 }
340 343
341 /* 344 /*
342 * We must exit the interpreter because the region 345 * We must exit the interpreter because the region setup will
343 * setup will potentially execute control methods 346 * potentially execute control methods (for example, the _REG method
344 * (e.g., _REG method for this region) 347 * for this region)
345 */ 348 */
346 acpi_ex_exit_interpreter(); 349 acpi_ex_exit_interpreter();
347 350
@@ -364,9 +367,8 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
364 return_ACPI_STATUS(status); 367 return_ACPI_STATUS(status);
365 } 368 }
366 369
367 /* 370 /* Region initialization may have been completed by region_setup */
368 * Region initialization may have been completed by region_setup 371
369 */
370 if (!(region_obj->region.flags & AOPOBJ_SETUP_COMPLETE)) { 372 if (!(region_obj->region.flags & AOPOBJ_SETUP_COMPLETE)) {
371 region_obj->region.flags |= AOPOBJ_SETUP_COMPLETE; 373 region_obj->region.flags |= AOPOBJ_SETUP_COMPLETE;
372 374
@@ -521,8 +523,8 @@ acpi_ev_detach_region(union acpi_operand_object *region_obj,
521 } 523 }
522 524
523 /* 525 /*
524 * If the region has been activated, call the setup handler 526 * If the region has been activated, call the setup handler with
525 * with the deactivate notification 527 * the deactivate notification
526 */ 528 */
527 if (region_obj->region.flags & AOPOBJ_SETUP_COMPLETE) { 529 if (region_obj->region.flags & AOPOBJ_SETUP_COMPLETE) {
528 region_setup = handler_obj->address_space.setup; 530 region_setup = handler_obj->address_space.setup;
@@ -668,8 +670,8 @@ acpi_ev_install_handler(acpi_handle obj_handle,
668 } 670 }
669 671
670 /* 672 /*
671 * We only care about regions.and objects 673 * We only care about regions and objects that are allowed to have
672 * that are allowed to have address space handlers 674 * address space handlers
673 */ 675 */
674 if ((node->type != ACPI_TYPE_DEVICE) && 676 if ((node->type != ACPI_TYPE_DEVICE) &&
675 (node->type != ACPI_TYPE_REGION) && (node != acpi_gbl_root_node)) { 677 (node->type != ACPI_TYPE_REGION) && (node != acpi_gbl_root_node)) {
@@ -710,9 +712,9 @@ acpi_ev_install_handler(acpi_handle obj_handle,
710 /* 712 /*
711 * Since the object we found it on was a device, then it 713 * Since the object we found it on was a device, then it
712 * means that someone has already installed a handler for 714 * means that someone has already installed a handler for
713 * the branch of the namespace from this device on. Just 715 * the branch of the namespace from this device on. Just
714 * bail out telling the walk routine to not traverse this 716 * bail out telling the walk routine to not traverse this
715 * branch. This preserves the scoping rule for handlers. 717 * branch. This preserves the scoping rule for handlers.
716 */ 718 */
717 return (AE_CTRL_DEPTH); 719 return (AE_CTRL_DEPTH);
718 } 720 }
@@ -723,9 +725,8 @@ acpi_ev_install_handler(acpi_handle obj_handle,
723 } 725 }
724 726
725 /* 727 /*
726 * As long as the device didn't have a handler for this 728 * As long as the device didn't have a handler for this space we
727 * space we don't care about it. We just ignore it and 729 * don't care about it. We just ignore it and proceed.
728 * proceed.
729 */ 730 */
730 return (AE_OK); 731 return (AE_OK);
731 } 732 }
@@ -733,16 +734,14 @@ acpi_ev_install_handler(acpi_handle obj_handle,
733 /* Object is a Region */ 734 /* Object is a Region */
734 735
735 if (obj_desc->region.space_id != handler_obj->address_space.space_id) { 736 if (obj_desc->region.space_id != handler_obj->address_space.space_id) {
736 /* 737
737 * This region is for a different address space 738 /* This region is for a different address space, just ignore it */
738 * -- just ignore it 739
739 */
740 return (AE_OK); 740 return (AE_OK);
741 } 741 }
742 742
743 /* 743 /*
744 * Now we have a region and it is for the handler's address 744 * Now we have a region and it is for the handler's address space type.
745 * space type.
746 * 745 *
747 * First disconnect region for any previous handler (if any) 746 * First disconnect region for any previous handler (if any)
748 */ 747 */
@@ -786,9 +785,8 @@ acpi_ev_install_space_handler(struct acpi_namespace_node * node,
786 ACPI_FUNCTION_TRACE(ev_install_space_handler); 785 ACPI_FUNCTION_TRACE(ev_install_space_handler);
787 786
788 /* 787 /*
789 * This registration is valid for only the types below 788 * This registration is valid for only the types below and the root. This
790 * and the root. This is where the default handlers 789 * is where the default handlers get placed.
791 * get placed.
792 */ 790 */
793 if ((node->type != ACPI_TYPE_DEVICE) && 791 if ((node->type != ACPI_TYPE_DEVICE) &&
794 (node->type != ACPI_TYPE_PROCESSOR) && 792 (node->type != ACPI_TYPE_PROCESSOR) &&
@@ -848,8 +846,8 @@ acpi_ev_install_space_handler(struct acpi_namespace_node * node,
848 obj_desc = acpi_ns_get_attached_object(node); 846 obj_desc = acpi_ns_get_attached_object(node);
849 if (obj_desc) { 847 if (obj_desc) {
850 /* 848 /*
851 * The attached device object already exists. 849 * The attached device object already exists. Make sure the handler
852 * Make sure the handler is not already installed. 850 * is not already installed.
853 */ 851 */
854 handler_obj = obj_desc->device.handler; 852 handler_obj = obj_desc->device.handler;
855 853
@@ -864,8 +862,8 @@ acpi_ev_install_space_handler(struct acpi_namespace_node * node,
864 handler) { 862 handler) {
865 /* 863 /*
866 * It is (relatively) OK to attempt to install the SAME 864 * It is (relatively) OK to attempt to install the SAME
867 * handler twice. This can easily happen 865 * handler twice. This can easily happen with the
868 * with PCI_Config space. 866 * PCI_Config space.
869 */ 867 */
870 status = AE_SAME_HANDLER; 868 status = AE_SAME_HANDLER;
871 goto unlock_and_exit; 869 goto unlock_and_exit;
@@ -925,9 +923,8 @@ acpi_ev_install_space_handler(struct acpi_namespace_node * node,
925 /* 923 /*
926 * Install the handler 924 * Install the handler
927 * 925 *
928 * At this point there is no existing handler. 926 * At this point there is no existing handler. Just allocate the object
929 * Just allocate the object for the handler and link it 927 * for the handler and link it into the list.
930 * into the list.
931 */ 928 */
932 handler_obj = 929 handler_obj =
933 acpi_ut_create_internal_object(ACPI_TYPE_LOCAL_ADDRESS_HANDLER); 930 acpi_ut_create_internal_object(ACPI_TYPE_LOCAL_ADDRESS_HANDLER);
@@ -1000,11 +997,10 @@ acpi_ev_execute_reg_methods(struct acpi_namespace_node *node,
1000 ACPI_FUNCTION_TRACE(ev_execute_reg_methods); 997 ACPI_FUNCTION_TRACE(ev_execute_reg_methods);
1001 998
1002 /* 999 /*
1003 * Run all _REG methods for all Operation Regions for this 1000 * Run all _REG methods for all Operation Regions for this space ID. This
1004 * space ID. This is a separate walk in order to handle any 1001 * is a separate walk in order to handle any interdependencies between
1005 * interdependencies between regions and _REG methods. (i.e. handlers 1002 * regions and _REG methods. (i.e. handlers must be installed for all
1006 * must be installed for all regions of this Space ID before we 1003 * regions of this Space ID before we can run any _REG methods)
1007 * can run any _REG methods)
1008 */ 1004 */
1009 status = acpi_ns_walk_namespace(ACPI_TYPE_ANY, node, ACPI_UINT32_MAX, 1005 status = acpi_ns_walk_namespace(ACPI_TYPE_ANY, node, ACPI_UINT32_MAX,
1010 ACPI_NS_WALK_UNLOCK, acpi_ev_reg_run, 1006 ACPI_NS_WALK_UNLOCK, acpi_ev_reg_run,
@@ -1042,8 +1038,8 @@ acpi_ev_reg_run(acpi_handle obj_handle,
1042 } 1038 }
1043 1039
1044 /* 1040 /*
1045 * We only care about regions.and objects 1041 * We only care about regions.and objects that are allowed to have address
1046 * that are allowed to have address space handlers 1042 * space handlers
1047 */ 1043 */
1048 if ((node->type != ACPI_TYPE_REGION) && (node != acpi_gbl_root_node)) { 1044 if ((node->type != ACPI_TYPE_REGION) && (node != acpi_gbl_root_node)) {
1049 return (AE_OK); 1045 return (AE_OK);
@@ -1062,10 +1058,9 @@ acpi_ev_reg_run(acpi_handle obj_handle,
1062 /* Object is a Region */ 1058 /* Object is a Region */
1063 1059
1064 if (obj_desc->region.space_id != space_id) { 1060 if (obj_desc->region.space_id != space_id) {
1065 /* 1061
1066 * This region is for a different address space 1062 /* This region is for a different address space, just ignore it */
1067 * -- just ignore it 1063
1068 */
1069 return (AE_OK); 1064 return (AE_OK);
1070 } 1065 }
1071 1066
diff --git a/drivers/acpi/events/evrgnini.c b/drivers/acpi/events/evrgnini.c
index 6b94b38df07d..f9e561ee9a71 100644
--- a/drivers/acpi/events/evrgnini.c
+++ b/drivers/acpi/events/evrgnini.c
@@ -233,9 +233,9 @@ acpi_ev_pci_config_region_setup(acpi_handle handle,
233 if (ACPI_FAILURE(status)) { 233 if (ACPI_FAILURE(status)) {
234 if (status == AE_SAME_HANDLER) { 234 if (status == AE_SAME_HANDLER) {
235 /* 235 /*
236 * It is OK if the handler is already installed on the root 236 * It is OK if the handler is already installed on the
237 * bridge. Still need to return a context object for the 237 * root bridge. Still need to return a context object
238 * new PCI_Config operation region, however. 238 * for the new PCI_Config operation region, however.
239 */ 239 */
240 status = AE_OK; 240 status = AE_OK;
241 } else { 241 } else {
@@ -272,8 +272,8 @@ acpi_ev_pci_config_region_setup(acpi_handle handle,
272 } 272 }
273 273
274 /* 274 /*
275 * For PCI_Config space access, we need the segment, bus, 275 * For PCI_Config space access, we need the segment, bus, device and
276 * device and function numbers. Acquire them here. 276 * function numbers. Acquire them here.
277 * 277 *
278 * Find the parent device object. (This allows the operation region to be 278 * Find the parent device object. (This allows the operation region to be
279 * within a subscope under the device, such as a control method.) 279 * within a subscope under the device, such as a control method.)
@@ -289,16 +289,16 @@ acpi_ev_pci_config_region_setup(acpi_handle handle,
289 } 289 }
290 290
291 /* 291 /*
292 * Get the PCI device and function numbers from the _ADR object 292 * Get the PCI device and function numbers from the _ADR object contained
293 * contained in the parent's scope. 293 * in the parent's scope.
294 */ 294 */
295 status = 295 status =
296 acpi_ut_evaluate_numeric_object(METHOD_NAME__ADR, pci_device_node, 296 acpi_ut_evaluate_numeric_object(METHOD_NAME__ADR, pci_device_node,
297 &pci_value); 297 &pci_value);
298 298
299 /* 299 /*
300 * The default is zero, and since the allocation above zeroed 300 * The default is zero, and since the allocation above zeroed the data,
301 * the data, just do nothing on failure. 301 * just do nothing on failure.
302 */ 302 */
303 if (ACPI_SUCCESS(status)) { 303 if (ACPI_SUCCESS(status)) {
304 pci_id->device = ACPI_HIWORD(ACPI_LODWORD(pci_value)); 304 pci_id->device = ACPI_HIWORD(ACPI_LODWORD(pci_value));
@@ -382,9 +382,8 @@ static u8 acpi_ev_is_pci_root_bridge(struct acpi_namespace_node *node)
382 struct acpi_compatible_id_list *cid; 382 struct acpi_compatible_id_list *cid;
383 u32 i; 383 u32 i;
384 384
385 /* 385 /* Get the _HID and check for a PCI Root Bridge */
386 * Get the _HID and check for a PCI Root Bridge 386
387 */
388 status = acpi_ut_execute_HID(node, &hid); 387 status = acpi_ut_execute_HID(node, &hid);
389 if (ACPI_FAILURE(status)) { 388 if (ACPI_FAILURE(status)) {
390 return (FALSE); 389 return (FALSE);
@@ -394,10 +393,8 @@ static u8 acpi_ev_is_pci_root_bridge(struct acpi_namespace_node *node)
394 return (TRUE); 393 return (TRUE);
395 } 394 }
396 395
397 /* 396 /* The _HID did not match. Get the _CID and check for a PCI Root Bridge */
398 * The _HID did not match. 397
399 * Get the _CID and check for a PCI Root Bridge
400 */
401 status = acpi_ut_execute_CID(node, &cid); 398 status = acpi_ut_execute_CID(node, &cid);
402 if (ACPI_FAILURE(status)) { 399 if (ACPI_FAILURE(status)) {
403 return (FALSE); 400 return (FALSE);
@@ -516,9 +513,9 @@ acpi_ev_default_region_setup(acpi_handle handle,
516 * Get the appropriate address space handler for a newly 513 * Get the appropriate address space handler for a newly
517 * created region. 514 * created region.
518 * 515 *
519 * This also performs address space specific initialization. For 516 * This also performs address space specific initialization. For
520 * example, PCI regions must have an _ADR object that contains 517 * example, PCI regions must have an _ADR object that contains
521 * a PCI address in the scope of the definition. This address is 518 * a PCI address in the scope of the definition. This address is
522 * required to perform an access to PCI config space. 519 * required to perform an access to PCI config space.
523 * 520 *
524 * MUTEX: Interpreter should be unlocked, because we may run the _REG 521 * MUTEX: Interpreter should be unlocked, because we may run the _REG
@@ -572,7 +569,7 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj,
572 if (ACPI_SUCCESS(status)) { 569 if (ACPI_SUCCESS(status)) {
573 /* 570 /*
574 * The _REG method is optional and there can be only one per region 571 * The _REG method is optional and there can be only one per region
575 * definition. This will be executed when the handler is attached 572 * definition. This will be executed when the handler is attached
576 * or removed 573 * or removed
577 */ 574 */
578 region_obj2->extra.method_REG = method_node; 575 region_obj2->extra.method_REG = method_node;
@@ -670,10 +667,8 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj,
670 } 667 }
671 } 668 }
672 669
673 /* 670 /* This node does not have the handler we need; Pop up one level */
674 * This node does not have the handler we need; 671
675 * Pop up one level
676 */
677 node = acpi_ns_get_parent_node(node); 672 node = acpi_ns_get_parent_node(node);
678 } 673 }
679 674
diff --git a/drivers/acpi/events/evsci.c b/drivers/acpi/events/evsci.c
index 2a8b77877610..b5fc8055a473 100644
--- a/drivers/acpi/events/evsci.c
+++ b/drivers/acpi/events/evsci.c
@@ -115,10 +115,8 @@ u32 ACPI_SYSTEM_XFACE acpi_ev_gpe_xrupt_handler(void *context)
115 * if this interrupt handler is installed, ACPI is enabled. 115 * if this interrupt handler is installed, ACPI is enabled.
116 */ 116 */
117 117
118 /* 118 /* GPEs: Check for and dispatch any GPEs that have occurred */
119 * GPEs: 119
120 * Check for and dispatch any GPEs that have occurred
121 */
122 interrupt_handled |= acpi_ev_gpe_detect(gpe_xrupt_list); 120 interrupt_handled |= acpi_ev_gpe_detect(gpe_xrupt_list);
123 121
124 return_UINT32(interrupt_handled); 122 return_UINT32(interrupt_handled);
@@ -158,11 +156,11 @@ u32 acpi_ev_install_sci_handler(void)
158 * RETURN: E_OK if handler uninstalled OK, E_ERROR if handler was not 156 * RETURN: E_OK if handler uninstalled OK, E_ERROR if handler was not
159 * installed to begin with 157 * installed to begin with
160 * 158 *
161 * DESCRIPTION: Remove the SCI interrupt handler. No further SCIs will be 159 * DESCRIPTION: Remove the SCI interrupt handler. No further SCIs will be
162 * taken. 160 * taken.
163 * 161 *
164 * Note: It doesn't seem important to disable all events or set the event 162 * Note: It doesn't seem important to disable all events or set the event
165 * enable registers to their original values. The OS should disable 163 * enable registers to their original values. The OS should disable
166 * the SCI interrupt level when the handler is removed, so no more 164 * the SCI interrupt level when the handler is removed, so no more
167 * events will come in. 165 * events will come in.
168 * 166 *
diff --git a/drivers/acpi/events/evxface.c b/drivers/acpi/events/evxface.c
index 94a6efe020be..a2867875c74e 100644
--- a/drivers/acpi/events/evxface.c
+++ b/drivers/acpi/events/evxface.c
@@ -267,7 +267,7 @@ acpi_install_notify_handler(acpi_handle device,
267 /* 267 /*
268 * Root Object: 268 * Root Object:
269 * Registering a notify handler on the root object indicates that the 269 * Registering a notify handler on the root object indicates that the
270 * caller wishes to receive notifications for all objects. Note that 270 * caller wishes to receive notifications for all objects. Note that
271 * only one <external> global handler can be regsitered (per notify type). 271 * only one <external> global handler can be regsitered (per notify type).
272 */ 272 */
273 if (device == ACPI_ROOT_OBJECT) { 273 if (device == ACPI_ROOT_OBJECT) {
diff --git a/drivers/acpi/events/evxfevnt.c b/drivers/acpi/events/evxfevnt.c
index 41554f736b68..669b8ca4984b 100644
--- a/drivers/acpi/events/evxfevnt.c
+++ b/drivers/acpi/events/evxfevnt.c
@@ -161,8 +161,8 @@ acpi_status acpi_enable_event(u32 event, u32 flags)
161 } 161 }
162 162
163 /* 163 /*
164 * Enable the requested fixed event (by writing a one to the 164 * Enable the requested fixed event (by writing a one to the enable
165 * enable register bit) 165 * register bit)
166 */ 166 */
167 status = 167 status =
168 acpi_set_register(acpi_gbl_fixed_event_info[event]. 168 acpi_set_register(acpi_gbl_fixed_event_info[event].
@@ -343,8 +343,8 @@ acpi_status acpi_disable_event(u32 event, u32 flags)
343 } 343 }
344 344
345 /* 345 /*
346 * Disable the requested fixed event (by writing a zero to the 346 * Disable the requested fixed event (by writing a zero to the enable
347 * enable register bit) 347 * register bit)
348 */ 348 */
349 status = 349 status =
350 acpi_set_register(acpi_gbl_fixed_event_info[event]. 350 acpi_set_register(acpi_gbl_fixed_event_info[event].
@@ -396,8 +396,8 @@ acpi_status acpi_clear_event(u32 event)
396 } 396 }
397 397
398 /* 398 /*
399 * Clear the requested fixed event (By writing a one to the 399 * Clear the requested fixed event (By writing a one to the status
400 * status register bit) 400 * register bit)
401 */ 401 */
402 status = 402 status =
403 acpi_set_register(acpi_gbl_fixed_event_info[event]. 403 acpi_set_register(acpi_gbl_fixed_event_info[event].