aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLv Zheng <lv.zheng@intel.com>2016-11-30 02:21:12 -0500
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2016-12-01 08:28:22 -0500
commit760235cd6ca8ae0d7509055d75a0f1d8b3c60668 (patch)
treeaa8e4b03a54779837394c303b22077e538e8d9a0
parentf7cc87413b389c49e5bbc93aa65e6e67f475fb78 (diff)
ACPICA: Events: Fix acpi_ev_initialize_region() return value
ACPICA commit 543342ab7a676f4eb0c9f100d349388a84dff0e8 This patch changes acpi_ev_initialize_region(), stop returning AE_NOT_EXIST from it so that, not only in acpi_ds_load2_end_op(), but all places invoking this function won't emit exceptions. The exception can be seen in acpi_ds_initialize_objects() when certain table loading mode is chosen. This patch also removes useless acpi_ns_locked from acpi_ev_initialize_region() as this function will always be invoked with interpreter lock held now, and the lock granularity has been tuned to lock around _REG execution, thus it is now handled by acpi_ex_exit_interpreter(). Lv Zheng. Link: https://github.com/acpica/acpica/commit/543342ab 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.h4
-rw-r--r--drivers/acpi/acpica/dsopcode.c2
-rw-r--r--drivers/acpi/acpica/dswload2.c13
-rw-r--r--drivers/acpi/acpica/evrgnini.c59
4 files changed, 27 insertions, 51 deletions
diff --git a/drivers/acpi/acpica/acevents.h b/drivers/acpi/acpica/acevents.h
index 92fa47c6498c..8a0049d5cdf3 100644
--- a/drivers/acpi/acpica/acevents.h
+++ b/drivers/acpi/acpica/acevents.h
@@ -243,9 +243,7 @@ acpi_ev_default_region_setup(acpi_handle handle,
243 u32 function, 243 u32 function,
244 void *handler_context, void **region_context); 244 void *handler_context, void **region_context);
245 245
246acpi_status 246acpi_status acpi_ev_initialize_region(union acpi_operand_object *region_obj);
247acpi_ev_initialize_region(union acpi_operand_object *region_obj,
248 u8 acpi_ns_locked);
249 247
250/* 248/*
251 * evsci - SCI (System Control Interrupt) handling/dispatch 249 * evsci - SCI (System Control Interrupt) handling/dispatch
diff --git a/drivers/acpi/acpica/dsopcode.c b/drivers/acpi/acpica/dsopcode.c
index 4cc9d989a114..77fd7c84ec39 100644
--- a/drivers/acpi/acpica/dsopcode.c
+++ b/drivers/acpi/acpica/dsopcode.c
@@ -84,7 +84,7 @@ acpi_status acpi_ds_initialize_region(acpi_handle obj_handle)
84 84
85 /* Namespace is NOT locked */ 85 /* Namespace is NOT locked */
86 86
87 status = acpi_ev_initialize_region(obj_desc, FALSE); 87 status = acpi_ev_initialize_region(obj_desc);
88 return (status); 88 return (status);
89} 89}
90 90
diff --git a/drivers/acpi/acpica/dswload2.c b/drivers/acpi/acpica/dswload2.c
index e36218206bb0..651f35a66cc2 100644
--- a/drivers/acpi/acpica/dswload2.c
+++ b/drivers/acpi/acpica/dswload2.c
@@ -609,18 +609,7 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state)
609 609
610 status = 610 status =
611 acpi_ev_initialize_region 611 acpi_ev_initialize_region
612 (acpi_ns_get_attached_object(node), FALSE); 612 (acpi_ns_get_attached_object(node));
613
614 if (ACPI_FAILURE(status)) {
615 /*
616 * If AE_NOT_EXIST is returned, it is not fatal
617 * because many regions get created before a handler
618 * is installed for said region.
619 */
620 if (AE_NOT_EXIST == status) {
621 status = AE_OK;
622 }
623 }
624 break; 613 break;
625 614
626 case AML_NAME_OP: 615 case AML_NAME_OP:
diff --git a/drivers/acpi/acpica/evrgnini.c b/drivers/acpi/acpica/evrgnini.c
index 75ddd160a716..a9092251ce80 100644
--- a/drivers/acpi/acpica/evrgnini.c
+++ b/drivers/acpi/acpica/evrgnini.c
@@ -479,7 +479,6 @@ acpi_ev_default_region_setup(acpi_handle handle,
479 * FUNCTION: acpi_ev_initialize_region 479 * FUNCTION: acpi_ev_initialize_region
480 * 480 *
481 * PARAMETERS: region_obj - Region we are initializing 481 * PARAMETERS: region_obj - Region we are initializing
482 * acpi_ns_locked - Is namespace locked?
483 * 482 *
484 * RETURN: Status 483 * RETURN: Status
485 * 484 *
@@ -497,19 +496,28 @@ acpi_ev_default_region_setup(acpi_handle handle,
497 * MUTEX: Interpreter should be unlocked, because we may run the _REG 496 * MUTEX: Interpreter should be unlocked, because we may run the _REG
498 * method for this region. 497 * method for this region.
499 * 498 *
499 * NOTE: Possible incompliance:
500 * There is a behavior conflict in automatic _REG execution:
501 * 1. When the interpreter is evaluating a method, we can only
502 * automatically run _REG for the following case:
503 * operation_region (OPR1, 0x80, 0x1000010, 0x4)
504 * 2. When the interpreter is loading a table, we can also
505 * automatically run _REG for the following case:
506 * operation_region (OPR1, 0x80, 0x1000010, 0x4)
507 * Though this may not be compliant to the de-facto standard, the
508 * logic is kept in order not to trigger regressions. And keeping
509 * this logic should be taken care by the caller of this function.
510 *
500 ******************************************************************************/ 511 ******************************************************************************/
501 512
502acpi_status 513acpi_status acpi_ev_initialize_region(union acpi_operand_object *region_obj)
503acpi_ev_initialize_region(union acpi_operand_object *region_obj,
504 u8 acpi_ns_locked)
505{ 514{
506 union acpi_operand_object *handler_obj; 515 union acpi_operand_object *handler_obj;
507 union acpi_operand_object *obj_desc; 516 union acpi_operand_object *obj_desc;
508 acpi_adr_space_type space_id; 517 acpi_adr_space_type space_id;
509 struct acpi_namespace_node *node; 518 struct acpi_namespace_node *node;
510 acpi_status status;
511 519
512 ACPI_FUNCTION_TRACE_U32(ev_initialize_region, acpi_ns_locked); 520 ACPI_FUNCTION_TRACE(ev_initialize_region);
513 521
514 if (!region_obj) { 522 if (!region_obj) {
515 return_ACPI_STATUS(AE_BAD_PARAMETER); 523 return_ACPI_STATUS(AE_BAD_PARAMETER);
@@ -580,39 +588,17 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj,
580 handler_obj, region_obj, 588 handler_obj, region_obj,
581 obj_desc)); 589 obj_desc));
582 590
583 status = 591 (void)acpi_ev_attach_region(handler_obj,
584 acpi_ev_attach_region(handler_obj, 592 region_obj, FALSE);
585 region_obj,
586 acpi_ns_locked);
587 593
588 /* 594 /*
589 * Tell all users that this region is usable by 595 * Tell all users that this region is usable by
590 * running the _REG method 596 * running the _REG method
591 */ 597 */
592 if (acpi_ns_locked) {
593 status =
594 acpi_ut_release_mutex
595 (ACPI_MTX_NAMESPACE);
596 if (ACPI_FAILURE(status)) {
597 return_ACPI_STATUS(status);
598 }
599 }
600
601 acpi_ex_exit_interpreter(); 598 acpi_ex_exit_interpreter();
602 status = 599 (void)acpi_ev_execute_reg_method(region_obj,
603 acpi_ev_execute_reg_method(region_obj, 600 ACPI_REG_CONNECT);
604 ACPI_REG_CONNECT);
605 acpi_ex_enter_interpreter(); 601 acpi_ex_enter_interpreter();
606
607 if (acpi_ns_locked) {
608 status =
609 acpi_ut_acquire_mutex
610 (ACPI_MTX_NAMESPACE);
611 if (ACPI_FAILURE(status)) {
612 return_ACPI_STATUS(status);
613 }
614 }
615
616 return_ACPI_STATUS(AE_OK); 602 return_ACPI_STATUS(AE_OK);
617 } 603 }
618 } 604 }
@@ -622,12 +608,15 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj,
622 node = node->parent; 608 node = node->parent;
623 } 609 }
624 610
625 /* If we get here, there is no handler for this region */ 611 /*
626 612 * If we get here, there is no handler for this region. This is not
613 * fatal because many regions get created before a handler is installed
614 * for said region.
615 */
627 ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, 616 ACPI_DEBUG_PRINT((ACPI_DB_OPREGION,
628 "No handler for RegionType %s(%X) (RegionObj %p)\n", 617 "No handler for RegionType %s(%X) (RegionObj %p)\n",
629 acpi_ut_get_region_name(space_id), space_id, 618 acpi_ut_get_region_name(space_id), space_id,
630 region_obj)); 619 region_obj));
631 620
632 return_ACPI_STATUS(AE_NOT_EXIST); 621 return_ACPI_STATUS(AE_OK);
633} 622}