Commit d815346f authored by Lv Zheng's avatar Lv Zheng Committed by Rafael J. Wysocki

ACPICA: Events: Introduce ACPI_REG_DISCONNECT invocation to acpi_ev_execute_reg_methods()

ACPICA commit 1cf1a1e090f61f0c27f1dcf1905c7cc79a9c51c8

It is likely that we should synchronously invoke _REG(DISCONNECT) only when
the acpi_remove_address_space_handler() is invoked because of dependencies.
If it is invoked when the object is not referenced, problem may occur
if the operation region fields accessed in _REG are no longer driven by any
device driver.

Noticed that _REG(CONNECT)/_REG(DISCONNECT) only mean to inform the AML of
the handler availability, no return value is required for the caller.

This patch only introduces ACPI_REG_DISCONNECT invaocation, but doesn't
introduce a real change. Lv Zheng.

Link: https://github.com/acpica/acpica/commit/1cf1a1e0Signed-off-by: default avatarLv Zheng <lv.zheng@intel.com>
Signed-off-by: default avatarBob Moore <robert.moore@intel.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent efaed9be
...@@ -200,9 +200,9 @@ acpi_ev_detach_region(union acpi_operand_object *region_obj, ...@@ -200,9 +200,9 @@ acpi_ev_detach_region(union acpi_operand_object *region_obj,
void acpi_ev_associate_reg_method(union acpi_operand_object *region_obj); void acpi_ev_associate_reg_method(union acpi_operand_object *region_obj);
acpi_status void
acpi_ev_execute_reg_methods(struct acpi_namespace_node *node, acpi_ev_execute_reg_methods(struct acpi_namespace_node *node,
acpi_adr_space_type space_id); acpi_adr_space_type space_id, u32 function);
acpi_status acpi_status
acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function); acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function);
......
...@@ -428,6 +428,7 @@ struct acpi_simple_repair_info { ...@@ -428,6 +428,7 @@ struct acpi_simple_repair_info {
struct acpi_reg_walk_info { struct acpi_reg_walk_info {
acpi_adr_space_type space_id; acpi_adr_space_type space_id;
u32 function;
u32 reg_run_count; u32 reg_run_count;
}; };
......
...@@ -97,10 +97,9 @@ acpi_status acpi_ev_initialize_op_regions(void) ...@@ -97,10 +97,9 @@ acpi_status acpi_ev_initialize_op_regions(void)
if (acpi_ev_has_default_handler(acpi_gbl_root_node, if (acpi_ev_has_default_handler(acpi_gbl_root_node,
acpi_gbl_default_address_spaces acpi_gbl_default_address_spaces
[i])) { [i])) {
status = acpi_ev_execute_reg_methods(acpi_gbl_root_node,
acpi_ev_execute_reg_methods(acpi_gbl_root_node, acpi_gbl_default_address_spaces
acpi_gbl_default_address_spaces [i], ACPI_REG_CONNECT);
[i]);
} }
} }
...@@ -683,24 +682,25 @@ acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function) ...@@ -683,24 +682,25 @@ acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function)
* *
* PARAMETERS: node - Namespace node for the device * PARAMETERS: node - Namespace node for the device
* space_id - The address space ID * space_id - The address space ID
* function - Passed to _REG: On (1) or Off (0)
* *
* RETURN: Status * RETURN: None
* *
* DESCRIPTION: Run all _REG methods for the input Space ID; * DESCRIPTION: Run all _REG methods for the input Space ID;
* Note: assumes namespace is locked, or system init time. * Note: assumes namespace is locked, or system init time.
* *
******************************************************************************/ ******************************************************************************/
acpi_status void
acpi_ev_execute_reg_methods(struct acpi_namespace_node *node, acpi_ev_execute_reg_methods(struct acpi_namespace_node *node,
acpi_adr_space_type space_id) acpi_adr_space_type space_id, u32 function)
{ {
acpi_status status;
struct acpi_reg_walk_info info; struct acpi_reg_walk_info info;
ACPI_FUNCTION_TRACE(ev_execute_reg_methods); ACPI_FUNCTION_TRACE(ev_execute_reg_methods);
info.space_id = space_id; info.space_id = space_id;
info.function = function;
info.reg_run_count = 0; info.reg_run_count = 0;
ACPI_DEBUG_PRINT_RAW((ACPI_DB_NAMES, ACPI_DEBUG_PRINT_RAW((ACPI_DB_NAMES,
...@@ -713,9 +713,9 @@ acpi_ev_execute_reg_methods(struct acpi_namespace_node *node, ...@@ -713,9 +713,9 @@ acpi_ev_execute_reg_methods(struct acpi_namespace_node *node,
* regions and _REG methods. (i.e. handlers must be installed for all * regions and _REG methods. (i.e. handlers must be installed for all
* regions of this Space ID before we can run any _REG methods) * regions of this Space ID before we can run any _REG methods)
*/ */
status = acpi_ns_walk_namespace(ACPI_TYPE_ANY, node, ACPI_UINT32_MAX, (void)acpi_ns_walk_namespace(ACPI_TYPE_ANY, node, ACPI_UINT32_MAX,
ACPI_NS_WALK_UNLOCK, acpi_ev_reg_run, ACPI_NS_WALK_UNLOCK, acpi_ev_reg_run, NULL,
NULL, &info, NULL); &info, NULL);
/* Special case for EC: handle "orphan" _REG methods with no region */ /* Special case for EC: handle "orphan" _REG methods with no region */
...@@ -728,7 +728,7 @@ acpi_ev_execute_reg_methods(struct acpi_namespace_node *node, ...@@ -728,7 +728,7 @@ acpi_ev_execute_reg_methods(struct acpi_namespace_node *node,
info.reg_run_count, info.reg_run_count,
acpi_ut_get_region_name(info.space_id))); acpi_ut_get_region_name(info.space_id)));
return_ACPI_STATUS(status); return_VOID;
} }
/******************************************************************************* /*******************************************************************************
...@@ -787,7 +787,7 @@ acpi_ev_reg_run(acpi_handle obj_handle, ...@@ -787,7 +787,7 @@ acpi_ev_reg_run(acpi_handle obj_handle,
} }
info->reg_run_count++; info->reg_run_count++;
status = acpi_ev_execute_reg_method(obj_desc, ACPI_REG_CONNECT); status = acpi_ev_execute_reg_method(obj_desc, info->function);
return (status); return (status);
} }
......
...@@ -114,7 +114,7 @@ acpi_install_address_space_handler(acpi_handle device, ...@@ -114,7 +114,7 @@ acpi_install_address_space_handler(acpi_handle device,
/* Run all _REG methods for this address space */ /* Run all _REG methods for this address space */
status = acpi_ev_execute_reg_methods(node, space_id); acpi_ev_execute_reg_methods(node, space_id, ACPI_REG_CONNECT);
unlock_and_exit: unlock_and_exit:
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment