2018-03-14 23:13:07 +00:00
|
|
|
// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0
|
2005-04-16 22:20:36 +00:00
|
|
|
/******************************************************************************
|
|
|
|
*
|
2012-08-22 10:11:26 +00:00
|
|
|
* Module Name: dsopcode - Dispatcher support for regions and fields
|
2005-04-16 22:20:36 +00:00
|
|
|
*
|
2021-01-15 18:48:25 +00:00
|
|
|
* Copyright (C) 2000 - 2021, Intel Corp.
|
2005-04-16 22:20:36 +00:00
|
|
|
*
|
2018-03-14 23:13:07 +00:00
|
|
|
*****************************************************************************/
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
#include <acpi/acpi.h>
|
2009-01-09 05:30:03 +00:00
|
|
|
#include "accommon.h"
|
|
|
|
#include "acparser.h"
|
|
|
|
#include "amlcode.h"
|
|
|
|
#include "acdispat.h"
|
|
|
|
#include "acinterp.h"
|
|
|
|
#include "acnamesp.h"
|
|
|
|
#include "acevents.h"
|
|
|
|
#include "actables.h"
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
#define _COMPONENT ACPI_DISPATCHER
|
2005-08-05 04:44:28 +00:00
|
|
|
ACPI_MODULE_NAME("dsopcode")
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2005-04-19 02:49:35 +00:00
|
|
|
/* Local prototypes */
|
|
|
|
static acpi_status
|
2005-08-05 04:44:28 +00:00
|
|
|
acpi_ds_init_buffer_field(u16 aml_opcode,
|
|
|
|
union acpi_operand_object *obj_desc,
|
|
|
|
union acpi_operand_object *buffer_desc,
|
|
|
|
union acpi_operand_object *offset_desc,
|
|
|
|
union acpi_operand_object *length_desc,
|
|
|
|
union acpi_operand_object *result_desc);
|
2005-04-19 02:49:35 +00:00
|
|
|
|
|
|
|
/*******************************************************************************
|
2005-04-16 22:20:36 +00:00
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ds_initialize_region
|
|
|
|
*
|
2005-04-19 02:49:35 +00:00
|
|
|
* PARAMETERS: obj_handle - Region namespace node
|
2005-04-16 22:20:36 +00:00
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Front end to ev_initialize_region
|
|
|
|
*
|
2005-04-19 02:49:35 +00:00
|
|
|
******************************************************************************/
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
acpi_status acpi_ds_initialize_region(acpi_handle obj_handle)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2005-08-05 04:44:28 +00:00
|
|
|
union acpi_operand_object *obj_desc;
|
|
|
|
acpi_status status;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
obj_desc = acpi_ns_get_attached_object(obj_handle);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/* Namespace is NOT locked */
|
|
|
|
|
2016-11-30 07:21:12 +00:00
|
|
|
status = acpi_ev_initialize_region(obj_desc);
|
2005-04-16 22:20:36 +00:00
|
|
|
return (status);
|
|
|
|
}
|
|
|
|
|
2005-04-19 02:49:35 +00:00
|
|
|
/*******************************************************************************
|
2005-04-16 22:20:36 +00:00
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ds_init_buffer_field
|
|
|
|
*
|
|
|
|
* PARAMETERS: aml_opcode - create_xxx_field
|
|
|
|
* obj_desc - buffer_field object
|
|
|
|
* buffer_desc - Host Buffer
|
|
|
|
* offset_desc - Offset into buffer
|
2005-04-19 02:49:35 +00:00
|
|
|
* length_desc - Length of field (CREATE_FIELD_OP only)
|
|
|
|
* result_desc - Where to store the result
|
2005-04-16 22:20:36 +00:00
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Perform actual initialization of a buffer field
|
|
|
|
*
|
2005-04-19 02:49:35 +00:00
|
|
|
******************************************************************************/
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2005-04-19 02:49:35 +00:00
|
|
|
static acpi_status
|
2005-08-05 04:44:28 +00:00
|
|
|
acpi_ds_init_buffer_field(u16 aml_opcode,
|
|
|
|
union acpi_operand_object *obj_desc,
|
|
|
|
union acpi_operand_object *buffer_desc,
|
|
|
|
union acpi_operand_object *offset_desc,
|
|
|
|
union acpi_operand_object *length_desc,
|
|
|
|
union acpi_operand_object *result_desc)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2005-08-05 04:44:28 +00:00
|
|
|
u32 offset;
|
|
|
|
u32 bit_offset;
|
|
|
|
u32 bit_count;
|
|
|
|
u8 field_flags;
|
|
|
|
acpi_status status;
|
2005-04-16 22:20:36 +00: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 21:15:00 +00:00
|
|
|
ACPI_FUNCTION_TRACE_PTR(ds_init_buffer_field, obj_desc);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/* Host object must be a Buffer */
|
|
|
|
|
2009-02-18 06:44:03 +00:00
|
|
|
if (buffer_desc->common.type != ACPI_TYPE_BUFFER) {
|
2006-01-27 21:43:00 +00:00
|
|
|
ACPI_ERROR((AE_INFO,
|
|
|
|
"Target of Create Field is not a Buffer object - %s",
|
|
|
|
acpi_ut_get_object_type_name(buffer_desc)));
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
status = AE_AML_OPERAND_TYPE;
|
|
|
|
goto cleanup;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The last parameter to all of these opcodes (result_desc) started
|
|
|
|
* out as a name_string, and should therefore now be a NS node
|
|
|
|
* after resolution in acpi_ex_resolve_operands().
|
|
|
|
*/
|
2005-08-05 04:44:28 +00:00
|
|
|
if (ACPI_GET_DESCRIPTOR_TYPE(result_desc) != ACPI_DESC_TYPE_NAMED) {
|
2006-01-27 21:43:00 +00:00
|
|
|
ACPI_ERROR((AE_INFO,
|
|
|
|
"(%s) destination not a NS Node [%s]",
|
|
|
|
acpi_ps_get_opcode_name(aml_opcode),
|
|
|
|
acpi_ut_get_descriptor_name(result_desc)));
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
status = AE_AML_OPERAND_TYPE;
|
|
|
|
goto cleanup;
|
|
|
|
}
|
|
|
|
|
|
|
|
offset = (u32) offset_desc->integer.value;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Setup the Bit offsets and counts, according to the opcode
|
|
|
|
*/
|
|
|
|
switch (aml_opcode) {
|
|
|
|
case AML_CREATE_FIELD_OP:
|
|
|
|
|
|
|
|
/* Offset is in bits, count is in bits */
|
|
|
|
|
2005-04-19 02:49:35 +00:00
|
|
|
field_flags = AML_FIELD_ACCESS_BYTE;
|
2005-04-16 22:20:36 +00:00
|
|
|
bit_offset = offset;
|
2005-08-05 04:44:28 +00:00
|
|
|
bit_count = (u32) length_desc->integer.value;
|
2005-04-19 02:49:35 +00:00
|
|
|
|
|
|
|
/* Must have a valid (>0) bit count */
|
|
|
|
|
|
|
|
if (bit_count == 0) {
|
2019-01-14 17:55:23 +00:00
|
|
|
ACPI_BIOS_ERROR((AE_INFO,
|
|
|
|
"Attempt to CreateField of length zero"));
|
2005-04-19 02:49:35 +00:00
|
|
|
status = AE_AML_OPERAND_VALUE;
|
|
|
|
goto cleanup;
|
|
|
|
}
|
2005-04-16 22:20:36 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case AML_CREATE_BIT_FIELD_OP:
|
|
|
|
|
|
|
|
/* Offset is in bits, Field is one bit */
|
|
|
|
|
|
|
|
bit_offset = offset;
|
2005-08-05 04:44:28 +00:00
|
|
|
bit_count = 1;
|
2005-04-16 22:20:36 +00:00
|
|
|
field_flags = AML_FIELD_ACCESS_BYTE;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case AML_CREATE_BYTE_FIELD_OP:
|
|
|
|
|
|
|
|
/* Offset is in bytes, field is one byte */
|
|
|
|
|
|
|
|
bit_offset = 8 * offset;
|
2005-08-05 04:44:28 +00:00
|
|
|
bit_count = 8;
|
2005-04-16 22:20:36 +00:00
|
|
|
field_flags = AML_FIELD_ACCESS_BYTE;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case AML_CREATE_WORD_FIELD_OP:
|
|
|
|
|
|
|
|
/* Offset is in bytes, field is one word */
|
|
|
|
|
|
|
|
bit_offset = 8 * offset;
|
2005-08-05 04:44:28 +00:00
|
|
|
bit_count = 16;
|
2005-04-16 22:20:36 +00:00
|
|
|
field_flags = AML_FIELD_ACCESS_WORD;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case AML_CREATE_DWORD_FIELD_OP:
|
|
|
|
|
|
|
|
/* Offset is in bytes, field is one dword */
|
|
|
|
|
|
|
|
bit_offset = 8 * offset;
|
2005-08-05 04:44:28 +00:00
|
|
|
bit_count = 32;
|
2005-04-16 22:20:36 +00:00
|
|
|
field_flags = AML_FIELD_ACCESS_DWORD;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case AML_CREATE_QWORD_FIELD_OP:
|
|
|
|
|
|
|
|
/* Offset is in bytes, field is one qword */
|
|
|
|
|
|
|
|
bit_offset = 8 * offset;
|
2005-08-05 04:44:28 +00:00
|
|
|
bit_count = 64;
|
2005-04-16 22:20:36 +00:00
|
|
|
field_flags = AML_FIELD_ACCESS_QWORD;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
2006-01-27 21:43:00 +00:00
|
|
|
ACPI_ERROR((AE_INFO,
|
2010-03-05 09:56:40 +00:00
|
|
|
"Unknown field creation opcode 0x%02X",
|
|
|
|
aml_opcode));
|
2005-04-16 22:20:36 +00:00
|
|
|
status = AE_AML_BAD_OPCODE;
|
|
|
|
goto cleanup;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Entire field must fit within the current length of the buffer */
|
|
|
|
|
2017-06-05 08:40:08 +00:00
|
|
|
if ((bit_offset + bit_count) > (8 * (u32)buffer_desc->buffer.length)) {
|
2005-04-16 22:20:36 +00:00
|
|
|
status = AE_AML_BUFFER_LIMIT;
|
2019-01-14 17:55:23 +00:00
|
|
|
ACPI_BIOS_EXCEPTION((AE_INFO, status,
|
|
|
|
"Field [%4.4s] at bit offset/length %u/%u "
|
|
|
|
"exceeds size of target Buffer (%u bits)",
|
|
|
|
acpi_ut_get_node_name(result_desc),
|
|
|
|
bit_offset, bit_count,
|
|
|
|
8 * (u32)buffer_desc->buffer.length));
|
2005-04-16 22:20:36 +00:00
|
|
|
goto cleanup;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Initialize areas of the field object that are common to all fields
|
2005-04-19 02:49:35 +00:00
|
|
|
* For field_flags, use LOCK_RULE = 0 (NO_LOCK),
|
|
|
|
* UPDATE_RULE = 0 (UPDATE_PRESERVE)
|
2005-04-16 22:20:36 +00:00
|
|
|
*/
|
2015-12-29 05:54:36 +00:00
|
|
|
status =
|
|
|
|
acpi_ex_prep_common_field_object(obj_desc, field_flags, 0,
|
|
|
|
bit_offset, bit_count);
|
2005-08-05 04:44:28 +00:00
|
|
|
if (ACPI_FAILURE(status)) {
|
2005-04-16 22:20:36 +00:00
|
|
|
goto cleanup;
|
|
|
|
}
|
|
|
|
|
|
|
|
obj_desc->buffer_field.buffer_obj = buffer_desc;
|
ACPICA: Dispatcher: always generate buffer objects for ASL create_field() operator
ACPICA commit 79a466b64e6af36cc83102f05915e56cb7dd89ab
According to table 19-419 of the ACPI 6.3 specification, buffer_fields
created using the ASL create_field() Operator have been treated as
integers if the buffer_field is small enough to fit inside of an ASL
integer (32-bits or 64-bits depending on the definition block
revision). If they are larger, buffer fields are treated as ASL
Buffer objects. However, this is not true for other AML interpreter
implementations.
It has been discovered that other AML interpreters always treat
buffer fields created by create_field() as a buffer regardless of the
length of the buffer field.
More specifically, the Microsoft AML interpreter always treats buffer
fields created by the create_field() operator as buffer. ACPICA
currently does this only when the field size is larger than the
maximum integer width. This causes problems with AML code shipped in
Microsoft Surface devices.
More details:
The control methods in these devices determine the success of an ASL
control method execution by examining the type resulting from storing
a buffer field created by a create_field() operator. On success, a
Buffer object is expected, on failure an Integer containing an error
code. This buffer object is created with a dynamic size via the
create_field() operator. Due to the difference in behavior, Buffer
values of small size are however converted to Integers and thus
interpreted by the control method as having failed, whereas in
reality it succeeded. Below is an example of a control method called
TEST that illustrates this behavior.
Method (CBUF) // Create a Buffer field
{
/*
* Depending on the value of RAND, ACPICA interpreter will treat
* BF00 as an integer or buffer.
*/
create_field (BUFF, 0, RAND, BF00)
return (BF00)
}
Method (TEST)
{
/*
* Storing the value returned by CBUF to local0 will result in
* implicit type conversion outlined in the ACPI specification.
*
* ACPICA will treat local0 like an ASL integer if RAND is less
* than or equal to 64 or 32 (depending on the definition_block
* revision). If RAND is greater, it will be treated like an ASL
* buffer. Other implementations treat local0 like an ASL buffer
* regardless of the value of RAND.
*/
local0 = CBUF()
/*
* object_type of 0x03 represents an ASL Buffer
*/
if (object_type (Local0) != 0x03)
{
// Error on ACPICA if RAND is small enough
}
else
{
/*
* Success on APICA if RAND is large enough
* Other implementations always take this path because local0
* is always treated as a buffer.
*/
}
}
This change prohibits the previously mentioned integer conversion to
match other AML interpreter implementations (Microsoft) that do not
conform to the ACPI specification.
Link: https://github.com/acpica/acpica/commit/79a466b6
Signed-off-by: Maximilian Luz <luzmaximilian@gmail.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>
2019-12-17 19:35:22 +00:00
|
|
|
obj_desc->buffer_field.is_create_field =
|
|
|
|
aml_opcode == AML_CREATE_FIELD_OP;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/* Reference count for buffer_desc inherits obj_desc count */
|
|
|
|
|
2005-04-19 02:49:35 +00:00
|
|
|
buffer_desc->common.reference_count = (u16)
|
2005-08-05 04:44:28 +00:00
|
|
|
(buffer_desc->common.reference_count +
|
|
|
|
obj_desc->common.reference_count);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2013-10-29 01:30:02 +00:00
|
|
|
cleanup:
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/* Always delete the operands */
|
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
acpi_ut_remove_reference(offset_desc);
|
|
|
|
acpi_ut_remove_reference(buffer_desc);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
if (aml_opcode == AML_CREATE_FIELD_OP) {
|
2005-08-05 04:44:28 +00:00
|
|
|
acpi_ut_remove_reference(length_desc);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* On failure, delete the result descriptor */
|
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
if (ACPI_FAILURE(status)) {
|
|
|
|
acpi_ut_remove_reference(result_desc); /* Result descriptor */
|
|
|
|
} else {
|
2005-04-16 22:20:36 +00:00
|
|
|
/* Now the address and length are valid for this buffer_field */
|
|
|
|
|
|
|
|
obj_desc->buffer_field.flags |= AOPOBJ_DATA_VALID;
|
|
|
|
}
|
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
return_ACPI_STATUS(status);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
2005-04-19 02:49:35 +00:00
|
|
|
/*******************************************************************************
|
2005-04-16 22:20:36 +00:00
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ds_eval_buffer_field_operands
|
|
|
|
*
|
|
|
|
* PARAMETERS: walk_state - Current walk
|
2012-07-12 01:40:10 +00:00
|
|
|
* op - A valid buffer_field Op object
|
2005-04-16 22:20:36 +00:00
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Get buffer_field Buffer and Index
|
|
|
|
* Called from acpi_ds_exec_end_op during buffer_field parse tree walk
|
|
|
|
*
|
2005-04-19 02:49:35 +00:00
|
|
|
******************************************************************************/
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
acpi_status
|
2005-08-05 04:44:28 +00:00
|
|
|
acpi_ds_eval_buffer_field_operands(struct acpi_walk_state *walk_state,
|
|
|
|
union acpi_parse_object *op)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2005-08-05 04:44:28 +00:00
|
|
|
acpi_status status;
|
|
|
|
union acpi_operand_object *obj_desc;
|
|
|
|
struct acpi_namespace_node *node;
|
|
|
|
union acpi_parse_object *next_op;
|
2005-04-16 22:20:36 +00: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 21:15:00 +00:00
|
|
|
ACPI_FUNCTION_TRACE_PTR(ds_eval_buffer_field_operands, op);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* This is where we evaluate the address and length fields of the
|
|
|
|
* create_xxx_field declaration
|
|
|
|
*/
|
2005-08-05 04:44:28 +00:00
|
|
|
node = op->common.node;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/* next_op points to the op that holds the Buffer */
|
|
|
|
|
|
|
|
next_op = op->common.value.arg;
|
|
|
|
|
|
|
|
/* Evaluate/create the address and length operands */
|
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
status = acpi_ds_create_operands(walk_state, next_op);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
|
|
|
return_ACPI_STATUS(status);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
obj_desc = acpi_ns_get_attached_object(node);
|
2005-04-16 22:20:36 +00:00
|
|
|
if (!obj_desc) {
|
2005-08-05 04:44:28 +00:00
|
|
|
return_ACPI_STATUS(AE_NOT_EXIST);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Resolve the operands */
|
|
|
|
|
2015-12-29 05:54:36 +00:00
|
|
|
status =
|
|
|
|
acpi_ex_resolve_operands(op->common.aml_opcode, ACPI_WALK_OPERANDS,
|
|
|
|
walk_state);
|
2005-08-05 04:44:28 +00:00
|
|
|
if (ACPI_FAILURE(status)) {
|
2010-03-05 09:56:40 +00:00
|
|
|
ACPI_ERROR((AE_INFO, "(%s) bad operand(s), status 0x%X",
|
2006-01-27 21:43:00 +00:00
|
|
|
acpi_ps_get_opcode_name(op->common.aml_opcode),
|
|
|
|
status));
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
return_ACPI_STATUS(status);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Initialize the Buffer Field */
|
|
|
|
|
|
|
|
if (op->common.aml_opcode == AML_CREATE_FIELD_OP) {
|
2006-10-02 04:00:00 +00:00
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
/* NOTE: Slightly different operands for this opcode */
|
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
status =
|
|
|
|
acpi_ds_init_buffer_field(op->common.aml_opcode, obj_desc,
|
|
|
|
walk_state->operands[0],
|
|
|
|
walk_state->operands[1],
|
|
|
|
walk_state->operands[2],
|
|
|
|
walk_state->operands[3]);
|
|
|
|
} else {
|
2005-04-16 22:20:36 +00:00
|
|
|
/* All other, create_xxx_field opcodes */
|
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
status =
|
|
|
|
acpi_ds_init_buffer_field(op->common.aml_opcode, obj_desc,
|
|
|
|
walk_state->operands[0],
|
|
|
|
walk_state->operands[1], NULL,
|
|
|
|
walk_state->operands[2]);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
return_ACPI_STATUS(status);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
2005-04-19 02:49:35 +00:00
|
|
|
/*******************************************************************************
|
2005-04-16 22:20:36 +00:00
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ds_eval_region_operands
|
|
|
|
*
|
|
|
|
* PARAMETERS: walk_state - Current walk
|
2012-07-12 01:40:10 +00:00
|
|
|
* op - A valid region Op object
|
2005-04-16 22:20:36 +00:00
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Get region address and length
|
|
|
|
* Called from acpi_ds_exec_end_op during op_region parse tree walk
|
|
|
|
*
|
2005-04-19 02:49:35 +00:00
|
|
|
******************************************************************************/
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
acpi_status
|
2005-08-05 04:44:28 +00:00
|
|
|
acpi_ds_eval_region_operands(struct acpi_walk_state *walk_state,
|
|
|
|
union acpi_parse_object *op)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2005-08-05 04:44:28 +00:00
|
|
|
acpi_status status;
|
|
|
|
union acpi_operand_object *obj_desc;
|
|
|
|
union acpi_operand_object *operand_desc;
|
|
|
|
struct acpi_namespace_node *node;
|
|
|
|
union acpi_parse_object *next_op;
|
2019-02-15 21:36:07 +00:00
|
|
|
acpi_adr_space_type space_id;
|
2005-04-16 22:20:36 +00: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 21:15:00 +00:00
|
|
|
ACPI_FUNCTION_TRACE_PTR(ds_eval_region_operands, op);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/*
|
2005-04-19 02:49:35 +00:00
|
|
|
* This is where we evaluate the address and length fields of the
|
|
|
|
* op_region declaration
|
2005-04-16 22:20:36 +00:00
|
|
|
*/
|
2005-08-05 04:44:28 +00:00
|
|
|
node = op->common.node;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2012-07-12 01:40:10 +00:00
|
|
|
/* next_op points to the op that holds the space_ID */
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
next_op = op->common.value.arg;
|
2019-02-15 21:36:07 +00:00
|
|
|
space_id = (acpi_adr_space_type)next_op->common.value.integer;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/* next_op points to address op */
|
|
|
|
|
|
|
|
next_op = next_op->common.next;
|
|
|
|
|
|
|
|
/* Evaluate/create the address and length operands */
|
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
status = acpi_ds_create_operands(walk_state, next_op);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
|
|
|
return_ACPI_STATUS(status);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Resolve the length and address operands to numbers */
|
|
|
|
|
2015-12-29 05:54:36 +00:00
|
|
|
status =
|
|
|
|
acpi_ex_resolve_operands(op->common.aml_opcode, ACPI_WALK_OPERANDS,
|
|
|
|
walk_state);
|
2005-08-05 04:44:28 +00:00
|
|
|
if (ACPI_FAILURE(status)) {
|
|
|
|
return_ACPI_STATUS(status);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
obj_desc = acpi_ns_get_attached_object(node);
|
2005-04-16 22:20:36 +00:00
|
|
|
if (!obj_desc) {
|
2005-08-05 04:44:28 +00:00
|
|
|
return_ACPI_STATUS(AE_NOT_EXIST);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Get the length operand and save it
|
|
|
|
* (at Top of stack)
|
|
|
|
*/
|
|
|
|
operand_desc = walk_state->operands[walk_state->num_operands - 1];
|
|
|
|
|
|
|
|
obj_desc->region.length = (u32) operand_desc->integer.value;
|
2005-08-05 04:44:28 +00:00
|
|
|
acpi_ut_remove_reference(operand_desc);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2019-02-15 21:36:07 +00:00
|
|
|
/* A zero-length operation region is unusable. Just warn */
|
|
|
|
|
|
|
|
if (!obj_desc->region.length
|
|
|
|
&& (space_id < ACPI_NUM_PREDEFINED_REGIONS)) {
|
|
|
|
ACPI_WARNING((AE_INFO,
|
|
|
|
"Operation Region [%4.4s] has zero length (SpaceId %X)",
|
|
|
|
node->name.ascii, space_id));
|
|
|
|
}
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
/*
|
|
|
|
* Get the address and save it
|
|
|
|
* (at top of stack - 1)
|
|
|
|
*/
|
|
|
|
operand_desc = walk_state->operands[walk_state->num_operands - 2];
|
|
|
|
|
2005-04-19 02:49:35 +00:00
|
|
|
obj_desc->region.address = (acpi_physical_address)
|
2005-08-05 04:44:28 +00:00
|
|
|
operand_desc->integer.value;
|
|
|
|
acpi_ut_remove_reference(operand_desc);
|
2005-04-16 22:20:36 +00: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 21:15:00 +00:00
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "RgnObj %p Addr %8.8X%8.8X Len %X\n",
|
2005-08-05 04:44:28 +00:00
|
|
|
obj_desc,
|
2015-04-13 03:48:52 +00:00
|
|
|
ACPI_FORMAT_UINT64(obj_desc->region.address),
|
2005-08-05 04:44:28 +00:00
|
|
|
obj_desc->region.length));
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2018-10-17 21:09:35 +00:00
|
|
|
status = acpi_ut_add_address_range(obj_desc->region.space_id,
|
|
|
|
obj_desc->region.address,
|
|
|
|
obj_desc->region.length, node);
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
/* Now the address and length are valid for this opregion */
|
|
|
|
|
|
|
|
obj_desc->region.flags |= AOPOBJ_DATA_VALID;
|
2005-08-05 04:44:28 +00:00
|
|
|
return_ACPI_STATUS(status);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
2008-04-10 15:06:41 +00:00
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ds_eval_table_region_operands
|
|
|
|
*
|
|
|
|
* PARAMETERS: walk_state - Current walk
|
2012-07-12 01:40:10 +00:00
|
|
|
* op - A valid region Op object
|
2008-04-10 15:06:41 +00:00
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
2011-02-14 08:09:40 +00:00
|
|
|
* DESCRIPTION: Get region address and length.
|
|
|
|
* Called from acpi_ds_exec_end_op during data_table_region parse
|
|
|
|
* tree walk.
|
2008-04-10 15:06:41 +00:00
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
acpi_status
|
|
|
|
acpi_ds_eval_table_region_operands(struct acpi_walk_state *walk_state,
|
|
|
|
union acpi_parse_object *op)
|
|
|
|
{
|
|
|
|
acpi_status status;
|
|
|
|
union acpi_operand_object *obj_desc;
|
|
|
|
union acpi_operand_object **operand;
|
|
|
|
struct acpi_namespace_node *node;
|
|
|
|
union acpi_parse_object *next_op;
|
|
|
|
struct acpi_table_header *table;
|
2015-08-25 02:28:39 +00:00
|
|
|
u32 table_index;
|
2008-04-10 15:06:41 +00:00
|
|
|
|
|
|
|
ACPI_FUNCTION_TRACE_PTR(ds_eval_table_region_operands, op);
|
|
|
|
|
|
|
|
/*
|
2012-12-19 05:36:49 +00:00
|
|
|
* This is where we evaluate the Signature string, oem_id string,
|
|
|
|
* and oem_table_id string of the Data Table Region declaration
|
2008-04-10 15:06:41 +00:00
|
|
|
*/
|
|
|
|
node = op->common.node;
|
|
|
|
|
2012-12-19 05:36:49 +00:00
|
|
|
/* next_op points to Signature string op */
|
2008-04-10 15:06:41 +00:00
|
|
|
|
|
|
|
next_op = op->common.value.arg;
|
|
|
|
|
|
|
|
/*
|
2012-12-19 05:36:49 +00:00
|
|
|
* Evaluate/create the Signature string, oem_id string,
|
|
|
|
* and oem_table_id string operands
|
2008-04-10 15:06:41 +00:00
|
|
|
*/
|
|
|
|
status = acpi_ds_create_operands(walk_state, next_op);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
|
|
|
return_ACPI_STATUS(status);
|
|
|
|
}
|
|
|
|
|
2015-08-25 02:28:39 +00:00
|
|
|
operand = &walk_state->operands[0];
|
|
|
|
|
2008-04-10 15:06:41 +00:00
|
|
|
/*
|
2012-12-19 05:36:49 +00:00
|
|
|
* Resolve the Signature string, oem_id string,
|
|
|
|
* and oem_table_id string operands
|
2008-04-10 15:06:41 +00:00
|
|
|
*/
|
2015-12-29 05:54:36 +00:00
|
|
|
status =
|
|
|
|
acpi_ex_resolve_operands(op->common.aml_opcode, ACPI_WALK_OPERANDS,
|
|
|
|
walk_state);
|
2008-04-10 15:06:41 +00:00
|
|
|
if (ACPI_FAILURE(status)) {
|
2015-08-25 02:28:39 +00:00
|
|
|
goto cleanup;
|
2008-04-10 15:06:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Find the ACPI table */
|
|
|
|
|
|
|
|
status = acpi_tb_find_table(operand[0]->string.pointer,
|
|
|
|
operand[1]->string.pointer,
|
|
|
|
operand[2]->string.pointer, &table_index);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
2015-08-25 02:28:39 +00:00
|
|
|
if (status == AE_NOT_FOUND) {
|
|
|
|
ACPI_ERROR((AE_INFO,
|
|
|
|
"ACPI Table [%4.4s] OEM:(%s, %s) not found in RSDT/XSDT",
|
|
|
|
operand[0]->string.pointer,
|
|
|
|
operand[1]->string.pointer,
|
|
|
|
operand[2]->string.pointer));
|
|
|
|
}
|
|
|
|
goto cleanup;
|
2008-04-10 15:06:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
status = acpi_get_table_by_index(table_index, &table);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
2015-08-25 02:28:39 +00:00
|
|
|
goto cleanup;
|
2008-04-10 15:06:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
obj_desc = acpi_ns_get_attached_object(node);
|
|
|
|
if (!obj_desc) {
|
2015-08-25 02:28:39 +00:00
|
|
|
status = AE_NOT_EXIST;
|
|
|
|
goto cleanup;
|
2008-04-10 15:06:41 +00:00
|
|
|
}
|
|
|
|
|
2015-04-13 03:48:37 +00:00
|
|
|
obj_desc->region.address = ACPI_PTR_TO_PHYSADDR(table);
|
2008-04-10 15:06:41 +00:00
|
|
|
obj_desc->region.length = table->length;
|
|
|
|
|
|
|
|
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "RgnObj %p Addr %8.8X%8.8X Len %X\n",
|
|
|
|
obj_desc,
|
2015-04-13 03:48:52 +00:00
|
|
|
ACPI_FORMAT_UINT64(obj_desc->region.address),
|
2008-04-10 15:06:41 +00:00
|
|
|
obj_desc->region.length));
|
|
|
|
|
|
|
|
/* Now the address and length are valid for this opregion */
|
|
|
|
|
|
|
|
obj_desc->region.flags |= AOPOBJ_DATA_VALID;
|
|
|
|
|
2015-08-25 02:28:39 +00:00
|
|
|
cleanup:
|
|
|
|
acpi_ut_remove_reference(operand[0]);
|
|
|
|
acpi_ut_remove_reference(operand[1]);
|
|
|
|
acpi_ut_remove_reference(operand[2]);
|
|
|
|
|
2008-04-10 15:06:41 +00:00
|
|
|
return_ACPI_STATUS(status);
|
|
|
|
}
|
|
|
|
|
2005-04-19 02:49:35 +00:00
|
|
|
/*******************************************************************************
|
2005-04-16 22:20:36 +00:00
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ds_eval_data_object_operands
|
|
|
|
*
|
|
|
|
* PARAMETERS: walk_state - Current walk
|
2012-07-12 01:40:10 +00:00
|
|
|
* op - A valid data_object Op object
|
2005-04-16 22:20:36 +00:00
|
|
|
* obj_desc - data_object
|
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Get the operands and complete the following data object types:
|
|
|
|
* Buffer, Package.
|
|
|
|
*
|
2005-04-19 02:49:35 +00:00
|
|
|
******************************************************************************/
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
acpi_status
|
2005-08-05 04:44:28 +00:00
|
|
|
acpi_ds_eval_data_object_operands(struct acpi_walk_state *walk_state,
|
|
|
|
union acpi_parse_object *op,
|
|
|
|
union acpi_operand_object *obj_desc)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2005-08-05 04:44:28 +00:00
|
|
|
acpi_status status;
|
|
|
|
union acpi_operand_object *arg_desc;
|
|
|
|
u32 length;
|
2005-04-16 22:20:36 +00: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 21:15:00 +00:00
|
|
|
ACPI_FUNCTION_TRACE(ds_eval_data_object_operands);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/* The first operand (for all of these data objects) is the length */
|
|
|
|
|
2008-04-10 15:06:36 +00:00
|
|
|
/*
|
|
|
|
* Set proper index into operand stack for acpi_ds_obj_stack_push
|
|
|
|
* invoked inside acpi_ds_create_operand.
|
|
|
|
*/
|
|
|
|
walk_state->operand_index = walk_state->num_operands;
|
|
|
|
|
2017-08-03 06:27:22 +00:00
|
|
|
/* Ignore if child is not valid */
|
|
|
|
|
|
|
|
if (!op->common.value.arg) {
|
|
|
|
ACPI_ERROR((AE_INFO,
|
2018-02-15 21:09:28 +00:00
|
|
|
"Missing child while evaluating opcode %4.4X, Op %p",
|
|
|
|
op->common.aml_opcode, op));
|
2017-08-03 06:27:22 +00:00
|
|
|
return_ACPI_STATUS(AE_OK);
|
|
|
|
}
|
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
status = acpi_ds_create_operand(walk_state, op->common.value.arg, 1);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
|
|
|
return_ACPI_STATUS(status);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
status = acpi_ex_resolve_operands(walk_state->opcode,
|
|
|
|
&(walk_state->
|
|
|
|
operands[walk_state->num_operands -
|
|
|
|
1]), walk_state);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
|
|
|
return_ACPI_STATUS(status);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Extract length operand */
|
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
arg_desc = walk_state->operands[walk_state->num_operands - 1];
|
2005-04-16 22:20:36 +00:00
|
|
|
length = (u32) arg_desc->integer.value;
|
|
|
|
|
|
|
|
/* Cleanup for length operand */
|
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
status = acpi_ds_obj_stack_pop(1, walk_state);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
|
|
|
return_ACPI_STATUS(status);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
acpi_ut_remove_reference(arg_desc);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Create the actual data object
|
|
|
|
*/
|
|
|
|
switch (op->common.aml_opcode) {
|
|
|
|
case AML_BUFFER_OP:
|
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
status =
|
|
|
|
acpi_ds_build_internal_buffer_obj(walk_state, op, length,
|
|
|
|
&obj_desc);
|
2005-04-16 22:20:36 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case AML_PACKAGE_OP:
|
2017-04-26 08:18:40 +00:00
|
|
|
case AML_VARIABLE_PACKAGE_OP:
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
status =
|
|
|
|
acpi_ds_build_internal_package_obj(walk_state, op, length,
|
|
|
|
&obj_desc);
|
2005-04-16 22:20:36 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2013-06-08 00:58:14 +00:00
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
return_ACPI_STATUS(AE_AML_BAD_OPCODE);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
if (ACPI_SUCCESS(status)) {
|
2005-04-16 22:20:36 +00:00
|
|
|
/*
|
2005-04-19 02:49:35 +00:00
|
|
|
* Return the object in the walk_state, unless the parent is a package -
|
2005-04-16 22:20:36 +00:00
|
|
|
* in this case, the return object will be stored in the parse tree
|
|
|
|
* for the package.
|
|
|
|
*/
|
|
|
|
if ((!op->common.parent) ||
|
2005-08-05 04:44:28 +00:00
|
|
|
((op->common.parent->common.aml_opcode != AML_PACKAGE_OP) &&
|
|
|
|
(op->common.parent->common.aml_opcode !=
|
2017-04-26 08:18:40 +00:00
|
|
|
AML_VARIABLE_PACKAGE_OP)
|
2012-10-31 02:25:45 +00:00
|
|
|
&& (op->common.parent->common.aml_opcode !=
|
|
|
|
AML_NAME_OP))) {
|
2005-04-16 22:20:36 +00:00
|
|
|
walk_state->result_obj = obj_desc;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-08-05 04:44:28 +00:00
|
|
|
return_ACPI_STATUS(status);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
2008-04-10 15:06:41 +00:00
|
|
|
/*******************************************************************************
|
|
|
|
*
|
|
|
|
* FUNCTION: acpi_ds_eval_bank_field_operands
|
|
|
|
*
|
|
|
|
* PARAMETERS: walk_state - Current walk
|
2012-07-12 01:40:10 +00:00
|
|
|
* op - A valid bank_field Op object
|
2008-04-10 15:06:41 +00:00
|
|
|
*
|
|
|
|
* RETURN: Status
|
|
|
|
*
|
|
|
|
* DESCRIPTION: Get bank_field bank_value
|
|
|
|
* Called from acpi_ds_exec_end_op during bank_field parse tree walk
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
acpi_status
|
|
|
|
acpi_ds_eval_bank_field_operands(struct acpi_walk_state *walk_state,
|
|
|
|
union acpi_parse_object *op)
|
|
|
|
{
|
|
|
|
acpi_status status;
|
|
|
|
union acpi_operand_object *obj_desc;
|
|
|
|
union acpi_operand_object *operand_desc;
|
|
|
|
struct acpi_namespace_node *node;
|
|
|
|
union acpi_parse_object *next_op;
|
|
|
|
union acpi_parse_object *arg;
|
|
|
|
|
|
|
|
ACPI_FUNCTION_TRACE_PTR(ds_eval_bank_field_operands, op);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This is where we evaluate the bank_value field of the
|
|
|
|
* bank_field declaration
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* next_op points to the op that holds the Region */
|
|
|
|
|
|
|
|
next_op = op->common.value.arg;
|
|
|
|
|
|
|
|
/* next_op points to the op that holds the Bank Register */
|
|
|
|
|
|
|
|
next_op = next_op->common.next;
|
|
|
|
|
|
|
|
/* next_op points to the op that holds the Bank Value */
|
|
|
|
|
|
|
|
next_op = next_op->common.next;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Set proper index into operand stack for acpi_ds_obj_stack_push
|
|
|
|
* invoked inside acpi_ds_create_operand.
|
|
|
|
*
|
|
|
|
* We use walk_state->Operands[0] to store the evaluated bank_value
|
|
|
|
*/
|
|
|
|
walk_state->operand_index = 0;
|
|
|
|
|
|
|
|
status = acpi_ds_create_operand(walk_state, next_op, 0);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
|
|
|
return_ACPI_STATUS(status);
|
|
|
|
}
|
|
|
|
|
|
|
|
status = acpi_ex_resolve_to_value(&walk_state->operands[0], walk_state);
|
|
|
|
if (ACPI_FAILURE(status)) {
|
|
|
|
return_ACPI_STATUS(status);
|
|
|
|
}
|
|
|
|
|
2008-06-10 06:25:05 +00:00
|
|
|
ACPI_DUMP_OPERANDS(ACPI_WALK_OPERANDS,
|
|
|
|
acpi_ps_get_opcode_name(op->common.aml_opcode), 1);
|
2008-04-10 15:06:41 +00:00
|
|
|
/*
|
|
|
|
* Get the bank_value operand and save it
|
|
|
|
* (at Top of stack)
|
|
|
|
*/
|
|
|
|
operand_desc = walk_state->operands[0];
|
|
|
|
|
|
|
|
/* Arg points to the start Bank Field */
|
|
|
|
|
|
|
|
arg = acpi_ps_get_arg(op, 4);
|
|
|
|
while (arg) {
|
|
|
|
|
|
|
|
/* Ignore OFFSET and ACCESSAS terms here */
|
|
|
|
|
|
|
|
if (arg->common.aml_opcode == AML_INT_NAMEDFIELD_OP) {
|
|
|
|
node = arg->common.node;
|
|
|
|
|
|
|
|
obj_desc = acpi_ns_get_attached_object(node);
|
|
|
|
if (!obj_desc) {
|
|
|
|
return_ACPI_STATUS(AE_NOT_EXIST);
|
|
|
|
}
|
|
|
|
|
|
|
|
obj_desc->bank_field.value =
|
|
|
|
(u32) operand_desc->integer.value;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Move to next field in the list */
|
|
|
|
|
|
|
|
arg = arg->common.next;
|
|
|
|
}
|
|
|
|
|
|
|
|
acpi_ut_remove_reference(operand_desc);
|
|
|
|
return_ACPI_STATUS(status);
|
|
|
|
}
|