diff options
Diffstat (limited to 'drivers/acpi/acpica/evgpe.c')
| -rw-r--r-- | drivers/acpi/acpica/evgpe.c | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/drivers/acpi/acpica/evgpe.c b/drivers/acpi/acpica/evgpe.c index 4b4949ce05bc..bdb10bee13ce 100644 --- a/drivers/acpi/acpica/evgpe.c +++ b/drivers/acpi/acpica/evgpe.c | |||
| @@ -130,6 +130,60 @@ acpi_status acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info) | |||
| 130 | 130 | ||
| 131 | /******************************************************************************* | 131 | /******************************************************************************* |
| 132 | * | 132 | * |
| 133 | * FUNCTION: acpi_ev_mask_gpe | ||
| 134 | * | ||
| 135 | * PARAMETERS: gpe_event_info - GPE to be blocked/unblocked | ||
| 136 | * is_masked - Whether the GPE is masked or not | ||
| 137 | * | ||
| 138 | * RETURN: Status | ||
| 139 | * | ||
| 140 | * DESCRIPTION: Unconditionally mask/unmask a GPE during runtime. | ||
| 141 | * | ||
| 142 | ******************************************************************************/ | ||
| 143 | |||
| 144 | acpi_status | ||
| 145 | acpi_ev_mask_gpe(struct acpi_gpe_event_info *gpe_event_info, u8 is_masked) | ||
| 146 | { | ||
| 147 | struct acpi_gpe_register_info *gpe_register_info; | ||
| 148 | u32 register_bit; | ||
| 149 | |||
| 150 | ACPI_FUNCTION_TRACE(ev_mask_gpe); | ||
| 151 | |||
| 152 | gpe_register_info = gpe_event_info->register_info; | ||
| 153 | if (!gpe_register_info) { | ||
| 154 | return_ACPI_STATUS(AE_NOT_EXIST); | ||
| 155 | } | ||
| 156 | |||
| 157 | register_bit = acpi_hw_get_gpe_register_bit(gpe_event_info); | ||
| 158 | |||
| 159 | /* Perform the action */ | ||
| 160 | |||
| 161 | if (is_masked) { | ||
| 162 | if (register_bit & gpe_register_info->mask_for_run) { | ||
| 163 | return_ACPI_STATUS(AE_BAD_PARAMETER); | ||
| 164 | } | ||
| 165 | |||
| 166 | (void)acpi_hw_low_set_gpe(gpe_event_info, ACPI_GPE_DISABLE); | ||
| 167 | ACPI_SET_BIT(gpe_register_info->mask_for_run, (u8)register_bit); | ||
| 168 | } else { | ||
| 169 | if (!(register_bit & gpe_register_info->mask_for_run)) { | ||
| 170 | return_ACPI_STATUS(AE_BAD_PARAMETER); | ||
| 171 | } | ||
| 172 | |||
| 173 | ACPI_CLEAR_BIT(gpe_register_info->mask_for_run, | ||
| 174 | (u8)register_bit); | ||
| 175 | if (gpe_event_info->runtime_count | ||
| 176 | && !gpe_event_info->disable_for_dispatch) { | ||
| 177 | (void)acpi_hw_low_set_gpe(gpe_event_info, | ||
| 178 | ACPI_GPE_ENABLE); | ||
| 179 | } | ||
| 180 | } | ||
| 181 | |||
| 182 | return_ACPI_STATUS(AE_OK); | ||
| 183 | } | ||
| 184 | |||
| 185 | /******************************************************************************* | ||
| 186 | * | ||
| 133 | * FUNCTION: acpi_ev_add_gpe_reference | 187 | * FUNCTION: acpi_ev_add_gpe_reference |
| 134 | * | 188 | * |
| 135 | * PARAMETERS: gpe_event_info - Add a reference to this GPE | 189 | * PARAMETERS: gpe_event_info - Add a reference to this GPE |
| @@ -674,6 +728,7 @@ acpi_status acpi_ev_finish_gpe(struct acpi_gpe_event_info *gpe_event_info) | |||
| 674 | * in the event_info. | 728 | * in the event_info. |
| 675 | */ | 729 | */ |
| 676 | (void)acpi_hw_low_set_gpe(gpe_event_info, ACPI_GPE_CONDITIONAL_ENABLE); | 730 | (void)acpi_hw_low_set_gpe(gpe_event_info, ACPI_GPE_CONDITIONAL_ENABLE); |
| 731 | gpe_event_info->disable_for_dispatch = FALSE; | ||
| 677 | return (AE_OK); | 732 | return (AE_OK); |
| 678 | } | 733 | } |
| 679 | 734 | ||
| @@ -737,6 +792,8 @@ acpi_ev_gpe_dispatch(struct acpi_namespace_node *gpe_device, | |||
| 737 | } | 792 | } |
| 738 | } | 793 | } |
| 739 | 794 | ||
| 795 | gpe_event_info->disable_for_dispatch = TRUE; | ||
| 796 | |||
| 740 | /* | 797 | /* |
| 741 | * Dispatch the GPE to either an installed handler or the control | 798 | * Dispatch the GPE to either an installed handler or the control |
| 742 | * method associated with this GPE (_Lxx or _Exx). If a handler | 799 | * method associated with this GPE (_Lxx or _Exx). If a handler |
