2018-03-14 16:13:07 -07:00
|
|
|
// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0
|
2005-04-16 15:20:36 -07:00
|
|
|
/******************************************************************************
|
|
|
|
*
|
|
|
|
* Module Name: evxfregn - External Interfaces, ACPI Operation Regions and
|
|
|
|
* Address Spaces.
|
|
|
|
*
|
2023-04-05 06:38:21 -07:00
|
|
|
* Copyright (C) 2000 - 2023, Intel Corp.
|
2005-04-16 15:20:36 -07:00
|
|
|
*
|
2018-03-14 16:13:07 -07:00
|
|
|
*****************************************************************************/
|
2005-04-16 15:20:36 -07:00
|
|
|
|
2013-10-28 18:29:51 -07:00
|
|
|
#define EXPORT_ACPI_INTERFACES
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
#include <acpi/acpi.h>
|
2009-01-08 22:30:03 -07:00
|
|
|
#include "accommon.h"
|
|
|
|
#include "acnamesp.h"
|
|
|
|
#include "acevents.h"
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
#define _COMPONENT ACPI_EVENTS
|
2005-08-04 21:44:28 -07:00
|
|
|
ACPI_MODULE_NAME("evxfregn")
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
2022-12-08 07:23:33 -07:00
|
|
|
* FUNCTION: acpi_install_address_space_handler_internal
|
2005-04-16 15:20:36 -07:00
|
|
|
*
|
2012-07-11 18:40:10 -07:00
|
|
|
* PARAMETERS: device - Handle for the device
|
2005-04-16 15:20:36 -07:00
|
|
|
* space_id - The address space ID
|
2012-07-11 18:40:10 -07:00
|
|
|
* handler - Address of the handler
|
|
|
|
* setup - Address of the setup function
|
|
|
|
* context - Value passed to the handler on each access
|
2022-12-08 07:23:33 -07:00
|
|
|
* Run_reg - Run _REG methods for this address space?
|
2005-04-16 15:20:36 -07:00
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Install a handler for all op_regions of a given space_id.
|
|
|
|
*
|
2010-10-17 17:43:13 -07:00
|
|
|
* NOTE: This function should only be called after acpi_enable_subsystem has
|
|
|
|
* been called. This is because any _REG methods associated with the Space ID
|
|
|
|
* are executed here, and these methods can only be safely executed after
|
|
|
|
* the default handlers have been installed and the hardware has been
|
|
|
|
* initialized (via acpi_enable_subsystem.)
|
2022-12-08 07:23:33 -07:00
|
|
|
* To avoid this problem pass FALSE for Run_Reg and later on call
|
|
|
|
* acpi_execute_reg_methods() to execute _REG.
|
2010-10-17 17:43:13 -07:00
|
|
|
*
|
2005-04-16 15:20:36 -07:00
|
|
|
******************************************************************************/
|
2022-12-08 07:23:33 -07:00
|
|
|
static acpi_status
|
|
|
|
acpi_install_address_space_handler_internal(acpi_handle device,
|
|
|
|
acpi_adr_space_type space_id,
|
|
|
|
acpi_adr_space_handler handler,
|
|
|
|
acpi_adr_space_setup setup,
|
|
|
|
void *context, u8 run_reg)
|
2005-04-16 15:20:36 -07:00
|
|
|
{
|
2005-08-04 21:44:28 -07:00
|
|
|
struct acpi_namespace_node *node;
|
|
|
|
acpi_status status;
|
2005-04-16 15:20:36 -07:00
|
|
|
|
ACPI: ACPICA 20060421
Removed a device initialization optimization introduced in
20051216 where the _STA method was not run unless an _INI
was also present for the same device. This optimization
could cause problems because it could allow _INI methods
to be run within a not-present device subtree (If a
not-present device had no _INI, _STA would not be run,
the not-present status would not be discovered, and the
children of the device would be incorrectly traversed.)
Implemented a new _STA optimization where namespace
subtrees that do not contain _INI are identified and
ignored during device initialization. Selectively running
_STA can significantly improve boot time on large machines
(with assistance from Len Brown.)
Implemented support for the device initialization case
where the returned _STA flags indicate a device not-present
but functioning. In this case, _INI is not run, but the
device children are examined for presence, as per the
ACPI specification.
Implemented an additional change to the IndexField support
in order to conform to MS behavior. The value written to
the Index Register is not simply a byte offset, it is a
byte offset in units of the access width of the parent
Index Field. (Fiodor Suietov)
Defined and deployed a new OSL interface,
acpi_os_validate_address(). This interface is called during
the creation of all AML operation regions, and allows
the host OS to exert control over what addresses it will
allow the AML code to access. Operation Regions whose
addresses are disallowed will cause a runtime exception
when they are actually accessed (will not affect or abort
table loading.)
Defined and deployed a new OSL interface,
acpi_os_validate_interface(). This interface allows the host OS
to match the various "optional" interface/behavior strings
for the _OSI predefined control method as appropriate
(with assistance from Bjorn Helgaas.)
Restructured and corrected various problems in the
exception handling code paths within DsCallControlMethod
and DsTerminateControlMethod in dsmethod (with assistance
from Takayoshi Kochi.)
Modified the Linux source converter to ignore quoted string
literals while converting identifiers from mixed to lower
case. This will correct problems with the disassembler
and other areas where such strings must not be modified.
The ACPI_FUNCTION_* macros no longer require quotes around
the function name. This allows the Linux source converter
to convert the names, now that the converter ignores
quoted strings.
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-04-21 14:15:00 -07:00
|
|
|
ACPI_FUNCTION_TRACE(acpi_install_address_space_handler);
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
/* Parameter validation */
|
|
|
|
|
|
|
|
if (!device) {
|
2005-08-04 21:44:28 -07:00
|
|
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
2005-04-16 15:20:36 -07:00
|
|
|
}
|
|
|
|
|
2005-08-04 21:44:28 -07:00
|
|
|
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
|
|
|
return_ACPI_STATUS(status);
|
2005-04-16 15:20:36 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Convert and validate the device handle */
|
|
|
|
|
2009-12-10 23:57:00 -07:00
|
|
|
node = acpi_ns_validate_handle(device);
|
2005-04-16 15:20:36 -07:00
|
|
|
if (!node) {
|
|
|
|
status = AE_BAD_PARAMETER;
|
|
|
|
goto unlock_and_exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Install the handler for all Regions for this Space ID */
|
|
|
|
|
2005-08-04 21:44:28 -07:00
|
|
|
status =
|
|
|
|
acpi_ev_install_space_handler(node, space_id, handler, setup,
|
|
|
|
context);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
2005-04-16 15:20:36 -07:00
|
|
|
goto unlock_and_exit;
|
|
|
|
}
|
|
|
|
|
2011-04-12 22:22:04 -07:00
|
|
|
/* Run all _REG methods for this address space */
|
|
|
|
|
2022-12-08 07:23:33 -07:00
|
|
|
if (run_reg) {
|
2024-08-12 06:11:42 -07:00
|
|
|
acpi_ev_execute_reg_methods(node, ACPI_UINT32_MAX, space_id,
|
|
|
|
ACPI_REG_CONNECT);
|
2022-12-08 07:23:33 -07:00
|
|
|
}
|
2011-04-12 22:22:04 -07:00
|
|
|
|
2013-10-28 18:30:02 -07:00
|
|
|
unlock_and_exit:
|
2005-08-04 21:44:28 -07:00
|
|
|
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
|
|
|
|
return_ACPI_STATUS(status);
|
2005-04-16 15:20:36 -07:00
|
|
|
}
|
|
|
|
|
2022-12-08 07:23:33 -07:00
|
|
|
acpi_status
|
|
|
|
acpi_install_address_space_handler(acpi_handle device,
|
|
|
|
acpi_adr_space_type space_id,
|
|
|
|
acpi_adr_space_handler handler,
|
|
|
|
acpi_adr_space_setup setup, void *context)
|
|
|
|
{
|
|
|
|
return acpi_install_address_space_handler_internal(device, space_id,
|
|
|
|
handler, setup,
|
|
|
|
context, TRUE);
|
|
|
|
}
|
|
|
|
|
2006-10-02 21:00:00 -07:00
|
|
|
ACPI_EXPORT_SYMBOL(acpi_install_address_space_handler)
|
2022-12-08 07:23:33 -07:00
|
|
|
acpi_status
|
|
|
|
acpi_install_address_space_handler_no_reg(acpi_handle device,
|
|
|
|
acpi_adr_space_type space_id,
|
|
|
|
acpi_adr_space_handler handler,
|
|
|
|
acpi_adr_space_setup setup,
|
|
|
|
void *context)
|
|
|
|
{
|
|
|
|
return acpi_install_address_space_handler_internal(device, space_id,
|
|
|
|
handler, setup,
|
|
|
|
context, FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
ACPI_EXPORT_SYMBOL(acpi_install_address_space_handler_no_reg)
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_remove_address_space_handler
|
|
|
|
*
|
2012-07-11 18:40:10 -07:00
|
|
|
* PARAMETERS: device - Handle for the device
|
2005-04-16 15:20:36 -07:00
|
|
|
* space_id - The address space ID
|
2012-07-11 18:40:10 -07:00
|
|
|
* handler - Address of the handler
|
2005-04-16 15:20:36 -07:00
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Remove a previously installed handler.
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
acpi_status
|
2005-08-04 21:44:28 -07:00
|
|
|
acpi_remove_address_space_handler(acpi_handle device,
|
|
|
|
acpi_adr_space_type space_id,
|
|
|
|
acpi_adr_space_handler handler)
|
2005-04-16 15:20:36 -07:00
|
|
|
{
|
2005-08-04 21:44:28 -07:00
|
|
|
union acpi_operand_object *obj_desc;
|
|
|
|
union acpi_operand_object *handler_obj;
|
|
|
|
union acpi_operand_object *region_obj;
|
|
|
|
union acpi_operand_object **last_obj_ptr;
|
|
|
|
struct acpi_namespace_node *node;
|
|
|
|
acpi_status status;
|
2005-04-16 15:20:36 -07:00
|
|
|
|
ACPI: ACPICA 20060421
Removed a device initialization optimization introduced in
20051216 where the _STA method was not run unless an _INI
was also present for the same device. This optimization
could cause problems because it could allow _INI methods
to be run within a not-present device subtree (If a
not-present device had no _INI, _STA would not be run,
the not-present status would not be discovered, and the
children of the device would be incorrectly traversed.)
Implemented a new _STA optimization where namespace
subtrees that do not contain _INI are identified and
ignored during device initialization. Selectively running
_STA can significantly improve boot time on large machines
(with assistance from Len Brown.)
Implemented support for the device initialization case
where the returned _STA flags indicate a device not-present
but functioning. In this case, _INI is not run, but the
device children are examined for presence, as per the
ACPI specification.
Implemented an additional change to the IndexField support
in order to conform to MS behavior. The value written to
the Index Register is not simply a byte offset, it is a
byte offset in units of the access width of the parent
Index Field. (Fiodor Suietov)
Defined and deployed a new OSL interface,
acpi_os_validate_address(). This interface is called during
the creation of all AML operation regions, and allows
the host OS to exert control over what addresses it will
allow the AML code to access. Operation Regions whose
addresses are disallowed will cause a runtime exception
when they are actually accessed (will not affect or abort
table loading.)
Defined and deployed a new OSL interface,
acpi_os_validate_interface(). This interface allows the host OS
to match the various "optional" interface/behavior strings
for the _OSI predefined control method as appropriate
(with assistance from Bjorn Helgaas.)
Restructured and corrected various problems in the
exception handling code paths within DsCallControlMethod
and DsTerminateControlMethod in dsmethod (with assistance
from Takayoshi Kochi.)
Modified the Linux source converter to ignore quoted string
literals while converting identifiers from mixed to lower
case. This will correct problems with the disassembler
and other areas where such strings must not be modified.
The ACPI_FUNCTION_* macros no longer require quotes around
the function name. This allows the Linux source converter
to convert the names, now that the converter ignores
quoted strings.
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-04-21 14:15:00 -07:00
|
|
|
ACPI_FUNCTION_TRACE(acpi_remove_address_space_handler);
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
/* Parameter validation */
|
|
|
|
|
|
|
|
if (!device) {
|
2005-08-04 21:44:28 -07:00
|
|
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
2005-04-16 15:20:36 -07:00
|
|
|
}
|
|
|
|
|
2005-08-04 21:44:28 -07:00
|
|
|
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
|
|
|
return_ACPI_STATUS(status);
|
2005-04-16 15:20:36 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Convert and validate the device handle */
|
|
|
|
|
2009-12-10 23:57:00 -07:00
|
|
|
node = acpi_ns_validate_handle(device);
|
2006-07-07 17:44:38 -07:00
|
|
|
if (!node ||
|
|
|
|
((node->type != ACPI_TYPE_DEVICE) &&
|
|
|
|
(node->type != ACPI_TYPE_PROCESSOR) &&
|
|
|
|
(node->type != ACPI_TYPE_THERMAL) &&
|
|
|
|
(node != acpi_gbl_root_node))) {
|
2005-04-16 15:20:36 -07:00
|
|
|
status = AE_BAD_PARAMETER;
|
|
|
|
goto unlock_and_exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Make sure the internal object exists */
|
|
|
|
|
2005-08-04 21:44:28 -07:00
|
|
|
obj_desc = acpi_ns_get_attached_object(node);
|
2005-04-16 15:20:36 -07:00
|
|
|
if (!obj_desc) {
|
|
|
|
status = AE_NOT_EXIST;
|
|
|
|
goto unlock_and_exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Find the address handler the user requested */
|
|
|
|
|
2015-12-28 23:02:08 -07:00
|
|
|
handler_obj = obj_desc->common_notify.handler;
|
|
|
|
last_obj_ptr = &obj_desc->common_notify.handler;
|
2005-04-16 15:20:36 -07:00
|
|
|
while (handler_obj) {
|
2006-10-01 21:00:00 -07:00
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
/* We have a handler, see if user requested this one */
|
|
|
|
|
|
|
|
if (handler_obj->address_space.space_id == space_id) {
|
2006-10-01 21:00:00 -07:00
|
|
|
|
2006-07-07 17:44:38 -07:00
|
|
|
/* Handler must be the same as the installed handler */
|
|
|
|
|
|
|
|
if (handler_obj->address_space.handler != handler) {
|
|
|
|
status = AE_BAD_PARAMETER;
|
|
|
|
goto unlock_and_exit;
|
|
|
|
}
|
|
|
|
|
2005-04-16 15:20:36 -07:00
|
|
|
/* Matched space_id, first dereference this in the Regions */
|
|
|
|
|
2005-08-04 21:44:28 -07:00
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_OPREGION,
|
2009-03-05 19:05:18 -07:00
|
|
|
"Removing address handler %p(%p) for region %s "
|
|
|
|
"on Device %p(%p)\n",
|
2005-08-04 21:44:28 -07:00
|
|
|
handler_obj, handler,
|
|
|
|
acpi_ut_get_region_name(space_id),
|
|
|
|
node, obj_desc));
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
region_obj = handler_obj->address_space.region_list;
|
|
|
|
|
|
|
|
/* Walk the handler's region list */
|
|
|
|
|
|
|
|
while (region_obj) {
|
|
|
|
/*
|
|
|
|
* First disassociate the handler from the region.
|
|
|
|
*
|
|
|
|
* NOTE: this doesn't mean that the region goes away
|
|
|
|
* The region is just inaccessible as indicated to
|
|
|
|
* the _REG method
|
|
|
|
*/
|
2005-08-04 21:44:28 -07:00
|
|
|
acpi_ev_detach_region(region_obj, TRUE);
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Walk the list: Just grab the head because the
|
|
|
|
* detach_region removed the previous head.
|
|
|
|
*/
|
2005-08-04 21:44:28 -07:00
|
|
|
region_obj =
|
|
|
|
handler_obj->address_space.region_list;
|
2005-04-16 15:20:36 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Remove this Handler object from the list */
|
|
|
|
|
|
|
|
*last_obj_ptr = handler_obj->address_space.next;
|
|
|
|
|
|
|
|
/* Now we can delete the handler object */
|
|
|
|
|
ACPICA: Fix race in generic_serial_bus (I2C) and GPIO op_region parameter handling
ACPICA commit c9e0116952363b0fa815143dca7e9a2eb4fefa61
The handling of the generic_serial_bus (I2C) and GPIO op_regions in
acpi_ev_address_space_dispatch() passes a number of extra parameters
to the address-space handler through the address-space Context pointer
(instead of using more function parameters).
The Context is shared between threads, so if multiple threads try to
call the handler for the same address-space at the same time, then
a second thread could change the parameters of a first thread while
the handler is running for the first thread.
An example of this race hitting is the Lenovo Yoga Tablet2 1015L,
where there are both attrib_bytes accesses and attrib_byte accesses
to the same address-space. The attrib_bytes access stores the number
of bytes to transfer in Context->access_length. Where as for the
attrib_byte access the number of bytes to transfer is always 1 and
field_obj->Field.access_length is unused (so 0). Both types of
accesses racing from different threads leads to the following problem:
1. Thread a. starts an attrib_bytes access, stores a non 0 value
from field_obj->Field.access_length in Context->access_length
2. Thread b. starts an attrib_byte access, stores 0 in
Context->access_length
3. Thread a. calls i2c_acpi_space_handler() (under Linux). Which
sees that the access-type is ACPI_GSB_ACCESS_ATTRIB_MULTIBYTE
and calls acpi_gsb_i2c_read_bytes(..., Context->access_length)
4. At this point Context->access_length is 0 (set by thread b.)
rather then the field_obj->Field.access_length value from thread a.
This 0 length reads leads to the following errors being logged:
i2c i2c-0: adapter quirk: no zero length (addr 0x0078, size 0, read)
i2c i2c-0: i2c read 0 bytes from client@0x78 starting at reg 0x0 failed, error: -95
Note this is just an example of the problems which this race can cause.
There are likely many more (sporadic) problems caused by this race.
This commit adds a new context_mutex to struct acpi_object_addr_handler
and makes acpi_ev_address_space_dispatch() take that mutex when
using the shared Context to pass extra parameters to an address-space
handler, fixing this race.
Note the new mutex must be taken *after* exiting the interpreter,
therefor the existing acpi_ex_exit_interpreter() call is moved to above
the code which stores the extra parameters in the Context.
Link: https://github.com/acpica/acpica/commit/c9e01169
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Erik Kaneda <erik.kaneda@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2021-02-18 16:17:07 -07:00
|
|
|
acpi_os_release_mutex(handler_obj->address_space.
|
|
|
|
context_mutex);
|
2005-08-04 21:44:28 -07:00
|
|
|
acpi_ut_remove_reference(handler_obj);
|
2005-04-16 15:20:36 -07:00
|
|
|
goto unlock_and_exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Walk the linked list of handlers */
|
|
|
|
|
|
|
|
last_obj_ptr = &handler_obj->address_space.next;
|
|
|
|
handler_obj = handler_obj->address_space.next;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* The handler does not exist */
|
|
|
|
|
2005-08-04 21:44:28 -07:00
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_OPREGION,
|
ACPI: ACPICA 20060421
Removed a device initialization optimization introduced in
20051216 where the _STA method was not run unless an _INI
was also present for the same device. This optimization
could cause problems because it could allow _INI methods
to be run within a not-present device subtree (If a
not-present device had no _INI, _STA would not be run,
the not-present status would not be discovered, and the
children of the device would be incorrectly traversed.)
Implemented a new _STA optimization where namespace
subtrees that do not contain _INI are identified and
ignored during device initialization. Selectively running
_STA can significantly improve boot time on large machines
(with assistance from Len Brown.)
Implemented support for the device initialization case
where the returned _STA flags indicate a device not-present
but functioning. In this case, _INI is not run, but the
device children are examined for presence, as per the
ACPI specification.
Implemented an additional change to the IndexField support
in order to conform to MS behavior. The value written to
the Index Register is not simply a byte offset, it is a
byte offset in units of the access width of the parent
Index Field. (Fiodor Suietov)
Defined and deployed a new OSL interface,
acpi_os_validate_address(). This interface is called during
the creation of all AML operation regions, and allows
the host OS to exert control over what addresses it will
allow the AML code to access. Operation Regions whose
addresses are disallowed will cause a runtime exception
when they are actually accessed (will not affect or abort
table loading.)
Defined and deployed a new OSL interface,
acpi_os_validate_interface(). This interface allows the host OS
to match the various "optional" interface/behavior strings
for the _OSI predefined control method as appropriate
(with assistance from Bjorn Helgaas.)
Restructured and corrected various problems in the
exception handling code paths within DsCallControlMethod
and DsTerminateControlMethod in dsmethod (with assistance
from Takayoshi Kochi.)
Modified the Linux source converter to ignore quoted string
literals while converting identifiers from mixed to lower
case. This will correct problems with the disassembler
and other areas where such strings must not be modified.
The ACPI_FUNCTION_* macros no longer require quotes around
the function name. This allows the Linux source converter
to convert the names, now that the converter ignores
quoted strings.
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2006-04-21 14:15:00 -07:00
|
|
|
"Unable to remove address handler %p for %s(%X), DevNode %p, obj %p\n",
|
2005-08-04 21:44:28 -07:00
|
|
|
handler, acpi_ut_get_region_name(space_id), space_id,
|
|
|
|
node, obj_desc));
|
2005-04-16 15:20:36 -07:00
|
|
|
|
|
|
|
status = AE_NOT_EXIST;
|
|
|
|
|
2013-10-28 18:30:02 -07:00
|
|
|
unlock_and_exit:
|
2005-08-04 21:44:28 -07:00
|
|
|
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
|
|
|
|
return_ACPI_STATUS(status);
|
2005-04-16 15:20:36 -07:00
|
|
|
}
|
|
|
|
|
2006-10-02 21:00:00 -07:00
|
|
|
ACPI_EXPORT_SYMBOL(acpi_remove_address_space_handler)
|
2022-12-08 07:23:33 -07:00
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_execute_reg_methods
|
|
|
|
*
|
|
|
|
* PARAMETERS: device - Handle for the device
|
2024-08-12 06:11:42 -07:00
|
|
|
* max_depth - Depth to which search for _REG
|
2022-12-08 07:23:33 -07:00
|
|
|
* space_id - The address space ID
|
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Execute _REG for all op_regions of a given space_id.
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
acpi_status
|
2024-08-12 06:11:42 -07:00
|
|
|
acpi_execute_reg_methods(acpi_handle device, u32 max_depth,
|
|
|
|
acpi_adr_space_type space_id)
|
2022-12-08 07:23:33 -07:00
|
|
|
{
|
|
|
|
struct acpi_namespace_node *node;
|
|
|
|
acpi_status status;
|
|
|
|
|
|
|
|
ACPI_FUNCTION_TRACE(acpi_execute_reg_methods);
|
|
|
|
|
|
|
|
/* Parameter validation */
|
|
|
|
|
|
|
|
if (!device) {
|
|
|
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
|
|
|
}
|
|
|
|
|
|
|
|
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
|
|
|
return_ACPI_STATUS(status);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Convert and validate the device handle */
|
|
|
|
|
|
|
|
node = acpi_ns_validate_handle(device);
|
|
|
|
if (node) {
|
|
|
|
|
|
|
|
/* Run all _REG methods for this address space */
|
|
|
|
|
2024-08-12 06:11:42 -07:00
|
|
|
acpi_ev_execute_reg_methods(node, max_depth, space_id,
|
|
|
|
ACPI_REG_CONNECT);
|
2022-12-08 07:23:33 -07:00
|
|
|
} else {
|
|
|
|
status = AE_BAD_PARAMETER;
|
|
|
|
}
|
|
|
|
|
|
|
|
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
|
|
|
|
return_ACPI_STATUS(status);
|
|
|
|
}
|
|
|
|
|
|
|
|
ACPI_EXPORT_SYMBOL(acpi_execute_reg_methods)
|