2005-04-17 06:20:36 +08:00
|
|
|
/******************************************************************************
|
|
|
|
*
|
|
|
|
* Module Name: exresolv - AML Interpreter object resolution
|
|
|
|
*
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
/*
|
2017-02-08 11:00:08 +08:00
|
|
|
* Copyright (C) 2000 - 2017, Intel Corp.
|
2005-04-17 06:20:36 +08:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions, and the following disclaimer,
|
|
|
|
* without modification.
|
|
|
|
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
|
|
|
|
* substantially similar to the "NO WARRANTY" disclaimer below
|
|
|
|
* ("Disclaimer") and any redistribution must be conditioned upon
|
|
|
|
* including a substantially similar Disclaimer requirement for further
|
|
|
|
* binary redistribution.
|
|
|
|
* 3. Neither the names of the above-listed copyright holders nor the names
|
|
|
|
* of any contributors may be used to endorse or promote products derived
|
|
|
|
* from this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* Alternatively, this software may be distributed under the terms of the
|
|
|
|
* GNU General Public License ("GPL") version 2 as published by the Free
|
|
|
|
* Software Foundation.
|
|
|
|
*
|
|
|
|
* NO WARRANTY
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
|
|
|
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
|
|
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
|
|
|
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
|
|
|
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
* POSSIBILITY OF SUCH DAMAGES.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <acpi/acpi.h>
|
2009-01-09 13:30:03 +08:00
|
|
|
#include "accommon.h"
|
|
|
|
#include "amlcode.h"
|
|
|
|
#include "acdispat.h"
|
|
|
|
#include "acinterp.h"
|
|
|
|
#include "acnamesp.h"
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
#define _COMPONENT ACPI_EXECUTER
|
2005-08-05 12:44:28 +08:00
|
|
|
ACPI_MODULE_NAME("exresolv")
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-04-19 10:49:35 +08:00
|
|
|
/* Local prototypes */
|
|
|
|
static acpi_status
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr,
|
|
|
|
struct acpi_walk_state *walk_state);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ex_resolve_to_value
|
|
|
|
*
|
|
|
|
* PARAMETERS: **stack_ptr - Points to entry on obj_stack, which can
|
|
|
|
* be either an (union acpi_operand_object *)
|
|
|
|
* or an acpi_handle.
|
|
|
|
* walk_state - Current method state
|
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Convert Reference objects to values
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
acpi_status
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_ex_resolve_to_value(union acpi_operand_object **stack_ptr,
|
|
|
|
struct acpi_walk_state *walk_state)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_status status;
|
2005-04-17 06:20:36 +08: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-22 05:15:00 +08:00
|
|
|
ACPI_FUNCTION_TRACE_PTR(ex_resolve_to_value, stack_ptr);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
if (!stack_ptr || !*stack_ptr) {
|
2006-01-28 05:43:00 +08:00
|
|
|
ACPI_ERROR((AE_INFO, "Internal - null pointer"));
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(AE_AML_NO_OPERAND);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The entity pointed to by the stack_ptr can be either
|
|
|
|
* 1) A valid union acpi_operand_object, or
|
|
|
|
* 2) A struct acpi_namespace_node (named_obj)
|
|
|
|
*/
|
2005-08-05 12:44:28 +08:00
|
|
|
if (ACPI_GET_DESCRIPTOR_TYPE(*stack_ptr) == ACPI_DESC_TYPE_OPERAND) {
|
|
|
|
status = acpi_ex_resolve_object_to_value(stack_ptr, walk_state);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
2005-04-19 10:49:35 +08:00
|
|
|
|
|
|
|
if (!*stack_ptr) {
|
2006-01-28 05:43:00 +08:00
|
|
|
ACPI_ERROR((AE_INFO, "Internal - null pointer"));
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(AE_AML_NO_OPERAND);
|
2005-04-19 10:49:35 +08:00
|
|
|
}
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Object on the stack may have changed if acpi_ex_resolve_object_to_value()
|
|
|
|
* was called (i.e., we can't use an _else_ here.)
|
|
|
|
*/
|
2005-08-05 12:44:28 +08:00
|
|
|
if (ACPI_GET_DESCRIPTOR_TYPE(*stack_ptr) == ACPI_DESC_TYPE_NAMED) {
|
|
|
|
status =
|
|
|
|
acpi_ex_resolve_node_to_value(ACPI_CAST_INDIRECT_PTR
|
|
|
|
(struct acpi_namespace_node,
|
|
|
|
stack_ptr), walk_state);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Resolved object %p\n", *stack_ptr));
|
|
|
|
return_ACPI_STATUS(AE_OK);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ex_resolve_object_to_value
|
|
|
|
*
|
2005-04-19 10:49:35 +08:00
|
|
|
* PARAMETERS: stack_ptr - Pointer to an internal object
|
2005-04-17 06:20:36 +08:00
|
|
|
* walk_state - Current method state
|
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
2005-04-19 10:49:35 +08:00
|
|
|
* DESCRIPTION: Retrieve the value from an internal object. The Reference type
|
2005-04-17 06:20:36 +08:00
|
|
|
* uses the associated AML opcode to determine the value.
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2005-04-19 10:49:35 +08:00
|
|
|
static acpi_status
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr,
|
|
|
|
struct acpi_walk_state *walk_state)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_status status = AE_OK;
|
|
|
|
union acpi_operand_object *stack_desc;
|
2007-02-03 00:48:21 +08:00
|
|
|
union acpi_operand_object *obj_desc = NULL;
|
2008-09-27 11:08:41 +08:00
|
|
|
u8 ref_type;
|
2005-04-17 06:20:36 +08: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-22 05:15:00 +08:00
|
|
|
ACPI_FUNCTION_TRACE(ex_resolve_object_to_value);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
stack_desc = *stack_ptr;
|
|
|
|
|
2012-07-16 09:52:27 +08:00
|
|
|
/* This is an object of type union acpi_operand_object */
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2009-02-18 14:44:03 +08:00
|
|
|
switch (stack_desc->common.type) {
|
2005-04-17 06:20:36 +08:00
|
|
|
case ACPI_TYPE_LOCAL_REFERENCE:
|
|
|
|
|
2008-09-27 11:08:41 +08:00
|
|
|
ref_type = stack_desc->reference.class;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2008-09-27 11:08:41 +08:00
|
|
|
switch (ref_type) {
|
|
|
|
case ACPI_REFCLASS_LOCAL:
|
|
|
|
case ACPI_REFCLASS_ARG:
|
2005-04-17 06:20:36 +08:00
|
|
|
/*
|
|
|
|
* Get the local from the method's state info
|
|
|
|
* Note: this increments the local's object reference count
|
|
|
|
*/
|
2008-09-27 11:08:41 +08:00
|
|
|
status = acpi_ds_method_data_get_value(ref_type,
|
2005-08-05 12:44:28 +08:00
|
|
|
stack_desc->
|
2008-09-27 11:08:41 +08:00
|
|
|
reference.value,
|
2005-08-05 12:44:28 +08:00
|
|
|
walk_state,
|
|
|
|
&obj_desc);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
|
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-22 05:15:00 +08:00
|
|
|
"[Arg/Local %X] ValueObj is %p\n",
|
2008-09-27 11:08:41 +08:00
|
|
|
stack_desc->reference.value,
|
2005-08-05 12:44:28 +08:00
|
|
|
obj_desc));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Now we can delete the original Reference Object and
|
|
|
|
* replace it with the resolved value
|
|
|
|
*/
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_ut_remove_reference(stack_desc);
|
2005-04-17 06:20:36 +08:00
|
|
|
*stack_ptr = obj_desc;
|
|
|
|
break;
|
|
|
|
|
2008-09-27 11:08:41 +08:00
|
|
|
case ACPI_REFCLASS_INDEX:
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
switch (stack_desc->reference.target_type) {
|
|
|
|
case ACPI_TYPE_BUFFER_FIELD:
|
|
|
|
|
2008-04-10 23:06:41 +08:00
|
|
|
/* Just return - do not dereference */
|
2005-04-17 06:20:36 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_TYPE_PACKAGE:
|
|
|
|
|
2008-04-10 23:06:41 +08:00
|
|
|
/* If method call or copy_object - do not dereference */
|
2008-04-10 23:06:41 +08:00
|
|
|
|
2008-04-10 23:06:41 +08:00
|
|
|
if ((walk_state->opcode ==
|
|
|
|
AML_INT_METHODCALL_OP)
|
2017-04-26 16:18:40 +08:00
|
|
|
|| (walk_state->opcode ==
|
|
|
|
AML_COPY_OBJECT_OP)) {
|
2008-04-10 23:06:41 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2008-04-10 23:06:41 +08:00
|
|
|
/* Otherwise, dereference the package_index to a package element */
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
obj_desc = *stack_desc->reference.where;
|
|
|
|
if (obj_desc) {
|
|
|
|
/*
|
2008-04-10 23:06:41 +08:00
|
|
|
* Valid object descriptor, copy pointer to return value
|
2005-04-17 06:20:36 +08:00
|
|
|
* (i.e., dereference the package index)
|
|
|
|
* Delete the ref object, increment the returned object
|
|
|
|
*/
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_ut_add_reference(obj_desc);
|
2005-04-17 06:20:36 +08:00
|
|
|
*stack_ptr = obj_desc;
|
2005-08-05 12:44:28 +08:00
|
|
|
} else {
|
2005-04-17 06:20:36 +08:00
|
|
|
/*
|
2008-04-10 23:06:41 +08:00
|
|
|
* A NULL object descriptor means an uninitialized element of
|
2005-04-17 06:20:36 +08:00
|
|
|
* the package, can't dereference it
|
|
|
|
*/
|
2006-01-28 05:43:00 +08:00
|
|
|
ACPI_ERROR((AE_INFO,
|
2015-12-29 13:54:36 +08:00
|
|
|
"Attempt to dereference an Index to "
|
|
|
|
"NULL package element Idx=%p",
|
2006-01-28 05:43:00 +08:00
|
|
|
stack_desc));
|
2005-04-17 06:20:36 +08:00
|
|
|
status = AE_AML_UNINITIALIZED_ELEMENT;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
/* Invalid reference object */
|
|
|
|
|
2006-01-28 05:43:00 +08:00
|
|
|
ACPI_ERROR((AE_INFO,
|
2010-03-05 17:56:40 +08:00
|
|
|
"Unknown TargetType 0x%X in Index/Reference object %p",
|
2006-01-28 05:43:00 +08:00
|
|
|
stack_desc->reference.target_type,
|
|
|
|
stack_desc));
|
2005-04-17 06:20:36 +08:00
|
|
|
status = AE_AML_INTERNAL;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2008-09-27 11:08:41 +08:00
|
|
|
case ACPI_REFCLASS_REFOF:
|
|
|
|
case ACPI_REFCLASS_DEBUG:
|
|
|
|
case ACPI_REFCLASS_TABLE:
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2008-04-10 23:06:41 +08:00
|
|
|
/* Just leave the object as-is, do not dereference */
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
break;
|
|
|
|
|
2008-09-27 11:08:41 +08:00
|
|
|
case ACPI_REFCLASS_NAME: /* Reference to a named object */
|
2005-04-19 10:49:35 +08:00
|
|
|
|
2006-06-09 04:29:00 +08:00
|
|
|
/* Dereference the name */
|
|
|
|
|
|
|
|
if ((stack_desc->reference.node->type ==
|
|
|
|
ACPI_TYPE_DEVICE)
|
|
|
|
|| (stack_desc->reference.node->type ==
|
|
|
|
ACPI_TYPE_THERMAL)) {
|
|
|
|
|
|
|
|
/* These node types do not have 'real' subobjects */
|
|
|
|
|
|
|
|
*stack_ptr = (void *)stack_desc->reference.node;
|
|
|
|
} else {
|
|
|
|
/* Get the object pointed to by the namespace node */
|
|
|
|
|
|
|
|
*stack_ptr =
|
|
|
|
(stack_desc->reference.node)->object;
|
|
|
|
acpi_ut_add_reference(*stack_ptr);
|
|
|
|
}
|
2005-04-19 10:49:35 +08:00
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_ut_remove_reference(stack_desc);
|
2005-04-19 10:49:35 +08:00
|
|
|
break;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
default:
|
|
|
|
|
2006-01-28 05:43:00 +08:00
|
|
|
ACPI_ERROR((AE_INFO,
|
2010-03-05 17:56:40 +08:00
|
|
|
"Unknown Reference type 0x%X in %p",
|
|
|
|
ref_type, stack_desc));
|
2005-04-17 06:20:36 +08:00
|
|
|
status = AE_AML_INTERNAL;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_TYPE_BUFFER:
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
status = acpi_ds_get_buffer_arguments(stack_desc);
|
2005-04-17 06:20:36 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_TYPE_PACKAGE:
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
status = acpi_ds_get_package_arguments(stack_desc);
|
2005-04-17 06:20:36 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_TYPE_BUFFER_FIELD:
|
|
|
|
case ACPI_TYPE_LOCAL_REGION_FIELD:
|
|
|
|
case ACPI_TYPE_LOCAL_BANK_FIELD:
|
|
|
|
case ACPI_TYPE_LOCAL_INDEX_FIELD:
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
|
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-22 05:15:00 +08:00
|
|
|
"FieldRead SourceDesc=%p Type=%X\n",
|
2009-02-18 14:44:03 +08:00
|
|
|
stack_desc, stack_desc->common.type));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
status =
|
|
|
|
acpi_ex_read_data_from_field(walk_state, stack_desc,
|
|
|
|
&obj_desc);
|
2007-02-03 00:48:21 +08:00
|
|
|
|
|
|
|
/* Remove a reference to the original operand, then override */
|
|
|
|
|
|
|
|
acpi_ut_remove_reference(*stack_ptr);
|
2005-08-05 12:44:28 +08:00
|
|
|
*stack_ptr = (void *)obj_desc;
|
2005-04-17 06:20:36 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2013-06-08 08:58:14 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ex_resolve_multiple
|
|
|
|
*
|
|
|
|
* PARAMETERS: walk_state - Current state (contains AML opcode)
|
2012-07-12 09:40:10 +08:00
|
|
|
* operand - Starting point for resolution
|
2005-04-17 06:20:36 +08:00
|
|
|
* return_type - Where the object type is returned
|
|
|
|
* return_desc - Where the resolved object is returned
|
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
2012-10-31 10:26:55 +08:00
|
|
|
* DESCRIPTION: Return the base object and type. Traverse a reference list if
|
2005-04-17 06:20:36 +08:00
|
|
|
* necessary to get to the base object.
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
acpi_status
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state,
|
|
|
|
union acpi_operand_object *operand,
|
2016-05-05 12:57:53 +08:00
|
|
|
acpi_object_type *return_type,
|
2005-08-05 12:44:28 +08:00
|
|
|
union acpi_operand_object **return_desc)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2015-08-25 10:28:26 +08:00
|
|
|
union acpi_operand_object *obj_desc = ACPI_CAST_PTR(void, operand);
|
|
|
|
struct acpi_namespace_node *node =
|
|
|
|
ACPI_CAST_PTR(struct acpi_namespace_node, operand);
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_object_type type;
|
|
|
|
acpi_status status;
|
2005-04-17 06:20:36 +08: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-22 05:15:00 +08:00
|
|
|
ACPI_FUNCTION_TRACE(acpi_ex_resolve_multiple);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-04-19 10:49:35 +08:00
|
|
|
/* Operand can be either a namespace node or an operand descriptor */
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
switch (ACPI_GET_DESCRIPTOR_TYPE(obj_desc)) {
|
2005-04-17 06:20:36 +08:00
|
|
|
case ACPI_DESC_TYPE_OPERAND:
|
2013-06-08 08:58:14 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
type = obj_desc->common.type;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_DESC_TYPE_NAMED:
|
2013-06-08 08:58:14 +08:00
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
type = ((struct acpi_namespace_node *)obj_desc)->type;
|
2015-08-25 10:28:26 +08:00
|
|
|
obj_desc = acpi_ns_get_attached_object(node);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* If we had an Alias node, use the attached object for type info */
|
|
|
|
|
|
|
|
if (type == ACPI_TYPE_LOCAL_ALIAS) {
|
2005-08-05 12:44:28 +08:00
|
|
|
type = ((struct acpi_namespace_node *)obj_desc)->type;
|
2015-12-29 13:54:36 +08:00
|
|
|
obj_desc = acpi_ns_get_attached_object((struct
|
|
|
|
acpi_namespace_node
|
|
|
|
*)obj_desc);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
2015-08-25 10:28:26 +08:00
|
|
|
|
2017-06-05 16:41:18 +08:00
|
|
|
switch (type) {
|
|
|
|
case ACPI_TYPE_DEVICE:
|
|
|
|
case ACPI_TYPE_THERMAL:
|
|
|
|
|
|
|
|
/* These types have no attached subobject */
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
/* All other types require a subobject */
|
|
|
|
|
|
|
|
if (!obj_desc) {
|
|
|
|
ACPI_ERROR((AE_INFO,
|
|
|
|
"[%4.4s] Node is unresolved or uninitialized",
|
|
|
|
acpi_ut_get_node_name(node)));
|
|
|
|
return_ACPI_STATUS(AE_AML_UNINITIALIZED_NODE);
|
|
|
|
}
|
|
|
|
break;
|
2015-08-25 10:28:26 +08:00
|
|
|
}
|
2005-04-17 06:20:36 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2005-04-19 10:49:35 +08:00
|
|
|
/* If type is anything other than a reference, we are done */
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
if (type != ACPI_TYPE_LOCAL_REFERENCE) {
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2008-04-10 23:06:42 +08:00
|
|
|
* For reference objects created via the ref_of, Index, or Load/load_table
|
|
|
|
* operators, we need to get to the base object (as per the ACPI
|
|
|
|
* specification of the object_type and size_of operators). This means
|
|
|
|
* traversing the list of possibly many nested references.
|
2005-04-17 06:20:36 +08:00
|
|
|
*/
|
2009-02-18 14:44:03 +08:00
|
|
|
while (obj_desc->common.type == ACPI_TYPE_LOCAL_REFERENCE) {
|
2008-09-27 11:08:41 +08:00
|
|
|
switch (obj_desc->reference.class) {
|
|
|
|
case ACPI_REFCLASS_REFOF:
|
|
|
|
case ACPI_REFCLASS_NAME:
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* Dereference the reference pointer */
|
|
|
|
|
2008-09-27 11:08:41 +08:00
|
|
|
if (obj_desc->reference.class == ACPI_REFCLASS_REFOF) {
|
2006-10-02 12:00:00 +08:00
|
|
|
node = obj_desc->reference.object;
|
|
|
|
} else { /* AML_INT_NAMEPATH_OP */
|
|
|
|
|
|
|
|
node = obj_desc->reference.node;
|
|
|
|
}
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* All "References" point to a NS node */
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
if (ACPI_GET_DESCRIPTOR_TYPE(node) !=
|
|
|
|
ACPI_DESC_TYPE_NAMED) {
|
2010-03-05 17:56:40 +08:00
|
|
|
ACPI_ERROR((AE_INFO,
|
|
|
|
"Not a namespace node %p [%s]",
|
2006-01-28 05:43:00 +08:00
|
|
|
node,
|
|
|
|
acpi_ut_get_descriptor_name(node)));
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(AE_AML_INTERNAL);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Get the attached object */
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
obj_desc = acpi_ns_get_attached_object(node);
|
2005-04-17 06:20:36 +08:00
|
|
|
if (!obj_desc) {
|
2006-10-02 12:00:00 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/* No object, use the NS node type */
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
type = acpi_ns_get_type(node);
|
2005-04-17 06:20:36 +08:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Check for circular references */
|
|
|
|
|
|
|
|
if (obj_desc == operand) {
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(AE_AML_CIRCULAR_REFERENCE);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2008-09-27 11:08:41 +08:00
|
|
|
case ACPI_REFCLASS_INDEX:
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* Get the type of this reference (index into another object) */
|
|
|
|
|
|
|
|
type = obj_desc->reference.target_type;
|
|
|
|
if (type != ACPI_TYPE_PACKAGE) {
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The main object is a package, we want to get the type
|
|
|
|
* of the individual package element that is referenced by
|
|
|
|
* the index.
|
|
|
|
*
|
|
|
|
* This could of course in turn be another reference object.
|
|
|
|
*/
|
|
|
|
obj_desc = *(obj_desc->reference.where);
|
|
|
|
if (!obj_desc) {
|
2006-10-02 12:00:00 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/* NULL package elements are allowed */
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
type = 0; /* Uninitialized */
|
2005-04-17 06:20:36 +08:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2008-09-27 11:08:41 +08:00
|
|
|
case ACPI_REFCLASS_TABLE:
|
2008-04-10 23:06:42 +08:00
|
|
|
|
|
|
|
type = ACPI_TYPE_DDB_HANDLE;
|
|
|
|
goto exit;
|
|
|
|
|
2008-09-27 11:08:41 +08:00
|
|
|
case ACPI_REFCLASS_LOCAL:
|
|
|
|
case ACPI_REFCLASS_ARG:
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
if (return_desc) {
|
2005-08-05 12:44:28 +08:00
|
|
|
status =
|
|
|
|
acpi_ds_method_data_get_value(obj_desc->
|
|
|
|
reference.
|
2008-09-27 11:08:41 +08:00
|
|
|
class,
|
2005-08-05 12:44:28 +08:00
|
|
|
obj_desc->
|
|
|
|
reference.
|
2008-09-27 11:08:41 +08:00
|
|
|
value,
|
2005-08-05 12:44:28 +08:00
|
|
|
walk_state,
|
|
|
|
&obj_desc);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_ut_remove_reference(obj_desc);
|
|
|
|
} else {
|
|
|
|
status =
|
|
|
|
acpi_ds_method_data_get_node(obj_desc->
|
|
|
|
reference.
|
2008-09-27 11:08:41 +08:00
|
|
|
class,
|
2005-08-05 12:44:28 +08:00
|
|
|
obj_desc->
|
|
|
|
reference.
|
2008-09-27 11:08:41 +08:00
|
|
|
value,
|
2005-08-05 12:44:28 +08:00
|
|
|
walk_state,
|
|
|
|
&node);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
obj_desc = acpi_ns_get_attached_object(node);
|
2005-04-17 06:20:36 +08:00
|
|
|
if (!obj_desc) {
|
|
|
|
type = ACPI_TYPE_ANY;
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2008-09-27 11:08:41 +08:00
|
|
|
case ACPI_REFCLASS_DEBUG:
|
2005-04-17 06:20:36 +08: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-22 05:15:00 +08:00
|
|
|
/* The Debug Object is of type "DebugObject" */
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
type = ACPI_TYPE_DEBUG_OBJECT;
|
|
|
|
goto exit;
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
2006-01-28 05:43:00 +08:00
|
|
|
ACPI_ERROR((AE_INFO,
|
2010-03-05 17:56:40 +08:00
|
|
|
"Unknown Reference Class 0x%2.2X",
|
2008-09-27 11:08:41 +08:00
|
|
|
obj_desc->reference.class));
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(AE_AML_INTERNAL);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Now we are guaranteed to have an object that has not been created
|
|
|
|
* via the ref_of or Index operators.
|
|
|
|
*/
|
2009-02-18 14:44:03 +08:00
|
|
|
type = obj_desc->common.type;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2013-10-29 09:30:02 +08:00
|
|
|
exit:
|
2005-04-17 06:20:36 +08:00
|
|
|
/* Convert internal types to external types */
|
|
|
|
|
|
|
|
switch (type) {
|
|
|
|
case ACPI_TYPE_LOCAL_REGION_FIELD:
|
|
|
|
case ACPI_TYPE_LOCAL_BANK_FIELD:
|
|
|
|
case ACPI_TYPE_LOCAL_INDEX_FIELD:
|
|
|
|
|
|
|
|
type = ACPI_TYPE_FIELD_UNIT;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_TYPE_LOCAL_SCOPE:
|
|
|
|
|
|
|
|
/* Per ACPI Specification, Scope is untyped */
|
|
|
|
|
|
|
|
type = ACPI_TYPE_ANY;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2013-06-08 08:58:14 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/* No change to Type required */
|
2013-06-08 08:58:14 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
*return_type = type;
|
|
|
|
if (return_desc) {
|
|
|
|
*return_desc = obj_desc;
|
|
|
|
}
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(AE_OK);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|