evgpe.c 19 KB

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