ACPICA: Cleanup for internal Reference Object

Fix some sloppiness in the Reference object. No longer use AML
opcodes to differentiate the types, introduce new reference
Class. Cleanup the debug output code.

Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lin Ming <ming.m.lin@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
This commit is contained in:
Bob Moore 2008-09-27 11:08:41 +08:00 committed by Len Brown
parent 2425a0967f
commit 1044f1f65b
25 changed files with 310 additions and 292 deletions

View file

@ -43,7 +43,6 @@
#include <acpi/acpi.h> #include <acpi/acpi.h>
#include <acpi/acdispat.h> #include <acpi/acdispat.h>
#include <acpi/amlcode.h>
#include <acpi/acnamesp.h> #include <acpi/acnamesp.h>
#include <acpi/acinterp.h> #include <acpi/acinterp.h>
@ -52,11 +51,11 @@ ACPI_MODULE_NAME("dsmthdat")
/* Local prototypes */ /* Local prototypes */
static void static void
acpi_ds_method_data_delete_value(u16 opcode, acpi_ds_method_data_delete_value(u8 type,
u32 index, struct acpi_walk_state *walk_state); u32 index, struct acpi_walk_state *walk_state);
static acpi_status static acpi_status
acpi_ds_method_data_set_value(u16 opcode, acpi_ds_method_data_set_value(u8 type,
u32 index, u32 index,
union acpi_operand_object *object, union acpi_operand_object *object,
struct acpi_walk_state *walk_state); struct acpi_walk_state *walk_state);
@ -216,7 +215,7 @@ acpi_ds_method_data_init_args(union acpi_operand_object **params,
* Store the argument in the method/walk descriptor. * Store the argument in the method/walk descriptor.
* Do not copy the arg in order to implement call by reference * Do not copy the arg in order to implement call by reference
*/ */
status = acpi_ds_method_data_set_value(AML_ARG_OP, index, status = acpi_ds_method_data_set_value(ACPI_REFCLASS_ARG, index,
params[index], params[index],
walk_state); walk_state);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
@ -234,7 +233,8 @@ acpi_ds_method_data_init_args(union acpi_operand_object **params,
* *
* FUNCTION: acpi_ds_method_data_get_node * FUNCTION: acpi_ds_method_data_get_node
* *
* PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP * PARAMETERS: Type - Either ACPI_REFCLASS_LOCAL or
* ACPI_REFCLASS_ARG
* Index - Which Local or Arg whose type to get * Index - Which Local or Arg whose type to get
* walk_state - Current walk state object * walk_state - Current walk state object
* Node - Where the node is returned. * Node - Where the node is returned.
@ -246,7 +246,7 @@ acpi_ds_method_data_init_args(union acpi_operand_object **params,
******************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_ds_method_data_get_node(u16 opcode, acpi_ds_method_data_get_node(u8 type,
u32 index, u32 index,
struct acpi_walk_state *walk_state, struct acpi_walk_state *walk_state,
struct acpi_namespace_node **node) struct acpi_namespace_node **node)
@ -256,8 +256,8 @@ acpi_ds_method_data_get_node(u16 opcode,
/* /*
* Method Locals and Arguments are supported * Method Locals and Arguments are supported
*/ */
switch (opcode) { switch (type) {
case AML_LOCAL_OP: case ACPI_REFCLASS_LOCAL:
if (index > ACPI_METHOD_MAX_LOCAL) { if (index > ACPI_METHOD_MAX_LOCAL) {
ACPI_ERROR((AE_INFO, ACPI_ERROR((AE_INFO,
@ -271,7 +271,7 @@ acpi_ds_method_data_get_node(u16 opcode,
*node = &walk_state->local_variables[index]; *node = &walk_state->local_variables[index];
break; break;
case AML_ARG_OP: case ACPI_REFCLASS_ARG:
if (index > ACPI_METHOD_MAX_ARG) { if (index > ACPI_METHOD_MAX_ARG) {
ACPI_ERROR((AE_INFO, ACPI_ERROR((AE_INFO,
@ -286,8 +286,8 @@ acpi_ds_method_data_get_node(u16 opcode,
break; break;
default: default:
ACPI_ERROR((AE_INFO, "Opcode %d is invalid", opcode)); ACPI_ERROR((AE_INFO, "Type %d is invalid", type));
return_ACPI_STATUS(AE_AML_BAD_OPCODE); return_ACPI_STATUS(AE_TYPE);
} }
return_ACPI_STATUS(AE_OK); return_ACPI_STATUS(AE_OK);
@ -297,7 +297,8 @@ acpi_ds_method_data_get_node(u16 opcode,
* *
* FUNCTION: acpi_ds_method_data_set_value * FUNCTION: acpi_ds_method_data_set_value
* *
* PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP * PARAMETERS: Type - Either ACPI_REFCLASS_LOCAL or
* ACPI_REFCLASS_ARG
* Index - Which Local or Arg to get * Index - Which Local or Arg to get
* Object - Object to be inserted into the stack entry * Object - Object to be inserted into the stack entry
* walk_state - Current walk state object * walk_state - Current walk state object
@ -310,7 +311,7 @@ acpi_ds_method_data_get_node(u16 opcode,
******************************************************************************/ ******************************************************************************/
static acpi_status static acpi_status
acpi_ds_method_data_set_value(u16 opcode, acpi_ds_method_data_set_value(u8 type,
u32 index, u32 index,
union acpi_operand_object *object, union acpi_operand_object *object,
struct acpi_walk_state *walk_state) struct acpi_walk_state *walk_state)
@ -321,13 +322,13 @@ acpi_ds_method_data_set_value(u16 opcode,
ACPI_FUNCTION_TRACE(ds_method_data_set_value); ACPI_FUNCTION_TRACE(ds_method_data_set_value);
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
"NewObj %p Opcode %X, Refs=%d [%s]\n", object, "NewObj %p Type %2.2X, Refs=%d [%s]\n", object,
opcode, object->common.reference_count, type, object->common.reference_count,
acpi_ut_get_type_name(object->common.type))); acpi_ut_get_type_name(object->common.type)));
/* Get the namespace node for the arg/local */ /* Get the namespace node for the arg/local */
status = acpi_ds_method_data_get_node(opcode, index, walk_state, &node); status = acpi_ds_method_data_get_node(type, index, walk_state, &node);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
@ -350,7 +351,8 @@ acpi_ds_method_data_set_value(u16 opcode,
* *
* FUNCTION: acpi_ds_method_data_get_value * FUNCTION: acpi_ds_method_data_get_value
* *
* PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP * PARAMETERS: Type - Either ACPI_REFCLASS_LOCAL or
* ACPI_REFCLASS_ARG
* Index - Which local_var or argument to get * Index - Which local_var or argument to get
* walk_state - Current walk state object * walk_state - Current walk state object
* dest_desc - Where Arg or Local value is returned * dest_desc - Where Arg or Local value is returned
@ -363,7 +365,7 @@ acpi_ds_method_data_set_value(u16 opcode,
******************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_ds_method_data_get_value(u16 opcode, acpi_ds_method_data_get_value(u8 type,
u32 index, u32 index,
struct acpi_walk_state *walk_state, struct acpi_walk_state *walk_state,
union acpi_operand_object **dest_desc) union acpi_operand_object **dest_desc)
@ -383,7 +385,7 @@ acpi_ds_method_data_get_value(u16 opcode,
/* Get the namespace node for the arg/local */ /* Get the namespace node for the arg/local */
status = acpi_ds_method_data_get_node(opcode, index, walk_state, &node); status = acpi_ds_method_data_get_node(type, index, walk_state, &node);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
@ -419,8 +421,8 @@ acpi_ds_method_data_get_value(u16 opcode,
/* Otherwise, return the error */ /* Otherwise, return the error */
else else
switch (opcode) { switch (type) {
case AML_ARG_OP: case ACPI_REFCLASS_ARG:
ACPI_ERROR((AE_INFO, ACPI_ERROR((AE_INFO,
"Uninitialized Arg[%d] at node %p", "Uninitialized Arg[%d] at node %p",
@ -428,7 +430,7 @@ acpi_ds_method_data_get_value(u16 opcode,
return_ACPI_STATUS(AE_AML_UNINITIALIZED_ARG); return_ACPI_STATUS(AE_AML_UNINITIALIZED_ARG);
case AML_LOCAL_OP: case ACPI_REFCLASS_LOCAL:
ACPI_ERROR((AE_INFO, ACPI_ERROR((AE_INFO,
"Uninitialized Local[%d] at node %p", "Uninitialized Local[%d] at node %p",
@ -437,9 +439,10 @@ acpi_ds_method_data_get_value(u16 opcode,
return_ACPI_STATUS(AE_AML_UNINITIALIZED_LOCAL); return_ACPI_STATUS(AE_AML_UNINITIALIZED_LOCAL);
default: default:
ACPI_ERROR((AE_INFO, ACPI_ERROR((AE_INFO,
"Not a Arg/Local opcode: %X", "Not a Arg/Local opcode: %X",
opcode)); type));
return_ACPI_STATUS(AE_AML_INTERNAL); return_ACPI_STATUS(AE_AML_INTERNAL);
} }
} }
@ -458,7 +461,8 @@ acpi_ds_method_data_get_value(u16 opcode,
* *
* FUNCTION: acpi_ds_method_data_delete_value * FUNCTION: acpi_ds_method_data_delete_value
* *
* PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP * PARAMETERS: Type - Either ACPI_REFCLASS_LOCAL or
* ACPI_REFCLASS_ARG
* Index - Which local_var or argument to delete * Index - Which local_var or argument to delete
* walk_state - Current walk state object * walk_state - Current walk state object
* *
@ -470,7 +474,7 @@ acpi_ds_method_data_get_value(u16 opcode,
******************************************************************************/ ******************************************************************************/
static void static void
acpi_ds_method_data_delete_value(u16 opcode, acpi_ds_method_data_delete_value(u8 type,
u32 index, struct acpi_walk_state *walk_state) u32 index, struct acpi_walk_state *walk_state)
{ {
acpi_status status; acpi_status status;
@ -481,7 +485,7 @@ acpi_ds_method_data_delete_value(u16 opcode,
/* Get the namespace node for the arg/local */ /* Get the namespace node for the arg/local */
status = acpi_ds_method_data_get_node(opcode, index, walk_state, &node); status = acpi_ds_method_data_get_node(type, index, walk_state, &node);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
return_VOID; return_VOID;
} }
@ -514,7 +518,8 @@ acpi_ds_method_data_delete_value(u16 opcode,
* *
* FUNCTION: acpi_ds_store_object_to_local * FUNCTION: acpi_ds_store_object_to_local
* *
* PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP * PARAMETERS: Type - Either ACPI_REFCLASS_LOCAL or
* ACPI_REFCLASS_ARG
* Index - Which Local or Arg to set * Index - Which Local or Arg to set
* obj_desc - Value to be stored * obj_desc - Value to be stored
* walk_state - Current walk state * walk_state - Current walk state
@ -528,7 +533,7 @@ acpi_ds_method_data_delete_value(u16 opcode,
******************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_ds_store_object_to_local(u16 opcode, acpi_ds_store_object_to_local(u8 type,
u32 index, u32 index,
union acpi_operand_object *obj_desc, union acpi_operand_object *obj_desc,
struct acpi_walk_state *walk_state) struct acpi_walk_state *walk_state)
@ -539,8 +544,8 @@ acpi_ds_store_object_to_local(u16 opcode,
union acpi_operand_object *new_obj_desc; union acpi_operand_object *new_obj_desc;
ACPI_FUNCTION_TRACE(ds_store_object_to_local); ACPI_FUNCTION_TRACE(ds_store_object_to_local);
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Opcode=%X Index=%d Obj=%p\n", ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Type=%2.2X Index=%d Obj=%p\n",
opcode, index, obj_desc)); type, index, obj_desc));
/* Parameter validation */ /* Parameter validation */
@ -550,7 +555,7 @@ acpi_ds_store_object_to_local(u16 opcode,
/* Get the namespace node for the arg/local */ /* Get the namespace node for the arg/local */
status = acpi_ds_method_data_get_node(opcode, index, walk_state, &node); status = acpi_ds_method_data_get_node(type, index, walk_state, &node);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
@ -602,7 +607,7 @@ acpi_ds_store_object_to_local(u16 opcode,
* *
* Weird, but true. * Weird, but true.
*/ */
if (opcode == AML_ARG_OP) { if (type == ACPI_REFCLASS_ARG) {
/* /*
* If we have a valid reference object that came from ref_of(), * If we have a valid reference object that came from ref_of(),
* do the indirect store * do the indirect store
@ -611,8 +616,8 @@ acpi_ds_store_object_to_local(u16 opcode,
ACPI_DESC_TYPE_OPERAND) ACPI_DESC_TYPE_OPERAND)
&& (current_obj_desc->common.type == && (current_obj_desc->common.type ==
ACPI_TYPE_LOCAL_REFERENCE) ACPI_TYPE_LOCAL_REFERENCE)
&& (current_obj_desc->reference.opcode == && (current_obj_desc->reference.class ==
AML_REF_OF_OP)) { ACPI_REFCLASS_REFOF)) {
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
"Arg (%p) is an ObjRef(Node), storing in node %p\n", "Arg (%p) is an ObjRef(Node), storing in node %p\n",
new_obj_desc, new_obj_desc,
@ -640,11 +645,9 @@ acpi_ds_store_object_to_local(u16 opcode,
} }
} }
/* /* Delete the existing object before storing the new one */
* Delete the existing object
* before storing the new one acpi_ds_method_data_delete_value(type, index, walk_state);
*/
acpi_ds_method_data_delete_value(opcode, index, walk_state);
} }
/* /*
@ -653,7 +656,7 @@ acpi_ds_store_object_to_local(u16 opcode,
* (increments the object reference count by one) * (increments the object reference count by one)
*/ */
status = status =
acpi_ds_method_data_set_value(opcode, index, new_obj_desc, acpi_ds_method_data_set_value(type, index, new_obj_desc,
walk_state); walk_state);
/* Remove local reference if we copied the object above */ /* Remove local reference if we copied the object above */

View file

@ -731,36 +731,35 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state,
switch (op_info->type) { switch (op_info->type) {
case AML_TYPE_LOCAL_VARIABLE: case AML_TYPE_LOCAL_VARIABLE:
/* Split the opcode into a base opcode + offset */ /* Local ID (0-7) is (AML opcode - base AML_LOCAL_OP) */
obj_desc->reference.opcode = AML_LOCAL_OP; obj_desc->reference.value = opcode - AML_LOCAL_OP;
obj_desc->reference.offset = opcode - AML_LOCAL_OP; obj_desc->reference.class = ACPI_REFCLASS_LOCAL;
#ifndef ACPI_NO_METHOD_EXECUTION #ifndef ACPI_NO_METHOD_EXECUTION
status = acpi_ds_method_data_get_node(AML_LOCAL_OP, status =
obj_desc-> acpi_ds_method_data_get_node(ACPI_REFCLASS_LOCAL,
reference.offset, obj_desc->reference.
walk_state, value, walk_state,
ACPI_CAST_INDIRECT_PTR ACPI_CAST_INDIRECT_PTR
(struct (struct
acpi_namespace_node, acpi_namespace_node,
&obj_desc-> &obj_desc->reference.
reference. object));
object));
#endif #endif
break; break;
case AML_TYPE_METHOD_ARGUMENT: case AML_TYPE_METHOD_ARGUMENT:
/* Split the opcode into a base opcode + offset */ /* Arg ID (0-6) is (AML opcode - base AML_ARG_OP) */
obj_desc->reference.opcode = AML_ARG_OP; obj_desc->reference.value = opcode - AML_ARG_OP;
obj_desc->reference.offset = opcode - AML_ARG_OP; obj_desc->reference.class = ACPI_REFCLASS_ARG;
#ifndef ACPI_NO_METHOD_EXECUTION #ifndef ACPI_NO_METHOD_EXECUTION
status = acpi_ds_method_data_get_node(AML_ARG_OP, status = acpi_ds_method_data_get_node(ACPI_REFCLASS_ARG,
obj_desc-> obj_desc->
reference.offset, reference.value,
walk_state, walk_state,
ACPI_CAST_INDIRECT_PTR ACPI_CAST_INDIRECT_PTR
(struct (struct
@ -771,18 +770,31 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state,
#endif #endif
break; break;
default: /* Other literals, etc.. */ default: /* Object name or Debug object */
if (op->common.aml_opcode == AML_INT_NAMEPATH_OP) { switch (op->common.aml_opcode) {
case AML_INT_NAMEPATH_OP:
/* Node was saved in Op */ /* Node was saved in Op */
obj_desc->reference.node = op->common.node; obj_desc->reference.node = op->common.node;
obj_desc->reference.object = obj_desc->reference.object =
op->common.node->object; op->common.node->object;
} obj_desc->reference.class = ACPI_REFCLASS_NAME;
break;
obj_desc->reference.opcode = opcode; case AML_DEBUG_OP:
obj_desc->reference.class = ACPI_REFCLASS_DEBUG;
break;
default:
ACPI_ERROR((AE_INFO,
"Unimplemented reference type for AML opcode: %4.4X",
opcode));
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
}
break; break;
} }
break; break;

View file

@ -1330,7 +1330,7 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state,
(walk_state->results->results.obj_desc[0]) == (walk_state->results->results.obj_desc[0]) ==
ACPI_TYPE_LOCAL_REFERENCE) ACPI_TYPE_LOCAL_REFERENCE)
&& ((walk_state->results->results.obj_desc[0])-> && ((walk_state->results->results.obj_desc[0])->
reference.opcode != AML_INDEX_OP)) { reference.class != ACPI_REFCLASS_INDEX)) {
status = status =
acpi_ex_resolve_to_value(&walk_state-> acpi_ex_resolve_to_value(&walk_state->
results->results. results->results.

View file

@ -429,10 +429,10 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state)
ACPI_TYPE_LOCAL_REFERENCE) ACPI_TYPE_LOCAL_REFERENCE)
&& (walk_state->operands[1]->common.type == && (walk_state->operands[1]->common.type ==
ACPI_TYPE_LOCAL_REFERENCE) ACPI_TYPE_LOCAL_REFERENCE)
&& (walk_state->operands[0]->reference.opcode == && (walk_state->operands[0]->reference.class ==
walk_state->operands[1]->reference.opcode) walk_state->operands[1]->reference.class)
&& (walk_state->operands[0]->reference.offset == && (walk_state->operands[0]->reference.value ==
walk_state->operands[1]->reference.offset)) { walk_state->operands[1]->reference.value)) {
status = AE_OK; status = AE_OK;
} else { } else {
ACPI_EXCEPTION((AE_INFO, status, ACPI_EXCEPTION((AE_INFO, status,

View file

@ -43,7 +43,6 @@
#include <acpi/acpi.h> #include <acpi/acpi.h>
#include <acpi/acinterp.h> #include <acpi/acinterp.h>
#include <acpi/amlcode.h>
#include <acpi/acnamesp.h> #include <acpi/acnamesp.h>
#include <acpi/actables.h> #include <acpi/actables.h>
#include <acpi/acdispat.h> #include <acpi/acdispat.h>
@ -91,7 +90,7 @@ acpi_ex_add_table(u32 table_index,
/* Init the table handle */ /* Init the table handle */
obj_desc->reference.opcode = AML_LOAD_OP; obj_desc->reference.class = ACPI_REFCLASS_TABLE;
*ddb_handle = obj_desc; *ddb_handle = obj_desc;
/* Install the new table into the local data structures */ /* Install the new table into the local data structures */

View file

@ -45,7 +45,6 @@
#include <acpi/acinterp.h> #include <acpi/acinterp.h>
#include <acpi/amlcode.h> #include <acpi/amlcode.h>
#include <acpi/acnamesp.h> #include <acpi/acnamesp.h>
#include <acpi/acparser.h>
#define _COMPONENT ACPI_EXECUTER #define _COMPONENT ACPI_EXECUTER
ACPI_MODULE_NAME("exdump") ACPI_MODULE_NAME("exdump")
@ -216,8 +215,8 @@ static struct acpi_exdump_info acpi_ex_dump_index_field[5] = {
static struct acpi_exdump_info acpi_ex_dump_reference[8] = { static struct acpi_exdump_info acpi_ex_dump_reference[8] = {
{ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_reference), NULL}, {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_reference), NULL},
{ACPI_EXD_UINT8, ACPI_EXD_OFFSET(reference.class), "Class"},
{ACPI_EXD_UINT8, ACPI_EXD_OFFSET(reference.target_type), "Target Type"}, {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(reference.target_type), "Target Type"},
{ACPI_EXD_UINT32, ACPI_EXD_OFFSET(reference.offset), "Offset"},
{ACPI_EXD_UINT32, ACPI_EXD_OFFSET(reference.value), "Value"}, {ACPI_EXD_UINT32, ACPI_EXD_OFFSET(reference.value), "Value"},
{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(reference.object), "Object Desc"}, {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(reference.object), "Object Desc"},
{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(reference.node), "Node"}, {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(reference.node), "Node"},
@ -414,10 +413,10 @@ acpi_ex_dump_object(union acpi_operand_object *obj_desc,
case ACPI_EXD_REFERENCE: case ACPI_EXD_REFERENCE:
acpi_ex_out_string("Opcode", acpi_ex_out_string("Class Name",
(acpi_ps_get_opcode_info (char *)
(obj_desc->reference.opcode))-> acpi_ut_get_reference_name
name); (obj_desc));
acpi_ex_dump_reference_obj(obj_desc); acpi_ex_dump_reference_obj(obj_desc);
break; break;
@ -495,40 +494,41 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth)
switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
case ACPI_TYPE_LOCAL_REFERENCE: case ACPI_TYPE_LOCAL_REFERENCE:
switch (obj_desc->reference.opcode) { acpi_os_printf("Reference: [%s] ",
case AML_DEBUG_OP: acpi_ut_get_reference_name(obj_desc));
acpi_os_printf("Reference: [Debug]\n"); switch (obj_desc->reference.class) {
case ACPI_REFCLASS_DEBUG:
acpi_os_printf("\n");
break; break;
case AML_INDEX_OP: case ACPI_REFCLASS_INDEX:
acpi_os_printf("Reference: [Index] %p\n", acpi_os_printf("%p\n", obj_desc->reference.object);
obj_desc->reference.object);
break; break;
case AML_LOAD_OP: case ACPI_REFCLASS_TABLE:
acpi_os_printf("Reference: [DdbHandle] TableIndex %X\n", acpi_os_printf("Table Index %X\n",
obj_desc->reference.value); obj_desc->reference.value);
break; break;
case AML_REF_OF_OP: case ACPI_REFCLASS_REFOF:
acpi_os_printf("Reference: [RefOf] %p [%s]\n", acpi_os_printf("%p [%s]\n", obj_desc->reference.object,
obj_desc->reference.object,
acpi_ut_get_type_name(((union acpi_ut_get_type_name(((union
acpi_operand_object acpi_operand_object
*)obj_desc-> *)
obj_desc->
reference. reference.
object)->common. object)->common.
type)); type));
break; break;
case AML_ARG_OP: case ACPI_REFCLASS_ARG:
acpi_os_printf("Reference: [Arg%d]", acpi_os_printf("%X", obj_desc->reference.value);
obj_desc->reference.offset);
if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) {
@ -543,10 +543,9 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth)
acpi_os_printf("\n"); acpi_os_printf("\n");
break; break;
case AML_LOCAL_OP: case ACPI_REFCLASS_LOCAL:
acpi_os_printf("Reference: [Local%d]", acpi_os_printf("%X", obj_desc->reference.value);
obj_desc->reference.offset);
if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) {
@ -561,21 +560,16 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth)
acpi_os_printf("\n"); acpi_os_printf("\n");
break; break;
case AML_INT_NAMEPATH_OP: case ACPI_REFCLASS_NAME:
acpi_os_printf("Reference: [Namepath] %X [%4.4s]\n", acpi_os_printf("- [%4.4s]\n",
obj_desc->reference.node->name.integer,
obj_desc->reference.node->name.ascii); obj_desc->reference.node->name.ascii);
break; break;
default: default: /* Unknown reference class */
/* Unknown opcode */ acpi_os_printf("%2.2X\n", obj_desc->reference.class);
acpi_os_printf("Unknown Reference opcode=%X\n",
obj_desc->reference.opcode);
break; break;
} }
break; break;
@ -866,8 +860,8 @@ static void acpi_ex_dump_reference_obj(union acpi_operand_object *obj_desc)
ret_buf.length = ACPI_ALLOCATE_LOCAL_BUFFER; ret_buf.length = ACPI_ALLOCATE_LOCAL_BUFFER;
if (obj_desc->reference.opcode == AML_INT_NAMEPATH_OP) { if (obj_desc->reference.class == ACPI_REFCLASS_NAME) {
acpi_os_printf(" Named Object %p ", obj_desc->reference.node); acpi_os_printf(" %p ", obj_desc->reference.node);
status = status =
acpi_ns_handle_to_pathname(obj_desc->reference.node, acpi_ns_handle_to_pathname(obj_desc->reference.node,
@ -883,8 +877,8 @@ static void acpi_ex_dump_reference_obj(union acpi_operand_object *obj_desc)
ACPI_DESC_TYPE_OPERAND) { ACPI_DESC_TYPE_OPERAND) {
acpi_os_printf(" Target: %p", acpi_os_printf(" Target: %p",
obj_desc->reference.object); obj_desc->reference.object);
if (obj_desc->reference.opcode == AML_LOAD_OP) { if (obj_desc->reference.class == ACPI_REFCLASS_TABLE) {
acpi_os_printf(" [DDBHandle] Table Index: %X\n", acpi_os_printf(" Table Index: %X\n",
obj_desc->reference.value); obj_desc->reference.value);
} else { } else {
acpi_os_printf(" Target: %p [%s]\n", acpi_os_printf(" Target: %p [%s]\n",
@ -987,9 +981,9 @@ acpi_ex_dump_package_obj(union acpi_operand_object *obj_desc,
case ACPI_TYPE_LOCAL_REFERENCE: case ACPI_TYPE_LOCAL_REFERENCE:
acpi_os_printf("[Object Reference] %s", acpi_os_printf("[Object Reference] Type [%s] %2.2X",
(acpi_ps_get_opcode_info acpi_ut_get_reference_name(obj_desc),
(obj_desc->reference.opcode))->name); obj_desc->reference.class);
acpi_ex_dump_reference_obj(obj_desc); acpi_ex_dump_reference_obj(obj_desc);
break; break;

View file

@ -86,10 +86,10 @@ acpi_ex_get_object_reference(union acpi_operand_object *obj_desc,
/* /*
* Must be a reference to a Local or Arg * Must be a reference to a Local or Arg
*/ */
switch (obj_desc->reference.opcode) { switch (obj_desc->reference.class) {
case AML_LOCAL_OP: case ACPI_REFCLASS_LOCAL:
case AML_ARG_OP: case ACPI_REFCLASS_ARG:
case AML_DEBUG_OP: case ACPI_REFCLASS_DEBUG:
/* The referenced object is the pseudo-node for the local/arg */ /* The referenced object is the pseudo-node for the local/arg */
@ -98,8 +98,8 @@ acpi_ex_get_object_reference(union acpi_operand_object *obj_desc,
default: default:
ACPI_ERROR((AE_INFO, "Unknown Reference opcode %X", ACPI_ERROR((AE_INFO, "Unknown Reference Class %2.2X",
obj_desc->reference.opcode)); obj_desc->reference.class));
return_ACPI_STATUS(AE_AML_INTERNAL); return_ACPI_STATUS(AE_AML_INTERNAL);
} }
break; break;
@ -127,7 +127,7 @@ acpi_ex_get_object_reference(union acpi_operand_object *obj_desc,
return_ACPI_STATUS(AE_NO_MEMORY); return_ACPI_STATUS(AE_NO_MEMORY);
} }
reference_obj->reference.opcode = AML_REF_OF_OP; reference_obj->reference.class = ACPI_REFCLASS_REFOF;
reference_obj->reference.object = referenced_obj; reference_obj->reference.object = referenced_obj;
*return_desc = reference_obj; *return_desc = reference_obj;

View file

@ -825,16 +825,16 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
* *
* Must resolve/dereference the local/arg reference first * Must resolve/dereference the local/arg reference first
*/ */
switch (operand[0]->reference.opcode) { switch (operand[0]->reference.class) {
case AML_LOCAL_OP: case ACPI_REFCLASS_LOCAL:
case AML_ARG_OP: case ACPI_REFCLASS_ARG:
/* Set Operand[0] to the value of the local/arg */ /* Set Operand[0] to the value of the local/arg */
status = status =
acpi_ds_method_data_get_value acpi_ds_method_data_get_value
(operand[0]->reference.opcode, (operand[0]->reference.class,
operand[0]->reference.offset, operand[0]->reference.value,
walk_state, &temp_desc); walk_state, &temp_desc);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
goto cleanup; goto cleanup;
@ -848,7 +848,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
operand[0] = temp_desc; operand[0] = temp_desc;
break; break;
case AML_REF_OF_OP: case ACPI_REFCLASS_REFOF:
/* Get the object to which the reference refers */ /* Get the object to which the reference refers */
@ -928,8 +928,8 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
* This must be a reference object produced by either the * This must be a reference object produced by either the
* Index() or ref_of() operator * Index() or ref_of() operator
*/ */
switch (operand[0]->reference.opcode) { switch (operand[0]->reference.class) {
case AML_INDEX_OP: case ACPI_REFCLASS_INDEX:
/* /*
* The target type for the Index operator must be * The target type for the Index operator must be
@ -965,7 +965,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
return_desc->integer.value = return_desc->integer.value =
temp_desc->buffer. temp_desc->buffer.
pointer[operand[0]->reference. pointer[operand[0]->reference.
offset]; value];
break; break;
case ACPI_TYPE_PACKAGE: case ACPI_TYPE_PACKAGE:
@ -985,7 +985,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
default: default:
ACPI_ERROR((AE_INFO, ACPI_ERROR((AE_INFO,
"Unknown Index TargetType %X in obj %p", "Unknown Index TargetType %X in reference object %p",
operand[0]->reference. operand[0]->reference.
target_type, operand[0])); target_type, operand[0]));
status = AE_AML_OPERAND_TYPE; status = AE_AML_OPERAND_TYPE;
@ -993,7 +993,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
} }
break; break;
case AML_REF_OF_OP: case ACPI_REFCLASS_REFOF:
return_desc = operand[0]->reference.object; return_desc = operand[0]->reference.object;
@ -1013,9 +1013,9 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
default: default:
ACPI_ERROR((AE_INFO, ACPI_ERROR((AE_INFO,
"Unknown opcode in reference(%p) - %X", "Unknown class in reference(%p) - %2.2X",
operand[0], operand[0],
operand[0]->reference.opcode)); operand[0]->reference.class));
status = AE_TYPE; status = AE_TYPE;
goto cleanup; goto cleanup;

View file

@ -391,8 +391,8 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state)
/* Initialize the Index reference object */ /* Initialize the Index reference object */
index = operand[1]->integer.value; index = operand[1]->integer.value;
return_desc->reference.offset = (u32) index; return_desc->reference.value = (u32) index;
return_desc->reference.opcode = AML_INDEX_OP; return_desc->reference.class = ACPI_REFCLASS_INDEX;
/* /*
* At this point, the Source operand is a String, Buffer, or Package. * At this point, the Source operand is a String, Buffer, or Package.

View file

@ -46,8 +46,6 @@
#include <acpi/acdispat.h> #include <acpi/acdispat.h>
#include <acpi/acinterp.h> #include <acpi/acinterp.h>
#include <acpi/acnamesp.h> #include <acpi/acnamesp.h>
#include <acpi/acparser.h>
#include <acpi/amlcode.h>
#define _COMPONENT ACPI_EXECUTER #define _COMPONENT ACPI_EXECUTER
ACPI_MODULE_NAME("exresnte") ACPI_MODULE_NAME("exresnte")
@ -238,10 +236,10 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr,
case ACPI_TYPE_LOCAL_REFERENCE: case ACPI_TYPE_LOCAL_REFERENCE:
switch (source_desc->reference.opcode) { switch (source_desc->reference.class) {
case AML_LOAD_OP: /* This is a ddb_handle */ case ACPI_REFCLASS_TABLE: /* This is a ddb_handle */
case AML_REF_OF_OP: case ACPI_REFCLASS_REFOF:
case AML_INDEX_OP: case ACPI_REFCLASS_INDEX:
/* Return an additional reference to the object */ /* Return an additional reference to the object */
@ -253,10 +251,8 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr,
/* No named references are allowed here */ /* No named references are allowed here */
ACPI_ERROR((AE_INFO, ACPI_ERROR((AE_INFO,
"Unsupported Reference opcode %X (%s)", "Unsupported Reference type %X",
source_desc->reference.opcode, source_desc->reference.class));
acpi_ps_get_opcode_name(source_desc->
reference.opcode)));
return_ACPI_STATUS(AE_AML_OPERAND_TYPE); return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
} }

View file

@ -47,7 +47,6 @@
#include <acpi/acdispat.h> #include <acpi/acdispat.h>
#include <acpi/acinterp.h> #include <acpi/acinterp.h>
#include <acpi/acnamesp.h> #include <acpi/acnamesp.h>
#include <acpi/acparser.h>
#define _COMPONENT ACPI_EXECUTER #define _COMPONENT ACPI_EXECUTER
ACPI_MODULE_NAME("exresolv") ACPI_MODULE_NAME("exresolv")
@ -141,7 +140,7 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr,
acpi_status status = AE_OK; acpi_status status = AE_OK;
union acpi_operand_object *stack_desc; union acpi_operand_object *stack_desc;
union acpi_operand_object *obj_desc = NULL; union acpi_operand_object *obj_desc = NULL;
u16 opcode; u8 ref_type;
ACPI_FUNCTION_TRACE(ex_resolve_object_to_value); ACPI_FUNCTION_TRACE(ex_resolve_object_to_value);
@ -152,19 +151,19 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr,
switch (ACPI_GET_OBJECT_TYPE(stack_desc)) { switch (ACPI_GET_OBJECT_TYPE(stack_desc)) {
case ACPI_TYPE_LOCAL_REFERENCE: case ACPI_TYPE_LOCAL_REFERENCE:
opcode = stack_desc->reference.opcode; ref_type = stack_desc->reference.class;
switch (opcode) { switch (ref_type) {
case AML_LOCAL_OP: case ACPI_REFCLASS_LOCAL:
case AML_ARG_OP: case ACPI_REFCLASS_ARG:
/* /*
* Get the local from the method's state info * Get the local from the method's state info
* Note: this increments the local's object reference count * Note: this increments the local's object reference count
*/ */
status = acpi_ds_method_data_get_value(opcode, status = acpi_ds_method_data_get_value(ref_type,
stack_desc-> stack_desc->
reference.offset, reference.value,
walk_state, walk_state,
&obj_desc); &obj_desc);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
@ -173,7 +172,7 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr,
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
"[Arg/Local %X] ValueObj is %p\n", "[Arg/Local %X] ValueObj is %p\n",
stack_desc->reference.offset, stack_desc->reference.value,
obj_desc)); obj_desc));
/* /*
@ -184,7 +183,7 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr,
*stack_ptr = obj_desc; *stack_ptr = obj_desc;
break; break;
case AML_INDEX_OP: case ACPI_REFCLASS_INDEX:
switch (stack_desc->reference.target_type) { switch (stack_desc->reference.target_type) {
case ACPI_TYPE_BUFFER_FIELD: case ACPI_TYPE_BUFFER_FIELD:
@ -239,15 +238,15 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr,
} }
break; break;
case AML_REF_OF_OP: case ACPI_REFCLASS_REFOF:
case AML_DEBUG_OP: case ACPI_REFCLASS_DEBUG:
case AML_LOAD_OP: case ACPI_REFCLASS_TABLE:
/* Just leave the object as-is, do not dereference */ /* Just leave the object as-is, do not dereference */
break; break;
case AML_INT_NAMEPATH_OP: /* Reference to a named object */ case ACPI_REFCLASS_NAME: /* Reference to a named object */
/* Dereference the name */ /* Dereference the name */
@ -273,8 +272,7 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr,
default: default:
ACPI_ERROR((AE_INFO, ACPI_ERROR((AE_INFO,
"Unknown Reference opcode %X (%s) in %p", "Unknown Reference type %X in %p", ref_type,
opcode, acpi_ps_get_opcode_name(opcode),
stack_desc)); stack_desc));
status = AE_AML_INTERNAL; status = AE_AML_INTERNAL;
break; break;
@ -388,13 +386,13 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state,
* traversing the list of possibly many nested references. * traversing the list of possibly many nested references.
*/ */
while (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_REFERENCE) { while (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_REFERENCE) {
switch (obj_desc->reference.opcode) { switch (obj_desc->reference.class) {
case AML_REF_OF_OP: case ACPI_REFCLASS_REFOF:
case AML_INT_NAMEPATH_OP: case ACPI_REFCLASS_NAME:
/* Dereference the reference pointer */ /* Dereference the reference pointer */
if (obj_desc->reference.opcode == AML_REF_OF_OP) { if (obj_desc->reference.class == ACPI_REFCLASS_REFOF) {
node = obj_desc->reference.object; node = obj_desc->reference.object;
} else { /* AML_INT_NAMEPATH_OP */ } else { /* AML_INT_NAMEPATH_OP */
@ -429,7 +427,7 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state,
} }
break; break;
case AML_INDEX_OP: case ACPI_REFCLASS_INDEX:
/* Get the type of this reference (index into another object) */ /* Get the type of this reference (index into another object) */
@ -455,22 +453,22 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state,
} }
break; break;
case AML_LOAD_OP: case ACPI_REFCLASS_TABLE:
type = ACPI_TYPE_DDB_HANDLE; type = ACPI_TYPE_DDB_HANDLE;
goto exit; goto exit;
case AML_LOCAL_OP: case ACPI_REFCLASS_LOCAL:
case AML_ARG_OP: case ACPI_REFCLASS_ARG:
if (return_desc) { if (return_desc) {
status = status =
acpi_ds_method_data_get_value(obj_desc-> acpi_ds_method_data_get_value(obj_desc->
reference. reference.
opcode, class,
obj_desc-> obj_desc->
reference. reference.
offset, value,
walk_state, walk_state,
&obj_desc); &obj_desc);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
@ -481,10 +479,10 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state,
status = status =
acpi_ds_method_data_get_node(obj_desc-> acpi_ds_method_data_get_node(obj_desc->
reference. reference.
opcode, class,
obj_desc-> obj_desc->
reference. reference.
offset, value,
walk_state, walk_state,
&node); &node);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
@ -499,7 +497,7 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state,
} }
break; break;
case AML_DEBUG_OP: case ACPI_REFCLASS_DEBUG:
/* The Debug Object is of type "DebugObject" */ /* The Debug Object is of type "DebugObject" */
@ -509,8 +507,8 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state,
default: default:
ACPI_ERROR((AE_INFO, ACPI_ERROR((AE_INFO,
"Unknown Reference subtype %X", "Unknown Reference Class %2.2X",
obj_desc->reference.opcode)); obj_desc->reference.class));
return_ACPI_STATUS(AE_AML_INTERNAL); return_ACPI_STATUS(AE_AML_INTERNAL);
} }
} }

View file

@ -225,41 +225,36 @@ acpi_ex_resolve_operands(u16 opcode,
if (object_type == (u8) ACPI_TYPE_LOCAL_REFERENCE) { if (object_type == (u8) ACPI_TYPE_LOCAL_REFERENCE) {
/* Decode the Reference */ /* Validate the Reference */
op_info = acpi_ps_get_opcode_info(opcode); switch (obj_desc->reference.class) {
if (op_info->class == AML_CLASS_UNKNOWN) { case ACPI_REFCLASS_DEBUG:
return_ACPI_STATUS(AE_AML_BAD_OPCODE);
}
switch (obj_desc->reference.opcode) {
case AML_DEBUG_OP:
target_op = AML_DEBUG_OP; target_op = AML_DEBUG_OP;
/*lint -fallthrough */ /*lint -fallthrough */
case AML_INDEX_OP: case ACPI_REFCLASS_ARG:
case AML_REF_OF_OP: case ACPI_REFCLASS_LOCAL:
case AML_ARG_OP: case ACPI_REFCLASS_INDEX:
case AML_LOCAL_OP: case ACPI_REFCLASS_REFOF:
case AML_LOAD_OP: /* ddb_handle from LOAD_OP or LOAD_TABLE_OP */ case ACPI_REFCLASS_TABLE: /* ddb_handle from LOAD_OP or LOAD_TABLE_OP */
case AML_INT_NAMEPATH_OP: /* Reference to a named object */ case ACPI_REFCLASS_NAME: /* Reference to a named object */
ACPI_DEBUG_ONLY_MEMBERS(ACPI_DEBUG_PRINT ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
((ACPI_DB_EXEC, "Operand is a Reference, Class [%s] %2.2X\n",
"Operand is a Reference, RefOpcode [%s]\n", acpi_ut_get_reference_name
(acpi_ps_get_opcode_info (obj_desc),
(obj_desc-> obj_desc->reference.
reference. class));
opcode))->
name)));
break; break;
default: default:
ACPI_ERROR((AE_INFO, ACPI_ERROR((AE_INFO,
"Operand is a Reference, Unknown Reference Opcode: %X", "Unknown Reference Class %2.2X in %p",
obj_desc->reference. obj_desc->reference.class,
opcode)); obj_desc));
return_ACPI_STATUS(AE_AML_OPERAND_TYPE); return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
} }
@ -270,8 +265,7 @@ acpi_ex_resolve_operands(u16 opcode,
/* Invalid descriptor */ /* Invalid descriptor */
ACPI_ERROR((AE_INFO, ACPI_ERROR((AE_INFO, "Invalid descriptor %p [%s]",
"Invalid descriptor %p [%s]",
obj_desc, obj_desc,
acpi_ut_get_descriptor_name(obj_desc))); acpi_ut_get_descriptor_name(obj_desc)));
@ -343,7 +337,7 @@ acpi_ex_resolve_operands(u16 opcode,
if ((opcode == AML_STORE_OP) && if ((opcode == AML_STORE_OP) &&
(ACPI_GET_OBJECT_TYPE(*stack_ptr) == (ACPI_GET_OBJECT_TYPE(*stack_ptr) ==
ACPI_TYPE_LOCAL_REFERENCE) ACPI_TYPE_LOCAL_REFERENCE)
&& ((*stack_ptr)->reference.opcode == AML_INDEX_OP)) { && ((*stack_ptr)->reference.class == ACPI_REFCLASS_INDEX)) {
goto next_operand; goto next_operand;
} }
break; break;

View file

@ -47,7 +47,6 @@
#include <acpi/acinterp.h> #include <acpi/acinterp.h>
#include <acpi/amlcode.h> #include <acpi/amlcode.h>
#include <acpi/acnamesp.h> #include <acpi/acnamesp.h>
#include <acpi/acparser.h>
#define _COMPONENT ACPI_EXECUTER #define _COMPONENT ACPI_EXECUTER
ACPI_MODULE_NAME("exstore") ACPI_MODULE_NAME("exstore")
@ -179,23 +178,27 @@ acpi_ex_do_debug_object(union acpi_operand_object *source_desc,
case ACPI_TYPE_LOCAL_REFERENCE: case ACPI_TYPE_LOCAL_REFERENCE:
if (source_desc->reference.opcode == AML_INDEX_OP) { ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "[%s] ",
ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, acpi_ut_get_reference_name(source_desc)));
"[%s, 0x%X]\n",
acpi_ps_get_opcode_name
(source_desc->reference.opcode),
source_desc->reference.offset));
} else {
ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "[%s]",
acpi_ps_get_opcode_name
(source_desc->reference.opcode)));
}
if (source_desc->reference.opcode == AML_LOAD_OP) { /* Load and load_table */ /* Decode the reference */
ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT,
" Table Index %X\n", switch (source_desc->reference.class) {
case ACPI_REFCLASS_INDEX:
ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "0x%X\n",
source_desc->reference.value)); source_desc->reference.value));
break; break;
case ACPI_REFCLASS_TABLE:
ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT,
"Table Index 0x%X\n",
source_desc->reference.value));
break;
default:
break;
} }
ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, " ")); ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, " "));
@ -347,15 +350,15 @@ acpi_ex_store(union acpi_operand_object *source_desc,
} }
/* /*
* Examine the Reference opcode. These cases are handled: * Examine the Reference class. These cases are handled:
* *
* 1) Store to Name (Change the object associated with a name) * 1) Store to Name (Change the object associated with a name)
* 2) Store to an indexed area of a Buffer or Package * 2) Store to an indexed area of a Buffer or Package
* 3) Store to a Method Local or Arg * 3) Store to a Method Local or Arg
* 4) Store to the debug object * 4) Store to the debug object
*/ */
switch (ref_desc->reference.opcode) { switch (ref_desc->reference.class) {
case AML_REF_OF_OP: case ACPI_REFCLASS_REFOF:
/* Storing an object into a Name "container" */ /* Storing an object into a Name "container" */
@ -365,7 +368,7 @@ acpi_ex_store(union acpi_operand_object *source_desc,
ACPI_IMPLICIT_CONVERSION); ACPI_IMPLICIT_CONVERSION);
break; break;
case AML_INDEX_OP: case ACPI_REFCLASS_INDEX:
/* Storing to an Index (pointer into a packager or buffer) */ /* Storing to an Index (pointer into a packager or buffer) */
@ -374,18 +377,18 @@ acpi_ex_store(union acpi_operand_object *source_desc,
walk_state); walk_state);
break; break;
case AML_LOCAL_OP: case ACPI_REFCLASS_LOCAL:
case AML_ARG_OP: case ACPI_REFCLASS_ARG:
/* Store to a method local/arg */ /* Store to a method local/arg */
status = status =
acpi_ds_store_object_to_local(ref_desc->reference.opcode, acpi_ds_store_object_to_local(ref_desc->reference.class,
ref_desc->reference.offset, ref_desc->reference.value,
source_desc, walk_state); source_desc, walk_state);
break; break;
case AML_DEBUG_OP: case ACPI_REFCLASS_DEBUG:
/* /*
* Storing to the Debug object causes the value stored to be * Storing to the Debug object causes the value stored to be
@ -401,8 +404,8 @@ acpi_ex_store(union acpi_operand_object *source_desc,
default: default:
ACPI_ERROR((AE_INFO, "Unknown Reference opcode %X", ACPI_ERROR((AE_INFO, "Unknown Reference Class %2.2X",
ref_desc->reference.opcode)); ref_desc->reference.class));
ACPI_DUMP_ENTRY(ref_desc, ACPI_LV_INFO); ACPI_DUMP_ENTRY(ref_desc, ACPI_LV_INFO);
status = AE_AML_INTERNAL; status = AE_AML_INTERNAL;
@ -458,7 +461,7 @@ acpi_ex_store_object_to_index(union acpi_operand_object *source_desc,
if (ACPI_GET_OBJECT_TYPE(source_desc) == if (ACPI_GET_OBJECT_TYPE(source_desc) ==
ACPI_TYPE_LOCAL_REFERENCE ACPI_TYPE_LOCAL_REFERENCE
&& source_desc->reference.opcode == AML_LOAD_OP) { && source_desc->reference.class == ACPI_REFCLASS_TABLE) {
/* This is a DDBHandle, just add a reference to it */ /* This is a DDBHandle, just add a reference to it */
@ -553,7 +556,7 @@ acpi_ex_store_object_to_index(union acpi_operand_object *source_desc,
/* Store the source value into the target buffer byte */ /* Store the source value into the target buffer byte */
obj_desc->buffer.pointer[index_desc->reference.offset] = value; obj_desc->buffer.pointer[index_desc->reference.value] = value;
break; break;
default: default:

View file

@ -121,7 +121,8 @@ acpi_ex_resolve_object(union acpi_operand_object **source_desc_ptr,
(ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_STRING) && (ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_STRING) &&
!((ACPI_GET_OBJECT_TYPE(source_desc) == !((ACPI_GET_OBJECT_TYPE(source_desc) ==
ACPI_TYPE_LOCAL_REFERENCE) ACPI_TYPE_LOCAL_REFERENCE)
&& (source_desc->reference.opcode == AML_LOAD_OP))) { && (source_desc->reference.class ==
ACPI_REFCLASS_TABLE))) {
/* Conversion successful but still not a valid type */ /* Conversion successful but still not a valid type */

View file

@ -43,7 +43,6 @@
#include <acpi/acpi.h> #include <acpi/acpi.h>
#include <acpi/acnamesp.h> #include <acpi/acnamesp.h>
#include <acpi/acparser.h>
#define _COMPONENT ACPI_NAMESPACE #define _COMPONENT ACPI_NAMESPACE
ACPI_MODULE_NAME("nsdump") ACPI_MODULE_NAME("nsdump")
@ -334,9 +333,7 @@ acpi_ns_dump_one_object(acpi_handle obj_handle,
case ACPI_TYPE_LOCAL_REFERENCE: case ACPI_TYPE_LOCAL_REFERENCE:
acpi_os_printf("[%s]\n", acpi_os_printf("[%s]\n",
acpi_ps_get_opcode_name(obj_desc-> acpi_ut_get_reference_name(obj_desc));
reference.
opcode));
break; break;
case ACPI_TYPE_BUFFER_FIELD: case ACPI_TYPE_BUFFER_FIELD:

View file

@ -45,7 +45,6 @@
#include <acpi/acpi.h> #include <acpi/acpi.h>
#include <acpi/acnamesp.h> #include <acpi/acnamesp.h>
#include <acpi/acinterp.h> #include <acpi/acinterp.h>
#include <acpi/amlcode.h>
#define _COMPONENT ACPI_NAMESPACE #define _COMPONENT ACPI_NAMESPACE
ACPI_MODULE_NAME("nsxfeval") ACPI_MODULE_NAME("nsxfeval")
@ -399,13 +398,13 @@ static void acpi_ns_resolve_references(struct acpi_evaluate_info *info)
* (AML_LOAD_OP) cannot be dereferenced, nor can it be converted to * (AML_LOAD_OP) cannot be dereferenced, nor can it be converted to
* an union acpi_object. * an union acpi_object.
*/ */
switch (info->return_object->reference.opcode) { switch (info->return_object->reference.class) {
case AML_INDEX_OP: case ACPI_REFCLASS_INDEX:
obj_desc = *(info->return_object->reference.where); obj_desc = *(info->return_object->reference.where);
break; break;
case AML_REF_OF_OP: case ACPI_REFCLASS_REFOF:
node = info->return_object->reference.object; node = info->return_object->reference.object;
if (node) { if (node) {

View file

@ -43,7 +43,6 @@
#include <acpi/acpi.h> #include <acpi/acpi.h>
#include <acpi/acresrc.h> #include <acpi/acresrc.h>
#include <acpi/amlcode.h>
#include <acpi/acnamesp.h> #include <acpi/acnamesp.h>
#define _COMPONENT ACPI_RESOURCES #define _COMPONENT ACPI_RESOURCES
@ -560,8 +559,8 @@ acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object,
ACPI_GET_OBJECT_TYPE(*sub_object_list)) || ACPI_GET_OBJECT_TYPE(*sub_object_list)) ||
((ACPI_TYPE_LOCAL_REFERENCE == ((ACPI_TYPE_LOCAL_REFERENCE ==
ACPI_GET_OBJECT_TYPE(*sub_object_list)) && ACPI_GET_OBJECT_TYPE(*sub_object_list)) &&
((*sub_object_list)->reference.opcode == ((*sub_object_list)->reference.class ==
AML_INT_NAMEPATH_OP)))) { ACPI_REFCLASS_NAME)))) {
name_found = TRUE; name_found = TRUE;
} else { } else {
/* Look at the next element */ /* Look at the next element */

View file

@ -43,7 +43,6 @@
#include <acpi/acpi.h> #include <acpi/acpi.h>
#include <acpi/acresrc.h> #include <acpi/acresrc.h>
#include <acpi/amlcode.h>
#include <acpi/acnamesp.h> #include <acpi/acnamesp.h>
#define _COMPONENT ACPI_RESOURCES #define _COMPONENT ACPI_RESOURCES
@ -310,13 +309,12 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
case ACPI_TYPE_LOCAL_REFERENCE: case ACPI_TYPE_LOCAL_REFERENCE:
if (obj_desc->reference.opcode != if (obj_desc->reference.class !=
AML_INT_NAMEPATH_OP) { ACPI_REFCLASS_NAME) {
ACPI_ERROR((AE_INFO, ACPI_ERROR((AE_INFO,
"(PRT[%X].Source) Need name, found reference op %X", "(PRT[%X].Source) Need name, found Reference Class %X",
index, index,
obj_desc->reference. obj_desc->reference.class));
opcode));
return_ACPI_STATUS(AE_BAD_DATA); return_ACPI_STATUS(AE_BAD_DATA);
} }

View file

@ -42,7 +42,6 @@
*/ */
#include <acpi/acpi.h> #include <acpi/acpi.h>
#include <acpi/amlcode.h>
#include <acpi/acnamesp.h> #include <acpi/acnamesp.h>
@ -176,20 +175,24 @@ acpi_ut_copy_isimple_to_esimple(union acpi_operand_object *internal_object,
/* This is an object reference. */ /* This is an object reference. */
switch (internal_object->reference.opcode) { switch (internal_object->reference.class) {
case AML_INT_NAMEPATH_OP: case ACPI_REFCLASS_NAME:
/* For namepath, return the object handle ("reference") */
default:
/* We are referring to the namespace node */
/*
* For namepath, return the object handle ("reference")
* We are referring to the namespace node
*/
external_object->reference.handle = external_object->reference.handle =
internal_object->reference.node; internal_object->reference.node;
external_object->reference.actual_type = external_object->reference.actual_type =
acpi_ns_get_type(internal_object->reference.node); acpi_ns_get_type(internal_object->reference.node);
break; break;
default:
/* All other reference types are unsupported */
return_ACPI_STATUS(AE_TYPE);
} }
break; break;
@ -533,7 +536,7 @@ acpi_ut_copy_esimple_to_isimple(union acpi_object *external_object,
/* TBD: should validate incoming handle */ /* TBD: should validate incoming handle */
internal_object->reference.opcode = AML_INT_NAMEPATH_OP; internal_object->reference.class = ACPI_REFCLASS_NAME;
internal_object->reference.node = internal_object->reference.node =
external_object->reference.handle; external_object->reference.handle;
break; break;
@ -743,11 +746,11 @@ acpi_ut_copy_simple_object(union acpi_operand_object *source_desc,
* We copied the reference object, so we now must add a reference * We copied the reference object, so we now must add a reference
* to the object pointed to by the reference * to the object pointed to by the reference
* *
* DDBHandle reference (from Load/load_table is a special reference, * DDBHandle reference (from Load/load_table) is a special reference,
* it's Reference.Object is the table index, so does not need to * it does not have a Reference.Object, so does not need to
* increase the reference count * increase the reference count
*/ */
if (source_desc->reference.opcode == AML_LOAD_OP) { if (source_desc->reference.class == ACPI_REFCLASS_TABLE) {
break; break;
} }

View file

@ -45,7 +45,6 @@
#include <acpi/acinterp.h> #include <acpi/acinterp.h>
#include <acpi/acnamesp.h> #include <acpi/acnamesp.h>
#include <acpi/acevents.h> #include <acpi/acevents.h>
#include <acpi/amlcode.h>
#define _COMPONENT ACPI_UTILITIES #define _COMPONENT ACPI_UTILITIES
ACPI_MODULE_NAME("utdelete") ACPI_MODULE_NAME("utdelete")
@ -548,8 +547,8 @@ acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action)
* reference must track changes to the ref count of the index or * reference must track changes to the ref count of the index or
* target object. * target object.
*/ */
if ((object->reference.opcode == AML_INDEX_OP) || if ((object->reference.class == ACPI_REFCLASS_INDEX) ||
(object->reference.opcode == AML_INT_NAMEPATH_OP)) { (object->reference.class == ACPI_REFCLASS_NAME)) {
next_object = object->reference.object; next_object = object->reference.object;
} }
break; break;

View file

@ -45,7 +45,6 @@
#include <acpi/acpi.h> #include <acpi/acpi.h>
#include <acpi/acnamesp.h> #include <acpi/acnamesp.h>
#include <acpi/amlcode.h>
ACPI_EXPORT_SYMBOL(acpi_gbl_FADT) ACPI_EXPORT_SYMBOL(acpi_gbl_FADT)
#define _COMPONENT ACPI_UTILITIES #define _COMPONENT ACPI_UTILITIES
@ -590,25 +589,31 @@ char *acpi_ut_get_descriptor_name(void *object)
/* Printable names of reference object sub-types */ /* Printable names of reference object sub-types */
static const char *acpi_gbl_ref_class_names[] = {
/* 00 */ "Local",
/* 01 */ "Argument",
/* 02 */ "RefOf",
/* 03 */ "Index",
/* 04 */ "DdbHandle",
/* 05 */ "Named Object",
/* 06 */ "Debug"
};
const char *acpi_ut_get_reference_name(union acpi_operand_object *object) const char *acpi_ut_get_reference_name(union acpi_operand_object *object)
{ {
if (!object)
return "NULL Object";
switch (object->reference.opcode) { if (ACPI_GET_DESCRIPTOR_TYPE(object) != ACPI_DESC_TYPE_OPERAND)
case AML_INT_NAMEPATH_OP: return "Not an Operand object";
return "Name";
case AML_LOAD_OP: if (object->common.type != ACPI_TYPE_LOCAL_REFERENCE)
return "DDB-Handle"; return "Not a Reference object";
case AML_REF_OF_OP: if (object->reference.class > ACPI_REFCLASS_MAX)
return "RefOf"; return "Unknown Reference class";
case AML_INDEX_OP: return acpi_gbl_ref_class_names[object->reference.class];
return "Index";
default:
return "Unknown";
}
} }
#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
@ -812,4 +817,4 @@ acpi_status acpi_ut_init_globals(void)
} }
ACPI_EXPORT_SYMBOL(acpi_dbg_level) ACPI_EXPORT_SYMBOL(acpi_dbg_level)
ACPI_EXPORT_SYMBOL(acpi_dbg_layer) ACPI_EXPORT_SYMBOL(acpi_dbg_layer)

View file

@ -43,7 +43,6 @@
#include <acpi/acpi.h> #include <acpi/acpi.h>
#include <acpi/acnamesp.h> #include <acpi/acnamesp.h>
#include <acpi/amlcode.h>
#define _COMPONENT ACPI_UTILITIES #define _COMPONENT ACPI_UTILITIES
ACPI_MODULE_NAME("utobject") ACPI_MODULE_NAME("utobject")
@ -478,8 +477,8 @@ acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object,
case ACPI_TYPE_LOCAL_REFERENCE: case ACPI_TYPE_LOCAL_REFERENCE:
switch (internal_object->reference.opcode) { switch (internal_object->reference.class) {
case AML_INT_NAMEPATH_OP: case ACPI_REFCLASS_NAME:
/* /*
* Get the actual length of the full pathname to this object. * Get the actual length of the full pathname to this object.
@ -504,9 +503,9 @@ acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object,
*/ */
ACPI_ERROR((AE_INFO, ACPI_ERROR((AE_INFO,
"Cannot convert to external object - " "Cannot convert to external object - "
"unsupported Reference type [%s] %X in object %p", "unsupported Reference Class [%s] %X in object %p",
acpi_ut_get_reference_name(internal_object), acpi_ut_get_reference_name(internal_object),
internal_object->reference.opcode, internal_object->reference.class,
internal_object)); internal_object));
status = AE_TYPE; status = AE_TYPE;
break; break;

View file

@ -123,6 +123,10 @@ void acpi_db_check_integrity(void);
void acpi_db_generate_gpe(char *gpe_arg, char *block_arg); void acpi_db_generate_gpe(char *gpe_arg, char *block_arg);
void acpi_db_check_predefined_names(void);
void acpi_db_batch_execute(void);
/* /*
* dbdisply - debug display commands * dbdisply - debug display commands
*/ */

View file

@ -157,7 +157,7 @@ acpi_ds_init_callbacks(struct acpi_walk_state *walk_state, u32 pass_number);
* dsmthdat - method data (locals/args) * dsmthdat - method data (locals/args)
*/ */
acpi_status acpi_status
acpi_ds_store_object_to_local(u16 opcode, acpi_ds_store_object_to_local(u8 type,
u32 index, u32 index,
union acpi_operand_object *src_desc, union acpi_operand_object *src_desc,
struct acpi_walk_state *walk_state); struct acpi_walk_state *walk_state);
@ -173,7 +173,7 @@ void acpi_ds_method_data_delete_all(struct acpi_walk_state *walk_state);
u8 acpi_ds_is_method_value(union acpi_operand_object *obj_desc); u8 acpi_ds_is_method_value(union acpi_operand_object *obj_desc);
acpi_status acpi_status
acpi_ds_method_data_get_value(u16 opcode, acpi_ds_method_data_get_value(u8 type,
u32 index, u32 index,
struct acpi_walk_state *walk_state, struct acpi_walk_state *walk_state,
union acpi_operand_object **dest_desc); union acpi_operand_object **dest_desc);
@ -184,7 +184,7 @@ acpi_ds_method_data_init_args(union acpi_operand_object **params,
struct acpi_walk_state *walk_state); struct acpi_walk_state *walk_state);
acpi_status acpi_status
acpi_ds_method_data_get_node(u16 opcode, acpi_ds_method_data_get_node(u8 type,
u32 index, u32 index,
struct acpi_walk_state *walk_state, struct acpi_walk_state *walk_state,
struct acpi_namespace_node **node); struct acpi_namespace_node **node);

View file

@ -308,19 +308,34 @@ struct acpi_object_addr_handler {
*****************************************************************************/ *****************************************************************************/
/* /*
* The Reference object type is used for these opcodes: * The Reference object is used for these opcodes:
* Arg[0-6], Local[0-7], index_op, name_op, zero_op, one_op, ones_op, debug_op * Arg[0-6], Local[0-7], index_op, name_op, ref_of_op, load_op, load_table_op, debug_op
* The Reference.Class differentiates these types.
*/ */
struct acpi_object_reference { struct acpi_object_reference {
ACPI_OBJECT_COMMON_HEADER u8 target_type; /* Used for index_op */ ACPI_OBJECT_COMMON_HEADER u8 class; /* Reference Class */
u16 opcode; u8 target_type; /* Used for Index Op */
u8 reserved;
void *object; /* name_op=>HANDLE to obj, index_op=>union acpi_operand_object */ void *object; /* name_op=>HANDLE to obj, index_op=>union acpi_operand_object */
struct acpi_namespace_node *node; struct acpi_namespace_node *node; /* ref_of or Namepath */
union acpi_operand_object **where; union acpi_operand_object **where; /* Target of Index */
u32 offset; /* Used for arg_op, local_op, and index_op */ u32 value; /* Used for Local/Arg/Index/ddb_handle */
u32 value; /* Used for ddb_handle */
}; };
/* Values for Reference.Class above */
typedef enum {
ACPI_REFCLASS_LOCAL = 0, /* Method local */
ACPI_REFCLASS_ARG = 1, /* Method argument */
ACPI_REFCLASS_REFOF = 2, /* Result of ref_of() TBD: Split to Ref/Node and Ref/operand_obj? */
ACPI_REFCLASS_INDEX = 3, /* Result of Index() */
ACPI_REFCLASS_TABLE = 4, /* ddb_handle - Load(), load_table() */
ACPI_REFCLASS_NAME = 5, /* Reference to a named object */
ACPI_REFCLASS_DEBUG = 6, /* Debug object */
ACPI_REFCLASS_MAX = 6
} ACPI_REFERENCE_CLASSES;
/* /*
* Extra object is used as additional storage for types that * Extra object is used as additional storage for types that
* have AML code in their declarations (term_args) that must be * have AML code in their declarations (term_args) that must be