[ACPI] ACPICA 20060127
[pandora-kernel.git] / drivers / acpi / executer / exresop.c
index 804faeb..a1c000f 100644 (file)
@@ -46,6 +46,7 @@
 #include <acpi/amlcode.h>
 #include <acpi/acparser.h>
 #include <acpi/acinterp.h>
+#include <acpi/acnamesp.h>
 
 #define _COMPONENT          ACPI_EXECUTER
 ACPI_MODULE_NAME("exresop")
@@ -95,9 +96,10 @@ acpi_ex_check_object_type(acpi_object_type type_needed,
        }
 
        if (type_needed != this_type) {
-               ACPI_REPORT_ERROR(("Needed type [%s], found [%s] %p\n",
-                                  acpi_ut_get_type_name(type_needed),
-                                  acpi_ut_get_type_name(this_type), object));
+               ACPI_ERROR((AE_INFO,
+                           "Needed type [%s], found [%s] %p",
+                           acpi_ut_get_type_name(type_needed),
+                           acpi_ut_get_type_name(this_type), object));
 
                return (AE_AML_OPERAND_TYPE);
        }
@@ -150,7 +152,7 @@ acpi_ex_resolve_operands(u16 opcode,
 
        arg_types = op_info->runtime_args;
        if (arg_types == ARGI_INVALID_OPCODE) {
-               ACPI_REPORT_ERROR(("Unknown AML opcode %X\n", opcode));
+               ACPI_ERROR((AE_INFO, "Unknown AML opcode %X", opcode));
 
                return_ACPI_STATUS(AE_AML_INTERNAL);
        }
@@ -168,8 +170,8 @@ acpi_ex_resolve_operands(u16 opcode,
         */
        while (GET_CURRENT_ARG_TYPE(arg_types)) {
                if (!stack_ptr || !*stack_ptr) {
-                       ACPI_REPORT_ERROR(("Null stack entry at %p\n",
-                                          stack_ptr));
+                       ACPI_ERROR((AE_INFO, "Null stack entry at %p",
+                                   stack_ptr));
 
                        return_ACPI_STATUS(AE_AML_INTERNAL);
                }
@@ -187,6 +189,22 @@ acpi_ex_resolve_operands(u16 opcode,
 
                        object_type =
                            ((struct acpi_namespace_node *)obj_desc)->type;
+
+                       /*
+                        * Resolve an alias object. The construction of these objects
+                        * guarantees that there is only one level of alias indirection;
+                        * thus, the attached object is always the aliased namespace node
+                        */
+                       if (object_type == ACPI_TYPE_LOCAL_ALIAS) {
+                               obj_desc =
+                                   acpi_ns_get_attached_object((struct
+                                                                acpi_namespace_node
+                                                                *)obj_desc);
+                               *stack_ptr = obj_desc;
+                               object_type =
+                                   ((struct acpi_namespace_node *)obj_desc)->
+                                   type;
+                       }
                        break;
 
                case ACPI_DESC_TYPE_OPERAND:
@@ -198,7 +216,9 @@ acpi_ex_resolve_operands(u16 opcode,
                        /* Check for bad acpi_object_type */
 
                        if (!acpi_ut_valid_object_type(object_type)) {
-                               ACPI_REPORT_ERROR(("Bad operand object type [%X]\n", object_type));
+                               ACPI_ERROR((AE_INFO,
+                                           "Bad operand object type [%X]",
+                                           object_type));
 
                                return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
                        }
@@ -236,7 +256,10 @@ acpi_ex_resolve_operands(u16 opcode,
                                        break;
 
                                default:
-                                       ACPI_REPORT_ERROR(("Operand is a Reference, Unknown Reference Opcode: %X\n", obj_desc->reference.opcode));
+                                       ACPI_ERROR((AE_INFO,
+                                                   "Operand is a Reference, Unknown Reference Opcode: %X",
+                                                   obj_desc->reference.
+                                                   opcode));
 
                                        return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
                                }
@@ -247,10 +270,10 @@ acpi_ex_resolve_operands(u16 opcode,
 
                        /* Invalid descriptor */
 
-                       ACPI_REPORT_ERROR(("Invalid descriptor %p [%s]\n",
-                                          obj_desc,
-                                          acpi_ut_get_descriptor_name
-                                          (obj_desc)));
+                       ACPI_ERROR((AE_INFO,
+                                   "Invalid descriptor %p [%s]",
+                                   obj_desc,
+                                   acpi_ut_get_descriptor_name(obj_desc)));
 
                        return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
                }
@@ -408,7 +431,10 @@ acpi_ex_resolve_operands(u16 opcode,
                            acpi_ex_convert_to_integer(obj_desc, stack_ptr, 16);
                        if (ACPI_FAILURE(status)) {
                                if (status == AE_TYPE) {
-                                       ACPI_REPORT_ERROR(("Needed [Integer/String/Buffer], found [%s] %p\n", acpi_ut_get_object_type_name(obj_desc), obj_desc));
+                                       ACPI_ERROR((AE_INFO,
+                                                   "Needed [Integer/String/Buffer], found [%s] %p",
+                                                   acpi_ut_get_object_type_name
+                                                   (obj_desc), obj_desc));
 
                                        return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
                                }
@@ -431,7 +457,10 @@ acpi_ex_resolve_operands(u16 opcode,
                        status = acpi_ex_convert_to_buffer(obj_desc, stack_ptr);
                        if (ACPI_FAILURE(status)) {
                                if (status == AE_TYPE) {
-                                       ACPI_REPORT_ERROR(("Needed [Integer/String/Buffer], found [%s] %p\n", acpi_ut_get_object_type_name(obj_desc), obj_desc));
+                                       ACPI_ERROR((AE_INFO,
+                                                   "Needed [Integer/String/Buffer], found [%s] %p",
+                                                   acpi_ut_get_object_type_name
+                                                   (obj_desc), obj_desc));
 
                                        return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
                                }
@@ -455,7 +484,10 @@ acpi_ex_resolve_operands(u16 opcode,
                                                           ACPI_IMPLICIT_CONVERT_HEX);
                        if (ACPI_FAILURE(status)) {
                                if (status == AE_TYPE) {
-                                       ACPI_REPORT_ERROR(("Needed [Integer/String/Buffer], found [%s] %p\n", acpi_ut_get_object_type_name(obj_desc), obj_desc));
+                                       ACPI_ERROR((AE_INFO,
+                                                   "Needed [Integer/String/Buffer], found [%s] %p",
+                                                   acpi_ut_get_object_type_name
+                                                   (obj_desc), obj_desc));
 
                                        return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
                                }
@@ -481,7 +513,10 @@ acpi_ex_resolve_operands(u16 opcode,
                                break;
 
                        default:
-                               ACPI_REPORT_ERROR(("Needed [Integer/String/Buffer], found [%s] %p\n", acpi_ut_get_object_type_name(obj_desc), obj_desc));
+                               ACPI_ERROR((AE_INFO,
+                                           "Needed [Integer/String/Buffer], found [%s] %p",
+                                           acpi_ut_get_object_type_name
+                                           (obj_desc), obj_desc));
 
                                return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
                        }
@@ -515,7 +550,10 @@ acpi_ex_resolve_operands(u16 opcode,
                                break;
 
                        default:
-                               ACPI_REPORT_ERROR(("Needed [Integer/String/Buffer], found [%s] %p\n", acpi_ut_get_object_type_name(obj_desc), obj_desc));
+                               ACPI_ERROR((AE_INFO,
+                                           "Needed [Integer/String/Buffer], found [%s] %p",
+                                           acpi_ut_get_object_type_name
+                                           (obj_desc), obj_desc));
 
                                return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
                        }
@@ -539,7 +577,10 @@ acpi_ex_resolve_operands(u16 opcode,
                                break;
 
                        default:
-                               ACPI_REPORT_ERROR(("Needed [Buffer/String/Package/Reference], found [%s] %p\n", acpi_ut_get_object_type_name(obj_desc), obj_desc));
+                               ACPI_ERROR((AE_INFO,
+                                           "Needed [Buffer/String/Package/Reference], found [%s] %p",
+                                           acpi_ut_get_object_type_name
+                                           (obj_desc), obj_desc));
 
                                return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
                        }
@@ -558,7 +599,10 @@ acpi_ex_resolve_operands(u16 opcode,
                                break;
 
                        default:
-                               ACPI_REPORT_ERROR(("Needed [Buffer/String/Package], found [%s] %p\n", acpi_ut_get_object_type_name(obj_desc), obj_desc));
+                               ACPI_ERROR((AE_INFO,
+                                           "Needed [Buffer/String/Package], found [%s] %p",
+                                           acpi_ut_get_object_type_name
+                                           (obj_desc), obj_desc));
 
                                return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
                        }
@@ -578,7 +622,10 @@ acpi_ex_resolve_operands(u16 opcode,
                                break;
 
                        default:
-                               ACPI_REPORT_ERROR(("Needed [Region/region_field], found [%s] %p\n", acpi_ut_get_object_type_name(obj_desc), obj_desc));
+                               ACPI_ERROR((AE_INFO,
+                                           "Needed [Region/region_field], found [%s] %p",
+                                           acpi_ut_get_object_type_name
+                                           (obj_desc), obj_desc));
 
                                return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
                        }
@@ -620,7 +667,10 @@ acpi_ex_resolve_operands(u16 opcode,
                                        break;
                                }
 
-                               ACPI_REPORT_ERROR(("Needed Integer/Buffer/String/Package/Ref/Ddb], found [%s] %p\n", acpi_ut_get_object_type_name(obj_desc), obj_desc));
+                               ACPI_ERROR((AE_INFO,
+                                           "Needed Integer/Buffer/String/Package/Ref/Ddb], found [%s] %p",
+                                           acpi_ut_get_object_type_name
+                                           (obj_desc), obj_desc));
 
                                return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
                        }
@@ -630,7 +680,9 @@ acpi_ex_resolve_operands(u16 opcode,
 
                        /* Unknown type */
 
-                       ACPI_REPORT_ERROR(("Internal - Unknown ARGI (required operand) type %X\n", this_arg_type));
+                       ACPI_ERROR((AE_INFO,
+                                   "Internal - Unknown ARGI (required operand) type %X",
+                                   this_arg_type));
 
                        return_ACPI_STATUS(AE_BAD_PARAMETER);
                }