diff options
author | Len Brown <len.brown@intel.com> | 2005-08-05 00:44:28 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2005-08-05 00:45:14 -0400 |
commit | 4be44fcd3bf648b782f4460fd06dfae6c42ded4b (patch) | |
tree | 5b5b7d296ea58786f53b95e5eac9565ff66890b0 /drivers/acpi/dispatcher/dsutils.c | |
parent | c65ade4dc8b486e8c8b9b0a6399789a5428e2039 (diff) |
[ACPI] Lindent all ACPI files
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/dispatcher/dsutils.c')
-rw-r--r-- | drivers/acpi/dispatcher/dsutils.c | 421 |
1 files changed, 203 insertions, 218 deletions
diff --git a/drivers/acpi/dispatcher/dsutils.c b/drivers/acpi/dispatcher/dsutils.c index 9613349ac31d..83ae1c1aa286 100644 --- a/drivers/acpi/dispatcher/dsutils.c +++ b/drivers/acpi/dispatcher/dsutils.c | |||
@@ -41,7 +41,6 @@ | |||
41 | * POSSIBILITY OF SUCH DAMAGES. | 41 | * POSSIBILITY OF SUCH DAMAGES. |
42 | */ | 42 | */ |
43 | 43 | ||
44 | |||
45 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
46 | #include <acpi/acparser.h> | 45 | #include <acpi/acparser.h> |
47 | #include <acpi/amlcode.h> | 46 | #include <acpi/amlcode.h> |
@@ -51,8 +50,7 @@ | |||
51 | #include <acpi/acdebug.h> | 50 | #include <acpi/acdebug.h> |
52 | 51 | ||
53 | #define _COMPONENT ACPI_DISPATCHER | 52 | #define _COMPONENT ACPI_DISPATCHER |
54 | ACPI_MODULE_NAME ("dsutils") | 53 | ACPI_MODULE_NAME("dsutils") |
55 | |||
56 | 54 | ||
57 | /******************************************************************************* | 55 | /******************************************************************************* |
58 | * | 56 | * |
@@ -68,13 +66,9 @@ | |||
68 | * parent method exits.) | 66 | * parent method exits.) |
69 | * | 67 | * |
70 | ******************************************************************************/ | 68 | ******************************************************************************/ |
71 | 69 | void acpi_ds_clear_implicit_return(struct acpi_walk_state *walk_state) | |
72 | void | ||
73 | acpi_ds_clear_implicit_return ( | ||
74 | struct acpi_walk_state *walk_state) | ||
75 | { | 70 | { |
76 | ACPI_FUNCTION_NAME ("ds_clear_implicit_return"); | 71 | ACPI_FUNCTION_NAME("ds_clear_implicit_return"); |
77 | |||
78 | 72 | ||
79 | /* | 73 | /* |
80 | * Slack must be enabled for this feature | 74 | * Slack must be enabled for this feature |
@@ -89,16 +83,15 @@ acpi_ds_clear_implicit_return ( | |||
89 | * complex statements, the implicit return value can be | 83 | * complex statements, the implicit return value can be |
90 | * bubbled up several levels. | 84 | * bubbled up several levels. |
91 | */ | 85 | */ |
92 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, | 86 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
93 | "Removing reference on stale implicit return obj %p\n", | 87 | "Removing reference on stale implicit return obj %p\n", |
94 | walk_state->implicit_return_obj)); | 88 | walk_state->implicit_return_obj)); |
95 | 89 | ||
96 | acpi_ut_remove_reference (walk_state->implicit_return_obj); | 90 | acpi_ut_remove_reference(walk_state->implicit_return_obj); |
97 | walk_state->implicit_return_obj = NULL; | 91 | walk_state->implicit_return_obj = NULL; |
98 | } | 92 | } |
99 | } | 93 | } |
100 | 94 | ||
101 | |||
102 | #ifndef ACPI_NO_METHOD_EXECUTION | 95 | #ifndef ACPI_NO_METHOD_EXECUTION |
103 | /******************************************************************************* | 96 | /******************************************************************************* |
104 | * | 97 | * |
@@ -119,27 +112,22 @@ acpi_ds_clear_implicit_return ( | |||
119 | ******************************************************************************/ | 112 | ******************************************************************************/ |
120 | 113 | ||
121 | u8 | 114 | u8 |
122 | acpi_ds_do_implicit_return ( | 115 | acpi_ds_do_implicit_return(union acpi_operand_object *return_desc, |
123 | union acpi_operand_object *return_desc, | 116 | struct acpi_walk_state *walk_state, u8 add_reference) |
124 | struct acpi_walk_state *walk_state, | ||
125 | u8 add_reference) | ||
126 | { | 117 | { |
127 | ACPI_FUNCTION_NAME ("ds_do_implicit_return"); | 118 | ACPI_FUNCTION_NAME("ds_do_implicit_return"); |
128 | |||
129 | 119 | ||
130 | /* | 120 | /* |
131 | * Slack must be enabled for this feature, and we must | 121 | * Slack must be enabled for this feature, and we must |
132 | * have a valid return object | 122 | * have a valid return object |
133 | */ | 123 | */ |
134 | if ((!acpi_gbl_enable_interpreter_slack) || | 124 | if ((!acpi_gbl_enable_interpreter_slack) || (!return_desc)) { |
135 | (!return_desc)) { | ||
136 | return (FALSE); | 125 | return (FALSE); |
137 | } | 126 | } |
138 | 127 | ||
139 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, | 128 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
140 | "Result %p will be implicitly returned; Prev=%p\n", | 129 | "Result %p will be implicitly returned; Prev=%p\n", |
141 | return_desc, | 130 | return_desc, walk_state->implicit_return_obj)); |
142 | walk_state->implicit_return_obj)); | ||
143 | 131 | ||
144 | /* | 132 | /* |
145 | * Delete any "stale" implicit return value first. However, in | 133 | * Delete any "stale" implicit return value first. However, in |
@@ -151,20 +139,19 @@ acpi_ds_do_implicit_return ( | |||
151 | if (walk_state->implicit_return_obj == return_desc) { | 139 | if (walk_state->implicit_return_obj == return_desc) { |
152 | return (TRUE); | 140 | return (TRUE); |
153 | } | 141 | } |
154 | acpi_ds_clear_implicit_return (walk_state); | 142 | acpi_ds_clear_implicit_return(walk_state); |
155 | } | 143 | } |
156 | 144 | ||
157 | /* Save the implicit return value, add a reference if requested */ | 145 | /* Save the implicit return value, add a reference if requested */ |
158 | 146 | ||
159 | walk_state->implicit_return_obj = return_desc; | 147 | walk_state->implicit_return_obj = return_desc; |
160 | if (add_reference) { | 148 | if (add_reference) { |
161 | acpi_ut_add_reference (return_desc); | 149 | acpi_ut_add_reference(return_desc); |
162 | } | 150 | } |
163 | 151 | ||
164 | return (TRUE); | 152 | return (TRUE); |
165 | } | 153 | } |
166 | 154 | ||
167 | |||
168 | /******************************************************************************* | 155 | /******************************************************************************* |
169 | * | 156 | * |
170 | * FUNCTION: acpi_ds_is_result_used | 157 | * FUNCTION: acpi_ds_is_result_used |
@@ -179,20 +166,18 @@ acpi_ds_do_implicit_return ( | |||
179 | ******************************************************************************/ | 166 | ******************************************************************************/ |
180 | 167 | ||
181 | u8 | 168 | u8 |
182 | acpi_ds_is_result_used ( | 169 | acpi_ds_is_result_used(union acpi_parse_object * op, |
183 | union acpi_parse_object *op, | 170 | struct acpi_walk_state * walk_state) |
184 | struct acpi_walk_state *walk_state) | ||
185 | { | 171 | { |
186 | const struct acpi_opcode_info *parent_info; | 172 | const struct acpi_opcode_info *parent_info; |
187 | |||
188 | ACPI_FUNCTION_TRACE_PTR ("ds_is_result_used", op); | ||
189 | 173 | ||
174 | ACPI_FUNCTION_TRACE_PTR("ds_is_result_used", op); | ||
190 | 175 | ||
191 | /* Must have both an Op and a Result Object */ | 176 | /* Must have both an Op and a Result Object */ |
192 | 177 | ||
193 | if (!op) { | 178 | if (!op) { |
194 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null Op\n")); | 179 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Null Op\n")); |
195 | return_VALUE (TRUE); | 180 | return_VALUE(TRUE); |
196 | } | 181 | } |
197 | 182 | ||
198 | /* | 183 | /* |
@@ -204,7 +189,8 @@ acpi_ds_is_result_used ( | |||
204 | * NOTE: this is optional because the ASL language does not actually | 189 | * NOTE: this is optional because the ASL language does not actually |
205 | * support this behavior. | 190 | * support this behavior. |
206 | */ | 191 | */ |
207 | (void) acpi_ds_do_implicit_return (walk_state->result_obj, walk_state, TRUE); | 192 | (void)acpi_ds_do_implicit_return(walk_state->result_obj, walk_state, |
193 | TRUE); | ||
208 | 194 | ||
209 | /* | 195 | /* |
210 | * Now determine if the parent will use the result | 196 | * Now determine if the parent will use the result |
@@ -215,22 +201,24 @@ acpi_ds_is_result_used ( | |||
215 | * via execute_control_method has a scope_op as the parent. | 201 | * via execute_control_method has a scope_op as the parent. |
216 | */ | 202 | */ |
217 | if ((!op->common.parent) || | 203 | if ((!op->common.parent) || |
218 | (op->common.parent->common.aml_opcode == AML_SCOPE_OP)) { | 204 | (op->common.parent->common.aml_opcode == AML_SCOPE_OP)) { |
219 | /* No parent, the return value cannot possibly be used */ | 205 | /* No parent, the return value cannot possibly be used */ |
220 | 206 | ||
221 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, | 207 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
222 | "At Method level, result of [%s] not used\n", | 208 | "At Method level, result of [%s] not used\n", |
223 | acpi_ps_get_opcode_name (op->common.aml_opcode))); | 209 | acpi_ps_get_opcode_name(op->common. |
224 | return_VALUE (FALSE); | 210 | aml_opcode))); |
211 | return_VALUE(FALSE); | ||
225 | } | 212 | } |
226 | 213 | ||
227 | /* Get info on the parent. The root_op is AML_SCOPE */ | 214 | /* Get info on the parent. The root_op is AML_SCOPE */ |
228 | 215 | ||
229 | parent_info = acpi_ps_get_opcode_info (op->common.parent->common.aml_opcode); | 216 | parent_info = |
217 | acpi_ps_get_opcode_info(op->common.parent->common.aml_opcode); | ||
230 | if (parent_info->class == AML_CLASS_UNKNOWN) { | 218 | if (parent_info->class == AML_CLASS_UNKNOWN) { |
231 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 219 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
232 | "Unknown parent opcode. Op=%p\n", op)); | 220 | "Unknown parent opcode. Op=%p\n", op)); |
233 | return_VALUE (FALSE); | 221 | return_VALUE(FALSE); |
234 | } | 222 | } |
235 | 223 | ||
236 | /* | 224 | /* |
@@ -256,8 +244,10 @@ acpi_ds_is_result_used ( | |||
256 | * If we are executing the predicate AND this is the predicate op, | 244 | * If we are executing the predicate AND this is the predicate op, |
257 | * we will use the return value | 245 | * we will use the return value |
258 | */ | 246 | */ |
259 | if ((walk_state->control_state->common.state == ACPI_CONTROL_PREDICATE_EXECUTING) && | 247 | if ((walk_state->control_state->common.state == |
260 | (walk_state->control_state->control.predicate_op == op)) { | 248 | ACPI_CONTROL_PREDICATE_EXECUTING) |
249 | && (walk_state->control_state->control. | ||
250 | predicate_op == op)) { | ||
261 | goto result_used; | 251 | goto result_used; |
262 | } | 252 | } |
263 | break; | 253 | break; |
@@ -271,7 +261,6 @@ acpi_ds_is_result_used ( | |||
271 | 261 | ||
272 | goto result_not_used; | 262 | goto result_not_used; |
273 | 263 | ||
274 | |||
275 | case AML_CLASS_CREATE: | 264 | case AML_CLASS_CREATE: |
276 | 265 | ||
277 | /* | 266 | /* |
@@ -280,15 +269,16 @@ acpi_ds_is_result_used ( | |||
280 | */ | 269 | */ |
281 | goto result_used; | 270 | goto result_used; |
282 | 271 | ||
283 | |||
284 | case AML_CLASS_NAMED_OBJECT: | 272 | case AML_CLASS_NAMED_OBJECT: |
285 | 273 | ||
286 | if ((op->common.parent->common.aml_opcode == AML_REGION_OP) || | 274 | if ((op->common.parent->common.aml_opcode == AML_REGION_OP) || |
287 | (op->common.parent->common.aml_opcode == AML_DATA_REGION_OP) || | 275 | (op->common.parent->common.aml_opcode == AML_DATA_REGION_OP) |
288 | (op->common.parent->common.aml_opcode == AML_PACKAGE_OP) || | 276 | || (op->common.parent->common.aml_opcode == AML_PACKAGE_OP) |
289 | (op->common.parent->common.aml_opcode == AML_VAR_PACKAGE_OP) || | 277 | || (op->common.parent->common.aml_opcode == |
290 | (op->common.parent->common.aml_opcode == AML_BUFFER_OP) || | 278 | AML_VAR_PACKAGE_OP) |
291 | (op->common.parent->common.aml_opcode == AML_INT_EVAL_SUBTREE_OP)) { | 279 | || (op->common.parent->common.aml_opcode == AML_BUFFER_OP) |
280 | || (op->common.parent->common.aml_opcode == | ||
281 | AML_INT_EVAL_SUBTREE_OP)) { | ||
292 | /* | 282 | /* |
293 | * These opcodes allow term_arg(s) as operands and therefore | 283 | * These opcodes allow term_arg(s) as operands and therefore |
294 | * the operands can be method calls. The result is used. | 284 | * the operands can be method calls. The result is used. |
@@ -298,7 +288,6 @@ acpi_ds_is_result_used ( | |||
298 | 288 | ||
299 | goto result_not_used; | 289 | goto result_not_used; |
300 | 290 | ||
301 | |||
302 | default: | 291 | default: |
303 | 292 | ||
304 | /* | 293 | /* |
@@ -308,26 +297,25 @@ acpi_ds_is_result_used ( | |||
308 | goto result_used; | 297 | goto result_used; |
309 | } | 298 | } |
310 | 299 | ||
300 | result_used: | ||
301 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | ||
302 | "Result of [%s] used by Parent [%s] Op=%p\n", | ||
303 | acpi_ps_get_opcode_name(op->common.aml_opcode), | ||
304 | acpi_ps_get_opcode_name(op->common.parent->common. | ||
305 | aml_opcode), op)); | ||
311 | 306 | ||
312 | result_used: | 307 | return_VALUE(TRUE); |
313 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, | ||
314 | "Result of [%s] used by Parent [%s] Op=%p\n", | ||
315 | acpi_ps_get_opcode_name (op->common.aml_opcode), | ||
316 | acpi_ps_get_opcode_name (op->common.parent->common.aml_opcode), op)); | ||
317 | |||
318 | return_VALUE (TRUE); | ||
319 | |||
320 | 308 | ||
321 | result_not_used: | 309 | result_not_used: |
322 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, | 310 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
323 | "Result of [%s] not used by Parent [%s] Op=%p\n", | 311 | "Result of [%s] not used by Parent [%s] Op=%p\n", |
324 | acpi_ps_get_opcode_name (op->common.aml_opcode), | 312 | acpi_ps_get_opcode_name(op->common.aml_opcode), |
325 | acpi_ps_get_opcode_name (op->common.parent->common.aml_opcode), op)); | 313 | acpi_ps_get_opcode_name(op->common.parent->common. |
314 | aml_opcode), op)); | ||
326 | 315 | ||
327 | return_VALUE (FALSE); | 316 | return_VALUE(FALSE); |
328 | } | 317 | } |
329 | 318 | ||
330 | |||
331 | /******************************************************************************* | 319 | /******************************************************************************* |
332 | * | 320 | * |
333 | * FUNCTION: acpi_ds_delete_result_if_not_used | 321 | * FUNCTION: acpi_ds_delete_result_if_not_used |
@@ -346,20 +334,17 @@ result_not_used: | |||
346 | ******************************************************************************/ | 334 | ******************************************************************************/ |
347 | 335 | ||
348 | void | 336 | void |
349 | acpi_ds_delete_result_if_not_used ( | 337 | acpi_ds_delete_result_if_not_used(union acpi_parse_object *op, |
350 | union acpi_parse_object *op, | 338 | union acpi_operand_object *result_obj, |
351 | union acpi_operand_object *result_obj, | 339 | struct acpi_walk_state *walk_state) |
352 | struct acpi_walk_state *walk_state) | ||
353 | { | 340 | { |
354 | union acpi_operand_object *obj_desc; | 341 | union acpi_operand_object *obj_desc; |
355 | acpi_status status; | 342 | acpi_status status; |
356 | |||
357 | |||
358 | ACPI_FUNCTION_TRACE_PTR ("ds_delete_result_if_not_used", result_obj); | ||
359 | 343 | ||
344 | ACPI_FUNCTION_TRACE_PTR("ds_delete_result_if_not_used", result_obj); | ||
360 | 345 | ||
361 | if (!op) { | 346 | if (!op) { |
362 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null Op\n")); | 347 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Null Op\n")); |
363 | return_VOID; | 348 | return_VOID; |
364 | } | 349 | } |
365 | 350 | ||
@@ -367,19 +352,18 @@ acpi_ds_delete_result_if_not_used ( | |||
367 | return_VOID; | 352 | return_VOID; |
368 | } | 353 | } |
369 | 354 | ||
370 | if (!acpi_ds_is_result_used (op, walk_state)) { | 355 | if (!acpi_ds_is_result_used(op, walk_state)) { |
371 | /* Must pop the result stack (obj_desc should be equal to result_obj) */ | 356 | /* Must pop the result stack (obj_desc should be equal to result_obj) */ |
372 | 357 | ||
373 | status = acpi_ds_result_pop (&obj_desc, walk_state); | 358 | status = acpi_ds_result_pop(&obj_desc, walk_state); |
374 | if (ACPI_SUCCESS (status)) { | 359 | if (ACPI_SUCCESS(status)) { |
375 | acpi_ut_remove_reference (result_obj); | 360 | acpi_ut_remove_reference(result_obj); |
376 | } | 361 | } |
377 | } | 362 | } |
378 | 363 | ||
379 | return_VOID; | 364 | return_VOID; |
380 | } | 365 | } |
381 | 366 | ||
382 | |||
383 | /******************************************************************************* | 367 | /******************************************************************************* |
384 | * | 368 | * |
385 | * FUNCTION: acpi_ds_resolve_operands | 369 | * FUNCTION: acpi_ds_resolve_operands |
@@ -394,16 +378,12 @@ acpi_ds_delete_result_if_not_used ( | |||
394 | * | 378 | * |
395 | ******************************************************************************/ | 379 | ******************************************************************************/ |
396 | 380 | ||
397 | acpi_status | 381 | acpi_status acpi_ds_resolve_operands(struct acpi_walk_state *walk_state) |
398 | acpi_ds_resolve_operands ( | ||
399 | struct acpi_walk_state *walk_state) | ||
400 | { | 382 | { |
401 | u32 i; | 383 | u32 i; |
402 | acpi_status status = AE_OK; | 384 | acpi_status status = AE_OK; |
403 | |||
404 | |||
405 | ACPI_FUNCTION_TRACE_PTR ("ds_resolve_operands", walk_state); | ||
406 | 385 | ||
386 | ACPI_FUNCTION_TRACE_PTR("ds_resolve_operands", walk_state); | ||
407 | 387 | ||
408 | /* | 388 | /* |
409 | * Attempt to resolve each of the valid operands | 389 | * Attempt to resolve each of the valid operands |
@@ -411,16 +391,17 @@ acpi_ds_resolve_operands ( | |||
411 | * that the actual objects are passed, not copies of the objects. | 391 | * that the actual objects are passed, not copies of the objects. |
412 | */ | 392 | */ |
413 | for (i = 0; i < walk_state->num_operands; i++) { | 393 | for (i = 0; i < walk_state->num_operands; i++) { |
414 | status = acpi_ex_resolve_to_value (&walk_state->operands[i], walk_state); | 394 | status = |
415 | if (ACPI_FAILURE (status)) { | 395 | acpi_ex_resolve_to_value(&walk_state->operands[i], |
396 | walk_state); | ||
397 | if (ACPI_FAILURE(status)) { | ||
416 | break; | 398 | break; |
417 | } | 399 | } |
418 | } | 400 | } |
419 | 401 | ||
420 | return_ACPI_STATUS (status); | 402 | return_ACPI_STATUS(status); |
421 | } | 403 | } |
422 | 404 | ||
423 | |||
424 | /******************************************************************************* | 405 | /******************************************************************************* |
425 | * | 406 | * |
426 | * FUNCTION: acpi_ds_clear_operands | 407 | * FUNCTION: acpi_ds_clear_operands |
@@ -433,15 +414,11 @@ acpi_ds_resolve_operands ( | |||
433 | * | 414 | * |
434 | ******************************************************************************/ | 415 | ******************************************************************************/ |
435 | 416 | ||
436 | void | 417 | void acpi_ds_clear_operands(struct acpi_walk_state *walk_state) |
437 | acpi_ds_clear_operands ( | ||
438 | struct acpi_walk_state *walk_state) | ||
439 | { | 418 | { |
440 | u32 i; | 419 | u32 i; |
441 | |||
442 | |||
443 | ACPI_FUNCTION_TRACE_PTR ("ds_clear_operands", walk_state); | ||
444 | 420 | ||
421 | ACPI_FUNCTION_TRACE_PTR("ds_clear_operands", walk_state); | ||
445 | 422 | ||
446 | /* Remove a reference on each operand on the stack */ | 423 | /* Remove a reference on each operand on the stack */ |
447 | 424 | ||
@@ -450,7 +427,7 @@ acpi_ds_clear_operands ( | |||
450 | * Remove a reference to all operands, including both | 427 | * Remove a reference to all operands, including both |
451 | * "Arguments" and "Targets". | 428 | * "Arguments" and "Targets". |
452 | */ | 429 | */ |
453 | acpi_ut_remove_reference (walk_state->operands[i]); | 430 | acpi_ut_remove_reference(walk_state->operands[i]); |
454 | walk_state->operands[i] = NULL; | 431 | walk_state->operands[i] = NULL; |
455 | } | 432 | } |
456 | 433 | ||
@@ -459,7 +436,6 @@ acpi_ds_clear_operands ( | |||
459 | } | 436 | } |
460 | #endif | 437 | #endif |
461 | 438 | ||
462 | |||
463 | /******************************************************************************* | 439 | /******************************************************************************* |
464 | * | 440 | * |
465 | * FUNCTION: acpi_ds_create_operand | 441 | * FUNCTION: acpi_ds_create_operand |
@@ -478,37 +454,36 @@ acpi_ds_clear_operands ( | |||
478 | ******************************************************************************/ | 454 | ******************************************************************************/ |
479 | 455 | ||
480 | acpi_status | 456 | acpi_status |
481 | acpi_ds_create_operand ( | 457 | acpi_ds_create_operand(struct acpi_walk_state *walk_state, |
482 | struct acpi_walk_state *walk_state, | 458 | union acpi_parse_object *arg, u32 arg_index) |
483 | union acpi_parse_object *arg, | ||
484 | u32 arg_index) | ||
485 | { | 459 | { |
486 | acpi_status status = AE_OK; | 460 | acpi_status status = AE_OK; |
487 | char *name_string; | 461 | char *name_string; |
488 | u32 name_length; | 462 | u32 name_length; |
489 | union acpi_operand_object *obj_desc; | 463 | union acpi_operand_object *obj_desc; |
490 | union acpi_parse_object *parent_op; | 464 | union acpi_parse_object *parent_op; |
491 | u16 opcode; | 465 | u16 opcode; |
492 | acpi_interpreter_mode interpreter_mode; | 466 | acpi_interpreter_mode interpreter_mode; |
493 | const struct acpi_opcode_info *op_info; | 467 | const struct acpi_opcode_info *op_info; |
494 | |||
495 | |||
496 | ACPI_FUNCTION_TRACE_PTR ("ds_create_operand", arg); | ||
497 | 468 | ||
469 | ACPI_FUNCTION_TRACE_PTR("ds_create_operand", arg); | ||
498 | 470 | ||
499 | /* A valid name must be looked up in the namespace */ | 471 | /* A valid name must be looked up in the namespace */ |
500 | 472 | ||
501 | if ((arg->common.aml_opcode == AML_INT_NAMEPATH_OP) && | 473 | if ((arg->common.aml_opcode == AML_INT_NAMEPATH_OP) && |
502 | (arg->common.value.string)) { | 474 | (arg->common.value.string)) { |
503 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Getting a name: Arg=%p\n", arg)); | 475 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Getting a name: Arg=%p\n", |
476 | arg)); | ||
504 | 477 | ||
505 | /* Get the entire name string from the AML stream */ | 478 | /* Get the entire name string from the AML stream */ |
506 | 479 | ||
507 | status = acpi_ex_get_name_string (ACPI_TYPE_ANY, arg->common.value.buffer, | 480 | status = |
508 | &name_string, &name_length); | 481 | acpi_ex_get_name_string(ACPI_TYPE_ANY, |
482 | arg->common.value.buffer, | ||
483 | &name_string, &name_length); | ||
509 | 484 | ||
510 | if (ACPI_FAILURE (status)) { | 485 | if (ACPI_FAILURE(status)) { |
511 | return_ACPI_STATUS (status); | 486 | return_ACPI_STATUS(status); |
512 | } | 487 | } |
513 | 488 | ||
514 | /* All prefixes have been handled, and the name is in name_string */ | 489 | /* All prefixes have been handled, and the name is in name_string */ |
@@ -523,13 +498,14 @@ acpi_ds_create_operand ( | |||
523 | * actual opcode exists. | 498 | * actual opcode exists. |
524 | */ | 499 | */ |
525 | if ((walk_state->deferred_node) && | 500 | if ((walk_state->deferred_node) && |
526 | (walk_state->deferred_node->type == ACPI_TYPE_BUFFER_FIELD) && | 501 | (walk_state->deferred_node->type == ACPI_TYPE_BUFFER_FIELD) |
527 | (arg_index != 0)) { | 502 | && (arg_index != 0)) { |
528 | obj_desc = ACPI_CAST_PTR ( | 503 | obj_desc = |
529 | union acpi_operand_object, walk_state->deferred_node); | 504 | ACPI_CAST_PTR(union acpi_operand_object, |
505 | walk_state->deferred_node); | ||
530 | status = AE_OK; | 506 | status = AE_OK; |
531 | } | 507 | } else { /* All other opcodes */ |
532 | else /* All other opcodes */ { | 508 | |
533 | /* | 509 | /* |
534 | * Differentiate between a namespace "create" operation | 510 | * Differentiate between a namespace "create" operation |
535 | * versus a "lookup" operation (IMODE_LOAD_PASS2 vs. | 511 | * versus a "lookup" operation (IMODE_LOAD_PASS2 vs. |
@@ -537,43 +513,51 @@ acpi_ds_create_operand ( | |||
537 | * namespace objects during the execution of control methods. | 513 | * namespace objects during the execution of control methods. |
538 | */ | 514 | */ |
539 | parent_op = arg->common.parent; | 515 | parent_op = arg->common.parent; |
540 | op_info = acpi_ps_get_opcode_info (parent_op->common.aml_opcode); | 516 | op_info = |
541 | if ((op_info->flags & AML_NSNODE) && | 517 | acpi_ps_get_opcode_info(parent_op->common. |
542 | (parent_op->common.aml_opcode != AML_INT_METHODCALL_OP) && | 518 | aml_opcode); |
543 | (parent_op->common.aml_opcode != AML_REGION_OP) && | 519 | if ((op_info->flags & AML_NSNODE) |
544 | (parent_op->common.aml_opcode != AML_INT_NAMEPATH_OP)) { | 520 | && (parent_op->common.aml_opcode != |
521 | AML_INT_METHODCALL_OP) | ||
522 | && (parent_op->common.aml_opcode != AML_REGION_OP) | ||
523 | && (parent_op->common.aml_opcode != | ||
524 | AML_INT_NAMEPATH_OP)) { | ||
545 | /* Enter name into namespace if not found */ | 525 | /* Enter name into namespace if not found */ |
546 | 526 | ||
547 | interpreter_mode = ACPI_IMODE_LOAD_PASS2; | 527 | interpreter_mode = ACPI_IMODE_LOAD_PASS2; |
548 | } | 528 | } else { |
549 | else { | ||
550 | /* Return a failure if name not found */ | 529 | /* Return a failure if name not found */ |
551 | 530 | ||
552 | interpreter_mode = ACPI_IMODE_EXECUTE; | 531 | interpreter_mode = ACPI_IMODE_EXECUTE; |
553 | } | 532 | } |
554 | 533 | ||
555 | status = acpi_ns_lookup (walk_state->scope_info, name_string, | 534 | status = |
556 | ACPI_TYPE_ANY, interpreter_mode, | 535 | acpi_ns_lookup(walk_state->scope_info, name_string, |
557 | ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, | 536 | ACPI_TYPE_ANY, interpreter_mode, |
558 | walk_state, | 537 | ACPI_NS_SEARCH_PARENT | |
559 | ACPI_CAST_INDIRECT_PTR (struct acpi_namespace_node, &obj_desc)); | 538 | ACPI_NS_DONT_OPEN_SCOPE, walk_state, |
539 | ACPI_CAST_INDIRECT_PTR(struct | ||
540 | acpi_namespace_node, | ||
541 | &obj_desc)); | ||
560 | /* | 542 | /* |
561 | * The only case where we pass through (ignore) a NOT_FOUND | 543 | * The only case where we pass through (ignore) a NOT_FOUND |
562 | * error is for the cond_ref_of opcode. | 544 | * error is for the cond_ref_of opcode. |
563 | */ | 545 | */ |
564 | if (status == AE_NOT_FOUND) { | 546 | if (status == AE_NOT_FOUND) { |
565 | if (parent_op->common.aml_opcode == AML_COND_REF_OF_OP) { | 547 | if (parent_op->common.aml_opcode == |
548 | AML_COND_REF_OF_OP) { | ||
566 | /* | 549 | /* |
567 | * For the Conditional Reference op, it's OK if | 550 | * For the Conditional Reference op, it's OK if |
568 | * the name is not found; We just need a way to | 551 | * the name is not found; We just need a way to |
569 | * indicate this to the interpreter, set the | 552 | * indicate this to the interpreter, set the |
570 | * object to the root | 553 | * object to the root |
571 | */ | 554 | */ |
572 | obj_desc = ACPI_CAST_PTR ( | 555 | obj_desc = |
573 | union acpi_operand_object, acpi_gbl_root_node); | 556 | ACPI_CAST_PTR(union |
557 | acpi_operand_object, | ||
558 | acpi_gbl_root_node); | ||
574 | status = AE_OK; | 559 | status = AE_OK; |
575 | } | 560 | } else { |
576 | else { | ||
577 | /* | 561 | /* |
578 | * We just plain didn't find it -- which is a | 562 | * We just plain didn't find it -- which is a |
579 | * very serious error at this point | 563 | * very serious error at this point |
@@ -582,30 +566,30 @@ acpi_ds_create_operand ( | |||
582 | } | 566 | } |
583 | } | 567 | } |
584 | 568 | ||
585 | if (ACPI_FAILURE (status)) { | 569 | if (ACPI_FAILURE(status)) { |
586 | ACPI_REPORT_NSERROR (name_string, status); | 570 | ACPI_REPORT_NSERROR(name_string, status); |
587 | } | 571 | } |
588 | } | 572 | } |
589 | 573 | ||
590 | /* Free the namestring created above */ | 574 | /* Free the namestring created above */ |
591 | 575 | ||
592 | ACPI_MEM_FREE (name_string); | 576 | ACPI_MEM_FREE(name_string); |
593 | 577 | ||
594 | /* Check status from the lookup */ | 578 | /* Check status from the lookup */ |
595 | 579 | ||
596 | if (ACPI_FAILURE (status)) { | 580 | if (ACPI_FAILURE(status)) { |
597 | return_ACPI_STATUS (status); | 581 | return_ACPI_STATUS(status); |
598 | } | 582 | } |
599 | 583 | ||
600 | /* Put the resulting object onto the current object stack */ | 584 | /* Put the resulting object onto the current object stack */ |
601 | 585 | ||
602 | status = acpi_ds_obj_stack_push (obj_desc, walk_state); | 586 | status = acpi_ds_obj_stack_push(obj_desc, walk_state); |
603 | if (ACPI_FAILURE (status)) { | 587 | if (ACPI_FAILURE(status)) { |
604 | return_ACPI_STATUS (status); | 588 | return_ACPI_STATUS(status); |
605 | } | 589 | } |
606 | ACPI_DEBUGGER_EXEC (acpi_db_display_argument_object (obj_desc, walk_state)); | 590 | ACPI_DEBUGGER_EXEC(acpi_db_display_argument_object |
607 | } | 591 | (obj_desc, walk_state)); |
608 | else { | 592 | } else { |
609 | /* Check for null name case */ | 593 | /* Check for null name case */ |
610 | 594 | ||
611 | if (arg->common.aml_opcode == AML_INT_NAMEPATH_OP) { | 595 | if (arg->common.aml_opcode == AML_INT_NAMEPATH_OP) { |
@@ -615,77 +599,83 @@ acpi_ds_create_operand ( | |||
615 | * in the original ASL. Create a Zero Constant for a | 599 | * in the original ASL. Create a Zero Constant for a |
616 | * placeholder. (Store to a constant is a Noop.) | 600 | * placeholder. (Store to a constant is a Noop.) |
617 | */ | 601 | */ |
618 | opcode = AML_ZERO_OP; /* Has no arguments! */ | 602 | opcode = AML_ZERO_OP; /* Has no arguments! */ |
619 | 603 | ||
620 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, | 604 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
621 | "Null namepath: Arg=%p\n", arg)); | 605 | "Null namepath: Arg=%p\n", arg)); |
622 | } | 606 | } else { |
623 | else { | ||
624 | opcode = arg->common.aml_opcode; | 607 | opcode = arg->common.aml_opcode; |
625 | } | 608 | } |
626 | 609 | ||
627 | /* Get the object type of the argument */ | 610 | /* Get the object type of the argument */ |
628 | 611 | ||
629 | op_info = acpi_ps_get_opcode_info (opcode); | 612 | op_info = acpi_ps_get_opcode_info(opcode); |
630 | if (op_info->object_type == ACPI_TYPE_INVALID) { | 613 | if (op_info->object_type == ACPI_TYPE_INVALID) { |
631 | return_ACPI_STATUS (AE_NOT_IMPLEMENTED); | 614 | return_ACPI_STATUS(AE_NOT_IMPLEMENTED); |
632 | } | 615 | } |
633 | 616 | ||
634 | if (op_info->flags & AML_HAS_RETVAL) { | 617 | if (op_info->flags & AML_HAS_RETVAL) { |
635 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, | 618 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
636 | "Argument previously created, already stacked \n")); | 619 | "Argument previously created, already stacked \n")); |
637 | 620 | ||
638 | ACPI_DEBUGGER_EXEC (acpi_db_display_argument_object ( | 621 | ACPI_DEBUGGER_EXEC(acpi_db_display_argument_object |
639 | walk_state->operands [walk_state->num_operands - 1], walk_state)); | 622 | (walk_state-> |
623 | operands[walk_state->num_operands - | ||
624 | 1], walk_state)); | ||
640 | 625 | ||
641 | /* | 626 | /* |
642 | * Use value that was already previously returned | 627 | * Use value that was already previously returned |
643 | * by the evaluation of this argument | 628 | * by the evaluation of this argument |
644 | */ | 629 | */ |
645 | status = acpi_ds_result_pop_from_bottom (&obj_desc, walk_state); | 630 | status = |
646 | if (ACPI_FAILURE (status)) { | 631 | acpi_ds_result_pop_from_bottom(&obj_desc, |
632 | walk_state); | ||
633 | if (ACPI_FAILURE(status)) { | ||
647 | /* | 634 | /* |
648 | * Only error is underflow, and this indicates | 635 | * Only error is underflow, and this indicates |
649 | * a missing or null operand! | 636 | * a missing or null operand! |
650 | */ | 637 | */ |
651 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 638 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
652 | "Missing or null operand, %s\n", | 639 | "Missing or null operand, %s\n", |
653 | acpi_format_exception (status))); | 640 | acpi_format_exception |
654 | return_ACPI_STATUS (status); | 641 | (status))); |
642 | return_ACPI_STATUS(status); | ||
655 | } | 643 | } |
656 | } | 644 | } else { |
657 | else { | ||
658 | /* Create an ACPI_INTERNAL_OBJECT for the argument */ | 645 | /* Create an ACPI_INTERNAL_OBJECT for the argument */ |
659 | 646 | ||
660 | obj_desc = acpi_ut_create_internal_object (op_info->object_type); | 647 | obj_desc = |
648 | acpi_ut_create_internal_object(op_info-> | ||
649 | object_type); | ||
661 | if (!obj_desc) { | 650 | if (!obj_desc) { |
662 | return_ACPI_STATUS (AE_NO_MEMORY); | 651 | return_ACPI_STATUS(AE_NO_MEMORY); |
663 | } | 652 | } |
664 | 653 | ||
665 | /* Initialize the new object */ | 654 | /* Initialize the new object */ |
666 | 655 | ||
667 | status = acpi_ds_init_object_from_op ( | 656 | status = |
668 | walk_state, arg, opcode, &obj_desc); | 657 | acpi_ds_init_object_from_op(walk_state, arg, opcode, |
669 | if (ACPI_FAILURE (status)) { | 658 | &obj_desc); |
670 | acpi_ut_delete_object_desc (obj_desc); | 659 | if (ACPI_FAILURE(status)) { |
671 | return_ACPI_STATUS (status); | 660 | acpi_ut_delete_object_desc(obj_desc); |
661 | return_ACPI_STATUS(status); | ||
672 | } | 662 | } |
673 | } | 663 | } |
674 | 664 | ||
675 | /* Put the operand object on the object stack */ | 665 | /* Put the operand object on the object stack */ |
676 | 666 | ||
677 | status = acpi_ds_obj_stack_push (obj_desc, walk_state); | 667 | status = acpi_ds_obj_stack_push(obj_desc, walk_state); |
678 | if (ACPI_FAILURE (status)) { | 668 | if (ACPI_FAILURE(status)) { |
679 | return_ACPI_STATUS (status); | 669 | return_ACPI_STATUS(status); |
680 | } | 670 | } |
681 | 671 | ||
682 | ACPI_DEBUGGER_EXEC (acpi_db_display_argument_object (obj_desc, walk_state)); | 672 | ACPI_DEBUGGER_EXEC(acpi_db_display_argument_object |
673 | (obj_desc, walk_state)); | ||
683 | } | 674 | } |
684 | 675 | ||
685 | return_ACPI_STATUS (AE_OK); | 676 | return_ACPI_STATUS(AE_OK); |
686 | } | 677 | } |
687 | 678 | ||
688 | |||
689 | /******************************************************************************* | 679 | /******************************************************************************* |
690 | * | 680 | * |
691 | * FUNCTION: acpi_ds_create_operands | 681 | * FUNCTION: acpi_ds_create_operands |
@@ -702,29 +692,27 @@ acpi_ds_create_operand ( | |||
702 | ******************************************************************************/ | 692 | ******************************************************************************/ |
703 | 693 | ||
704 | acpi_status | 694 | acpi_status |
705 | acpi_ds_create_operands ( | 695 | acpi_ds_create_operands(struct acpi_walk_state *walk_state, |
706 | struct acpi_walk_state *walk_state, | 696 | union acpi_parse_object *first_arg) |
707 | union acpi_parse_object *first_arg) | ||
708 | { | 697 | { |
709 | acpi_status status = AE_OK; | 698 | acpi_status status = AE_OK; |
710 | union acpi_parse_object *arg; | 699 | union acpi_parse_object *arg; |
711 | u32 arg_count = 0; | 700 | u32 arg_count = 0; |
712 | |||
713 | |||
714 | ACPI_FUNCTION_TRACE_PTR ("ds_create_operands", first_arg); | ||
715 | 701 | ||
702 | ACPI_FUNCTION_TRACE_PTR("ds_create_operands", first_arg); | ||
716 | 703 | ||
717 | /* For all arguments in the list... */ | 704 | /* For all arguments in the list... */ |
718 | 705 | ||
719 | arg = first_arg; | 706 | arg = first_arg; |
720 | while (arg) { | 707 | while (arg) { |
721 | status = acpi_ds_create_operand (walk_state, arg, arg_count); | 708 | status = acpi_ds_create_operand(walk_state, arg, arg_count); |
722 | if (ACPI_FAILURE (status)) { | 709 | if (ACPI_FAILURE(status)) { |
723 | goto cleanup; | 710 | goto cleanup; |
724 | } | 711 | } |
725 | 712 | ||
726 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Arg #%d (%p) done, Arg1=%p\n", | 713 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
727 | arg_count, arg, first_arg)); | 714 | "Arg #%d (%p) done, Arg1=%p\n", arg_count, |
715 | arg, first_arg)); | ||
728 | 716 | ||
729 | /* Move on to next argument, if any */ | 717 | /* Move on to next argument, if any */ |
730 | 718 | ||
@@ -732,20 +720,17 @@ acpi_ds_create_operands ( | |||
732 | arg_count++; | 720 | arg_count++; |
733 | } | 721 | } |
734 | 722 | ||
735 | return_ACPI_STATUS (status); | 723 | return_ACPI_STATUS(status); |
736 | |||
737 | 724 | ||
738 | cleanup: | 725 | cleanup: |
739 | /* | 726 | /* |
740 | * We must undo everything done above; meaning that we must | 727 | * We must undo everything done above; meaning that we must |
741 | * pop everything off of the operand stack and delete those | 728 | * pop everything off of the operand stack and delete those |
742 | * objects | 729 | * objects |
743 | */ | 730 | */ |
744 | (void) acpi_ds_obj_stack_pop_and_delete (arg_count, walk_state); | 731 | (void)acpi_ds_obj_stack_pop_and_delete(arg_count, walk_state); |
745 | 732 | ||
746 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "While creating Arg %d - %s\n", | 733 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "While creating Arg %d - %s\n", |
747 | (arg_count + 1), acpi_format_exception (status))); | 734 | (arg_count + 1), acpi_format_exception(status))); |
748 | return_ACPI_STATUS (status); | 735 | return_ACPI_STATUS(status); |
749 | } | 736 | } |
750 | |||
751 | |||