aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/parser
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/parser')
-rw-r--r--drivers/acpi/parser/psargs.c55
-rw-r--r--drivers/acpi/parser/psopcode.c298
-rw-r--r--drivers/acpi/parser/psparse.c144
-rw-r--r--drivers/acpi/parser/psscope.c45
-rw-r--r--drivers/acpi/parser/pstree.c159
-rw-r--r--drivers/acpi/parser/psutils.c15
-rw-r--r--drivers/acpi/parser/pswalk.c11
-rw-r--r--drivers/acpi/parser/psxface.c21
8 files changed, 261 insertions, 487 deletions
diff --git a/drivers/acpi/parser/psargs.c b/drivers/acpi/parser/psargs.c
index b5d98895f6a8..b7ac68cc9e1c 100644
--- a/drivers/acpi/parser/psargs.c
+++ b/drivers/acpi/parser/psargs.c
@@ -50,6 +50,16 @@
50#define _COMPONENT ACPI_PARSER 50#define _COMPONENT ACPI_PARSER
51 ACPI_MODULE_NAME ("psargs") 51 ACPI_MODULE_NAME ("psargs")
52 52
53/* Local prototypes */
54
55static u32
56acpi_ps_get_next_package_length (
57 struct acpi_parse_state *parser_state);
58
59static union acpi_parse_object *
60acpi_ps_get_next_field (
61 struct acpi_parse_state *parser_state);
62
53 63
54/******************************************************************************* 64/*******************************************************************************
55 * 65 *
@@ -64,7 +74,7 @@
64 * 74 *
65 ******************************************************************************/ 75 ******************************************************************************/
66 76
67u32 77static u32
68acpi_ps_get_next_package_length ( 78acpi_ps_get_next_package_length (
69 struct acpi_parse_state *parser_state) 79 struct acpi_parse_state *parser_state)
70{ 80{
@@ -78,7 +88,6 @@ acpi_ps_get_next_package_length (
78 encoded_length = (u32) ACPI_GET8 (parser_state->aml); 88 encoded_length = (u32) ACPI_GET8 (parser_state->aml);
79 parser_state->aml++; 89 parser_state->aml++;
80 90
81
82 switch (encoded_length >> 6) /* bits 6-7 contain encoding scheme */ { 91 switch (encoded_length >> 6) /* bits 6-7 contain encoding scheme */ {
83 case 0: /* 1-byte encoding (bits 0-5) */ 92 case 0: /* 1-byte encoding (bits 0-5) */
84 93
@@ -287,13 +296,14 @@ acpi_ps_get_next_namepath (
287 * parent tree, but don't open a new scope -- we just want to lookup the 296 * parent tree, but don't open a new scope -- we just want to lookup the
288 * object (MUST BE mode EXECUTE to perform upsearch) 297 * object (MUST BE mode EXECUTE to perform upsearch)
289 */ 298 */
290 status = acpi_ns_lookup (&scope_info, path, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, 299 status = acpi_ns_lookup (&scope_info, path, ACPI_TYPE_ANY,
291 ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, NULL, &node); 300 ACPI_IMODE_EXECUTE,
301 ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
302 NULL, &node);
292 if (ACPI_SUCCESS (status) && method_call) { 303 if (ACPI_SUCCESS (status) && method_call) {
293 if (node->type == ACPI_TYPE_METHOD) { 304 if (node->type == ACPI_TYPE_METHOD) {
294 /* 305 /* This name is actually a control method invocation */
295 * This name is actually a control method invocation 306
296 */
297 method_desc = acpi_ns_get_attached_object (node); 307 method_desc = acpi_ns_get_attached_object (node);
298 ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, 308 ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
299 "Control Method - %p Desc %p Path=%p\n", 309 "Control Method - %p Desc %p Path=%p\n",
@@ -360,7 +370,7 @@ acpi_ps_get_next_namepath (
360 /* 370 /*
361 * We got a NOT_FOUND during table load or we encountered 371 * We got a NOT_FOUND during table load or we encountered
362 * a cond_ref_of(x) where the target does not exist. 372 * a cond_ref_of(x) where the target does not exist.
363 * -- either case is ok 373 * Either case is ok
364 */ 374 */
365 status = AE_OK; 375 status = AE_OK;
366 } 376 }
@@ -486,12 +496,13 @@ acpi_ps_get_next_simple_arg (
486 * 496 *
487 ******************************************************************************/ 497 ******************************************************************************/
488 498
489union acpi_parse_object * 499static union acpi_parse_object *
490acpi_ps_get_next_field ( 500acpi_ps_get_next_field (
491 struct acpi_parse_state *parser_state) 501 struct acpi_parse_state *parser_state)
492{ 502{
493 u32 aml_offset = (u32) ACPI_PTR_DIFF (parser_state->aml, 503 u32 aml_offset = (u32)
494 parser_state->aml_start); 504 ACPI_PTR_DIFF (parser_state->aml,
505 parser_state->aml_start);
495 union acpi_parse_object *field; 506 union acpi_parse_object *field;
496 u16 opcode; 507 u16 opcode;
497 u32 name; 508 u32 name;
@@ -500,7 +511,7 @@ acpi_ps_get_next_field (
500 ACPI_FUNCTION_TRACE ("ps_get_next_field"); 511 ACPI_FUNCTION_TRACE ("ps_get_next_field");
501 512
502 513
503 /* determine field type */ 514 /* Determine field type */
504 515
505 switch (ACPI_GET8 (parser_state->aml)) { 516 switch (ACPI_GET8 (parser_state->aml)) {
506 default: 517 default:
@@ -521,7 +532,6 @@ acpi_ps_get_next_field (
521 break; 532 break;
522 } 533 }
523 534
524
525 /* Allocate a new field op */ 535 /* Allocate a new field op */
526 536
527 field = acpi_ps_alloc_op (opcode); 537 field = acpi_ps_alloc_op (opcode);
@@ -582,10 +592,10 @@ acpi_ps_get_next_field (
582 * 592 *
583 * FUNCTION: acpi_ps_get_next_arg 593 * FUNCTION: acpi_ps_get_next_arg
584 * 594 *
585 * PARAMETERS: parser_state - Current parser state object 595 * PARAMETERS: walk_state - Current state
596 * parser_state - Current parser state object
586 * arg_type - The argument type (AML_*_ARG) 597 * arg_type - The argument type (AML_*_ARG)
587 * arg_count - If the argument points to a control method 598 * return_arg - Where the next arg is returned
588 * the method's argument is returned here.
589 * 599 *
590 * RETURN: Status, and an op object containing the next argument. 600 * RETURN: Status, and an op object containing the next argument.
591 * 601 *
@@ -619,7 +629,7 @@ acpi_ps_get_next_arg (
619 case ARGP_NAME: 629 case ARGP_NAME:
620 case ARGP_NAMESTRING: 630 case ARGP_NAMESTRING:
621 631
622 /* constants, strings, and namestrings are all the same size */ 632 /* Constants, strings, and namestrings are all the same size */
623 633
624 arg = acpi_ps_alloc_op (AML_BYTE_OP); 634 arg = acpi_ps_alloc_op (AML_BYTE_OP);
625 if (!arg) { 635 if (!arg) {
@@ -654,7 +664,6 @@ acpi_ps_get_next_arg (
654 else { 664 else {
655 arg = field; 665 arg = field;
656 } 666 }
657
658 prev = field; 667 prev = field;
659 } 668 }
660 669
@@ -677,8 +686,8 @@ acpi_ps_get_next_arg (
677 686
678 /* Fill in bytelist data */ 687 /* Fill in bytelist data */
679 688
680 arg->common.value.size = (u32) ACPI_PTR_DIFF (parser_state->pkg_end, 689 arg->common.value.size = (u32)
681 parser_state->aml); 690 ACPI_PTR_DIFF (parser_state->pkg_end, parser_state->aml);
682 arg->named.data = parser_state->aml; 691 arg->named.data = parser_state->aml;
683 692
684 /* Skip to End of byte data */ 693 /* Skip to End of byte data */
@@ -706,7 +715,7 @@ acpi_ps_get_next_arg (
706 status = acpi_ps_get_next_namepath (walk_state, parser_state, arg, 0); 715 status = acpi_ps_get_next_namepath (walk_state, parser_state, arg, 0);
707 } 716 }
708 else { 717 else {
709 /* single complex argument, nothing returned */ 718 /* Single complex argument, nothing returned */
710 719
711 walk_state->arg_count = 1; 720 walk_state->arg_count = 1;
712 } 721 }
@@ -716,7 +725,7 @@ acpi_ps_get_next_arg (
716 case ARGP_DATAOBJ: 725 case ARGP_DATAOBJ:
717 case ARGP_TERMARG: 726 case ARGP_TERMARG:
718 727
719 /* single complex argument, nothing returned */ 728 /* Single complex argument, nothing returned */
720 729
721 walk_state->arg_count = 1; 730 walk_state->arg_count = 1;
722 break; 731 break;
@@ -727,7 +736,7 @@ acpi_ps_get_next_arg (
727 case ARGP_OBJLIST: 736 case ARGP_OBJLIST:
728 737
729 if (parser_state->aml < parser_state->pkg_end) { 738 if (parser_state->aml < parser_state->pkg_end) {
730 /* non-empty list of variable arguments, nothing returned */ 739 /* Non-empty list of variable arguments, nothing returned */
731 740
732 walk_state->arg_count = ACPI_VAR_ARGS; 741 walk_state->arg_count = ACPI_VAR_ARGS;
733 } 742 }
diff --git a/drivers/acpi/parser/psopcode.c b/drivers/acpi/parser/psopcode.c
index 03e33fedc11a..5744673568c0 100644
--- a/drivers/acpi/parser/psopcode.c
+++ b/drivers/acpi/parser/psopcode.c
@@ -44,6 +44,7 @@
44 44
45#include <acpi/acpi.h> 45#include <acpi/acpi.h>
46#include <acpi/acparser.h> 46#include <acpi/acparser.h>
47#include <acpi/acopcode.h>
47#include <acpi/amlcode.h> 48#include <acpi/amlcode.h>
48 49
49 50
@@ -51,23 +52,6 @@
51 ACPI_MODULE_NAME ("psopcode") 52 ACPI_MODULE_NAME ("psopcode")
52 53
53 54
54#define _UNK 0x6B
55/*
56 * Reserved ASCII characters. Do not use any of these for
57 * internal opcodes, since they are used to differentiate
58 * name strings from AML opcodes
59 */
60#define _ASC 0x6C
61#define _NAM 0x6C
62#define _PFX 0x6D
63#define _UNKNOWN_OPCODE 0x02 /* An example unknown opcode */
64
65#define MAX_EXTENDED_OPCODE 0x88
66#define NUM_EXTENDED_OPCODE (MAX_EXTENDED_OPCODE + 1)
67#define MAX_INTERNAL_OPCODE
68#define NUM_INTERNAL_OPCODE (MAX_INTERNAL_OPCODE + 1)
69
70
71/******************************************************************************* 55/*******************************************************************************
72 * 56 *
73 * NAME: acpi_gbl_aml_op_info 57 * NAME: acpi_gbl_aml_op_info
@@ -79,274 +63,9 @@
79 * 63 *
80 ******************************************************************************/ 64 ******************************************************************************/
81 65
82
83/*
84 * All AML opcodes and the parse-time arguments for each. Used by the AML parser Each list is compressed
85 * into a 32-bit number and stored in the master opcode table at the end of this file.
86 */
87
88
89#define ARGP_ACCESSFIELD_OP ARGP_LIST1 (ARGP_NAMESTRING)
90#define ARGP_ACQUIRE_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_WORDDATA)
91#define ARGP_ADD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
92#define ARGP_ALIAS_OP ARGP_LIST2 (ARGP_NAMESTRING, ARGP_NAME)
93#define ARGP_ARG0 ARG_NONE
94#define ARGP_ARG1 ARG_NONE
95#define ARGP_ARG2 ARG_NONE
96#define ARGP_ARG3 ARG_NONE
97#define ARGP_ARG4 ARG_NONE
98#define ARGP_ARG5 ARG_NONE
99#define ARGP_ARG6 ARG_NONE
100#define ARGP_BANK_FIELD_OP ARGP_LIST6 (ARGP_PKGLENGTH, ARGP_NAMESTRING, ARGP_NAMESTRING,ARGP_TERMARG, ARGP_BYTEDATA, ARGP_FIELDLIST)
101#define ARGP_BIT_AND_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
102#define ARGP_BIT_NAND_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
103#define ARGP_BIT_NOR_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
104#define ARGP_BIT_NOT_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
105#define ARGP_BIT_OR_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
106#define ARGP_BIT_XOR_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
107#define ARGP_BREAK_OP ARG_NONE
108#define ARGP_BREAK_POINT_OP ARG_NONE
109#define ARGP_BUFFER_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_BYTELIST)
110#define ARGP_BYTE_OP ARGP_LIST1 (ARGP_BYTEDATA)
111#define ARGP_BYTELIST_OP ARGP_LIST1 (ARGP_NAMESTRING)
112#define ARGP_CONCAT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
113#define ARGP_CONCAT_RES_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
114#define ARGP_COND_REF_OF_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_SUPERNAME)
115#define ARGP_CONTINUE_OP ARG_NONE
116#define ARGP_COPY_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_SIMPLENAME)
117#define ARGP_CREATE_BIT_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
118#define ARGP_CREATE_BYTE_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
119#define ARGP_CREATE_DWORD_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
120#define ARGP_CREATE_FIELD_OP ARGP_LIST4 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
121#define ARGP_CREATE_QWORD_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
122#define ARGP_CREATE_WORD_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
123#define ARGP_DATA_REGION_OP ARGP_LIST4 (ARGP_NAME, ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG)
124#define ARGP_DEBUG_OP ARG_NONE
125#define ARGP_DECREMENT_OP ARGP_LIST1 (ARGP_SUPERNAME)
126#define ARGP_DEREF_OF_OP ARGP_LIST1 (ARGP_TERMARG)
127#define ARGP_DEVICE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_OBJLIST)
128#define ARGP_DIVIDE_OP ARGP_LIST4 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET, ARGP_TARGET)
129#define ARGP_DWORD_OP ARGP_LIST1 (ARGP_DWORDDATA)
130#define ARGP_ELSE_OP ARGP_LIST2 (ARGP_PKGLENGTH, ARGP_TERMLIST)
131#define ARGP_EVENT_OP ARGP_LIST1 (ARGP_NAME)
132#define ARGP_FATAL_OP ARGP_LIST3 (ARGP_BYTEDATA, ARGP_DWORDDATA, ARGP_TERMARG)
133#define ARGP_FIELD_OP ARGP_LIST4 (ARGP_PKGLENGTH, ARGP_NAMESTRING, ARGP_BYTEDATA, ARGP_FIELDLIST)
134#define ARGP_FIND_SET_LEFT_BIT_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
135#define ARGP_FIND_SET_RIGHT_BIT_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
136#define ARGP_FROM_BCD_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
137#define ARGP_IF_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_TERMLIST)
138#define ARGP_INCREMENT_OP ARGP_LIST1 (ARGP_SUPERNAME)
139#define ARGP_INDEX_FIELD_OP ARGP_LIST5 (ARGP_PKGLENGTH, ARGP_NAMESTRING, ARGP_NAMESTRING,ARGP_BYTEDATA, ARGP_FIELDLIST)
140#define ARGP_INDEX_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
141#define ARGP_LAND_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
142#define ARGP_LEQUAL_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
143#define ARGP_LGREATER_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
144#define ARGP_LGREATEREQUAL_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
145#define ARGP_LLESS_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
146#define ARGP_LLESSEQUAL_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
147#define ARGP_LNOT_OP ARGP_LIST1 (ARGP_TERMARG)
148#define ARGP_LNOTEQUAL_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
149#define ARGP_LOAD_OP ARGP_LIST2 (ARGP_NAMESTRING, ARGP_SUPERNAME)
150#define ARGP_LOAD_TABLE_OP ARGP_LIST6 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG)
151#define ARGP_LOCAL0 ARG_NONE
152#define ARGP_LOCAL1 ARG_NONE
153#define ARGP_LOCAL2 ARG_NONE
154#define ARGP_LOCAL3 ARG_NONE
155#define ARGP_LOCAL4 ARG_NONE
156#define ARGP_LOCAL5 ARG_NONE
157#define ARGP_LOCAL6 ARG_NONE
158#define ARGP_LOCAL7 ARG_NONE
159#define ARGP_LOR_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
160#define ARGP_MATCH_OP ARGP_LIST6 (ARGP_TERMARG, ARGP_BYTEDATA, ARGP_TERMARG, ARGP_BYTEDATA, ARGP_TERMARG, ARGP_TERMARG)
161#define ARGP_METHOD_OP ARGP_LIST4 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_BYTEDATA, ARGP_TERMLIST)
162#define ARGP_METHODCALL_OP ARGP_LIST1 (ARGP_NAMESTRING)
163#define ARGP_MID_OP ARGP_LIST4 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
164#define ARGP_MOD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
165#define ARGP_MULTIPLY_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
166#define ARGP_MUTEX_OP ARGP_LIST2 (ARGP_NAME, ARGP_BYTEDATA)
167#define ARGP_NAME_OP ARGP_LIST2 (ARGP_NAME, ARGP_DATAOBJ)
168#define ARGP_NAMEDFIELD_OP ARGP_LIST1 (ARGP_NAMESTRING)
169#define ARGP_NAMEPATH_OP ARGP_LIST1 (ARGP_NAMESTRING)
170#define ARGP_NOOP_OP ARG_NONE
171#define ARGP_NOTIFY_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_TERMARG)
172#define ARGP_ONE_OP ARG_NONE
173#define ARGP_ONES_OP ARG_NONE
174#define ARGP_PACKAGE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_BYTEDATA, ARGP_DATAOBJLIST)
175#define ARGP_POWER_RES_OP ARGP_LIST5 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_BYTEDATA, ARGP_WORDDATA, ARGP_OBJLIST)
176#define ARGP_PROCESSOR_OP ARGP_LIST6 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_BYTEDATA, ARGP_DWORDDATA, ARGP_BYTEDATA, ARGP_OBJLIST)
177#define ARGP_QWORD_OP ARGP_LIST1 (ARGP_QWORDDATA)
178#define ARGP_REF_OF_OP ARGP_LIST1 (ARGP_SUPERNAME)
179#define ARGP_REGION_OP ARGP_LIST4 (ARGP_NAME, ARGP_BYTEDATA, ARGP_TERMARG, ARGP_TERMARG)
180#define ARGP_RELEASE_OP ARGP_LIST1 (ARGP_SUPERNAME)
181#define ARGP_RESERVEDFIELD_OP ARGP_LIST1 (ARGP_NAMESTRING)
182#define ARGP_RESET_OP ARGP_LIST1 (ARGP_SUPERNAME)
183#define ARGP_RETURN_OP ARGP_LIST1 (ARGP_TERMARG)
184#define ARGP_REVISION_OP ARG_NONE
185#define ARGP_SCOPE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_TERMLIST)
186#define ARGP_SHIFT_LEFT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
187#define ARGP_SHIFT_RIGHT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
188#define ARGP_SIGNAL_OP ARGP_LIST1 (ARGP_SUPERNAME)
189#define ARGP_SIZE_OF_OP ARGP_LIST1 (ARGP_SUPERNAME)
190#define ARGP_SLEEP_OP ARGP_LIST1 (ARGP_TERMARG)
191#define ARGP_STALL_OP ARGP_LIST1 (ARGP_TERMARG)
192#define ARGP_STATICSTRING_OP ARGP_LIST1 (ARGP_NAMESTRING)
193#define ARGP_STORE_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_SUPERNAME)
194#define ARGP_STRING_OP ARGP_LIST1 (ARGP_CHARLIST)
195#define ARGP_SUBTRACT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
196#define ARGP_THERMAL_ZONE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_OBJLIST)
197#define ARGP_TIMER_OP ARG_NONE
198#define ARGP_TO_BCD_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
199#define ARGP_TO_BUFFER_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
200#define ARGP_TO_DEC_STR_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
201#define ARGP_TO_HEX_STR_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
202#define ARGP_TO_INTEGER_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
203#define ARGP_TO_STRING_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
204#define ARGP_TYPE_OP ARGP_LIST1 (ARGP_SUPERNAME)
205#define ARGP_UNLOAD_OP ARGP_LIST1 (ARGP_SUPERNAME)
206#define ARGP_VAR_PACKAGE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_DATAOBJLIST)
207#define ARGP_WAIT_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_TERMARG)
208#define ARGP_WHILE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_TERMLIST)
209#define ARGP_WORD_OP ARGP_LIST1 (ARGP_WORDDATA)
210#define ARGP_ZERO_OP ARG_NONE
211
212
213/*
214 * All AML opcodes and the runtime arguments for each. Used by the AML interpreter Each list is compressed
215 * into a 32-bit number and stored in the master opcode table at the end of this file.
216 *
217 * (Used by prep_operands procedure and the ASL Compiler)
218 */
219
220
221#define ARGI_ACCESSFIELD_OP ARGI_INVALID_OPCODE
222#define ARGI_ACQUIRE_OP ARGI_LIST2 (ARGI_MUTEX, ARGI_INTEGER)
223#define ARGI_ADD_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
224#define ARGI_ALIAS_OP ARGI_INVALID_OPCODE
225#define ARGI_ARG0 ARG_NONE
226#define ARGI_ARG1 ARG_NONE
227#define ARGI_ARG2 ARG_NONE
228#define ARGI_ARG3 ARG_NONE
229#define ARGI_ARG4 ARG_NONE
230#define ARGI_ARG5 ARG_NONE
231#define ARGI_ARG6 ARG_NONE
232#define ARGI_BANK_FIELD_OP ARGI_INVALID_OPCODE
233#define ARGI_BIT_AND_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
234#define ARGI_BIT_NAND_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
235#define ARGI_BIT_NOR_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
236#define ARGI_BIT_NOT_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF)
237#define ARGI_BIT_OR_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
238#define ARGI_BIT_XOR_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
239#define ARGI_BREAK_OP ARG_NONE
240#define ARGI_BREAK_POINT_OP ARG_NONE
241#define ARGI_BUFFER_OP ARGI_LIST1 (ARGI_INTEGER)
242#define ARGI_BYTE_OP ARGI_INVALID_OPCODE
243#define ARGI_BYTELIST_OP ARGI_INVALID_OPCODE
244#define ARGI_CONCAT_OP ARGI_LIST3 (ARGI_COMPUTEDATA,ARGI_COMPUTEDATA, ARGI_TARGETREF)
245#define ARGI_CONCAT_RES_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_BUFFER, ARGI_TARGETREF)
246#define ARGI_COND_REF_OF_OP ARGI_LIST2 (ARGI_OBJECT_REF, ARGI_TARGETREF)
247#define ARGI_CONTINUE_OP ARGI_INVALID_OPCODE
248#define ARGI_COPY_OP ARGI_LIST2 (ARGI_ANYTYPE, ARGI_SIMPLE_TARGET)
249#define ARGI_CREATE_BIT_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE)
250#define ARGI_CREATE_BYTE_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE)
251#define ARGI_CREATE_DWORD_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE)
252#define ARGI_CREATE_FIELD_OP ARGI_LIST4 (ARGI_BUFFER, ARGI_INTEGER, ARGI_INTEGER, ARGI_REFERENCE)
253#define ARGI_CREATE_QWORD_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE)
254#define ARGI_CREATE_WORD_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE)
255#define ARGI_DATA_REGION_OP ARGI_LIST3 (ARGI_STRING, ARGI_STRING, ARGI_STRING)
256#define ARGI_DEBUG_OP ARG_NONE
257#define ARGI_DECREMENT_OP ARGI_LIST1 (ARGI_INTEGER_REF)
258#define ARGI_DEREF_OF_OP ARGI_LIST1 (ARGI_REF_OR_STRING)
259#define ARGI_DEVICE_OP ARGI_INVALID_OPCODE
260#define ARGI_DIVIDE_OP ARGI_LIST4 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF, ARGI_TARGETREF)
261#define ARGI_DWORD_OP ARGI_INVALID_OPCODE
262#define ARGI_ELSE_OP ARGI_INVALID_OPCODE
263#define ARGI_EVENT_OP ARGI_INVALID_OPCODE
264#define ARGI_FATAL_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_INTEGER)
265#define ARGI_FIELD_OP ARGI_INVALID_OPCODE
266#define ARGI_FIND_SET_LEFT_BIT_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF)
267#define ARGI_FIND_SET_RIGHT_BIT_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF)
268#define ARGI_FROM_BCD_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF)
269#define ARGI_IF_OP ARGI_INVALID_OPCODE
270#define ARGI_INCREMENT_OP ARGI_LIST1 (ARGI_INTEGER_REF)
271#define ARGI_INDEX_FIELD_OP ARGI_INVALID_OPCODE
272#define ARGI_INDEX_OP ARGI_LIST3 (ARGI_COMPLEXOBJ, ARGI_INTEGER, ARGI_TARGETREF)
273#define ARGI_LAND_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER)
274#define ARGI_LEQUAL_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_COMPUTEDATA)
275#define ARGI_LGREATER_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_COMPUTEDATA)
276#define ARGI_LGREATEREQUAL_OP ARGI_INVALID_OPCODE
277#define ARGI_LLESS_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_COMPUTEDATA)
278#define ARGI_LLESSEQUAL_OP ARGI_INVALID_OPCODE
279#define ARGI_LNOT_OP ARGI_LIST1 (ARGI_INTEGER)
280#define ARGI_LNOTEQUAL_OP ARGI_INVALID_OPCODE
281#define ARGI_LOAD_OP ARGI_LIST2 (ARGI_REGION_OR_FIELD,ARGI_TARGETREF)
282#define ARGI_LOAD_TABLE_OP ARGI_LIST6 (ARGI_STRING, ARGI_STRING, ARGI_STRING, ARGI_STRING, ARGI_STRING, ARGI_ANYTYPE)
283#define ARGI_LOCAL0 ARG_NONE
284#define ARGI_LOCAL1 ARG_NONE
285#define ARGI_LOCAL2 ARG_NONE
286#define ARGI_LOCAL3 ARG_NONE
287#define ARGI_LOCAL4 ARG_NONE
288#define ARGI_LOCAL5 ARG_NONE
289#define ARGI_LOCAL6 ARG_NONE
290#define ARGI_LOCAL7 ARG_NONE
291#define ARGI_LOR_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER)
292#define ARGI_MATCH_OP ARGI_LIST6 (ARGI_PACKAGE, ARGI_INTEGER, ARGI_COMPUTEDATA, ARGI_INTEGER,ARGI_COMPUTEDATA,ARGI_INTEGER)
293#define ARGI_METHOD_OP ARGI_INVALID_OPCODE
294#define ARGI_METHODCALL_OP ARGI_INVALID_OPCODE
295#define ARGI_MID_OP ARGI_LIST4 (ARGI_BUFFER_OR_STRING,ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
296#define ARGI_MOD_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
297#define ARGI_MULTIPLY_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
298#define ARGI_MUTEX_OP ARGI_INVALID_OPCODE
299#define ARGI_NAME_OP ARGI_INVALID_OPCODE
300#define ARGI_NAMEDFIELD_OP ARGI_INVALID_OPCODE
301#define ARGI_NAMEPATH_OP ARGI_INVALID_OPCODE
302#define ARGI_NOOP_OP ARG_NONE
303#define ARGI_NOTIFY_OP ARGI_LIST2 (ARGI_DEVICE_REF, ARGI_INTEGER)
304#define ARGI_ONE_OP ARG_NONE
305#define ARGI_ONES_OP ARG_NONE
306#define ARGI_PACKAGE_OP ARGI_LIST1 (ARGI_INTEGER)
307#define ARGI_POWER_RES_OP ARGI_INVALID_OPCODE
308#define ARGI_PROCESSOR_OP ARGI_INVALID_OPCODE
309#define ARGI_QWORD_OP ARGI_INVALID_OPCODE
310#define ARGI_REF_OF_OP ARGI_LIST1 (ARGI_OBJECT_REF)
311#define ARGI_REGION_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER)
312#define ARGI_RELEASE_OP ARGI_LIST1 (ARGI_MUTEX)
313#define ARGI_RESERVEDFIELD_OP ARGI_INVALID_OPCODE
314#define ARGI_RESET_OP ARGI_LIST1 (ARGI_EVENT)
315#define ARGI_RETURN_OP ARGI_INVALID_OPCODE
316#define ARGI_REVISION_OP ARG_NONE
317#define ARGI_SCOPE_OP ARGI_INVALID_OPCODE
318#define ARGI_SHIFT_LEFT_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
319#define ARGI_SHIFT_RIGHT_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
320#define ARGI_SIGNAL_OP ARGI_LIST1 (ARGI_EVENT)
321#define ARGI_SIZE_OF_OP ARGI_LIST1 (ARGI_DATAOBJECT)
322#define ARGI_SLEEP_OP ARGI_LIST1 (ARGI_INTEGER)
323#define ARGI_STALL_OP ARGI_LIST1 (ARGI_INTEGER)
324#define ARGI_STATICSTRING_OP ARGI_INVALID_OPCODE
325#define ARGI_STORE_OP ARGI_LIST2 (ARGI_DATAREFOBJ, ARGI_TARGETREF)
326#define ARGI_STRING_OP ARGI_INVALID_OPCODE
327#define ARGI_SUBTRACT_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
328#define ARGI_THERMAL_ZONE_OP ARGI_INVALID_OPCODE
329#define ARGI_TIMER_OP ARG_NONE
330#define ARGI_TO_BCD_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_FIXED_TARGET)
331#define ARGI_TO_BUFFER_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET)
332#define ARGI_TO_DEC_STR_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET)
333#define ARGI_TO_HEX_STR_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET)
334#define ARGI_TO_INTEGER_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET)
335#define ARGI_TO_STRING_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_FIXED_TARGET)
336#define ARGI_TYPE_OP ARGI_LIST1 (ARGI_ANYTYPE)
337#define ARGI_UNLOAD_OP ARGI_LIST1 (ARGI_DDBHANDLE)
338#define ARGI_VAR_PACKAGE_OP ARGI_LIST1 (ARGI_INTEGER)
339#define ARGI_WAIT_OP ARGI_LIST2 (ARGI_EVENT, ARGI_INTEGER)
340#define ARGI_WHILE_OP ARGI_INVALID_OPCODE
341#define ARGI_WORD_OP ARGI_INVALID_OPCODE
342#define ARGI_ZERO_OP ARG_NONE
343
344
345/* 66/*
346 * Summary of opcode types/flags 67 * Summary of opcode types/flags
347 */ 68 *
348
349/******************************************************************************
350 69
351 Opcodes that have associated namespace objects (AML_NSOBJECT flag) 70 Opcodes that have associated namespace objects (AML_NSOBJECT flag)
352 71
@@ -460,14 +179,13 @@
460 AML_CREATE_DWORD_FIELD_OP 179 AML_CREATE_DWORD_FIELD_OP
461 AML_CREATE_QWORD_FIELD_OP 180 AML_CREATE_QWORD_FIELD_OP
462 181
463******************************************************************************/ 182 ******************************************************************************/
464 183
465 184
466/* 185/*
467 * Master Opcode information table. A summary of everything we know about each opcode, all in one place. 186 * Master Opcode information table. A summary of everything we know about each
187 * opcode, all in one place.
468 */ 188 */
469
470
471const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES] = 189const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES] =
472{ 190{
473/*! [Begin] no source code translation */ 191/*! [Begin] no source code translation */
@@ -693,8 +411,7 @@ static const u8 acpi_gbl_long_op_index[NUM_EXTENDED_OPCODE] =
693 * 411 *
694 * PARAMETERS: Opcode - The AML opcode 412 * PARAMETERS: Opcode - The AML opcode
695 * 413 *
696 * RETURN: A pointer to the info about the opcode. NULL if the opcode was 414 * RETURN: A pointer to the info about the opcode.
697 * not found in the table.
698 * 415 *
699 * DESCRIPTION: Find AML opcode description based on the opcode. 416 * DESCRIPTION: Find AML opcode description based on the opcode.
700 * NOTE: This procedure must ALWAYS return a valid pointer! 417 * NOTE: This procedure must ALWAYS return a valid pointer!
@@ -731,7 +448,8 @@ acpi_ps_get_opcode_info (
731 448
732 default: 449 default:
733 450
734 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown AML opcode [%4.4X]\n", opcode)); 451 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
452 "Unknown AML opcode [%4.4X]\n", opcode));
735 break; 453 break;
736 } 454 }
737 455
diff --git a/drivers/acpi/parser/psparse.c b/drivers/acpi/parser/psparse.c
index e79edb53cb3b..bbfdc1a58c27 100644
--- a/drivers/acpi/parser/psparse.c
+++ b/drivers/acpi/parser/psparse.c
@@ -64,6 +64,23 @@
64 64
65static u32 acpi_gbl_depth = 0; 65static u32 acpi_gbl_depth = 0;
66 66
67/* Local prototypes */
68
69static void
70acpi_ps_complete_this_op (
71 struct acpi_walk_state *walk_state,
72 union acpi_parse_object *op);
73
74static acpi_status
75acpi_ps_next_parse_state (
76 struct acpi_walk_state *walk_state,
77 union acpi_parse_object *op,
78 acpi_status callback_status);
79
80static acpi_status
81acpi_ps_parse_loop (
82 struct acpi_walk_state *walk_state);
83
67 84
68/******************************************************************************* 85/*******************************************************************************
69 * 86 *
@@ -100,7 +117,7 @@ acpi_ps_get_opcode_size (
100 * 117 *
101 * PARAMETERS: parser_state - A parser state object 118 * PARAMETERS: parser_state - A parser state object
102 * 119 *
103 * RETURN: Status 120 * RETURN: Next AML opcode
104 * 121 *
105 * DESCRIPTION: Get next AML opcode (without incrementing AML pointer) 122 * DESCRIPTION: Get next AML opcode (without incrementing AML pointer)
106 * 123 *
@@ -117,7 +134,6 @@ acpi_ps_peek_opcode (
117 aml = parser_state->aml; 134 aml = parser_state->aml;
118 opcode = (u16) ACPI_GET8 (aml); 135 opcode = (u16) ACPI_GET8 (aml);
119 136
120
121 if (opcode == AML_EXTOP) { 137 if (opcode == AML_EXTOP) {
122 /* Extended opcode */ 138 /* Extended opcode */
123 139
@@ -142,7 +158,7 @@ acpi_ps_peek_opcode (
142 * 158 *
143 ******************************************************************************/ 159 ******************************************************************************/
144 160
145void 161static void
146acpi_ps_complete_this_op ( 162acpi_ps_complete_this_op (
147 struct acpi_walk_state *walk_state, 163 struct acpi_walk_state *walk_state,
148 union acpi_parse_object *op) 164 union acpi_parse_object *op)
@@ -272,7 +288,6 @@ acpi_ps_complete_this_op (
272 next = NULL; 288 next = NULL;
273 } 289 }
274 } 290 }
275
276 prev = next; 291 prev = next;
277 } 292 }
278 } 293 }
@@ -280,7 +295,7 @@ acpi_ps_complete_this_op (
280 295
281cleanup: 296cleanup:
282 297
283 /* Now we can actually delete the subtree rooted at op */ 298 /* Now we can actually delete the subtree rooted at Op */
284 299
285 acpi_ps_delete_parse_tree (op); 300 acpi_ps_delete_parse_tree (op);
286 return_VOID; 301 return_VOID;
@@ -291,7 +306,9 @@ cleanup:
291 * 306 *
292 * FUNCTION: acpi_ps_next_parse_state 307 * FUNCTION: acpi_ps_next_parse_state
293 * 308 *
294 * PARAMETERS: parser_state - Current parser state object 309 * PARAMETERS: walk_state - Current state
310 * Op - Current parse op
311 * callback_status - Status from previous operation
295 * 312 *
296 * RETURN: Status 313 * RETURN: Status
297 * 314 *
@@ -300,7 +317,7 @@ cleanup:
300 * 317 *
301 ******************************************************************************/ 318 ******************************************************************************/
302 319
303acpi_status 320static acpi_status
304acpi_ps_next_parse_state ( 321acpi_ps_next_parse_state (
305 struct acpi_walk_state *walk_state, 322 struct acpi_walk_state *walk_state,
306 union acpi_parse_object *op, 323 union acpi_parse_object *op,
@@ -382,9 +399,8 @@ acpi_ps_next_parse_state (
382 399
383 case AE_CTRL_TRANSFER: 400 case AE_CTRL_TRANSFER:
384 401
385 /* 402 /* A method call (invocation) -- transfer control */
386 * A method call (invocation) -- transfer control 403
387 */
388 status = AE_CTRL_TRANSFER; 404 status = AE_CTRL_TRANSFER;
389 walk_state->prev_op = op; 405 walk_state->prev_op = op;
390 walk_state->method_call_op = op; 406 walk_state->method_call_op = op;
@@ -397,6 +413,7 @@ acpi_ps_next_parse_state (
397 413
398 414
399 default: 415 default:
416
400 status = callback_status; 417 status = callback_status;
401 if ((callback_status & AE_CODE_MASK) == AE_CODE_CONTROL) { 418 if ((callback_status & AE_CODE_MASK) == AE_CODE_CONTROL) {
402 status = AE_OK; 419 status = AE_OK;
@@ -412,7 +429,7 @@ acpi_ps_next_parse_state (
412 * 429 *
413 * FUNCTION: acpi_ps_parse_loop 430 * FUNCTION: acpi_ps_parse_loop
414 * 431 *
415 * PARAMETERS: parser_state - Current parser state object 432 * PARAMETERS: walk_state - Current state
416 * 433 *
417 * RETURN: Status 434 * RETURN: Status
418 * 435 *
@@ -421,7 +438,7 @@ acpi_ps_next_parse_state (
421 * 438 *
422 ******************************************************************************/ 439 ******************************************************************************/
423 440
424acpi_status 441static acpi_status
425acpi_ps_parse_loop ( 442acpi_ps_parse_loop (
426 struct acpi_walk_state *walk_state) 443 struct acpi_walk_state *walk_state)
427{ 444{
@@ -443,6 +460,7 @@ acpi_ps_parse_loop (
443 walk_state->arg_types = 0; 460 walk_state->arg_types = 0;
444 461
445#if (!defined (ACPI_NO_METHOD_EXECUTION) && !defined (ACPI_CONSTANT_EVAL_ONLY)) 462#if (!defined (ACPI_NO_METHOD_EXECUTION) && !defined (ACPI_CONSTANT_EVAL_ONLY))
463
446 if (walk_state->walk_type & ACPI_WALK_METHOD_RESTART) { 464 if (walk_state->walk_type & ACPI_WALK_METHOD_RESTART) {
447 /* We are restarting a preempted control method */ 465 /* We are restarting a preempted control method */
448 466
@@ -471,7 +489,8 @@ acpi_ps_parse_loop (
471 acpi_format_exception (status))); 489 acpi_format_exception (status)));
472 490
473 } 491 }
474 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "get_predicate Failed, %s\n", 492 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
493 "get_predicate Failed, %s\n",
475 acpi_format_exception (status))); 494 acpi_format_exception (status)));
476 return_ACPI_STATUS (status); 495 return_ACPI_STATUS (status);
477 } 496 }
@@ -492,16 +511,15 @@ acpi_ps_parse_loop (
492 } 511 }
493#endif 512#endif
494 513
495 /* 514 /* Iterative parsing loop, while there is more AML to process: */
496 * Iterative parsing loop, while there is more aml to process: 515
497 */
498 while ((parser_state->aml < parser_state->aml_end) || (op)) { 516 while ((parser_state->aml < parser_state->aml_end) || (op)) {
499 aml_op_start = parser_state->aml; 517 aml_op_start = parser_state->aml;
500 if (!op) { 518 if (!op) {
501 /* Get the next opcode from the AML stream */ 519 /* Get the next opcode from the AML stream */
502 520
503 walk_state->aml_offset = (u32) ACPI_PTR_DIFF (parser_state->aml, 521 walk_state->aml_offset = (u32) ACPI_PTR_DIFF (parser_state->aml,
504 parser_state->aml_start); 522 parser_state->aml_start);
505 walk_state->opcode = acpi_ps_peek_opcode (parser_state); 523 walk_state->opcode = acpi_ps_peek_opcode (parser_state);
506 524
507 /* 525 /*
@@ -578,8 +596,10 @@ acpi_ps_parse_loop (
578 INCREMENT_ARG_LIST (walk_state->arg_types); 596 INCREMENT_ARG_LIST (walk_state->arg_types);
579 } 597 }
580 598
581 /* Make sure that we found a NAME and didn't run out of arguments */ 599 /*
582 600 * Make sure that we found a NAME and didn't run out of
601 * arguments
602 */
583 if (!GET_CURRENT_ARG_TYPE (walk_state->arg_types)) { 603 if (!GET_CURRENT_ARG_TYPE (walk_state->arg_types)) {
584 status = AE_AML_NO_OPERAND; 604 status = AE_AML_NO_OPERAND;
585 goto close_this_op; 605 goto close_this_op;
@@ -597,12 +617,13 @@ acpi_ps_parse_loop (
597 617
598 status = walk_state->descending_callback (walk_state, &op); 618 status = walk_state->descending_callback (walk_state, &op);
599 if (ACPI_FAILURE (status)) { 619 if (ACPI_FAILURE (status)) {
600 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "During name lookup/catalog, %s\n", 620 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
601 acpi_format_exception (status))); 621 "During name lookup/catalog, %s\n",
622 acpi_format_exception (status)));
602 goto close_this_op; 623 goto close_this_op;
603 } 624 }
604 625
605 if (op == NULL) { 626 if (!op) {
606 continue; 627 continue;
607 } 628 }
608 629
@@ -659,7 +680,7 @@ acpi_ps_parse_loop (
659 680
660 if ((walk_state->descending_callback != NULL)) { 681 if ((walk_state->descending_callback != NULL)) {
661 /* 682 /*
662 * Find the object. This will either insert the object into 683 * Find the object. This will either insert the object into
663 * the namespace or simply look it up 684 * the namespace or simply look it up
664 */ 685 */
665 walk_state->op = op; 686 walk_state->op = op;
@@ -688,11 +709,15 @@ acpi_ps_parse_loop (
688 } 709 }
689 710
690 711
691 /* Start arg_count at zero because we don't know if there are any args yet */ 712 /*
692 713 * Start arg_count at zero because we don't know if there are
714 * any args yet
715 */
693 walk_state->arg_count = 0; 716 walk_state->arg_count = 0;
694 717
695 if (walk_state->arg_types) /* Are there any arguments that must be processed? */ { 718 /* Are there any arguments that must be processed? */
719
720 if (walk_state->arg_types) {
696 /* Get arguments */ 721 /* Get arguments */
697 722
698 switch (op->common.aml_opcode) { 723 switch (op->common.aml_opcode) {
@@ -720,14 +745,18 @@ acpi_ps_parse_loop (
720 745
721 default: 746 default:
722 747
723 /* Op is not a constant or string, append each argument to the Op */ 748 /*
724 749 * Op is not a constant or string, append each argument
750 * to the Op
751 */
725 while (GET_CURRENT_ARG_TYPE (walk_state->arg_types) && 752 while (GET_CURRENT_ARG_TYPE (walk_state->arg_types) &&
726 !walk_state->arg_count) { 753 !walk_state->arg_count) {
727 walk_state->aml_offset = (u32) ACPI_PTR_DIFF (parser_state->aml, 754 walk_state->aml_offset = (u32)
728 parser_state->aml_start); 755 ACPI_PTR_DIFF (parser_state->aml, parser_state->aml_start);
756
729 status = acpi_ps_get_next_arg (walk_state, parser_state, 757 status = acpi_ps_get_next_arg (walk_state, parser_state,
730 GET_CURRENT_ARG_TYPE (walk_state->arg_types), &arg); 758 GET_CURRENT_ARG_TYPE (walk_state->arg_types),
759 &arg);
731 if (ACPI_FAILURE (status)) { 760 if (ACPI_FAILURE (status)) {
732 goto close_this_op; 761 goto close_this_op;
733 } 762 }
@@ -752,7 +781,8 @@ acpi_ps_parse_loop (
752 * Save the length and address of the body 781 * Save the length and address of the body
753 */ 782 */
754 op->named.data = parser_state->aml; 783 op->named.data = parser_state->aml;
755 op->named.length = (u32) (parser_state->pkg_end - parser_state->aml); 784 op->named.length = (u32) (parser_state->pkg_end -
785 parser_state->aml);
756 786
757 /* Skip body of method */ 787 /* Skip body of method */
758 788
@@ -773,7 +803,8 @@ acpi_ps_parse_loop (
773 * to parse them correctly. 803 * to parse them correctly.
774 */ 804 */
775 op->named.data = aml_op_start; 805 op->named.data = aml_op_start;
776 op->named.length = (u32) (parser_state->pkg_end - aml_op_start); 806 op->named.length = (u32) (parser_state->pkg_end -
807 aml_op_start);
777 808
778 /* Skip body */ 809 /* Skip body */
779 810
@@ -785,7 +816,8 @@ acpi_ps_parse_loop (
785 case AML_WHILE_OP: 816 case AML_WHILE_OP:
786 817
787 if (walk_state->control_state) { 818 if (walk_state->control_state) {
788 walk_state->control_state->control.package_end = parser_state->pkg_end; 819 walk_state->control_state->control.package_end =
820 parser_state->pkg_end;
789 } 821 }
790 break; 822 break;
791 823
@@ -801,8 +833,10 @@ acpi_ps_parse_loop (
801 /* Check for arguments that need to be processed */ 833 /* Check for arguments that need to be processed */
802 834
803 if (walk_state->arg_count) { 835 if (walk_state->arg_count) {
804 /* There are arguments (complex ones), push Op and prepare for argument */ 836 /*
805 837 * There are arguments (complex ones), push Op and
838 * prepare for argument
839 */
806 status = acpi_ps_push_scope (parser_state, op, 840 status = acpi_ps_push_scope (parser_state, op,
807 walk_state->arg_types, walk_state->arg_count); 841 walk_state->arg_types, walk_state->arg_count);
808 if (ACPI_FAILURE (status)) { 842 if (ACPI_FAILURE (status)) {
@@ -812,8 +846,10 @@ acpi_ps_parse_loop (
812 continue; 846 continue;
813 } 847 }
814 848
815 /* All arguments have been processed -- Op is complete, prepare for next */ 849 /*
816 850 * All arguments have been processed -- Op is complete,
851 * prepare for next
852 */
817 walk_state->op_info = acpi_ps_get_opcode_info (op->common.aml_opcode); 853 walk_state->op_info = acpi_ps_get_opcode_info (op->common.aml_opcode);
818 if (walk_state->op_info->flags & AML_NAMED) { 854 if (walk_state->op_info->flags & AML_NAMED) {
819 if (acpi_gbl_depth) { 855 if (acpi_gbl_depth) {
@@ -880,9 +916,8 @@ close_this_op:
880 916
881 case AE_CTRL_TRANSFER: 917 case AE_CTRL_TRANSFER:
882 918
883 /* 919 /* We are about to transfer to a called method. */
884 * We are about to transfer to a called method. 920
885 */
886 walk_state->prev_op = op; 921 walk_state->prev_op = op;
887 walk_state->prev_arg_types = walk_state->arg_types; 922 walk_state->prev_arg_types = walk_state->arg_types;
888 return_ACPI_STATUS (status); 923 return_ACPI_STATUS (status);
@@ -1051,10 +1086,7 @@ close_this_op:
1051 * 1086 *
1052 * FUNCTION: acpi_ps_parse_aml 1087 * FUNCTION: acpi_ps_parse_aml
1053 * 1088 *
1054 * PARAMETERS: start_scope - The starting point of the parse. Becomes the 1089 * PARAMETERS: walk_state - Current state
1055 * root of the parsed op tree.
1056 * Aml - Pointer to the raw AML code to parse
1057 * aml_size - Length of the AML to parse
1058 * 1090 *
1059 * 1091 *
1060 * RETURN: Status 1092 * RETURN: Status
@@ -1076,8 +1108,10 @@ acpi_ps_parse_aml (
1076 1108
1077 ACPI_FUNCTION_TRACE ("ps_parse_aml"); 1109 ACPI_FUNCTION_TRACE ("ps_parse_aml");
1078 1110
1079 ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Entered with walk_state=%p Aml=%p size=%X\n", 1111 ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
1080 walk_state, walk_state->parser_state.aml, walk_state->parser_state.aml_size)); 1112 "Entered with walk_state=%p Aml=%p size=%X\n",
1113 walk_state, walk_state->parser_state.aml,
1114 walk_state->parser_state.aml_size));
1081 1115
1082 1116
1083 /* Create and initialize a new thread state */ 1117 /* Create and initialize a new thread state */
@@ -1142,9 +1176,10 @@ acpi_ps_parse_aml (
1142 if ((status == AE_ALREADY_EXISTS) && 1176 if ((status == AE_ALREADY_EXISTS) &&
1143 (!walk_state->method_desc->method.semaphore)) { 1177 (!walk_state->method_desc->method.semaphore)) {
1144 /* 1178 /*
1145 * This method is marked not_serialized, but it tried to create a named 1179 * This method is marked not_serialized, but it tried to create
1146 * object, causing the second thread entrance to fail. We will workaround 1180 * a named object, causing the second thread entrance to fail.
1147 * this by marking the method permanently as Serialized. 1181 * We will workaround this by marking the method permanently
1182 * as Serialized.
1148 */ 1183 */
1149 walk_state->method_desc->method.method_flags |= AML_METHOD_SERIALIZED; 1184 walk_state->method_desc->method.method_flags |= AML_METHOD_SERIALIZED;
1150 walk_state->method_desc->method.concurrency = 1; 1185 walk_state->method_desc->method.concurrency = 1;
@@ -1187,7 +1222,8 @@ acpi_ps_parse_aml (
1187 1222
1188 previous_walk_state = walk_state; 1223 previous_walk_state = walk_state;
1189 1224
1190 ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "return_value=%p, implicit_value=%p State=%p\n", 1225 ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
1226 "return_value=%p, implicit_value=%p State=%p\n",
1191 walk_state->return_desc, walk_state->implicit_return_obj, walk_state)); 1227 walk_state->return_desc, walk_state->implicit_return_obj, walk_state));
1192 1228
1193 /* Check if we have restarted a preempted walk */ 1229 /* Check if we have restarted a preempted walk */
@@ -1231,12 +1267,14 @@ acpi_ps_parse_aml (
1231 */ 1267 */
1232 else if (previous_walk_state->caller_return_desc) { 1268 else if (previous_walk_state->caller_return_desc) {
1233 if (previous_walk_state->implicit_return_obj) { 1269 if (previous_walk_state->implicit_return_obj) {
1234 *(previous_walk_state->caller_return_desc) = previous_walk_state->implicit_return_obj; 1270 *(previous_walk_state->caller_return_desc) =
1271 previous_walk_state->implicit_return_obj;
1235 } 1272 }
1236 else { 1273 else {
1237 /* NULL if no return value */ 1274 /* NULL if no return value */
1238 1275
1239 *(previous_walk_state->caller_return_desc) = previous_walk_state->return_desc; 1276 *(previous_walk_state->caller_return_desc) =
1277 previous_walk_state->return_desc;
1240 } 1278 }
1241 } 1279 }
1242 else { 1280 else {
diff --git a/drivers/acpi/parser/psscope.c b/drivers/acpi/parser/psscope.c
index dcbed49608b0..8dcd1b1e7131 100644
--- a/drivers/acpi/parser/psscope.c
+++ b/drivers/acpi/parser/psscope.c
@@ -65,6 +65,7 @@ union acpi_parse_object *
65acpi_ps_get_parent_scope ( 65acpi_ps_get_parent_scope (
66 struct acpi_parse_state *parser_state) 66 struct acpi_parse_state *parser_state)
67{ 67{
68
68 return (parser_state->scope->parse_scope.op); 69 return (parser_state->scope->parse_scope.op);
69} 70}
70 71
@@ -87,8 +88,10 @@ u8
87acpi_ps_has_completed_scope ( 88acpi_ps_has_completed_scope (
88 struct acpi_parse_state *parser_state) 89 struct acpi_parse_state *parser_state)
89{ 90{
90 return ((u8) ((parser_state->aml >= parser_state->scope->parse_scope.arg_end || 91
91 !parser_state->scope->parse_scope.arg_count))); 92 return ((u8)
93 ((parser_state->aml >= parser_state->scope->parse_scope.arg_end ||
94 !parser_state->scope->parse_scope.arg_count)));
92} 95}
93 96
94 97
@@ -167,23 +170,23 @@ acpi_ps_push_scope (
167 return_ACPI_STATUS (AE_NO_MEMORY); 170 return_ACPI_STATUS (AE_NO_MEMORY);
168 } 171 }
169 172
170 scope->common.data_type = ACPI_DESC_TYPE_STATE_PSCOPE; 173 scope->common.data_type = ACPI_DESC_TYPE_STATE_PSCOPE;
171 scope->parse_scope.op = op; 174 scope->parse_scope.op = op;
172 scope->parse_scope.arg_list = remaining_args; 175 scope->parse_scope.arg_list = remaining_args;
173 scope->parse_scope.arg_count = arg_count; 176 scope->parse_scope.arg_count = arg_count;
174 scope->parse_scope.pkg_end = parser_state->pkg_end; 177 scope->parse_scope.pkg_end = parser_state->pkg_end;
175 178
176 /* Push onto scope stack */ 179 /* Push onto scope stack */
177 180
178 acpi_ut_push_generic_state (&parser_state->scope, scope); 181 acpi_ut_push_generic_state (&parser_state->scope, scope);
179 182
180 if (arg_count == ACPI_VAR_ARGS) { 183 if (arg_count == ACPI_VAR_ARGS) {
181 /* multiple arguments */ 184 /* Multiple arguments */
182 185
183 scope->parse_scope.arg_end = parser_state->pkg_end; 186 scope->parse_scope.arg_end = parser_state->pkg_end;
184 } 187 }
185 else { 188 else {
186 /* single argument */ 189 /* Single argument */
187 190
188 scope->parse_scope.arg_end = ACPI_TO_POINTER (ACPI_MAX_PTR); 191 scope->parse_scope.arg_end = ACPI_TO_POINTER (ACPI_MAX_PTR);
189 } 192 }
@@ -221,18 +224,17 @@ acpi_ps_pop_scope (
221 ACPI_FUNCTION_TRACE ("ps_pop_scope"); 224 ACPI_FUNCTION_TRACE ("ps_pop_scope");
222 225
223 226
224 /* 227 /* Only pop the scope if there is in fact a next scope */
225 * Only pop the scope if there is in fact a next scope 228
226 */
227 if (scope->common.next) { 229 if (scope->common.next) {
228 scope = acpi_ut_pop_generic_state (&parser_state->scope); 230 scope = acpi_ut_pop_generic_state (&parser_state->scope);
229 231
230 /* return to parsing previous op */ 232 /* return to parsing previous op */
231 233
232 *op = scope->parse_scope.op; 234 *op = scope->parse_scope.op;
233 *arg_list = scope->parse_scope.arg_list; 235 *arg_list = scope->parse_scope.arg_list;
234 *arg_count = scope->parse_scope.arg_count; 236 *arg_count = scope->parse_scope.arg_count;
235 parser_state->pkg_end = scope->parse_scope.pkg_end; 237 parser_state->pkg_end = scope->parse_scope.pkg_end;
236 238
237 /* All done with this scope state structure */ 239 /* All done with this scope state structure */
238 240
@@ -241,12 +243,13 @@ acpi_ps_pop_scope (
241 else { 243 else {
242 /* empty parse stack, prepare to fetch next opcode */ 244 /* empty parse stack, prepare to fetch next opcode */
243 245
244 *op = NULL; 246 *op = NULL;
245 *arg_list = 0; 247 *arg_list = 0;
246 *arg_count = 0; 248 *arg_count = 0;
247 } 249 }
248 250
249 ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Popped Op %p Args %X\n", *op, *arg_count)); 251 ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
252 "Popped Op %p Args %X\n", *op, *arg_count));
250 return_VOID; 253 return_VOID;
251} 254}
252 255
@@ -257,7 +260,7 @@ acpi_ps_pop_scope (
257 * 260 *
258 * PARAMETERS: parser_state - Current parser state object 261 * PARAMETERS: parser_state - Current parser state object
259 * 262 *
260 * RETURN: Status 263 * RETURN: None
261 * 264 *
262 * DESCRIPTION: Destroy available list, remaining stack levels, and return 265 * DESCRIPTION: Destroy available list, remaining stack levels, and return
263 * root scope 266 * root scope
diff --git a/drivers/acpi/parser/pstree.c b/drivers/acpi/parser/pstree.c
index 2140bd1ac10b..d5aafe73fca0 100644
--- a/drivers/acpi/parser/pstree.c
+++ b/drivers/acpi/parser/pstree.c
@@ -49,6 +49,14 @@
49#define _COMPONENT ACPI_PARSER 49#define _COMPONENT ACPI_PARSER
50 ACPI_MODULE_NAME ("pstree") 50 ACPI_MODULE_NAME ("pstree")
51 51
52/* Local prototypes */
53
54#ifdef ACPI_OBSOLETE_FUNCTIONS
55union acpi_parse_object *
56acpi_ps_get_child (
57 union acpi_parse_object *op);
58#endif
59
52 60
53/******************************************************************************* 61/*******************************************************************************
54 * 62 *
@@ -57,7 +65,7 @@
57 * PARAMETERS: Op - Get an argument for this op 65 * PARAMETERS: Op - Get an argument for this op
58 * Argn - Nth argument to get 66 * Argn - Nth argument to get
59 * 67 *
60 * RETURN: The argument (as an Op object). NULL if argument does not exist 68 * RETURN: The argument (as an Op object). NULL if argument does not exist
61 * 69 *
62 * DESCRIPTION: Get the specified op's argument. 70 * DESCRIPTION: Get the specified op's argument.
63 * 71 *
@@ -152,7 +160,6 @@ acpi_ps_append_arg (
152 return; 160 return;
153 } 161 }
154 162
155
156 /* Append the argument to the linked argument list */ 163 /* Append the argument to the linked argument list */
157 164
158 if (op->common.value.arg) { 165 if (op->common.value.arg) {
@@ -164,14 +171,12 @@ acpi_ps_append_arg (
164 } 171 }
165 prev_arg->common.next = arg; 172 prev_arg->common.next = arg;
166 } 173 }
167
168 else { 174 else {
169 /* No argument list, this will be the first argument */ 175 /* No argument list, this will be the first argument */
170 176
171 op->common.value.arg = arg; 177 op->common.value.arg = arg;
172 } 178 }
173 179
174
175 /* Set the parent in this arg and any args linked after it */ 180 /* Set the parent in this arg and any args linked after it */
176 181
177 while (arg) { 182 while (arg) {
@@ -182,73 +187,6 @@ acpi_ps_append_arg (
182 187
183 188
184#ifdef ACPI_FUTURE_USAGE 189#ifdef ACPI_FUTURE_USAGE
185
186/*******************************************************************************
187 *
188 * FUNCTION: acpi_ps_get_child
189 *
190 * PARAMETERS: Op - Get the child of this Op
191 *
192 * RETURN: Child Op, Null if none is found.
193 *
194 * DESCRIPTION: Get op's children or NULL if none
195 *
196 ******************************************************************************/
197union acpi_parse_object *
198acpi_ps_get_child (
199 union acpi_parse_object *op)
200{
201 union acpi_parse_object *child = NULL;
202
203
204 ACPI_FUNCTION_ENTRY ();
205
206
207 switch (op->common.aml_opcode) {
208 case AML_SCOPE_OP:
209 case AML_ELSE_OP:
210 case AML_DEVICE_OP:
211 case AML_THERMAL_ZONE_OP:
212 case AML_INT_METHODCALL_OP:
213
214 child = acpi_ps_get_arg (op, 0);
215 break;
216
217
218 case AML_BUFFER_OP:
219 case AML_PACKAGE_OP:
220 case AML_METHOD_OP:
221 case AML_IF_OP:
222 case AML_WHILE_OP:
223 case AML_FIELD_OP:
224
225 child = acpi_ps_get_arg (op, 1);
226 break;
227
228
229 case AML_POWER_RES_OP:
230 case AML_INDEX_FIELD_OP:
231
232 child = acpi_ps_get_arg (op, 2);
233 break;
234
235
236 case AML_PROCESSOR_OP:
237 case AML_BANK_FIELD_OP:
238
239 child = acpi_ps_get_arg (op, 3);
240 break;
241
242
243 default:
244 /* All others have no children */
245 break;
246 }
247
248 return (child);
249}
250
251
252/******************************************************************************* 190/*******************************************************************************
253 * 191 *
254 * FUNCTION: acpi_ps_get_depth_next 192 * FUNCTION: acpi_ps_get_depth_next
@@ -280,21 +218,21 @@ acpi_ps_get_depth_next (
280 return (NULL); 218 return (NULL);
281 } 219 }
282 220
283 /* look for an argument or child */ 221 /* Look for an argument or child */
284 222
285 next = acpi_ps_get_arg (op, 0); 223 next = acpi_ps_get_arg (op, 0);
286 if (next) { 224 if (next) {
287 return (next); 225 return (next);
288 } 226 }
289 227
290 /* look for a sibling */ 228 /* Look for a sibling */
291 229
292 next = op->common.next; 230 next = op->common.next;
293 if (next) { 231 if (next) {
294 return (next); 232 return (next);
295 } 233 }
296 234
297 /* look for a sibling of parent */ 235 /* Look for a sibling of parent */
298 236
299 parent = op->common.parent; 237 parent = op->common.parent;
300 238
@@ -305,13 +243,13 @@ acpi_ps_get_depth_next (
305 } 243 }
306 244
307 if (arg == origin) { 245 if (arg == origin) {
308 /* reached parent of origin, end search */ 246 /* Reached parent of origin, end search */
309 247
310 return (NULL); 248 return (NULL);
311 } 249 }
312 250
313 if (parent->common.next) { 251 if (parent->common.next) {
314 /* found sibling of parent */ 252 /* Found sibling of parent */
315 253
316 return (parent->common.next); 254 return (parent->common.next);
317 } 255 }
@@ -323,5 +261,74 @@ acpi_ps_get_depth_next (
323 return (next); 261 return (next);
324} 262}
325 263
264
265#ifdef ACPI_OBSOLETE_FUNCTIONS
266/*******************************************************************************
267 *
268 * FUNCTION: acpi_ps_get_child
269 *
270 * PARAMETERS: Op - Get the child of this Op
271 *
272 * RETURN: Child Op, Null if none is found.
273 *
274 * DESCRIPTION: Get op's children or NULL if none
275 *
276 ******************************************************************************/
277
278union acpi_parse_object *
279acpi_ps_get_child (
280 union acpi_parse_object *op)
281{
282 union acpi_parse_object *child = NULL;
283
284
285 ACPI_FUNCTION_ENTRY ();
286
287
288 switch (op->common.aml_opcode) {
289 case AML_SCOPE_OP:
290 case AML_ELSE_OP:
291 case AML_DEVICE_OP:
292 case AML_THERMAL_ZONE_OP:
293 case AML_INT_METHODCALL_OP:
294
295 child = acpi_ps_get_arg (op, 0);
296 break;
297
298
299 case AML_BUFFER_OP:
300 case AML_PACKAGE_OP:
301 case AML_METHOD_OP:
302 case AML_IF_OP:
303 case AML_WHILE_OP:
304 case AML_FIELD_OP:
305
306 child = acpi_ps_get_arg (op, 1);
307 break;
308
309
310 case AML_POWER_RES_OP:
311 case AML_INDEX_FIELD_OP:
312
313 child = acpi_ps_get_arg (op, 2);
314 break;
315
316
317 case AML_PROCESSOR_OP:
318 case AML_BANK_FIELD_OP:
319
320 child = acpi_ps_get_arg (op, 3);
321 break;
322
323
324 default:
325 /* All others have no children */
326 break;
327 }
328
329 return (child);
330}
331#endif
332
326#endif /* ACPI_FUTURE_USAGE */ 333#endif /* ACPI_FUTURE_USAGE */
327 334
diff --git a/drivers/acpi/parser/psutils.c b/drivers/acpi/parser/psutils.c
index b3597cb19f88..a10f88715d43 100644
--- a/drivers/acpi/parser/psutils.c
+++ b/drivers/acpi/parser/psutils.c
@@ -45,7 +45,6 @@
45#include <acpi/acpi.h> 45#include <acpi/acpi.h>
46#include <acpi/acparser.h> 46#include <acpi/acparser.h>
47#include <acpi/amlcode.h> 47#include <acpi/amlcode.h>
48#include <acpi/acnamesp.h>
49 48
50#define _COMPONENT ACPI_PARSER 49#define _COMPONENT ACPI_PARSER
51 ACPI_MODULE_NAME ("psutils") 50 ACPI_MODULE_NAME ("psutils")
@@ -57,7 +56,7 @@
57 * 56 *
58 * PARAMETERS: None 57 * PARAMETERS: None
59 * 58 *
60 * RETURN: scope_op 59 * RETURN: A new Scope object, null on failure
61 * 60 *
62 * DESCRIPTION: Create a Scope and associated namepath op with the root name 61 * DESCRIPTION: Create a Scope and associated namepath op with the root name
63 * 62 *
@@ -75,7 +74,6 @@ acpi_ps_create_scope_op (
75 return (NULL); 74 return (NULL);
76 } 75 }
77 76
78
79 scope_op->named.name = ACPI_ROOT_NAME; 77 scope_op->named.name = ACPI_ROOT_NAME;
80 return (scope_op); 78 return (scope_op);
81} 79}
@@ -88,10 +86,9 @@ acpi_ps_create_scope_op (
88 * PARAMETERS: Op - A newly allocated Op object 86 * PARAMETERS: Op - A newly allocated Op object
89 * Opcode - Opcode to store in the Op 87 * Opcode - Opcode to store in the Op
90 * 88 *
91 * RETURN: Status 89 * RETURN: None
92 * 90 *
93 * DESCRIPTION: Allocate an acpi_op, choose op type (and thus size) based on 91 * DESCRIPTION: Initialize a parse (Op) object
94 * opcode
95 * 92 *
96 ******************************************************************************/ 93 ******************************************************************************/
97 94
@@ -107,7 +104,8 @@ acpi_ps_init_op (
107 op->common.aml_opcode = opcode; 104 op->common.aml_opcode = opcode;
108 105
109 ACPI_DISASM_ONLY_MEMBERS (ACPI_STRNCPY (op->common.aml_op_name, 106 ACPI_DISASM_ONLY_MEMBERS (ACPI_STRNCPY (op->common.aml_op_name,
110 (acpi_ps_get_opcode_info (opcode))->name, sizeof (op->common.aml_op_name))); 107 (acpi_ps_get_opcode_info (opcode))->name,
108 sizeof (op->common.aml_op_name)));
111} 109}
112 110
113 111
@@ -117,7 +115,7 @@ acpi_ps_init_op (
117 * 115 *
118 * PARAMETERS: Opcode - Opcode that will be stored in the new Op 116 * PARAMETERS: Opcode - Opcode that will be stored in the new Op
119 * 117 *
120 * RETURN: Pointer to the new Op. 118 * RETURN: Pointer to the new Op, null on failure
121 * 119 *
122 * DESCRIPTION: Allocate an acpi_op, choose op type (and thus size) based on 120 * DESCRIPTION: Allocate an acpi_op, choose op type (and thus size) based on
123 * opcode. A cache of opcodes is available for the pure 121 * opcode. A cache of opcodes is available for the pure
@@ -275,7 +273,6 @@ acpi_ps_get_name (
275 union acpi_parse_object *op) 273 union acpi_parse_object *op)
276{ 274{
277 275
278
279 /* The "generic" object has no name associated with it */ 276 /* The "generic" object has no name associated with it */
280 277
281 if (op->common.flags & ACPI_PARSEOP_GENERIC) { 278 if (op->common.flags & ACPI_PARSEOP_GENERIC) {
diff --git a/drivers/acpi/parser/pswalk.c b/drivers/acpi/parser/pswalk.c
index 110d2ce917b6..9d20cb2ceb51 100644
--- a/drivers/acpi/parser/pswalk.c
+++ b/drivers/acpi/parser/pswalk.c
@@ -90,17 +90,15 @@ acpi_ps_delete_parse_tree (
90 } 90 }
91 } 91 }
92 92
93 /* 93 /* No more children, this Op is complete. */
94 * No more children, this Op is complete. 94
95 */
96 next = op->common.next; 95 next = op->common.next;
97 parent = op->common.parent; 96 parent = op->common.parent;
98 97
99 acpi_ps_free_op (op); 98 acpi_ps_free_op (op);
100 99
101 /* 100 /* If we are back to the starting point, the walk is complete. */
102 * If we are back to the starting point, the walk is complete. 101
103 */
104 if (op == subtree_root) { 102 if (op == subtree_root) {
105 return_VOID; 103 return_VOID;
106 } 104 }
@@ -111,5 +109,6 @@ acpi_ps_delete_parse_tree (
111 op = parent; 109 op = parent;
112 } 110 }
113 } 111 }
112
114 return_VOID; 113 return_VOID;
115} 114}
diff --git a/drivers/acpi/parser/psxface.c b/drivers/acpi/parser/psxface.c
index b318ad24726d..dba893648e84 100644
--- a/drivers/acpi/parser/psxface.c
+++ b/drivers/acpi/parser/psxface.c
@@ -57,13 +57,16 @@
57 * 57 *
58 * FUNCTION: acpi_psx_execute 58 * FUNCTION: acpi_psx_execute
59 * 59 *
60 * PARAMETERS: Info->Node - A method object containing both the AML 60 * PARAMETERS: Info - Method info block, contains:
61 * address and length. 61 * Node - Method Node to execute
62 * **Params - List of parameters to pass to method, 62 * Parameters - List of parameters to pass to the method,
63 * terminated by NULL. Params itself may be 63 * terminated by NULL. Params itself may be
64 * NULL if no parameters are being passed. 64 * NULL if no parameters are being passed.
65 * **return_obj_desc - Return object from execution of the 65 * return_object - Where to put method's return value (if
66 * method. 66 * any). If NULL, no value is returned.
67 * parameter_type - Type of Parameter list
68 * return_object - Where to put method's return value (if
69 * any). If NULL, no value is returned.
67 * 70 *
68 * RETURN: Status 71 * RETURN: Status
69 * 72 *
@@ -196,9 +199,8 @@ acpi_psx_execute (
196 goto cleanup3; 199 goto cleanup3;
197 } 200 }
198 201
199 /* 202 /* The walk of the parse tree is where we actually execute the method */
200 * The walk of the parse tree is where we actually execute the method 203
201 */
202 status = acpi_ps_parse_aml (walk_state); 204 status = acpi_ps_parse_aml (walk_state);
203 goto cleanup2; /* Walk state already deleted */ 205 goto cleanup2; /* Walk state already deleted */
204 206
@@ -217,7 +219,8 @@ cleanup1:
217 for (i = 0; info->parameters[i]; i++) { 219 for (i = 0; info->parameters[i]; i++) {
218 /* Ignore errors, just do them all */ 220 /* Ignore errors, just do them all */
219 221
220 (void) acpi_ut_update_object_reference (info->parameters[i], REF_DECREMENT); 222 (void) acpi_ut_update_object_reference (
223 info->parameters[i], REF_DECREMENT);
221 } 224 }
222 } 225 }
223 226