Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 174330
b: refs/heads/master
c: 74d3ec7
h: refs/heads/master
v: v3
  • Loading branch information
Lin Ming authored and Len Brown committed Nov 25, 2009
1 parent 0f2394b commit 2392820
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0240d7b4f20f7d156a74dfdd0647a0231b7e8ef4
refs/heads/master: 74d3ec77a5e0633b0c7a8490941432c2e4789037
64 changes: 59 additions & 5 deletions trunk/drivers/acpi/acpica/evregion.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@
ACPI_MODULE_NAME("evregion")

/* Local prototypes */
static u8
acpi_ev_has_default_handler(struct acpi_namespace_node *node,
acpi_adr_space_type space_id);

static acpi_status
acpi_ev_reg_run(acpi_handle obj_handle,
u32 level, void *context, void **return_value);
Expand Down Expand Up @@ -140,6 +144,50 @@ acpi_status acpi_ev_install_region_handlers(void)
return_ACPI_STATUS(status);
}

/*******************************************************************************
*
* FUNCTION: acpi_ev_has_default_handler
*
* PARAMETERS: Node - Namespace node for the device
* space_id - The address space ID
*
* RETURN: TRUE if default handler is installed, FALSE otherwise
*
* DESCRIPTION: Check if the default handler is installed for the requested
* space ID.
*
******************************************************************************/

static u8
acpi_ev_has_default_handler(struct acpi_namespace_node *node,
acpi_adr_space_type space_id)
{
union acpi_operand_object *obj_desc;
union acpi_operand_object *handler_obj;

/* Must have an existing internal object */

obj_desc = acpi_ns_get_attached_object(node);
if (obj_desc) {
handler_obj = obj_desc->device.handler;

/* Walk the linked list of handlers for this object */

while (handler_obj) {
if (handler_obj->address_space.space_id == space_id) {
if (handler_obj->address_space.handler_flags &
ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) {
return (TRUE);
}
}

handler_obj = handler_obj->address_space.next;
}
}

return (FALSE);
}

/*******************************************************************************
*
* FUNCTION: acpi_ev_initialize_op_regions
Expand Down Expand Up @@ -169,12 +217,18 @@ acpi_status acpi_ev_initialize_op_regions(void)

for (i = 0; i < ACPI_NUM_DEFAULT_SPACES; i++) {
/*
* TBD: Make sure handler is the DEFAULT handler, otherwise
* _REG will have already been run.
* Make sure the installed handler is the DEFAULT handler. If not the
* default, the _REG methods will have already been run (when the
* handler was installed)
*/
status = acpi_ev_execute_reg_methods(acpi_gbl_root_node,
acpi_gbl_default_address_spaces
[i]);
if (acpi_ev_has_default_handler(acpi_gbl_root_node,
acpi_gbl_default_address_spaces
[i])) {
status =
acpi_ev_execute_reg_methods(acpi_gbl_root_node,
acpi_gbl_default_address_spaces
[i]);
}
}

(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
Expand Down

0 comments on commit 2392820

Please sign in to comment.