aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/dispatcher/dsopcode.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/dispatcher/dsopcode.c')
-rw-r--r--drivers/acpi/dispatcher/dsopcode.c105
1 files changed, 70 insertions, 35 deletions
diff --git a/drivers/acpi/dispatcher/dsopcode.c b/drivers/acpi/dispatcher/dsopcode.c
index 5c987a0e7b75..ba13bca28bee 100644
--- a/drivers/acpi/dispatcher/dsopcode.c
+++ b/drivers/acpi/dispatcher/dsopcode.c
@@ -54,12 +54,31 @@
54#define _COMPONENT ACPI_DISPATCHER 54#define _COMPONENT ACPI_DISPATCHER
55 ACPI_MODULE_NAME ("dsopcode") 55 ACPI_MODULE_NAME ("dsopcode")
56 56
57/* Local prototypes */
57 58
58/***************************************************************************** 59static acpi_status
60acpi_ds_execute_arguments (
61 struct acpi_namespace_node *node,
62 struct acpi_namespace_node *scope_node,
63 u32 aml_length,
64 u8 *aml_start);
65
66static acpi_status
67acpi_ds_init_buffer_field (
68 u16 aml_opcode,
69 union acpi_operand_object *obj_desc,
70 union acpi_operand_object *buffer_desc,
71 union acpi_operand_object *offset_desc,
72 union acpi_operand_object *length_desc,
73 union acpi_operand_object *result_desc);
74
75
76/*******************************************************************************
59 * 77 *
60 * FUNCTION: acpi_ds_execute_arguments 78 * FUNCTION: acpi_ds_execute_arguments
61 * 79 *
62 * PARAMETERS: Node - Parent NS node 80 * PARAMETERS: Node - Object NS node
81 * scope_node - Parent NS node
63 * aml_length - Length of executable AML 82 * aml_length - Length of executable AML
64 * aml_start - Pointer to the AML 83 * aml_start - Pointer to the AML
65 * 84 *
@@ -67,9 +86,9 @@
67 * 86 *
68 * DESCRIPTION: Late (deferred) execution of region or field arguments 87 * DESCRIPTION: Late (deferred) execution of region or field arguments
69 * 88 *
70 ****************************************************************************/ 89 ******************************************************************************/
71 90
72acpi_status 91static acpi_status
73acpi_ds_execute_arguments ( 92acpi_ds_execute_arguments (
74 struct acpi_namespace_node *node, 93 struct acpi_namespace_node *node,
75 struct acpi_namespace_node *scope_node, 94 struct acpi_namespace_node *scope_node,
@@ -162,7 +181,7 @@ acpi_ds_execute_arguments (
162} 181}
163 182
164 183
165/***************************************************************************** 184/*******************************************************************************
166 * 185 *
167 * FUNCTION: acpi_ds_get_buffer_field_arguments 186 * FUNCTION: acpi_ds_get_buffer_field_arguments
168 * 187 *
@@ -173,7 +192,7 @@ acpi_ds_execute_arguments (
173 * DESCRIPTION: Get buffer_field Buffer and Index. This implements the late 192 * DESCRIPTION: Get buffer_field Buffer and Index. This implements the late
174 * evaluation of these field attributes. 193 * evaluation of these field attributes.
175 * 194 *
176 ****************************************************************************/ 195 ******************************************************************************/
177 196
178acpi_status 197acpi_status
179acpi_ds_get_buffer_field_arguments ( 198acpi_ds_get_buffer_field_arguments (
@@ -208,7 +227,7 @@ acpi_ds_get_buffer_field_arguments (
208} 227}
209 228
210 229
211/***************************************************************************** 230/*******************************************************************************
212 * 231 *
213 * FUNCTION: acpi_ds_get_buffer_arguments 232 * FUNCTION: acpi_ds_get_buffer_arguments
214 * 233 *
@@ -219,7 +238,7 @@ acpi_ds_get_buffer_field_arguments (
219 * DESCRIPTION: Get Buffer length and initializer byte list. This implements 238 * DESCRIPTION: Get Buffer length and initializer byte list. This implements
220 * the late evaluation of these attributes. 239 * the late evaluation of these attributes.
221 * 240 *
222 ****************************************************************************/ 241 ******************************************************************************/
223 242
224acpi_status 243acpi_status
225acpi_ds_get_buffer_arguments ( 244acpi_ds_get_buffer_arguments (
@@ -255,7 +274,7 @@ acpi_ds_get_buffer_arguments (
255} 274}
256 275
257 276
258/***************************************************************************** 277/*******************************************************************************
259 * 278 *
260 * FUNCTION: acpi_ds_get_package_arguments 279 * FUNCTION: acpi_ds_get_package_arguments
261 * 280 *
@@ -266,7 +285,7 @@ acpi_ds_get_buffer_arguments (
266 * DESCRIPTION: Get Package length and initializer byte list. This implements 285 * DESCRIPTION: Get Package length and initializer byte list. This implements
267 * the late evaluation of these attributes. 286 * the late evaluation of these attributes.
268 * 287 *
269 ****************************************************************************/ 288 ******************************************************************************/
270 289
271acpi_status 290acpi_status
272acpi_ds_get_package_arguments ( 291acpi_ds_get_package_arguments (
@@ -353,17 +372,17 @@ acpi_ds_get_region_arguments (
353} 372}
354 373
355 374
356/***************************************************************************** 375/*******************************************************************************
357 * 376 *
358 * FUNCTION: acpi_ds_initialize_region 377 * FUNCTION: acpi_ds_initialize_region
359 * 378 *
360 * PARAMETERS: Op - A valid region Op object 379 * PARAMETERS: obj_handle - Region namespace node
361 * 380 *
362 * RETURN: Status 381 * RETURN: Status
363 * 382 *
364 * DESCRIPTION: Front end to ev_initialize_region 383 * DESCRIPTION: Front end to ev_initialize_region
365 * 384 *
366 ****************************************************************************/ 385 ******************************************************************************/
367 386
368acpi_status 387acpi_status
369acpi_ds_initialize_region ( 388acpi_ds_initialize_region (
@@ -382,7 +401,7 @@ acpi_ds_initialize_region (
382} 401}
383 402
384 403
385/***************************************************************************** 404/*******************************************************************************
386 * 405 *
387 * FUNCTION: acpi_ds_init_buffer_field 406 * FUNCTION: acpi_ds_init_buffer_field
388 * 407 *
@@ -390,16 +409,16 @@ acpi_ds_initialize_region (
390 * obj_desc - buffer_field object 409 * obj_desc - buffer_field object
391 * buffer_desc - Host Buffer 410 * buffer_desc - Host Buffer
392 * offset_desc - Offset into buffer 411 * offset_desc - Offset into buffer
393 * Length - Length of field (CREATE_FIELD_OP only) 412 * length_desc - Length of field (CREATE_FIELD_OP only)
394 * Result - Where to store the result 413 * result_desc - Where to store the result
395 * 414 *
396 * RETURN: Status 415 * RETURN: Status
397 * 416 *
398 * DESCRIPTION: Perform actual initialization of a buffer field 417 * DESCRIPTION: Perform actual initialization of a buffer field
399 * 418 *
400 ****************************************************************************/ 419 ******************************************************************************/
401 420
402acpi_status 421static acpi_status
403acpi_ds_init_buffer_field ( 422acpi_ds_init_buffer_field (
404 u16 aml_opcode, 423 u16 aml_opcode,
405 union acpi_operand_object *obj_desc, 424 union acpi_operand_object *obj_desc,
@@ -435,8 +454,10 @@ acpi_ds_init_buffer_field (
435 * after resolution in acpi_ex_resolve_operands(). 454 * after resolution in acpi_ex_resolve_operands().
436 */ 455 */
437 if (ACPI_GET_DESCRIPTOR_TYPE (result_desc) != ACPI_DESC_TYPE_NAMED) { 456 if (ACPI_GET_DESCRIPTOR_TYPE (result_desc) != ACPI_DESC_TYPE_NAMED) {
438 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "(%s) destination not a NS Node [%s]\n", 457 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
439 acpi_ps_get_opcode_name (aml_opcode), acpi_ut_get_descriptor_name (result_desc))); 458 "(%s) destination not a NS Node [%s]\n",
459 acpi_ps_get_opcode_name (aml_opcode),
460 acpi_ut_get_descriptor_name (result_desc)));
440 461
441 status = AE_AML_OPERAND_TYPE; 462 status = AE_AML_OPERAND_TYPE;
442 goto cleanup; 463 goto cleanup;
@@ -452,9 +473,18 @@ acpi_ds_init_buffer_field (
452 473
453 /* Offset is in bits, count is in bits */ 474 /* Offset is in bits, count is in bits */
454 475
476 field_flags = AML_FIELD_ACCESS_BYTE;
455 bit_offset = offset; 477 bit_offset = offset;
456 bit_count = (u32) length_desc->integer.value; 478 bit_count = (u32) length_desc->integer.value;
457 field_flags = AML_FIELD_ACCESS_BYTE; 479
480 /* Must have a valid (>0) bit count */
481
482 if (bit_count == 0) {
483 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
484 "Attempt to create_field of length 0\n"));
485 status = AE_AML_OPERAND_VALUE;
486 goto cleanup;
487 }
458 break; 488 break;
459 489
460 case AML_CREATE_BIT_FIELD_OP: 490 case AML_CREATE_BIT_FIELD_OP:
@@ -527,7 +557,8 @@ acpi_ds_init_buffer_field (
527 557
528 /* 558 /*
529 * Initialize areas of the field object that are common to all fields 559 * Initialize areas of the field object that are common to all fields
530 * For field_flags, use LOCK_RULE = 0 (NO_LOCK), UPDATE_RULE = 0 (UPDATE_PRESERVE) 560 * For field_flags, use LOCK_RULE = 0 (NO_LOCK),
561 * UPDATE_RULE = 0 (UPDATE_PRESERVE)
531 */ 562 */
532 status = acpi_ex_prep_common_field_object (obj_desc, field_flags, 0, 563 status = acpi_ex_prep_common_field_object (obj_desc, field_flags, 0,
533 bit_offset, bit_count); 564 bit_offset, bit_count);
@@ -539,8 +570,8 @@ acpi_ds_init_buffer_field (
539 570
540 /* Reference count for buffer_desc inherits obj_desc count */ 571 /* Reference count for buffer_desc inherits obj_desc count */
541 572
542 buffer_desc->common.reference_count = (u16) (buffer_desc->common.reference_count + 573 buffer_desc->common.reference_count = (u16)
543 obj_desc->common.reference_count); 574 (buffer_desc->common.reference_count + obj_desc->common.reference_count);
544 575
545 576
546cleanup: 577cleanup:
@@ -569,7 +600,7 @@ cleanup:
569} 600}
570 601
571 602
572/***************************************************************************** 603/*******************************************************************************
573 * 604 *
574 * FUNCTION: acpi_ds_eval_buffer_field_operands 605 * FUNCTION: acpi_ds_eval_buffer_field_operands
575 * 606 *
@@ -581,7 +612,7 @@ cleanup:
581 * DESCRIPTION: Get buffer_field Buffer and Index 612 * DESCRIPTION: Get buffer_field Buffer and Index
582 * Called from acpi_ds_exec_end_op during buffer_field parse tree walk 613 * Called from acpi_ds_exec_end_op during buffer_field parse tree walk
583 * 614 *
584 ****************************************************************************/ 615 ******************************************************************************/
585 616
586acpi_status 617acpi_status
587acpi_ds_eval_buffer_field_operands ( 618acpi_ds_eval_buffer_field_operands (
@@ -656,7 +687,7 @@ acpi_ds_eval_buffer_field_operands (
656} 687}
657 688
658 689
659/***************************************************************************** 690/*******************************************************************************
660 * 691 *
661 * FUNCTION: acpi_ds_eval_region_operands 692 * FUNCTION: acpi_ds_eval_region_operands
662 * 693 *
@@ -668,7 +699,7 @@ acpi_ds_eval_buffer_field_operands (
668 * DESCRIPTION: Get region address and length 699 * DESCRIPTION: Get region address and length
669 * Called from acpi_ds_exec_end_op during op_region parse tree walk 700 * Called from acpi_ds_exec_end_op during op_region parse tree walk
670 * 701 *
671 ****************************************************************************/ 702 ******************************************************************************/
672 703
673acpi_status 704acpi_status
674acpi_ds_eval_region_operands ( 705acpi_ds_eval_region_operands (
@@ -686,7 +717,8 @@ acpi_ds_eval_region_operands (
686 717
687 718
688 /* 719 /*
689 * This is where we evaluate the address and length fields of the op_region declaration 720 * This is where we evaluate the address and length fields of the
721 * op_region declaration
690 */ 722 */
691 node = op->common.node; 723 node = op->common.node;
692 724
@@ -707,7 +739,8 @@ acpi_ds_eval_region_operands (
707 739
708 /* Resolve the length and address operands to numbers */ 740 /* Resolve the length and address operands to numbers */
709 741
710 status = acpi_ex_resolve_operands (op->common.aml_opcode, ACPI_WALK_OPERANDS, walk_state); 742 status = acpi_ex_resolve_operands (op->common.aml_opcode,
743 ACPI_WALK_OPERANDS, walk_state);
711 if (ACPI_FAILURE (status)) { 744 if (ACPI_FAILURE (status)) {
712 return_ACPI_STATUS (status); 745 return_ACPI_STATUS (status);
713 } 746 }
@@ -736,7 +769,8 @@ acpi_ds_eval_region_operands (
736 */ 769 */
737 operand_desc = walk_state->operands[walk_state->num_operands - 2]; 770 operand_desc = walk_state->operands[walk_state->num_operands - 2];
738 771
739 obj_desc->region.address = (acpi_physical_address) operand_desc->integer.value; 772 obj_desc->region.address = (acpi_physical_address)
773 operand_desc->integer.value;
740 acpi_ut_remove_reference (operand_desc); 774 acpi_ut_remove_reference (operand_desc);
741 775
742 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "rgn_obj %p Addr %8.8X%8.8X Len %X\n", 776 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "rgn_obj %p Addr %8.8X%8.8X Len %X\n",
@@ -752,7 +786,7 @@ acpi_ds_eval_region_operands (
752} 786}
753 787
754 788
755/***************************************************************************** 789/*******************************************************************************
756 * 790 *
757 * FUNCTION: acpi_ds_eval_data_object_operands 791 * FUNCTION: acpi_ds_eval_data_object_operands
758 * 792 *
@@ -765,7 +799,7 @@ acpi_ds_eval_region_operands (
765 * DESCRIPTION: Get the operands and complete the following data object types: 799 * DESCRIPTION: Get the operands and complete the following data object types:
766 * Buffer, Package. 800 * Buffer, Package.
767 * 801 *
768 ****************************************************************************/ 802 ******************************************************************************/
769 803
770acpi_status 804acpi_status
771acpi_ds_eval_data_object_operands ( 805acpi_ds_eval_data_object_operands (
@@ -830,7 +864,7 @@ acpi_ds_eval_data_object_operands (
830 864
831 if (ACPI_SUCCESS (status)) { 865 if (ACPI_SUCCESS (status)) {
832 /* 866 /*
833 * Return the object in the walk_state, unless the parent is a package -- 867 * Return the object in the walk_state, unless the parent is a package -
834 * in this case, the return object will be stored in the parse tree 868 * in this case, the return object will be stored in the parse tree
835 * for the package. 869 * for the package.
836 */ 870 */
@@ -988,7 +1022,8 @@ acpi_ds_exec_end_control_op (
988 status = AE_CTRL_PENDING; 1022 status = AE_CTRL_PENDING;
989 } 1023 }
990 1024
991 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[WHILE_OP] termination! Op=%p\n", op)); 1025 ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
1026 "[WHILE_OP] termination! Op=%p\n",op));
992 1027
993 /* Pop this control state and free it */ 1028 /* Pop this control state and free it */
994 1029