Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /****************************************************************************** |
| 2 | * |
| 3 | * Module Name: evgpe - General Purpose Event handling and dispatch |
| 4 | * |
| 5 | *****************************************************************************/ |
| 6 | |
| 7 | /* |
Bob Moore | a8357b0 | 2010-01-22 19:07:36 +0800 | [diff] [blame] | 8 | * Copyright (C) 2000 - 2010, Intel Corp. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 9 | * All rights reserved. |
| 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without |
| 12 | * modification, are permitted provided that the following conditions |
| 13 | * are met: |
| 14 | * 1. Redistributions of source code must retain the above copyright |
| 15 | * notice, this list of conditions, and the following disclaimer, |
| 16 | * without modification. |
| 17 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer |
| 18 | * substantially similar to the "NO WARRANTY" disclaimer below |
| 19 | * ("Disclaimer") and any redistribution must be conditioned upon |
| 20 | * including a substantially similar Disclaimer requirement for further |
| 21 | * binary redistribution. |
| 22 | * 3. Neither the names of the above-listed copyright holders nor the names |
| 23 | * of any contributors may be used to endorse or promote products derived |
| 24 | * from this software without specific prior written permission. |
| 25 | * |
| 26 | * Alternatively, this software may be distributed under the terms of the |
| 27 | * GNU General Public License ("GPL") version 2 as published by the Free |
| 28 | * Software Foundation. |
| 29 | * |
| 30 | * NO WARRANTY |
| 31 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 32 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 33 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR |
| 34 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 35 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 36 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
| 37 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 38 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
| 39 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
| 40 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 41 | * POSSIBILITY OF SUCH DAMAGES. |
| 42 | */ |
| 43 | |
| 44 | #include <acpi/acpi.h> |
Len Brown | e2f7a77 | 2009-01-09 00:30:03 -0500 | [diff] [blame] | 45 | #include "accommon.h" |
| 46 | #include "acevents.h" |
| 47 | #include "acnamesp.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 48 | |
| 49 | #define _COMPONENT ACPI_EVENTS |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 50 | ACPI_MODULE_NAME("evgpe") |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 51 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 52 | /* Local prototypes */ |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 53 | static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 54 | |
| 55 | /******************************************************************************* |
| 56 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 57 | * FUNCTION: acpi_ev_update_gpe_enable_masks |
| 58 | * |
| 59 | * PARAMETERS: gpe_event_info - GPE to update |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 60 | * |
| 61 | * RETURN: Status |
| 62 | * |
| 63 | * DESCRIPTION: Updates GPE register enable masks based on the GPE type |
| 64 | * |
| 65 | ******************************************************************************/ |
| 66 | |
| 67 | acpi_status |
Rafael J. Wysocki | 9630bdd | 2010-02-17 23:41:07 +0100 | [diff] [blame] | 68 | acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 69 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 70 | struct acpi_gpe_register_info *gpe_register_info; |
| 71 | u8 register_bit; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 72 | |
Bob Moore | b229cf9 | 2006-04-21 17:15:00 -0400 | [diff] [blame] | 73 | ACPI_FUNCTION_TRACE(ev_update_gpe_enable_masks); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 74 | |
| 75 | gpe_register_info = gpe_event_info->register_info; |
| 76 | if (!gpe_register_info) { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 77 | return_ACPI_STATUS(AE_NOT_EXIST); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 78 | } |
Bob Moore | d4913dc | 2009-03-06 10:05:18 +0800 | [diff] [blame] | 79 | |
Alexey Starikovskiy | 6987416 | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 80 | register_bit = (u8) |
| 81 | (1 << |
| 82 | (gpe_event_info->gpe_number - gpe_register_info->base_gpe_number)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 83 | |
Rafael J. Wysocki | 9630bdd | 2010-02-17 23:41:07 +0100 | [diff] [blame] | 84 | ACPI_CLEAR_BIT(gpe_register_info->enable_for_wake, register_bit); |
| 85 | ACPI_CLEAR_BIT(gpe_register_info->enable_for_run, register_bit); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 86 | |
Rafael J. Wysocki | 9630bdd | 2010-02-17 23:41:07 +0100 | [diff] [blame] | 87 | if (gpe_event_info->runtime_count) |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 88 | ACPI_SET_BIT(gpe_register_info->enable_for_run, register_bit); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 89 | |
Rafael J. Wysocki | 9630bdd | 2010-02-17 23:41:07 +0100 | [diff] [blame] | 90 | if (gpe_event_info->wakeup_count) |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 91 | ACPI_SET_BIT(gpe_register_info->enable_for_wake, register_bit); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 92 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 93 | return_ACPI_STATUS(AE_OK); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 94 | } |
| 95 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 96 | /******************************************************************************* |
| 97 | * |
| 98 | * FUNCTION: acpi_ev_enable_gpe |
| 99 | * |
| 100 | * PARAMETERS: gpe_event_info - GPE to enable |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 101 | * |
| 102 | * RETURN: Status |
| 103 | * |
| 104 | * DESCRIPTION: Enable a GPE based on the GPE type |
| 105 | * |
| 106 | ******************************************************************************/ |
| 107 | |
Rafael J. Wysocki | cbbc0de | 2010-02-24 00:52:08 +0100 | [diff] [blame] | 108 | acpi_status acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 109 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 110 | acpi_status status; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 111 | |
Bob Moore | b229cf9 | 2006-04-21 17:15:00 -0400 | [diff] [blame] | 112 | ACPI_FUNCTION_TRACE(ev_enable_gpe); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 113 | |
| 114 | /* Make sure HW enable masks are updated */ |
| 115 | |
Rafael J. Wysocki | 9630bdd | 2010-02-17 23:41:07 +0100 | [diff] [blame] | 116 | status = acpi_ev_update_gpe_enable_masks(gpe_event_info); |
| 117 | if (ACPI_FAILURE(status)) |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 118 | return_ACPI_STATUS(status); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 119 | |
Rafael J. Wysocki | bf02bd2 | 2010-03-16 23:21:55 +0100 | [diff] [blame] | 120 | /* Clear the GPE (of stale events), then enable it */ |
| 121 | status = acpi_hw_clear_gpe(gpe_event_info); |
| 122 | if (ACPI_FAILURE(status)) |
| 123 | return_ACPI_STATUS(status); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 124 | |
Rafael J. Wysocki | bf02bd2 | 2010-03-16 23:21:55 +0100 | [diff] [blame] | 125 | /* Enable the requested GPE */ |
| 126 | status = acpi_hw_write_gpe_enable_reg(gpe_event_info); |
| 127 | return_ACPI_STATUS(status); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 128 | } |
| 129 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 130 | /******************************************************************************* |
| 131 | * |
| 132 | * FUNCTION: acpi_ev_disable_gpe |
| 133 | * |
| 134 | * PARAMETERS: gpe_event_info - GPE to disable |
| 135 | * |
| 136 | * RETURN: Status |
| 137 | * |
| 138 | * DESCRIPTION: Disable a GPE based on the GPE type |
| 139 | * |
| 140 | ******************************************************************************/ |
| 141 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 142 | acpi_status acpi_ev_disable_gpe(struct acpi_gpe_event_info *gpe_event_info) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 143 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 144 | acpi_status status; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 145 | |
Bob Moore | b229cf9 | 2006-04-21 17:15:00 -0400 | [diff] [blame] | 146 | ACPI_FUNCTION_TRACE(ev_disable_gpe); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 147 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 148 | /* Make sure HW enable masks are updated */ |
| 149 | |
Rafael J. Wysocki | 9630bdd | 2010-02-17 23:41:07 +0100 | [diff] [blame] | 150 | status = acpi_ev_update_gpe_enable_masks(gpe_event_info); |
| 151 | if (ACPI_FAILURE(status)) |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 152 | return_ACPI_STATUS(status); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 153 | |
Bob Moore | e38e8a0 | 2008-06-13 08:28:55 +0800 | [diff] [blame] | 154 | /* |
| 155 | * Even if we don't know the GPE type, make sure that we always |
| 156 | * disable it. low_disable_gpe will just clear the enable bit for this |
| 157 | * GPE and write it. It will not write out the current GPE enable mask, |
| 158 | * since this may inadvertently enable GPEs too early, if a rogue GPE has |
| 159 | * come in during ACPICA initialization - possibly as a result of AML or |
| 160 | * other code that has enabled the GPE. |
| 161 | */ |
| 162 | status = acpi_hw_low_disable_gpe(gpe_event_info); |
| 163 | return_ACPI_STATUS(status); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 164 | } |
| 165 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 166 | /******************************************************************************* |
| 167 | * |
| 168 | * FUNCTION: acpi_ev_get_gpe_event_info |
| 169 | * |
Bob Moore | 9f15fc6 | 2008-11-12 16:01:56 +0800 | [diff] [blame] | 170 | * PARAMETERS: gpe_device - Device node. NULL for GPE0/GPE1 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 171 | * gpe_number - Raw GPE number |
| 172 | * |
| 173 | * RETURN: A GPE event_info struct. NULL if not a valid GPE |
| 174 | * |
| 175 | * DESCRIPTION: Returns the event_info struct associated with this GPE. |
| 176 | * Validates the gpe_block and the gpe_number |
| 177 | * |
| 178 | * Should be called only when the GPE lists are semaphore locked |
| 179 | * and not subject to change. |
| 180 | * |
| 181 | ******************************************************************************/ |
| 182 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 183 | struct acpi_gpe_event_info *acpi_ev_get_gpe_event_info(acpi_handle gpe_device, |
| 184 | u32 gpe_number) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 185 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 186 | union acpi_operand_object *obj_desc; |
| 187 | struct acpi_gpe_block_info *gpe_block; |
Bob Moore | 67a119f | 2008-06-10 13:42:13 +0800 | [diff] [blame] | 188 | u32 i; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 189 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 190 | ACPI_FUNCTION_ENTRY(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 191 | |
| 192 | /* A NULL gpe_block means use the FADT-defined GPE block(s) */ |
| 193 | |
| 194 | if (!gpe_device) { |
Bob Moore | 52fc0b0 | 2006-10-02 00:00:00 -0400 | [diff] [blame] | 195 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 196 | /* Examine GPE Block 0 and 1 (These blocks are permanent) */ |
| 197 | |
| 198 | for (i = 0; i < ACPI_MAX_GPE_BLOCKS; i++) { |
| 199 | gpe_block = acpi_gbl_gpe_fadt_blocks[i]; |
| 200 | if (gpe_block) { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 201 | if ((gpe_number >= gpe_block->block_base_number) |
| 202 | && (gpe_number < |
| 203 | gpe_block->block_base_number + |
| 204 | (gpe_block->register_count * 8))) { |
| 205 | return (&gpe_block-> |
| 206 | event_info[gpe_number - |
| 207 | gpe_block-> |
| 208 | block_base_number]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 209 | } |
| 210 | } |
| 211 | } |
| 212 | |
| 213 | /* The gpe_number was not in the range of either FADT GPE block */ |
| 214 | |
| 215 | return (NULL); |
| 216 | } |
| 217 | |
| 218 | /* A Non-NULL gpe_device means this is a GPE Block Device */ |
| 219 | |
Len Brown | fd35094 | 2007-05-09 23:34:35 -0400 | [diff] [blame] | 220 | obj_desc = acpi_ns_get_attached_object((struct acpi_namespace_node *) |
| 221 | gpe_device); |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 222 | if (!obj_desc || !obj_desc->device.gpe_block) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 223 | return (NULL); |
| 224 | } |
| 225 | |
| 226 | gpe_block = obj_desc->device.gpe_block; |
| 227 | |
| 228 | if ((gpe_number >= gpe_block->block_base_number) && |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 229 | (gpe_number < |
| 230 | gpe_block->block_base_number + (gpe_block->register_count * 8))) { |
| 231 | return (&gpe_block-> |
| 232 | event_info[gpe_number - gpe_block->block_base_number]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 233 | } |
| 234 | |
| 235 | return (NULL); |
| 236 | } |
| 237 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 238 | /******************************************************************************* |
| 239 | * |
| 240 | * FUNCTION: acpi_ev_gpe_detect |
| 241 | * |
| 242 | * PARAMETERS: gpe_xrupt_list - Interrupt block for this interrupt. |
| 243 | * Can have multiple GPE blocks attached. |
| 244 | * |
| 245 | * RETURN: INTERRUPT_HANDLED or INTERRUPT_NOT_HANDLED |
| 246 | * |
Bob Moore | 9f15fc6 | 2008-11-12 16:01:56 +0800 | [diff] [blame] | 247 | * DESCRIPTION: Detect if any GP events have occurred. This function is |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 248 | * executed at interrupt level. |
| 249 | * |
| 250 | ******************************************************************************/ |
| 251 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 252 | u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 253 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 254 | acpi_status status; |
| 255 | struct acpi_gpe_block_info *gpe_block; |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 256 | struct acpi_gpe_register_info *gpe_register_info; |
| 257 | u32 int_status = ACPI_INTERRUPT_NOT_HANDLED; |
| 258 | u8 enabled_status_byte; |
| 259 | u32 status_reg; |
| 260 | u32 enable_reg; |
Bob Moore | b8e4d89 | 2006-01-27 16:43:00 -0500 | [diff] [blame] | 261 | acpi_cpu_flags flags; |
Bob Moore | 67a119f | 2008-06-10 13:42:13 +0800 | [diff] [blame] | 262 | u32 i; |
| 263 | u32 j; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 264 | |
Bob Moore | b229cf9 | 2006-04-21 17:15:00 -0400 | [diff] [blame] | 265 | ACPI_FUNCTION_NAME(ev_gpe_detect); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 266 | |
| 267 | /* Check for the case where there are no GPEs */ |
| 268 | |
| 269 | if (!gpe_xrupt_list) { |
| 270 | return (int_status); |
| 271 | } |
| 272 | |
Bob Moore | 967440e | 2006-06-23 17:04:00 -0400 | [diff] [blame] | 273 | /* |
| 274 | * We need to obtain the GPE lock for both the data structs and registers |
Bob Moore | 9f15fc6 | 2008-11-12 16:01:56 +0800 | [diff] [blame] | 275 | * Note: Not necessary to obtain the hardware lock, since the GPE |
| 276 | * registers are owned by the gpe_lock. |
Bob Moore | 967440e | 2006-06-23 17:04:00 -0400 | [diff] [blame] | 277 | */ |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 278 | flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); |
Bob Moore | 4c90ece | 2006-06-08 16:29:00 -0400 | [diff] [blame] | 279 | |
| 280 | /* Examine all GPE blocks attached to this interrupt level */ |
| 281 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 282 | gpe_block = gpe_xrupt_list->gpe_block_list_head; |
| 283 | while (gpe_block) { |
| 284 | /* |
Bob Moore | 9f15fc6 | 2008-11-12 16:01:56 +0800 | [diff] [blame] | 285 | * Read all of the 8-bit GPE status and enable registers in this GPE |
| 286 | * block, saving all of them. Find all currently active GP events. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 287 | */ |
| 288 | for (i = 0; i < gpe_block->register_count; i++) { |
Bob Moore | 52fc0b0 | 2006-10-02 00:00:00 -0400 | [diff] [blame] | 289 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 290 | /* Get the next status/enable pair */ |
| 291 | |
| 292 | gpe_register_info = &gpe_block->register_info[i]; |
| 293 | |
| 294 | /* Read the Status Register */ |
| 295 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 296 | status = |
Bob Moore | c6b5774 | 2009-06-24 09:44:06 +0800 | [diff] [blame] | 297 | acpi_hw_read(&status_reg, |
| 298 | &gpe_register_info->status_address); |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 299 | if (ACPI_FAILURE(status)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 300 | goto unlock_and_exit; |
| 301 | } |
| 302 | |
| 303 | /* Read the Enable Register */ |
| 304 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 305 | status = |
Bob Moore | c6b5774 | 2009-06-24 09:44:06 +0800 | [diff] [blame] | 306 | acpi_hw_read(&enable_reg, |
| 307 | &gpe_register_info->enable_address); |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 308 | if (ACPI_FAILURE(status)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 309 | goto unlock_and_exit; |
| 310 | } |
| 311 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 312 | ACPI_DEBUG_PRINT((ACPI_DB_INTERRUPTS, |
| 313 | "Read GPE Register at GPE%X: Status=%02X, Enable=%02X\n", |
| 314 | gpe_register_info->base_gpe_number, |
| 315 | status_reg, enable_reg)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 316 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 317 | /* Check if there is anything active at all in this register */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 318 | |
| 319 | enabled_status_byte = (u8) (status_reg & enable_reg); |
| 320 | if (!enabled_status_byte) { |
Bob Moore | 52fc0b0 | 2006-10-02 00:00:00 -0400 | [diff] [blame] | 321 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 322 | /* No active GPEs in this register, move on */ |
| 323 | |
| 324 | continue; |
| 325 | } |
| 326 | |
| 327 | /* Now look at the individual GPEs in this byte register */ |
| 328 | |
| 329 | for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) { |
Bob Moore | 52fc0b0 | 2006-10-02 00:00:00 -0400 | [diff] [blame] | 330 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 331 | /* Examine one GPE bit */ |
| 332 | |
Alexey Starikovskiy | 6987416 | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 333 | if (enabled_status_byte & (1 << j)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 334 | /* |
| 335 | * Found an active GPE. Dispatch the event to a handler |
| 336 | * or method. |
| 337 | */ |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 338 | int_status |= |
| 339 | acpi_ev_gpe_dispatch(&gpe_block-> |
Bob Moore | 67a119f | 2008-06-10 13:42:13 +0800 | [diff] [blame] | 340 | event_info[((acpi_size) i * ACPI_GPE_REGISTER_WIDTH) + j], j + gpe_register_info->base_gpe_number); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 341 | } |
| 342 | } |
| 343 | } |
| 344 | |
| 345 | gpe_block = gpe_block->next; |
| 346 | } |
| 347 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 348 | unlock_and_exit: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 349 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 350 | acpi_os_release_lock(acpi_gbl_gpe_lock, flags); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 351 | return (int_status); |
| 352 | } |
| 353 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 354 | /******************************************************************************* |
| 355 | * |
| 356 | * FUNCTION: acpi_ev_asynch_execute_gpe_method |
| 357 | * |
| 358 | * PARAMETERS: Context (gpe_event_info) - Info for this GPE |
| 359 | * |
| 360 | * RETURN: None |
| 361 | * |
Bob Moore | 4119532 | 2006-05-26 16:36:00 -0400 | [diff] [blame] | 362 | * DESCRIPTION: Perform the actual execution of a GPE control method. This |
| 363 | * function is called from an invocation of acpi_os_execute and |
| 364 | * therefore does NOT execute at interrupt level - so that |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 365 | * the control method itself is not executed in the context of |
| 366 | * an interrupt handler. |
| 367 | * |
| 368 | ******************************************************************************/ |
Alexey Starikovskiy | 17bc54e | 2007-11-13 13:05:45 +0300 | [diff] [blame] | 369 | static void acpi_ev_asynch_enable_gpe(void *context); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 370 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 371 | static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 372 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 373 | struct acpi_gpe_event_info *gpe_event_info = (void *)context; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 374 | acpi_status status; |
| 375 | struct acpi_gpe_event_info local_gpe_event_info; |
Bob Moore | 4119532 | 2006-05-26 16:36:00 -0400 | [diff] [blame] | 376 | struct acpi_evaluate_info *info; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 377 | |
Bob Moore | b229cf9 | 2006-04-21 17:15:00 -0400 | [diff] [blame] | 378 | ACPI_FUNCTION_TRACE(ev_asynch_execute_gpe_method); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 379 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 380 | status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); |
| 381 | if (ACPI_FAILURE(status)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 382 | return_VOID; |
| 383 | } |
| 384 | |
| 385 | /* Must revalidate the gpe_number/gpe_block */ |
| 386 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 387 | if (!acpi_ev_valid_gpe_event(gpe_event_info)) { |
| 388 | status = acpi_ut_release_mutex(ACPI_MTX_EVENTS); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 389 | return_VOID; |
| 390 | } |
| 391 | |
| 392 | /* Set the GPE flags for return to enabled state */ |
| 393 | |
Rafael J. Wysocki | cbbc0de | 2010-02-24 00:52:08 +0100 | [diff] [blame] | 394 | (void)acpi_ev_update_gpe_enable_masks(gpe_event_info); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 395 | |
| 396 | /* |
Bob Moore | 9f15fc6 | 2008-11-12 16:01:56 +0800 | [diff] [blame] | 397 | * Take a snapshot of the GPE info for this level - we copy the info to |
| 398 | * prevent a race condition with remove_handler/remove_block. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 399 | */ |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 400 | ACPI_MEMCPY(&local_gpe_event_info, gpe_event_info, |
| 401 | sizeof(struct acpi_gpe_event_info)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 402 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 403 | status = acpi_ut_release_mutex(ACPI_MTX_EVENTS); |
| 404 | if (ACPI_FAILURE(status)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 405 | return_VOID; |
| 406 | } |
| 407 | |
| 408 | /* |
Bob Moore | 9f15fc6 | 2008-11-12 16:01:56 +0800 | [diff] [blame] | 409 | * Must check for control method type dispatch one more time to avoid a |
| 410 | * race with ev_gpe_install_handler |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 411 | */ |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 412 | if ((local_gpe_event_info.flags & ACPI_GPE_DISPATCH_MASK) == |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 413 | ACPI_GPE_DISPATCH_METHOD) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 414 | |
Bob Moore | 4119532 | 2006-05-26 16:36:00 -0400 | [diff] [blame] | 415 | /* Allocate the evaluation information block */ |
| 416 | |
| 417 | info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info)); |
| 418 | if (!info) { |
| 419 | status = AE_NO_MEMORY; |
| 420 | } else { |
| 421 | /* |
| 422 | * Invoke the GPE Method (_Lxx, _Exx) i.e., evaluate the _Lxx/_Exx |
| 423 | * control method that corresponds to this GPE |
| 424 | */ |
| 425 | info->prefix_node = |
| 426 | local_gpe_event_info.dispatch.method_node; |
Bob Moore | 4119532 | 2006-05-26 16:36:00 -0400 | [diff] [blame] | 427 | info->flags = ACPI_IGNORE_RETURN_VALUE; |
| 428 | |
| 429 | status = acpi_ns_evaluate(info); |
| 430 | ACPI_FREE(info); |
| 431 | } |
| 432 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 433 | if (ACPI_FAILURE(status)) { |
Bob Moore | b8e4d89 | 2006-01-27 16:43:00 -0500 | [diff] [blame] | 434 | ACPI_EXCEPTION((AE_INFO, status, |
Bob Moore | 2e42005 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 435 | "while evaluating GPE method [%4.4s]", |
Bob Moore | b8e4d89 | 2006-01-27 16:43:00 -0500 | [diff] [blame] | 436 | acpi_ut_get_node_name |
| 437 | (local_gpe_event_info.dispatch. |
Bob Moore | 4c90ece | 2006-06-08 16:29:00 -0400 | [diff] [blame] | 438 | method_node))); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 439 | } |
| 440 | } |
Alexey Starikovskiy | 17bc54e | 2007-11-13 13:05:45 +0300 | [diff] [blame] | 441 | /* Defer enabling of GPE until all notify handlers are done */ |
| 442 | acpi_os_execute(OSL_NOTIFY_HANDLER, acpi_ev_asynch_enable_gpe, |
| 443 | gpe_event_info); |
| 444 | return_VOID; |
| 445 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 446 | |
Alexey Starikovskiy | 17bc54e | 2007-11-13 13:05:45 +0300 | [diff] [blame] | 447 | static void acpi_ev_asynch_enable_gpe(void *context) |
| 448 | { |
| 449 | struct acpi_gpe_event_info *gpe_event_info = context; |
| 450 | acpi_status status; |
| 451 | if ((gpe_event_info->flags & ACPI_GPE_XRUPT_TYPE_MASK) == |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 452 | ACPI_GPE_LEVEL_TRIGGERED) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 453 | /* |
Bob Moore | 9f15fc6 | 2008-11-12 16:01:56 +0800 | [diff] [blame] | 454 | * GPE is level-triggered, we clear the GPE status bit after handling |
| 455 | * the event. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 456 | */ |
Alexey Starikovskiy | 17bc54e | 2007-11-13 13:05:45 +0300 | [diff] [blame] | 457 | status = acpi_hw_clear_gpe(gpe_event_info); |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 458 | if (ACPI_FAILURE(status)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 459 | return_VOID; |
| 460 | } |
| 461 | } |
| 462 | |
| 463 | /* Enable this GPE */ |
Alexey Starikovskiy | 17bc54e | 2007-11-13 13:05:45 +0300 | [diff] [blame] | 464 | (void)acpi_hw_write_gpe_enable_reg(gpe_event_info); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 465 | return_VOID; |
| 466 | } |
| 467 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 468 | /******************************************************************************* |
| 469 | * |
| 470 | * FUNCTION: acpi_ev_gpe_dispatch |
| 471 | * |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 472 | * PARAMETERS: gpe_event_info - Info for this GPE |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 473 | * gpe_number - Number relative to the parent GPE block |
| 474 | * |
| 475 | * RETURN: INTERRUPT_HANDLED or INTERRUPT_NOT_HANDLED |
| 476 | * |
| 477 | * DESCRIPTION: Dispatch a General Purpose Event to either a function (e.g. EC) |
| 478 | * or method (e.g. _Lxx/_Exx) handler. |
| 479 | * |
| 480 | * This function executes at interrupt level. |
| 481 | * |
| 482 | ******************************************************************************/ |
| 483 | |
| 484 | u32 |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 485 | acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 486 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 487 | acpi_status status; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 488 | |
Bob Moore | b229cf9 | 2006-04-21 17:15:00 -0400 | [diff] [blame] | 489 | ACPI_FUNCTION_TRACE(ev_gpe_dispatch); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 490 | |
Len Brown | 5229e87 | 2008-02-06 01:26:55 -0500 | [diff] [blame] | 491 | acpi_os_gpe_count(gpe_number); |
Bob Moore | fdffb72 | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 492 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 493 | /* |
Bob Moore | 9f15fc6 | 2008-11-12 16:01:56 +0800 | [diff] [blame] | 494 | * If edge-triggered, clear the GPE status bit now. Note that |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 495 | * level-triggered events are cleared after the GPE is serviced. |
| 496 | */ |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 497 | if ((gpe_event_info->flags & ACPI_GPE_XRUPT_TYPE_MASK) == |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 498 | ACPI_GPE_EDGE_TRIGGERED) { |
| 499 | status = acpi_hw_clear_gpe(gpe_event_info); |
| 500 | if (ACPI_FAILURE(status)) { |
Bob Moore | b8e4d89 | 2006-01-27 16:43:00 -0500 | [diff] [blame] | 501 | ACPI_EXCEPTION((AE_INFO, status, |
Bob Moore | f6a22b0 | 2010-03-05 17:56:40 +0800 | [diff] [blame] | 502 | "Unable to clear GPE[0x%2X]", |
Bob Moore | b8e4d89 | 2006-01-27 16:43:00 -0500 | [diff] [blame] | 503 | gpe_number)); |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 504 | return_UINT32(ACPI_INTERRUPT_NOT_HANDLED); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 505 | } |
| 506 | } |
| 507 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 508 | /* |
Bob Moore | c5a7156 | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 509 | * Dispatch the GPE to either an installed handler, or the control method |
| 510 | * associated with this GPE (_Lxx or _Exx). If a handler exists, we invoke |
| 511 | * it and do not attempt to run the method. If there is neither a handler |
| 512 | * nor a method, we disable this GPE to prevent further such pointless |
| 513 | * events from firing. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 514 | */ |
| 515 | switch (gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) { |
| 516 | case ACPI_GPE_DISPATCH_HANDLER: |
| 517 | |
| 518 | /* |
| 519 | * Invoke the installed handler (at interrupt level) |
Bob Moore | 9f15fc6 | 2008-11-12 16:01:56 +0800 | [diff] [blame] | 520 | * Ignore return status for now. |
| 521 | * TBD: leave GPE disabled on error? |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 522 | */ |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 523 | (void)gpe_event_info->dispatch.handler->address(gpe_event_info-> |
| 524 | dispatch. |
| 525 | handler-> |
| 526 | context); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 527 | |
| 528 | /* It is now safe to clear level-triggered events. */ |
| 529 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 530 | if ((gpe_event_info->flags & ACPI_GPE_XRUPT_TYPE_MASK) == |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 531 | ACPI_GPE_LEVEL_TRIGGERED) { |
| 532 | status = acpi_hw_clear_gpe(gpe_event_info); |
| 533 | if (ACPI_FAILURE(status)) { |
Bob Moore | b8e4d89 | 2006-01-27 16:43:00 -0500 | [diff] [blame] | 534 | ACPI_EXCEPTION((AE_INFO, status, |
Bob Moore | f6a22b0 | 2010-03-05 17:56:40 +0800 | [diff] [blame] | 535 | "Unable to clear GPE[0x%2X]", |
Bob Moore | b8e4d89 | 2006-01-27 16:43:00 -0500 | [diff] [blame] | 536 | gpe_number)); |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 537 | return_UINT32(ACPI_INTERRUPT_NOT_HANDLED); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 538 | } |
| 539 | } |
| 540 | break; |
| 541 | |
| 542 | case ACPI_GPE_DISPATCH_METHOD: |
| 543 | |
| 544 | /* |
Bob Moore | c5a7156 | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 545 | * Disable the GPE, so it doesn't keep firing before the method has a |
| 546 | * chance to run (it runs asynchronously with interrupts enabled). |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 547 | */ |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 548 | status = acpi_ev_disable_gpe(gpe_event_info); |
| 549 | if (ACPI_FAILURE(status)) { |
Bob Moore | b8e4d89 | 2006-01-27 16:43:00 -0500 | [diff] [blame] | 550 | ACPI_EXCEPTION((AE_INFO, status, |
Bob Moore | f6a22b0 | 2010-03-05 17:56:40 +0800 | [diff] [blame] | 551 | "Unable to disable GPE[0x%2X]", |
Bob Moore | b8e4d89 | 2006-01-27 16:43:00 -0500 | [diff] [blame] | 552 | gpe_number)); |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 553 | return_UINT32(ACPI_INTERRUPT_NOT_HANDLED); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 554 | } |
| 555 | |
| 556 | /* |
| 557 | * Execute the method associated with the GPE |
| 558 | * NOTE: Level-triggered GPEs are cleared after the method completes. |
| 559 | */ |
Bob Moore | 958dd24 | 2006-05-12 17:12:00 -0400 | [diff] [blame] | 560 | status = acpi_os_execute(OSL_GPE_HANDLER, |
| 561 | acpi_ev_asynch_execute_gpe_method, |
| 562 | gpe_event_info); |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 563 | if (ACPI_FAILURE(status)) { |
Bob Moore | b8e4d89 | 2006-01-27 16:43:00 -0500 | [diff] [blame] | 564 | ACPI_EXCEPTION((AE_INFO, status, |
Bob Moore | f6a22b0 | 2010-03-05 17:56:40 +0800 | [diff] [blame] | 565 | "Unable to queue handler for GPE[0x%2X] - event disabled", |
Bob Moore | b8e4d89 | 2006-01-27 16:43:00 -0500 | [diff] [blame] | 566 | gpe_number)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 567 | } |
| 568 | break; |
| 569 | |
| 570 | default: |
| 571 | |
| 572 | /* No handler or method to run! */ |
| 573 | |
Bob Moore | b8e4d89 | 2006-01-27 16:43:00 -0500 | [diff] [blame] | 574 | ACPI_ERROR((AE_INFO, |
Bob Moore | f6a22b0 | 2010-03-05 17:56:40 +0800 | [diff] [blame] | 575 | "No handler or method for GPE[0x%2X], disabling event", |
Bob Moore | b8e4d89 | 2006-01-27 16:43:00 -0500 | [diff] [blame] | 576 | gpe_number)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 577 | |
| 578 | /* |
Bob Moore | 9f15fc6 | 2008-11-12 16:01:56 +0800 | [diff] [blame] | 579 | * Disable the GPE. The GPE will remain disabled until the ACPICA |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 580 | * Core Subsystem is restarted, or a handler is installed. |
| 581 | */ |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 582 | status = acpi_ev_disable_gpe(gpe_event_info); |
| 583 | if (ACPI_FAILURE(status)) { |
Bob Moore | b8e4d89 | 2006-01-27 16:43:00 -0500 | [diff] [blame] | 584 | ACPI_EXCEPTION((AE_INFO, status, |
Bob Moore | f6a22b0 | 2010-03-05 17:56:40 +0800 | [diff] [blame] | 585 | "Unable to disable GPE[0x%2X]", |
Bob Moore | b8e4d89 | 2006-01-27 16:43:00 -0500 | [diff] [blame] | 586 | gpe_number)); |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 587 | return_UINT32(ACPI_INTERRUPT_NOT_HANDLED); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 588 | } |
| 589 | break; |
| 590 | } |
| 591 | |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 592 | return_UINT32(ACPI_INTERRUPT_HANDLED); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 593 | } |