]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/acpi/executer/exresolv.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6
[linux-2.6-omap-h63xx.git] / drivers / acpi / executer / exresolv.c
index 795ec8c7363c90d0a9bec63b85c8e4055d88d3e6..89571b92a52279258812e7cc6f93ad5024acc28b 100644 (file)
@@ -6,7 +6,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2007, R. Byron Moore
+ * Copyright (C) 2000 - 2008, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -47,7 +47,6 @@
 #include <acpi/acdispat.h>
 #include <acpi/acinterp.h>
 #include <acpi/acnamesp.h>
-#include <acpi/acparser.h>
 
 #define _COMPONENT          ACPI_EXECUTER
 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;
        union acpi_operand_object *stack_desc;
        union acpi_operand_object *obj_desc = NULL;
-       u16 opcode;
+       u8 ref_type;
 
        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)) {
        case ACPI_TYPE_LOCAL_REFERENCE:
 
-               opcode = stack_desc->reference.opcode;
+               ref_type = stack_desc->reference.class;
 
-               switch (opcode) {
-               case AML_LOCAL_OP:
-               case AML_ARG_OP:
+               switch (ref_type) {
+               case ACPI_REFCLASS_LOCAL:
+               case ACPI_REFCLASS_ARG:
 
                        /*
                         * Get the local from the method's state info
                         * 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->
-                                                              reference.offset,
+                                                              reference.value,
                                                               walk_state,
                                                               &obj_desc);
                        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,
                                          "[Arg/Local %X] ValueObj is %p\n",
-                                         stack_desc->reference.offset,
+                                         stack_desc->reference.value,
                                          obj_desc));
 
                        /*
@@ -184,26 +183,30 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr,
                        *stack_ptr = obj_desc;
                        break;
 
-               case AML_INDEX_OP:
+               case ACPI_REFCLASS_INDEX:
 
                        switch (stack_desc->reference.target_type) {
                        case ACPI_TYPE_BUFFER_FIELD:
 
-                               /* Just return - leave the Reference on the stack */
+                               /* Just return - do not dereference */
                                break;
 
                        case ACPI_TYPE_PACKAGE:
 
-                               /* If method call - leave the Reference on the stack */
+                               /* If method call or copy_object - do not dereference */
 
-                               if (walk_state->opcode == AML_INT_METHODCALL_OP) {
+                               if ((walk_state->opcode ==
+                                    AML_INT_METHODCALL_OP)
+                                   || (walk_state->opcode == AML_COPY_OP)) {
                                        break;
                                }
 
+                               /* Otherwise, dereference the package_index to a package element */
+
                                obj_desc = *stack_desc->reference.where;
                                if (obj_desc) {
                                        /*
-                                        * Valid obj descriptor, copy pointer to return value
+                                        * Valid object descriptor, copy pointer to return value
                                         * (i.e., dereference the package index)
                                         * Delete the ref object, increment the returned object
                                         */
@@ -212,7 +215,7 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr,
                                        *stack_ptr = obj_desc;
                                } else {
                                        /*
-                                        * A NULL object descriptor means an unitialized element of
+                                        * A NULL object descriptor means an uninitialized element of
                                         * the package, can't dereference it
                                         */
                                        ACPI_ERROR((AE_INFO,
@@ -235,15 +238,15 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr,
                        }
                        break;
 
-               case AML_REF_OF_OP:
-               case AML_DEBUG_OP:
-               case AML_LOAD_OP:
+               case ACPI_REFCLASS_REFOF:
+               case ACPI_REFCLASS_DEBUG:
+               case ACPI_REFCLASS_TABLE:
 
-                       /* Just leave the object as-is */
+                       /* Just leave the object as-is, do not dereference */
 
                        break;
 
-               case AML_INT_NAMEPATH_OP:       /* Reference to a named object */
+               case ACPI_REFCLASS_NAME:        /* Reference to a named object */
 
                        /* Dereference the name */
 
@@ -269,8 +272,7 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr,
                default:
 
                        ACPI_ERROR((AE_INFO,
-                                   "Unknown Reference opcode %X (%s) in %p",
-                                   opcode, acpi_ps_get_opcode_name(opcode),
+                                   "Unknown Reference type %X in %p", ref_type,
                                    stack_desc));
                        status = AE_AML_INTERNAL;
                        break;
@@ -378,19 +380,19 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state,
        }
 
        /*
-        * For reference objects created via the ref_of or Index operators,
-        * we need to get to the base object (as per the ACPI specification
-        * of the object_type and size_of operators). This means traversing
-        * the list of possibly many nested references.
+        * For reference objects created via the ref_of, Index, or Load/load_table
+        * operators, we need to get to the base object (as per the ACPI
+        * specification of the object_type and size_of operators). This means
+        * traversing the list of possibly many nested references.
         */
        while (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_REFERENCE) {
-               switch (obj_desc->reference.opcode) {
-               case AML_REF_OF_OP:
-               case AML_INT_NAMEPATH_OP:
+               switch (obj_desc->reference.class) {
+               case ACPI_REFCLASS_REFOF:
+               case ACPI_REFCLASS_NAME:
 
                        /* 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;
                        } else {        /* AML_INT_NAMEPATH_OP */
 
@@ -425,7 +427,7 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state,
                        }
                        break;
 
-               case AML_INDEX_OP:
+               case ACPI_REFCLASS_INDEX:
 
                        /* Get the type of this reference (index into another object) */
 
@@ -451,17 +453,22 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state,
                        }
                        break;
 
-               case AML_LOCAL_OP:
-               case AML_ARG_OP:
+               case ACPI_REFCLASS_TABLE:
+
+                       type = ACPI_TYPE_DDB_HANDLE;
+                       goto exit;
+
+               case ACPI_REFCLASS_LOCAL:
+               case ACPI_REFCLASS_ARG:
 
                        if (return_desc) {
                                status =
                                    acpi_ds_method_data_get_value(obj_desc->
                                                                  reference.
-                                                                 opcode,
+                                                                 class,
                                                                  obj_desc->
                                                                  reference.
-                                                                 offset,
+                                                                 value,
                                                                  walk_state,
                                                                  &obj_desc);
                                if (ACPI_FAILURE(status)) {
@@ -472,10 +479,10 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state,
                                status =
                                    acpi_ds_method_data_get_node(obj_desc->
                                                                 reference.
-                                                                opcode,
+                                                                class,
                                                                 obj_desc->
                                                                 reference.
-                                                                offset,
+                                                                value,
                                                                 walk_state,
                                                                 &node);
                                if (ACPI_FAILURE(status)) {
@@ -490,7 +497,7 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state,
                        }
                        break;
 
-               case AML_DEBUG_OP:
+               case ACPI_REFCLASS_DEBUG:
 
                        /* The Debug Object is of type "DebugObject" */
 
@@ -500,8 +507,8 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state,
                default:
 
                        ACPI_ERROR((AE_INFO,
-                                   "Unknown Reference subtype %X",
-                                   obj_desc->reference.opcode));
+                                   "Unknown Reference Class %2.2X",
+                                   obj_desc->reference.class));
                        return_ACPI_STATUS(AE_AML_INTERNAL);
                }
        }