Pull acpica into release branch
[pandora-kernel.git] / drivers / acpi / executer / exresolv.c
index 97eecbd..6499de8 100644 (file)
@@ -6,7 +6,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2005, R. Byron Moore
+ * Copyright (C) 2000 - 2006, R. Byron Moore
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -78,10 +78,10 @@ acpi_ex_resolve_to_value(union acpi_operand_object **stack_ptr,
 {
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE_PTR("ex_resolve_to_value", stack_ptr);
+       ACPI_FUNCTION_TRACE_PTR(ex_resolve_to_value, stack_ptr);
 
        if (!stack_ptr || !*stack_ptr) {
-               ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Internal - null pointer\n"));
+               ACPI_ERROR((AE_INFO, "Internal - null pointer"));
                return_ACPI_STATUS(AE_AML_NO_OPERAND);
        }
 
@@ -97,8 +97,7 @@ acpi_ex_resolve_to_value(union acpi_operand_object **stack_ptr,
                }
 
                if (!*stack_ptr) {
-                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                         "Internal - null pointer\n"));
+                       ACPI_ERROR((AE_INFO, "Internal - null pointer"));
                        return_ACPI_STATUS(AE_AML_NO_OPERAND);
                }
        }
@@ -145,7 +144,7 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr,
        union acpi_operand_object *obj_desc;
        u16 opcode;
 
-       ACPI_FUNCTION_TRACE("ex_resolve_object_to_value");
+       ACPI_FUNCTION_TRACE(ex_resolve_object_to_value);
 
        stack_desc = *stack_ptr;
 
@@ -191,7 +190,7 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr,
                        }
 
                        ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
-                                         "[Arg/Local %X] value_obj is %p\n",
+                                         "[Arg/Local %X] ValueObj is %p\n",
                                          stack_desc->reference.offset,
                                          obj_desc));
 
@@ -228,9 +227,9 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr,
                                         * A NULL object descriptor means an unitialized element of
                                         * the package, can't dereference it
                                         */
-                                       ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
-                                                         "Attempt to deref an Index to NULL pkg element Idx=%p\n",
-                                                         stack_desc));
+                                       ACPI_ERROR((AE_INFO,
+                                                   "Attempt to deref an Index to NULL pkg element Idx=%p",
+                                                   stack_desc));
                                        status = AE_AML_UNINITIALIZED_ELEMENT;
                                }
                                break;
@@ -239,7 +238,10 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr,
 
                                /* Invalid reference object */
 
-                               ACPI_REPORT_ERROR(("During resolve, Unknown target_type %X in Index/Reference obj %p\n", stack_desc->reference.target_type, stack_desc));
+                               ACPI_ERROR((AE_INFO,
+                                           "Unknown TargetType %X in Index/Reference obj %p",
+                                           stack_desc->reference.target_type,
+                                           stack_desc));
                                status = AE_AML_INTERNAL;
                                break;
                        }
@@ -255,16 +257,33 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr,
 
                case AML_INT_NAMEPATH_OP:       /* Reference to a named object */
 
-                       /* Get the object pointed to by the namespace node */
+                       /* Dereference the name */
+
+                       if ((stack_desc->reference.node->type ==
+                            ACPI_TYPE_DEVICE)
+                           || (stack_desc->reference.node->type ==
+                               ACPI_TYPE_THERMAL)) {
+
+                               /* These node types do not have 'real' subobjects */
+
+                               *stack_ptr = (void *)stack_desc->reference.node;
+                       } else {
+                               /* Get the object pointed to by the namespace node */
+
+                               *stack_ptr =
+                                   (stack_desc->reference.node)->object;
+                               acpi_ut_add_reference(*stack_ptr);
+                       }
 
-                       *stack_ptr = (stack_desc->reference.node)->object;
-                       acpi_ut_add_reference(*stack_ptr);
                        acpi_ut_remove_reference(stack_desc);
                        break;
 
                default:
 
-                       ACPI_REPORT_ERROR(("During resolve, Unknown Reference opcode %X (%s) in %p\n", opcode, acpi_ps_get_opcode_name(opcode), stack_desc));
+                       ACPI_ERROR((AE_INFO,
+                                   "Unknown Reference opcode %X (%s) in %p",
+                                   opcode, acpi_ps_get_opcode_name(opcode),
+                                   stack_desc));
                        status = AE_AML_INTERNAL;
                        break;
                }
