diff options
Diffstat (limited to 'drivers/acpi/events/evgpe.c')
-rw-r--r-- | drivers/acpi/events/evgpe.c | 91 |
1 files changed, 25 insertions, 66 deletions
diff --git a/drivers/acpi/events/evgpe.c b/drivers/acpi/events/evgpe.c index c76c0583ca6a..dfac3ecc596e 100644 --- a/drivers/acpi/events/evgpe.c +++ b/drivers/acpi/events/evgpe.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2006, R. Byron Moore | 8 | * Copyright (C) 2000 - 2007, R. Byron Moore |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -121,7 +121,9 @@ acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info, | |||
121 | if (!gpe_register_info) { | 121 | if (!gpe_register_info) { |
122 | return_ACPI_STATUS(AE_NOT_EXIST); | 122 | return_ACPI_STATUS(AE_NOT_EXIST); |
123 | } | 123 | } |
124 | register_bit = gpe_event_info->register_bit; | 124 | register_bit = (u8) |
125 | (1 << | ||
126 | (gpe_event_info->gpe_number - gpe_register_info->base_gpe_number)); | ||
125 | 127 | ||
126 | /* 1) Disable case. Simply clear all enable bits */ | 128 | /* 1) Disable case. Simply clear all enable bits */ |
127 | 129 | ||
@@ -458,8 +460,7 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) | |||
458 | 460 | ||
459 | /* Examine one GPE bit */ | 461 | /* Examine one GPE bit */ |
460 | 462 | ||
461 | if (enabled_status_byte & | 463 | if (enabled_status_byte & (1 << j)) { |
462 | acpi_gbl_decode_to8bit[j]) { | ||
463 | /* | 464 | /* |
464 | * Found an active GPE. Dispatch the event to a handler | 465 | * Found an active GPE. Dispatch the event to a handler |
465 | * or method. | 466 | * or method. |
@@ -570,7 +571,7 @@ static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context) | |||
570 | 571 | ||
571 | if (ACPI_FAILURE(status)) { | 572 | if (ACPI_FAILURE(status)) { |
572 | ACPI_EXCEPTION((AE_INFO, status, | 573 | ACPI_EXCEPTION((AE_INFO, status, |
573 | "While evaluating GPE method [%4.4s]", | 574 | "while evaluating GPE method [%4.4s]", |
574 | acpi_ut_get_node_name | 575 | acpi_ut_get_node_name |
575 | (local_gpe_event_info.dispatch. | 576 | (local_gpe_event_info.dispatch. |
576 | method_node))); | 577 | method_node))); |
@@ -618,6 +619,8 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number) | |||
618 | 619 | ||
619 | ACPI_FUNCTION_TRACE(ev_gpe_dispatch); | 620 | ACPI_FUNCTION_TRACE(ev_gpe_dispatch); |
620 | 621 | ||
622 | acpi_gpe_count++; | ||
623 | |||
621 | /* | 624 | /* |
622 | * If edge-triggered, clear the GPE status bit now. Note that | 625 | * If edge-triggered, clear the GPE status bit now. Note that |
623 | * level-triggered events are cleared after the GPE is serviced. | 626 | * level-triggered events are cleared after the GPE is serviced. |
@@ -633,20 +636,23 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number) | |||
633 | } | 636 | } |
634 | } | 637 | } |
635 | 638 | ||
636 | /* Save current system state */ | 639 | if (!acpi_gbl_system_awake_and_running) { |
637 | 640 | /* | |
638 | if (acpi_gbl_system_awake_and_running) { | 641 | * We just woke up because of a wake GPE. Disable any further GPEs |
639 | ACPI_SET_BIT(gpe_event_info->flags, ACPI_GPE_SYSTEM_RUNNING); | 642 | * until we are fully up and running (Only wake GPEs should be enabled |
640 | } else { | 643 | * at this time, but we just brute-force disable them all.) |
641 | ACPI_CLEAR_BIT(gpe_event_info->flags, ACPI_GPE_SYSTEM_RUNNING); | 644 | * 1) We must disable this particular wake GPE so it won't fire again |
645 | * 2) We want to disable all wake GPEs, since we are now awake | ||
646 | */ | ||
647 | (void)acpi_hw_disable_all_gpes(); | ||
642 | } | 648 | } |
643 | 649 | ||
644 | /* | 650 | /* |
645 | * Dispatch the GPE to either an installed handler, or the control | 651 | * Dispatch the GPE to either an installed handler, or the control method |
646 | * method associated with this GPE (_Lxx or _Exx). | 652 | * associated with this GPE (_Lxx or _Exx). If a handler exists, we invoke |
647 | * If a handler exists, we invoke it and do not attempt to run the method. | 653 | * it and do not attempt to run the method. If there is neither a handler |
648 | * If there is neither a handler nor a method, we disable the level to | 654 | * nor a method, we disable this GPE to prevent further such pointless |
649 | * prevent further events from coming in here. | 655 | * events from firing. |
650 | */ | 656 | */ |
651 | switch (gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) { | 657 | switch (gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) { |
652 | case ACPI_GPE_DISPATCH_HANDLER: | 658 | case ACPI_GPE_DISPATCH_HANDLER: |
@@ -677,8 +683,8 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number) | |||
677 | case ACPI_GPE_DISPATCH_METHOD: | 683 | case ACPI_GPE_DISPATCH_METHOD: |
678 | 684 | ||
679 | /* | 685 | /* |
680 | * Disable GPE, so it doesn't keep firing before the method has a | 686 | * Disable the GPE, so it doesn't keep firing before the method has a |
681 | * chance to run. | 687 | * chance to run (it runs asynchronously with interrupts enabled). |
682 | */ | 688 | */ |
683 | status = acpi_ev_disable_gpe(gpe_event_info); | 689 | status = acpi_ev_disable_gpe(gpe_event_info); |
684 | if (ACPI_FAILURE(status)) { | 690 | if (ACPI_FAILURE(status)) { |
@@ -711,7 +717,7 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number) | |||
711 | gpe_number)); | 717 | gpe_number)); |
712 | 718 | ||
713 | /* | 719 | /* |
714 | * Disable the GPE. The GPE will remain disabled until the ACPI | 720 | * Disable the GPE. The GPE will remain disabled until the ACPI |
715 | * Core Subsystem is restarted, or a handler is installed. | 721 | * Core Subsystem is restarted, or a handler is installed. |
716 | */ | 722 | */ |
717 | status = acpi_ev_disable_gpe(gpe_event_info); | 723 | status = acpi_ev_disable_gpe(gpe_event_info); |
@@ -726,50 +732,3 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number) | |||
726 | 732 | ||
727 | return_UINT32(ACPI_INTERRUPT_HANDLED); | 733 | return_UINT32(ACPI_INTERRUPT_HANDLED); |
728 | } | 734 | } |
729 | |||
730 | #ifdef ACPI_GPE_NOTIFY_CHECK | ||
731 | /******************************************************************************* | ||
732 | * TBD: NOT USED, PROTOTYPE ONLY AND WILL PROBABLY BE REMOVED | ||
733 | * | ||
734 | * FUNCTION: acpi_ev_check_for_wake_only_gpe | ||
735 | * | ||
736 | * PARAMETERS: gpe_event_info - info for this GPE | ||
737 | * | ||
738 | * RETURN: Status | ||
739 | * | ||
740 | * DESCRIPTION: Determine if a a GPE is "wake-only". | ||
741 | * | ||
742 | * Called from Notify() code in interpreter when a "DeviceWake" | ||
743 | * Notify comes in. | ||
744 | * | ||
745 | ******************************************************************************/ | ||
746 | |||
747 | acpi_status | ||
748 | acpi_ev_check_for_wake_only_gpe(struct acpi_gpe_event_info *gpe_event_info) | ||
749 | { | ||
750 | acpi_status status; | ||
751 | |||
752 | ACPI_FUNCTION_TRACE(ev_check_for_wake_only_gpe); | ||
753 | |||
754 | if ((gpe_event_info) && /* Only >0 for _Lxx/_Exx */ | ||
755 | ((gpe_event_info->flags & ACPI_GPE_SYSTEM_MASK) == ACPI_GPE_SYSTEM_RUNNING)) { /* System state at GPE time */ | ||
756 | /* This must be a wake-only GPE, disable it */ | ||
757 | |||
758 | status = acpi_ev_disable_gpe(gpe_event_info); | ||
759 | |||
760 | /* Set GPE to wake-only. Do not change wake disabled/enabled status */ | ||
761 | |||
762 | acpi_ev_set_gpe_type(gpe_event_info, ACPI_GPE_TYPE_WAKE); | ||
763 | |||
764 | ACPI_INFO((AE_INFO, | ||
765 | "GPE %p was updated from wake/run to wake-only", | ||
766 | gpe_event_info)); | ||
767 | |||
768 | /* This was a wake-only GPE */ | ||
769 | |||
770 | return_ACPI_STATUS(AE_WAKE_ONLY_GPE); | ||
771 | } | ||
772 | |||
773 | return_ACPI_STATUS(AE_OK); | ||
774 | } | ||
775 | #endif | ||