aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/executer/exprep.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/executer/exprep.c')
-rw-r--r--drivers/acpi/executer/exprep.c34
1 files changed, 21 insertions, 13 deletions
diff --git a/drivers/acpi/executer/exprep.c b/drivers/acpi/executer/exprep.c
index 7476c363e407..7719ae5d4f16 100644
--- a/drivers/acpi/executer/exprep.c
+++ b/drivers/acpi/executer/exprep.c
@@ -6,7 +6,7 @@
6 *****************************************************************************/ 6 *****************************************************************************/
7 7
8/* 8/*
9 * Copyright (C) 2000 - 2005, R. Byron Moore 9 * Copyright (C) 2000 - 2006, R. Byron Moore
10 * All rights reserved. 10 * All rights reserved.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
@@ -274,9 +274,8 @@ acpi_ex_decode_field_access(union acpi_operand_object *obj_desc,
274 default: 274 default:
275 /* Invalid field access type */ 275 /* Invalid field access type */
276 276
277 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 277 ACPI_ERROR((AE_INFO, "Unknown field access type %X", access));
278 "Unknown field access type %X\n", access)); 278 return_UINT32(0);
279 return_VALUE(0);
280 } 279 }
281 280
282 if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_BUFFER_FIELD) { 281 if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_BUFFER_FIELD) {
@@ -289,7 +288,7 @@ acpi_ex_decode_field_access(union acpi_operand_object *obj_desc,
289 } 288 }
290 289
291 *return_byte_alignment = byte_alignment; 290 *return_byte_alignment = byte_alignment;
292 return_VALUE(bit_length); 291 return_UINT32(bit_length);
293} 292}
294 293
295/******************************************************************************* 294/*******************************************************************************
@@ -422,15 +421,15 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info)
422 421
423 if (info->field_type != ACPI_TYPE_LOCAL_INDEX_FIELD) { 422 if (info->field_type != ACPI_TYPE_LOCAL_INDEX_FIELD) {
424 if (!info->region_node) { 423 if (!info->region_node) {
425 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Null region_node\n")); 424 ACPI_ERROR((AE_INFO, "Null region_node"));
426 return_ACPI_STATUS(AE_AML_NO_OPERAND); 425 return_ACPI_STATUS(AE_AML_NO_OPERAND);
427 } 426 }
428 427
429 type = acpi_ns_get_type(info->region_node); 428 type = acpi_ns_get_type(info->region_node);
430 if (type != ACPI_TYPE_REGION) { 429 if (type != ACPI_TYPE_REGION) {
431 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 430 ACPI_ERROR((AE_INFO,
432 "Needed Region, found type %X (%s)\n", 431 "Needed Region, found type %X (%s)",
433 type, acpi_ut_get_type_name(type))); 432 type, acpi_ut_get_type_name(type)));
434 433
435 return_ACPI_STATUS(AE_AML_OPERAND_TYPE); 434 return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
436 } 435 }
@@ -499,17 +498,17 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info)
499 498
500 case ACPI_TYPE_LOCAL_INDEX_FIELD: 499 case ACPI_TYPE_LOCAL_INDEX_FIELD:
501 500
501 /* Get the Index and Data registers */
502
502 obj_desc->index_field.index_obj = 503 obj_desc->index_field.index_obj =
503 acpi_ns_get_attached_object(info->register_node); 504 acpi_ns_get_attached_object(info->register_node);
504 obj_desc->index_field.data_obj = 505 obj_desc->index_field.data_obj =
505 acpi_ns_get_attached_object(info->data_register_node); 506 acpi_ns_get_attached_object(info->data_register_node);
506 obj_desc->index_field.value = (u32)
507 (info->field_bit_position /
508 ACPI_MUL_8(obj_desc->field.access_byte_width));
509 507
510 if (!obj_desc->index_field.data_obj 508 if (!obj_desc->index_field.data_obj
511 || !obj_desc->index_field.index_obj) { 509 || !obj_desc->index_field.index_obj) {
512 ACPI_REPORT_ERROR(("Null Index Object during field prep\n")); 510 ACPI_ERROR((AE_INFO,
511 "Null Index Object during field prep"));
513 acpi_ut_delete_object_desc(obj_desc); 512 acpi_ut_delete_object_desc(obj_desc);
514 return_ACPI_STATUS(AE_AML_INTERNAL); 513 return_ACPI_STATUS(AE_AML_INTERNAL);
515 } 514 }
@@ -519,6 +518,15 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info)
519 acpi_ut_add_reference(obj_desc->index_field.data_obj); 518 acpi_ut_add_reference(obj_desc->index_field.data_obj);
520 acpi_ut_add_reference(obj_desc->index_field.index_obj); 519 acpi_ut_add_reference(obj_desc->index_field.index_obj);
521 520
521 /*
522 * The value written to the Index register is the byte offset of the
523 * target field
524 * Note: may change code to: ACPI_DIV_8 (Info->field_bit_position)
525 */
526 obj_desc->index_field.value = (u32)
527 (info->field_bit_position /
528 ACPI_MUL_8(obj_desc->field.access_byte_width));
529
522 ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, 530 ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
523 "index_field: bit_off %X, Off %X, Value %X, Gran %X, Index %p, Data %p\n", 531 "index_field: bit_off %X, Off %X, Value %X, Gran %X, Index %p, Data %p\n",
524 obj_desc->index_field.start_field_bit_offset, 532 obj_desc->index_field.start_field_bit_offset,