diff options
author | Lv Zheng <lv.zheng@intel.com> | 2015-12-29 01:02:58 -0500 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2015-12-31 21:47:38 -0500 |
commit | 849c25719ac6acc7420515c7b6324f4248a13790 (patch) | |
tree | 163574cc06a6fa6ebdf5b6389162d56071bf0979 | |
parent | 1d65d9a7b642b8d1eb201830e0c1cae6231b5c51 (diff) |
ACPICA: Events: Split acpi_ev_associate_reg_method() from region initialization code
ACPICA commit 87c85610250ff7141a84507f68dbc1e00f2936db
This patch introduces a new region initialization function
acpi_ev_associate_reg_method(), which is invoked to associate the _REG method
to its related region object.
Region object's default value assignments are also sorted by cleaning up
the code using this new function. Lv Zheng.
Link: https://github.com/acpica/acpica/commit/87c85610
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r-- | drivers/acpi/acpica/acevents.h | 2 | ||||
-rw-r--r-- | drivers/acpi/acpica/evregion.c | 46 | ||||
-rw-r--r-- | drivers/acpi/acpica/evrgnini.c | 30 | ||||
-rw-r--r-- | drivers/acpi/acpica/excreate.c | 6 |
4 files changed, 55 insertions, 29 deletions
diff --git a/drivers/acpi/acpica/acevents.h b/drivers/acpi/acpica/acevents.h index 42975abf1e03..772ee3c1bdc3 100644 --- a/drivers/acpi/acpica/acevents.h +++ b/drivers/acpi/acpica/acevents.h | |||
@@ -198,6 +198,8 @@ void | |||
198 | acpi_ev_detach_region(union acpi_operand_object *region_obj, | 198 | acpi_ev_detach_region(union acpi_operand_object *region_obj, |
199 | u8 acpi_ns_is_locked); | 199 | u8 acpi_ns_is_locked); |
200 | 200 | ||
201 | void acpi_ev_associate_reg_method(union acpi_operand_object *region_obj); | ||
202 | |||
201 | acpi_status | 203 | acpi_status |
202 | acpi_ev_execute_reg_methods(struct acpi_namespace_node *node, | 204 | acpi_ev_execute_reg_methods(struct acpi_namespace_node *node, |
203 | acpi_adr_space_type space_id); | 205 | acpi_adr_space_type space_id); |
diff --git a/drivers/acpi/acpica/evregion.c b/drivers/acpi/acpica/evregion.c index 19a4e695555f..432b81080369 100644 --- a/drivers/acpi/acpica/evregion.c +++ b/drivers/acpi/acpica/evregion.c | |||
@@ -529,6 +529,52 @@ acpi_ev_attach_region(union acpi_operand_object *handler_obj, | |||
529 | 529 | ||
530 | /******************************************************************************* | 530 | /******************************************************************************* |
531 | * | 531 | * |
532 | * FUNCTION: acpi_ev_associate_reg_method | ||
533 | * | ||
534 | * PARAMETERS: region_obj - Region object | ||
535 | * | ||
536 | * RETURN: Status | ||
537 | * | ||
538 | * DESCRIPTION: Find and associate _REG method to a region | ||
539 | * | ||
540 | ******************************************************************************/ | ||
541 | |||
542 | void acpi_ev_associate_reg_method(union acpi_operand_object *region_obj) | ||
543 | { | ||
544 | acpi_name *reg_name_ptr = (acpi_name *) METHOD_NAME__REG; | ||
545 | struct acpi_namespace_node *method_node; | ||
546 | struct acpi_namespace_node *node; | ||
547 | union acpi_operand_object *region_obj2; | ||
548 | acpi_status status; | ||
549 | |||
550 | ACPI_FUNCTION_TRACE(ev_associate_reg_method); | ||
551 | |||
552 | region_obj2 = acpi_ns_get_secondary_object(region_obj); | ||
553 | if (!region_obj2) { | ||
554 | return_VOID; | ||
555 | } | ||
556 | |||
557 | node = region_obj->region.node->parent; | ||
558 | |||
559 | /* Find any "_REG" method associated with this region definition */ | ||
560 | |||
561 | status = | ||
562 | acpi_ns_search_one_scope(*reg_name_ptr, node, ACPI_TYPE_METHOD, | ||
563 | &method_node); | ||
564 | if (ACPI_SUCCESS(status)) { | ||
565 | /* | ||
566 | * The _REG method is optional and there can be only one per region | ||
567 | * definition. This will be executed when the handler is attached | ||
568 | * or removed | ||
569 | */ | ||
570 | region_obj2->extra.method_REG = method_node; | ||
571 | } | ||
572 | |||
573 | return_VOID; | ||
574 | } | ||
575 | |||
576 | /******************************************************************************* | ||
577 | * | ||
532 | * FUNCTION: acpi_ev_execute_reg_method | 578 | * FUNCTION: acpi_ev_execute_reg_method |
533 | * | 579 | * |
534 | * PARAMETERS: region_obj - Region object | 580 | * PARAMETERS: region_obj - Region object |
diff --git a/drivers/acpi/acpica/evrgnini.c b/drivers/acpi/acpica/evrgnini.c index 024689dadcd2..bb2e529249c7 100644 --- a/drivers/acpi/acpica/evrgnini.c +++ b/drivers/acpi/acpica/evrgnini.c | |||
@@ -507,9 +507,6 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj, | |||
507 | acpi_adr_space_type space_id; | 507 | acpi_adr_space_type space_id; |
508 | struct acpi_namespace_node *node; | 508 | struct acpi_namespace_node *node; |
509 | acpi_status status; | 509 | acpi_status status; |
510 | struct acpi_namespace_node *method_node; | ||
511 | acpi_name *reg_name_ptr = (acpi_name *) METHOD_NAME__REG; | ||
512 | union acpi_operand_object *region_obj2; | ||
513 | 510 | ||
514 | ACPI_FUNCTION_TRACE_U32(ev_initialize_region, acpi_ns_locked); | 511 | ACPI_FUNCTION_TRACE_U32(ev_initialize_region, acpi_ns_locked); |
515 | 512 | ||
@@ -521,35 +518,12 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj, | |||
521 | return_ACPI_STATUS(AE_OK); | 518 | return_ACPI_STATUS(AE_OK); |
522 | } | 519 | } |
523 | 520 | ||
524 | region_obj2 = acpi_ns_get_secondary_object(region_obj); | 521 | acpi_ev_associate_reg_method(region_obj); |
525 | if (!region_obj2) { | 522 | region_obj->common.flags |= AOPOBJ_OBJECT_INITIALIZED; |
526 | return_ACPI_STATUS(AE_NOT_EXIST); | ||
527 | } | ||
528 | 523 | ||
529 | node = region_obj->region.node->parent; | 524 | node = region_obj->region.node->parent; |
530 | space_id = region_obj->region.space_id; | 525 | space_id = region_obj->region.space_id; |
531 | 526 | ||
532 | /* Setup defaults */ | ||
533 | |||
534 | region_obj->region.handler = NULL; | ||
535 | region_obj2->extra.method_REG = NULL; | ||
536 | region_obj->common.flags &= ~(AOPOBJ_SETUP_COMPLETE); | ||
537 | region_obj->common.flags |= AOPOBJ_OBJECT_INITIALIZED; | ||
538 | |||
539 | /* Find any "_REG" method associated with this region definition */ | ||
540 | |||
541 | status = | ||
542 | acpi_ns_search_one_scope(*reg_name_ptr, node, ACPI_TYPE_METHOD, | ||
543 | &method_node); | ||
544 | if (ACPI_SUCCESS(status)) { | ||
545 | /* | ||
546 | * The _REG method is optional and there can be only one per region | ||
547 | * definition. This will be executed when the handler is attached | ||
548 | * or removed | ||
549 | */ | ||
550 | region_obj2->extra.method_REG = method_node; | ||
551 | } | ||
552 | |||
553 | /* | 527 | /* |
554 | * The following loop depends upon the root Node having no parent | 528 | * The following loop depends upon the root Node having no parent |
555 | * ie: acpi_gbl_root_node->Parent being set to NULL | 529 | * ie: acpi_gbl_root_node->Parent being set to NULL |
diff --git a/drivers/acpi/acpica/excreate.c b/drivers/acpi/acpica/excreate.c index 0f3444647f52..6a1396e313b1 100644 --- a/drivers/acpi/acpica/excreate.c +++ b/drivers/acpi/acpica/excreate.c | |||
@@ -326,9 +326,10 @@ acpi_ex_create_region(u8 * aml_start, | |||
326 | * Remember location in AML stream of address & length | 326 | * Remember location in AML stream of address & length |
327 | * operands since they need to be evaluated at run time. | 327 | * operands since they need to be evaluated at run time. |
328 | */ | 328 | */ |
329 | region_obj2 = obj_desc->common.next_object; | 329 | region_obj2 = acpi_ns_get_secondary_object(obj_desc); |
330 | region_obj2->extra.aml_start = aml_start; | 330 | region_obj2->extra.aml_start = aml_start; |
331 | region_obj2->extra.aml_length = aml_length; | 331 | region_obj2->extra.aml_length = aml_length; |
332 | region_obj2->extra.method_REG = NULL; | ||
332 | if (walk_state->scope_info) { | 333 | if (walk_state->scope_info) { |
333 | region_obj2->extra.scope_node = | 334 | region_obj2->extra.scope_node = |
334 | walk_state->scope_info->scope.node; | 335 | walk_state->scope_info->scope.node; |
@@ -342,6 +343,9 @@ acpi_ex_create_region(u8 * aml_start, | |||
342 | obj_desc->region.address = 0; | 343 | obj_desc->region.address = 0; |
343 | obj_desc->region.length = 0; | 344 | obj_desc->region.length = 0; |
344 | obj_desc->region.node = node; | 345 | obj_desc->region.node = node; |
346 | obj_desc->region.handler = NULL; | ||
347 | obj_desc->common.flags &= | ||
348 | ~(AOPOBJ_SETUP_COMPLETE | AOPOBJ_OBJECT_INITIALIZED); | ||
345 | 349 | ||
346 | /* Install the new region object in the parent Node */ | 350 | /* Install the new region object in the parent Node */ |
347 | 351 | ||