aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/acpica/evgpeblk.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/acpica/evgpeblk.c')
-rw-r--r--drivers/acpi/acpica/evgpeblk.c70
1 files changed, 13 insertions, 57 deletions
diff --git a/drivers/acpi/acpica/evgpeblk.c b/drivers/acpi/acpica/evgpeblk.c
index 341a38ce8aa6..85445fb5844e 100644
--- a/drivers/acpi/acpica/evgpeblk.c
+++ b/drivers/acpi/acpica/evgpeblk.c
@@ -439,8 +439,6 @@ acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device,
439{ 439{
440 acpi_status status; 440 acpi_status status;
441 struct acpi_gpe_event_info *gpe_event_info; 441 struct acpi_gpe_event_info *gpe_event_info;
442 struct acpi_gpe_walk_info walk_info;
443 u32 wake_gpe_count;
444 u32 gpe_enabled_count; 442 u32 gpe_enabled_count;
445 u32 gpe_index; 443 u32 gpe_index;
446 u32 gpe_number; 444 u32 gpe_number;
@@ -456,37 +454,9 @@ acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device,
456 } 454 }
457 455
458 /* 456 /*
459 * Runtime option: Should wake GPEs be enabled at runtime? The default 457 * Enable all GPEs that have a corresponding method. Any other GPEs
460 * is no, they should only be enabled just as the machine goes to sleep. 458 * within this block must be enabled via the acpi_enable_gpe interface.
461 */ 459 */
462 if (acpi_gbl_leave_wake_gpes_disabled) {
463 /*
464 * Differentiate runtime vs wake GPEs, via the _PRW control methods.
465 * Each GPE that has one or more _PRWs that reference it is by
466 * definition a wake GPE and will not be enabled while the machine
467 * is running.
468 */
469 walk_info.gpe_block = gpe_block;
470 walk_info.gpe_device = gpe_device;
471 walk_info.execute_by_owner_id = FALSE;
472
473 status =
474 acpi_ns_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
475 ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK,
476 acpi_ev_match_prw_and_gpe, NULL,
477 &walk_info, NULL);
478 if (ACPI_FAILURE(status)) {
479 ACPI_EXCEPTION((AE_INFO, status,
480 "While executing _PRW methods"));
481 }
482 }
483
484 /*
485 * Enable all GPEs that have a corresponding method and are not
486 * capable of generating wakeups. Any other GPEs within this block
487 * must be enabled via the acpi_enable_gpe interface.
488 */
489 wake_gpe_count = 0;
490 gpe_enabled_count = 0; 460 gpe_enabled_count = 0;
491 461
492 if (gpe_device == acpi_gbl_fadt_gpe_device) { 462 if (gpe_device == acpi_gbl_fadt_gpe_device) {
@@ -502,35 +472,21 @@ acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device,
502 gpe_event_info = &gpe_block->event_info[gpe_index]; 472 gpe_event_info = &gpe_block->event_info[gpe_index];
503 gpe_number = gpe_index + gpe_block->block_base_number; 473 gpe_number = gpe_index + gpe_block->block_base_number;
504 474
505 /*
506 * If the GPE has already been enabled for runtime
507 * signaling, make sure it remains enabled, but do not
508 * increment its reference counter.
509 */
510 if (gpe_event_info->runtime_count) {
511 acpi_set_gpe(gpe_device, gpe_number,
512 ACPI_GPE_ENABLE);
513 gpe_enabled_count++;
514 continue;
515 }
516
517 if (gpe_event_info->flags & ACPI_GPE_CAN_WAKE) {
518 wake_gpe_count++;
519 if (acpi_gbl_leave_wake_gpes_disabled) {
520 continue;
521 }
522 }
523
524 /* Ignore GPEs that have no corresponding _Lxx/_Exx method */ 475 /* Ignore GPEs that have no corresponding _Lxx/_Exx method */
525 476
526 if (!(gpe_event_info->flags & ACPI_GPE_DISPATCH_METHOD)) { 477 if (!(gpe_event_info->flags & ACPI_GPE_DISPATCH_METHOD)) {
527 continue; 478 continue;
528 } 479 }
529 480
530 /* Enable this GPE */ 481 /*
482 * If the GPE has already been enabled for runtime
483 * signaling, make sure it remains enabled, but do not
484 * increment its reference counter.
485 */
486 status = gpe_event_info->runtime_count ?
487 acpi_ev_enable_gpe(gpe_event_info) :
488 acpi_enable_gpe(gpe_device, gpe_number);
531 489
532 status = acpi_enable_gpe(gpe_device, gpe_number,
533 ACPI_GPE_TYPE_RUNTIME);
534 if (ACPI_FAILURE(status)) { 490 if (ACPI_FAILURE(status)) {
535 ACPI_EXCEPTION((AE_INFO, status, 491 ACPI_EXCEPTION((AE_INFO, status,
536 "Could not enable GPE 0x%02X", 492 "Could not enable GPE 0x%02X",
@@ -542,10 +498,10 @@ acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device,
542 } 498 }
543 } 499 }
544 500
545 if (gpe_enabled_count || wake_gpe_count) { 501 if (gpe_enabled_count) {
546 ACPI_DEBUG_PRINT((ACPI_DB_INIT, 502 ACPI_DEBUG_PRINT((ACPI_DB_INIT,
547 "Enabled %u Runtime GPEs, added %u Wake GPEs in this block\n", 503 "Enabled %u GPEs in this block\n",
548 gpe_enabled_count, wake_gpe_count)); 504 gpe_enabled_count));
549 } 505 }
550 506
551 return_ACPI_STATUS(AE_OK); 507 return_ACPI_STATUS(AE_OK);