Source
x
// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0
/******************************************************************************
*
* Module Name: exresop - AML Interpreter operand/object resolution
*
* Copyright (C) 2000 - 2019, Intel Corp.
*
*****************************************************************************/
ACPI_MODULE_NAME("exresop")
/* Local prototypes */
static acpi_status
acpi_ex_check_object_type(acpi_object_type type_needed,
acpi_object_type this_type, void *object);
/*******************************************************************************
*
* 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
*
******************************************************************************/
static acpi_status
acpi_ex_check_object_type(acpi_object_type type_needed,
acpi_object_type this_type, void *object)
{
ACPI_FUNCTION_ENTRY();
if (type_needed == ACPI_TYPE_ANY) {
/* 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
* objects and thus allow them to be targets. (As per the ACPI
* specification, a store to a constant is a noop.)
*/
if ((this_type == ACPI_TYPE_INTEGER) &&
(((union acpi_operand_object *)object)->common.flags &
AOPOBJ_AML_CONSTANT)) {
return (AE_OK);
}
}
if (type_needed != this_type) {
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));
return (AE_AML_OPERAND_TYPE);
}
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_resolve_operands
*
* PARAMETERS: opcode - Opcode being interpreted
* 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