[ACPI] ACPICA 20060127
[sfrench/cifs-2.6.git] / drivers / acpi / executer / exprep.c
index 3bde780c94cfb4845b5b5cfa8bb307b9fd1b2fc4..7719ae5d4f16a012b97b48244992518fdc7aa3ca 100644 (file)
@@ -274,7 +274,7 @@ acpi_ex_decode_field_access(union acpi_operand_object *obj_desc,
        default:
                /* Invalid field access type */
 
-               ACPI_REPORT_ERROR(("Unknown field access type %X\n", access));
+               ACPI_ERROR((AE_INFO, "Unknown field access type %X", access));
                return_UINT32(0);
        }
 
@@ -421,13 +421,15 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info)
 
        if (info->field_type != ACPI_TYPE_LOCAL_INDEX_FIELD) {
                if (!info->region_node) {
-                       ACPI_REPORT_ERROR(("Null region_node\n"));
+                       ACPI_ERROR((AE_INFO, "Null region_node"));
                        return_ACPI_STATUS(AE_AML_NO_OPERAND);
                }
 
                type = acpi_ns_get_type(info->region_node);
                if (type != ACPI_TYPE_REGION) {
-                       ACPI_REPORT_ERROR(("Needed Region, found type %X (%s)\n", type, acpi_ut_get_type_name(type)));
+                       ACPI_ERROR((AE_INFO,
+                                   "Needed Region, found type %X (%s)",
+                                   type, acpi_ut_get_type_name(type)));
 
                        return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
                }
@@ -496,17 +498,17 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info)
 
        case ACPI_TYPE_LOCAL_INDEX_FIELD:
 
+               /* Get the Index and Data registers */
+
                obj_desc->index_field.index_obj =
                    acpi_ns_get_attached_object(info->register_node);
                obj_desc->index_field.data_obj =
                    acpi_ns_get_attached_object(info->data_register_node);
-               obj_desc->index_field.value = (u32)
-                   (info->field_bit_position /
-                    ACPI_MUL_8(obj_desc->field.access_byte_width));
 
                if (!obj_desc->index_field.data_obj
                    || !obj_desc->index_field.index_obj) {
-                       ACPI_REPORT_ERROR(("Null Index Object during field prep\n"));
+                       ACPI_ERROR((AE_INFO,
+                                   "Null Index Object during field prep"));
                        acpi_ut_delete_object_desc(obj_desc);
                        return_ACPI_STATUS(AE_AML_INTERNAL);
                }
@@ -516,6 +518,15 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info)
                acpi_ut_add_reference(obj_desc->index_field.data_obj);
                acpi_ut_add_reference(obj_desc->index_field.index_obj);
 
+               /*
+                * The value written to the Index register is the byte offset of the
+                * target field
+                * Note: may change code to: ACPI_DIV_8 (Info->field_bit_position)
+                */
+               obj_desc->index_field.value = (u32)
+                   (info->field_bit_position /
+                    ACPI_MUL_8(obj_desc->field.access_byte_width));
+
                ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
                                  "index_field: bit_off %X, Off %X, Value %X, Gran %X, Index %p, Data %p\n",
                                  obj_desc->index_field.start_field_bit_offset,