diff options
Diffstat (limited to 'drivers/acpi/events/evgpe.c')
-rw-r--r-- | drivers/acpi/events/evgpe.c | 427 |
1 files changed, 196 insertions, 231 deletions
diff --git a/drivers/acpi/events/evgpe.c b/drivers/acpi/events/evgpe.c index 081120b109b..b2f232df13d 100644 --- a/drivers/acpi/events/evgpe.c +++ b/drivers/acpi/events/evgpe.c @@ -46,14 +46,10 @@ #include <acpi/acnamesp.h> #define _COMPONENT ACPI_EVENTS - ACPI_MODULE_NAME ("evgpe") +ACPI_MODULE_NAME("evgpe") /* Local prototypes */ - -static void ACPI_SYSTEM_XFACE -acpi_ev_asynch_execute_gpe_method ( - void *context); - +static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context); /******************************************************************************* * @@ -69,15 +65,11 @@ acpi_ev_asynch_execute_gpe_method ( ******************************************************************************/ acpi_status -acpi_ev_set_gpe_type ( - struct acpi_gpe_event_info *gpe_event_info, - u8 type) +acpi_ev_set_gpe_type(struct acpi_gpe_event_info *gpe_event_info, u8 type) { - acpi_status status; - - - ACPI_FUNCTION_TRACE ("ev_set_gpe_type"); + acpi_status status; + ACPI_FUNCTION_TRACE("ev_set_gpe_type"); /* Validate type and update register enable masks */ @@ -88,21 +80,20 @@ acpi_ev_set_gpe_type ( break; default: - return_ACPI_STATUS (AE_BAD_PARAMETER); + return_ACPI_STATUS(AE_BAD_PARAMETER); } /* Disable the GPE if currently enabled */ - status = acpi_ev_disable_gpe (gpe_event_info); + status = acpi_ev_disable_gpe(gpe_event_info); /* Type was validated above */ - gpe_event_info->flags &= ~ACPI_GPE_TYPE_MASK; /* Clear type bits */ - gpe_event_info->flags |= type; /* Insert type */ - return_ACPI_STATUS (status); + gpe_event_info->flags &= ~ACPI_GPE_TYPE_MASK; /* Clear type bits */ + gpe_event_info->flags |= type; /* Insert type */ + return_ACPI_STATUS(status); } - /******************************************************************************* * * FUNCTION: acpi_ev_update_gpe_enable_masks @@ -118,57 +109,55 @@ acpi_ev_set_gpe_type ( ******************************************************************************/ acpi_status -acpi_ev_update_gpe_enable_masks ( - struct acpi_gpe_event_info *gpe_event_info, - u8 type) +acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info, + u8 type) { - struct acpi_gpe_register_info *gpe_register_info; - u8 register_bit; - - - ACPI_FUNCTION_TRACE ("ev_update_gpe_enable_masks"); + struct acpi_gpe_register_info *gpe_register_info; + u8 register_bit; + ACPI_FUNCTION_TRACE("ev_update_gpe_enable_masks"); gpe_register_info = gpe_event_info->register_info; if (!gpe_register_info) { - return_ACPI_STATUS (AE_NOT_EXIST); + return_ACPI_STATUS(AE_NOT_EXIST); } register_bit = gpe_event_info->register_bit; /* 1) Disable case. Simply clear all enable bits */ if (type == ACPI_GPE_DISABLE) { - ACPI_CLEAR_BIT (gpe_register_info->enable_for_wake, register_bit); - ACPI_CLEAR_BIT (gpe_register_info->enable_for_run, register_bit); - return_ACPI_STATUS (AE_OK); + ACPI_CLEAR_BIT(gpe_register_info->enable_for_wake, + register_bit); + ACPI_CLEAR_BIT(gpe_register_info->enable_for_run, register_bit); + return_ACPI_STATUS(AE_OK); } /* 2) Enable case. Set/Clear the appropriate enable bits */ switch (gpe_event_info->flags & ACPI_GPE_TYPE_MASK) { case ACPI_GPE_TYPE_WAKE: - ACPI_SET_BIT (gpe_register_info->enable_for_wake, register_bit); - ACPI_CLEAR_BIT (gpe_register_info->enable_for_run, register_bit); + ACPI_SET_BIT(gpe_register_info->enable_for_wake, register_bit); + ACPI_CLEAR_BIT(gpe_register_info->enable_for_run, register_bit); break; case ACPI_GPE_TYPE_RUNTIME: - ACPI_CLEAR_BIT (gpe_register_info->enable_for_wake, register_bit); - ACPI_SET_BIT (gpe_register_info->enable_for_run, register_bit); + ACPI_CLEAR_BIT(gpe_register_info->enable_for_wake, + register_bit); + ACPI_SET_BIT(gpe_register_info->enable_for_run, register_bit); break; case ACPI_GPE_TYPE_WAKE_RUN: - ACPI_SET_BIT (gpe_register_info->enable_for_wake, register_bit); - ACPI_SET_BIT (gpe_register_info->enable_for_run, register_bit); + ACPI_SET_BIT(gpe_register_info->enable_for_wake, register_bit); + ACPI_SET_BIT(gpe_register_info->enable_for_run, register_bit); break; default: - return_ACPI_STATUS (AE_BAD_PARAMETER); + return_ACPI_STATUS(AE_BAD_PARAMETER); } - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_ev_enable_gpe @@ -184,21 +173,19 @@ acpi_ev_update_gpe_enable_masks ( ******************************************************************************/ acpi_status -acpi_ev_enable_gpe ( - struct acpi_gpe_event_info *gpe_event_info, - u8 write_to_hardware) +acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info, + u8 write_to_hardware) { - acpi_status status; - - - ACPI_FUNCTION_TRACE ("ev_enable_gpe"); + acpi_status status; + ACPI_FUNCTION_TRACE("ev_enable_gpe"); /* Make sure HW enable masks are updated */ - status = acpi_ev_update_gpe_enable_masks (gpe_event_info, ACPI_GPE_ENABLE); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = + acpi_ev_update_gpe_enable_masks(gpe_event_info, ACPI_GPE_ENABLE); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* Mark wake-enabled or HW enable, or both */ @@ -206,41 +193,40 @@ acpi_ev_enable_gpe ( switch (gpe_event_info->flags & ACPI_GPE_TYPE_MASK) { case ACPI_GPE_TYPE_WAKE: - ACPI_SET_BIT (gpe_event_info->flags, ACPI_GPE_WAKE_ENABLED); + ACPI_SET_BIT(gpe_event_info->flags, ACPI_GPE_WAKE_ENABLED); break; case ACPI_GPE_TYPE_WAKE_RUN: - ACPI_SET_BIT (gpe_event_info->flags, ACPI_GPE_WAKE_ENABLED); + ACPI_SET_BIT(gpe_event_info->flags, ACPI_GPE_WAKE_ENABLED); /*lint -fallthrough */ case ACPI_GPE_TYPE_RUNTIME: - ACPI_SET_BIT (gpe_event_info->flags, ACPI_GPE_RUN_ENABLED); + ACPI_SET_BIT(gpe_event_info->flags, ACPI_GPE_RUN_ENABLED); if (write_to_hardware) { /* Clear the GPE (of stale events), then enable it */ - status = acpi_hw_clear_gpe (gpe_event_info); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = acpi_hw_clear_gpe(gpe_event_info); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* Enable the requested runtime GPE */ - status = acpi_hw_write_gpe_enable_reg (gpe_event_info); + status = acpi_hw_write_gpe_enable_reg(gpe_event_info); } break; default: - return_ACPI_STATUS (AE_BAD_PARAMETER); + return_ACPI_STATUS(AE_BAD_PARAMETER); } - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_ev_disable_gpe @@ -253,36 +239,33 @@ acpi_ev_enable_gpe ( * ******************************************************************************/ -acpi_status -acpi_ev_disable_gpe ( - struct acpi_gpe_event_info *gpe_event_info) +acpi_status acpi_ev_disable_gpe(struct acpi_gpe_event_info *gpe_event_info) { - acpi_status status; - - - ACPI_FUNCTION_TRACE ("ev_disable_gpe"); + acpi_status status; + ACPI_FUNCTION_TRACE("ev_disable_gpe"); if (!(gpe_event_info->flags & ACPI_GPE_ENABLE_MASK)) { - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } /* Make sure HW enable masks are updated */ - status = acpi_ev_update_gpe_enable_masks (gpe_event_info, ACPI_GPE_DISABLE); - if (ACPI_FAILURE (status)) { - return_ACPI_STATUS (status); + status = + acpi_ev_update_gpe_enable_masks(gpe_event_info, ACPI_GPE_DISABLE); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } /* Mark wake-disabled or HW disable, or both */ switch (gpe_event_info->flags & ACPI_GPE_TYPE_MASK) { case ACPI_GPE_TYPE_WAKE: - ACPI_CLEAR_BIT (gpe_event_info->flags, ACPI_GPE_WAKE_ENABLED); + ACPI_CLEAR_BIT(gpe_event_info->flags, ACPI_GPE_WAKE_ENABLED); break; case ACPI_GPE_TYPE_WAKE_RUN: - ACPI_CLEAR_BIT (gpe_event_info->flags, ACPI_GPE_WAKE_ENABLED); + ACPI_CLEAR_BIT(gpe_event_info->flags, ACPI_GPE_WAKE_ENABLED); /*lint -fallthrough */ @@ -290,18 +273,17 @@ acpi_ev_disable_gpe ( /* Disable the requested runtime GPE */ - ACPI_CLEAR_BIT (gpe_event_info->flags, ACPI_GPE_RUN_ENABLED); - status = acpi_hw_write_gpe_enable_reg (gpe_event_info); + ACPI_CLEAR_BIT(gpe_event_info->flags, ACPI_GPE_RUN_ENABLED); + status = acpi_hw_write_gpe_enable_reg(gpe_event_info); break; default: - return_ACPI_STATUS (AE_BAD_PARAMETER); + return_ACPI_STATUS(AE_BAD_PARAMETER); } - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } - /******************************************************************************* * * FUNCTION: acpi_ev_get_gpe_event_info @@ -319,18 +301,14 @@ acpi_ev_disable_gpe ( * ******************************************************************************/ -struct acpi_gpe_event_info * -acpi_ev_get_gpe_event_info ( - acpi_handle gpe_device, - u32 gpe_number) +struct acpi_gpe_event_info *acpi_ev_get_gpe_event_info(acpi_handle gpe_device, + u32 gpe_number) { - union acpi_operand_object *obj_desc; - struct acpi_gpe_block_info *gpe_block; - acpi_native_uint i; - - - ACPI_FUNCTION_ENTRY (); + union acpi_operand_object *obj_desc; + struct acpi_gpe_block_info *gpe_block; + acpi_native_uint i; + ACPI_FUNCTION_ENTRY(); /* A NULL gpe_block means use the FADT-defined GPE block(s) */ @@ -340,11 +318,14 @@ acpi_ev_get_gpe_event_info ( for (i = 0; i < ACPI_MAX_GPE_BLOCKS; i++) { gpe_block = acpi_gbl_gpe_fadt_blocks[i]; if (gpe_block) { - if ((gpe_number >= gpe_block->block_base_number) && - (gpe_number < gpe_block->block_base_number + - (gpe_block->register_count * 8))) { - return (&gpe_block->event_info[gpe_number - - gpe_block->block_base_number]); + if ((gpe_number >= gpe_block->block_base_number) + && (gpe_number < + gpe_block->block_base_number + + (gpe_block->register_count * 8))) { + return (&gpe_block-> + event_info[gpe_number - + gpe_block-> + block_base_number]); } } } @@ -356,23 +337,25 @@ acpi_ev_get_gpe_event_info ( /* A Non-NULL gpe_device means this is a GPE Block Device */ - obj_desc = acpi_ns_get_attached_object ((struct acpi_namespace_node *) gpe_device); - if (!obj_desc || - !obj_desc->device.gpe_block) { + obj_desc = + acpi_ns_get_attached_object((struct acpi_namespace_node *) + gpe_device); + if (!obj_desc || !obj_desc->device.gpe_block) { return (NULL); } gpe_block = obj_desc->device.gpe_block; if ((gpe_number >= gpe_block->block_base_number) && - (gpe_number < gpe_block->block_base_number + (gpe_block->register_count * 8))) { - return (&gpe_block->event_info[gpe_number - gpe_block->block_base_number]); + (gpe_number < + gpe_block->block_base_number + (gpe_block->register_count * 8))) { + return (&gpe_block-> + event_info[gpe_number - gpe_block->block_base_number]); } return (NULL); } - /******************************************************************************* * * FUNCTION: acpi_ev_gpe_detect @@ -387,22 +370,20 @@ acpi_ev_get_gpe_event_info ( * ******************************************************************************/ -u32 -acpi_ev_gpe_detect ( - struct acpi_gpe_xrupt_info *gpe_xrupt_list) +u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) { - u32 int_status = ACPI_INTERRUPT_NOT_HANDLED; - u8 enabled_status_byte; - struct acpi_gpe_register_info *gpe_register_info; - u32 status_reg; - u32 enable_reg; - acpi_status status; - struct acpi_gpe_block_info *gpe_block; - acpi_native_uint i; - acpi_native_uint j; - - - ACPI_FUNCTION_NAME ("ev_gpe_detect"); + u32 int_status = ACPI_INTERRUPT_NOT_HANDLED; + u8 enabled_status_byte; + struct acpi_gpe_register_info *gpe_register_info; + u32 status_reg; + u32 enable_reg; + u32 flags; + acpi_status status; + struct acpi_gpe_block_info *gpe_block; + acpi_native_uint i; + acpi_native_uint j; + + ACPI_FUNCTION_NAME("ev_gpe_detect"); /* Check for the case where there are no GPEs */ @@ -412,7 +393,7 @@ acpi_ev_gpe_detect ( /* Examine all GPE blocks attached to this interrupt level */ - acpi_os_acquire_lock (acpi_gbl_gpe_lock, ACPI_ISR); + flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); gpe_block = gpe_xrupt_list->gpe_block_list_head; while (gpe_block) { /* @@ -427,23 +408,30 @@ acpi_ev_gpe_detect ( /* Read the Status Register */ - status = acpi_hw_low_level_read (ACPI_GPE_REGISTER_WIDTH, &status_reg, - &gpe_register_info->status_address); - if (ACPI_FAILURE (status)) { + status = + acpi_hw_low_level_read(ACPI_GPE_REGISTER_WIDTH, + &status_reg, + &gpe_register_info-> + status_address); + if (ACPI_FAILURE(status)) { goto unlock_and_exit; } /* Read the Enable Register */ - status = acpi_hw_low_level_read (ACPI_GPE_REGISTER_WIDTH, &enable_reg, - &gpe_register_info->enable_address); - if (ACPI_FAILURE (status)) { + status = + acpi_hw_low_level_read(ACPI_GPE_REGISTER_WIDTH, + &enable_reg, + &gpe_register_info-> + enable_address); + if (ACPI_FAILURE(status)) { goto unlock_and_exit; } - ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS, - "Read GPE Register at GPE%X: Status=%02X, Enable=%02X\n", - gpe_register_info->base_gpe_number, status_reg, enable_reg)); + ACPI_DEBUG_PRINT((ACPI_DB_INTERRUPTS, + "Read GPE Register at GPE%X: Status=%02X, Enable=%02X\n", + gpe_register_info->base_gpe_number, + status_reg, enable_reg)); /* Check if there is anything active at all in this register */ @@ -459,14 +447,21 @@ acpi_ev_gpe_detect ( for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) { /* Examine one GPE bit */ - if (enabled_status_byte & acpi_gbl_decode_to8bit[j]) { + if (enabled_status_byte & + acpi_gbl_decode_to8bit[j]) { /* * Found an active GPE. Dispatch the event to a handler * or method. */ - int_status |= acpi_ev_gpe_dispatch ( - &gpe_block->event_info[(i * ACPI_GPE_REGISTER_WIDTH) + j], - (u32) j + gpe_register_info->base_gpe_number); + int_status |= + acpi_ev_gpe_dispatch(&gpe_block-> + event_info[(i * + ACPI_GPE_REGISTER_WIDTH) + + + j], + (u32) j + + gpe_register_info-> + base_gpe_number); } } } @@ -474,13 +469,12 @@ acpi_ev_gpe_detect ( gpe_block = gpe_block->next; } -unlock_and_exit: + unlock_and_exit: - acpi_os_release_lock (acpi_gbl_gpe_lock, ACPI_ISR); + acpi_os_release_lock(acpi_gbl_gpe_lock, flags); return (int_status); } - /******************************************************************************* * * FUNCTION: acpi_ev_asynch_execute_gpe_method @@ -497,45 +491,41 @@ unlock_and_exit: * ******************************************************************************/ -static void ACPI_SYSTEM_XFACE -acpi_ev_asynch_execute_gpe_method ( - void *context) +static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context) { - struct acpi_gpe_event_info *gpe_event_info = (void *) context; - u32 gpe_number = 0; - acpi_status status; - struct acpi_gpe_event_info local_gpe_event_info; - struct acpi_parameter_info info; - + struct acpi_gpe_event_info *gpe_event_info = (void *)context; + u32 gpe_number = 0; + acpi_status status; + struct acpi_gpe_event_info local_gpe_event_info; + struct acpi_parameter_info info; - ACPI_FUNCTION_TRACE ("ev_asynch_execute_gpe_method"); + ACPI_FUNCTION_TRACE("ev_asynch_execute_gpe_method"); - - status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS); - if (ACPI_FAILURE (status)) { + status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); + if (ACPI_FAILURE(status)) { return_VOID; } /* Must revalidate the gpe_number/gpe_block */ - if (!acpi_ev_valid_gpe_event (gpe_event_info)) { - status = acpi_ut_release_mutex (ACPI_MTX_EVENTS); + if (!acpi_ev_valid_gpe_event(gpe_event_info)) { + status = acpi_ut_release_mutex(ACPI_MTX_EVENTS); return_VOID; } /* Set the GPE flags for return to enabled state */ - (void) acpi_ev_enable_gpe (gpe_event_info, FALSE); + (void)acpi_ev_enable_gpe(gpe_event_info, FALSE); /* * Take a snapshot of the GPE info for this level - we copy the * info to prevent a race condition with remove_handler/remove_block. */ - ACPI_MEMCPY (&local_gpe_event_info, gpe_event_info, - sizeof (struct acpi_gpe_event_info)); + ACPI_MEMCPY(&local_gpe_event_info, gpe_event_info, + sizeof(struct acpi_gpe_event_info)); - status = acpi_ut_release_mutex (ACPI_MTX_EVENTS); - if (ACPI_FAILURE (status)) { + status = acpi_ut_release_mutex(ACPI_MTX_EVENTS); + if (ACPI_FAILURE(status)) { return_VOID; } @@ -544,44 +534,40 @@ acpi_ev_asynch_execute_gpe_method ( * time to avoid race with ev_gpe_install_handler */ if ((local_gpe_event_info.flags & ACPI_GPE_DISPATCH_MASK) == - ACPI_GPE_DISPATCH_METHOD) { + ACPI_GPE_DISPATCH_METHOD) { /* * Invoke the GPE Method (_Lxx, _Exx) i.e., evaluate the _Lxx/_Exx * control method that corresponds to this GPE */ info.node = local_gpe_event_info.dispatch.method_node; - info.parameters = ACPI_CAST_PTR (union acpi_operand_object *, gpe_event_info); + info.parameters = + ACPI_CAST_PTR(union acpi_operand_object *, gpe_event_info); info.parameter_type = ACPI_PARAM_GPE; - status = acpi_ns_evaluate_by_handle (&info); - if (ACPI_FAILURE (status)) { - ACPI_REPORT_ERROR (( - "%s while evaluating method [%4.4s] for GPE[%2X]\n", - acpi_format_exception (status), - acpi_ut_get_node_name (local_gpe_event_info.dispatch.method_node), - gpe_number)); + status = acpi_ns_evaluate_by_handle(&info); + if (ACPI_FAILURE(status)) { + ACPI_REPORT_ERROR(("%s while evaluating method [%4.4s] for GPE[%2X]\n", acpi_format_exception(status), acpi_ut_get_node_name(local_gpe_event_info.dispatch.method_node), gpe_number)); } } if ((local_gpe_event_info.flags & ACPI_GPE_XRUPT_TYPE_MASK) == - ACPI_GPE_LEVEL_TRIGGERED) { + ACPI_GPE_LEVEL_TRIGGERED) { /* * GPE is level-triggered, we clear the GPE status bit after * handling the event. */ - status = acpi_hw_clear_gpe (&local_gpe_event_info); - if (ACPI_FAILURE (status)) { + status = acpi_hw_clear_gpe(&local_gpe_event_info); + if (ACPI_FAILURE(status)) { return_VOID; } } /* Enable this GPE */ - (void) acpi_hw_write_gpe_enable_reg (&local_gpe_event_info); + (void)acpi_hw_write_gpe_enable_reg(&local_gpe_event_info); return_VOID; } - /******************************************************************************* * * FUNCTION: acpi_ev_gpe_dispatch @@ -599,38 +585,31 @@ acpi_ev_asynch_execute_gpe_method ( ******************************************************************************/ u32 -acpi_ev_gpe_dispatch ( - struct acpi_gpe_event_info *gpe_event_info, - u32 gpe_number) +acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number) { - acpi_status status; - - - ACPI_FUNCTION_TRACE ("ev_gpe_dispatch"); + acpi_status status; + ACPI_FUNCTION_TRACE("ev_gpe_dispatch"); /* * If edge-triggered, clear the GPE status bit now. Note that * level-triggered events are cleared after the GPE is serviced. */ if ((gpe_event_info->flags & ACPI_GPE_XRUPT_TYPE_MASK) == - ACPI_GPE_EDGE_TRIGGERED) { - status = acpi_hw_clear_gpe (gpe_event_info); - if (ACPI_FAILURE (status)) { - ACPI_REPORT_ERROR (( - "acpi_ev_gpe_dispatch: %s, Unable to clear GPE[%2X]\n", - acpi_format_exception (status), gpe_number)); - return_VALUE (ACPI_INTERRUPT_NOT_HANDLED); + ACPI_GPE_EDGE_TRIGGERED) { + status = acpi_hw_clear_gpe(gpe_event_info); + if (ACPI_FAILURE(status)) { + ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to clear GPE[%2X]\n", acpi_format_exception(status), gpe_number)); + return_VALUE(ACPI_INTERRUPT_NOT_HANDLED); } } /* Save current system state */ if (acpi_gbl_system_awake_and_running) { - ACPI_SET_BIT (gpe_event_info->flags, ACPI_GPE_SYSTEM_RUNNING); - } - else { - ACPI_CLEAR_BIT (gpe_event_info->flags, ACPI_GPE_SYSTEM_RUNNING); + ACPI_SET_BIT(gpe_event_info->flags, ACPI_GPE_SYSTEM_RUNNING); + } else { + ACPI_CLEAR_BIT(gpe_event_info->flags, ACPI_GPE_SYSTEM_RUNNING); } /* @@ -647,19 +626,19 @@ acpi_ev_gpe_dispatch ( * Invoke the installed handler (at interrupt level) * Ignore return status for now. TBD: leave GPE disabled on error? */ - (void) gpe_event_info->dispatch.handler->address ( - gpe_event_info->dispatch.handler->context); + (void)gpe_event_info->dispatch.handler->address(gpe_event_info-> + dispatch. + handler-> + context); /* It is now safe to clear level-triggered events. */ if ((gpe_event_info->flags & ACPI_GPE_XRUPT_TYPE_MASK) == - ACPI_GPE_LEVEL_TRIGGERED) { - status = acpi_hw_clear_gpe (gpe_event_info); - if (ACPI_FAILURE (status)) { - ACPI_REPORT_ERROR (( - "acpi_ev_gpe_dispatch: %s, Unable to clear GPE[%2X]\n", - acpi_format_exception (status), gpe_number)); - return_VALUE (ACPI_INTERRUPT_NOT_HANDLED); + ACPI_GPE_LEVEL_TRIGGERED) { + status = acpi_hw_clear_gpe(gpe_event_info); + if (ACPI_FAILURE(status)) { + ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to clear GPE[%2X]\n", acpi_format_exception(status), gpe_number)); + return_VALUE(ACPI_INTERRUPT_NOT_HANDLED); } } break; @@ -670,24 +649,21 @@ acpi_ev_gpe_dispatch ( * Disable GPE, so it doesn't keep firing before the method has a * chance to run. */ - status = acpi_ev_disable_gpe (gpe_event_info); - if (ACPI_FAILURE (status)) { - ACPI_REPORT_ERROR (( - "acpi_ev_gpe_dispatch: %s, Unable to disable GPE[%2X]\n", - acpi_format_exception (status), gpe_number)); - return_VALUE (ACPI_INTERRUPT_NOT_HANDLED); + status = acpi_ev_disable_gpe(gpe_event_info); + if (ACPI_FAILURE(status)) { + ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to disable GPE[%2X]\n", acpi_format_exception(status), gpe_number)); + return_VALUE(ACPI_INTERRUPT_NOT_HANDLED); } /* * Execute the method associated with the GPE * NOTE: Level-triggered GPEs are cleared after the method completes. */ - status = acpi_os_queue_for_execution (OSD_PRIORITY_GPE, - acpi_ev_asynch_execute_gpe_method, gpe_event_info); - if (ACPI_FAILURE (status)) { - ACPI_REPORT_ERROR (( - "acpi_ev_gpe_dispatch: %s, Unable to queue handler for GPE[%2X] - event disabled\n", - acpi_format_exception (status), gpe_number)); + status = acpi_os_queue_for_execution(OSD_PRIORITY_GPE, + acpi_ev_asynch_execute_gpe_method, + gpe_event_info); + if (ACPI_FAILURE(status)) { + ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to queue handler for GPE[%2X] - event disabled\n", acpi_format_exception(status), gpe_number)); } break; @@ -695,28 +671,23 @@ acpi_ev_gpe_dispatch ( /* No handler or method to run! */ - ACPI_REPORT_ERROR (( - "acpi_ev_gpe_dispatch: No handler or method for GPE[%2X], disabling event\n", - gpe_number)); + ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: No handler or method for GPE[%2X], disabling event\n", gpe_number)); /* * Disable the GPE. The GPE will remain disabled until the ACPI * Core Subsystem is restarted, or a handler is installed. */ - status = acpi_ev_disable_gpe (gpe_event_info); - if (ACPI_FAILURE (status)) { - ACPI_REPORT_ERROR (( - "acpi_ev_gpe_dispatch: %s, Unable to disable GPE[%2X]\n", - acpi_format_exception (status), gpe_number)); - return_VALUE (ACPI_INTERRUPT_NOT_HANDLED); + status = acpi_ev_disable_gpe(gpe_event_info); + if (ACPI_FAILURE(status)) { + ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to disable GPE[%2X]\n", acpi_format_exception(status), gpe_number)); + return_VALUE(ACPI_INTERRUPT_NOT_HANDLED); } break; } - return_VALUE (ACPI_INTERRUPT_HANDLED); + return_VALUE(ACPI_INTERRUPT_HANDLED); } - #ifdef ACPI_GPE_NOTIFY_CHECK /******************************************************************************* * TBD: NOT USED, PROTOTYPE ONLY AND WILL PROBABLY BE REMOVED @@ -735,35 +706,29 @@ acpi_ev_gpe_dispatch ( ******************************************************************************/ acpi_status -acpi_ev_check_for_wake_only_gpe ( - struct acpi_gpe_event_info *gpe_event_info) +acpi_ev_check_for_wake_only_gpe(struct acpi_gpe_event_info *gpe_event_info) { - acpi_status status; + acpi_status status; + ACPI_FUNCTION_TRACE("ev_check_for_wake_only_gpe"); - ACPI_FUNCTION_TRACE ("ev_check_for_wake_only_gpe"); - - - if ((gpe_event_info) && /* Only >0 for _Lxx/_Exx */ - ((gpe_event_info->flags & ACPI_GPE_SYSTEM_MASK) == ACPI_GPE_SYSTEM_RUNNING)) /* System state at GPE time */ { + if ((gpe_event_info) && /* Only >0 for _Lxx/_Exx */ + ((gpe_event_info->flags & ACPI_GPE_SYSTEM_MASK) == ACPI_GPE_SYSTEM_RUNNING)) { /* System state at GPE time */ /* This must be a wake-only GPE, disable it */ - status = acpi_ev_disable_gpe (gpe_event_info); + status = acpi_ev_disable_gpe(gpe_event_info); /* Set GPE to wake-only. Do not change wake disabled/enabled status */ - acpi_ev_set_gpe_type (gpe_event_info, ACPI_GPE_TYPE_WAKE); + acpi_ev_set_gpe_type(gpe_event_info, ACPI_GPE_TYPE_WAKE); - ACPI_REPORT_INFO (("GPE %p was updated from wake/run to wake-only\n", - gpe_event_info)); + ACPI_REPORT_INFO(("GPE %p was updated from wake/run to wake-only\n", gpe_event_info)); /* This was a wake-only GPE */ - return_ACPI_STATUS (AE_WAKE_ONLY_GPE); + return_ACPI_STATUS(AE_WAKE_ONLY_GPE); } - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS(AE_OK); } #endif - - |