aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/dispatcher/dsopcode.c
diff options
context:
space:
mode:
authorBob Moore <robert.moore@intel.com>2006-04-21 17:15:00 -0400
committerLen Brown <len.brown@intel.com>2006-06-14 02:30:55 -0400
commitb229cf92eee616c7cb5ad8cdb35a19b119f00bc8 (patch)
tree74b52bec6ec029859c2320aba227290a503af31a /drivers/acpi/dispatcher/dsopcode.c
parent793c2388cae3fd023b3b5166354931752d42353c (diff)
ACPI: ACPICA 20060421
Removed a device initialization optimization introduced in 20051216 where the _STA method was not run unless an _INI was also present for the same device. This optimization could cause problems because it could allow _INI methods to be run within a not-present device subtree (If a not-present device had no _INI, _STA would not be run, the not-present status would not be discovered, and the children of the device would be incorrectly traversed.) Implemented a new _STA optimization where namespace subtrees that do not contain _INI are identified and ignored during device initialization. Selectively running _STA can significantly improve boot time on large machines (with assistance from Len Brown.) Implemented support for the device initialization case where the returned _STA flags indicate a device not-present but functioning. In this case, _INI is not run, but the device children are examined for presence, as per the ACPI specification. Implemented an additional change to the IndexField support in order to conform to MS behavior. The value written to the Index Register is not simply a byte offset, it is a byte offset in units of the access width of the parent Index Field. (Fiodor Suietov) Defined and deployed a new OSL interface, acpi_os_validate_address(). This interface is called during the creation of all AML operation regions, and allows the host OS to exert control over what addresses it will allow the AML code to access. Operation Regions whose addresses are disallowed will cause a runtime exception when they are actually accessed (will not affect or abort table loading.) Defined and deployed a new OSL interface, acpi_os_validate_interface(). This interface allows the host OS to match the various "optional" interface/behavior strings for the _OSI predefined control method as appropriate (with assistance from Bjorn Helgaas.) Restructured and corrected various problems in the exception handling code paths within DsCallControlMethod and DsTerminateControlMethod in dsmethod (with assistance from Takayoshi Kochi.) Modified the Linux source converter to ignore quoted string literals while converting identifiers from mixed to lower case. This will correct problems with the disassembler and other areas where such strings must not be modified. The ACPI_FUNCTION_* macros no longer require quotes around the function name. This allows the Linux source converter to convert the names, now that the converter ignores quoted strings. Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/dispatcher/dsopcode.c')
-rw-r--r--drivers/acpi/dispatcher/dsopcode.c59
1 files changed, 40 insertions, 19 deletions
diff --git a/drivers/acpi/dispatcher/dsopcode.c b/drivers/acpi/dispatcher/dsopcode.c
index 8a690a9963f2..5b974a8fe614 100644
--- a/drivers/acpi/dispatcher/dsopcode.c
+++ b/drivers/acpi/dispatcher/dsopcode.c
@@ -91,7 +91,7 @@ acpi_ds_execute_arguments(struct acpi_namespace_node *node,
91 union acpi_parse_object *op; 91 union acpi_parse_object *op;
92 struct acpi_walk_state *walk_state; 92 struct acpi_walk_state *walk_state;
93 93
94 ACPI_FUNCTION_TRACE("ds_execute_arguments"); 94 ACPI_FUNCTION_TRACE(ds_execute_arguments);
95 95
96 /* 96 /*
97 * Allocate a new parser op to be the root of the parsed tree 97 * Allocate a new parser op to be the root of the parsed tree
@@ -193,7 +193,7 @@ acpi_ds_get_buffer_field_arguments(union acpi_operand_object *obj_desc)
193 struct acpi_namespace_node *node; 193 struct acpi_namespace_node *node;
194 acpi_status status; 194 acpi_status status;
195 195
196 ACPI_FUNCTION_TRACE_PTR("ds_get_buffer_field_arguments", obj_desc); 196 ACPI_FUNCTION_TRACE_PTR(ds_get_buffer_field_arguments, obj_desc);
197 197
198 if (obj_desc->common.flags & AOPOBJ_DATA_VALID) { 198 if (obj_desc->common.flags & AOPOBJ_DATA_VALID) {
199 return_ACPI_STATUS(AE_OK); 199 return_ACPI_STATUS(AE_OK);
@@ -206,7 +206,7 @@ acpi_ds_get_buffer_field_arguments(union acpi_operand_object *obj_desc)
206 206
207 ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname 207 ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname
208 (ACPI_TYPE_BUFFER_FIELD, node, NULL)); 208 (ACPI_TYPE_BUFFER_FIELD, node, NULL));
209 ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "[%4.4s] buffer_field Arg Init\n", 209 ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "[%4.4s] BufferField Arg Init\n",
210 acpi_ut_get_node_name(node))); 210 acpi_ut_get_node_name(node)));
211 211
212 /* Execute the AML code for the term_arg arguments */ 212 /* Execute the AML code for the term_arg arguments */
@@ -235,7 +235,7 @@ acpi_status acpi_ds_get_buffer_arguments(union acpi_operand_object *obj_desc)
235 struct acpi_namespace_node *node; 235 struct acpi_namespace_node *node;
236 acpi_status status; 236 acpi_status status;
237 237
238 ACPI_FUNCTION_TRACE_PTR("ds_get_buffer_arguments", obj_desc); 238 ACPI_FUNCTION_TRACE_PTR(ds_get_buffer_arguments, obj_desc);
239 239
240 if (obj_desc->common.flags & AOPOBJ_DATA_VALID) { 240 if (obj_desc->common.flags & AOPOBJ_DATA_VALID) {
241 return_ACPI_STATUS(AE_OK); 241 return_ACPI_STATUS(AE_OK);
@@ -279,7 +279,7 @@ acpi_status acpi_ds_get_package_arguments(union acpi_operand_object *obj_desc)
279 struct acpi_namespace_node *node; 279 struct acpi_namespace_node *node;
280 acpi_status status; 280 acpi_status status;
281 281
282 ACPI_FUNCTION_TRACE_PTR("ds_get_package_arguments", obj_desc); 282 ACPI_FUNCTION_TRACE_PTR(ds_get_package_arguments, obj_desc);
283 283
284 if (obj_desc->common.flags & AOPOBJ_DATA_VALID) { 284 if (obj_desc->common.flags & AOPOBJ_DATA_VALID) {
285 return_ACPI_STATUS(AE_OK); 285 return_ACPI_STATUS(AE_OK);
@@ -324,7 +324,7 @@ acpi_status acpi_ds_get_region_arguments(union acpi_operand_object *obj_desc)
324 acpi_status status; 324 acpi_status status;
325 union acpi_operand_object *extra_desc; 325 union acpi_operand_object *extra_desc;
326 326
327 ACPI_FUNCTION_TRACE_PTR("ds_get_region_arguments", obj_desc); 327 ACPI_FUNCTION_TRACE_PTR(ds_get_region_arguments, obj_desc);
328 328
329 if (obj_desc->region.flags & AOPOBJ_DATA_VALID) { 329 if (obj_desc->region.flags & AOPOBJ_DATA_VALID) {
330 return_ACPI_STATUS(AE_OK); 330 return_ACPI_STATUS(AE_OK);
@@ -342,8 +342,7 @@ acpi_status acpi_ds_get_region_arguments(union acpi_operand_object *obj_desc)
342 ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname 342 ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname
343 (ACPI_TYPE_REGION, node, NULL)); 343 (ACPI_TYPE_REGION, node, NULL));
344 344
345 ACPI_DEBUG_PRINT((ACPI_DB_EXEC, 345 ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "[%4.4s] OpRegion Arg Init at AML %p\n",
346 "[%4.4s] op_region Arg Init at AML %p\n",
347 acpi_ut_get_node_name(node), 346 acpi_ut_get_node_name(node),
348 extra_desc->extra.aml_start)); 347 extra_desc->extra.aml_start));
349 348
@@ -352,6 +351,28 @@ acpi_status acpi_ds_get_region_arguments(union acpi_operand_object *obj_desc)
352 status = acpi_ds_execute_arguments(node, acpi_ns_get_parent_node(node), 351 status = acpi_ds_execute_arguments(node, acpi_ns_get_parent_node(node),
353 extra_desc->extra.aml_length, 352 extra_desc->extra.aml_length,
354 extra_desc->extra.aml_start); 353 extra_desc->extra.aml_start);
354 if (ACPI_FAILURE(status)) {
355 return_ACPI_STATUS(status);
356 }
357
358 /* Validate the region address/length via the host OS */
359
360 status = acpi_os_validate_address(obj_desc->region.space_id,
361 obj_desc->region.address,
362 (acpi_size) obj_desc->region.length);
363 if (ACPI_FAILURE(status)) {
364 /*
365 * Invalid address/length. We will emit an error message and mark
366 * the region as invalid, so that it will cause an additional error if
367 * it is ever used. Then return AE_OK.
368 */
369 ACPI_EXCEPTION((AE_INFO, status,
370 "During address validation of OpRegion [%4.4s]",
371 node->name.ascii));
372 obj_desc->common.flags |= AOPOBJ_INVALID;
373 status = AE_OK;
374 }
375
355 return_ACPI_STATUS(status); 376 return_ACPI_STATUS(status);
356} 377}
357 378
@@ -411,7 +432,7 @@ acpi_ds_init_buffer_field(u16 aml_opcode,
411 u8 field_flags; 432 u8 field_flags;
412 acpi_status status; 433 acpi_status status;
413 434
414 ACPI_FUNCTION_TRACE_PTR("ds_init_buffer_field", obj_desc); 435 ACPI_FUNCTION_TRACE_PTR(ds_init_buffer_field, obj_desc);
415 436
416 /* Host object must be a Buffer */ 437 /* Host object must be a Buffer */
417 438
@@ -457,7 +478,7 @@ acpi_ds_init_buffer_field(u16 aml_opcode,
457 478
458 if (bit_count == 0) { 479 if (bit_count == 0) {
459 ACPI_ERROR((AE_INFO, 480 ACPI_ERROR((AE_INFO,
460 "Attempt to create_field of length zero")); 481 "Attempt to CreateField of length zero"));
461 status = AE_AML_OPERAND_VALUE; 482 status = AE_AML_OPERAND_VALUE;
462 goto cleanup; 483 goto cleanup;
463 } 484 }
@@ -595,7 +616,7 @@ acpi_ds_eval_buffer_field_operands(struct acpi_walk_state *walk_state,
595 struct acpi_namespace_node *node; 616 struct acpi_namespace_node *node;
596 union acpi_parse_object *next_op; 617 union acpi_parse_object *next_op;
597 618
598 ACPI_FUNCTION_TRACE_PTR("ds_eval_buffer_field_operands", op); 619 ACPI_FUNCTION_TRACE_PTR(ds_eval_buffer_field_operands, op);
599 620
600 /* 621 /*
601 * This is where we evaluate the address and length fields of the 622 * This is where we evaluate the address and length fields of the
@@ -627,7 +648,7 @@ acpi_ds_eval_buffer_field_operands(struct acpi_walk_state *walk_state,
627 ACPI_DUMP_OPERANDS(ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE, 648 ACPI_DUMP_OPERANDS(ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE,
628 acpi_ps_get_opcode_name(op->common.aml_opcode), 649 acpi_ps_get_opcode_name(op->common.aml_opcode),
629 walk_state->num_operands, 650 walk_state->num_operands,
630 "after acpi_ex_resolve_operands"); 651 "after AcpiExResolveOperands");
631 652
632 if (ACPI_FAILURE(status)) { 653 if (ACPI_FAILURE(status)) {
633 ACPI_ERROR((AE_INFO, "(%s) bad operand(s) (%X)", 654 ACPI_ERROR((AE_INFO, "(%s) bad operand(s) (%X)",
@@ -686,7 +707,7 @@ acpi_ds_eval_region_operands(struct acpi_walk_state *walk_state,
686 struct acpi_namespace_node *node; 707 struct acpi_namespace_node *node;
687 union acpi_parse_object *next_op; 708 union acpi_parse_object *next_op;
688 709
689 ACPI_FUNCTION_TRACE_PTR("ds_eval_region_operands", op); 710 ACPI_FUNCTION_TRACE_PTR(ds_eval_region_operands, op);
690 711
691 /* 712 /*
692 * This is where we evaluate the address and length fields of the 713 * This is where we evaluate the address and length fields of the
@@ -719,7 +740,7 @@ acpi_ds_eval_region_operands(struct acpi_walk_state *walk_state,
719 740
720 ACPI_DUMP_OPERANDS(ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE, 741 ACPI_DUMP_OPERANDS(ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE,
721 acpi_ps_get_opcode_name(op->common.aml_opcode), 742 acpi_ps_get_opcode_name(op->common.aml_opcode),
722 1, "after acpi_ex_resolve_operands"); 743 1, "after AcpiExResolveOperands");
723 744
724 obj_desc = acpi_ns_get_attached_object(node); 745 obj_desc = acpi_ns_get_attached_object(node);
725 if (!obj_desc) { 746 if (!obj_desc) {
@@ -745,7 +766,7 @@ acpi_ds_eval_region_operands(struct acpi_walk_state *walk_state,
745 operand_desc->integer.value; 766 operand_desc->integer.value;
746 acpi_ut_remove_reference(operand_desc); 767 acpi_ut_remove_reference(operand_desc);
747 768
748 ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "rgn_obj %p Addr %8.8X%8.8X Len %X\n", 769 ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "RgnObj %p Addr %8.8X%8.8X Len %X\n",
749 obj_desc, 770 obj_desc,
750 ACPI_FORMAT_UINT64(obj_desc->region.address), 771 ACPI_FORMAT_UINT64(obj_desc->region.address),
751 obj_desc->region.length)); 772 obj_desc->region.length));
@@ -781,7 +802,7 @@ acpi_ds_eval_data_object_operands(struct acpi_walk_state *walk_state,
781 union acpi_operand_object *arg_desc; 802 union acpi_operand_object *arg_desc;
782 u32 length; 803 u32 length;
783 804
784 ACPI_FUNCTION_TRACE("ds_eval_data_object_operands"); 805 ACPI_FUNCTION_TRACE(ds_eval_data_object_operands);
785 806
786 /* The first operand (for all of these data objects) is the length */ 807 /* The first operand (for all of these data objects) is the length */
787 808
@@ -875,7 +896,7 @@ acpi_ds_exec_begin_control_op(struct acpi_walk_state *walk_state,
875 acpi_status status = AE_OK; 896 acpi_status status = AE_OK;
876 union acpi_generic_state *control_state; 897 union acpi_generic_state *control_state;
877 898
878 ACPI_FUNCTION_NAME("ds_exec_begin_control_op"); 899 ACPI_FUNCTION_NAME(ds_exec_begin_control_op);
879 900
880 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p Opcode=%2.2X State=%p\n", op, 901 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p Opcode=%2.2X State=%p\n", op,
881 op->common.aml_opcode, walk_state)); 902 op->common.aml_opcode, walk_state));
@@ -953,7 +974,7 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state,
953 acpi_status status = AE_OK; 974 acpi_status status = AE_OK;
954 union acpi_generic_state *control_state; 975 union acpi_generic_state *control_state;
955 976
956 ACPI_FUNCTION_NAME("ds_exec_end_control_op"); 977 ACPI_FUNCTION_NAME(ds_exec_end_control_op);
957 978
958 switch (op->common.aml_opcode) { 979 switch (op->common.aml_opcode) {
959 case AML_IF_OP: 980 case AML_IF_OP:
@@ -1099,7 +1120,7 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state,
1099 } 1120 }
1100 1121
1101 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, 1122 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
1102 "Completed RETURN_OP State=%p, ret_val=%p\n", 1123 "Completed RETURN_OP State=%p, RetVal=%p\n",
1103 walk_state, walk_state->return_desc)); 1124 walk_state, walk_state->return_desc));
1104 1125
1105 /* End the control method execution right now */ 1126 /* End the control method execution right now */