aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/parser
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/parser')
-rw-r--r--drivers/acpi/parser/psargs.c7
-rw-r--r--drivers/acpi/parser/psloop.c6
-rw-r--r--drivers/acpi/parser/psopcode.c2
-rw-r--r--drivers/acpi/parser/psparse.c8
-rw-r--r--drivers/acpi/parser/psscope.c1
-rw-r--r--drivers/acpi/parser/pstree.c7
-rw-r--r--drivers/acpi/parser/psutils.c1
-rw-r--r--drivers/acpi/parser/pswalk.c3
-rw-r--r--drivers/acpi/parser/psxface.c2
9 files changed, 37 insertions, 0 deletions
diff --git a/drivers/acpi/parser/psargs.c b/drivers/acpi/parser/psargs.c
index de573be52718..1c5934fe1853 100644
--- a/drivers/acpi/parser/psargs.c
+++ b/drivers/acpi/parser/psargs.c
@@ -275,6 +275,7 @@ acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state,
275 */ 275 */
276 if (ACPI_SUCCESS(status) && 276 if (ACPI_SUCCESS(status) &&
277 possible_method_call && (node->type == ACPI_TYPE_METHOD)) { 277 possible_method_call && (node->type == ACPI_TYPE_METHOD)) {
278
278 /* This name is actually a control method invocation */ 279 /* This name is actually a control method invocation */
279 280
280 method_desc = acpi_ns_get_attached_object(node); 281 method_desc = acpi_ns_get_attached_object(node);
@@ -319,6 +320,7 @@ acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state,
319 * some not_found cases are allowed 320 * some not_found cases are allowed
320 */ 321 */
321 if (status == AE_NOT_FOUND) { 322 if (status == AE_NOT_FOUND) {
323
322 /* 1) not_found is ok during load pass 1/2 (allow forward references) */ 324 /* 1) not_found is ok during load pass 1/2 (allow forward references) */
323 325
324 if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) != 326 if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) !=
@@ -354,6 +356,7 @@ acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state,
354 356
355 if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) == 357 if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) ==
356 ACPI_PARSE_EXECUTE) { 358 ACPI_PARSE_EXECUTE) {
359
357 /* Report a control method execution error */ 360 /* Report a control method execution error */
358 361
359 status = acpi_ds_method_error(status, walk_state); 362 status = acpi_ds_method_error(status, walk_state);
@@ -620,6 +623,7 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state,
620 case ARGP_FIELDLIST: 623 case ARGP_FIELDLIST:
621 624
622 if (parser_state->aml < parser_state->pkg_end) { 625 if (parser_state->aml < parser_state->pkg_end) {
626
623 /* Non-empty list */ 627 /* Non-empty list */
624 628
625 while (parser_state->aml < parser_state->pkg_end) { 629 while (parser_state->aml < parser_state->pkg_end) {
@@ -645,6 +649,7 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state,
645 case ARGP_BYTELIST: 649 case ARGP_BYTELIST:
646 650
647 if (parser_state->aml < parser_state->pkg_end) { 651 if (parser_state->aml < parser_state->pkg_end) {
652
648 /* Non-empty list */ 653 /* Non-empty list */
649 654
650 arg = acpi_ps_alloc_op(AML_INT_BYTELIST_OP); 655 arg = acpi_ps_alloc_op(AML_INT_BYTELIST_OP);
@@ -673,6 +678,7 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state,
673 if (subop == 0 || 678 if (subop == 0 ||
674 acpi_ps_is_leading_char(subop) || 679 acpi_ps_is_leading_char(subop) ||
675 acpi_ps_is_prefix_char(subop)) { 680 acpi_ps_is_prefix_char(subop)) {
681
676 /* null_name or name_string */ 682 /* null_name or name_string */
677 683
678 arg = acpi_ps_alloc_op(AML_INT_NAMEPATH_OP); 684 arg = acpi_ps_alloc_op(AML_INT_NAMEPATH_OP);
@@ -703,6 +709,7 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state,
703 case ARGP_OBJLIST: 709 case ARGP_OBJLIST:
704 710
705 if (parser_state->aml < parser_state->pkg_end) { 711 if (parser_state->aml < parser_state->pkg_end) {
712
706 /* Non-empty list of variable arguments, nothing returned */ 713 /* Non-empty list of variable arguments, nothing returned */
707 714
708 walk_state->arg_count = ACPI_VAR_ARGS; 715 walk_state->arg_count = ACPI_VAR_ARGS;
diff --git a/drivers/acpi/parser/psloop.c b/drivers/acpi/parser/psloop.c
index 00b072e15d19..42062d5abc9e 100644
--- a/drivers/acpi/parser/psloop.c
+++ b/drivers/acpi/parser/psloop.c
@@ -95,6 +95,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state)
95#if (!defined (ACPI_NO_METHOD_EXECUTION) && !defined (ACPI_CONSTANT_EVAL_ONLY)) 95#if (!defined (ACPI_NO_METHOD_EXECUTION) && !defined (ACPI_CONSTANT_EVAL_ONLY))
96 96
97 if (walk_state->walk_type & ACPI_WALK_METHOD_RESTART) { 97 if (walk_state->walk_type & ACPI_WALK_METHOD_RESTART) {
98
98 /* We are restarting a preempted control method */ 99 /* We are restarting a preempted control method */
99 100
100 if (acpi_ps_has_completed_scope(parser_state)) { 101 if (acpi_ps_has_completed_scope(parser_state)) {
@@ -143,6 +144,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state)
143 ACPI_DEBUG_PRINT((ACPI_DB_PARSE, 144 ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
144 "Popped scope, Op=%p\n", op)); 145 "Popped scope, Op=%p\n", op));
145 } else if (walk_state->prev_op) { 146 } else if (walk_state->prev_op) {
147
146 /* We were in the middle of an op */ 148 /* We were in the middle of an op */
147 149
148 op = walk_state->prev_op; 150 op = walk_state->prev_op;
@@ -156,6 +158,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state)
156 while ((parser_state->aml < parser_state->aml_end) || (op)) { 158 while ((parser_state->aml < parser_state->aml_end) || (op)) {
157 aml_op_start = parser_state->aml; 159 aml_op_start = parser_state->aml;
158 if (!op) { 160 if (!op) {
161
159 /* Get the next opcode from the AML stream */ 162 /* Get the next opcode from the AML stream */
160 163
161 walk_state->aml_offset = 164 walk_state->aml_offset =
@@ -213,6 +216,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state)
213 /* Create Op structure and append to parent's argument list */ 216 /* Create Op structure and append to parent's argument list */
214 217
215 if (walk_state->op_info->flags & AML_NAMED) { 218 if (walk_state->op_info->flags & AML_NAMED) {
219
216 /* Allocate a new pre_op if necessary */ 220 /* Allocate a new pre_op if necessary */
217 221
218 if (!pre_op) { 222 if (!pre_op) {
@@ -388,6 +392,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state)
388 /* Are there any arguments that must be processed? */ 392 /* Are there any arguments that must be processed? */
389 393
390 if (walk_state->arg_types) { 394 if (walk_state->arg_types) {
395
391 /* Get arguments */ 396 /* Get arguments */
392 397
393 switch (op->common.aml_opcode) { 398 switch (op->common.aml_opcode) {
@@ -853,6 +858,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state)
853 } 858 }
854 859
855 else if (ACPI_FAILURE(status)) { 860 else if (ACPI_FAILURE(status)) {
861
856 /* First error is most important */ 862 /* First error is most important */
857 863
858 (void) 864 (void)
diff --git a/drivers/acpi/parser/psopcode.c b/drivers/acpi/parser/psopcode.c
index 11d6351ab8b2..9eb8d0663886 100644
--- a/drivers/acpi/parser/psopcode.c
+++ b/drivers/acpi/parser/psopcode.c
@@ -731,6 +731,7 @@ const struct acpi_opcode_info *acpi_ps_get_opcode_info(u16 opcode)
731 * Detect normal 8-bit opcode or extended 16-bit opcode 731 * Detect normal 8-bit opcode or extended 16-bit opcode
732 */ 732 */
733 if (!(opcode & 0xFF00)) { 733 if (!(opcode & 0xFF00)) {
734
734 /* Simple (8-bit) opcode: 0-255, can't index beyond table */ 735 /* Simple (8-bit) opcode: 0-255, can't index beyond table */
735 736
736 return (&acpi_gbl_aml_op_info 737 return (&acpi_gbl_aml_op_info
@@ -739,6 +740,7 @@ const struct acpi_opcode_info *acpi_ps_get_opcode_info(u16 opcode)
739 740
740 if (((opcode & 0xFF00) == AML_EXTENDED_OPCODE) && 741 if (((opcode & 0xFF00) == AML_EXTENDED_OPCODE) &&
741 (((u8) opcode) <= MAX_EXTENDED_OPCODE)) { 742 (((u8) opcode) <= MAX_EXTENDED_OPCODE)) {
743
742 /* Valid extended (16-bit) opcode */ 744 /* Valid extended (16-bit) opcode */
743 745
744 return (&acpi_gbl_aml_op_info 746 return (&acpi_gbl_aml_op_info
diff --git a/drivers/acpi/parser/psparse.c b/drivers/acpi/parser/psparse.c
index a9f3229f4106..83d8916bc1af 100644
--- a/drivers/acpi/parser/psparse.c
+++ b/drivers/acpi/parser/psparse.c
@@ -106,6 +106,7 @@ u16 acpi_ps_peek_opcode(struct acpi_parse_state * parser_state)
106 opcode = (u16) ACPI_GET8(aml); 106 opcode = (u16) ACPI_GET8(aml);
107 107
108 if (opcode == AML_EXTENDED_OP_PREFIX) { 108 if (opcode == AML_EXTENDED_OP_PREFIX) {
109
109 /* Extended opcode, get the second opcode byte */ 110 /* Extended opcode, get the second opcode byte */
110 111
111 aml++; 112 aml++;
@@ -158,6 +159,7 @@ acpi_ps_complete_this_op(struct acpi_walk_state * walk_state,
158 if (op->common.parent) { 159 if (op->common.parent) {
159 prev = op->common.parent->common.value.arg; 160 prev = op->common.parent->common.value.arg;
160 if (!prev) { 161 if (!prev) {
162
161 /* Nothing more to do */ 163 /* Nothing more to do */
162 164
163 goto cleanup; 165 goto cleanup;
@@ -245,6 +247,7 @@ acpi_ps_complete_this_op(struct acpi_walk_state * walk_state,
245 /* We must unlink this op from the parent tree */ 247 /* We must unlink this op from the parent tree */
246 248
247 if (prev == op) { 249 if (prev == op) {
250
248 /* This op is the first in the list */ 251 /* This op is the first in the list */
249 252
250 if (replacement_op) { 253 if (replacement_op) {
@@ -265,6 +268,7 @@ acpi_ps_complete_this_op(struct acpi_walk_state * walk_state,
265 268
266 else 269 else
267 while (prev) { 270 while (prev) {
271
268 /* Traverse all siblings in the parent's argument list */ 272 /* Traverse all siblings in the parent's argument list */
269 273
270 next = prev->common.next; 274 next = prev->common.next;
@@ -510,6 +514,7 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state)
510 } else if (status == AE_CTRL_TERMINATE) { 514 } else if (status == AE_CTRL_TERMINATE) {
511 status = AE_OK; 515 status = AE_OK;
512 } else if ((status != AE_OK) && (walk_state->method_desc)) { 516 } else if ((status != AE_OK) && (walk_state->method_desc)) {
517
513 /* Either the method parse or actual execution failed */ 518 /* Either the method parse or actual execution failed */
514 519
515 ACPI_ERROR_METHOD("Method parse/execution failed", 520 ACPI_ERROR_METHOD("Method parse/execution failed",
@@ -551,6 +556,7 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state)
551 if (((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) == 556 if (((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) ==
552 ACPI_PARSE_EXECUTE) || (ACPI_FAILURE(status))) { 557 ACPI_PARSE_EXECUTE) || (ACPI_FAILURE(status))) {
553 if (walk_state->method_desc) { 558 if (walk_state->method_desc) {
559
554 /* Decrement the thread count on the method parse tree */ 560 /* Decrement the thread count on the method parse tree */
555 561
556 if (walk_state->method_desc->method. 562 if (walk_state->method_desc->method.
@@ -633,12 +639,14 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state)
633 } 639 }
634 } else { 640 } else {
635 if (previous_walk_state->return_desc) { 641 if (previous_walk_state->return_desc) {
642
636 /* Caller doesn't want it, must delete it */ 643 /* Caller doesn't want it, must delete it */
637 644
638 acpi_ut_remove_reference(previous_walk_state-> 645 acpi_ut_remove_reference(previous_walk_state->
639 return_desc); 646 return_desc);
640 } 647 }
641 if (previous_walk_state->implicit_return_obj) { 648 if (previous_walk_state->implicit_return_obj) {
649
642 /* Caller doesn't want it, must delete it */ 650 /* Caller doesn't want it, must delete it */
643 651
644 acpi_ut_remove_reference(previous_walk_state-> 652 acpi_ut_remove_reference(previous_walk_state->
diff --git a/drivers/acpi/parser/psscope.c b/drivers/acpi/parser/psscope.c
index bc6047caccd9..edb7c9ba6ec2 100644
--- a/drivers/acpi/parser/psscope.c
+++ b/drivers/acpi/parser/psscope.c
@@ -165,6 +165,7 @@ acpi_ps_push_scope(struct acpi_parse_state *parser_state,
165 acpi_ut_push_generic_state(&parser_state->scope, scope); 165 acpi_ut_push_generic_state(&parser_state->scope, scope);
166 166
167 if (arg_count == ACPI_VAR_ARGS) { 167 if (arg_count == ACPI_VAR_ARGS) {
168
168 /* Multiple arguments */ 169 /* Multiple arguments */
169 170
170 scope->parse_scope.arg_end = parser_state->pkg_end; 171 scope->parse_scope.arg_end = parser_state->pkg_end;
diff --git a/drivers/acpi/parser/pstree.c b/drivers/acpi/parser/pstree.c
index dd6f16726fc4..6aa0012643ce 100644
--- a/drivers/acpi/parser/pstree.c
+++ b/drivers/acpi/parser/pstree.c
@@ -77,6 +77,7 @@ union acpi_parse_object *acpi_ps_get_arg(union acpi_parse_object *op, u32 argn)
77 77
78 op_info = acpi_ps_get_opcode_info(op->common.aml_opcode); 78 op_info = acpi_ps_get_opcode_info(op->common.aml_opcode);
79 if (op_info->class == AML_CLASS_UNKNOWN) { 79 if (op_info->class == AML_CLASS_UNKNOWN) {
80
80 /* Invalid opcode or ASCII character */ 81 /* Invalid opcode or ASCII character */
81 82
82 return (NULL); 83 return (NULL);
@@ -85,6 +86,7 @@ union acpi_parse_object *acpi_ps_get_arg(union acpi_parse_object *op, u32 argn)
85 /* Check if this opcode requires argument sub-objects */ 86 /* Check if this opcode requires argument sub-objects */
86 87
87 if (!(op_info->flags & AML_HAS_ARGS)) { 88 if (!(op_info->flags & AML_HAS_ARGS)) {
89
88 /* Has no linked argument objects */ 90 /* Has no linked argument objects */
89 91
90 return (NULL); 92 return (NULL);
@@ -130,6 +132,7 @@ acpi_ps_append_arg(union acpi_parse_object *op, union acpi_parse_object *arg)
130 132
131 op_info = acpi_ps_get_opcode_info(op->common.aml_opcode); 133 op_info = acpi_ps_get_opcode_info(op->common.aml_opcode);
132 if (op_info->class == AML_CLASS_UNKNOWN) { 134 if (op_info->class == AML_CLASS_UNKNOWN) {
135
133 /* Invalid opcode */ 136 /* Invalid opcode */
134 137
135 ACPI_ERROR((AE_INFO, "Invalid AML Opcode: 0x%2.2X", 138 ACPI_ERROR((AE_INFO, "Invalid AML Opcode: 0x%2.2X",
@@ -140,6 +143,7 @@ acpi_ps_append_arg(union acpi_parse_object *op, union acpi_parse_object *arg)
140 /* Check if this opcode requires argument sub-objects */ 143 /* Check if this opcode requires argument sub-objects */
141 144
142 if (!(op_info->flags & AML_HAS_ARGS)) { 145 if (!(op_info->flags & AML_HAS_ARGS)) {
146
143 /* Has no linked argument objects */ 147 /* Has no linked argument objects */
144 148
145 return; 149 return;
@@ -148,6 +152,7 @@ acpi_ps_append_arg(union acpi_parse_object *op, union acpi_parse_object *arg)
148 /* Append the argument to the linked argument list */ 152 /* Append the argument to the linked argument list */
149 153
150 if (op->common.value.arg) { 154 if (op->common.value.arg) {
155
151 /* Append to existing argument list */ 156 /* Append to existing argument list */
152 157
153 prev_arg = op->common.value.arg; 158 prev_arg = op->common.value.arg;
@@ -222,12 +227,14 @@ union acpi_parse_object *acpi_ps_get_depth_next(union acpi_parse_object *origin,
222 } 227 }
223 228
224 if (arg == origin) { 229 if (arg == origin) {
230
225 /* Reached parent of origin, end search */ 231 /* Reached parent of origin, end search */
226 232
227 return (NULL); 233 return (NULL);
228 } 234 }
229 235
230 if (parent->common.next) { 236 if (parent->common.next) {
237
231 /* Found sibling of parent */ 238 /* Found sibling of parent */
232 239
233 return (parent->common.next); 240 return (parent->common.next);
diff --git a/drivers/acpi/parser/psutils.c b/drivers/acpi/parser/psutils.c
index 3e07cb9cb748..a4c33a4bfe35 100644
--- a/drivers/acpi/parser/psutils.c
+++ b/drivers/acpi/parser/psutils.c
@@ -135,6 +135,7 @@ union acpi_parse_object *acpi_ps_alloc_op(u16 opcode)
135 /* Allocate the minimum required size object */ 135 /* Allocate the minimum required size object */
136 136
137 if (flags == ACPI_PARSEOP_GENERIC) { 137 if (flags == ACPI_PARSEOP_GENERIC) {
138
138 /* The generic op (default) is by far the most common (16 to 1) */ 139 /* The generic op (default) is by far the most common (16 to 1) */
139 140
140 op = acpi_os_acquire_object(acpi_gbl_ps_node_cache); 141 op = acpi_os_acquire_object(acpi_gbl_ps_node_cache);
diff --git a/drivers/acpi/parser/pswalk.c b/drivers/acpi/parser/pswalk.c
index 06f05bfd7612..3d08b8c6db41 100644
--- a/drivers/acpi/parser/pswalk.c
+++ b/drivers/acpi/parser/pswalk.c
@@ -69,13 +69,16 @@ void acpi_ps_delete_parse_tree(union acpi_parse_object *subtree_root)
69 /* Visit all nodes in the subtree */ 69 /* Visit all nodes in the subtree */
70 70
71 while (op) { 71 while (op) {
72
72 /* Check if we are not ascending */ 73 /* Check if we are not ascending */
73 74
74 if (op != parent) { 75 if (op != parent) {
76
75 /* Look for an argument or child of the current op */ 77 /* Look for an argument or child of the current op */
76 78
77 next = acpi_ps_get_arg(op, 0); 79 next = acpi_ps_get_arg(op, 0);
78 if (next) { 80 if (next) {
81
79 /* Still going downward in tree (Op is not completed yet) */ 82 /* Still going downward in tree (Op is not completed yet) */
80 83
81 op = next; 84 op = next;
diff --git a/drivers/acpi/parser/psxface.c b/drivers/acpi/parser/psxface.c
index 2dd48cbb7c02..e09a820ee294 100644
--- a/drivers/acpi/parser/psxface.c
+++ b/drivers/acpi/parser/psxface.c
@@ -317,9 +317,11 @@ acpi_ps_update_parameter_list(struct acpi_parameter_info *info, u16 action)
317 acpi_native_uint i; 317 acpi_native_uint i;
318 318
319 if ((info->parameter_type == ACPI_PARAM_ARGS) && (info->parameters)) { 319 if ((info->parameter_type == ACPI_PARAM_ARGS) && (info->parameters)) {
320
320 /* Update reference count for each parameter */ 321 /* Update reference count for each parameter */
321 322
322 for (i = 0; info->parameters[i]; i++) { 323 for (i = 0; info->parameters[i]; i++) {
324
323 /* Ignore errors, just do them all */ 325 /* Ignore errors, just do them all */
324 326
325 (void)acpi_ut_update_object_reference(info-> 327 (void)acpi_ut_update_object_reference(info->