/******************************************************************************* * * FUNCTION: acpi_ev_update_gpe_enable_mask * * PARAMETERS: gpe_event_info - GPE to update * * RETURN: Status * * DESCRIPTION: Updates GPE register enable mask based upon whether there are * runtime references to this GPE *
******************************************************************************/
status = acpi_hw_low_set_gpe(gpe_event_info, ACPI_GPE_ENABLE);
return_ACPI_STATUS(status);
}
/******************************************************************************* * * FUNCTION: acpi_ev_mask_gpe * * PARAMETERS: gpe_event_info - GPE to be blocked/unblocked * is_masked - Whether the GPE is masked or not * * RETURN: Status * * DESCRIPTION: Unconditionally mask/unmask a GPE during runtime. *
******************************************************************************/
/******************************************************************************* * * FUNCTION: acpi_ev_add_gpe_reference * * PARAMETERS: gpe_event_info - Add a reference to this GPE * clear_on_enable - Clear GPE status before enabling it * * RETURN: Status * * DESCRIPTION: Add a reference to a GPE. On the first reference, the GPE is * hardware-enabled. *
******************************************************************************/
if (gpe_event_info->runtime_count == ACPI_UINT8_MAX) {
return_ACPI_STATUS(AE_LIMIT);
}
gpe_event_info->runtime_count++; if (gpe_event_info->runtime_count == 1) {
/* Enable on first reference */
if (clear_on_enable) {
(void)acpi_hw_clear_gpe(gpe_event_info);
}
status = acpi_ev_update_gpe_enable_mask(gpe_event_info); if (ACPI_SUCCESS(status)) {
status = acpi_ev_enable_gpe(gpe_event_info);
}
if (ACPI_FAILURE(status)) {
gpe_event_info->runtime_count--;
}
}
return_ACPI_STATUS(status);
}
/******************************************************************************* * * FUNCTION: acpi_ev_remove_gpe_reference * * PARAMETERS: gpe_event_info - Remove a reference to this GPE * * RETURN: Status * * DESCRIPTION: Remove a reference to a GPE. When the last reference is * removed, the GPE is hardware-disabled. *
******************************************************************************/
acpi_status
acpi_ev_remove_gpe_reference(struct acpi_gpe_event_info *gpe_event_info)
{
acpi_status status = AE_OK;
ACPI_FUNCTION_TRACE(ev_remove_gpe_reference);
if (!gpe_event_info->runtime_count) {
return_ACPI_STATUS(AE_LIMIT);
}
gpe_event_info->runtime_count--; if (!gpe_event_info->runtime_count) {
/* Disable on last reference */
status = acpi_ev_update_gpe_enable_mask(gpe_event_info); if (ACPI_SUCCESS(status)) {
status =
acpi_hw_low_set_gpe(gpe_event_info,
ACPI_GPE_DISABLE);
}
if (ACPI_FAILURE(status)) {
gpe_event_info->runtime_count++;
}
}
return_ACPI_STATUS(status);
}
/******************************************************************************* * * FUNCTION: acpi_ev_low_get_gpe_info * * PARAMETERS: gpe_number - Raw GPE number * gpe_block - A GPE info block * * RETURN: A GPE event_info struct. NULL if not a valid GPE (The gpe_number * is not within the specified GPE block) * * DESCRIPTION: Returns the event_info struct associated with this GPE. This is * the low-level implementation of ev_get_gpe_event_info. *
******************************************************************************/
/* * Validate that the gpe_number is within the specified gpe_block. * (Two steps)
*/ if (!gpe_block || (gpe_number < gpe_block->block_base_number)) { return (NULL);
}
/******************************************************************************* * * FUNCTION: acpi_ev_get_gpe_event_info * * PARAMETERS: gpe_device - Device node. NULL for GPE0/GPE1 * gpe_number - Raw GPE number * * RETURN: A GPE event_info struct. NULL if not a valid GPE * * DESCRIPTION: Returns the event_info struct associated with this GPE. * Validates the gpe_block and the gpe_number * * Should be called only when the GPE lists are semaphore locked * and not subject to change. *
******************************************************************************/
/******************************************************************************* * * FUNCTION: acpi_ev_gpe_detect * * PARAMETERS: gpe_xrupt_list - Interrupt block for this interrupt. * Can have multiple GPE blocks attached. * * RETURN: INTERRUPT_HANDLED or INTERRUPT_NOT_HANDLED * * DESCRIPTION: Detect if any GP events have occurred. This function is * executed at interrupt level. *
******************************************************************************/
/* * We need to obtain the GPE lock for both the data structs and registers * Note: Not necessary to obtain the hardware lock, since the GPE * registers are owned by the gpe_lock.
*/
flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
/* Examine all GPE blocks attached to this interrupt level */
gpe_block = gpe_xrupt_list->gpe_block_list_head; while (gpe_block) {
gpe_device = gpe_block->node;
/* * Read all of the 8-bit GPE status and enable registers in this GPE * block, saving all of them. Find all currently active GP events.
*/ for (i = 0; i < gpe_block->register_count; i++) {
/* Get the next status/enable pair */
gpe_register_info = &gpe_block->register_info[i];
/* * Optimization: If there are no GPEs enabled within this * register, we can safely ignore the entire register.
*/ if (!(gpe_register_info->enable_for_run |
gpe_register_info->enable_for_wake)) {
ACPI_DEBUG_PRINT((ACPI_DB_INTERRUPTS, "Ignore disabled registers for GPE %02X-%02X: " "RunEnable=%02X, WakeEnable=%02X\n",
gpe_register_info->
base_gpe_number,
gpe_register_info->
base_gpe_number +
(ACPI_GPE_REGISTER_WIDTH - 1),
gpe_register_info->
enable_for_run,
gpe_register_info->
enable_for_wake)); continue;
}
/* Now look at the individual GPEs in this byte register */
/******************************************************************************* * * FUNCTION: acpi_ev_asynch_execute_gpe_method * * PARAMETERS: Context (gpe_event_info) - Info for this GPE * * RETURN: None * * DESCRIPTION: Perform the actual execution of a GPE control method. This * function is called from an invocation of acpi_os_execute and * therefore does NOT execute at interrupt level - so that * the control method itself is not executed in the context of * an interrupt handler. *
******************************************************************************/
/* Do the correct dispatch - normal method or implicit notify */
switch (ACPI_GPE_DISPATCH_TYPE(gpe_event_info->flags)) { case ACPI_GPE_DISPATCH_NOTIFY: /* * Implicit notify. * Dispatch a DEVICE_WAKE notify to the appropriate handler. * NOTE: the request is queued for execution after this method * completes. The notify handlers are NOT invoked synchronously * from this thread -- because handlers may in turn run other * control methods. * * June 2012: Expand implicit notify mechanism to support * notifies on multiple device objects.
*/
notify = gpe_event_info->dispatch.notify_list; while (ACPI_SUCCESS(status) && notify) {
status =
acpi_ev_queue_notify_request(notify->device_node,
ACPI_NOTIFY_DEVICE_WAKE);
notify = notify->next;
}
break;
case ACPI_GPE_DISPATCH_METHOD:
/* Allocate the evaluation information block */
info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info)); if (!info) {
status = AE_NO_MEMORY;
} else { /* * Invoke the GPE Method (_Lxx, _Exx) i.e., evaluate the * _Lxx/_Exx control method that corresponds to this GPE
*/
info->prefix_node =
gpe_event_info->dispatch.method_node;
info->flags = ACPI_IGNORE_RETURN_VALUE;
status = acpi_ns_evaluate(info);
ACPI_FREE(info);
}
/******************************************************************************* * * FUNCTION: acpi_ev_asynch_enable_gpe * * PARAMETERS: Context (gpe_event_info) - Info for this GPE * Callback from acpi_os_execute * * RETURN: None * * DESCRIPTION: Asynchronous clear/enable for GPE. This allows the GPE to * complete (i.e., finish execution of Notify) *
******************************************************************************/
/******************************************************************************* * * FUNCTION: acpi_ev_finish_gpe * * PARAMETERS: gpe_event_info - Info for this GPE * * RETURN: Status * * DESCRIPTION: Clear/Enable a GPE. Common code that is used after execution * of a GPE method or a synchronous or asynchronous GPE handler. *
******************************************************************************/
if ((gpe_event_info->flags & ACPI_GPE_XRUPT_TYPE_MASK) ==
ACPI_GPE_LEVEL_TRIGGERED) { /* * GPE is level-triggered, we clear the GPE status bit after * handling the event.
*/
status = acpi_hw_clear_gpe(gpe_event_info); if (ACPI_FAILURE(status)) { return (status);
}
}
/* * Enable this GPE, conditionally. This means that the GPE will * only be physically enabled if the enable_mask bit is set * in the event_info.
*/
(void)acpi_hw_low_set_gpe(gpe_event_info, ACPI_GPE_CONDITIONAL_ENABLE);
gpe_event_info->disable_for_dispatch = FALSE; return (AE_OK);
}
/******************************************************************************* * * FUNCTION: acpi_ev_detect_gpe * * PARAMETERS: gpe_device - Device node. NULL for GPE0/GPE1 * gpe_event_info - Info for this GPE * gpe_number - Number relative to the parent GPE block * * RETURN: INTERRUPT_HANDLED or INTERRUPT_NOT_HANDLED * * DESCRIPTION: Detect and dispatch a General Purpose Event to either a function * (e.g. EC) or method (e.g. _Lxx/_Exx) handler. * NOTE: GPE is W1C, so it is possible to handle a single GPE from both * task and irq context in parallel as long as the process to * detect and mask the GPE is atomic. * However the atomicity of ACPI_GPE_DISPATCH_RAW_HANDLER is * dependent on the raw handler itself. *
******************************************************************************/
/* * There is no protection around the namespace node * and the GPE handler to ensure a safe destruction * because: * 1. The namespace node is expected to always * exist after loading a table. * 2. The GPE handler is expected to be flushed by * acpi_os_wait_events_complete() before the * destruction.
*/
acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
int_status |=
gpe_handler_info->address(gpe_device, gpe_number,
gpe_handler_info->context);
flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
} else { /* Dispatch the event to a standard handler or method. */
/******************************************************************************* * * FUNCTION: acpi_ev_gpe_dispatch * * PARAMETERS: gpe_device - Device node. NULL for GPE0/GPE1 * gpe_event_info - Info for this GPE * gpe_number - Number relative to the parent GPE block * * RETURN: INTERRUPT_HANDLED or INTERRUPT_NOT_HANDLED * * DESCRIPTION: Dispatch a General Purpose Event to either a function (e.g. EC) * or method (e.g. _Lxx/_Exx) handler. *
******************************************************************************/
/* * Always disable the GPE so that it does not keep firing before * any asynchronous activity completes (either from the execution * of a GPE method or an asynchronous GPE handler.) * * If there is no handler or method to run, just disable the * GPE and leave it disabled permanently to prevent further such * pointless events from firing.
*/
status = acpi_hw_low_set_gpe(gpe_event_info, ACPI_GPE_DISABLE); if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status, "Unable to disable GPE %02X", gpe_number));
return_UINT32(ACPI_INTERRUPT_NOT_HANDLED);
}
/* * 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_EXCEPTION((AE_INFO, status, "Unable to clear GPE %02X",
gpe_number));
(void)acpi_hw_low_set_gpe(gpe_event_info,
ACPI_GPE_CONDITIONAL_ENABLE);
return_UINT32(ACPI_INTERRUPT_NOT_HANDLED);
}
}
gpe_event_info->disable_for_dispatch = TRUE;
/* * Dispatch the GPE to either an installed handler or the control * method associated with this GPE (_Lxx or _Exx). If a handler * exists, we invoke it and do not attempt to run the method. * If there is neither a handler nor a method, leave the GPE * disabled.
*/ switch (ACPI_GPE_DISPATCH_TYPE(gpe_event_info->flags)) { case ACPI_GPE_DISPATCH_HANDLER:
/* Invoke the installed handler (at interrupt level) */
/* If requested, clear (if level-triggered) and re-enable the GPE */
if (return_value & ACPI_REENABLE_GPE) {
(void)acpi_ev_finish_gpe(gpe_event_info);
} break;
case ACPI_GPE_DISPATCH_METHOD: case ACPI_GPE_DISPATCH_NOTIFY: /* * Execute the method associated with the GPE * NOTE: Level-triggered GPEs are cleared after the method completes.
*/
status = acpi_os_execute(OSL_GPE_HANDLER,
acpi_ev_asynch_execute_gpe_method,
gpe_event_info); if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status, "Unable to queue handler for GPE %02X - event disabled",
gpe_number));
} break;
default: /* * No handler or method to run! * 03/2010: This case should no longer be possible. We will not allow * a GPE to be enabled if it has no handler or method.
*/
ACPI_ERROR((AE_INFO, "No handler or method for GPE %02X, disabling event",
gpe_number));
break;
}
return_UINT32(ACPI_INTERRUPT_HANDLED);
}
#endif/* !ACPI_REDUCED_HARDWARE */
Messung V0.5
¤ Diese beiden folgenden Angebotsgruppen bietet das Unternehmen0.8Angebot
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.