1 /******************************************************************************
3 * Module Name: evxfevnt - External Interfaces, ACPI event disable/enable
5 *****************************************************************************/
8 * Copyright (C) 2000 - 2008, Intel Corp.
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
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.
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.
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.
44 #include <acpi/acpi.h>
50 #define _COMPONENT ACPI_EVENTS
51 ACPI_MODULE_NAME("evxfevnt")
53 /* Local prototypes */
55 acpi_ev_get_gpe_device(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
56 struct acpi_gpe_block_info *gpe_block, void *context);
58 /*******************************************************************************
60 * FUNCTION: acpi_enable
66 * DESCRIPTION: Transfers the system into ACPI mode.
68 ******************************************************************************/
70 acpi_status acpi_enable(void)
72 acpi_status status = AE_OK;
74 ACPI_FUNCTION_TRACE(acpi_enable);
76 /* ACPI tables must be present */
78 if (!acpi_tb_tables_loaded()) {
79 return_ACPI_STATUS(AE_NO_ACPI_TABLES);
82 /* Check current mode */
84 if (acpi_hw_get_mode() == ACPI_SYS_MODE_ACPI) {
85 ACPI_DEBUG_PRINT((ACPI_DB_INIT,
86 "System is already in ACPI mode\n"));
88 /* Transition to ACPI mode */
90 status = acpi_hw_set_mode(ACPI_SYS_MODE_ACPI);
91 if (ACPI_FAILURE(status)) {
93 "Could not transition to ACPI mode"));
94 return_ACPI_STATUS(status);
97 ACPI_DEBUG_PRINT((ACPI_DB_INIT,
98 "Transition to ACPI mode successful\n"));
101 return_ACPI_STATUS(status);
104 ACPI_EXPORT_SYMBOL(acpi_enable)
106 /*******************************************************************************
108 * FUNCTION: acpi_disable
114 * DESCRIPTION: Transfers the system into LEGACY (non-ACPI) mode.
116 ******************************************************************************/
117 acpi_status acpi_disable(void)
119 acpi_status status = AE_OK;
121 ACPI_FUNCTION_TRACE(acpi_disable);
123 if (acpi_hw_get_mode() == ACPI_SYS_MODE_LEGACY) {
124 ACPI_DEBUG_PRINT((ACPI_DB_INIT,
125 "System is already in legacy (non-ACPI) mode\n"));
127 /* Transition to LEGACY mode */
129 status = acpi_hw_set_mode(ACPI_SYS_MODE_LEGACY);
131 if (ACPI_FAILURE(status)) {
133 "Could not exit ACPI mode to legacy mode"));
134 return_ACPI_STATUS(status);
137 ACPI_DEBUG_PRINT((ACPI_DB_INIT, "ACPI mode disabled\n"));
140 return_ACPI_STATUS(status);
143 ACPI_EXPORT_SYMBOL(acpi_disable)
145 /*******************************************************************************
147 * FUNCTION: acpi_enable_event
149 * PARAMETERS: Event - The fixed eventto be enabled
154 * DESCRIPTION: Enable an ACPI event (fixed)
156 ******************************************************************************/
157 acpi_status acpi_enable_event(u32 event, u32 flags)
159 acpi_status status = AE_OK;
162 ACPI_FUNCTION_TRACE(acpi_enable_event);
164 /* Decode the Fixed Event */
166 if (event > ACPI_EVENT_MAX) {
167 return_ACPI_STATUS(AE_BAD_PARAMETER);
171 * Enable the requested fixed event (by writing a one to the enable
175 acpi_write_bit_register(acpi_gbl_fixed_event_info[event].
176 enable_register_id, ACPI_ENABLE_EVENT);
177 if (ACPI_FAILURE(status)) {
178 return_ACPI_STATUS(status);
181 /* Make sure that the hardware responded */
184 acpi_read_bit_register(acpi_gbl_fixed_event_info[event].
185 enable_register_id, &value);
186 if (ACPI_FAILURE(status)) {
187 return_ACPI_STATUS(status);
192 "Could not enable %s event",
193 acpi_ut_get_event_name(event)));
194 return_ACPI_STATUS(AE_NO_HARDWARE_RESPONSE);
197 return_ACPI_STATUS(status);
200 ACPI_EXPORT_SYMBOL(acpi_enable_event)
202 /*******************************************************************************
204 * FUNCTION: acpi_set_gpe
206 * PARAMETERS: gpe_device - Parent GPE Device
207 * gpe_number - GPE level within the GPE block
208 * action - Enable or disable
209 * Called from ISR or not
213 * DESCRIPTION: Enable or disable an ACPI event (general purpose)
215 ******************************************************************************/
216 acpi_status acpi_set_gpe(acpi_handle gpe_device, u32 gpe_number, u8 action)
218 acpi_status status = AE_OK;
219 acpi_cpu_flags flags;
220 struct acpi_gpe_event_info *gpe_event_info;
222 ACPI_FUNCTION_TRACE(acpi_set_gpe);
224 flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
226 /* Ensure that we have a valid GPE number */
228 gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
229 if (!gpe_event_info) {
230 status = AE_BAD_PARAMETER;
231 goto unlock_and_exit;
234 /* Perform the action */
237 case ACPI_GPE_ENABLE:
238 status = acpi_ev_enable_gpe(gpe_event_info, TRUE);
241 case ACPI_GPE_DISABLE:
242 status = acpi_ev_disable_gpe(gpe_event_info);
246 ACPI_ERROR((AE_INFO, "Invalid action\n"));
247 status = AE_BAD_PARAMETER;
252 acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
253 return_ACPI_STATUS(status);
256 ACPI_EXPORT_SYMBOL(acpi_set_gpe)
258 /*******************************************************************************
260 * FUNCTION: acpi_enable_gpe
262 * PARAMETERS: gpe_device - Parent GPE Device
263 * gpe_number - GPE level within the GPE block
264 * type - Purpose the GPE will be used for
268 * DESCRIPTION: Take a reference to a GPE and enable it if necessary
270 ******************************************************************************/
271 acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number, u8 type)
273 acpi_status status = AE_OK;
274 acpi_cpu_flags flags;
275 struct acpi_gpe_event_info *gpe_event_info;
277 ACPI_FUNCTION_TRACE(acpi_enable_gpe);
279 flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
281 /* Ensure that we have a valid GPE number */
283 gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
284 if (!gpe_event_info) {
285 status = AE_BAD_PARAMETER;
286 goto unlock_and_exit;
289 if (type & ACPI_GPE_TYPE_RUNTIME) {
290 if (++gpe_event_info->runtime_count == 1)
291 status = acpi_ev_enable_gpe(gpe_event_info, TRUE);
293 if (ACPI_FAILURE(status))
294 gpe_event_info->runtime_count--;
297 if (type & ACPI_GPE_TYPE_WAKE) {
298 if (!(gpe_event_info->flags & ACPI_GPE_CAN_WAKE)) {
299 status = AE_BAD_PARAMETER;
300 goto unlock_and_exit;
304 * Wake-up GPEs are only enabled right prior to putting the
305 * system into a sleep state.
307 if (++gpe_event_info->wakeup_count == 1)
308 acpi_ev_update_gpe_enable_masks(gpe_event_info);
312 acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
313 return_ACPI_STATUS(status);
315 ACPI_EXPORT_SYMBOL(acpi_enable_gpe)
317 /*******************************************************************************
319 * FUNCTION: acpi_disable_gpe
321 * PARAMETERS: gpe_device - Parent GPE Device
322 * gpe_number - GPE level within the GPE block
323 * type - Purpose the GPE won't be used for any more
327 * DESCRIPTION: Release a reference to a GPE and disable it if necessary
329 ******************************************************************************/
330 acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number, u8 type)
332 acpi_status status = AE_OK;
333 acpi_cpu_flags flags;
334 struct acpi_gpe_event_info *gpe_event_info;
336 ACPI_FUNCTION_TRACE(acpi_disable_gpe);
338 flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
339 /* Ensure that we have a valid GPE number */
341 gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
342 if (!gpe_event_info) {
343 status = AE_BAD_PARAMETER;
344 goto unlock_and_exit;
347 if ((type & ACPI_GPE_TYPE_WAKE) && gpe_event_info->runtime_count) {
348 if (--gpe_event_info->runtime_count == 0)
349 acpi_ev_disable_gpe(gpe_event_info);
352 if ((type & ACPI_GPE_TYPE_RUNTIME) && gpe_event_info->wakeup_count) {
354 * Wake-up GPEs are not enabled after leaving system sleep
355 * states, so we don't need to disable them here.
357 if (--gpe_event_info->wakeup_count == 0)
358 acpi_ev_update_gpe_enable_masks(gpe_event_info);
362 acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
363 return_ACPI_STATUS(status);
365 ACPI_EXPORT_SYMBOL(acpi_disable_gpe)
367 /*******************************************************************************
369 * FUNCTION: acpi_disable_event
371 * PARAMETERS: Event - The fixed eventto be enabled
376 * DESCRIPTION: Disable an ACPI event (fixed)
378 ******************************************************************************/
379 acpi_status acpi_disable_event(u32 event, u32 flags)
381 acpi_status status = AE_OK;
384 ACPI_FUNCTION_TRACE(acpi_disable_event);
386 /* Decode the Fixed Event */
388 if (event > ACPI_EVENT_MAX) {
389 return_ACPI_STATUS(AE_BAD_PARAMETER);
393 * Disable the requested fixed event (by writing a zero to the enable
397 acpi_write_bit_register(acpi_gbl_fixed_event_info[event].
398 enable_register_id, ACPI_DISABLE_EVENT);
399 if (ACPI_FAILURE(status)) {
400 return_ACPI_STATUS(status);
404 acpi_read_bit_register(acpi_gbl_fixed_event_info[event].
405 enable_register_id, &value);
406 if (ACPI_FAILURE(status)) {
407 return_ACPI_STATUS(status);
412 "Could not disable %s events",
413 acpi_ut_get_event_name(event)));
414 return_ACPI_STATUS(AE_NO_HARDWARE_RESPONSE);
417 return_ACPI_STATUS(status);
420 ACPI_EXPORT_SYMBOL(acpi_disable_event)
422 /*******************************************************************************
424 * FUNCTION: acpi_clear_event
426 * PARAMETERS: Event - The fixed event to be cleared
430 * DESCRIPTION: Clear an ACPI event (fixed)
432 ******************************************************************************/
433 acpi_status acpi_clear_event(u32 event)
435 acpi_status status = AE_OK;
437 ACPI_FUNCTION_TRACE(acpi_clear_event);
439 /* Decode the Fixed Event */
441 if (event > ACPI_EVENT_MAX) {
442 return_ACPI_STATUS(AE_BAD_PARAMETER);
446 * Clear the requested fixed event (By writing a one to the status
450 acpi_write_bit_register(acpi_gbl_fixed_event_info[event].
451 status_register_id, ACPI_CLEAR_STATUS);
453 return_ACPI_STATUS(status);
456 ACPI_EXPORT_SYMBOL(acpi_clear_event)
458 /*******************************************************************************
460 * FUNCTION: acpi_clear_gpe
462 * PARAMETERS: gpe_device - Parent GPE Device
463 * gpe_number - GPE level within the GPE block
464 * Flags - Called from an ISR or not
468 * DESCRIPTION: Clear an ACPI event (general purpose)
470 ******************************************************************************/
471 acpi_status acpi_clear_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags)
473 acpi_status status = AE_OK;
474 struct acpi_gpe_event_info *gpe_event_info;
476 ACPI_FUNCTION_TRACE(acpi_clear_gpe);
478 /* Use semaphore lock if not executing at interrupt level */
480 if (flags & ACPI_NOT_ISR) {
481 status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
482 if (ACPI_FAILURE(status)) {
483 return_ACPI_STATUS(status);
487 /* Ensure that we have a valid GPE number */
489 gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
490 if (!gpe_event_info) {
491 status = AE_BAD_PARAMETER;
492 goto unlock_and_exit;
495 status = acpi_hw_clear_gpe(gpe_event_info);
498 if (flags & ACPI_NOT_ISR) {
499 (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
501 return_ACPI_STATUS(status);
504 ACPI_EXPORT_SYMBOL(acpi_clear_gpe)
505 /*******************************************************************************
507 * FUNCTION: acpi_get_event_status
509 * PARAMETERS: Event - The fixed event
510 * event_status - Where the current status of the event will
515 * DESCRIPTION: Obtains and returns the current status of the event
517 ******************************************************************************/
518 acpi_status acpi_get_event_status(u32 event, acpi_event_status * event_status)
520 acpi_status status = AE_OK;
523 ACPI_FUNCTION_TRACE(acpi_get_event_status);
526 return_ACPI_STATUS(AE_BAD_PARAMETER);
529 /* Decode the Fixed Event */
531 if (event > ACPI_EVENT_MAX) {
532 return_ACPI_STATUS(AE_BAD_PARAMETER);
535 /* Get the status of the requested fixed event */
538 acpi_read_bit_register(acpi_gbl_fixed_event_info[event].
539 enable_register_id, &value);
540 if (ACPI_FAILURE(status))
541 return_ACPI_STATUS(status);
543 *event_status = value;
546 acpi_read_bit_register(acpi_gbl_fixed_event_info[event].
547 status_register_id, &value);
548 if (ACPI_FAILURE(status))
549 return_ACPI_STATUS(status);
552 *event_status |= ACPI_EVENT_FLAG_SET;
554 if (acpi_gbl_fixed_event_handlers[event].handler)
555 *event_status |= ACPI_EVENT_FLAG_HANDLE;
557 return_ACPI_STATUS(status);
560 ACPI_EXPORT_SYMBOL(acpi_get_event_status)
562 /*******************************************************************************
564 * FUNCTION: acpi_get_gpe_status
566 * PARAMETERS: gpe_device - Parent GPE Device
567 * gpe_number - GPE level within the GPE block
568 * Flags - Called from an ISR or not
569 * event_status - Where the current status of the event will
574 * DESCRIPTION: Get status of an event (general purpose)
576 ******************************************************************************/
578 acpi_get_gpe_status(acpi_handle gpe_device,
579 u32 gpe_number, u32 flags, acpi_event_status * event_status)
581 acpi_status status = AE_OK;
582 struct acpi_gpe_event_info *gpe_event_info;
584 ACPI_FUNCTION_TRACE(acpi_get_gpe_status);
586 /* Use semaphore lock if not executing at interrupt level */
588 if (flags & ACPI_NOT_ISR) {
589 status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
590 if (ACPI_FAILURE(status)) {
591 return_ACPI_STATUS(status);
595 /* Ensure that we have a valid GPE number */
597 gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
598 if (!gpe_event_info) {
599 status = AE_BAD_PARAMETER;
600 goto unlock_and_exit;
603 /* Obtain status on the requested GPE number */
605 status = acpi_hw_get_gpe_status(gpe_event_info, event_status);
607 if (gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK)
608 *event_status |= ACPI_EVENT_FLAG_HANDLE;
611 if (flags & ACPI_NOT_ISR) {
612 (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
614 return_ACPI_STATUS(status);
617 ACPI_EXPORT_SYMBOL(acpi_get_gpe_status)
618 /*******************************************************************************
620 * FUNCTION: acpi_install_gpe_block
622 * PARAMETERS: gpe_device - Handle to the parent GPE Block Device
623 * gpe_block_address - Address and space_iD
624 * register_count - Number of GPE register pairs in the block
625 * interrupt_number - H/W interrupt for the block
629 * DESCRIPTION: Create and Install a block of GPE registers
631 ******************************************************************************/
633 acpi_install_gpe_block(acpi_handle gpe_device,
634 struct acpi_generic_address *gpe_block_address,
635 u32 register_count, u32 interrupt_number)
638 union acpi_operand_object *obj_desc;
639 struct acpi_namespace_node *node;
640 struct acpi_gpe_block_info *gpe_block;
642 ACPI_FUNCTION_TRACE(acpi_install_gpe_block);
644 if ((!gpe_device) || (!gpe_block_address) || (!register_count)) {
645 return_ACPI_STATUS(AE_BAD_PARAMETER);
648 status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
649 if (ACPI_FAILURE(status)) {
653 node = acpi_ns_validate_handle(gpe_device);
655 status = AE_BAD_PARAMETER;
656 goto unlock_and_exit;
660 * For user-installed GPE Block Devices, the gpe_block_base_number
664 acpi_ev_create_gpe_block(node, gpe_block_address, register_count, 0,
665 interrupt_number, &gpe_block);
666 if (ACPI_FAILURE(status)) {
667 goto unlock_and_exit;
670 /* Run the _PRW methods and enable the GPEs */
672 status = acpi_ev_initialize_gpe_block(node, gpe_block);
673 if (ACPI_FAILURE(status)) {
674 goto unlock_and_exit;
677 /* Get the device_object attached to the node */
679 obj_desc = acpi_ns_get_attached_object(node);
682 /* No object, create a new one */
684 obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_DEVICE);
686 status = AE_NO_MEMORY;
687 goto unlock_and_exit;
691 acpi_ns_attach_object(node, obj_desc, ACPI_TYPE_DEVICE);
693 /* Remove local reference to the object */
695 acpi_ut_remove_reference(obj_desc);
697 if (ACPI_FAILURE(status)) {
698 goto unlock_and_exit;
702 /* Install the GPE block in the device_object */
704 obj_desc->device.gpe_block = gpe_block;
707 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
708 return_ACPI_STATUS(status);
711 ACPI_EXPORT_SYMBOL(acpi_install_gpe_block)
713 /*******************************************************************************
715 * FUNCTION: acpi_remove_gpe_block
717 * PARAMETERS: gpe_device - Handle to the parent GPE Block Device
721 * DESCRIPTION: Remove a previously installed block of GPE registers
723 ******************************************************************************/
724 acpi_status acpi_remove_gpe_block(acpi_handle gpe_device)
726 union acpi_operand_object *obj_desc;
728 struct acpi_namespace_node *node;
730 ACPI_FUNCTION_TRACE(acpi_remove_gpe_block);
733 return_ACPI_STATUS(AE_BAD_PARAMETER);
736 status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
737 if (ACPI_FAILURE(status)) {
741 node = acpi_ns_validate_handle(gpe_device);
743 status = AE_BAD_PARAMETER;
744 goto unlock_and_exit;
747 /* Get the device_object attached to the node */
749 obj_desc = acpi_ns_get_attached_object(node);
750 if (!obj_desc || !obj_desc->device.gpe_block) {
751 return_ACPI_STATUS(AE_NULL_OBJECT);
754 /* Delete the GPE block (but not the device_object) */
756 status = acpi_ev_delete_gpe_block(obj_desc->device.gpe_block);
757 if (ACPI_SUCCESS(status)) {
758 obj_desc->device.gpe_block = NULL;
762 (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
763 return_ACPI_STATUS(status);
766 ACPI_EXPORT_SYMBOL(acpi_remove_gpe_block)
768 /*******************************************************************************
770 * FUNCTION: acpi_get_gpe_device
772 * PARAMETERS: Index - System GPE index (0-current_gpe_count)
773 * gpe_device - Where the parent GPE Device is returned
777 * DESCRIPTION: Obtain the GPE device associated with the input index. A NULL
778 * gpe device indicates that the gpe number is contained in one of
779 * the FADT-defined gpe blocks. Otherwise, the GPE block device.
781 ******************************************************************************/
783 acpi_get_gpe_device(u32 index, acpi_handle *gpe_device)
785 struct acpi_gpe_device_info info;
788 ACPI_FUNCTION_TRACE(acpi_get_gpe_device);
791 return_ACPI_STATUS(AE_BAD_PARAMETER);
794 if (index >= acpi_current_gpe_count) {
795 return_ACPI_STATUS(AE_NOT_EXIST);
798 /* Setup and walk the GPE list */
801 info.status = AE_NOT_EXIST;
802 info.gpe_device = NULL;
803 info.next_block_base_index = 0;
805 status = acpi_ev_walk_gpe_list(acpi_ev_get_gpe_device, &info);
806 if (ACPI_FAILURE(status)) {
807 return_ACPI_STATUS(status);
810 *gpe_device = info.gpe_device;
811 return_ACPI_STATUS(info.status);
814 ACPI_EXPORT_SYMBOL(acpi_get_gpe_device)
816 /*******************************************************************************
818 * FUNCTION: acpi_ev_get_gpe_device
820 * PARAMETERS: GPE_WALK_CALLBACK
824 * DESCRIPTION: Matches the input GPE index (0-current_gpe_count) with a GPE
825 * block device. NULL if the GPE is one of the FADT-defined GPEs.
827 ******************************************************************************/
829 acpi_ev_get_gpe_device(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
830 struct acpi_gpe_block_info *gpe_block, void *context)
832 struct acpi_gpe_device_info *info = context;
834 /* Increment Index by the number of GPEs in this block */
836 info->next_block_base_index +=
837 (gpe_block->register_count * ACPI_GPE_REGISTER_WIDTH);
839 if (info->index < info->next_block_base_index) {
841 * The GPE index is within this block, get the node. Leave the node
842 * NULL for the FADT-defined GPEs
844 if ((gpe_block->node)->type == ACPI_TYPE_DEVICE) {
845 info->gpe_device = gpe_block->node;
848 info->status = AE_OK;
849 return (AE_CTRL_END);
855 /******************************************************************************
857 * FUNCTION: acpi_disable_all_gpes
863 * DESCRIPTION: Disable and clear all GPEs in all GPE blocks
865 ******************************************************************************/
867 acpi_status acpi_disable_all_gpes(void)
871 ACPI_FUNCTION_TRACE(acpi_disable_all_gpes);
873 status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
874 if (ACPI_FAILURE(status)) {
875 return_ACPI_STATUS(status);
878 status = acpi_hw_disable_all_gpes();
879 (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
881 return_ACPI_STATUS(status);
884 /******************************************************************************
886 * FUNCTION: acpi_enable_all_runtime_gpes
892 * DESCRIPTION: Enable all "runtime" GPEs, in all GPE blocks
894 ******************************************************************************/
896 acpi_status acpi_enable_all_runtime_gpes(void)
900 ACPI_FUNCTION_TRACE(acpi_enable_all_runtime_gpes);
902 status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
903 if (ACPI_FAILURE(status)) {
904 return_ACPI_STATUS(status);
907 status = acpi_hw_enable_all_runtime_gpes();
908 (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
910 return_ACPI_STATUS(status);