diff options
author | Robert Moore <robert.moore@intel.com> | 2005-04-18 22:49:35 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2005-07-12 00:08:52 -0400 |
commit | 44f6c01242da4e162f28d8e1216a8c7a91174605 (patch) | |
tree | 53f724764f1bd9036dfb049a643d198125cc9edc /drivers/acpi/dispatcher | |
parent | ebb6e1a6122fd6b7c96470cfd4ce0f04150e5084 (diff) |
ACPICA 20050408 from Bob Moore
Fixed three cases in the interpreter where an "index"
argument to an ASL function was still (internally) 32
bits instead of the required 64 bits. This was the Index
argument to the Index, Mid, and Match operators.
The "strupr" function is now permanently local
(acpi_ut_strupr), since this is not a POSIX-defined
function and not present in most kernel-level C
libraries. References to the C library strupr function
have been removed from the headers.
Completed the deployment of static
functions/prototypes. All prototypes with the static
attribute have been moved from the headers to the owning
C file.
ACPICA 20050329 from Bob Moore
An error is now generated if an attempt is made to create
a Buffer Field of length zero (A CreateField with a length
operand of zero.)
The interpreter now issues a warning whenever executable
code at the module level is detected during ACPI table
load. This will give some idea of the prevalence of this
type of code.
Implemented support for references to named objects (other
than control methods) within package objects.
Enhanced package object output for the debug
object. Package objects are now completely dumped, showing
all elements.
Enhanced miscellaneous object output for the debug
object. Any object can now be written to the debug object
(for example, a device object can be written, and the type
of the object will be displayed.)
The "static" qualifier has been added to all local
functions across the core subsystem.
The number of "long" lines (> 80 chars) within the source
has been significantly reduced, by about 1/3.
Cleaned up all header files to ensure that all CA/iASL
functions are prototyped (even static functions) and the
formatting is consistent.
Two new header files have been added, acopcode.h and
acnames.h.
Removed several obsolete functions that were no longer
used.
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/dispatcher')
-rw-r--r-- | drivers/acpi/dispatcher/dsfield.c | 58 | ||||
-rw-r--r-- | drivers/acpi/dispatcher/dsinit.c | 28 | ||||
-rw-r--r-- | drivers/acpi/dispatcher/dsmethod.c | 11 | ||||
-rw-r--r-- | drivers/acpi/dispatcher/dsmthdat.c | 195 | ||||
-rw-r--r-- | drivers/acpi/dispatcher/dsobject.c | 79 | ||||
-rw-r--r-- | drivers/acpi/dispatcher/dsopcode.c | 105 | ||||
-rw-r--r-- | drivers/acpi/dispatcher/dsutils.c | 41 | ||||
-rw-r--r-- | drivers/acpi/dispatcher/dswexec.c | 57 | ||||
-rw-r--r-- | drivers/acpi/dispatcher/dswload.c | 118 | ||||
-rw-r--r-- | drivers/acpi/dispatcher/dswscope.c | 31 | ||||
-rw-r--r-- | drivers/acpi/dispatcher/dswstate.c | 458 |
11 files changed, 684 insertions, 497 deletions
diff --git a/drivers/acpi/dispatcher/dsfield.c b/drivers/acpi/dispatcher/dsfield.c index 2779211be756..84193983d6ba 100644 --- a/drivers/acpi/dispatcher/dsfield.c +++ b/drivers/acpi/dispatcher/dsfield.c | |||
@@ -53,13 +53,20 @@ | |||
53 | #define _COMPONENT ACPI_DISPATCHER | 53 | #define _COMPONENT ACPI_DISPATCHER |
54 | ACPI_MODULE_NAME ("dsfield") | 54 | ACPI_MODULE_NAME ("dsfield") |
55 | 55 | ||
56 | /* Local prototypes */ | ||
57 | |||
58 | static acpi_status | ||
59 | acpi_ds_get_field_names ( | ||
60 | struct acpi_create_field_info *info, | ||
61 | struct acpi_walk_state *walk_state, | ||
62 | union acpi_parse_object *arg); | ||
63 | |||
56 | 64 | ||
57 | /******************************************************************************* | 65 | /******************************************************************************* |
58 | * | 66 | * |
59 | * FUNCTION: acpi_ds_create_buffer_field | 67 | * FUNCTION: acpi_ds_create_buffer_field |
60 | * | 68 | * |
61 | * PARAMETERS: Opcode - The opcode to be executed | 69 | * PARAMETERS: Op - Current parse op (create_xXField) |
62 | * Operands - List of operands for the opcode | ||
63 | * walk_state - Current state | 70 | * walk_state - Current state |
64 | * | 71 | * |
65 | * RETURN: Status | 72 | * RETURN: Status |
@@ -70,7 +77,7 @@ | |||
70 | * create_word_field_op, | 77 | * create_word_field_op, |
71 | * create_dword_field_op, | 78 | * create_dword_field_op, |
72 | * create_qword_field_op, | 79 | * create_qword_field_op, |
73 | * create_field_op (all of which define fields in buffers) | 80 | * create_field_op (all of which define a field in a buffer) |
74 | * | 81 | * |
75 | ******************************************************************************/ | 82 | ******************************************************************************/ |
76 | 83 | ||
@@ -119,7 +126,8 @@ acpi_ds_create_buffer_field ( | |||
119 | flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE; | 126 | flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE; |
120 | } | 127 | } |
121 | else { | 128 | else { |
122 | flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | ACPI_NS_ERROR_IF_FOUND; | 129 | flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | |
130 | ACPI_NS_ERROR_IF_FOUND; | ||
123 | } | 131 | } |
124 | 132 | ||
125 | /* | 133 | /* |
@@ -134,16 +142,16 @@ acpi_ds_create_buffer_field ( | |||
134 | } | 142 | } |
135 | } | 143 | } |
136 | 144 | ||
137 | /* We could put the returned object (Node) on the object stack for later, but | 145 | /* We could put the returned object (Node) on the object stack for later, |
138 | * for now, we will put it in the "op" object that the parser uses, so we | 146 | * but for now, we will put it in the "op" object that the parser uses, |
139 | * can get it again at the end of this scope | 147 | * so we can get it again at the end of this scope |
140 | */ | 148 | */ |
141 | op->common.node = node; | 149 | op->common.node = node; |
142 | 150 | ||
143 | /* | 151 | /* |
144 | * If there is no object attached to the node, this node was just created and | 152 | * If there is no object attached to the node, this node was just created |
145 | * we need to create the field object. Otherwise, this was a lookup of an | 153 | * and we need to create the field object. Otherwise, this was a lookup |
146 | * existing node and we don't want to create the field object again. | 154 | * of an existing node and we don't want to create the field object again. |
147 | */ | 155 | */ |
148 | obj_desc = acpi_ns_get_attached_object (node); | 156 | obj_desc = acpi_ns_get_attached_object (node); |
149 | if (obj_desc) { | 157 | if (obj_desc) { |
@@ -205,7 +213,7 @@ cleanup: | |||
205 | * | 213 | * |
206 | ******************************************************************************/ | 214 | ******************************************************************************/ |
207 | 215 | ||
208 | acpi_status | 216 | static acpi_status |
209 | acpi_ds_get_field_names ( | 217 | acpi_ds_get_field_names ( |
210 | struct acpi_create_field_info *info, | 218 | struct acpi_create_field_info *info, |
211 | struct acpi_walk_state *walk_state, | 219 | struct acpi_walk_state *walk_state, |
@@ -238,7 +246,8 @@ acpi_ds_get_field_names ( | |||
238 | + (acpi_integer) arg->common.value.size; | 246 | + (acpi_integer) arg->common.value.size; |
239 | 247 | ||
240 | if (position > ACPI_UINT32_MAX) { | 248 | if (position > ACPI_UINT32_MAX) { |
241 | ACPI_REPORT_ERROR (("Bit offset within field too large (> 0xFFFFFFFF)\n")); | 249 | ACPI_REPORT_ERROR (( |
250 | "Bit offset within field too large (> 0xFFFFFFFF)\n")); | ||
242 | return_ACPI_STATUS (AE_SUPPORT); | 251 | return_ACPI_STATUS (AE_SUPPORT); |
243 | } | 252 | } |
244 | 253 | ||
@@ -250,12 +259,15 @@ acpi_ds_get_field_names ( | |||
250 | 259 | ||
251 | /* | 260 | /* |
252 | * Get a new access_type and access_attribute -- to be used for all | 261 | * Get a new access_type and access_attribute -- to be used for all |
253 | * field units that follow, until field end or another access_as keyword. | 262 | * field units that follow, until field end or another access_as |
263 | * keyword. | ||
254 | * | 264 | * |
255 | * In field_flags, preserve the flag bits other than the ACCESS_TYPE bits | 265 | * In field_flags, preserve the flag bits other than the |
266 | * ACCESS_TYPE bits | ||
256 | */ | 267 | */ |
257 | info->field_flags = (u8) ((info->field_flags & ~(AML_FIELD_ACCESS_TYPE_MASK)) | | 268 | info->field_flags = (u8) |
258 | ((u8) ((u32) arg->common.value.integer >> 8))); | 269 | ((info->field_flags & ~(AML_FIELD_ACCESS_TYPE_MASK)) | |
270 | ((u8) ((u32) arg->common.value.integer >> 8))); | ||
259 | 271 | ||
260 | info->attribute = (u8) (arg->common.value.integer); | 272 | info->attribute = (u8) (arg->common.value.integer); |
261 | break; | 273 | break; |
@@ -267,7 +279,8 @@ acpi_ds_get_field_names ( | |||
267 | 279 | ||
268 | status = acpi_ns_lookup (walk_state->scope_info, | 280 | status = acpi_ns_lookup (walk_state->scope_info, |
269 | (char *) &arg->named.name, | 281 | (char *) &arg->named.name, |
270 | info->field_type, ACPI_IMODE_EXECUTE, ACPI_NS_DONT_OPEN_SCOPE, | 282 | info->field_type, ACPI_IMODE_EXECUTE, |
283 | ACPI_NS_DONT_OPEN_SCOPE, | ||
271 | walk_state, &info->field_node); | 284 | walk_state, &info->field_node); |
272 | if (ACPI_FAILURE (status)) { | 285 | if (ACPI_FAILURE (status)) { |
273 | ACPI_REPORT_NSERROR ((char *) &arg->named.name, status); | 286 | ACPI_REPORT_NSERROR ((char *) &arg->named.name, status); |
@@ -295,8 +308,9 @@ acpi_ds_get_field_names ( | |||
295 | + (acpi_integer) arg->common.value.size; | 308 | + (acpi_integer) arg->common.value.size; |
296 | 309 | ||
297 | if (position > ACPI_UINT32_MAX) { | 310 | if (position > ACPI_UINT32_MAX) { |
298 | ACPI_REPORT_ERROR (("Field [%4.4s] bit offset too large (> 0xFFFFFFFF)\n", | 311 | ACPI_REPORT_ERROR (( |
299 | (char *) &info->field_node->name)); | 312 | "Field [%4.4s] bit offset too large (> 0xFFFFFFFF)\n", |
313 | (char *) &info->field_node->name)); | ||
300 | return_ACPI_STATUS (AE_SUPPORT); | 314 | return_ACPI_STATUS (AE_SUPPORT); |
301 | } | 315 | } |
302 | 316 | ||
@@ -306,7 +320,8 @@ acpi_ds_get_field_names ( | |||
306 | 320 | ||
307 | default: | 321 | default: |
308 | 322 | ||
309 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid opcode in field list: %X\n", | 323 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
324 | "Invalid opcode in field list: %X\n", | ||
310 | arg->common.aml_opcode)); | 325 | arg->common.aml_opcode)); |
311 | return_ACPI_STATUS (AE_AML_BAD_OPCODE); | 326 | return_ACPI_STATUS (AE_AML_BAD_OPCODE); |
312 | } | 327 | } |
@@ -435,7 +450,8 @@ acpi_ds_init_field_objects ( | |||
435 | status = acpi_ns_lookup (walk_state->scope_info, | 450 | status = acpi_ns_lookup (walk_state->scope_info, |
436 | (char *) &arg->named.name, | 451 | (char *) &arg->named.name, |
437 | type, ACPI_IMODE_LOAD_PASS1, | 452 | type, ACPI_IMODE_LOAD_PASS1, |
438 | ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | ACPI_NS_ERROR_IF_FOUND, | 453 | ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | |
454 | ACPI_NS_ERROR_IF_FOUND, | ||
439 | walk_state, &node); | 455 | walk_state, &node); |
440 | if (ACPI_FAILURE (status)) { | 456 | if (ACPI_FAILURE (status)) { |
441 | ACPI_REPORT_NSERROR ((char *) &arg->named.name, status); | 457 | ACPI_REPORT_NSERROR ((char *) &arg->named.name, status); |
diff --git a/drivers/acpi/dispatcher/dsinit.c b/drivers/acpi/dispatcher/dsinit.c index b4d264dbbf67..d7790db50178 100644 --- a/drivers/acpi/dispatcher/dsinit.c +++ b/drivers/acpi/dispatcher/dsinit.c | |||
@@ -49,12 +49,21 @@ | |||
49 | #define _COMPONENT ACPI_DISPATCHER | 49 | #define _COMPONENT ACPI_DISPATCHER |
50 | ACPI_MODULE_NAME ("dsinit") | 50 | ACPI_MODULE_NAME ("dsinit") |
51 | 51 | ||
52 | /* Local prototypes */ | ||
53 | |||
54 | static acpi_status | ||
55 | acpi_ds_init_one_object ( | ||
56 | acpi_handle obj_handle, | ||
57 | u32 level, | ||
58 | void *context, | ||
59 | void **return_value); | ||
60 | |||
52 | 61 | ||
53 | /******************************************************************************* | 62 | /******************************************************************************* |
54 | * | 63 | * |
55 | * FUNCTION: acpi_ds_init_one_object | 64 | * FUNCTION: acpi_ds_init_one_object |
56 | * | 65 | * |
57 | * PARAMETERS: obj_handle - Node | 66 | * PARAMETERS: obj_handle - Node for the object |
58 | * Level - Current nesting level | 67 | * Level - Current nesting level |
59 | * Context - Points to a init info struct | 68 | * Context - Points to a init info struct |
60 | * return_value - Not used | 69 | * return_value - Not used |
@@ -70,7 +79,7 @@ | |||
70 | * | 79 | * |
71 | ******************************************************************************/ | 80 | ******************************************************************************/ |
72 | 81 | ||
73 | acpi_status | 82 | static acpi_status |
74 | acpi_ds_init_one_object ( | 83 | acpi_ds_init_one_object ( |
75 | acpi_handle obj_handle, | 84 | acpi_handle obj_handle, |
76 | u32 level, | 85 | u32 level, |
@@ -105,7 +114,8 @@ acpi_ds_init_one_object ( | |||
105 | 114 | ||
106 | status = acpi_ds_initialize_region (obj_handle); | 115 | status = acpi_ds_initialize_region (obj_handle); |
107 | if (ACPI_FAILURE (status)) { | 116 | if (ACPI_FAILURE (status)) { |
108 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Region %p [%4.4s] - Init failure, %s\n", | 117 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
118 | "Region %p [%4.4s] - Init failure, %s\n", | ||
109 | obj_handle, acpi_ut_get_node_name (obj_handle), | 119 | obj_handle, acpi_ut_get_node_name (obj_handle), |
110 | acpi_format_exception (status))); | 120 | acpi_format_exception (status))); |
111 | } | 121 | } |
@@ -118,8 +128,10 @@ acpi_ds_init_one_object ( | |||
118 | 128 | ||
119 | info->method_count++; | 129 | info->method_count++; |
120 | 130 | ||
121 | /* Print a dot for each method unless we are going to print the entire pathname */ | 131 | /* |
122 | 132 | * Print a dot for each method unless we are going to print | |
133 | * the entire pathname | ||
134 | */ | ||
123 | if (!(acpi_dbg_level & ACPI_LV_INIT_NAMES)) { | 135 | if (!(acpi_dbg_level & ACPI_LV_INIT_NAMES)) { |
124 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, ".")); | 136 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, ".")); |
125 | } | 137 | } |
@@ -140,7 +152,8 @@ acpi_ds_init_one_object ( | |||
140 | */ | 152 | */ |
141 | status = acpi_ds_parse_method (obj_handle); | 153 | status = acpi_ds_parse_method (obj_handle); |
142 | if (ACPI_FAILURE (status)) { | 154 | if (ACPI_FAILURE (status)) { |
143 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Method %p [%4.4s] - parse failure, %s\n", | 155 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
156 | "Method %p [%4.4s] - parse failure, %s\n", | ||
144 | obj_handle, acpi_ut_get_node_name (obj_handle), | 157 | obj_handle, acpi_ut_get_node_name (obj_handle), |
145 | acpi_format_exception (status))); | 158 | acpi_format_exception (status))); |
146 | 159 | ||
@@ -154,7 +167,8 @@ acpi_ds_init_one_object ( | |||
154 | * for every execution since there isn't much overhead | 167 | * for every execution since there isn't much overhead |
155 | */ | 168 | */ |
156 | acpi_ns_delete_namespace_subtree (obj_handle); | 169 | acpi_ns_delete_namespace_subtree (obj_handle); |
157 | acpi_ns_delete_namespace_by_owner (((struct acpi_namespace_node *) obj_handle)->object->method.owning_id); | 170 | acpi_ns_delete_namespace_by_owner ( |
171 | ((struct acpi_namespace_node *) obj_handle)->object->method.owning_id); | ||
158 | break; | 172 | break; |
159 | 173 | ||
160 | 174 | ||
diff --git a/drivers/acpi/dispatcher/dsmethod.c b/drivers/acpi/dispatcher/dsmethod.c index 9f0456cb9bb5..9fc3f4c033eb 100644 --- a/drivers/acpi/dispatcher/dsmethod.c +++ b/drivers/acpi/dispatcher/dsmethod.c | |||
@@ -153,12 +153,11 @@ acpi_ds_parse_method ( | |||
153 | /* | 153 | /* |
154 | * Parse the method, first pass | 154 | * Parse the method, first pass |
155 | * | 155 | * |
156 | * The first pass load is where newly declared named objects are | 156 | * The first pass load is where newly declared named objects are added into |
157 | * added into the namespace. Actual evaluation of | 157 | * the namespace. Actual evaluation of the named objects (what would be |
158 | * the named objects (what would be called a "second | 158 | * called a "second pass") happens during the actual execution of the |
159 | * pass") happens during the actual execution of the | 159 | * method so that operands to the named objects can take on dynamic |
160 | * method so that operands to the named objects can | 160 | * run-time values. |
161 | * take on dynamic run-time values. | ||
162 | */ | 161 | */ |
163 | status = acpi_ps_parse_aml (walk_state); | 162 | status = acpi_ps_parse_aml (walk_state); |
164 | if (ACPI_FAILURE (status)) { | 163 | if (ACPI_FAILURE (status)) { |
diff --git a/drivers/acpi/dispatcher/dsmthdat.c b/drivers/acpi/dispatcher/dsmthdat.c index f31d095f9833..f7998306f756 100644 --- a/drivers/acpi/dispatcher/dsmthdat.c +++ b/drivers/acpi/dispatcher/dsmthdat.c | |||
@@ -52,6 +52,29 @@ | |||
52 | #define _COMPONENT ACPI_DISPATCHER | 52 | #define _COMPONENT ACPI_DISPATCHER |
53 | ACPI_MODULE_NAME ("dsmthdat") | 53 | ACPI_MODULE_NAME ("dsmthdat") |
54 | 54 | ||
55 | /* Local prototypes */ | ||
56 | |||
57 | static void | ||
58 | acpi_ds_method_data_delete_value ( | ||
59 | u16 opcode, | ||
60 | u32 index, | ||
61 | struct acpi_walk_state *walk_state); | ||
62 | |||
63 | static acpi_status | ||
64 | acpi_ds_method_data_set_value ( | ||
65 | u16 opcode, | ||
66 | u32 index, | ||
67 | union acpi_operand_object *object, | ||
68 | struct acpi_walk_state *walk_state); | ||
69 | |||
70 | #ifdef ACPI_OBSOLETE_FUNCTIONS | ||
71 | acpi_object_type | ||
72 | acpi_ds_method_data_get_type ( | ||
73 | u16 opcode, | ||
74 | u32 index, | ||
75 | struct acpi_walk_state *walk_state); | ||
76 | #endif | ||
77 | |||
55 | 78 | ||
56 | /******************************************************************************* | 79 | /******************************************************************************* |
57 | * | 80 | * |
@@ -62,8 +85,8 @@ | |||
62 | * RETURN: Status | 85 | * RETURN: Status |
63 | * | 86 | * |
64 | * DESCRIPTION: Initialize the data structures that hold the method's arguments | 87 | * DESCRIPTION: Initialize the data structures that hold the method's arguments |
65 | * and locals. The data struct is an array of NTEs for each. | 88 | * and locals. The data struct is an array of namespace nodes for |
66 | * This allows ref_of and de_ref_of to work properly for these | 89 | * each - this allows ref_of and de_ref_of to work properly for these |
67 | * special data types. | 90 | * special data types. |
68 | * | 91 | * |
69 | * NOTES: walk_state fields are initialized to zero by the | 92 | * NOTES: walk_state fields are initialized to zero by the |
@@ -92,7 +115,8 @@ acpi_ds_method_data_init ( | |||
92 | walk_state->arguments[i].name.integer |= (i << 24); | 115 | walk_state->arguments[i].name.integer |= (i << 24); |
93 | walk_state->arguments[i].descriptor = ACPI_DESC_TYPE_NAMED; | 116 | walk_state->arguments[i].descriptor = ACPI_DESC_TYPE_NAMED; |
94 | walk_state->arguments[i].type = ACPI_TYPE_ANY; | 117 | walk_state->arguments[i].type = ACPI_TYPE_ANY; |
95 | walk_state->arguments[i].flags = ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_ARG; | 118 | walk_state->arguments[i].flags = ANOBJ_END_OF_PEER_LIST | |
119 | ANOBJ_METHOD_ARG; | ||
96 | } | 120 | } |
97 | 121 | ||
98 | /* Init the method locals */ | 122 | /* Init the method locals */ |
@@ -104,7 +128,8 @@ acpi_ds_method_data_init ( | |||
104 | walk_state->local_variables[i].name.integer |= (i << 24); | 128 | walk_state->local_variables[i].name.integer |= (i << 24); |
105 | walk_state->local_variables[i].descriptor = ACPI_DESC_TYPE_NAMED; | 129 | walk_state->local_variables[i].descriptor = ACPI_DESC_TYPE_NAMED; |
106 | walk_state->local_variables[i].type = ACPI_TYPE_ANY; | 130 | walk_state->local_variables[i].type = ACPI_TYPE_ANY; |
107 | walk_state->local_variables[i].flags = ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_LOCAL; | 131 | walk_state->local_variables[i].flags = ANOBJ_END_OF_PEER_LIST | |
132 | ANOBJ_METHOD_LOCAL; | ||
108 | } | 133 | } |
109 | 134 | ||
110 | return_VOID; | 135 | return_VOID; |
@@ -198,15 +223,18 @@ acpi_ds_method_data_init_args ( | |||
198 | return_ACPI_STATUS (AE_OK); | 223 | return_ACPI_STATUS (AE_OK); |
199 | } | 224 | } |
200 | 225 | ||
201 | /* Copy passed parameters into the new method stack frame */ | 226 | /* Copy passed parameters into the new method stack frame */ |
202 | 227 | ||
203 | while ((index < ACPI_METHOD_NUM_ARGS) && (index < max_param_count) && params[index]) { | 228 | while ((index < ACPI_METHOD_NUM_ARGS) && |
229 | (index < max_param_count) && | ||
230 | params[index]) { | ||
204 | /* | 231 | /* |
205 | * A valid parameter. | 232 | * A valid parameter. |
206 | * Store the argument in the method/walk descriptor. | 233 | * Store the argument in the method/walk descriptor. |
207 | * Do not copy the arg in order to implement call by reference | 234 | * Do not copy the arg in order to implement call by reference |
208 | */ | 235 | */ |
209 | status = acpi_ds_method_data_set_value (AML_ARG_OP, index, params[index], walk_state); | 236 | status = acpi_ds_method_data_set_value (AML_ARG_OP, index, |
237 | params[index], walk_state); | ||
210 | if (ACPI_FAILURE (status)) { | 238 | if (ACPI_FAILURE (status)) { |
211 | return_ACPI_STATUS (status); | 239 | return_ACPI_STATUS (status); |
212 | } | 240 | } |
@@ -224,11 +252,13 @@ acpi_ds_method_data_init_args ( | |||
224 | * FUNCTION: acpi_ds_method_data_get_node | 252 | * FUNCTION: acpi_ds_method_data_get_node |
225 | * | 253 | * |
226 | * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP | 254 | * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP |
227 | * Index - which local_var or argument whose type | 255 | * Index - Which Local or Arg whose type to get |
228 | * to get | ||
229 | * walk_state - Current walk state object | 256 | * walk_state - Current walk state object |
257 | * Node - Where the node is returned. | ||
230 | * | 258 | * |
231 | * RETURN: Get the Node associated with a local or arg. | 259 | * RETURN: Status and node |
260 | * | ||
261 | * DESCRIPTION: Get the Node associated with a local or arg. | ||
232 | * | 262 | * |
233 | ******************************************************************************/ | 263 | ******************************************************************************/ |
234 | 264 | ||
@@ -249,7 +279,8 @@ acpi_ds_method_data_get_node ( | |||
249 | case AML_LOCAL_OP: | 279 | case AML_LOCAL_OP: |
250 | 280 | ||
251 | if (index > ACPI_METHOD_MAX_LOCAL) { | 281 | if (index > ACPI_METHOD_MAX_LOCAL) { |
252 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Local index %d is invalid (max %d)\n", | 282 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
283 | "Local index %d is invalid (max %d)\n", | ||
253 | index, ACPI_METHOD_MAX_LOCAL)); | 284 | index, ACPI_METHOD_MAX_LOCAL)); |
254 | return_ACPI_STATUS (AE_AML_INVALID_INDEX); | 285 | return_ACPI_STATUS (AE_AML_INVALID_INDEX); |
255 | } | 286 | } |
@@ -262,7 +293,8 @@ acpi_ds_method_data_get_node ( | |||
262 | case AML_ARG_OP: | 293 | case AML_ARG_OP: |
263 | 294 | ||
264 | if (index > ACPI_METHOD_MAX_ARG) { | 295 | if (index > ACPI_METHOD_MAX_ARG) { |
265 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Arg index %d is invalid (max %d)\n", | 296 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
297 | "Arg index %d is invalid (max %d)\n", | ||
266 | index, ACPI_METHOD_MAX_ARG)); | 298 | index, ACPI_METHOD_MAX_ARG)); |
267 | return_ACPI_STATUS (AE_AML_INVALID_INDEX); | 299 | return_ACPI_STATUS (AE_AML_INVALID_INDEX); |
268 | } | 300 | } |
@@ -286,7 +318,7 @@ acpi_ds_method_data_get_node ( | |||
286 | * FUNCTION: acpi_ds_method_data_set_value | 318 | * FUNCTION: acpi_ds_method_data_set_value |
287 | * | 319 | * |
288 | * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP | 320 | * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP |
289 | * Index - which local_var or argument to get | 321 | * Index - Which Local or Arg to get |
290 | * Object - Object to be inserted into the stack entry | 322 | * Object - Object to be inserted into the stack entry |
291 | * walk_state - Current walk state object | 323 | * walk_state - Current walk state object |
292 | * | 324 | * |
@@ -297,7 +329,7 @@ acpi_ds_method_data_get_node ( | |||
297 | * | 329 | * |
298 | ******************************************************************************/ | 330 | ******************************************************************************/ |
299 | 331 | ||
300 | acpi_status | 332 | static acpi_status |
301 | acpi_ds_method_data_set_value ( | 333 | acpi_ds_method_data_set_value ( |
302 | u16 opcode, | 334 | u16 opcode, |
303 | u32 index, | 335 | u32 index, |
@@ -340,68 +372,16 @@ acpi_ds_method_data_set_value ( | |||
340 | 372 | ||
341 | /******************************************************************************* | 373 | /******************************************************************************* |
342 | * | 374 | * |
343 | * FUNCTION: acpi_ds_method_data_get_type | ||
344 | * | ||
345 | * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP | ||
346 | * Index - which local_var or argument whose type | ||
347 | * to get | ||
348 | * walk_state - Current walk state object | ||
349 | * | ||
350 | * RETURN: Data type of current value of the selected Arg or Local | ||
351 | * | ||
352 | ******************************************************************************/ | ||
353 | #ifdef ACPI_FUTURE_USAGE | ||
354 | acpi_object_type | ||
355 | acpi_ds_method_data_get_type ( | ||
356 | u16 opcode, | ||
357 | u32 index, | ||
358 | struct acpi_walk_state *walk_state) | ||
359 | { | ||
360 | acpi_status status; | ||
361 | struct acpi_namespace_node *node; | ||
362 | union acpi_operand_object *object; | ||
363 | |||
364 | |||
365 | ACPI_FUNCTION_TRACE ("ds_method_data_get_type"); | ||
366 | |||
367 | |||
368 | /* Get the namespace node for the arg/local */ | ||
369 | |||
370 | status = acpi_ds_method_data_get_node (opcode, index, walk_state, &node); | ||
371 | if (ACPI_FAILURE (status)) { | ||
372 | return_VALUE ((ACPI_TYPE_NOT_FOUND)); | ||
373 | } | ||
374 | |||
375 | /* Get the object */ | ||
376 | |||
377 | object = acpi_ns_get_attached_object (node); | ||
378 | if (!object) { | ||
379 | /* Uninitialized local/arg, return TYPE_ANY */ | ||
380 | |||
381 | return_VALUE (ACPI_TYPE_ANY); | ||
382 | } | ||
383 | |||
384 | /* Get the object type */ | ||
385 | |||
386 | return_VALUE (ACPI_GET_OBJECT_TYPE (object)); | ||
387 | } | ||
388 | #endif /* ACPI_FUTURE_USAGE */ | ||
389 | |||
390 | |||
391 | /******************************************************************************* | ||
392 | * | ||
393 | * FUNCTION: acpi_ds_method_data_get_value | 375 | * FUNCTION: acpi_ds_method_data_get_value |
394 | * | 376 | * |
395 | * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP | 377 | * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP |
396 | * Index - which local_var or argument to get | 378 | * Index - which local_var or argument to get |
397 | * walk_state - Current walk state object | 379 | * walk_state - Current walk state object |
398 | * *dest_desc - Ptr to Descriptor into which selected Arg | 380 | * dest_desc - Where Arg or Local value is returned |
399 | * or Local value should be copied | ||
400 | * | 381 | * |
401 | * RETURN: Status | 382 | * RETURN: Status |
402 | * | 383 | * |
403 | * DESCRIPTION: Retrieve value of selected Arg or Local from the method frame | 384 | * DESCRIPTION: Retrieve value of selected Arg or Local for this method |
404 | * at the current top of the method stack. | ||
405 | * Used only in acpi_ex_resolve_to_value(). | 385 | * Used only in acpi_ex_resolve_to_value(). |
406 | * | 386 | * |
407 | ******************************************************************************/ | 387 | ******************************************************************************/ |
@@ -467,14 +447,16 @@ acpi_ds_method_data_get_value ( | |||
467 | else switch (opcode) { | 447 | else switch (opcode) { |
468 | case AML_ARG_OP: | 448 | case AML_ARG_OP: |
469 | 449 | ||
470 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Uninitialized Arg[%d] at node %p\n", | 450 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
451 | "Uninitialized Arg[%d] at node %p\n", | ||
471 | index, node)); | 452 | index, node)); |
472 | 453 | ||
473 | return_ACPI_STATUS (AE_AML_UNINITIALIZED_ARG); | 454 | return_ACPI_STATUS (AE_AML_UNINITIALIZED_ARG); |
474 | 455 | ||
475 | case AML_LOCAL_OP: | 456 | case AML_LOCAL_OP: |
476 | 457 | ||
477 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Uninitialized Local[%d] at node %p\n", | 458 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
459 | "Uninitialized Local[%d] at node %p\n", | ||
478 | index, node)); | 460 | index, node)); |
479 | 461 | ||
480 | return_ACPI_STATUS (AE_AML_UNINITIALIZED_LOCAL); | 462 | return_ACPI_STATUS (AE_AML_UNINITIALIZED_LOCAL); |
@@ -506,12 +488,12 @@ acpi_ds_method_data_get_value ( | |||
506 | * | 488 | * |
507 | * RETURN: None | 489 | * RETURN: None |
508 | * | 490 | * |
509 | * DESCRIPTION: Delete the entry at Opcode:Index on the method stack. Inserts | 491 | * DESCRIPTION: Delete the entry at Opcode:Index. Inserts |
510 | * a null into the stack slot after the object is deleted. | 492 | * a null into the stack slot after the object is deleted. |
511 | * | 493 | * |
512 | ******************************************************************************/ | 494 | ******************************************************************************/ |
513 | 495 | ||
514 | void | 496 | static void |
515 | acpi_ds_method_data_delete_value ( | 497 | acpi_ds_method_data_delete_value ( |
516 | u16 opcode, | 498 | u16 opcode, |
517 | u32 index, | 499 | u32 index, |
@@ -562,7 +544,7 @@ acpi_ds_method_data_delete_value ( | |||
562 | * FUNCTION: acpi_ds_store_object_to_local | 544 | * FUNCTION: acpi_ds_store_object_to_local |
563 | * | 545 | * |
564 | * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP | 546 | * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP |
565 | * Index - which local_var or argument to set | 547 | * Index - Which Local or Arg to set |
566 | * obj_desc - Value to be stored | 548 | * obj_desc - Value to be stored |
567 | * walk_state - Current walk state | 549 | * walk_state - Current walk state |
568 | * | 550 | * |
@@ -651,19 +633,20 @@ acpi_ds_store_object_to_local ( | |||
651 | */ | 633 | */ |
652 | if (opcode == AML_ARG_OP) { | 634 | if (opcode == AML_ARG_OP) { |
653 | /* | 635 | /* |
654 | * Make sure that the object is the correct type. This may be overkill, but | 636 | * Make sure that the object is the correct type. This may be |
655 | * it is here because references were NS nodes in the past. Now they are | 637 | * overkill, butit is here because references were NS nodes in |
656 | * operand objects of type Reference. | 638 | * the past. Now they are operand objects of type Reference. |
657 | */ | 639 | */ |
658 | if (ACPI_GET_DESCRIPTOR_TYPE (current_obj_desc) != ACPI_DESC_TYPE_OPERAND) { | 640 | if (ACPI_GET_DESCRIPTOR_TYPE (current_obj_desc) != ACPI_DESC_TYPE_OPERAND) { |
659 | ACPI_REPORT_ERROR (("Invalid descriptor type while storing to method arg: [%s]\n", | 641 | ACPI_REPORT_ERROR (( |
660 | acpi_ut_get_descriptor_name (current_obj_desc))); | 642 | "Invalid descriptor type while storing to method arg: [%s]\n", |
643 | acpi_ut_get_descriptor_name (current_obj_desc))); | ||
661 | return_ACPI_STATUS (AE_AML_INTERNAL); | 644 | return_ACPI_STATUS (AE_AML_INTERNAL); |
662 | } | 645 | } |
663 | 646 | ||
664 | /* | 647 | /* |
665 | * If we have a valid reference object that came from ref_of(), do the | 648 | * If we have a valid reference object that came from ref_of(), |
666 | * indirect store | 649 | * do the indirect store |
667 | */ | 650 | */ |
668 | if ((current_obj_desc->common.type == ACPI_TYPE_LOCAL_REFERENCE) && | 651 | if ((current_obj_desc->common.type == ACPI_TYPE_LOCAL_REFERENCE) && |
669 | (current_obj_desc->reference.opcode == AML_REF_OF_OP)) { | 652 | (current_obj_desc->reference.opcode == AML_REF_OF_OP)) { |
@@ -713,3 +696,55 @@ acpi_ds_store_object_to_local ( | |||
713 | } | 696 | } |
714 | 697 | ||
715 | 698 | ||
699 | #ifdef ACPI_OBSOLETE_FUNCTIONS | ||
700 | /******************************************************************************* | ||
701 | * | ||
702 | * FUNCTION: acpi_ds_method_data_get_type | ||
703 | * | ||
704 | * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP | ||
705 | * Index - Which Local or Arg whose type to get | ||
706 | * walk_state - Current walk state object | ||
707 | * | ||
708 | * RETURN: Data type of current value of the selected Arg or Local | ||
709 | * | ||
710 | * DESCRIPTION: Get the type of the object stored in the Local or Arg | ||
711 | * | ||
712 | ******************************************************************************/ | ||
713 | |||
714 | acpi_object_type | ||
715 | acpi_ds_method_data_get_type ( | ||
716 | u16 opcode, | ||
717 | u32 index, | ||
718 | struct acpi_walk_state *walk_state) | ||
719 | { | ||
720 | acpi_status status; | ||
721 | struct acpi_namespace_node *node; | ||
722 | union acpi_operand_object *object; | ||
723 | |||
724 | |||
725 | ACPI_FUNCTION_TRACE ("ds_method_data_get_type"); | ||
726 | |||
727 | |||
728 | /* Get the namespace node for the arg/local */ | ||
729 | |||
730 | status = acpi_ds_method_data_get_node (opcode, index, walk_state, &node); | ||
731 | if (ACPI_FAILURE (status)) { | ||
732 | return_VALUE ((ACPI_TYPE_NOT_FOUND)); | ||
733 | } | ||
734 | |||
735 | /* Get the object */ | ||
736 | |||
737 | object = acpi_ns_get_attached_object (node); | ||
738 | if (!object) { | ||
739 | /* Uninitialized local/arg, return TYPE_ANY */ | ||
740 | |||
741 | return_VALUE (ACPI_TYPE_ANY); | ||
742 | } | ||
743 | |||
744 | /* Get the object type */ | ||
745 | |||
746 | return_VALUE (ACPI_GET_OBJECT_TYPE (object)); | ||
747 | } | ||
748 | #endif | ||
749 | |||
750 | |||
diff --git a/drivers/acpi/dispatcher/dsobject.c b/drivers/acpi/dispatcher/dsobject.c index eb8af4785bcb..bfbae4e4c667 100644 --- a/drivers/acpi/dispatcher/dsobject.c +++ b/drivers/acpi/dispatcher/dsobject.c | |||
@@ -52,9 +52,15 @@ | |||
52 | #define _COMPONENT ACPI_DISPATCHER | 52 | #define _COMPONENT ACPI_DISPATCHER |
53 | ACPI_MODULE_NAME ("dsobject") | 53 | ACPI_MODULE_NAME ("dsobject") |
54 | 54 | ||
55 | static acpi_status | ||
56 | acpi_ds_build_internal_object ( | ||
57 | struct acpi_walk_state *walk_state, | ||
58 | union acpi_parse_object *op, | ||
59 | union acpi_operand_object **obj_desc_ptr); | ||
60 | |||
55 | 61 | ||
56 | #ifndef ACPI_NO_METHOD_EXECUTION | 62 | #ifndef ACPI_NO_METHOD_EXECUTION |
57 | /***************************************************************************** | 63 | /******************************************************************************* |
58 | * | 64 | * |
59 | * FUNCTION: acpi_ds_build_internal_object | 65 | * FUNCTION: acpi_ds_build_internal_object |
60 | * | 66 | * |
@@ -67,9 +73,9 @@ | |||
67 | * DESCRIPTION: Translate a parser Op object to the equivalent namespace object | 73 | * DESCRIPTION: Translate a parser Op object to the equivalent namespace object |
68 | * Simple objects are any objects other than a package object! | 74 | * Simple objects are any objects other than a package object! |
69 | * | 75 | * |
70 | ****************************************************************************/ | 76 | ******************************************************************************/ |
71 | 77 | ||
72 | acpi_status | 78 | static acpi_status |
73 | acpi_ds_build_internal_object ( | 79 | acpi_ds_build_internal_object ( |
74 | struct acpi_walk_state *walk_state, | 80 | struct acpi_walk_state *walk_state, |
75 | union acpi_parse_object *op, | 81 | union acpi_parse_object *op, |
@@ -90,9 +96,11 @@ acpi_ds_build_internal_object ( | |||
90 | * Otherwise, go ahead and look it up now | 96 | * Otherwise, go ahead and look it up now |
91 | */ | 97 | */ |
92 | if (!op->common.node) { | 98 | if (!op->common.node) { |
93 | status = acpi_ns_lookup (walk_state->scope_info, op->common.value.string, | 99 | status = acpi_ns_lookup (walk_state->scope_info, |
100 | op->common.value.string, | ||
94 | ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, | 101 | ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, |
95 | ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, NULL, | 102 | ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, |
103 | NULL, | ||
96 | (struct acpi_namespace_node **) &(op->common.node)); | 104 | (struct acpi_namespace_node **) &(op->common.node)); |
97 | 105 | ||
98 | if (ACPI_FAILURE (status)) { | 106 | if (ACPI_FAILURE (status)) { |
@@ -104,12 +112,14 @@ acpi_ds_build_internal_object ( | |||
104 | 112 | ||
105 | /* Create and init the internal ACPI object */ | 113 | /* Create and init the internal ACPI object */ |
106 | 114 | ||
107 | obj_desc = acpi_ut_create_internal_object ((acpi_ps_get_opcode_info (op->common.aml_opcode))->object_type); | 115 | obj_desc = acpi_ut_create_internal_object ( |
116 | (acpi_ps_get_opcode_info (op->common.aml_opcode))->object_type); | ||
108 | if (!obj_desc) { | 117 | if (!obj_desc) { |
109 | return_ACPI_STATUS (AE_NO_MEMORY); | 118 | return_ACPI_STATUS (AE_NO_MEMORY); |
110 | } | 119 | } |
111 | 120 | ||
112 | status = acpi_ds_init_object_from_op (walk_state, op, op->common.aml_opcode, &obj_desc); | 121 | status = acpi_ds_init_object_from_op (walk_state, op, op->common.aml_opcode, |
122 | &obj_desc); | ||
113 | if (ACPI_FAILURE (status)) { | 123 | if (ACPI_FAILURE (status)) { |
114 | acpi_ut_remove_reference (obj_desc); | 124 | acpi_ut_remove_reference (obj_desc); |
115 | return_ACPI_STATUS (status); | 125 | return_ACPI_STATUS (status); |
@@ -120,7 +130,7 @@ acpi_ds_build_internal_object ( | |||
120 | } | 130 | } |
121 | 131 | ||
122 | 132 | ||
123 | /***************************************************************************** | 133 | /******************************************************************************* |
124 | * | 134 | * |
125 | * FUNCTION: acpi_ds_build_internal_buffer_obj | 135 | * FUNCTION: acpi_ds_build_internal_buffer_obj |
126 | * | 136 | * |
@@ -134,7 +144,7 @@ acpi_ds_build_internal_object ( | |||
134 | * DESCRIPTION: Translate a parser Op package object to the equivalent | 144 | * DESCRIPTION: Translate a parser Op package object to the equivalent |
135 | * namespace object | 145 | * namespace object |
136 | * | 146 | * |
137 | ****************************************************************************/ | 147 | ******************************************************************************/ |
138 | 148 | ||
139 | acpi_status | 149 | acpi_status |
140 | acpi_ds_build_internal_buffer_obj ( | 150 | acpi_ds_build_internal_buffer_obj ( |
@@ -229,7 +239,7 @@ acpi_ds_build_internal_buffer_obj ( | |||
229 | } | 239 | } |
230 | 240 | ||
231 | 241 | ||
232 | /***************************************************************************** | 242 | /******************************************************************************* |
233 | * | 243 | * |
234 | * FUNCTION: acpi_ds_build_internal_package_obj | 244 | * FUNCTION: acpi_ds_build_internal_package_obj |
235 | * | 245 | * |
@@ -243,7 +253,7 @@ acpi_ds_build_internal_buffer_obj ( | |||
243 | * DESCRIPTION: Translate a parser Op package object to the equivalent | 253 | * DESCRIPTION: Translate a parser Op package object to the equivalent |
244 | * namespace object | 254 | * namespace object |
245 | * | 255 | * |
246 | ****************************************************************************/ | 256 | ******************************************************************************/ |
247 | 257 | ||
248 | acpi_status | 258 | acpi_status |
249 | acpi_ds_build_internal_package_obj ( | 259 | acpi_ds_build_internal_package_obj ( |
@@ -331,11 +341,12 @@ acpi_ds_build_internal_package_obj ( | |||
331 | if (arg->common.aml_opcode == AML_INT_RETURN_VALUE_OP) { | 341 | if (arg->common.aml_opcode == AML_INT_RETURN_VALUE_OP) { |
332 | /* Object (package or buffer) is already built */ | 342 | /* Object (package or buffer) is already built */ |
333 | 343 | ||
334 | obj_desc->package.elements[i] = ACPI_CAST_PTR (union acpi_operand_object, arg->common.node); | 344 | obj_desc->package.elements[i] = |
345 | ACPI_CAST_PTR (union acpi_operand_object, arg->common.node); | ||
335 | } | 346 | } |
336 | else { | 347 | else { |
337 | status = acpi_ds_build_internal_object (walk_state, arg, | 348 | status = acpi_ds_build_internal_object (walk_state, arg, |
338 | &obj_desc->package.elements[i]); | 349 | &obj_desc->package.elements[i]); |
339 | } | 350 | } |
340 | 351 | ||
341 | i++; | 352 | i++; |
@@ -348,7 +359,7 @@ acpi_ds_build_internal_package_obj ( | |||
348 | } | 359 | } |
349 | 360 | ||
350 | 361 | ||
351 | /***************************************************************************** | 362 | /******************************************************************************* |
352 | * | 363 | * |
353 | * FUNCTION: acpi_ds_create_node | 364 | * FUNCTION: acpi_ds_create_node |
354 | * | 365 | * |
@@ -360,7 +371,7 @@ acpi_ds_build_internal_package_obj ( | |||
360 | * | 371 | * |
361 | * DESCRIPTION: Create the object to be associated with a namespace node | 372 | * DESCRIPTION: Create the object to be associated with a namespace node |
362 | * | 373 | * |
363 | ****************************************************************************/ | 374 | ******************************************************************************/ |
364 | 375 | ||
365 | acpi_status | 376 | acpi_status |
366 | acpi_ds_create_node ( | 377 | acpi_ds_create_node ( |
@@ -392,7 +403,8 @@ acpi_ds_create_node ( | |||
392 | 403 | ||
393 | /* Build an internal object for the argument(s) */ | 404 | /* Build an internal object for the argument(s) */ |
394 | 405 | ||
395 | status = acpi_ds_build_internal_object (walk_state, op->common.value.arg, &obj_desc); | 406 | status = acpi_ds_build_internal_object (walk_state, op->common.value.arg, |
407 | &obj_desc); | ||
396 | if (ACPI_FAILURE (status)) { | 408 | if (ACPI_FAILURE (status)) { |
397 | return_ACPI_STATUS (status); | 409 | return_ACPI_STATUS (status); |
398 | } | 410 | } |
@@ -414,7 +426,7 @@ acpi_ds_create_node ( | |||
414 | #endif /* ACPI_NO_METHOD_EXECUTION */ | 426 | #endif /* ACPI_NO_METHOD_EXECUTION */ |
415 | 427 | ||
416 | 428 | ||
417 | /***************************************************************************** | 429 | /******************************************************************************* |
418 | * | 430 | * |
419 | * FUNCTION: acpi_ds_init_object_from_op | 431 | * FUNCTION: acpi_ds_init_object_from_op |
420 | * | 432 | * |
@@ -429,7 +441,7 @@ acpi_ds_create_node ( | |||
429 | * associated arguments. The namespace object is a more compact | 441 | * associated arguments. The namespace object is a more compact |
430 | * representation of the Op and its arguments. | 442 | * representation of the Op and its arguments. |
431 | * | 443 | * |
432 | ****************************************************************************/ | 444 | ******************************************************************************/ |
433 | 445 | ||
434 | acpi_status | 446 | acpi_status |
435 | acpi_ds_init_object_from_op ( | 447 | acpi_ds_init_object_from_op ( |
@@ -462,7 +474,8 @@ acpi_ds_init_object_from_op ( | |||
462 | /* | 474 | /* |
463 | * Defer evaluation of Buffer term_arg operand | 475 | * Defer evaluation of Buffer term_arg operand |
464 | */ | 476 | */ |
465 | obj_desc->buffer.node = (struct acpi_namespace_node *) walk_state->operands[0]; | 477 | obj_desc->buffer.node = (struct acpi_namespace_node *) |
478 | walk_state->operands[0]; | ||
466 | obj_desc->buffer.aml_start = op->named.data; | 479 | obj_desc->buffer.aml_start = op->named.data; |
467 | obj_desc->buffer.aml_length = op->named.length; | 480 | obj_desc->buffer.aml_length = op->named.length; |
468 | break; | 481 | break; |
@@ -473,7 +486,8 @@ acpi_ds_init_object_from_op ( | |||
473 | /* | 486 | /* |
474 | * Defer evaluation of Package term_arg operand | 487 | * Defer evaluation of Package term_arg operand |
475 | */ | 488 | */ |
476 | obj_desc->package.node = (struct acpi_namespace_node *) walk_state->operands[0]; | 489 | obj_desc->package.node = (struct acpi_namespace_node *) |
490 | walk_state->operands[0]; | ||
477 | obj_desc->package.aml_start = op->named.data; | 491 | obj_desc->package.aml_start = op->named.data; |
478 | obj_desc->package.aml_length = op->named.length; | 492 | obj_desc->package.aml_length = op->named.length; |
479 | break; | 493 | break; |
@@ -486,9 +500,10 @@ acpi_ds_init_object_from_op ( | |||
486 | /* | 500 | /* |
487 | * Resolve AML Constants here - AND ONLY HERE! | 501 | * Resolve AML Constants here - AND ONLY HERE! |
488 | * All constants are integers. | 502 | * All constants are integers. |
489 | * We mark the integer with a flag that indicates that it started life | 503 | * We mark the integer with a flag that indicates that it started |
490 | * as a constant -- so that stores to constants will perform as expected (noop). | 504 | * life as a constant -- so that stores to constants will perform |
491 | * (zero_op is used as a placeholder for optional target operands.) | 505 | * as expected (noop). zero_op is used as a placeholder for optional |
506 | * target operands. | ||
492 | */ | 507 | */ |
493 | obj_desc->common.flags = AOPOBJ_AML_CONSTANT; | 508 | obj_desc->common.flags = AOPOBJ_AML_CONSTANT; |
494 | 509 | ||
@@ -521,7 +536,8 @@ acpi_ds_init_object_from_op ( | |||
521 | 536 | ||
522 | default: | 537 | default: |
523 | 538 | ||
524 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown constant opcode %X\n", opcode)); | 539 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
540 | "Unknown constant opcode %X\n", opcode)); | ||
525 | status = AE_AML_OPERAND_TYPE; | 541 | status = AE_AML_OPERAND_TYPE; |
526 | break; | 542 | break; |
527 | } | 543 | } |
@@ -535,7 +551,8 @@ acpi_ds_init_object_from_op ( | |||
535 | 551 | ||
536 | 552 | ||
537 | default: | 553 | default: |
538 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Integer type %X\n", op_info->type)); | 554 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Integer type %X\n", |
555 | op_info->type)); | ||
539 | status = AE_AML_OPERAND_TYPE; | 556 | status = AE_AML_OPERAND_TYPE; |
540 | break; | 557 | break; |
541 | } | 558 | } |
@@ -570,8 +587,10 @@ acpi_ds_init_object_from_op ( | |||
570 | obj_desc->reference.offset = opcode - AML_LOCAL_OP; | 587 | obj_desc->reference.offset = opcode - AML_LOCAL_OP; |
571 | 588 | ||
572 | #ifndef ACPI_NO_METHOD_EXECUTION | 589 | #ifndef ACPI_NO_METHOD_EXECUTION |
573 | status = acpi_ds_method_data_get_node (AML_LOCAL_OP, obj_desc->reference.offset, | 590 | status = acpi_ds_method_data_get_node (AML_LOCAL_OP, |
574 | walk_state, (struct acpi_namespace_node **) &obj_desc->reference.object); | 591 | obj_desc->reference.offset, |
592 | walk_state, | ||
593 | (struct acpi_namespace_node **) &obj_desc->reference.object); | ||
575 | #endif | 594 | #endif |
576 | break; | 595 | break; |
577 | 596 | ||
@@ -584,8 +603,10 @@ acpi_ds_init_object_from_op ( | |||
584 | obj_desc->reference.offset = opcode - AML_ARG_OP; | 603 | obj_desc->reference.offset = opcode - AML_ARG_OP; |
585 | 604 | ||
586 | #ifndef ACPI_NO_METHOD_EXECUTION | 605 | #ifndef ACPI_NO_METHOD_EXECUTION |
587 | status = acpi_ds_method_data_get_node (AML_ARG_OP, obj_desc->reference.offset, | 606 | status = acpi_ds_method_data_get_node (AML_ARG_OP, |
588 | walk_state, (struct acpi_namespace_node **) &obj_desc->reference.object); | 607 | obj_desc->reference.offset, |
608 | walk_state, | ||
609 | (struct acpi_namespace_node **) &obj_desc->reference.object); | ||
589 | #endif | 610 | #endif |
590 | break; | 611 | break; |
591 | 612 | ||
diff --git a/drivers/acpi/dispatcher/dsopcode.c b/drivers/acpi/dispatcher/dsopcode.c index 5c987a0e7b75..ba13bca28bee 100644 --- a/drivers/acpi/dispatcher/dsopcode.c +++ b/drivers/acpi/dispatcher/dsopcode.c | |||
@@ -54,12 +54,31 @@ | |||
54 | #define _COMPONENT ACPI_DISPATCHER | 54 | #define _COMPONENT ACPI_DISPATCHER |
55 | ACPI_MODULE_NAME ("dsopcode") | 55 | ACPI_MODULE_NAME ("dsopcode") |
56 | 56 | ||
57 | /* Local prototypes */ | ||
57 | 58 | ||
58 | /***************************************************************************** | 59 | static acpi_status |
60 | acpi_ds_execute_arguments ( | ||
61 | struct acpi_namespace_node *node, | ||
62 | struct acpi_namespace_node *scope_node, | ||
63 | u32 aml_length, | ||
64 | u8 *aml_start); | ||
65 | |||
66 | static acpi_status | ||
67 | acpi_ds_init_buffer_field ( | ||
68 | u16 aml_opcode, | ||
69 | union acpi_operand_object *obj_desc, | ||
70 | union acpi_operand_object *buffer_desc, | ||
71 | union acpi_operand_object *offset_desc, | ||
72 | union acpi_operand_object *length_desc, | ||
73 | union acpi_operand_object *result_desc); | ||
74 | |||
75 | |||
76 | /******************************************************************************* | ||
59 | * | 77 | * |
60 | * FUNCTION: acpi_ds_execute_arguments | 78 | * FUNCTION: acpi_ds_execute_arguments |
61 | * | 79 | * |
62 | * PARAMETERS: Node - Parent NS node | 80 | * PARAMETERS: Node - Object NS node |
81 | * scope_node - Parent NS node | ||
63 | * aml_length - Length of executable AML | 82 | * aml_length - Length of executable AML |
64 | * aml_start - Pointer to the AML | 83 | * aml_start - Pointer to the AML |
65 | * | 84 | * |
@@ -67,9 +86,9 @@ | |||
67 | * | 86 | * |
68 | * DESCRIPTION: Late (deferred) execution of region or field arguments | 87 | * DESCRIPTION: Late (deferred) execution of region or field arguments |
69 | * | 88 | * |
70 | ****************************************************************************/ | 89 | ******************************************************************************/ |
71 | 90 | ||
72 | acpi_status | 91 | static acpi_status |
73 | acpi_ds_execute_arguments ( | 92 | acpi_ds_execute_arguments ( |
74 | struct acpi_namespace_node *node, | 93 | struct acpi_namespace_node *node, |
75 | struct acpi_namespace_node *scope_node, | 94 | struct acpi_namespace_node *scope_node, |
@@ -162,7 +181,7 @@ acpi_ds_execute_arguments ( | |||
162 | } | 181 | } |
163 | 182 | ||
164 | 183 | ||
165 | /***************************************************************************** | 184 | /******************************************************************************* |
166 | * | 185 | * |
167 | * FUNCTION: acpi_ds_get_buffer_field_arguments | 186 | * FUNCTION: acpi_ds_get_buffer_field_arguments |
168 | * | 187 | * |
@@ -173,7 +192,7 @@ acpi_ds_execute_arguments ( | |||
173 | * DESCRIPTION: Get buffer_field Buffer and Index. This implements the late | 192 | * DESCRIPTION: Get buffer_field Buffer and Index. This implements the late |
174 | * evaluation of these field attributes. | 193 | * evaluation of these field attributes. |
175 | * | 194 | * |
176 | ****************************************************************************/ | 195 | ******************************************************************************/ |
177 | 196 | ||
178 | acpi_status | 197 | acpi_status |
179 | acpi_ds_get_buffer_field_arguments ( | 198 | acpi_ds_get_buffer_field_arguments ( |
@@ -208,7 +227,7 @@ acpi_ds_get_buffer_field_arguments ( | |||
208 | } | 227 | } |
209 | 228 | ||
210 | 229 | ||
211 | /***************************************************************************** | 230 | /******************************************************************************* |
212 | * | 231 | * |
213 | * FUNCTION: acpi_ds_get_buffer_arguments | 232 | * FUNCTION: acpi_ds_get_buffer_arguments |
214 | * | 233 | * |
@@ -219,7 +238,7 @@ acpi_ds_get_buffer_field_arguments ( | |||
219 | * DESCRIPTION: Get Buffer length and initializer byte list. This implements | 238 | * DESCRIPTION: Get Buffer length and initializer byte list. This implements |
220 | * the late evaluation of these attributes. | 239 | * the late evaluation of these attributes. |
221 | * | 240 | * |
222 | ****************************************************************************/ | 241 | ******************************************************************************/ |
223 | 242 | ||
224 | acpi_status | 243 | acpi_status |
225 | acpi_ds_get_buffer_arguments ( | 244 | acpi_ds_get_buffer_arguments ( |
@@ -255,7 +274,7 @@ acpi_ds_get_buffer_arguments ( | |||
255 | } | 274 | } |
256 | 275 | ||
257 | 276 | ||
258 | /***************************************************************************** | 277 | /******************************************************************************* |
259 | * | 278 | * |
260 | * FUNCTION: acpi_ds_get_package_arguments | 279 | * FUNCTION: acpi_ds_get_package_arguments |
261 | * | 280 | * |
@@ -266,7 +285,7 @@ acpi_ds_get_buffer_arguments ( | |||
266 | * DESCRIPTION: Get Package length and initializer byte list. This implements | 285 | * DESCRIPTION: Get Package length and initializer byte list. This implements |
267 | * the late evaluation of these attributes. | 286 | * the late evaluation of these attributes. |
268 | * | 287 | * |
269 | ****************************************************************************/ | 288 | ******************************************************************************/ |
270 | 289 | ||
271 | acpi_status | 290 | acpi_status |
272 | acpi_ds_get_package_arguments ( | 291 | acpi_ds_get_package_arguments ( |
@@ -353,17 +372,17 @@ acpi_ds_get_region_arguments ( | |||
353 | } | 372 | } |
354 | 373 | ||
355 | 374 | ||
356 | /***************************************************************************** | 375 | /******************************************************************************* |
357 | * | 376 | * |
358 | * FUNCTION: acpi_ds_initialize_region | 377 | * FUNCTION: acpi_ds_initialize_region |
359 | * | 378 | * |
360 | * PARAMETERS: Op - A valid region Op object | 379 | * PARAMETERS: obj_handle - Region namespace node |
361 | * | 380 | * |
362 | * RETURN: Status | 381 | * RETURN: Status |
363 | * | 382 | * |
364 | * DESCRIPTION: Front end to ev_initialize_region | 383 | * DESCRIPTION: Front end to ev_initialize_region |
365 | * | 384 | * |
366 | ****************************************************************************/ | 385 | ******************************************************************************/ |
367 | 386 | ||
368 | acpi_status | 387 | acpi_status |
369 | acpi_ds_initialize_region ( | 388 | acpi_ds_initialize_region ( |
@@ -382,7 +401,7 @@ acpi_ds_initialize_region ( | |||
382 | } | 401 | } |
383 | 402 | ||
384 | 403 | ||
385 | /***************************************************************************** | 404 | /******************************************************************************* |
386 | * | 405 | * |
387 | * FUNCTION: acpi_ds_init_buffer_field | 406 | * FUNCTION: acpi_ds_init_buffer_field |
388 | * | 407 | * |
@@ -390,16 +409,16 @@ acpi_ds_initialize_region ( | |||
390 | * obj_desc - buffer_field object | 409 | * obj_desc - buffer_field object |
391 | * buffer_desc - Host Buffer | 410 | * buffer_desc - Host Buffer |
392 | * offset_desc - Offset into buffer | 411 | * offset_desc - Offset into buffer |
393 | * Length - Length of field (CREATE_FIELD_OP only) | 412 | * length_desc - Length of field (CREATE_FIELD_OP only) |
394 | * Result - Where to store the result | 413 | * result_desc - Where to store the result |
395 | * | 414 | * |
396 | * RETURN: Status | 415 | * RETURN: Status |
397 | * | 416 | * |
398 | * DESCRIPTION: Perform actual initialization of a buffer field | 417 | * DESCRIPTION: Perform actual initialization of a buffer field |
399 | * | 418 | * |
400 | ****************************************************************************/ | 419 | ******************************************************************************/ |
401 | 420 | ||
402 | acpi_status | 421 | static acpi_status |
403 | acpi_ds_init_buffer_field ( | 422 | acpi_ds_init_buffer_field ( |
404 | u16 aml_opcode, | 423 | u16 aml_opcode, |
405 | union acpi_operand_object *obj_desc, | 424 | union acpi_operand_object *obj_desc, |
@@ -435,8 +454,10 @@ acpi_ds_init_buffer_field ( | |||
435 | * after resolution in acpi_ex_resolve_operands(). | 454 | * after resolution in acpi_ex_resolve_operands(). |
436 | */ | 455 | */ |
437 | if (ACPI_GET_DESCRIPTOR_TYPE (result_desc) != ACPI_DESC_TYPE_NAMED) { | 456 | if (ACPI_GET_DESCRIPTOR_TYPE (result_desc) != ACPI_DESC_TYPE_NAMED) { |
438 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "(%s) destination not a NS Node [%s]\n", | 457 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
439 | acpi_ps_get_opcode_name (aml_opcode), acpi_ut_get_descriptor_name (result_desc))); | 458 | "(%s) destination not a NS Node [%s]\n", |
459 | acpi_ps_get_opcode_name (aml_opcode), | ||
460 | acpi_ut_get_descriptor_name (result_desc))); | ||
440 | 461 | ||
441 | status = AE_AML_OPERAND_TYPE; | 462 | status = AE_AML_OPERAND_TYPE; |
442 | goto cleanup; | 463 | goto cleanup; |
@@ -452,9 +473,18 @@ acpi_ds_init_buffer_field ( | |||
452 | 473 | ||
453 | /* Offset is in bits, count is in bits */ | 474 | /* Offset is in bits, count is in bits */ |
454 | 475 | ||
476 | field_flags = AML_FIELD_ACCESS_BYTE; | ||
455 | bit_offset = offset; | 477 | bit_offset = offset; |
456 | bit_count = (u32) length_desc->integer.value; | 478 | bit_count = (u32) length_desc->integer.value; |
457 | field_flags = AML_FIELD_ACCESS_BYTE; | 479 | |
480 | /* Must have a valid (>0) bit count */ | ||
481 | |||
482 | if (bit_count == 0) { | ||
483 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | ||
484 | "Attempt to create_field of length 0\n")); | ||
485 | status = AE_AML_OPERAND_VALUE; | ||
486 | goto cleanup; | ||
487 | } | ||
458 | break; | 488 | break; |
459 | 489 | ||
460 | case AML_CREATE_BIT_FIELD_OP: | 490 | case AML_CREATE_BIT_FIELD_OP: |
@@ -527,7 +557,8 @@ acpi_ds_init_buffer_field ( | |||
527 | 557 | ||
528 | /* | 558 | /* |
529 | * Initialize areas of the field object that are common to all fields | 559 | * Initialize areas of the field object that are common to all fields |
530 | * For field_flags, use LOCK_RULE = 0 (NO_LOCK), UPDATE_RULE = 0 (UPDATE_PRESERVE) | 560 | * For field_flags, use LOCK_RULE = 0 (NO_LOCK), |
561 | * UPDATE_RULE = 0 (UPDATE_PRESERVE) | ||
531 | */ | 562 | */ |
532 | status = acpi_ex_prep_common_field_object (obj_desc, field_flags, 0, | 563 | status = acpi_ex_prep_common_field_object (obj_desc, field_flags, 0, |
533 | bit_offset, bit_count); | 564 | bit_offset, bit_count); |
@@ -539,8 +570,8 @@ acpi_ds_init_buffer_field ( | |||
539 | 570 | ||
540 | /* Reference count for buffer_desc inherits obj_desc count */ | 571 | /* Reference count for buffer_desc inherits obj_desc count */ |
541 | 572 | ||
542 | buffer_desc->common.reference_count = (u16) (buffer_desc->common.reference_count + | 573 | buffer_desc->common.reference_count = (u16) |
543 | obj_desc->common.reference_count); | 574 | (buffer_desc->common.reference_count + obj_desc->common.reference_count); |
544 | 575 | ||
545 | 576 | ||
546 | cleanup: | 577 | cleanup: |
@@ -569,7 +600,7 @@ cleanup: | |||
569 | } | 600 | } |
570 | 601 | ||
571 | 602 | ||
572 | /***************************************************************************** | 603 | /******************************************************************************* |
573 | * | 604 | * |
574 | * FUNCTION: acpi_ds_eval_buffer_field_operands | 605 | * FUNCTION: acpi_ds_eval_buffer_field_operands |
575 | * | 606 | * |
@@ -581,7 +612,7 @@ cleanup: | |||
581 | * DESCRIPTION: Get buffer_field Buffer and Index | 612 | * DESCRIPTION: Get buffer_field Buffer and Index |
582 | * Called from acpi_ds_exec_end_op during buffer_field parse tree walk | 613 | * Called from acpi_ds_exec_end_op during buffer_field parse tree walk |
583 | * | 614 | * |
584 | ****************************************************************************/ | 615 | ******************************************************************************/ |
585 | 616 | ||
586 | acpi_status | 617 | acpi_status |
587 | acpi_ds_eval_buffer_field_operands ( | 618 | acpi_ds_eval_buffer_field_operands ( |
@@ -656,7 +687,7 @@ acpi_ds_eval_buffer_field_operands ( | |||
656 | } | 687 | } |
657 | 688 | ||
658 | 689 | ||
659 | /***************************************************************************** | 690 | /******************************************************************************* |
660 | * | 691 | * |
661 | * FUNCTION: acpi_ds_eval_region_operands | 692 | * FUNCTION: acpi_ds_eval_region_operands |
662 | * | 693 | * |
@@ -668,7 +699,7 @@ acpi_ds_eval_buffer_field_operands ( | |||
668 | * DESCRIPTION: Get region address and length | 699 | * DESCRIPTION: Get region address and length |
669 | * Called from acpi_ds_exec_end_op during op_region parse tree walk | 700 | * Called from acpi_ds_exec_end_op during op_region parse tree walk |
670 | * | 701 | * |
671 | ****************************************************************************/ | 702 | ******************************************************************************/ |
672 | 703 | ||
673 | acpi_status | 704 | acpi_status |
674 | acpi_ds_eval_region_operands ( | 705 | acpi_ds_eval_region_operands ( |
@@ -686,7 +717,8 @@ acpi_ds_eval_region_operands ( | |||
686 | 717 | ||
687 | 718 | ||
688 | /* | 719 | /* |
689 | * This is where we evaluate the address and length fields of the op_region declaration | 720 | * This is where we evaluate the address and length fields of the |
721 | * op_region declaration | ||
690 | */ | 722 | */ |
691 | node = op->common.node; | 723 | node = op->common.node; |
692 | 724 | ||
@@ -707,7 +739,8 @@ acpi_ds_eval_region_operands ( | |||
707 | 739 | ||
708 | /* Resolve the length and address operands to numbers */ | 740 | /* Resolve the length and address operands to numbers */ |
709 | 741 | ||
710 | status = acpi_ex_resolve_operands (op->common.aml_opcode, ACPI_WALK_OPERANDS, walk_state); | 742 | status = acpi_ex_resolve_operands (op->common.aml_opcode, |
743 | ACPI_WALK_OPERANDS, walk_state); | ||
711 | if (ACPI_FAILURE (status)) { | 744 | if (ACPI_FAILURE (status)) { |
712 | return_ACPI_STATUS (status); | 745 | return_ACPI_STATUS (status); |
713 | } | 746 | } |
@@ -736,7 +769,8 @@ acpi_ds_eval_region_operands ( | |||
736 | */ | 769 | */ |
737 | operand_desc = walk_state->operands[walk_state->num_operands - 2]; | 770 | operand_desc = walk_state->operands[walk_state->num_operands - 2]; |
738 | 771 | ||
739 | obj_desc->region.address = (acpi_physical_address) operand_desc->integer.value; | 772 | obj_desc->region.address = (acpi_physical_address) |
773 | operand_desc->integer.value; | ||
740 | acpi_ut_remove_reference (operand_desc); | 774 | acpi_ut_remove_reference (operand_desc); |
741 | 775 | ||
742 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "rgn_obj %p Addr %8.8X%8.8X Len %X\n", | 776 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "rgn_obj %p Addr %8.8X%8.8X Len %X\n", |
@@ -752,7 +786,7 @@ acpi_ds_eval_region_operands ( | |||
752 | } | 786 | } |
753 | 787 | ||
754 | 788 | ||
755 | /***************************************************************************** | 789 | /******************************************************************************* |
756 | * | 790 | * |
757 | * FUNCTION: acpi_ds_eval_data_object_operands | 791 | * FUNCTION: acpi_ds_eval_data_object_operands |
758 | * | 792 | * |
@@ -765,7 +799,7 @@ acpi_ds_eval_region_operands ( | |||
765 | * DESCRIPTION: Get the operands and complete the following data object types: | 799 | * DESCRIPTION: Get the operands and complete the following data object types: |
766 | * Buffer, Package. | 800 | * Buffer, Package. |
767 | * | 801 | * |
768 | ****************************************************************************/ | 802 | ******************************************************************************/ |
769 | 803 | ||
770 | acpi_status | 804 | acpi_status |
771 | acpi_ds_eval_data_object_operands ( | 805 | acpi_ds_eval_data_object_operands ( |
@@ -830,7 +864,7 @@ acpi_ds_eval_data_object_operands ( | |||
830 | 864 | ||
831 | if (ACPI_SUCCESS (status)) { | 865 | if (ACPI_SUCCESS (status)) { |
832 | /* | 866 | /* |
833 | * Return the object in the walk_state, unless the parent is a package -- | 867 | * Return the object in the walk_state, unless the parent is a package - |
834 | * in this case, the return object will be stored in the parse tree | 868 | * in this case, the return object will be stored in the parse tree |
835 | * for the package. | 869 | * for the package. |
836 | */ | 870 | */ |
@@ -988,7 +1022,8 @@ acpi_ds_exec_end_control_op ( | |||
988 | status = AE_CTRL_PENDING; | 1022 | status = AE_CTRL_PENDING; |
989 | } | 1023 | } |
990 | 1024 | ||
991 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[WHILE_OP] termination! Op=%p\n", op)); | 1025 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, |
1026 | "[WHILE_OP] termination! Op=%p\n",op)); | ||
992 | 1027 | ||
993 | /* Pop this control state and free it */ | 1028 | /* Pop this control state and free it */ |
994 | 1029 | ||
diff --git a/drivers/acpi/dispatcher/dsutils.c b/drivers/acpi/dispatcher/dsutils.c index 462c5d83e747..9613349ac31d 100644 --- a/drivers/acpi/dispatcher/dsutils.c +++ b/drivers/acpi/dispatcher/dsutils.c | |||
@@ -100,7 +100,6 @@ acpi_ds_clear_implicit_return ( | |||
100 | 100 | ||
101 | 101 | ||
102 | #ifndef ACPI_NO_METHOD_EXECUTION | 102 | #ifndef ACPI_NO_METHOD_EXECUTION |
103 | |||
104 | /******************************************************************************* | 103 | /******************************************************************************* |
105 | * | 104 | * |
106 | * FUNCTION: acpi_ds_do_implicit_return | 105 | * FUNCTION: acpi_ds_do_implicit_return |
@@ -205,7 +204,7 @@ acpi_ds_is_result_used ( | |||
205 | * NOTE: this is optional because the ASL language does not actually | 204 | * NOTE: this is optional because the ASL language does not actually |
206 | * support this behavior. | 205 | * support this behavior. |
207 | */ | 206 | */ |
208 | acpi_ds_do_implicit_return (walk_state->result_obj, walk_state, TRUE); | 207 | (void) acpi_ds_do_implicit_return (walk_state->result_obj, walk_state, TRUE); |
209 | 208 | ||
210 | /* | 209 | /* |
211 | * Now determine if the parent will use the result | 210 | * Now determine if the parent will use the result |
@@ -219,8 +218,9 @@ acpi_ds_is_result_used ( | |||
219 | (op->common.parent->common.aml_opcode == AML_SCOPE_OP)) { | 218 | (op->common.parent->common.aml_opcode == AML_SCOPE_OP)) { |
220 | /* No parent, the return value cannot possibly be used */ | 219 | /* No parent, the return value cannot possibly be used */ |
221 | 220 | ||
222 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "At Method level, result of [%s] not used\n", | 221 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, |
223 | acpi_ps_get_opcode_name (op->common.aml_opcode))); | 222 | "At Method level, result of [%s] not used\n", |
223 | acpi_ps_get_opcode_name (op->common.aml_opcode))); | ||
224 | return_VALUE (FALSE); | 224 | return_VALUE (FALSE); |
225 | } | 225 | } |
226 | 226 | ||
@@ -228,7 +228,8 @@ acpi_ds_is_result_used ( | |||
228 | 228 | ||
229 | parent_info = acpi_ps_get_opcode_info (op->common.parent->common.aml_opcode); | 229 | parent_info = acpi_ps_get_opcode_info (op->common.parent->common.aml_opcode); |
230 | if (parent_info->class == AML_CLASS_UNKNOWN) { | 230 | if (parent_info->class == AML_CLASS_UNKNOWN) { |
231 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown parent opcode. Op=%p\n", op)); | 231 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
232 | "Unknown parent opcode. Op=%p\n", op)); | ||
232 | return_VALUE (FALSE); | 233 | return_VALUE (FALSE); |
233 | } | 234 | } |
234 | 235 | ||
@@ -309,17 +310,19 @@ acpi_ds_is_result_used ( | |||
309 | 310 | ||
310 | 311 | ||
311 | result_used: | 312 | result_used: |
312 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Result of [%s] used by Parent [%s] Op=%p\n", | 313 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, |
313 | acpi_ps_get_opcode_name (op->common.aml_opcode), | 314 | "Result of [%s] used by Parent [%s] Op=%p\n", |
314 | acpi_ps_get_opcode_name (op->common.parent->common.aml_opcode), op)); | 315 | acpi_ps_get_opcode_name (op->common.aml_opcode), |
316 | acpi_ps_get_opcode_name (op->common.parent->common.aml_opcode), op)); | ||
315 | 317 | ||
316 | return_VALUE (TRUE); | 318 | return_VALUE (TRUE); |
317 | 319 | ||
318 | 320 | ||
319 | result_not_used: | 321 | result_not_used: |
320 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Result of [%s] not used by Parent [%s] Op=%p\n", | 322 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, |
321 | acpi_ps_get_opcode_name (op->common.aml_opcode), | 323 | "Result of [%s] not used by Parent [%s] Op=%p\n", |
322 | acpi_ps_get_opcode_name (op->common.parent->common.aml_opcode), op)); | 324 | acpi_ps_get_opcode_name (op->common.aml_opcode), |
325 | acpi_ps_get_opcode_name (op->common.parent->common.aml_opcode), op)); | ||
323 | 326 | ||
324 | return_VALUE (FALSE); | 327 | return_VALUE (FALSE); |
325 | } | 328 | } |
@@ -522,7 +525,8 @@ acpi_ds_create_operand ( | |||
522 | if ((walk_state->deferred_node) && | 525 | if ((walk_state->deferred_node) && |
523 | (walk_state->deferred_node->type == ACPI_TYPE_BUFFER_FIELD) && | 526 | (walk_state->deferred_node->type == ACPI_TYPE_BUFFER_FIELD) && |
524 | (arg_index != 0)) { | 527 | (arg_index != 0)) { |
525 | obj_desc = ACPI_CAST_PTR (union acpi_operand_object, walk_state->deferred_node); | 528 | obj_desc = ACPI_CAST_PTR ( |
529 | union acpi_operand_object, walk_state->deferred_node); | ||
526 | status = AE_OK; | 530 | status = AE_OK; |
527 | } | 531 | } |
528 | else /* All other opcodes */ { | 532 | else /* All other opcodes */ { |
@@ -565,7 +569,8 @@ acpi_ds_create_operand ( | |||
565 | * indicate this to the interpreter, set the | 569 | * indicate this to the interpreter, set the |
566 | * object to the root | 570 | * object to the root |
567 | */ | 571 | */ |
568 | obj_desc = ACPI_CAST_PTR (union acpi_operand_object, acpi_gbl_root_node); | 572 | obj_desc = ACPI_CAST_PTR ( |
573 | union acpi_operand_object, acpi_gbl_root_node); | ||
569 | status = AE_OK; | 574 | status = AE_OK; |
570 | } | 575 | } |
571 | else { | 576 | else { |
@@ -612,7 +617,8 @@ acpi_ds_create_operand ( | |||
612 | */ | 617 | */ |
613 | opcode = AML_ZERO_OP; /* Has no arguments! */ | 618 | opcode = AML_ZERO_OP; /* Has no arguments! */ |
614 | 619 | ||
615 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Null namepath: Arg=%p\n", arg)); | 620 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, |
621 | "Null namepath: Arg=%p\n", arg)); | ||
616 | } | 622 | } |
617 | else { | 623 | else { |
618 | opcode = arg->common.aml_opcode; | 624 | opcode = arg->common.aml_opcode; |
@@ -642,7 +648,8 @@ acpi_ds_create_operand ( | |||
642 | * Only error is underflow, and this indicates | 648 | * Only error is underflow, and this indicates |
643 | * a missing or null operand! | 649 | * a missing or null operand! |
644 | */ | 650 | */ |
645 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Missing or null operand, %s\n", | 651 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
652 | "Missing or null operand, %s\n", | ||
646 | acpi_format_exception (status))); | 653 | acpi_format_exception (status))); |
647 | return_ACPI_STATUS (status); | 654 | return_ACPI_STATUS (status); |
648 | } | 655 | } |
@@ -657,8 +664,8 @@ acpi_ds_create_operand ( | |||
657 | 664 | ||
658 | /* Initialize the new object */ | 665 | /* Initialize the new object */ |
659 | 666 | ||
660 | status = acpi_ds_init_object_from_op (walk_state, arg, | 667 | status = acpi_ds_init_object_from_op ( |
661 | opcode, &obj_desc); | 668 | walk_state, arg, opcode, &obj_desc); |
662 | if (ACPI_FAILURE (status)) { | 669 | if (ACPI_FAILURE (status)) { |
663 | acpi_ut_delete_object_desc (obj_desc); | 670 | acpi_ut_delete_object_desc (obj_desc); |
664 | return_ACPI_STATUS (status); | 671 | return_ACPI_STATUS (status); |
diff --git a/drivers/acpi/dispatcher/dswexec.c b/drivers/acpi/dispatcher/dswexec.c index 2071a0d2bbbb..10f71318e23b 100644 --- a/drivers/acpi/dispatcher/dswexec.c +++ b/drivers/acpi/dispatcher/dswexec.c | |||
@@ -73,11 +73,13 @@ static ACPI_EXECUTE_OP acpi_gbl_op_type_dispatch [] = { | |||
73 | acpi_ex_opcode_3A_1T_1R, | 73 | acpi_ex_opcode_3A_1T_1R, |
74 | acpi_ex_opcode_6A_0T_1R}; | 74 | acpi_ex_opcode_6A_0T_1R}; |
75 | 75 | ||
76 | |||
76 | /***************************************************************************** | 77 | /***************************************************************************** |
77 | * | 78 | * |
78 | * FUNCTION: acpi_ds_get_predicate_value | 79 | * FUNCTION: acpi_ds_get_predicate_value |
79 | * | 80 | * |
80 | * PARAMETERS: walk_state - Current state of the parse tree walk | 81 | * PARAMETERS: walk_state - Current state of the parse tree walk |
82 | * result_obj - if non-zero, pop result from result stack | ||
81 | * | 83 | * |
82 | * RETURN: Status | 84 | * RETURN: Status |
83 | * | 85 | * |
@@ -124,7 +126,8 @@ acpi_ds_get_predicate_value ( | |||
124 | } | 126 | } |
125 | 127 | ||
126 | if (!obj_desc) { | 128 | if (!obj_desc) { |
127 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No predicate obj_desc=%p State=%p\n", | 129 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
130 | "No predicate obj_desc=%p State=%p\n", | ||
128 | obj_desc, walk_state)); | 131 | obj_desc, walk_state)); |
129 | 132 | ||
130 | return_ACPI_STATUS (AE_AML_NO_OPERAND); | 133 | return_ACPI_STATUS (AE_AML_NO_OPERAND); |
@@ -197,7 +200,7 @@ cleanup: | |||
197 | * FUNCTION: acpi_ds_exec_begin_op | 200 | * FUNCTION: acpi_ds_exec_begin_op |
198 | * | 201 | * |
199 | * PARAMETERS: walk_state - Current state of the parse tree walk | 202 | * PARAMETERS: walk_state - Current state of the parse tree walk |
200 | * out_op - Return op if a new one is created | 203 | * out_op - Where to return op if a new one is created |
201 | * | 204 | * |
202 | * RETURN: Status | 205 | * RETURN: Status |
203 | * | 206 | * |
@@ -233,7 +236,8 @@ acpi_ds_exec_begin_op ( | |||
233 | walk_state->op_info = acpi_ps_get_opcode_info (op->common.aml_opcode); | 236 | walk_state->op_info = acpi_ps_get_opcode_info (op->common.aml_opcode); |
234 | 237 | ||
235 | if (acpi_ns_opens_scope (walk_state->op_info->object_type)) { | 238 | if (acpi_ns_opens_scope (walk_state->op_info->object_type)) { |
236 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s) Popping scope for Op %p\n", | 239 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, |
240 | "(%s) Popping scope for Op %p\n", | ||
237 | acpi_ut_get_type_name (walk_state->op_info->object_type), op)); | 241 | acpi_ut_get_type_name (walk_state->op_info->object_type), op)); |
238 | 242 | ||
239 | status = acpi_ds_scope_stack_pop (walk_state); | 243 | status = acpi_ds_scope_stack_pop (walk_state); |
@@ -297,11 +301,10 @@ acpi_ds_exec_begin_op ( | |||
297 | 301 | ||
298 | if (walk_state->walk_type == ACPI_WALK_METHOD) { | 302 | if (walk_state->walk_type == ACPI_WALK_METHOD) { |
299 | /* | 303 | /* |
300 | * Found a named object declaration during method | 304 | * Found a named object declaration during method execution; |
301 | * execution; we must enter this object into the | 305 | * we must enter this object into the namespace. The created |
302 | * namespace. The created object is temporary and | 306 | * object is temporary and will be deleted upon completion of |
303 | * will be deleted upon completion of the execution | 307 | * the execution of this method. |
304 | * of this method. | ||
305 | */ | 308 | */ |
306 | status = acpi_ds_load2_begin_op (walk_state, NULL); | 309 | status = acpi_ds_load2_begin_op (walk_state, NULL); |
307 | } | 310 | } |
@@ -338,8 +341,6 @@ acpi_ds_exec_begin_op ( | |||
338 | * FUNCTION: acpi_ds_exec_end_op | 341 | * FUNCTION: acpi_ds_exec_end_op |
339 | * | 342 | * |
340 | * PARAMETERS: walk_state - Current state of the parse tree walk | 343 | * PARAMETERS: walk_state - Current state of the parse tree walk |
341 | * Op - Op that has been just been completed in the | ||
342 | * walk; Arguments have now been evaluated. | ||
343 | * | 344 | * |
344 | * RETURN: Status | 345 | * RETURN: Status |
345 | * | 346 | * |
@@ -389,7 +390,7 @@ acpi_ds_exec_end_op ( | |||
389 | /* Decode the Opcode Class */ | 390 | /* Decode the Opcode Class */ |
390 | 391 | ||
391 | switch (op_class) { | 392 | switch (op_class) { |
392 | case AML_CLASS_ARGUMENT: /* constants, literals, etc. -- do nothing */ | 393 | case AML_CLASS_ARGUMENT: /* constants, literals, etc. - do nothing */ |
393 | break; | 394 | break; |
394 | 395 | ||
395 | 396 | ||
@@ -417,12 +418,12 @@ acpi_ds_exec_end_op ( | |||
417 | /* Resolve all operands */ | 418 | /* Resolve all operands */ |
418 | 419 | ||
419 | status = acpi_ex_resolve_operands (walk_state->opcode, | 420 | status = acpi_ex_resolve_operands (walk_state->opcode, |
420 | &(walk_state->operands [walk_state->num_operands -1]), | 421 | &(walk_state->operands [walk_state->num_operands -1]), |
421 | walk_state); | 422 | walk_state); |
422 | if (ACPI_SUCCESS (status)) { | 423 | if (ACPI_SUCCESS (status)) { |
423 | ACPI_DUMP_OPERANDS (ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE, | 424 | ACPI_DUMP_OPERANDS (ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE, |
424 | acpi_ps_get_opcode_name (walk_state->opcode), | 425 | acpi_ps_get_opcode_name (walk_state->opcode), |
425 | walk_state->num_operands, "after ex_resolve_operands"); | 426 | walk_state->num_operands, "after ex_resolve_operands"); |
426 | } | 427 | } |
427 | } | 428 | } |
428 | 429 | ||
@@ -506,7 +507,8 @@ acpi_ds_exec_end_op ( | |||
506 | if ((op->asl.parent) && | 507 | if ((op->asl.parent) && |
507 | ((op->asl.parent->asl.aml_opcode == AML_PACKAGE_OP) || | 508 | ((op->asl.parent->asl.aml_opcode == AML_PACKAGE_OP) || |
508 | (op->asl.parent->asl.aml_opcode == AML_VAR_PACKAGE_OP))) { | 509 | (op->asl.parent->asl.aml_opcode == AML_VAR_PACKAGE_OP))) { |
509 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Method Reference in a Package, Op=%p\n", op)); | 510 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, |
511 | "Method Reference in a Package, Op=%p\n", op)); | ||
510 | op->common.node = (struct acpi_namespace_node *) op->asl.value.arg->asl.node->object; | 512 | op->common.node = (struct acpi_namespace_node *) op->asl.value.arg->asl.node->object; |
511 | acpi_ut_add_reference (op->asl.value.arg->asl.node->object); | 513 | acpi_ut_add_reference (op->asl.value.arg->asl.node->object); |
512 | return_ACPI_STATUS (AE_OK); | 514 | return_ACPI_STATUS (AE_OK); |
@@ -583,13 +585,15 @@ acpi_ds_exec_end_op ( | |||
583 | case AML_NAME_OP: | 585 | case AML_NAME_OP: |
584 | 586 | ||
585 | /* | 587 | /* |
586 | * Put the Node on the object stack (Contains the ACPI Name of | 588 | * Put the Node on the object stack (Contains the ACPI Name |
587 | * this object) | 589 | * of this object) |
588 | */ | 590 | */ |
589 | walk_state->operands[0] = (void *) op->common.parent->common.node; | 591 | walk_state->operands[0] = (void *) op->common.parent->common.node; |
590 | walk_state->num_operands = 1; | 592 | walk_state->num_operands = 1; |
591 | 593 | ||
592 | status = acpi_ds_create_node (walk_state, op->common.parent->common.node, op->common.parent); | 594 | status = acpi_ds_create_node (walk_state, |
595 | op->common.parent->common.node, | ||
596 | op->common.parent); | ||
593 | if (ACPI_FAILURE (status)) { | 597 | if (ACPI_FAILURE (status)) { |
594 | break; | 598 | break; |
595 | } | 599 | } |
@@ -600,7 +604,7 @@ acpi_ds_exec_end_op ( | |||
600 | case AML_INT_EVAL_SUBTREE_OP: | 604 | case AML_INT_EVAL_SUBTREE_OP: |
601 | 605 | ||
602 | status = acpi_ds_eval_data_object_operands (walk_state, op, | 606 | status = acpi_ds_eval_data_object_operands (walk_state, op, |
603 | acpi_ns_get_attached_object (op->common.parent->common.node)); | 607 | acpi_ns_get_attached_object (op->common.parent->common.node)); |
604 | break; | 608 | break; |
605 | 609 | ||
606 | default: | 610 | default: |
@@ -609,7 +613,7 @@ acpi_ds_exec_end_op ( | |||
609 | break; | 613 | break; |
610 | } | 614 | } |
611 | 615 | ||
612 | /* Done with this result state (Now that operand stack is built) */ | 616 | /* Done with result state (Now that operand stack is built) */ |
613 | 617 | ||
614 | status = acpi_ds_result_stack_pop (walk_state); | 618 | status = acpi_ds_result_stack_pop (walk_state); |
615 | if (ACPI_FAILURE (status)) { | 619 | if (ACPI_FAILURE (status)) { |
@@ -620,8 +624,7 @@ acpi_ds_exec_end_op ( | |||
620 | * If a result object was returned from above, push it on the | 624 | * If a result object was returned from above, push it on the |
621 | * current result stack | 625 | * current result stack |
622 | */ | 626 | */ |
623 | if (ACPI_SUCCESS (status) && | 627 | if (walk_state->result_obj) { |
624 | walk_state->result_obj) { | ||
625 | status = acpi_ds_result_push (walk_state->result_obj, walk_state); | 628 | status = acpi_ds_result_push (walk_state->result_obj, walk_state); |
626 | } | 629 | } |
627 | break; | 630 | break; |
@@ -654,7 +657,8 @@ acpi_ds_exec_end_op ( | |||
654 | 657 | ||
655 | case AML_TYPE_UNDEFINED: | 658 | case AML_TYPE_UNDEFINED: |
656 | 659 | ||
657 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Undefined opcode type Op=%p\n", op)); | 660 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
661 | "Undefined opcode type Op=%p\n", op)); | ||
658 | return_ACPI_STATUS (AE_NOT_IMPLEMENTED); | 662 | return_ACPI_STATUS (AE_NOT_IMPLEMENTED); |
659 | 663 | ||
660 | 664 | ||
@@ -709,13 +713,14 @@ cleanup: | |||
709 | status = acpi_gbl_exception_handler (status, | 713 | status = acpi_gbl_exception_handler (status, |
710 | walk_state->method_node->name.integer, walk_state->opcode, | 714 | walk_state->method_node->name.integer, walk_state->opcode, |
711 | walk_state->aml_offset, NULL); | 715 | walk_state->aml_offset, NULL); |
712 | acpi_ex_enter_interpreter (); | 716 | (void) acpi_ex_enter_interpreter (); |
713 | } | 717 | } |
714 | 718 | ||
715 | if (walk_state->result_obj) { | 719 | if (walk_state->result_obj) { |
716 | /* Break to debugger to display result */ | 720 | /* Break to debugger to display result */ |
717 | 721 | ||
718 | ACPI_DEBUGGER_EXEC (acpi_db_display_result_object (walk_state->result_obj, walk_state)); | 722 | ACPI_DEBUGGER_EXEC (acpi_db_display_result_object (walk_state->result_obj, |
723 | walk_state)); | ||
719 | 724 | ||
720 | /* | 725 | /* |
721 | * Delete the result op if and only if: | 726 | * Delete the result op if and only if: |
diff --git a/drivers/acpi/dispatcher/dswload.c b/drivers/acpi/dispatcher/dswload.c index 06d758679588..1ac197ccfc80 100644 --- a/drivers/acpi/dispatcher/dswload.c +++ b/drivers/acpi/dispatcher/dswload.c | |||
@@ -79,20 +79,23 @@ acpi_ds_init_callbacks ( | |||
79 | 79 | ||
80 | switch (pass_number) { | 80 | switch (pass_number) { |
81 | case 1: | 81 | case 1: |
82 | walk_state->parse_flags = ACPI_PARSE_LOAD_PASS1 | ACPI_PARSE_DELETE_TREE; | 82 | walk_state->parse_flags = ACPI_PARSE_LOAD_PASS1 | |
83 | ACPI_PARSE_DELETE_TREE; | ||
83 | walk_state->descending_callback = acpi_ds_load1_begin_op; | 84 | walk_state->descending_callback = acpi_ds_load1_begin_op; |
84 | walk_state->ascending_callback = acpi_ds_load1_end_op; | 85 | walk_state->ascending_callback = acpi_ds_load1_end_op; |
85 | break; | 86 | break; |
86 | 87 | ||
87 | case 2: | 88 | case 2: |
88 | walk_state->parse_flags = ACPI_PARSE_LOAD_PASS1 | ACPI_PARSE_DELETE_TREE; | 89 | walk_state->parse_flags = ACPI_PARSE_LOAD_PASS1 | |
90 | ACPI_PARSE_DELETE_TREE; | ||
89 | walk_state->descending_callback = acpi_ds_load2_begin_op; | 91 | walk_state->descending_callback = acpi_ds_load2_begin_op; |
90 | walk_state->ascending_callback = acpi_ds_load2_end_op; | 92 | walk_state->ascending_callback = acpi_ds_load2_end_op; |
91 | break; | 93 | break; |
92 | 94 | ||
93 | case 3: | 95 | case 3: |
94 | #ifndef ACPI_NO_METHOD_EXECUTION | 96 | #ifndef ACPI_NO_METHOD_EXECUTION |
95 | walk_state->parse_flags |= ACPI_PARSE_EXECUTE | ACPI_PARSE_DELETE_TREE; | 97 | walk_state->parse_flags |= ACPI_PARSE_EXECUTE | |
98 | ACPI_PARSE_DELETE_TREE; | ||
96 | walk_state->descending_callback = acpi_ds_exec_begin_op; | 99 | walk_state->descending_callback = acpi_ds_exec_begin_op; |
97 | walk_state->ascending_callback = acpi_ds_exec_end_op; | 100 | walk_state->ascending_callback = acpi_ds_exec_end_op; |
98 | #endif | 101 | #endif |
@@ -111,8 +114,7 @@ acpi_ds_init_callbacks ( | |||
111 | * FUNCTION: acpi_ds_load1_begin_op | 114 | * FUNCTION: acpi_ds_load1_begin_op |
112 | * | 115 | * |
113 | * PARAMETERS: walk_state - Current state of the parse tree walk | 116 | * PARAMETERS: walk_state - Current state of the parse tree walk |
114 | * Op - Op that has been just been reached in the | 117 | * out_op - Where to return op if a new one is created |
115 | * walk; Arguments have not been evaluated yet. | ||
116 | * | 118 | * |
117 | * RETURN: Status | 119 | * RETURN: Status |
118 | * | 120 | * |
@@ -146,7 +148,8 @@ acpi_ds_load1_begin_op ( | |||
146 | #if 0 | 148 | #if 0 |
147 | if ((walk_state->op_info->class == AML_CLASS_EXECUTE) || | 149 | if ((walk_state->op_info->class == AML_CLASS_EXECUTE) || |
148 | (walk_state->op_info->class == AML_CLASS_CONTROL)) { | 150 | (walk_state->op_info->class == AML_CLASS_CONTROL)) { |
149 | acpi_os_printf ("\n\n***EXECUTABLE OPCODE %s***\n\n", walk_state->op_info->name); | 151 | acpi_os_printf ("\n\n***EXECUTABLE OPCODE %s***\n\n", |
152 | walk_state->op_info->name); | ||
150 | *out_op = op; | 153 | *out_op = op; |
151 | return (AE_CTRL_SKIP); | 154 | return (AE_CTRL_SKIP); |
152 | } | 155 | } |
@@ -191,7 +194,8 @@ acpi_ds_load1_begin_op ( | |||
191 | */ | 194 | */ |
192 | acpi_dm_add_to_external_list (path); | 195 | acpi_dm_add_to_external_list (path); |
193 | status = acpi_ns_lookup (walk_state->scope_info, path, object_type, | 196 | status = acpi_ns_lookup (walk_state->scope_info, path, object_type, |
194 | ACPI_IMODE_LOAD_PASS1, ACPI_NS_SEARCH_PARENT, walk_state, &(node)); | 197 | ACPI_IMODE_LOAD_PASS1, ACPI_NS_SEARCH_PARENT, |
198 | walk_state, &(node)); | ||
195 | } | 199 | } |
196 | #endif | 200 | #endif |
197 | if (ACPI_FAILURE (status)) { | 201 | if (ACPI_FAILURE (status)) { |
@@ -224,10 +228,12 @@ acpi_ds_load1_begin_op ( | |||
224 | * Name (DEB, 0) | 228 | * Name (DEB, 0) |
225 | * Scope (DEB) { ... } | 229 | * Scope (DEB) { ... } |
226 | * | 230 | * |
227 | * Note: silently change the type here. On the second pass, we will report a warning | 231 | * Note: silently change the type here. On the second pass, we will report |
232 | * a warning | ||
228 | */ | 233 | */ |
229 | 234 | ||
230 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n", | 235 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, |
236 | "Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n", | ||
231 | path, acpi_ut_get_type_name (node->type))); | 237 | path, acpi_ut_get_type_name (node->type))); |
232 | 238 | ||
233 | node->type = ACPI_TYPE_ANY; | 239 | node->type = ACPI_TYPE_ANY; |
@@ -238,7 +244,8 @@ acpi_ds_load1_begin_op ( | |||
238 | 244 | ||
239 | /* All other types are an error */ | 245 | /* All other types are an error */ |
240 | 246 | ||
241 | ACPI_REPORT_ERROR (("Invalid type (%s) for target of Scope operator [%4.4s] (Cannot override)\n", | 247 | ACPI_REPORT_ERROR (( |
248 | "Invalid type (%s) for target of Scope operator [%4.4s] (Cannot override)\n", | ||
242 | acpi_ut_get_type_name (node->type), path)); | 249 | acpi_ut_get_type_name (node->type), path)); |
243 | 250 | ||
244 | return (AE_AML_OPERAND_TYPE); | 251 | return (AE_AML_OPERAND_TYPE); |
@@ -249,7 +256,8 @@ acpi_ds_load1_begin_op ( | |||
249 | default: | 256 | default: |
250 | 257 | ||
251 | /* | 258 | /* |
252 | * For all other named opcodes, we will enter the name into the namespace. | 259 | * For all other named opcodes, we will enter the name into |
260 | * the namespace. | ||
253 | * | 261 | * |
254 | * Setup the search flags. | 262 | * Setup the search flags. |
255 | * Since we are entering a name into the namespace, we do not want to | 263 | * Since we are entering a name into the namespace, we do not want to |
@@ -279,14 +287,16 @@ acpi_ds_load1_begin_op ( | |||
279 | acpi_ut_get_type_name (object_type))); | 287 | acpi_ut_get_type_name (object_type))); |
280 | } | 288 | } |
281 | else { | 289 | else { |
282 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[%s] Both Find or Create allowed\n", | 290 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, |
291 | "[%s] Both Find or Create allowed\n", | ||
283 | acpi_ut_get_type_name (object_type))); | 292 | acpi_ut_get_type_name (object_type))); |
284 | } | 293 | } |
285 | 294 | ||
286 | /* | 295 | /* |
287 | * Enter the named type into the internal namespace. We enter the name | 296 | * Enter the named type into the internal namespace. We enter the name |
288 | * as we go downward in the parse tree. Any necessary subobjects that involve | 297 | * as we go downward in the parse tree. Any necessary subobjects that |
289 | * arguments to the opcode must be created as we go back up the parse tree later. | 298 | * involve arguments to the opcode must be created as we go back up the |
299 | * parse tree later. | ||
290 | */ | 300 | */ |
291 | status = acpi_ns_lookup (walk_state->scope_info, path, object_type, | 301 | status = acpi_ns_lookup (walk_state->scope_info, path, object_type, |
292 | ACPI_IMODE_LOAD_PASS1, flags, walk_state, &(node)); | 302 | ACPI_IMODE_LOAD_PASS1, flags, walk_state, &(node)); |
@@ -335,8 +345,6 @@ acpi_ds_load1_begin_op ( | |||
335 | * FUNCTION: acpi_ds_load1_end_op | 345 | * FUNCTION: acpi_ds_load1_end_op |
336 | * | 346 | * |
337 | * PARAMETERS: walk_state - Current state of the parse tree walk | 347 | * PARAMETERS: walk_state - Current state of the parse tree walk |
338 | * Op - Op that has been just been completed in the | ||
339 | * walk; Arguments have now been evaluated. | ||
340 | * | 348 | * |
341 | * RETURN: Status | 349 | * RETURN: Status |
342 | * | 350 | * |
@@ -383,7 +391,9 @@ acpi_ds_load1_end_op ( | |||
383 | 391 | ||
384 | if (op->common.aml_opcode == AML_REGION_OP) { | 392 | if (op->common.aml_opcode == AML_REGION_OP) { |
385 | status = acpi_ex_create_region (op->named.data, op->named.length, | 393 | status = acpi_ex_create_region (op->named.data, op->named.length, |
386 | (acpi_adr_space_type) ((op->common.value.arg)->common.value.integer), walk_state); | 394 | (acpi_adr_space_type) |
395 | ((op->common.value.arg)->common.value.integer), | ||
396 | walk_state); | ||
387 | if (ACPI_FAILURE (status)) { | 397 | if (ACPI_FAILURE (status)) { |
388 | return (status); | 398 | return (status); |
389 | } | 399 | } |
@@ -394,7 +404,8 @@ acpi_ds_load1_end_op ( | |||
394 | /* For Name opcode, get the object type from the argument */ | 404 | /* For Name opcode, get the object type from the argument */ |
395 | 405 | ||
396 | if (op->common.value.arg) { | 406 | if (op->common.value.arg) { |
397 | object_type = (acpi_ps_get_opcode_info ((op->common.value.arg)->common.aml_opcode))->object_type; | 407 | object_type = (acpi_ps_get_opcode_info ( |
408 | (op->common.value.arg)->common.aml_opcode))->object_type; | ||
398 | op->common.node->type = (u8) object_type; | 409 | op->common.node->type = (u8) object_type; |
399 | } | 410 | } |
400 | } | 411 | } |
@@ -448,8 +459,7 @@ acpi_ds_load1_end_op ( | |||
448 | * FUNCTION: acpi_ds_load2_begin_op | 459 | * FUNCTION: acpi_ds_load2_begin_op |
449 | * | 460 | * |
450 | * PARAMETERS: walk_state - Current state of the parse tree walk | 461 | * PARAMETERS: walk_state - Current state of the parse tree walk |
451 | * Op - Op that has been just been reached in the | 462 | * out_op - Wher to return op if a new one is created |
452 | * walk; Arguments have not been evaluated yet. | ||
453 | * | 463 | * |
454 | * RETURN: Status | 464 | * RETURN: Status |
455 | * | 465 | * |
@@ -478,14 +488,20 @@ acpi_ds_load2_begin_op ( | |||
478 | if (op) { | 488 | if (op) { |
479 | /* We only care about Namespace opcodes here */ | 489 | /* We only care about Namespace opcodes here */ |
480 | 490 | ||
481 | if ((!(walk_state->op_info->flags & AML_NSOPCODE) && (walk_state->opcode != AML_INT_NAMEPATH_OP)) || | 491 | if ((!(walk_state->op_info->flags & AML_NSOPCODE) && |
492 | (walk_state->opcode != AML_INT_NAMEPATH_OP)) || | ||
482 | (!(walk_state->op_info->flags & AML_NAMED))) { | 493 | (!(walk_state->op_info->flags & AML_NAMED))) { |
494 | if ((walk_state->op_info->class == AML_CLASS_EXECUTE) || | ||
495 | (walk_state->op_info->class == AML_CLASS_CONTROL)) { | ||
496 | ACPI_REPORT_WARNING (( | ||
497 | "Encountered executable code at module level, [%s]\n", | ||
498 | acpi_ps_get_opcode_name (walk_state->opcode))); | ||
499 | } | ||
483 | return_ACPI_STATUS (AE_OK); | 500 | return_ACPI_STATUS (AE_OK); |
484 | } | 501 | } |
485 | 502 | ||
486 | /* | 503 | /* Get the name we are going to enter or lookup in the namespace */ |
487 | * Get the name we are going to enter or lookup in the namespace | 504 | |
488 | */ | ||
489 | if (walk_state->opcode == AML_INT_NAMEPATH_OP) { | 505 | if (walk_state->opcode == AML_INT_NAMEPATH_OP) { |
490 | /* For Namepath op, get the path string */ | 506 | /* For Namepath op, get the path string */ |
491 | 507 | ||
@@ -528,21 +544,25 @@ acpi_ds_load2_begin_op ( | |||
528 | case AML_INT_NAMEPATH_OP: | 544 | case AML_INT_NAMEPATH_OP: |
529 | 545 | ||
530 | /* | 546 | /* |
531 | * The name_path is an object reference to an existing object. Don't enter the | 547 | * The name_path is an object reference to an existing object. |
532 | * name into the namespace, but look it up for use later | 548 | * Don't enter the name into the namespace, but look it up |
549 | * for use later. | ||
533 | */ | 550 | */ |
534 | status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, object_type, | 551 | status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, object_type, |
535 | ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, walk_state, &(node)); | 552 | ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, |
553 | walk_state, &(node)); | ||
536 | break; | 554 | break; |
537 | 555 | ||
538 | case AML_SCOPE_OP: | 556 | case AML_SCOPE_OP: |
539 | 557 | ||
540 | /* | 558 | /* |
541 | * The Path is an object reference to an existing object. Don't enter the | 559 | * The Path is an object reference to an existing object. |
542 | * name into the namespace, but look it up for use later | 560 | * Don't enter the name into the namespace, but look it up |
561 | * for use later. | ||
543 | */ | 562 | */ |
544 | status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, object_type, | 563 | status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, object_type, |
545 | ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, walk_state, &(node)); | 564 | ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, |
565 | walk_state, &(node)); | ||
546 | if (ACPI_FAILURE (status)) { | 566 | if (ACPI_FAILURE (status)) { |
547 | #ifdef _ACPI_ASL_COMPILER | 567 | #ifdef _ACPI_ASL_COMPILER |
548 | if (status == AE_NOT_FOUND) { | 568 | if (status == AE_NOT_FOUND) { |
@@ -582,7 +602,8 @@ acpi_ds_load2_begin_op ( | |||
582 | * Scope (DEB) { ... } | 602 | * Scope (DEB) { ... } |
583 | */ | 603 | */ |
584 | 604 | ||
585 | ACPI_REPORT_WARNING (("Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n", | 605 | ACPI_REPORT_WARNING (( |
606 | "Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n", | ||
586 | buffer_ptr, acpi_ut_get_type_name (node->type))); | 607 | buffer_ptr, acpi_ut_get_type_name (node->type))); |
587 | 608 | ||
588 | node->type = ACPI_TYPE_ANY; | 609 | node->type = ACPI_TYPE_ANY; |
@@ -593,7 +614,8 @@ acpi_ds_load2_begin_op ( | |||
593 | 614 | ||
594 | /* All other types are an error */ | 615 | /* All other types are an error */ |
595 | 616 | ||
596 | ACPI_REPORT_ERROR (("Invalid type (%s) for target of Scope operator [%4.4s]\n", | 617 | ACPI_REPORT_ERROR (( |
618 | "Invalid type (%s) for target of Scope operator [%4.4s]\n", | ||
597 | acpi_ut_get_type_name (node->type), buffer_ptr)); | 619 | acpi_ut_get_type_name (node->type), buffer_ptr)); |
598 | 620 | ||
599 | return (AE_AML_OPERAND_TYPE); | 621 | return (AE_AML_OPERAND_TYPE); |
@@ -621,8 +643,9 @@ acpi_ds_load2_begin_op ( | |||
621 | 643 | ||
622 | /* | 644 | /* |
623 | * Enter the named type into the internal namespace. We enter the name | 645 | * Enter the named type into the internal namespace. We enter the name |
624 | * as we go downward in the parse tree. Any necessary subobjects that involve | 646 | * as we go downward in the parse tree. Any necessary subobjects that |
625 | * arguments to the opcode must be created as we go back up the parse tree later. | 647 | * involve arguments to the opcode must be created as we go back up the |
648 | * parse tree later. | ||
626 | * | 649 | * |
627 | * Note: Name may already exist if we are executing a deferred opcode. | 650 | * Note: Name may already exist if we are executing a deferred opcode. |
628 | */ | 651 | */ |
@@ -635,7 +658,8 @@ acpi_ds_load2_begin_op ( | |||
635 | } | 658 | } |
636 | 659 | ||
637 | status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, object_type, | 660 | status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, object_type, |
638 | ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, walk_state, &(node)); | 661 | ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, |
662 | walk_state, &(node)); | ||
639 | break; | 663 | break; |
640 | } | 664 | } |
641 | 665 | ||
@@ -678,8 +702,6 @@ acpi_ds_load2_begin_op ( | |||
678 | * FUNCTION: acpi_ds_load2_end_op | 702 | * FUNCTION: acpi_ds_load2_end_op |
679 | * | 703 | * |
680 | * PARAMETERS: walk_state - Current state of the parse tree walk | 704 | * PARAMETERS: walk_state - Current state of the parse tree walk |
681 | * Op - Op that has been just been completed in the | ||
682 | * walk; Arguments have now been evaluated. | ||
683 | * | 705 | * |
684 | * RETURN: Status | 706 | * RETURN: Status |
685 | * | 707 | * |
@@ -738,7 +760,8 @@ acpi_ds_load2_end_op ( | |||
738 | 760 | ||
739 | /* Pop the scope stack */ | 761 | /* Pop the scope stack */ |
740 | 762 | ||
741 | if (acpi_ns_opens_scope (object_type) && (op->common.aml_opcode != AML_INT_METHODCALL_OP)) { | 763 | if (acpi_ns_opens_scope (object_type) && |
764 | (op->common.aml_opcode != AML_INT_METHODCALL_OP)) { | ||
742 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s) Popping scope for Op %p\n", | 765 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s) Popping scope for Op %p\n", |
743 | acpi_ut_get_type_name (object_type), op)); | 766 | acpi_ut_get_type_name (object_type), op)); |
744 | 767 | ||
@@ -803,7 +826,7 @@ acpi_ds_load2_end_op ( | |||
803 | case AML_INDEX_FIELD_OP: | 826 | case AML_INDEX_FIELD_OP: |
804 | 827 | ||
805 | status = acpi_ds_create_index_field (op, (acpi_handle) arg->common.node, | 828 | status = acpi_ds_create_index_field (op, (acpi_handle) arg->common.node, |
806 | walk_state); | 829 | walk_state); |
807 | break; | 830 | break; |
808 | 831 | ||
809 | case AML_BANK_FIELD_OP: | 832 | case AML_BANK_FIELD_OP: |
@@ -884,14 +907,16 @@ acpi_ds_load2_end_op ( | |||
884 | #ifndef ACPI_NO_METHOD_EXECUTION | 907 | #ifndef ACPI_NO_METHOD_EXECUTION |
885 | case AML_REGION_OP: | 908 | case AML_REGION_OP: |
886 | /* | 909 | /* |
887 | * The op_region is not fully parsed at this time. Only valid argument is the space_id. | 910 | * The op_region is not fully parsed at this time. Only valid |
888 | * (We must save the address of the AML of the address and length operands) | 911 | * argument is the space_id. (We must save the address of the |
912 | * AML of the address and length operands) | ||
889 | */ | 913 | */ |
890 | /* | 914 | /* |
891 | * If we have a valid region, initialize it | 915 | * If we have a valid region, initialize it |
892 | * Namespace is NOT locked at this point. | 916 | * Namespace is NOT locked at this point. |
893 | */ | 917 | */ |
894 | status = acpi_ev_initialize_region (acpi_ns_get_attached_object (node), FALSE); | 918 | status = acpi_ev_initialize_region (acpi_ns_get_attached_object (node), |
919 | FALSE); | ||
895 | if (ACPI_FAILURE (status)) { | 920 | if (ACPI_FAILURE (status)) { |
896 | /* | 921 | /* |
897 | * If AE_NOT_EXIST is returned, it is not fatal | 922 | * If AE_NOT_EXIST is returned, it is not fatal |
@@ -942,15 +967,16 @@ acpi_ds_load2_end_op ( | |||
942 | if (ACPI_SUCCESS (status)) { | 967 | if (ACPI_SUCCESS (status)) { |
943 | /* | 968 | /* |
944 | * Make sure that what we found is indeed a method | 969 | * Make sure that what we found is indeed a method |
945 | * We didn't search for a method on purpose, to see if the name would resolve | 970 | * We didn't search for a method on purpose, to see if the name |
971 | * would resolve | ||
946 | */ | 972 | */ |
947 | if (new_node->type != ACPI_TYPE_METHOD) { | 973 | if (new_node->type != ACPI_TYPE_METHOD) { |
948 | status = AE_AML_OPERAND_TYPE; | 974 | status = AE_AML_OPERAND_TYPE; |
949 | } | 975 | } |
950 | 976 | ||
951 | /* We could put the returned object (Node) on the object stack for later, but | 977 | /* We could put the returned object (Node) on the object stack for |
952 | * for now, we will put it in the "op" object that the parser uses, so we | 978 | * later, but for now, we will put it in the "op" object that the |
953 | * can get it again at the end of this scope | 979 | * parser uses, so we can get it again at the end of this scope |
954 | */ | 980 | */ |
955 | op->common.node = new_node; | 981 | op->common.node = new_node; |
956 | } | 982 | } |
diff --git a/drivers/acpi/dispatcher/dswscope.c b/drivers/acpi/dispatcher/dswscope.c index 65f456151e25..21f4548ff323 100644 --- a/drivers/acpi/dispatcher/dswscope.c +++ b/drivers/acpi/dispatcher/dswscope.c | |||
@@ -50,14 +50,13 @@ | |||
50 | ACPI_MODULE_NAME ("dswscope") | 50 | ACPI_MODULE_NAME ("dswscope") |
51 | 51 | ||
52 | 52 | ||
53 | #define STACK_POP(head) head | ||
54 | |||
55 | |||
56 | /**************************************************************************** | 53 | /**************************************************************************** |
57 | * | 54 | * |
58 | * FUNCTION: acpi_ds_scope_stack_clear | 55 | * FUNCTION: acpi_ds_scope_stack_clear |
59 | * | 56 | * |
60 | * PARAMETERS: None | 57 | * PARAMETERS: walk_state - Current state |
58 | * | ||
59 | * RETURN: None | ||
61 | * | 60 | * |
62 | * DESCRIPTION: Pop (and free) everything on the scope stack except the | 61 | * DESCRIPTION: Pop (and free) everything on the scope stack except the |
63 | * root scope object (which remains at the stack top.) | 62 | * root scope object (which remains at the stack top.) |
@@ -80,7 +79,8 @@ acpi_ds_scope_stack_clear ( | |||
80 | walk_state->scope_info = scope_info->scope.next; | 79 | walk_state->scope_info = scope_info->scope.next; |
81 | 80 | ||
82 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, | 81 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, |
83 | "Popped object type (%s)\n", acpi_ut_get_type_name (scope_info->common.value))); | 82 | "Popped object type (%s)\n", |
83 | acpi_ut_get_type_name (scope_info->common.value))); | ||
84 | acpi_ut_delete_generic_state (scope_info); | 84 | acpi_ut_delete_generic_state (scope_info); |
85 | } | 85 | } |
86 | } | 86 | } |
@@ -90,8 +90,11 @@ acpi_ds_scope_stack_clear ( | |||
90 | * | 90 | * |
91 | * FUNCTION: acpi_ds_scope_stack_push | 91 | * FUNCTION: acpi_ds_scope_stack_push |
92 | * | 92 | * |
93 | * PARAMETERS: *Node, - Name to be made current | 93 | * PARAMETERS: Node - Name to be made current |
94 | * Type, - Type of frame being pushed | 94 | * Type - Type of frame being pushed |
95 | * walk_state - Current state | ||
96 | * | ||
97 | * RETURN: Status | ||
95 | * | 98 | * |
96 | * DESCRIPTION: Push the current scope on the scope stack, and make the | 99 | * DESCRIPTION: Push the current scope on the scope stack, and make the |
97 | * passed Node current. | 100 | * passed Node current. |
@@ -121,7 +124,8 @@ acpi_ds_scope_stack_push ( | |||
121 | /* Make sure object type is valid */ | 124 | /* Make sure object type is valid */ |
122 | 125 | ||
123 | if (!acpi_ut_valid_object_type (type)) { | 126 | if (!acpi_ut_valid_object_type (type)) { |
124 | ACPI_REPORT_WARNING (("ds_scope_stack_push: Invalid object type: 0x%X\n", type)); | 127 | ACPI_REPORT_WARNING (( |
128 | "ds_scope_stack_push: Invalid object type: 0x%X\n", type)); | ||
125 | } | 129 | } |
126 | 130 | ||
127 | /* Allocate a new scope object */ | 131 | /* Allocate a new scope object */ |
@@ -170,16 +174,11 @@ acpi_ds_scope_stack_push ( | |||
170 | * | 174 | * |
171 | * FUNCTION: acpi_ds_scope_stack_pop | 175 | * FUNCTION: acpi_ds_scope_stack_pop |
172 | * | 176 | * |
173 | * PARAMETERS: Type - The type of frame to be found | 177 | * PARAMETERS: walk_state - Current state |
174 | * | 178 | * |
175 | * DESCRIPTION: Pop the scope stack until a frame of the requested type | 179 | * RETURN: Status |
176 | * is found. | ||
177 | * | 180 | * |
178 | * RETURN: Count of frames popped. If no frame of the requested type | 181 | * DESCRIPTION: Pop the scope stack once. |
179 | * was found, the count is returned as a negative number and | ||
180 | * the scope stack is emptied (which sets the current scope | ||
181 | * to the root). If the scope stack was empty at entry, the | ||
182 | * function is a no-op and returns 0. | ||
183 | * | 182 | * |
184 | ***************************************************************************/ | 183 | ***************************************************************************/ |
185 | 184 | ||
diff --git a/drivers/acpi/dispatcher/dswstate.c b/drivers/acpi/dispatcher/dswstate.c index e555b3fbd5e5..9cd3db652b31 100644 --- a/drivers/acpi/dispatcher/dswstate.c +++ b/drivers/acpi/dispatcher/dswstate.c | |||
@@ -50,67 +50,31 @@ | |||
50 | #define _COMPONENT ACPI_DISPATCHER | 50 | #define _COMPONENT ACPI_DISPATCHER |
51 | ACPI_MODULE_NAME ("dswstate") | 51 | ACPI_MODULE_NAME ("dswstate") |
52 | 52 | ||
53 | /* Local prototypes */ | ||
53 | 54 | ||
54 | #ifdef ACPI_FUTURE_USAGE | 55 | #ifdef ACPI_OBSOLETE_FUNCTIONS |
55 | |||
56 | /******************************************************************************* | ||
57 | * | ||
58 | * FUNCTION: acpi_ds_result_insert | ||
59 | * | ||
60 | * PARAMETERS: Object - Object to push | ||
61 | * Index - Where to insert the object | ||
62 | * walk_state - Current Walk state | ||
63 | * | ||
64 | * RETURN: Status | ||
65 | * | ||
66 | * DESCRIPTION: Insert an object onto this walk's result stack | ||
67 | * | ||
68 | ******************************************************************************/ | ||
69 | |||
70 | acpi_status | 56 | acpi_status |
71 | acpi_ds_result_insert ( | 57 | acpi_ds_result_insert ( |
72 | void *object, | 58 | void *object, |
73 | u32 index, | 59 | u32 index, |
74 | struct acpi_walk_state *walk_state) | 60 | struct acpi_walk_state *walk_state); |
75 | { | ||
76 | union acpi_generic_state *state; | ||
77 | |||
78 | 61 | ||
79 | ACPI_FUNCTION_NAME ("ds_result_insert"); | 62 | acpi_status |
80 | 63 | acpi_ds_obj_stack_delete_all ( | |
81 | 64 | struct acpi_walk_state *walk_state); | |
82 | state = walk_state->results; | ||
83 | if (!state) { | ||
84 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result object pushed! State=%p\n", | ||
85 | walk_state)); | ||
86 | return (AE_NOT_EXIST); | ||
87 | } | ||
88 | |||
89 | if (index >= ACPI_OBJ_NUM_OPERANDS) { | ||
90 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | ||
91 | "Index out of range: %X Obj=%p State=%p Num=%X\n", | ||
92 | index, object, walk_state, state->results.num_results)); | ||
93 | return (AE_BAD_PARAMETER); | ||
94 | } | ||
95 | |||
96 | if (!object) { | ||
97 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | ||
98 | "Null Object! Index=%X Obj=%p State=%p Num=%X\n", | ||
99 | index, object, walk_state, state->results.num_results)); | ||
100 | return (AE_BAD_PARAMETER); | ||
101 | } | ||
102 | |||
103 | state->results.obj_desc [index] = object; | ||
104 | state->results.num_results++; | ||
105 | 65 | ||
106 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, | 66 | acpi_status |
107 | "Obj=%p [%s] State=%p Num=%X Cur=%X\n", | 67 | acpi_ds_obj_stack_pop_object ( |
108 | object, object ? acpi_ut_get_object_type_name ((union acpi_operand_object *) object) : "NULL", | 68 | union acpi_operand_object **object, |
109 | walk_state, state->results.num_results, walk_state->current_result)); | 69 | struct acpi_walk_state *walk_state); |
110 | 70 | ||
111 | return (AE_OK); | 71 | void * |
112 | } | 72 | acpi_ds_obj_stack_get_value ( |
73 | u32 index, | ||
74 | struct acpi_walk_state *walk_state); | ||
75 | #endif | ||
113 | 76 | ||
77 | #ifdef ACPI_FUTURE_USAGE | ||
114 | 78 | ||
115 | /******************************************************************************* | 79 | /******************************************************************************* |
116 | * | 80 | * |
@@ -178,7 +142,6 @@ acpi_ds_result_remove ( | |||
178 | 142 | ||
179 | #endif /* ACPI_FUTURE_USAGE */ | 143 | #endif /* ACPI_FUTURE_USAGE */ |
180 | 144 | ||
181 | |||
182 | /******************************************************************************* | 145 | /******************************************************************************* |
183 | * | 146 | * |
184 | * FUNCTION: acpi_ds_result_pop | 147 | * FUNCTION: acpi_ds_result_pop |
@@ -227,15 +190,18 @@ acpi_ds_result_pop ( | |||
227 | *object = state->results.obj_desc [index -1]; | 190 | *object = state->results.obj_desc [index -1]; |
228 | state->results.obj_desc [index -1] = NULL; | 191 | state->results.obj_desc [index -1] = NULL; |
229 | 192 | ||
230 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] Index=%X State=%p Num=%X\n", | 193 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, |
231 | *object, (*object) ? acpi_ut_get_object_type_name (*object) : "NULL", | 194 | "Obj=%p [%s] Index=%X State=%p Num=%X\n", |
195 | *object, | ||
196 | (*object) ? acpi_ut_get_object_type_name (*object) : "NULL", | ||
232 | (u32) index -1, walk_state, state->results.num_results)); | 197 | (u32) index -1, walk_state, state->results.num_results)); |
233 | 198 | ||
234 | return (AE_OK); | 199 | return (AE_OK); |
235 | } | 200 | } |
236 | } | 201 | } |
237 | 202 | ||
238 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result objects! State=%p\n", walk_state)); | 203 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
204 | "No result objects! State=%p\n", walk_state)); | ||
239 | return (AE_AML_NO_RETURN_VALUE); | 205 | return (AE_AML_NO_RETURN_VALUE); |
240 | } | 206 | } |
241 | 207 | ||
@@ -274,7 +240,8 @@ acpi_ds_result_pop_from_bottom ( | |||
274 | } | 240 | } |
275 | 241 | ||
276 | if (!state->results.num_results) { | 242 | if (!state->results.num_results) { |
277 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result objects! State=%p\n", walk_state)); | 243 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result objects! State=%p\n", |
244 | walk_state)); | ||
278 | return (AE_AML_NO_RETURN_VALUE); | 245 | return (AE_AML_NO_RETURN_VALUE); |
279 | } | 246 | } |
280 | 247 | ||
@@ -293,7 +260,8 @@ acpi_ds_result_pop_from_bottom ( | |||
293 | /* Check for a valid result object */ | 260 | /* Check for a valid result object */ |
294 | 261 | ||
295 | if (!*object) { | 262 | if (!*object) { |
296 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null operand! State=%p #Ops=%X, Index=%X\n", | 263 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
264 | "Null operand! State=%p #Ops=%X, Index=%X\n", | ||
297 | walk_state, state->results.num_results, (u32) index)); | 265 | walk_state, state->results.num_results, (u32) index)); |
298 | return (AE_AML_NO_RETURN_VALUE); | 266 | return (AE_AML_NO_RETURN_VALUE); |
299 | } | 267 | } |
@@ -344,7 +312,8 @@ acpi_ds_result_push ( | |||
344 | } | 312 | } |
345 | 313 | ||
346 | if (!object) { | 314 | if (!object) { |
347 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null Object! Obj=%p State=%p Num=%X\n", | 315 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
316 | "Null Object! Obj=%p State=%p Num=%X\n", | ||
348 | object, walk_state, state->results.num_results)); | 317 | object, walk_state, state->results.num_results)); |
349 | return (AE_BAD_PARAMETER); | 318 | return (AE_BAD_PARAMETER); |
350 | } | 319 | } |
@@ -439,43 +408,6 @@ acpi_ds_result_stack_pop ( | |||
439 | 408 | ||
440 | /******************************************************************************* | 409 | /******************************************************************************* |
441 | * | 410 | * |
442 | * FUNCTION: acpi_ds_obj_stack_delete_all | ||
443 | * | ||
444 | * PARAMETERS: walk_state - Current Walk state | ||
445 | * | ||
446 | * RETURN: Status | ||
447 | * | ||
448 | * DESCRIPTION: Clear the object stack by deleting all objects that are on it. | ||
449 | * Should be used with great care, if at all! | ||
450 | * | ||
451 | ******************************************************************************/ | ||
452 | #ifdef ACPI_FUTURE_USAGE | ||
453 | acpi_status | ||
454 | acpi_ds_obj_stack_delete_all ( | ||
455 | struct acpi_walk_state *walk_state) | ||
456 | { | ||
457 | u32 i; | ||
458 | |||
459 | |||
460 | ACPI_FUNCTION_TRACE_PTR ("ds_obj_stack_delete_all", walk_state); | ||
461 | |||
462 | |||
463 | /* The stack size is configurable, but fixed */ | ||
464 | |||
465 | for (i = 0; i < ACPI_OBJ_NUM_OPERANDS; i++) { | ||
466 | if (walk_state->operands[i]) { | ||
467 | acpi_ut_remove_reference (walk_state->operands[i]); | ||
468 | walk_state->operands[i] = NULL; | ||
469 | } | ||
470 | } | ||
471 | |||
472 | return_ACPI_STATUS (AE_OK); | ||
473 | } | ||
474 | #endif /* ACPI_FUTURE_USAGE */ | ||
475 | |||
476 | |||
477 | /******************************************************************************* | ||
478 | * | ||
479 | * FUNCTION: acpi_ds_obj_stack_push | 411 | * FUNCTION: acpi_ds_obj_stack_push |
480 | * | 412 | * |
481 | * PARAMETERS: Object - Object to push | 413 | * PARAMETERS: Object - Object to push |
@@ -517,67 +449,6 @@ acpi_ds_obj_stack_push ( | |||
517 | } | 449 | } |
518 | 450 | ||
519 | 451 | ||
520 | #if 0 | ||
521 | /******************************************************************************* | ||
522 | * | ||
523 | * FUNCTION: acpi_ds_obj_stack_pop_object | ||
524 | * | ||
525 | * PARAMETERS: pop_count - Number of objects/entries to pop | ||
526 | * walk_state - Current Walk state | ||
527 | * | ||
528 | * RETURN: Status | ||
529 | * | ||
530 | * DESCRIPTION: Pop this walk's object stack. Objects on the stack are NOT | ||
531 | * deleted by this routine. | ||
532 | * | ||
533 | ******************************************************************************/ | ||
534 | |||
535 | acpi_status | ||
536 | acpi_ds_obj_stack_pop_object ( | ||
537 | union acpi_operand_object **object, | ||
538 | struct acpi_walk_state *walk_state) | ||
539 | { | ||
540 | ACPI_FUNCTION_NAME ("ds_obj_stack_pop_object"); | ||
541 | |||
542 | |||
543 | /* Check for stack underflow */ | ||
544 | |||
545 | if (walk_state->num_operands == 0) { | ||
546 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | ||
547 | "Missing operand/stack empty! State=%p #Ops=%X\n", | ||
548 | walk_state, walk_state->num_operands)); | ||
549 | *object = NULL; | ||
550 | return (AE_AML_NO_OPERAND); | ||
551 | } | ||
552 | |||
553 | /* Pop the stack */ | ||
554 | |||
555 | walk_state->num_operands--; | ||
556 | |||
557 | /* Check for a valid operand */ | ||
558 | |||
559 | if (!walk_state->operands [walk_state->num_operands]) { | ||
560 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | ||
561 | "Null operand! State=%p #Ops=%X\n", | ||
562 | walk_state, walk_state->num_operands)); | ||
563 | *object = NULL; | ||
564 | return (AE_AML_NO_OPERAND); | ||
565 | } | ||
566 | |||
567 | /* Get operand and set stack entry to null */ | ||
568 | |||
569 | *object = walk_state->operands [walk_state->num_operands]; | ||
570 | walk_state->operands [walk_state->num_operands] = NULL; | ||
571 | |||
572 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] State=%p #Ops=%X\n", | ||
573 | *object, acpi_ut_get_object_type_name (*object), | ||
574 | walk_state, walk_state->num_operands)); | ||
575 | |||
576 | return (AE_OK); | ||
577 | } | ||
578 | #endif | ||
579 | |||
580 | |||
581 | /******************************************************************************* | 452 | /******************************************************************************* |
582 | * | 453 | * |
583 | * FUNCTION: acpi_ds_obj_stack_pop | 454 | * FUNCTION: acpi_ds_obj_stack_pop |
@@ -680,48 +551,6 @@ acpi_ds_obj_stack_pop_and_delete ( | |||
680 | 551 | ||
681 | /******************************************************************************* | 552 | /******************************************************************************* |
682 | * | 553 | * |
683 | * FUNCTION: acpi_ds_obj_stack_get_value | ||
684 | * | ||
685 | * PARAMETERS: Index - Stack index whose value is desired. Based | ||
686 | * on the top of the stack (index=0 == top) | ||
687 | * walk_state - Current Walk state | ||
688 | * | ||
689 | * RETURN: Status | ||
690 | * | ||
691 | * DESCRIPTION: Retrieve an object from this walk's object stack. Index must | ||
692 | * be within the range of the current stack pointer. | ||
693 | * | ||
694 | ******************************************************************************/ | ||
695 | #ifdef ACPI_FUTURE_USAGE | ||
696 | void * | ||
697 | acpi_ds_obj_stack_get_value ( | ||
698 | u32 index, | ||
699 | struct acpi_walk_state *walk_state) | ||
700 | { | ||
701 | |||
702 | ACPI_FUNCTION_TRACE_PTR ("ds_obj_stack_get_value", walk_state); | ||
703 | |||
704 | |||
705 | /* Can't do it if the stack is empty */ | ||
706 | |||
707 | if (walk_state->num_operands == 0) { | ||
708 | return_PTR (NULL); | ||
709 | } | ||
710 | |||
711 | /* or if the index is past the top of the stack */ | ||
712 | |||
713 | if (index > (walk_state->num_operands - (u32) 1)) { | ||
714 | return_PTR (NULL); | ||
715 | } | ||
716 | |||
717 | return_PTR (walk_state->operands[(acpi_native_uint)(walk_state->num_operands - 1) - | ||
718 | index]); | ||
719 | } | ||
720 | #endif /* ACPI_FUTURE_USAGE */ | ||
721 | |||
722 | |||
723 | /******************************************************************************* | ||
724 | * | ||
725 | * FUNCTION: acpi_ds_get_current_walk_state | 554 | * FUNCTION: acpi_ds_get_current_walk_state |
726 | * | 555 | * |
727 | * PARAMETERS: Thread - Get current active state for this Thread | 556 | * PARAMETERS: Thread - Get current active state for this Thread |
@@ -757,11 +586,11 @@ acpi_ds_get_current_walk_state ( | |||
757 | * FUNCTION: acpi_ds_push_walk_state | 586 | * FUNCTION: acpi_ds_push_walk_state |
758 | * | 587 | * |
759 | * PARAMETERS: walk_state - State to push | 588 | * PARAMETERS: walk_state - State to push |
760 | * walk_list - The list that owns the walk stack | 589 | * Thread - Thread state object |
761 | * | 590 | * |
762 | * RETURN: None | 591 | * RETURN: None |
763 | * | 592 | * |
764 | * DESCRIPTION: Place the walk_state at the head of the state list. | 593 | * DESCRIPTION: Place the Thread state at the head of the state list. |
765 | * | 594 | * |
766 | ******************************************************************************/ | 595 | ******************************************************************************/ |
767 | 596 | ||
@@ -784,9 +613,9 @@ acpi_ds_push_walk_state ( | |||
784 | * | 613 | * |
785 | * FUNCTION: acpi_ds_pop_walk_state | 614 | * FUNCTION: acpi_ds_pop_walk_state |
786 | * | 615 | * |
787 | * PARAMETERS: walk_list - The list that owns the walk stack | 616 | * PARAMETERS: Thread - Current thread state |
788 | * | 617 | * |
789 | * RETURN: A walk_state object popped from the stack | 618 | * RETURN: A walk_state object popped from the thread's stack |
790 | * | 619 | * |
791 | * DESCRIPTION: Remove and return the walkstate object that is at the head of | 620 | * DESCRIPTION: Remove and return the walkstate object that is at the head of |
792 | * the walk stack for the given walk list. NULL indicates that | 621 | * the walk stack for the given walk list. NULL indicates that |
@@ -814,7 +643,7 @@ acpi_ds_pop_walk_state ( | |||
814 | /* | 643 | /* |
815 | * Don't clear the NEXT field, this serves as an indicator | 644 | * Don't clear the NEXT field, this serves as an indicator |
816 | * that there is a parent WALK STATE | 645 | * that there is a parent WALK STATE |
817 | * NO: walk_state->Next = NULL; | 646 | * Do Not: walk_state->Next = NULL; |
818 | */ | 647 | */ |
819 | } | 648 | } |
820 | 649 | ||
@@ -826,7 +655,9 @@ acpi_ds_pop_walk_state ( | |||
826 | * | 655 | * |
827 | * FUNCTION: acpi_ds_create_walk_state | 656 | * FUNCTION: acpi_ds_create_walk_state |
828 | * | 657 | * |
829 | * PARAMETERS: Origin - Starting point for this walk | 658 | * PARAMETERS: owner_id - ID for object creation |
659 | * Origin - Starting point for this walk | ||
660 | * mth_desc - Method object | ||
830 | * Thread - Current thread state | 661 | * Thread - Current thread state |
831 | * | 662 | * |
832 | * RETURN: Pointer to the new walk state. | 663 | * RETURN: Pointer to the new walk state. |
@@ -896,8 +727,7 @@ acpi_ds_create_walk_state ( | |||
896 | * method_node - Control method NS node, if any | 727 | * method_node - Control method NS node, if any |
897 | * aml_start - Start of AML | 728 | * aml_start - Start of AML |
898 | * aml_length - Length of AML | 729 | * aml_length - Length of AML |
899 | * Params - Method args, if any | 730 | * Info - Method info block (params, etc.) |
900 | * return_obj_desc - Where to store a return object, if any | ||
901 | * pass_number - 1, 2, or 3 | 731 | * pass_number - 1, 2, or 3 |
902 | * | 732 | * |
903 | * RETURN: Status | 733 | * RETURN: Status |
@@ -931,7 +761,7 @@ acpi_ds_init_aml_walk ( | |||
931 | 761 | ||
932 | /* The next_op of the next_walk will be the beginning of the method */ | 762 | /* The next_op of the next_walk will be the beginning of the method */ |
933 | 763 | ||
934 | walk_state->next_op = NULL; | 764 | walk_state->next_op = NULL; |
935 | 765 | ||
936 | if (info) { | 766 | if (info) { |
937 | if (info->parameter_type == ACPI_PARAM_GPE) { | 767 | if (info->parameter_type == ACPI_PARAM_GPE) { |
@@ -939,8 +769,8 @@ acpi_ds_init_aml_walk ( | |||
939 | info->parameters); | 769 | info->parameters); |
940 | } | 770 | } |
941 | else { | 771 | else { |
942 | walk_state->params = info->parameters; | 772 | walk_state->params = info->parameters; |
943 | walk_state->caller_return_desc = &info->return_object; | 773 | walk_state->caller_return_desc = &info->return_object; |
944 | } | 774 | } |
945 | } | 775 | } |
946 | 776 | ||
@@ -964,7 +794,8 @@ acpi_ds_init_aml_walk ( | |||
964 | 794 | ||
965 | /* Init the method arguments */ | 795 | /* Init the method arguments */ |
966 | 796 | ||
967 | status = acpi_ds_method_data_init_args (walk_state->params, ACPI_METHOD_NUM_ARGS, walk_state); | 797 | status = acpi_ds_method_data_init_args (walk_state->params, |
798 | ACPI_METHOD_NUM_ARGS, walk_state); | ||
968 | if (ACPI_FAILURE (status)) { | 799 | if (ACPI_FAILURE (status)) { |
969 | return_ACPI_STATUS (status); | 800 | return_ACPI_STATUS (status); |
970 | } | 801 | } |
@@ -1031,12 +862,14 @@ acpi_ds_delete_walk_state ( | |||
1031 | } | 862 | } |
1032 | 863 | ||
1033 | if (walk_state->data_type != ACPI_DESC_TYPE_WALK) { | 864 | if (walk_state->data_type != ACPI_DESC_TYPE_WALK) { |
1034 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%p is not a valid walk state\n", walk_state)); | 865 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%p is not a valid walk state\n", |
866 | walk_state)); | ||
1035 | return; | 867 | return; |
1036 | } | 868 | } |
1037 | 869 | ||
1038 | if (walk_state->parser_state.scope) { | 870 | if (walk_state->parser_state.scope) { |
1039 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%p walk still has a scope list\n", walk_state)); | 871 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%p walk still has a scope list\n", |
872 | walk_state)); | ||
1040 | } | 873 | } |
1041 | 874 | ||
1042 | /* Always must free any linked control states */ | 875 | /* Always must free any linked control states */ |
@@ -1078,7 +911,7 @@ acpi_ds_delete_walk_state ( | |||
1078 | * | 911 | * |
1079 | * PARAMETERS: None | 912 | * PARAMETERS: None |
1080 | * | 913 | * |
1081 | * RETURN: Status | 914 | * RETURN: None |
1082 | * | 915 | * |
1083 | * DESCRIPTION: Purge the global state object cache. Used during subsystem | 916 | * DESCRIPTION: Purge the global state object cache. Used during subsystem |
1084 | * termination. | 917 | * termination. |
@@ -1098,3 +931,200 @@ acpi_ds_delete_walk_state_cache ( | |||
1098 | #endif | 931 | #endif |
1099 | 932 | ||
1100 | 933 | ||
934 | #ifdef ACPI_OBSOLETE_FUNCTIONS | ||
935 | /******************************************************************************* | ||
936 | * | ||
937 | * FUNCTION: acpi_ds_result_insert | ||
938 | * | ||
939 | * PARAMETERS: Object - Object to push | ||
940 | * Index - Where to insert the object | ||
941 | * walk_state - Current Walk state | ||
942 | * | ||
943 | * RETURN: Status | ||
944 | * | ||
945 | * DESCRIPTION: Insert an object onto this walk's result stack | ||
946 | * | ||
947 | ******************************************************************************/ | ||
948 | |||
949 | acpi_status | ||
950 | acpi_ds_result_insert ( | ||
951 | void *object, | ||
952 | u32 index, | ||
953 | struct acpi_walk_state *walk_state) | ||
954 | { | ||
955 | union acpi_generic_state *state; | ||
956 | |||
957 | |||
958 | ACPI_FUNCTION_NAME ("ds_result_insert"); | ||
959 | |||
960 | |||
961 | state = walk_state->results; | ||
962 | if (!state) { | ||
963 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result object pushed! State=%p\n", | ||
964 | walk_state)); | ||
965 | return (AE_NOT_EXIST); | ||
966 | } | ||
967 | |||
968 | if (index >= ACPI_OBJ_NUM_OPERANDS) { | ||
969 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | ||
970 | "Index out of range: %X Obj=%p State=%p Num=%X\n", | ||
971 | index, object, walk_state, state->results.num_results)); | ||
972 | return (AE_BAD_PARAMETER); | ||
973 | } | ||
974 | |||
975 | if (!object) { | ||
976 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | ||
977 | "Null Object! Index=%X Obj=%p State=%p Num=%X\n", | ||
978 | index, object, walk_state, state->results.num_results)); | ||
979 | return (AE_BAD_PARAMETER); | ||
980 | } | ||
981 | |||
982 | state->results.obj_desc [index] = object; | ||
983 | state->results.num_results++; | ||
984 | |||
985 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, | ||
986 | "Obj=%p [%s] State=%p Num=%X Cur=%X\n", | ||
987 | object, object ? acpi_ut_get_object_type_name ((union acpi_operand_object *) object) : "NULL", | ||
988 | walk_state, state->results.num_results, walk_state->current_result)); | ||
989 | |||
990 | return (AE_OK); | ||
991 | } | ||
992 | |||
993 | |||
994 | /******************************************************************************* | ||
995 | * | ||
996 | * FUNCTION: acpi_ds_obj_stack_delete_all | ||
997 | * | ||
998 | * PARAMETERS: walk_state - Current Walk state | ||
999 | * | ||
1000 | * RETURN: Status | ||
1001 | * | ||
1002 | * DESCRIPTION: Clear the object stack by deleting all objects that are on it. | ||
1003 | * Should be used with great care, if at all! | ||
1004 | * | ||
1005 | ******************************************************************************/ | ||
1006 | |||
1007 | acpi_status | ||
1008 | acpi_ds_obj_stack_delete_all ( | ||
1009 | struct acpi_walk_state *walk_state) | ||
1010 | { | ||
1011 | u32 i; | ||
1012 | |||
1013 | |||
1014 | ACPI_FUNCTION_TRACE_PTR ("ds_obj_stack_delete_all", walk_state); | ||
1015 | |||
1016 | |||
1017 | /* The stack size is configurable, but fixed */ | ||
1018 | |||
1019 | for (i = 0; i < ACPI_OBJ_NUM_OPERANDS; i++) { | ||
1020 | if (walk_state->operands[i]) { | ||
1021 | acpi_ut_remove_reference (walk_state->operands[i]); | ||
1022 | walk_state->operands[i] = NULL; | ||
1023 | } | ||
1024 | } | ||
1025 | |||
1026 | return_ACPI_STATUS (AE_OK); | ||
1027 | } | ||
1028 | |||
1029 | |||
1030 | /******************************************************************************* | ||
1031 | * | ||
1032 | * FUNCTION: acpi_ds_obj_stack_pop_object | ||
1033 | * | ||
1034 | * PARAMETERS: Object - Where to return the popped object | ||
1035 | * walk_state - Current Walk state | ||
1036 | * | ||
1037 | * RETURN: Status | ||
1038 | * | ||
1039 | * DESCRIPTION: Pop this walk's object stack. Objects on the stack are NOT | ||
1040 | * deleted by this routine. | ||
1041 | * | ||
1042 | ******************************************************************************/ | ||
1043 | |||
1044 | acpi_status | ||
1045 | acpi_ds_obj_stack_pop_object ( | ||
1046 | union acpi_operand_object **object, | ||
1047 | struct acpi_walk_state *walk_state) | ||
1048 | { | ||
1049 | ACPI_FUNCTION_NAME ("ds_obj_stack_pop_object"); | ||
1050 | |||
1051 | |||
1052 | /* Check for stack underflow */ | ||
1053 | |||
1054 | if (walk_state->num_operands == 0) { | ||
1055 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | ||
1056 | "Missing operand/stack empty! State=%p #Ops=%X\n", | ||
1057 | walk_state, walk_state->num_operands)); | ||
1058 | *object = NULL; | ||
1059 | return (AE_AML_NO_OPERAND); | ||
1060 | } | ||
1061 | |||
1062 | /* Pop the stack */ | ||
1063 | |||
1064 | walk_state->num_operands--; | ||
1065 | |||
1066 | /* Check for a valid operand */ | ||
1067 | |||
1068 | if (!walk_state->operands [walk_state->num_operands]) { | ||
1069 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | ||
1070 | "Null operand! State=%p #Ops=%X\n", | ||
1071 | walk_state, walk_state->num_operands)); | ||
1072 | *object = NULL; | ||
1073 | return (AE_AML_NO_OPERAND); | ||
1074 | } | ||
1075 | |||
1076 | /* Get operand and set stack entry to null */ | ||
1077 | |||
1078 | *object = walk_state->operands [walk_state->num_operands]; | ||
1079 | walk_state->operands [walk_state->num_operands] = NULL; | ||
1080 | |||
1081 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] State=%p #Ops=%X\n", | ||
1082 | *object, acpi_ut_get_object_type_name (*object), | ||
1083 | walk_state, walk_state->num_operands)); | ||
1084 | |||
1085 | return (AE_OK); | ||
1086 | } | ||
1087 | |||
1088 | |||
1089 | /******************************************************************************* | ||
1090 | * | ||
1091 | * FUNCTION: acpi_ds_obj_stack_get_value | ||
1092 | * | ||
1093 | * PARAMETERS: Index - Stack index whose value is desired. Based | ||
1094 | * on the top of the stack (index=0 == top) | ||
1095 | * walk_state - Current Walk state | ||
1096 | * | ||
1097 | * RETURN: Pointer to the requested operand | ||
1098 | * | ||
1099 | * DESCRIPTION: Retrieve an object from this walk's operand stack. Index must | ||
1100 | * be within the range of the current stack pointer. | ||
1101 | * | ||
1102 | ******************************************************************************/ | ||
1103 | |||
1104 | void * | ||
1105 | acpi_ds_obj_stack_get_value ( | ||
1106 | u32 index, | ||
1107 | struct acpi_walk_state *walk_state) | ||
1108 | { | ||
1109 | |||
1110 | ACPI_FUNCTION_TRACE_PTR ("ds_obj_stack_get_value", walk_state); | ||
1111 | |||
1112 | |||
1113 | /* Can't do it if the stack is empty */ | ||
1114 | |||
1115 | if (walk_state->num_operands == 0) { | ||
1116 | return_PTR (NULL); | ||
1117 | } | ||
1118 | |||
1119 | /* or if the index is past the top of the stack */ | ||
1120 | |||
1121 | if (index > (walk_state->num_operands - (u32) 1)) { | ||
1122 | return_PTR (NULL); | ||
1123 | } | ||
1124 | |||
1125 | return_PTR (walk_state->operands[(acpi_native_uint)(walk_state->num_operands - 1) - | ||
1126 | index]); | ||
1127 | } | ||
1128 | #endif | ||
1129 | |||
1130 | |||