@@ -288,7 +307,7 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr,
        case ACPI_TYPE_LOCAL_INDEX_FIELD:
 
                ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
-                                 "field_read source_desc=%p Type=%X\n",
+                                 "FieldRead SourceDesc=%p Type=%X\n",
                                  stack_desc,
                                  ACPI_GET_OBJECT_TYPE(stack_desc)));
 
@@ -332,7 +351,7 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state,
        acpi_object_type type;
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE("acpi_ex_resolve_multiple");
+       ACPI_FUNCTION_TRACE(acpi_ex_resolve_multiple);
 
        /* Operand can be either a namespace node or an operand descriptor */
 
@@ -377,16 +396,24 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state,
        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:
 
                        /* Dereference the reference pointer */
 
-                       node = obj_desc->reference.object;
+                       if (obj_desc->reference.opcode == AML_REF_OF_OP) {
+                               node = obj_desc->reference.object;
+                       } else {        /* AML_INT_NAMEPATH_OP */
+
+                               node = obj_desc->reference.node;
+                       }
 
                        /* All "References" point to a NS node */
 
                        if (ACPI_GET_DESCRIPTOR_TYPE(node) !=
                            ACPI_DESC_TYPE_NAMED) {
-                               ACPI_REPORT_ERROR(("acpi_ex_resolve_multiple: Not a NS node %p [%s]\n", node, acpi_ut_get_descriptor_name(node)));
+                               ACPI_ERROR((AE_INFO, "Not a NS node %p [%s]",
+                                           node,
+                                           acpi_ut_get_descriptor_name(node)));
                                return_ACPI_STATUS(AE_AML_INTERNAL);
                        }
 
@@ -394,6 +421,7 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state,
 
                        obj_desc = acpi_ns_get_attached_object(node);
                        if (!obj_desc) {
+
                                /* No object, use the NS node type */
 
                                type = acpi_ns_get_type(node);
@@ -425,6 +453,7 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state,
                         */
                        obj_desc = *(obj_desc->reference.where);
                        if (!obj_desc) {
+
                                /* NULL package elements are allowed */
 
                                type = 0;       /* Uninitialized */
@@ -432,37 +461,6 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state,
                        }
                        break;
 
-               case AML_INT_NAMEPATH_OP:
-
-                       /* Dereference the reference pointer */
-
-                       node = obj_desc->reference.node;
-
-                       /* All "References" point to a NS node */
-
-                       if (ACPI_GET_DESCRIPTOR_TYPE(node) !=
-                           ACPI_DESC_TYPE_NAMED) {
-                               ACPI_REPORT_ERROR(("acpi_ex_resolve_multiple: Not a NS node %p [%s]\n", node, acpi_ut_get_descriptor_name(node)));
-                               return_ACPI_STATUS(AE_AML_INTERNAL);
-                       }
-
-                       /* Get the attached object */
-
-                       obj_desc = acpi_ns_get_attached_object(node);
-                       if (!obj_desc) {
-                               /* No object, use the NS node type */
-
-                               type = acpi_ns_get_type(node);
-                               goto exit;
-                       }
-
-                       /* Check for circular references */
-
-                       if (obj_desc == operand) {
-                               return_ACPI_STATUS(AE_AML_CIRCULAR_REFERENCE);
-                       }
-                       break;
-
                case AML_LOCAL_OP:
                case AML_ARG_OP:
 
@@ -504,14 +502,16 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state,
 
                case AML_DEBUG_OP:
 
-                       /* The Debug Object is of type "debug_object" */
+                       /* The Debug Object is of type "DebugObject" */
 
                        type = ACPI_TYPE_DEBUG_OBJECT;
                        goto exit;
 
                default:
 
-                       ACPI_REPORT_ERROR(("acpi_ex_resolve_multiple: Unknown Reference subtype %X\n", obj_desc->reference.opcode));
+                       ACPI_ERROR((AE_INFO,
+                                   "Unknown Reference subtype %X",
+                                   obj_desc->reference.opcode));
                        return_ACPI_STATUS(AE_AML_INTERNAL);
                }
        }