2005-04-17 06:20:36 +08:00
|
|
|
/******************************************************************************
|
|
|
|
*
|
|
|
|
* Module Name: exresop - AML Interpreter operand/object resolution
|
|
|
|
*
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
/*
|
2016-01-15 08:17:03 +08:00
|
|
|
* Copyright (C) 2000 - 2016, 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 "acparser.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("exresop")
|
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_check_object_type(acpi_object_type type_needed,
|
|
|
|
acpi_object_type this_type, void *object);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ex_check_object_type
|
|
|
|
*
|
|
|
|
* PARAMETERS: type_needed Object type needed
|
|
|
|
* this_type Actual object type
|
|
|
|
* Object Object pointer
|
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Check required type against actual type
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2005-04-19 10:49:35 +08:00
|
|
|
static acpi_status
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_ex_check_object_type(acpi_object_type type_needed,
|
|
|
|
acpi_object_type this_type, void *object)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2006-01-14 05:22:00 +08:00
|
|
|
ACPI_FUNCTION_ENTRY();
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
if (type_needed == ACPI_TYPE_ANY) {
|
2006-10-02 12:00:00 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/* All types OK, so we don't perform any typechecks */
|
|
|
|
|
|
|
|
return (AE_OK);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (type_needed == ACPI_TYPE_LOCAL_REFERENCE) {
|
|
|
|
/*
|
|
|
|
* Allow the AML "Constant" opcodes (Zero, One, etc.) to be reference
|
2012-10-31 10:26:55 +08:00
|
|
|
* objects and thus allow them to be targets. (As per the ACPI
|
2005-04-17 06:20:36 +08:00
|
|
|
* specification, a store to a constant is a noop.)
|
|
|
|
*/
|
|
|
|
if ((this_type == ACPI_TYPE_INTEGER) &&
|
2015-12-29 13:54:36 +08:00
|
|
|
(((union acpi_operand_object *)object)->common.flags &
|
|
|
|
AOPOBJ_AML_CONSTANT)) {
|
2005-04-17 06:20:36 +08:00
|
|
|
return (AE_OK);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (type_needed != this_type) {
|
2006-01-28 05:43:00 +08:00
|
|
|
ACPI_ERROR((AE_INFO,
|
|
|
|
"Needed type [%s], found [%s] %p",
|
|
|
|
acpi_ut_get_type_name(type_needed),
|
|
|
|
acpi_ut_get_type_name(this_type), object));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
return (AE_AML_OPERAND_TYPE);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (AE_OK);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ex_resolve_operands
|
|
|
|
*
|
2012-07-12 09:40:10 +08:00
|
|
|
* PARAMETERS: opcode - Opcode being interpreted
|
2005-04-17 06:20:36 +08:00
|
|
|
* stack_ptr - Pointer to the operand stack to be
|
|
|
|
* resolved
|
|
|
|
* walk_state - Current state
|
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Convert multiple input operands to the types required by the
|
|
|
|
* target operator.
|
|
|
|
*
|
|
|
|
* Each 5-bit group in arg_types represents one required
|
|
|
|
* operand and indicates the required Type. The corresponding operand
|
|
|
|
* will be converted to the required type if possible, otherwise we
|
|
|
|
* abort with an exception.
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
acpi_status
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_ex_resolve_operands(u16 opcode,
|
|
|
|
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
|
|
|
union acpi_operand_object *obj_desc;
|
|
|
|
acpi_status status = AE_OK;
|
|
|
|
u8 object_type;
|
|
|
|
u32 arg_types;
|
|
|
|
const struct acpi_opcode_info *op_info;
|
|
|
|
u32 this_arg_type;
|
|
|
|
acpi_object_type type_needed;
|
|
|
|
u16 target_op = 0;
|
|
|
|
|
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_U32(ex_resolve_operands, opcode);
|
2005-08-05 12:44:28 +08:00
|
|
|
|
|
|
|
op_info = acpi_ps_get_opcode_info(opcode);
|
2005-04-17 06:20:36 +08:00
|
|
|
if (op_info->class == AML_CLASS_UNKNOWN) {
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(AE_AML_BAD_OPCODE);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
arg_types = op_info->runtime_args;
|
|
|
|
if (arg_types == ARGI_INVALID_OPCODE) {
|
2010-03-05 17:56:40 +08:00
|
|
|
ACPI_ERROR((AE_INFO, "Unknown AML opcode 0x%X", opcode));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(AE_AML_INTERNAL);
|
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
|
|
|
"Opcode %X [%s] RequiredOperandTypes=%8.8X\n",
|
2005-08-05 12:44:28 +08:00
|
|
|
opcode, op_info->name, arg_types));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Normal exit is with (arg_types == 0) at end of argument list.
|
|
|
|
* Function will return an exception from within the loop upon
|
|
|
|
* finding an entry which is not (or cannot be converted
|
|
|
|
* to) the required type; if stack underflows; or upon
|
|
|
|
* finding a NULL stack entry (which should not happen).
|
|
|
|
*/
|
2005-08-05 12:44:28 +08:00
|
|
|
while (GET_CURRENT_ARG_TYPE(arg_types)) {
|
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, "Null stack entry at %p",
|
|
|
|
stack_ptr));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(AE_AML_INTERNAL);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Extract useful items */
|
|
|
|
|
|
|
|
obj_desc = *stack_ptr;
|
|
|
|
|
|
|
|
/* Decode the descriptor type */
|
|
|
|
|
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_NAMED:
|
|
|
|
|
2005-04-19 10:49:35 +08:00
|
|
|
/* Namespace Node */
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
object_type =
|
|
|
|
((struct acpi_namespace_node *)obj_desc)->type;
|
2006-01-28 05:43:00 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Resolve an alias object. The construction of these objects
|
|
|
|
* guarantees that there is only one level of alias indirection;
|
|
|
|
* thus, the attached object is always the aliased namespace node
|
|
|
|
*/
|
|
|
|
if (object_type == ACPI_TYPE_LOCAL_ALIAS) {
|
2015-12-29 13:54:36 +08:00
|
|
|
obj_desc = acpi_ns_get_attached_object((struct
|
|
|
|
acpi_namespace_node
|
|
|
|
*)
|
|
|
|
obj_desc);
|
2006-01-28 05:43:00 +08:00
|
|
|
*stack_ptr = obj_desc;
|
|
|
|
object_type =
|
|
|
|
((struct acpi_namespace_node *)obj_desc)->
|
|
|
|
type;
|
|
|
|
}
|
2005-04-17 06:20:36 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_DESC_TYPE_OPERAND:
|
|
|
|
|
|
|
|
/* ACPI internal object */
|
|
|
|
|
2009-02-18 14:44:03 +08:00
|
|
|
object_type = obj_desc->common.type;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* Check for bad acpi_object_type */
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
if (!acpi_ut_valid_object_type(object_type)) {
|
2006-01-28 05:43:00 +08:00
|
|
|
ACPI_ERROR((AE_INFO,
|
2010-03-05 17:56:40 +08:00
|
|
|
"Bad operand object type [0x%X]",
|
2006-01-28 05:43:00 +08:00
|
|
|
object_type));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (object_type == (u8) ACPI_TYPE_LOCAL_REFERENCE) {
|
2006-10-02 12:00:00 +08:00
|
|
|
|
2008-09-27 11:08:41 +08:00
|
|
|
/* Validate the Reference */
|
2005-04-19 10:49:35 +08:00
|
|
|
|
2008-09-27 11:08:41 +08:00
|
|
|
switch (obj_desc->reference.class) {
|
|
|
|
case ACPI_REFCLASS_DEBUG:
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-04-19 10:49:35 +08:00
|
|
|
target_op = AML_DEBUG_OP;
|
|
|
|
|
|
|
|
/*lint -fallthrough */
|
|
|
|
|
2008-09-27 11:08:41 +08:00
|
|
|
case ACPI_REFCLASS_ARG:
|
|
|
|
case ACPI_REFCLASS_LOCAL:
|
|
|
|
case ACPI_REFCLASS_INDEX:
|
|
|
|
case ACPI_REFCLASS_REFOF:
|
|
|
|
case ACPI_REFCLASS_TABLE: /* ddb_handle from LOAD_OP or LOAD_TABLE_OP */
|
|
|
|
case ACPI_REFCLASS_NAME: /* Reference to a named object */
|
|
|
|
|
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
|
|
|
|
"Operand is a Reference, Class [%s] %2.2X\n",
|
|
|
|
acpi_ut_get_reference_name
|
|
|
|
(obj_desc),
|
|
|
|
obj_desc->reference.
|
|
|
|
class));
|
2005-04-17 06:20:36 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2008-09-27 11:08:41 +08:00
|
|
|
|
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 in %p",
|
2008-09-27 11:08:41 +08:00
|
|
|
obj_desc->reference.class,
|
|
|
|
obj_desc));
|
2005-08-05 12:44:28 +08:00
|
|
|
|
|
|
|
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
/* Invalid descriptor */
|
|
|
|
|
2008-09-27 11:08:41 +08:00
|
|
|
ACPI_ERROR((AE_INFO, "Invalid descriptor %p [%s]",
|
2006-01-28 05:43:00 +08:00
|
|
|
obj_desc,
|
|
|
|
acpi_ut_get_descriptor_name(obj_desc)));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
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
|
|
|
/* Get one argument type, point to the next */
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
this_arg_type = GET_CURRENT_ARG_TYPE(arg_types);
|
|
|
|
INCREMENT_ARG_LIST(arg_types);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Handle cases where the object does not need to be
|
|
|
|
* resolved to a value
|
|
|
|
*/
|
|
|
|
switch (this_arg_type) {
|
2005-08-05 12:44:28 +08:00
|
|
|
case ARGI_REF_OR_STRING: /* Can be a String or Reference */
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
if ((ACPI_GET_DESCRIPTOR_TYPE(obj_desc) ==
|
2015-12-29 13:54:36 +08:00
|
|
|
ACPI_DESC_TYPE_OPERAND) &&
|
|
|
|
(obj_desc->common.type == ACPI_TYPE_STRING)) {
|
2005-04-17 06:20:36 +08:00
|
|
|
/*
|
2005-04-19 10:49:35 +08:00
|
|
|
* String found - the string references a named object and
|
|
|
|
* must be resolved to a node
|
2005-04-17 06:20:36 +08:00
|
|
|
*/
|
|
|
|
goto next_operand;
|
|
|
|
}
|
|
|
|
|
2005-04-19 10:49:35 +08:00
|
|
|
/*
|
|
|
|
* Else not a string - fall through to the normal Reference
|
|
|
|
* case below
|
|
|
|
*/
|
2005-04-17 06:20:36 +08:00
|
|
|
/*lint -fallthrough */
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
case ARGI_REFERENCE: /* References: */
|
2005-04-17 06:20:36 +08:00
|
|
|
case ARGI_INTEGER_REF:
|
|
|
|
case ARGI_OBJECT_REF:
|
|
|
|
case ARGI_DEVICE_REF:
|
2005-08-05 12:44:28 +08:00
|
|
|
case ARGI_TARGETREF: /* Allows implicit conversion rules before store */
|
|
|
|
case ARGI_FIXED_TARGET: /* No implicit conversion before store to target */
|
2012-07-12 09:40:10 +08:00
|
|
|
case ARGI_SIMPLE_TARGET: /* Name, Local, or arg - no implicit conversion */
|
2015-10-19 10:24:58 +08:00
|
|
|
case ARGI_STORE_TARGET:
|
|
|
|
|
2005-04-19 10:49:35 +08:00
|
|
|
/*
|
|
|
|
* Need an operand of type ACPI_TYPE_LOCAL_REFERENCE
|
|
|
|
* A Namespace Node is OK as-is
|
|
|
|
*/
|
2005-08-05 12:44:28 +08:00
|
|
|
if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) ==
|
|
|
|
ACPI_DESC_TYPE_NAMED) {
|
2005-04-17 06:20:36 +08:00
|
|
|
goto next_operand;
|
|
|
|
}
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
status =
|
|
|
|
acpi_ex_check_object_type(ACPI_TYPE_LOCAL_REFERENCE,
|
|
|
|
object_type, obj_desc);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
goto next_operand;
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
case ARGI_DATAREFOBJ: /* Store operator only */
|
2005-04-17 06:20:36 +08:00
|
|
|
/*
|
|
|
|
* We don't want to resolve index_op reference objects during
|
|
|
|
* a store because this would be an implicit de_ref_of operation.
|
|
|
|
* Instead, we just want to store the reference object.
|
|
|
|
* -- All others must be resolved below.
|
|
|
|
*/
|
|
|
|
if ((opcode == AML_STORE_OP) &&
|
2009-02-18 14:44:03 +08:00
|
|
|
((*stack_ptr)->common.type ==
|
2005-08-05 12:44:28 +08:00
|
|
|
ACPI_TYPE_LOCAL_REFERENCE)
|
2012-10-31 10:25:45 +08:00
|
|
|
&& ((*stack_ptr)->reference.class ==
|
|
|
|
ACPI_REFCLASS_INDEX)) {
|
2005-04-17 06:20:36 +08:00
|
|
|
goto next_operand;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2013-06-08 08:58:14 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/* All cases covered above */
|
2013-06-08 08:58:14 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Resolve this object to a value
|
|
|
|
*/
|
2005-08-05 12:44:28 +08:00
|
|
|
status = acpi_ex_resolve_to_value(stack_ptr, walk_state);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Get the resolved object */
|
|
|
|
|
|
|
|
obj_desc = *stack_ptr;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Check the resulting object (value) type
|
|
|
|
*/
|
|
|
|
switch (this_arg_type) {
|
2005-08-05 12:44:28 +08:00
|
|
|
/*
|
|
|
|
* For the simple cases, only one type of resolved object
|
|
|
|
* is allowed
|
|
|
|
*/
|
2005-04-17 06:20:36 +08:00
|
|
|
case ARGI_MUTEX:
|
|
|
|
|
|
|
|
/* Need an operand of type ACPI_TYPE_MUTEX */
|
|
|
|
|
|
|
|
type_needed = ACPI_TYPE_MUTEX;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ARGI_EVENT:
|
|
|
|
|
|
|
|
/* Need an operand of type ACPI_TYPE_EVENT */
|
|
|
|
|
|
|
|
type_needed = ACPI_TYPE_EVENT;
|
|
|
|
break;
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
case ARGI_PACKAGE: /* Package */
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/* Need an operand of type ACPI_TYPE_PACKAGE */
|
|
|
|
|
|
|
|
type_needed = ACPI_TYPE_PACKAGE;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ARGI_ANYTYPE:
|
|
|
|
|
|
|
|
/* Any operand type will do */
|
|
|
|
|
|
|
|
type_needed = ACPI_TYPE_ANY;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ARGI_DDBHANDLE:
|
|
|
|
|
|
|
|
/* Need an operand of type ACPI_TYPE_DDB_HANDLE */
|
|
|
|
|
|
|
|
type_needed = ACPI_TYPE_LOCAL_REFERENCE;
|
|
|
|
break;
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
/*
|
|
|
|
* The more complex cases allow multiple resolved object types
|
|
|
|
*/
|
2005-04-19 10:49:35 +08:00
|
|
|
case ARGI_INTEGER:
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Need an operand of type ACPI_TYPE_INTEGER,
|
|
|
|
* But we can implicitly convert from a STRING or BUFFER
|
2012-07-12 09:40:10 +08:00
|
|
|
* aka - "Implicit Source Operand Conversion"
|
2005-04-17 06:20:36 +08:00
|
|
|
*/
|
2005-08-05 12:44:28 +08:00
|
|
|
status =
|
|
|
|
acpi_ex_convert_to_integer(obj_desc, stack_ptr, 16);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
2005-04-17 06:20:36 +08:00
|
|
|
if (status == AE_TYPE) {
|
2006-01-28 05:43:00 +08:00
|
|
|
ACPI_ERROR((AE_INFO,
|
|
|
|
"Needed [Integer/String/Buffer], found [%s] %p",
|
|
|
|
acpi_ut_get_object_type_name
|
|
|
|
(obj_desc), obj_desc));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
2005-07-08 12:00:00 +08:00
|
|
|
|
|
|
|
if (obj_desc != *stack_ptr) {
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_ut_remove_reference(obj_desc);
|
2005-07-08 12:00:00 +08:00
|
|
|
}
|
2005-04-17 06:20:36 +08:00
|
|
|
goto next_operand;
|
|
|
|
|
|
|
|
case ARGI_BUFFER:
|
|
|
|
/*
|
|
|
|
* Need an operand of type ACPI_TYPE_BUFFER,
|
|
|
|
* But we can implicitly convert from a STRING or INTEGER
|
2012-07-12 09:40:10 +08:00
|
|
|
* aka - "Implicit Source Operand Conversion"
|
2005-04-17 06:20:36 +08:00
|
|
|
*/
|
2005-08-05 12:44:28 +08:00
|
|
|
status = acpi_ex_convert_to_buffer(obj_desc, stack_ptr);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
2005-04-17 06:20:36 +08:00
|
|
|
if (status == AE_TYPE) {
|
2006-01-28 05:43:00 +08:00
|
|
|
ACPI_ERROR((AE_INFO,
|
|
|
|
"Needed [Integer/String/Buffer], found [%s] %p",
|
|
|
|
acpi_ut_get_object_type_name
|
|
|
|
(obj_desc), obj_desc));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
2005-07-08 12:00:00 +08:00
|
|
|
|
|
|
|
if (obj_desc != *stack_ptr) {
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_ut_remove_reference(obj_desc);
|
2005-07-08 12:00:00 +08:00
|
|
|
}
|
2005-04-17 06:20:36 +08:00
|
|
|
goto next_operand;
|
|
|
|
|
|
|
|
case ARGI_STRING:
|
|
|
|
/*
|
|
|
|
* Need an operand of type ACPI_TYPE_STRING,
|
|
|
|
* But we can implicitly convert from a BUFFER or INTEGER
|
2012-07-12 09:40:10 +08:00
|
|
|
* aka - "Implicit Source Operand Conversion"
|
2005-04-17 06:20:36 +08:00
|
|
|
*/
|
2015-12-29 13:54:36 +08:00
|
|
|
status =
|
|
|
|
acpi_ex_convert_to_string(obj_desc, stack_ptr,
|
|
|
|
ACPI_IMPLICIT_CONVERT_HEX);
|
2005-08-05 12:44:28 +08:00
|
|
|
if (ACPI_FAILURE(status)) {
|
2005-04-17 06:20:36 +08:00
|
|
|
if (status == AE_TYPE) {
|
2006-01-28 05:43:00 +08:00
|
|
|
ACPI_ERROR((AE_INFO,
|
|
|
|
"Needed [Integer/String/Buffer], found [%s] %p",
|
|
|
|
acpi_ut_get_object_type_name
|
|
|
|
(obj_desc), obj_desc));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
2005-07-08 12:00:00 +08:00
|
|
|
|
|
|
|
if (obj_desc != *stack_ptr) {
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_ut_remove_reference(obj_desc);
|
2005-07-08 12:00:00 +08:00
|
|
|
}
|
2005-04-17 06:20:36 +08:00
|
|
|
goto next_operand;
|
|
|
|
|
|
|
|
case ARGI_COMPUTEDATA:
|
|
|
|
|
|
|
|
/* Need an operand of type INTEGER, STRING or BUFFER */
|
|
|
|
|
2009-02-18 14:44:03 +08:00
|
|
|
switch (obj_desc->common.type) {
|
2005-04-17 06:20:36 +08:00
|
|
|
case ACPI_TYPE_INTEGER:
|
|
|
|
case ACPI_TYPE_STRING:
|
|
|
|
case ACPI_TYPE_BUFFER:
|
|
|
|
|
|
|
|
/* Valid operand */
|
2005-08-05 12:44:28 +08:00
|
|
|
break;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
default:
|
2006-01-28 05:43:00 +08:00
|
|
|
ACPI_ERROR((AE_INFO,
|
|
|
|
"Needed [Integer/String/Buffer], found [%s] %p",
|
|
|
|
acpi_ut_get_object_type_name
|
|
|
|
(obj_desc), obj_desc));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
goto next_operand;
|
|
|
|
|
|
|
|
case ARGI_BUFFER_OR_STRING:
|
|
|
|
|
|
|
|
/* Need an operand of type STRING or BUFFER */
|
|
|
|
|
2009-02-18 14:44:03 +08:00
|
|
|
switch (obj_desc->common.type) {
|
2005-04-17 06:20:36 +08:00
|
|
|
case ACPI_TYPE_STRING:
|
|
|
|
case ACPI_TYPE_BUFFER:
|
|
|
|
|
|
|
|
/* Valid operand */
|
2005-08-05 12:44:28 +08:00
|
|
|
break;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
case ACPI_TYPE_INTEGER:
|
|
|
|
|
|
|
|
/* Highest priority conversion is to type Buffer */
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
status =
|
|
|
|
acpi_ex_convert_to_buffer(obj_desc,
|
|
|
|
stack_ptr);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
2005-07-08 12:00:00 +08:00
|
|
|
|
|
|
|
if (obj_desc != *stack_ptr) {
|
2005-08-05 12:44:28 +08:00
|
|
|
acpi_ut_remove_reference(obj_desc);
|
2005-07-08 12:00:00 +08:00
|
|
|
}
|
2005-04-17 06:20:36 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2006-01-28 05:43:00 +08:00
|
|
|
ACPI_ERROR((AE_INFO,
|
|
|
|
"Needed [Integer/String/Buffer], found [%s] %p",
|
|
|
|
acpi_ut_get_object_type_name
|
|
|
|
(obj_desc), obj_desc));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
goto next_operand;
|
|
|
|
|
|
|
|
case ARGI_DATAOBJECT:
|
|
|
|
/*
|
|
|
|
* ARGI_DATAOBJECT is only used by the size_of operator.
|
|
|
|
* Need a buffer, string, package, or ref_of reference.
|
|
|
|
*
|
|
|
|
* The only reference allowed here is a direct reference to
|
|
|
|
* a namespace node.
|
|
|
|
*/
|
2009-02-18 14:44:03 +08:00
|
|
|
switch (obj_desc->common.type) {
|
2005-04-17 06:20:36 +08:00
|
|
|
case ACPI_TYPE_PACKAGE:
|
|
|
|
case ACPI_TYPE_STRING:
|
|
|
|
case ACPI_TYPE_BUFFER:
|
|
|
|
case ACPI_TYPE_LOCAL_REFERENCE:
|
|
|
|
|
|
|
|
/* Valid operand */
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2013-06-08 08:58:14 +08:00
|
|
|
|
2006-01-28 05:43:00 +08:00
|
|
|
ACPI_ERROR((AE_INFO,
|
|
|
|
"Needed [Buffer/String/Package/Reference], found [%s] %p",
|
|
|
|
acpi_ut_get_object_type_name
|
|
|
|
(obj_desc), obj_desc));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
goto next_operand;
|
|
|
|
|
|
|
|
case ARGI_COMPLEXOBJ:
|
|
|
|
|
|
|
|
/* Need a buffer or package or (ACPI 2.0) String */
|
|
|
|
|
2009-02-18 14:44:03 +08:00
|
|
|
switch (obj_desc->common.type) {
|
2005-04-17 06:20:36 +08:00
|
|
|
case ACPI_TYPE_PACKAGE:
|
|
|
|
case ACPI_TYPE_STRING:
|
|
|
|
case ACPI_TYPE_BUFFER:
|
|
|
|
|
|
|
|
/* Valid operand */
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2013-06-08 08:58:14 +08:00
|
|
|
|
2006-01-28 05:43:00 +08:00
|
|
|
ACPI_ERROR((AE_INFO,
|
|
|
|
"Needed [Buffer/String/Package], found [%s] %p",
|
|
|
|
acpi_ut_get_object_type_name
|
|
|
|
(obj_desc), obj_desc));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
goto next_operand;
|
|
|
|
|
2007-02-03 00:48:22 +08:00
|
|
|
case ARGI_REGION_OR_BUFFER: /* Used by Load() only */
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2015-12-29 13:54:36 +08:00
|
|
|
/*
|
|
|
|
* Need an operand of type REGION or a BUFFER
|
|
|
|
* (which could be a resolved region field)
|
|
|
|
*/
|
2009-02-18 14:44:03 +08:00
|
|
|
switch (obj_desc->common.type) {
|
2007-02-03 00:48:22 +08:00
|
|
|
case ACPI_TYPE_BUFFER:
|
2005-04-17 06:20:36 +08:00
|
|
|
case ACPI_TYPE_REGION:
|
|
|
|
|
|
|
|
/* Valid operand */
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2013-06-08 08:58:14 +08:00
|
|
|
|
2006-01-28 05:43:00 +08:00
|
|
|
ACPI_ERROR((AE_INFO,
|
2007-02-03 00:48:22 +08:00
|
|
|
"Needed [Region/Buffer], found [%s] %p",
|
2006-01-28 05:43:00 +08:00
|
|
|
acpi_ut_get_object_type_name
|
|
|
|
(obj_desc), obj_desc));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
goto next_operand;
|
|
|
|
|
|
|
|
case ARGI_DATAREFOBJ:
|
|
|
|
|
|
|
|
/* Used by the Store() operator only */
|
|
|
|
|
2009-02-18 14:44:03 +08:00
|
|
|
switch (obj_desc->common.type) {
|
2005-04-17 06:20:36 +08:00
|
|
|
case ACPI_TYPE_INTEGER:
|
|
|
|
case ACPI_TYPE_PACKAGE:
|
|
|
|
case ACPI_TYPE_STRING:
|
|
|
|
case ACPI_TYPE_BUFFER:
|
|
|
|
case ACPI_TYPE_BUFFER_FIELD:
|
|
|
|
case ACPI_TYPE_LOCAL_REFERENCE:
|
|
|
|
case ACPI_TYPE_LOCAL_REGION_FIELD:
|
|
|
|
case ACPI_TYPE_LOCAL_BANK_FIELD:
|
|
|
|
case ACPI_TYPE_LOCAL_INDEX_FIELD:
|
|
|
|
case ACPI_TYPE_DDB_HANDLE:
|
|
|
|
|
|
|
|
/* Valid operand */
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
if (acpi_gbl_enable_interpreter_slack) {
|
|
|
|
/*
|
2015-12-29 13:54:36 +08:00
|
|
|
* Enable original behavior of Store(), allowing any
|
|
|
|
* and all objects as the source operand. The ACPI
|
|
|
|
* spec does not allow this, however.
|
2005-04-17 06:20:36 +08:00
|
|
|
*/
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2005-04-19 10:49:35 +08:00
|
|
|
if (target_op == AML_DEBUG_OP) {
|
2006-10-02 12:00:00 +08:00
|
|
|
|
2005-04-19 10:49:35 +08:00
|
|
|
/* Allow store of any object to the Debug object */
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2006-01-28 05:43:00 +08:00
|
|
|
ACPI_ERROR((AE_INFO,
|
2015-12-29 13:54:36 +08:00
|
|
|
"Needed Integer/Buffer/String/Package/Ref/Ddb]"
|
|
|
|
", found [%s] %p",
|
2006-01-28 05:43:00 +08:00
|
|
|
acpi_ut_get_object_type_name
|
|
|
|
(obj_desc), obj_desc));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
goto next_operand;
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
/* Unknown type */
|
|
|
|
|
2006-01-28 05:43:00 +08:00
|
|
|
ACPI_ERROR((AE_INFO,
|
2010-03-05 17:56:40 +08:00
|
|
|
"Internal - Unknown ARGI (required operand) type 0x%X",
|
2006-01-28 05:43:00 +08:00
|
|
|
this_arg_type));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Make sure that the original object was resolved to the
|
|
|
|
* required object type (Simple cases only).
|
|
|
|
*/
|
2015-12-29 13:54:36 +08:00
|
|
|
status =
|
|
|
|
acpi_ex_check_object_type(type_needed,
|
|
|
|
(*stack_ptr)->common.type,
|
|
|
|
*stack_ptr);
|
2005-08-05 12:44:28 +08:00
|
|
|
if (ACPI_FAILURE(status)) {
|
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2013-10-29 09:30:02 +08:00
|
|
|
next_operand:
|
2005-04-17 06:20:36 +08:00
|
|
|
/*
|
|
|
|
* If more operands needed, decrement stack_ptr to point
|
|
|
|
* to next operand on stack
|
|
|
|
*/
|
2005-08-05 12:44:28 +08:00
|
|
|
if (GET_CURRENT_ARG_TYPE(arg_types)) {
|
2005-04-17 06:20:36 +08:00
|
|
|
stack_ptr--;
|
|
|
|
}
|
2005-04-19 10:49:35 +08:00
|
|
|
}
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2008-06-10 14:25:05 +08:00
|
|
|
ACPI_DUMP_OPERANDS(walk_state->operands,
|
|
|
|
acpi_ps_get_opcode_name(opcode),
|
|
|
|
walk_state->num_operands);
|
|
|
|
|
2005-08-05 12:44:28 +08:00
|
|
|
return_ACPI_STATUS(status);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|