Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 117313
b: refs/heads/master
c: 1044f1f
h: refs/heads/master
i:
  117311: 8404386
v: v3
  • Loading branch information
Bob Moore authored and Len Brown committed Oct 23, 2008
1 parent 417b3c1 commit c02d006
Show file tree
Hide file tree
Showing 26 changed files with 311 additions and 293 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2425a0967f29b196fad5d4f726c9502679284656
refs/heads/master: 1044f1f65b7df2aae979e397904c4985eeb99ba2
83 changes: 43 additions & 40 deletions trunk/drivers/acpi/dispatcher/dsmthdat.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@

#include <acpi/acpi.h>
#include <acpi/acdispat.h>
#include <acpi/amlcode.h>
#include <acpi/acnamesp.h>
#include <acpi/acinterp.h>

Expand All @@ -52,11 +51,11 @@ ACPI_MODULE_NAME("dsmthdat")

/* Local prototypes */
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);

static acpi_status
acpi_ds_method_data_set_value(u16 opcode,
acpi_ds_method_data_set_value(u8 type,
u32 index,
union acpi_operand_object *object,
struct acpi_walk_state *walk_state);
Expand Down Expand Up @@ -216,7 +215,7 @@ acpi_ds_method_data_init_args(union acpi_operand_object **params,
* Store the argument in the method/walk descriptor.
* 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],
walk_state);
if (ACPI_FAILURE(status)) {
Expand All @@ -234,7 +233,8 @@ acpi_ds_method_data_init_args(union acpi_operand_object **params,
*
* 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
* walk_state - Current walk state object
* Node - Where the node is returned.
Expand All @@ -246,7 +246,7 @@ acpi_ds_method_data_init_args(union acpi_operand_object **params,
******************************************************************************/

acpi_status
acpi_ds_method_data_get_node(u16 opcode,
acpi_ds_method_data_get_node(u8 type,
u32 index,
struct acpi_walk_state *walk_state,
struct acpi_namespace_node **node)
Expand All @@ -256,8 +256,8 @@ acpi_ds_method_data_get_node(u16 opcode,
/*
* Method Locals and Arguments are supported
*/
switch (opcode) {
case AML_LOCAL_OP:
switch (type) {
case ACPI_REFCLASS_LOCAL:

if (index > ACPI_METHOD_MAX_LOCAL) {
ACPI_ERROR((AE_INFO,
Expand All @@ -271,7 +271,7 @@ acpi_ds_method_data_get_node(u16 opcode,
*node = &walk_state->local_variables[index];
break;

case AML_ARG_OP:
case ACPI_REFCLASS_ARG:

if (index > ACPI_METHOD_MAX_ARG) {
ACPI_ERROR((AE_INFO,
Expand All @@ -286,8 +286,8 @@ acpi_ds_method_data_get_node(u16 opcode,
break;

default:
ACPI_ERROR((AE_INFO, "Opcode %d is invalid", opcode));
return_ACPI_STATUS(AE_AML_BAD_OPCODE);
ACPI_ERROR((AE_INFO, "Type %d is invalid", type));
return_ACPI_STATUS(AE_TYPE);
}

return_ACPI_STATUS(AE_OK);
Expand All @@ -297,7 +297,8 @@ acpi_ds_method_data_get_node(u16 opcode,
*
* 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
* Object - Object to be inserted into the stack entry
* walk_state - Current walk state object
Expand All @@ -310,7 +311,7 @@ acpi_ds_method_data_get_node(u16 opcode,
******************************************************************************/

static acpi_status
acpi_ds_method_data_set_value(u16 opcode,
acpi_ds_method_data_set_value(u8 type,
u32 index,
union acpi_operand_object *object,
struct acpi_walk_state *walk_state)
Expand All @@ -321,13 +322,13 @@ acpi_ds_method_data_set_value(u16 opcode,
ACPI_FUNCTION_TRACE(ds_method_data_set_value);

ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
"NewObj %p Opcode %X, Refs=%d [%s]\n", object,
opcode, object->common.reference_count,
"NewObj %p Type %2.2X, Refs=%d [%s]\n", object,
type, object->common.reference_count,
acpi_ut_get_type_name(object->common.type)));

/* 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)) {
return_ACPI_STATUS(status);
}
Expand All @@ -350,7 +351,8 @@ acpi_ds_method_data_set_value(u16 opcode,
*
* 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
* walk_state - Current walk state object
* dest_desc - Where Arg or Local value is returned
Expand All @@ -363,7 +365,7 @@ acpi_ds_method_data_set_value(u16 opcode,
******************************************************************************/

acpi_status
acpi_ds_method_data_get_value(u16 opcode,
acpi_ds_method_data_get_value(u8 type,
u32 index,
struct acpi_walk_state *walk_state,
union acpi_operand_object **dest_desc)
Expand All @@ -383,7 +385,7 @@ acpi_ds_method_data_get_value(u16 opcode,

/* 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)) {
return_ACPI_STATUS(status);
}
Expand Down Expand Up @@ -419,16 +421,16 @@ acpi_ds_method_data_get_value(u16 opcode,
/* Otherwise, return the error */

else
switch (opcode) {
case AML_ARG_OP:
switch (type) {
case ACPI_REFCLASS_ARG:

ACPI_ERROR((AE_INFO,
"Uninitialized Arg[%d] at node %p",
index, node));

return_ACPI_STATUS(AE_AML_UNINITIALIZED_ARG);

case AML_LOCAL_OP:
case ACPI_REFCLASS_LOCAL:

ACPI_ERROR((AE_INFO,
"Uninitialized Local[%d] at node %p",
Expand All @@ -437,9 +439,10 @@ acpi_ds_method_data_get_value(u16 opcode,
return_ACPI_STATUS(AE_AML_UNINITIALIZED_LOCAL);

default:

ACPI_ERROR((AE_INFO,
"Not a Arg/Local opcode: %X",
opcode));
type));
return_ACPI_STATUS(AE_AML_INTERNAL);
}
}
Expand All @@ -458,7 +461,8 @@ acpi_ds_method_data_get_value(u16 opcode,
*
* 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
* walk_state - Current walk state object
*
Expand All @@ -470,7 +474,7 @@ acpi_ds_method_data_get_value(u16 opcode,
******************************************************************************/

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)
{
acpi_status status;
Expand All @@ -481,7 +485,7 @@ acpi_ds_method_data_delete_value(u16 opcode,

/* 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)) {
return_VOID;
}
Expand Down Expand Up @@ -514,7 +518,8 @@ acpi_ds_method_data_delete_value(u16 opcode,
*
* 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
* obj_desc - Value to be stored
* walk_state - Current walk state
Expand All @@ -528,7 +533,7 @@ acpi_ds_method_data_delete_value(u16 opcode,
******************************************************************************/

acpi_status
acpi_ds_store_object_to_local(u16 opcode,
acpi_ds_store_object_to_local(u8 type,
u32 index,
union acpi_operand_object *obj_desc,
struct acpi_walk_state *walk_state)
Expand All @@ -539,8 +544,8 @@ acpi_ds_store_object_to_local(u16 opcode,
union acpi_operand_object *new_obj_desc;

ACPI_FUNCTION_TRACE(ds_store_object_to_local);
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Opcode=%X Index=%d Obj=%p\n",
opcode, index, obj_desc));
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Type=%2.2X Index=%d Obj=%p\n",
type, index, obj_desc));

/* Parameter validation */

Expand All @@ -550,7 +555,7 @@ acpi_ds_store_object_to_local(u16 opcode,

/* 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)) {
return_ACPI_STATUS(status);
}
Expand Down Expand Up @@ -602,7 +607,7 @@ acpi_ds_store_object_to_local(u16 opcode,
*
* 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(),
* do the indirect store
Expand All @@ -611,8 +616,8 @@ acpi_ds_store_object_to_local(u16 opcode,
ACPI_DESC_TYPE_OPERAND)
&& (current_obj_desc->common.type ==
ACPI_TYPE_LOCAL_REFERENCE)
&& (current_obj_desc->reference.opcode ==
AML_REF_OF_OP)) {
&& (current_obj_desc->reference.class ==
ACPI_REFCLASS_REFOF)) {
ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
"Arg (%p) is an ObjRef(Node), storing in node %p\n",
new_obj_desc,
Expand Down Expand Up @@ -640,11 +645,9 @@ acpi_ds_store_object_to_local(u16 opcode,
}
}

/*
* Delete the existing object
* before storing the new one
*/
acpi_ds_method_data_delete_value(opcode, index, walk_state);
/* Delete the existing object before storing the new one */

acpi_ds_method_data_delete_value(type, index, walk_state);
}

/*
Expand All @@ -653,7 +656,7 @@ acpi_ds_store_object_to_local(u16 opcode,
* (increments the object reference count by one)
*/
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);

/* Remove local reference if we copied the object above */
Expand Down
56 changes: 34 additions & 22 deletions trunk/drivers/acpi/dispatcher/dsobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -731,36 +731,35 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state,
switch (op_info->type) {
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.offset = opcode - AML_LOCAL_OP;
obj_desc->reference.value = opcode - AML_LOCAL_OP;
obj_desc->reference.class = ACPI_REFCLASS_LOCAL;

#ifndef ACPI_NO_METHOD_EXECUTION
status = acpi_ds_method_data_get_node(AML_LOCAL_OP,
obj_desc->
reference.offset,
walk_state,
ACPI_CAST_INDIRECT_PTR
(struct
acpi_namespace_node,
&obj_desc->
reference.
object));
status =
acpi_ds_method_data_get_node(ACPI_REFCLASS_LOCAL,
obj_desc->reference.
value, walk_state,
ACPI_CAST_INDIRECT_PTR
(struct
acpi_namespace_node,
&obj_desc->reference.
object));
#endif
break;

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.offset = opcode - AML_ARG_OP;
obj_desc->reference.value = opcode - AML_ARG_OP;
obj_desc->reference.class = ACPI_REFCLASS_ARG;

#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->
reference.offset,
reference.value,
walk_state,
ACPI_CAST_INDIRECT_PTR
(struct
Expand All @@ -771,18 +770,31 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state,
#endif
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 */

obj_desc->reference.node = op->common.node;
obj_desc->reference.object =
op->common.node->object;
}
obj_desc->reference.class = ACPI_REFCLASS_NAME;
break;

case AML_DEBUG_OP:

obj_desc->reference.opcode = opcode;
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;
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/acpi/dispatcher/dsopcode.c
Original file line number Diff line number Diff line change
Expand Up @@ -1330,7 +1330,7 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state,
(walk_state->results->results.obj_desc[0]) ==
ACPI_TYPE_LOCAL_REFERENCE)
&& ((walk_state->results->results.obj_desc[0])->
reference.opcode != AML_INDEX_OP)) {
reference.class != ACPI_REFCLASS_INDEX)) {
status =
acpi_ex_resolve_to_value(&walk_state->
results->results.
Expand Down
Loading

0 comments on commit c02d006

Please sign in to comment.