aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/parser
diff options
context:
space:
mode:
authorBob Moore <robert.moore@intel.com>2008-04-10 11:06:37 -0400
committerLen Brown <len.brown@intel.com>2008-04-22 14:29:21 -0400
commit4e3156b183aa087bc19804b3295c7c1a71f64752 (patch)
tree5db51b2351f4d919b36364681e594d2b6daa3860 /drivers/acpi/parser
parentba886cd4ac957608777fbc8d137f6b9f0450e775 (diff)
ACPICA: changed order of interpretation of operand objects
The interpreter now evaluates operands in the order that they appear (both in the AML and ASL), instead of in reverse order. This previously caused subtle incompatibilities with the MS interpreter as well as being non-intuitive. Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/parser')
-rw-r--r--drivers/acpi/parser/psloop.c23
-rw-r--r--drivers/acpi/parser/psopcode.c26
-rw-r--r--drivers/acpi/parser/pstree.c2
3 files changed, 49 insertions, 2 deletions
diff --git a/drivers/acpi/parser/psloop.c b/drivers/acpi/parser/psloop.c
index 266dd0c10218..4348b0530398 100644
--- a/drivers/acpi/parser/psloop.c
+++ b/drivers/acpi/parser/psloop.c
@@ -182,6 +182,7 @@ acpi_ps_build_named_op(struct acpi_walk_state *walk_state,
182 ACPI_FUNCTION_TRACE_PTR(ps_build_named_op, walk_state); 182 ACPI_FUNCTION_TRACE_PTR(ps_build_named_op, walk_state);
183 183
184 unnamed_op->common.value.arg = NULL; 184 unnamed_op->common.value.arg = NULL;
185 unnamed_op->common.arg_list_length = 0;
185 unnamed_op->common.aml_opcode = walk_state->opcode; 186 unnamed_op->common.aml_opcode = walk_state->opcode;
186 187
187 /* 188 /*
@@ -280,6 +281,9 @@ acpi_ps_create_op(struct acpi_walk_state *walk_state,
280 acpi_status status = AE_OK; 281 acpi_status status = AE_OK;
281 union acpi_parse_object *op; 282 union acpi_parse_object *op;
282 union acpi_parse_object *named_op = NULL; 283 union acpi_parse_object *named_op = NULL;
284 union acpi_parse_object *parent_scope;
285 u8 argument_count;
286 const struct acpi_opcode_info *op_info;
283 287
284 ACPI_FUNCTION_TRACE_PTR(ps_create_op, walk_state); 288 ACPI_FUNCTION_TRACE_PTR(ps_create_op, walk_state);
285 289
@@ -320,8 +324,23 @@ acpi_ps_create_op(struct acpi_walk_state *walk_state,
320 op->named.length = 0; 324 op->named.length = 0;
321 } 325 }
322 326
323 acpi_ps_append_arg(acpi_ps_get_parent_scope 327 parent_scope = acpi_ps_get_parent_scope(&(walk_state->parser_state));
324 (&(walk_state->parser_state)), op); 328 acpi_ps_append_arg(parent_scope, op);
329
330 if (parent_scope) {
331 op_info =
332 acpi_ps_get_opcode_info(parent_scope->common.aml_opcode);
333 if (op_info->flags & AML_HAS_TARGET) {
334 argument_count =
335 acpi_ps_get_argument_count(op_info->type);
336 if (parent_scope->common.arg_list_length >
337 argument_count) {
338 op->common.flags |= ACPI_PARSEOP_TARGET;
339 }
340 } else if (parent_scope->common.aml_opcode == AML_INCREMENT_OP) {
341 op->common.flags |= ACPI_PARSEOP_TARGET;
342 }
343 }
325 344
326 if (walk_state->descending_callback != NULL) { 345 if (walk_state->descending_callback != NULL) {
327 /* 346 /*
diff --git a/drivers/acpi/parser/psopcode.c b/drivers/acpi/parser/psopcode.c
index 9296e86761d7..3bf8105d6348 100644
--- a/drivers/acpi/parser/psopcode.c
+++ b/drivers/acpi/parser/psopcode.c
@@ -49,6 +49,8 @@
49#define _COMPONENT ACPI_PARSER 49#define _COMPONENT ACPI_PARSER
50ACPI_MODULE_NAME("psopcode") 50ACPI_MODULE_NAME("psopcode")
51 51
52const u8 acpi_gbl_argument_count[] = { 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 6 };
53
52/******************************************************************************* 54/*******************************************************************************
53 * 55 *
54 * NAME: acpi_gbl_aml_op_info 56 * NAME: acpi_gbl_aml_op_info
@@ -59,6 +61,7 @@ ACPI_MODULE_NAME("psopcode")
59 * the operand type. 61 * the operand type.
60 * 62 *
61 ******************************************************************************/ 63 ******************************************************************************/
64
62/* 65/*
63 * Summary of opcode types/flags 66 * Summary of opcode types/flags
64 * 67 *
@@ -176,6 +179,7 @@ ACPI_MODULE_NAME("psopcode")
176 AML_CREATE_QWORD_FIELD_OP 179 AML_CREATE_QWORD_FIELD_OP
177 180
178 ******************************************************************************/ 181 ******************************************************************************/
182
179/* 183/*
180 * Master Opcode information table. A summary of everything we know about each 184 * Master Opcode information table. A summary of everything we know about each
181 * opcode, all in one place. 185 * opcode, all in one place.
@@ -779,3 +783,25 @@ char *acpi_ps_get_opcode_name(u16 opcode)
779 783
780#endif 784#endif
781} 785}
786
787/*******************************************************************************
788 *
789 * FUNCTION: acpi_ps_get_argument_count
790 *
791 * PARAMETERS: op_type - Type associated with the AML opcode
792 *
793 * RETURN: Argument count
794 *
795 * DESCRIPTION: Obtain the number of expected arguments for an AML opcode
796 *
797 ******************************************************************************/
798
799u8 acpi_ps_get_argument_count(u32 op_type)
800{
801
802 if (op_type <= AML_TYPE_EXEC_6A_0T_1R) {
803 return (acpi_gbl_argument_count[op_type]);
804 }
805
806 return (0);
807}
diff --git a/drivers/acpi/parser/pstree.c b/drivers/acpi/parser/pstree.c
index 966e7ea2a0c4..0e1a3226665d 100644
--- a/drivers/acpi/parser/pstree.c
+++ b/drivers/acpi/parser/pstree.c
@@ -171,6 +171,8 @@ acpi_ps_append_arg(union acpi_parse_object *op, union acpi_parse_object *arg)
171 while (arg) { 171 while (arg) {
172 arg->common.parent = op; 172 arg->common.parent = op;
173 arg = arg->common.next; 173 arg = arg->common.next;
174
175 op->common.arg_list_length++;
174 } 176 }
175} 177}
176 178