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 | |
parent | c65ade4dc8b486e8c8b9b0a6399789a5428e2039 (diff) |
[ACPI] Lindent all ACPI files
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/dispatcher')
-rw-r--r-- | drivers/acpi/dispatcher/dsfield.c | 346 | ||||
-rw-r--r-- | drivers/acpi/dispatcher/dsinit.c | 123 | ||||
-rw-r--r-- | drivers/acpi/dispatcher/dsmethod.c | 354 | ||||
-rw-r--r-- | drivers/acpi/dispatcher/dsmthdat.c | 413 | ||||
-rw-r--r-- | drivers/acpi/dispatcher/dsobject.c | 329 | ||||
-rw-r--r-- | drivers/acpi/dispatcher/dsopcode.c | 710 | ||||
-rw-r--r-- | drivers/acpi/dispatcher/dsutils.c | 421 | ||||
-rw-r--r-- | drivers/acpi/dispatcher/dswexec.c | 519 | ||||
-rw-r--r-- | drivers/acpi/dispatcher/dswload.c | 488 | ||||
-rw-r--r-- | drivers/acpi/dispatcher/dswscope.c | 139 | ||||
-rw-r--r-- | drivers/acpi/dispatcher/dswstate.c | 640 |
11 files changed, 2154 insertions, 2328 deletions
diff --git a/drivers/acpi/dispatcher/dsfield.c b/drivers/acpi/dispatcher/dsfield.c index 84193983d6ba..2022aeaecfbb 100644 --- a/drivers/acpi/dispatcher/dsfield.c +++ b/drivers/acpi/dispatcher/dsfield.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/amlcode.h> | 45 | #include <acpi/amlcode.h> |
47 | #include <acpi/acdispat.h> | 46 | #include <acpi/acdispat.h> |
@@ -49,18 +48,14 @@ | |||
49 | #include <acpi/acnamesp.h> | 48 | #include <acpi/acnamesp.h> |
50 | #include <acpi/acparser.h> | 49 | #include <acpi/acparser.h> |
51 | 50 | ||
52 | |||
53 | #define _COMPONENT ACPI_DISPATCHER | 51 | #define _COMPONENT ACPI_DISPATCHER |
54 | ACPI_MODULE_NAME ("dsfield") | 52 | ACPI_MODULE_NAME("dsfield") |
55 | 53 | ||
56 | /* Local prototypes */ | 54 | /* Local prototypes */ |
57 | |||
58 | static acpi_status | 55 | static acpi_status |
59 | acpi_ds_get_field_names ( | 56 | acpi_ds_get_field_names(struct acpi_create_field_info *info, |
60 | struct acpi_create_field_info *info, | 57 | struct acpi_walk_state *walk_state, |
61 | struct acpi_walk_state *walk_state, | 58 | union acpi_parse_object *arg); |
62 | union acpi_parse_object *arg); | ||
63 | |||
64 | 59 | ||
65 | /******************************************************************************* | 60 | /******************************************************************************* |
66 | * | 61 | * |
@@ -82,41 +77,36 @@ acpi_ds_get_field_names ( | |||
82 | ******************************************************************************/ | 77 | ******************************************************************************/ |
83 | 78 | ||
84 | acpi_status | 79 | acpi_status |
85 | acpi_ds_create_buffer_field ( | 80 | acpi_ds_create_buffer_field(union acpi_parse_object *op, |
86 | union acpi_parse_object *op, | 81 | struct acpi_walk_state *walk_state) |
87 | struct acpi_walk_state *walk_state) | ||
88 | { | 82 | { |
89 | union acpi_parse_object *arg; | 83 | union acpi_parse_object *arg; |
90 | struct acpi_namespace_node *node; | 84 | struct acpi_namespace_node *node; |
91 | acpi_status status; | 85 | acpi_status status; |
92 | union acpi_operand_object *obj_desc; | 86 | union acpi_operand_object *obj_desc; |
93 | union acpi_operand_object *second_desc = NULL; | 87 | union acpi_operand_object *second_desc = NULL; |
94 | u32 flags; | 88 | u32 flags; |
95 | |||
96 | |||
97 | ACPI_FUNCTION_TRACE ("ds_create_buffer_field"); | ||
98 | 89 | ||
90 | ACPI_FUNCTION_TRACE("ds_create_buffer_field"); | ||
99 | 91 | ||
100 | /* Get the name_string argument */ | 92 | /* Get the name_string argument */ |
101 | 93 | ||
102 | if (op->common.aml_opcode == AML_CREATE_FIELD_OP) { | 94 | if (op->common.aml_opcode == AML_CREATE_FIELD_OP) { |
103 | arg = acpi_ps_get_arg (op, 3); | 95 | arg = acpi_ps_get_arg(op, 3); |
104 | } | 96 | } else { |
105 | else { | ||
106 | /* Create Bit/Byte/Word/Dword field */ | 97 | /* Create Bit/Byte/Word/Dword field */ |
107 | 98 | ||
108 | arg = acpi_ps_get_arg (op, 2); | 99 | arg = acpi_ps_get_arg(op, 2); |
109 | } | 100 | } |
110 | 101 | ||
111 | if (!arg) { | 102 | if (!arg) { |
112 | return_ACPI_STATUS (AE_AML_NO_OPERAND); | 103 | return_ACPI_STATUS(AE_AML_NO_OPERAND); |
113 | } | 104 | } |
114 | 105 | ||
115 | if (walk_state->deferred_node) { | 106 | if (walk_state->deferred_node) { |
116 | node = walk_state->deferred_node; | 107 | node = walk_state->deferred_node; |
117 | status = AE_OK; | 108 | status = AE_OK; |
118 | } | 109 | } else { |
119 | else { | ||
120 | /* | 110 | /* |
121 | * During the load phase, we want to enter the name of the field into | 111 | * During the load phase, we want to enter the name of the field into |
122 | * the namespace. During the execute phase (when we evaluate the size | 112 | * the namespace. During the execute phase (when we evaluate the size |
@@ -124,21 +114,22 @@ acpi_ds_create_buffer_field ( | |||
124 | */ | 114 | */ |
125 | if (walk_state->parse_flags & ACPI_PARSE_EXECUTE) { | 115 | if (walk_state->parse_flags & ACPI_PARSE_EXECUTE) { |
126 | flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE; | 116 | flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE; |
127 | } | 117 | } else { |
128 | else { | ||
129 | flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | | 118 | flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | |
130 | ACPI_NS_ERROR_IF_FOUND; | 119 | ACPI_NS_ERROR_IF_FOUND; |
131 | } | 120 | } |
132 | 121 | ||
133 | /* | 122 | /* |
134 | * Enter the name_string into the namespace | 123 | * Enter the name_string into the namespace |
135 | */ | 124 | */ |
136 | status = acpi_ns_lookup (walk_state->scope_info, arg->common.value.string, | 125 | status = |
137 | ACPI_TYPE_ANY, ACPI_IMODE_LOAD_PASS1, | 126 | acpi_ns_lookup(walk_state->scope_info, |
138 | flags, walk_state, &(node)); | 127 | arg->common.value.string, ACPI_TYPE_ANY, |
139 | if (ACPI_FAILURE (status)) { | 128 | ACPI_IMODE_LOAD_PASS1, flags, walk_state, |
140 | ACPI_REPORT_NSERROR (arg->common.value.string, status); | 129 | &(node)); |
141 | return_ACPI_STATUS (status); | 130 | if (ACPI_FAILURE(status)) { |
131 | ACPI_REPORT_NSERROR(arg->common.value.string, status); | ||
132 | return_ACPI_STATUS(status); | ||
142 | } | 133 | } |
143 | } | 134 | } |
144 | 135 | ||
@@ -153,9 +144,9 @@ acpi_ds_create_buffer_field ( | |||
153 | * and we need to create the field object. Otherwise, this was a lookup | 144 | * and we need to create the field object. Otherwise, this was a lookup |
154 | * of an existing node and we don't want to create the field object again. | 145 | * of an existing node and we don't want to create the field object again. |
155 | */ | 146 | */ |
156 | obj_desc = acpi_ns_get_attached_object (node); | 147 | obj_desc = acpi_ns_get_attached_object(node); |
157 | if (obj_desc) { | 148 | if (obj_desc) { |
158 | return_ACPI_STATUS (AE_OK); | 149 | return_ACPI_STATUS(AE_OK); |
159 | } | 150 | } |
160 | 151 | ||
161 | /* | 152 | /* |
@@ -165,7 +156,7 @@ acpi_ds_create_buffer_field ( | |||
165 | 156 | ||
166 | /* Create the buffer field object */ | 157 | /* Create the buffer field object */ |
167 | 158 | ||
168 | obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_BUFFER_FIELD); | 159 | obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_BUFFER_FIELD); |
169 | if (!obj_desc) { | 160 | if (!obj_desc) { |
170 | status = AE_NO_MEMORY; | 161 | status = AE_NO_MEMORY; |
171 | goto cleanup; | 162 | goto cleanup; |
@@ -176,28 +167,26 @@ acpi_ds_create_buffer_field ( | |||
176 | * opcode and operands -- since the buffer and index | 167 | * opcode and operands -- since the buffer and index |
177 | * operands must be evaluated. | 168 | * operands must be evaluated. |
178 | */ | 169 | */ |
179 | second_desc = obj_desc->common.next_object; | 170 | second_desc = obj_desc->common.next_object; |
180 | second_desc->extra.aml_start = op->named.data; | 171 | second_desc->extra.aml_start = op->named.data; |
181 | second_desc->extra.aml_length = op->named.length; | 172 | second_desc->extra.aml_length = op->named.length; |
182 | obj_desc->buffer_field.node = node; | 173 | obj_desc->buffer_field.node = node; |
183 | 174 | ||
184 | /* Attach constructed field descriptors to parent node */ | 175 | /* Attach constructed field descriptors to parent node */ |
185 | 176 | ||
186 | status = acpi_ns_attach_object (node, obj_desc, ACPI_TYPE_BUFFER_FIELD); | 177 | status = acpi_ns_attach_object(node, obj_desc, ACPI_TYPE_BUFFER_FIELD); |
187 | if (ACPI_FAILURE (status)) { | 178 | if (ACPI_FAILURE(status)) { |
188 | goto cleanup; | 179 | goto cleanup; |
189 | } | 180 | } |
190 | 181 | ||
191 | 182 | cleanup: | |
192 | cleanup: | ||
193 | 183 | ||
194 | /* Remove local reference to the object */ | 184 | /* Remove local reference to the object */ |
195 | 185 | ||
196 | acpi_ut_remove_reference (obj_desc); | 186 | acpi_ut_remove_reference(obj_desc); |
197 | return_ACPI_STATUS (status); | 187 | return_ACPI_STATUS(status); |
198 | } | 188 | } |
199 | 189 | ||
200 | |||
201 | /******************************************************************************* | 190 | /******************************************************************************* |
202 | * | 191 | * |
203 | * FUNCTION: acpi_ds_get_field_names | 192 | * FUNCTION: acpi_ds_get_field_names |
@@ -214,17 +203,14 @@ cleanup: | |||
214 | ******************************************************************************/ | 203 | ******************************************************************************/ |
215 | 204 | ||
216 | static acpi_status | 205 | static acpi_status |
217 | acpi_ds_get_field_names ( | 206 | acpi_ds_get_field_names(struct acpi_create_field_info *info, |
218 | struct acpi_create_field_info *info, | 207 | struct acpi_walk_state *walk_state, |
219 | struct acpi_walk_state *walk_state, | 208 | union acpi_parse_object *arg) |
220 | union acpi_parse_object *arg) | ||
221 | { | 209 | { |
222 | acpi_status status; | 210 | acpi_status status; |
223 | acpi_integer position; | 211 | acpi_integer position; |
224 | |||
225 | |||
226 | ACPI_FUNCTION_TRACE_PTR ("ds_get_field_names", info); | ||
227 | 212 | ||
213 | ACPI_FUNCTION_TRACE_PTR("ds_get_field_names", info); | ||
228 | 214 | ||
229 | /* First field starts at bit zero */ | 215 | /* First field starts at bit zero */ |
230 | 216 | ||
@@ -243,18 +229,16 @@ acpi_ds_get_field_names ( | |||
243 | case AML_INT_RESERVEDFIELD_OP: | 229 | case AML_INT_RESERVEDFIELD_OP: |
244 | 230 | ||
245 | position = (acpi_integer) info->field_bit_position | 231 | position = (acpi_integer) info->field_bit_position |
246 | + (acpi_integer) arg->common.value.size; | 232 | + (acpi_integer) arg->common.value.size; |
247 | 233 | ||
248 | if (position > ACPI_UINT32_MAX) { | 234 | if (position > ACPI_UINT32_MAX) { |
249 | ACPI_REPORT_ERROR (( | 235 | ACPI_REPORT_ERROR(("Bit offset within field too large (> 0xFFFFFFFF)\n")); |
250 | "Bit offset within field too large (> 0xFFFFFFFF)\n")); | 236 | return_ACPI_STATUS(AE_SUPPORT); |
251 | return_ACPI_STATUS (AE_SUPPORT); | ||
252 | } | 237 | } |
253 | 238 | ||
254 | info->field_bit_position = (u32) position; | 239 | info->field_bit_position = (u32) position; |
255 | break; | 240 | break; |
256 | 241 | ||
257 | |||
258 | case AML_INT_ACCESSFIELD_OP: | 242 | case AML_INT_ACCESSFIELD_OP: |
259 | 243 | ||
260 | /* | 244 | /* |
@@ -266,73 +250,70 @@ acpi_ds_get_field_names ( | |||
266 | * ACCESS_TYPE bits | 250 | * ACCESS_TYPE bits |
267 | */ | 251 | */ |
268 | info->field_flags = (u8) | 252 | info->field_flags = (u8) |
269 | ((info->field_flags & ~(AML_FIELD_ACCESS_TYPE_MASK)) | | 253 | ((info-> |
270 | ((u8) ((u32) arg->common.value.integer >> 8))); | 254 | field_flags & ~(AML_FIELD_ACCESS_TYPE_MASK)) | |
255 | ((u8) ((u32) arg->common.value.integer >> 8))); | ||
271 | 256 | ||
272 | info->attribute = (u8) (arg->common.value.integer); | 257 | info->attribute = (u8) (arg->common.value.integer); |
273 | break; | 258 | break; |
274 | 259 | ||
275 | |||
276 | case AML_INT_NAMEDFIELD_OP: | 260 | case AML_INT_NAMEDFIELD_OP: |
277 | 261 | ||
278 | /* Lookup the name */ | 262 | /* Lookup the name */ |
279 | 263 | ||
280 | status = acpi_ns_lookup (walk_state->scope_info, | 264 | status = acpi_ns_lookup(walk_state->scope_info, |
281 | (char *) &arg->named.name, | 265 | (char *)&arg->named.name, |
282 | info->field_type, ACPI_IMODE_EXECUTE, | 266 | info->field_type, |
283 | ACPI_NS_DONT_OPEN_SCOPE, | 267 | ACPI_IMODE_EXECUTE, |
284 | walk_state, &info->field_node); | 268 | ACPI_NS_DONT_OPEN_SCOPE, |
285 | if (ACPI_FAILURE (status)) { | 269 | walk_state, &info->field_node); |
286 | ACPI_REPORT_NSERROR ((char *) &arg->named.name, status); | 270 | if (ACPI_FAILURE(status)) { |
271 | ACPI_REPORT_NSERROR((char *)&arg->named.name, | ||
272 | status); | ||
287 | if (status != AE_ALREADY_EXISTS) { | 273 | if (status != AE_ALREADY_EXISTS) { |
288 | return_ACPI_STATUS (status); | 274 | return_ACPI_STATUS(status); |
289 | } | 275 | } |
290 | 276 | ||
291 | /* Already exists, ignore error */ | 277 | /* Already exists, ignore error */ |
292 | } | 278 | } else { |
293 | else { | ||
294 | arg->common.node = info->field_node; | 279 | arg->common.node = info->field_node; |
295 | info->field_bit_length = arg->common.value.size; | 280 | info->field_bit_length = arg->common.value.size; |
296 | 281 | ||
297 | /* Create and initialize an object for the new Field Node */ | 282 | /* Create and initialize an object for the new Field Node */ |
298 | 283 | ||
299 | status = acpi_ex_prep_field_value (info); | 284 | status = acpi_ex_prep_field_value(info); |
300 | if (ACPI_FAILURE (status)) { | 285 | if (ACPI_FAILURE(status)) { |
301 | return_ACPI_STATUS (status); | 286 | return_ACPI_STATUS(status); |
302 | } | 287 | } |
303 | } | 288 | } |
304 | 289 | ||
305 | /* Keep track of bit position for the next field */ | 290 | /* Keep track of bit position for the next field */ |
306 | 291 | ||
307 | position = (acpi_integer) info->field_bit_position | 292 | position = (acpi_integer) info->field_bit_position |
308 | + (acpi_integer) arg->common.value.size; | 293 | + (acpi_integer) arg->common.value.size; |
309 | 294 | ||
310 | if (position > ACPI_UINT32_MAX) { | 295 | if (position > ACPI_UINT32_MAX) { |
311 | ACPI_REPORT_ERROR (( | 296 | ACPI_REPORT_ERROR(("Field [%4.4s] bit offset too large (> 0xFFFFFFFF)\n", (char *)&info->field_node->name)); |
312 | "Field [%4.4s] bit offset too large (> 0xFFFFFFFF)\n", | 297 | return_ACPI_STATUS(AE_SUPPORT); |
313 | (char *) &info->field_node->name)); | ||
314 | return_ACPI_STATUS (AE_SUPPORT); | ||
315 | } | 298 | } |
316 | 299 | ||
317 | info->field_bit_position += info->field_bit_length; | 300 | info->field_bit_position += info->field_bit_length; |
318 | break; | 301 | break; |
319 | 302 | ||
320 | |||
321 | default: | 303 | default: |
322 | 304 | ||
323 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 305 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
324 | "Invalid opcode in field list: %X\n", | 306 | "Invalid opcode in field list: %X\n", |
325 | arg->common.aml_opcode)); | 307 | arg->common.aml_opcode)); |
326 | return_ACPI_STATUS (AE_AML_BAD_OPCODE); | 308 | return_ACPI_STATUS(AE_AML_BAD_OPCODE); |
327 | } | 309 | } |
328 | 310 | ||
329 | arg = arg->common.next; | 311 | arg = arg->common.next; |
330 | } | 312 | } |
331 | 313 | ||
332 | return_ACPI_STATUS (AE_OK); | 314 | return_ACPI_STATUS(AE_OK); |
333 | } | 315 | } |
334 | 316 | ||
335 | |||
336 | /******************************************************************************* | 317 | /******************************************************************************* |
337 | * | 318 | * |
338 | * FUNCTION: acpi_ds_create_field | 319 | * FUNCTION: acpi_ds_create_field |
@@ -348,29 +329,28 @@ acpi_ds_get_field_names ( | |||
348 | ******************************************************************************/ | 329 | ******************************************************************************/ |
349 | 330 | ||
350 | acpi_status | 331 | acpi_status |
351 | acpi_ds_create_field ( | 332 | acpi_ds_create_field(union acpi_parse_object *op, |
352 | union acpi_parse_object *op, | 333 | struct acpi_namespace_node *region_node, |
353 | struct acpi_namespace_node *region_node, | 334 | struct acpi_walk_state *walk_state) |
354 | struct acpi_walk_state *walk_state) | ||
355 | { | 335 | { |
356 | acpi_status status; | 336 | acpi_status status; |
357 | union acpi_parse_object *arg; | 337 | union acpi_parse_object *arg; |
358 | struct acpi_create_field_info info; | 338 | struct acpi_create_field_info info; |
359 | |||
360 | |||
361 | ACPI_FUNCTION_TRACE_PTR ("ds_create_field", op); | ||
362 | 339 | ||
340 | ACPI_FUNCTION_TRACE_PTR("ds_create_field", op); | ||
363 | 341 | ||
364 | /* First arg is the name of the parent op_region (must already exist) */ | 342 | /* First arg is the name of the parent op_region (must already exist) */ |
365 | 343 | ||
366 | arg = op->common.value.arg; | 344 | arg = op->common.value.arg; |
367 | if (!region_node) { | 345 | if (!region_node) { |
368 | status = acpi_ns_lookup (walk_state->scope_info, arg->common.value.name, | 346 | status = |
369 | ACPI_TYPE_REGION, ACPI_IMODE_EXECUTE, | 347 | acpi_ns_lookup(walk_state->scope_info, |
370 | ACPI_NS_SEARCH_PARENT, walk_state, ®ion_node); | 348 | arg->common.value.name, ACPI_TYPE_REGION, |
371 | if (ACPI_FAILURE (status)) { | 349 | ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, |
372 | ACPI_REPORT_NSERROR (arg->common.value.name, status); | 350 | walk_state, ®ion_node); |
373 | return_ACPI_STATUS (status); | 351 | if (ACPI_FAILURE(status)) { |
352 | ACPI_REPORT_NSERROR(arg->common.value.name, status); | ||
353 | return_ACPI_STATUS(status); | ||
374 | } | 354 | } |
375 | } | 355 | } |
376 | 356 | ||
@@ -385,12 +365,11 @@ acpi_ds_create_field ( | |||
385 | info.field_type = ACPI_TYPE_LOCAL_REGION_FIELD; | 365 | info.field_type = ACPI_TYPE_LOCAL_REGION_FIELD; |
386 | info.region_node = region_node; | 366 | info.region_node = region_node; |
387 | 367 | ||
388 | status = acpi_ds_get_field_names (&info, walk_state, arg->common.next); | 368 | status = acpi_ds_get_field_names(&info, walk_state, arg->common.next); |
389 | 369 | ||
390 | return_ACPI_STATUS (status); | 370 | return_ACPI_STATUS(status); |
391 | } | 371 | } |
392 | 372 | ||
393 | |||
394 | /******************************************************************************* | 373 | /******************************************************************************* |
395 | * | 374 | * |
396 | * FUNCTION: acpi_ds_init_field_objects | 375 | * FUNCTION: acpi_ds_init_field_objects |
@@ -407,37 +386,34 @@ acpi_ds_create_field ( | |||
407 | ******************************************************************************/ | 386 | ******************************************************************************/ |
408 | 387 | ||
409 | acpi_status | 388 | acpi_status |
410 | acpi_ds_init_field_objects ( | 389 | acpi_ds_init_field_objects(union acpi_parse_object *op, |
411 | union acpi_parse_object *op, | 390 | struct acpi_walk_state *walk_state) |
412 | struct acpi_walk_state *walk_state) | ||
413 | { | 391 | { |
414 | acpi_status status; | 392 | acpi_status status; |
415 | union acpi_parse_object *arg = NULL; | 393 | union acpi_parse_object *arg = NULL; |
416 | struct acpi_namespace_node *node; | 394 | struct acpi_namespace_node *node; |
417 | u8 type = 0; | 395 | u8 type = 0; |
418 | |||
419 | |||
420 | ACPI_FUNCTION_TRACE_PTR ("ds_init_field_objects", op); | ||
421 | 396 | ||
397 | ACPI_FUNCTION_TRACE_PTR("ds_init_field_objects", op); | ||
422 | 398 | ||
423 | switch (walk_state->opcode) { | 399 | switch (walk_state->opcode) { |
424 | case AML_FIELD_OP: | 400 | case AML_FIELD_OP: |
425 | arg = acpi_ps_get_arg (op, 2); | 401 | arg = acpi_ps_get_arg(op, 2); |
426 | type = ACPI_TYPE_LOCAL_REGION_FIELD; | 402 | type = ACPI_TYPE_LOCAL_REGION_FIELD; |
427 | break; | 403 | break; |
428 | 404 | ||
429 | case AML_BANK_FIELD_OP: | 405 | case AML_BANK_FIELD_OP: |
430 | arg = acpi_ps_get_arg (op, 4); | 406 | arg = acpi_ps_get_arg(op, 4); |
431 | type = ACPI_TYPE_LOCAL_BANK_FIELD; | 407 | type = ACPI_TYPE_LOCAL_BANK_FIELD; |
432 | break; | 408 | break; |
433 | 409 | ||
434 | case AML_INDEX_FIELD_OP: | 410 | case AML_INDEX_FIELD_OP: |
435 | arg = acpi_ps_get_arg (op, 3); | 411 | arg = acpi_ps_get_arg(op, 3); |
436 | type = ACPI_TYPE_LOCAL_INDEX_FIELD; | 412 | type = ACPI_TYPE_LOCAL_INDEX_FIELD; |
437 | break; | 413 | break; |
438 | 414 | ||
439 | default: | 415 | default: |
440 | return_ACPI_STATUS (AE_BAD_PARAMETER); | 416 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
441 | } | 417 | } |
442 | 418 | ||
443 | /* | 419 | /* |
@@ -447,16 +423,18 @@ acpi_ds_init_field_objects ( | |||
447 | /* Ignore OFFSET and ACCESSAS terms here */ | 423 | /* Ignore OFFSET and ACCESSAS terms here */ |
448 | 424 | ||
449 | if (arg->common.aml_opcode == AML_INT_NAMEDFIELD_OP) { | 425 | if (arg->common.aml_opcode == AML_INT_NAMEDFIELD_OP) { |
450 | status = acpi_ns_lookup (walk_state->scope_info, | 426 | status = acpi_ns_lookup(walk_state->scope_info, |
451 | (char *) &arg->named.name, | 427 | (char *)&arg->named.name, |
452 | type, ACPI_IMODE_LOAD_PASS1, | 428 | type, ACPI_IMODE_LOAD_PASS1, |
453 | ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | | 429 | ACPI_NS_NO_UPSEARCH | |
454 | ACPI_NS_ERROR_IF_FOUND, | 430 | ACPI_NS_DONT_OPEN_SCOPE | |
455 | walk_state, &node); | 431 | ACPI_NS_ERROR_IF_FOUND, |
456 | if (ACPI_FAILURE (status)) { | 432 | walk_state, &node); |
457 | ACPI_REPORT_NSERROR ((char *) &arg->named.name, status); | 433 | if (ACPI_FAILURE(status)) { |
434 | ACPI_REPORT_NSERROR((char *)&arg->named.name, | ||
435 | status); | ||
458 | if (status != AE_ALREADY_EXISTS) { | 436 | if (status != AE_ALREADY_EXISTS) { |
459 | return_ACPI_STATUS (status); | 437 | return_ACPI_STATUS(status); |
460 | } | 438 | } |
461 | 439 | ||
462 | /* Name already exists, just ignore this error */ | 440 | /* Name already exists, just ignore this error */ |
@@ -472,10 +450,9 @@ acpi_ds_init_field_objects ( | |||
472 | arg = arg->common.next; | 450 | arg = arg->common.next; |
473 | } | 451 | } |
474 | 452 | ||
475 | return_ACPI_STATUS (AE_OK); | 453 | return_ACPI_STATUS(AE_OK); |
476 | } | 454 | } |
477 | 455 | ||
478 | |||
479 | /******************************************************************************* | 456 | /******************************************************************************* |
480 | * | 457 | * |
481 | * FUNCTION: acpi_ds_create_bank_field | 458 | * FUNCTION: acpi_ds_create_bank_field |
@@ -491,41 +468,42 @@ acpi_ds_init_field_objects ( | |||
491 | ******************************************************************************/ | 468 | ******************************************************************************/ |
492 | 469 | ||
493 | acpi_status | 470 | acpi_status |
494 | acpi_ds_create_bank_field ( | 471 | acpi_ds_create_bank_field(union acpi_parse_object *op, |
495 | union acpi_parse_object *op, | 472 | struct acpi_namespace_node *region_node, |
496 | struct acpi_namespace_node *region_node, | 473 | struct acpi_walk_state *walk_state) |
497 | struct acpi_walk_state *walk_state) | ||
498 | { | 474 | { |
499 | acpi_status status; | 475 | acpi_status status; |
500 | union acpi_parse_object *arg; | 476 | union acpi_parse_object *arg; |
501 | struct acpi_create_field_info info; | 477 | struct acpi_create_field_info info; |
502 | |||
503 | |||
504 | ACPI_FUNCTION_TRACE_PTR ("ds_create_bank_field", op); | ||
505 | 478 | ||
479 | ACPI_FUNCTION_TRACE_PTR("ds_create_bank_field", op); | ||
506 | 480 | ||
507 | /* First arg is the name of the parent op_region (must already exist) */ | 481 | /* First arg is the name of the parent op_region (must already exist) */ |
508 | 482 | ||
509 | arg = op->common.value.arg; | 483 | arg = op->common.value.arg; |
510 | if (!region_node) { | 484 | if (!region_node) { |
511 | status = acpi_ns_lookup (walk_state->scope_info, arg->common.value.name, | 485 | status = |
512 | ACPI_TYPE_REGION, ACPI_IMODE_EXECUTE, | 486 | acpi_ns_lookup(walk_state->scope_info, |
513 | ACPI_NS_SEARCH_PARENT, walk_state, ®ion_node); | 487 | arg->common.value.name, ACPI_TYPE_REGION, |
514 | if (ACPI_FAILURE (status)) { | 488 | ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, |
515 | ACPI_REPORT_NSERROR (arg->common.value.name, status); | 489 | walk_state, ®ion_node); |
516 | return_ACPI_STATUS (status); | 490 | if (ACPI_FAILURE(status)) { |
491 | ACPI_REPORT_NSERROR(arg->common.value.name, status); | ||
492 | return_ACPI_STATUS(status); | ||
517 | } | 493 | } |
518 | } | 494 | } |
519 | 495 | ||
520 | /* Second arg is the Bank Register (Field) (must already exist) */ | 496 | /* Second arg is the Bank Register (Field) (must already exist) */ |
521 | 497 | ||
522 | arg = arg->common.next; | 498 | arg = arg->common.next; |
523 | status = acpi_ns_lookup (walk_state->scope_info, arg->common.value.string, | 499 | status = |
524 | ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, | 500 | acpi_ns_lookup(walk_state->scope_info, arg->common.value.string, |
525 | ACPI_NS_SEARCH_PARENT, walk_state, &info.register_node); | 501 | ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, |
526 | if (ACPI_FAILURE (status)) { | 502 | ACPI_NS_SEARCH_PARENT, walk_state, |
527 | ACPI_REPORT_NSERROR (arg->common.value.string, status); | 503 | &info.register_node); |
528 | return_ACPI_STATUS (status); | 504 | if (ACPI_FAILURE(status)) { |
505 | ACPI_REPORT_NSERROR(arg->common.value.string, status); | ||
506 | return_ACPI_STATUS(status); | ||
529 | } | 507 | } |
530 | 508 | ||
531 | /* Third arg is the bank_value */ | 509 | /* Third arg is the bank_value */ |
@@ -543,12 +521,11 @@ acpi_ds_create_bank_field ( | |||
543 | info.field_type = ACPI_TYPE_LOCAL_BANK_FIELD; | 521 | info.field_type = ACPI_TYPE_LOCAL_BANK_FIELD; |
544 | info.region_node = region_node; | 522 | info.region_node = region_node; |
545 | 523 | ||
546 | status = acpi_ds_get_field_names (&info, walk_state, arg->common.next); | 524 | status = acpi_ds_get_field_names(&info, walk_state, arg->common.next); |
547 | 525 | ||
548 | return_ACPI_STATUS (status); | 526 | return_ACPI_STATUS(status); |
549 | } | 527 | } |
550 | 528 | ||
551 | |||
552 | /******************************************************************************* | 529 | /******************************************************************************* |
553 | * | 530 | * |
554 | * FUNCTION: acpi_ds_create_index_field | 531 | * FUNCTION: acpi_ds_create_index_field |
@@ -564,39 +541,40 @@ acpi_ds_create_bank_field ( | |||
564 | ******************************************************************************/ | 541 | ******************************************************************************/ |
565 | 542 | ||
566 | acpi_status | 543 | acpi_status |
567 | acpi_ds_create_index_field ( | 544 | acpi_ds_create_index_field(union acpi_parse_object *op, |
568 | union acpi_parse_object *op, | 545 | struct acpi_namespace_node *region_node, |
569 | struct acpi_namespace_node *region_node, | 546 | struct acpi_walk_state *walk_state) |
570 | struct acpi_walk_state *walk_state) | ||
571 | { | 547 | { |
572 | acpi_status status; | 548 | acpi_status status; |
573 | union acpi_parse_object *arg; | 549 | union acpi_parse_object *arg; |
574 | struct acpi_create_field_info info; | 550 | struct acpi_create_field_info info; |
575 | |||
576 | |||
577 | ACPI_FUNCTION_TRACE_PTR ("ds_create_index_field", op); | ||
578 | 551 | ||
552 | ACPI_FUNCTION_TRACE_PTR("ds_create_index_field", op); | ||
579 | 553 | ||
580 | /* First arg is the name of the Index register (must already exist) */ | 554 | /* First arg is the name of the Index register (must already exist) */ |
581 | 555 | ||
582 | arg = op->common.value.arg; | 556 | arg = op->common.value.arg; |
583 | status = acpi_ns_lookup (walk_state->scope_info, arg->common.value.string, | 557 | status = |
584 | ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, | 558 | acpi_ns_lookup(walk_state->scope_info, arg->common.value.string, |
585 | ACPI_NS_SEARCH_PARENT, walk_state, &info.register_node); | 559 | ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, |
586 | if (ACPI_FAILURE (status)) { | 560 | ACPI_NS_SEARCH_PARENT, walk_state, |
587 | ACPI_REPORT_NSERROR (arg->common.value.string, status); | 561 | &info.register_node); |
588 | return_ACPI_STATUS (status); | 562 | if (ACPI_FAILURE(status)) { |
563 | ACPI_REPORT_NSERROR(arg->common.value.string, status); | ||
564 | return_ACPI_STATUS(status); | ||
589 | } | 565 | } |
590 | 566 | ||
591 | /* Second arg is the data register (must already exist) */ | 567 | /* Second arg is the data register (must already exist) */ |
592 | 568 | ||
593 | arg = arg->common.next; | 569 | arg = arg->common.next; |
594 | status = acpi_ns_lookup (walk_state->scope_info, arg->common.value.string, | 570 | status = |
595 | ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, | 571 | acpi_ns_lookup(walk_state->scope_info, arg->common.value.string, |
596 | ACPI_NS_SEARCH_PARENT, walk_state, &info.data_register_node); | 572 | ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, |
597 | if (ACPI_FAILURE (status)) { | 573 | ACPI_NS_SEARCH_PARENT, walk_state, |
598 | ACPI_REPORT_NSERROR (arg->common.value.string, status); | 574 | &info.data_register_node); |
599 | return_ACPI_STATUS (status); | 575 | if (ACPI_FAILURE(status)) { |
576 | ACPI_REPORT_NSERROR(arg->common.value.string, status); | ||
577 | return_ACPI_STATUS(status); | ||
600 | } | 578 | } |
601 | 579 | ||
602 | /* Next arg is the field flags */ | 580 | /* Next arg is the field flags */ |
@@ -609,9 +587,7 @@ acpi_ds_create_index_field ( | |||
609 | info.field_type = ACPI_TYPE_LOCAL_INDEX_FIELD; | 587 | info.field_type = ACPI_TYPE_LOCAL_INDEX_FIELD; |
610 | info.region_node = region_node; | 588 | info.region_node = region_node; |
611 | 589 | ||
612 | status = acpi_ds_get_field_names (&info, walk_state, arg->common.next); | 590 | status = acpi_ds_get_field_names(&info, walk_state, arg->common.next); |
613 | 591 | ||
614 | return_ACPI_STATUS (status); | 592 | return_ACPI_STATUS(status); |
615 | } | 593 | } |
616 | |||
617 | |||
diff --git a/drivers/acpi/dispatcher/dsinit.c b/drivers/acpi/dispatcher/dsinit.c index bcd1d472b90f..8693c704aea6 100644 --- a/drivers/acpi/dispatcher/dsinit.c +++ b/drivers/acpi/dispatcher/dsinit.c | |||
@@ -41,23 +41,17 @@ | |||
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/acdispat.h> | 45 | #include <acpi/acdispat.h> |
47 | #include <acpi/acnamesp.h> | 46 | #include <acpi/acnamesp.h> |
48 | 47 | ||
49 | #define _COMPONENT ACPI_DISPATCHER | 48 | #define _COMPONENT ACPI_DISPATCHER |
50 | ACPI_MODULE_NAME ("dsinit") | 49 | ACPI_MODULE_NAME("dsinit") |
51 | 50 | ||
52 | /* Local prototypes */ | 51 | /* Local prototypes */ |
53 | |||
54 | static acpi_status | 52 | static acpi_status |
55 | acpi_ds_init_one_object ( | 53 | acpi_ds_init_one_object(acpi_handle obj_handle, |
56 | acpi_handle obj_handle, | 54 | u32 level, void *context, void **return_value); |
57 | u32 level, | ||
58 | void *context, | ||
59 | void **return_value); | ||
60 | |||
61 | 55 | ||
62 | /******************************************************************************* | 56 | /******************************************************************************* |
63 | * | 57 | * |
@@ -80,20 +74,17 @@ acpi_ds_init_one_object ( | |||
80 | ******************************************************************************/ | 74 | ******************************************************************************/ |
81 | 75 | ||
82 | static acpi_status | 76 | static acpi_status |
83 | acpi_ds_init_one_object ( | 77 | acpi_ds_init_one_object(acpi_handle obj_handle, |
84 | acpi_handle obj_handle, | 78 | u32 level, void *context, void **return_value) |
85 | u32 level, | ||
86 | void *context, | ||
87 | void **return_value) | ||
88 | { | 79 | { |
89 | struct acpi_init_walk_info *info = (struct acpi_init_walk_info *) context; | 80 | struct acpi_init_walk_info *info = |
90 | struct acpi_namespace_node *node = (struct acpi_namespace_node *) obj_handle; | 81 | (struct acpi_init_walk_info *)context; |
91 | acpi_object_type type; | 82 | struct acpi_namespace_node *node = |
92 | acpi_status status; | 83 | (struct acpi_namespace_node *)obj_handle; |
93 | 84 | acpi_object_type type; | |
94 | 85 | acpi_status status; | |
95 | ACPI_FUNCTION_NAME ("ds_init_one_object"); | ||
96 | 86 | ||
87 | ACPI_FUNCTION_NAME("ds_init_one_object"); | ||
97 | 88 | ||
98 | /* | 89 | /* |
99 | * We are only interested in NS nodes owned by the table that | 90 | * We are only interested in NS nodes owned by the table that |
@@ -107,23 +98,23 @@ acpi_ds_init_one_object ( | |||
107 | 98 | ||
108 | /* And even then, we are only interested in a few object types */ | 99 | /* And even then, we are only interested in a few object types */ |
109 | 100 | ||
110 | type = acpi_ns_get_type (obj_handle); | 101 | type = acpi_ns_get_type(obj_handle); |
111 | 102 | ||
112 | switch (type) { | 103 | switch (type) { |
113 | case ACPI_TYPE_REGION: | 104 | case ACPI_TYPE_REGION: |
114 | 105 | ||
115 | status = acpi_ds_initialize_region (obj_handle); | 106 | status = acpi_ds_initialize_region(obj_handle); |
116 | if (ACPI_FAILURE (status)) { | 107 | if (ACPI_FAILURE(status)) { |
117 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 108 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
118 | "Region %p [%4.4s] - Init failure, %s\n", | 109 | "Region %p [%4.4s] - Init failure, %s\n", |
119 | obj_handle, acpi_ut_get_node_name (obj_handle), | 110 | obj_handle, |
120 | acpi_format_exception (status))); | 111 | acpi_ut_get_node_name(obj_handle), |
112 | acpi_format_exception(status))); | ||
121 | } | 113 | } |
122 | 114 | ||
123 | info->op_region_count++; | 115 | info->op_region_count++; |
124 | break; | 116 | break; |
125 | 117 | ||
126 | |||
127 | case ACPI_TYPE_METHOD: | 118 | case ACPI_TYPE_METHOD: |
128 | 119 | ||
129 | /* | 120 | /* |
@@ -131,7 +122,7 @@ acpi_ds_init_one_object ( | |||
131 | * the entire pathname | 122 | * the entire pathname |
132 | */ | 123 | */ |
133 | if (!(acpi_dbg_level & ACPI_LV_INIT_NAMES)) { | 124 | if (!(acpi_dbg_level & ACPI_LV_INIT_NAMES)) { |
134 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, ".")); | 125 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, ".")); |
135 | } | 126 | } |
136 | 127 | ||
137 | /* | 128 | /* |
@@ -148,12 +139,13 @@ acpi_ds_init_one_object ( | |||
148 | * Always parse methods to detect errors, we will delete | 139 | * Always parse methods to detect errors, we will delete |
149 | * the parse tree below | 140 | * the parse tree below |
150 | */ | 141 | */ |
151 | status = acpi_ds_parse_method (obj_handle); | 142 | status = acpi_ds_parse_method(obj_handle); |
152 | if (ACPI_FAILURE (status)) { | 143 | if (ACPI_FAILURE(status)) { |
153 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 144 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
154 | "\n+Method %p [%4.4s] - parse failure, %s\n", | 145 | "\n+Method %p [%4.4s] - parse failure, %s\n", |
155 | obj_handle, acpi_ut_get_node_name (obj_handle), | 146 | obj_handle, |
156 | acpi_format_exception (status))); | 147 | acpi_ut_get_node_name(obj_handle), |
148 | acpi_format_exception(status))); | ||
157 | 149 | ||
158 | /* This parse failed, but we will continue parsing more methods */ | 150 | /* This parse failed, but we will continue parsing more methods */ |
159 | } | 151 | } |
@@ -161,13 +153,11 @@ acpi_ds_init_one_object ( | |||
161 | info->method_count++; | 153 | info->method_count++; |
162 | break; | 154 | break; |
163 | 155 | ||
164 | |||
165 | case ACPI_TYPE_DEVICE: | 156 | case ACPI_TYPE_DEVICE: |
166 | 157 | ||
167 | info->device_count++; | 158 | info->device_count++; |
168 | break; | 159 | break; |
169 | 160 | ||
170 | |||
171 | default: | 161 | default: |
172 | break; | 162 | break; |
173 | } | 163 | } |
@@ -179,7 +169,6 @@ acpi_ds_init_one_object ( | |||
179 | return (AE_OK); | 169 | return (AE_OK); |
180 | } | 170 | } |
181 | 171 | ||
182 | |||
183 | /******************************************************************************* | 172 | /******************************************************************************* |
184 | * | 173 | * |
185 | * FUNCTION: acpi_ds_initialize_objects | 174 | * FUNCTION: acpi_ds_initialize_objects |
@@ -195,45 +184,43 @@ acpi_ds_init_one_object ( | |||
195 | ******************************************************************************/ | 184 | ******************************************************************************/ |
196 | 185 | ||
197 | acpi_status | 186 | acpi_status |
198 | acpi_ds_initialize_objects ( | 187 | acpi_ds_initialize_objects(struct acpi_table_desc * table_desc, |
199 | struct acpi_table_desc *table_desc, | 188 | struct acpi_namespace_node * start_node) |
200 | struct acpi_namespace_node *start_node) | ||
201 | { | 189 | { |
202 | acpi_status status; | 190 | acpi_status status; |
203 | struct acpi_init_walk_info info; | 191 | struct acpi_init_walk_info info; |
204 | |||
205 | 192 | ||
206 | ACPI_FUNCTION_TRACE ("ds_initialize_objects"); | 193 | ACPI_FUNCTION_TRACE("ds_initialize_objects"); |
207 | 194 | ||
195 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | ||
196 | "**** Starting initialization of namespace objects ****\n")); | ||
197 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, "Parsing all Control Methods:")); | ||
208 | 198 | ||
209 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, | 199 | info.method_count = 0; |
210 | "**** Starting initialization of namespace objects ****\n")); | ||
211 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "Parsing all Control Methods:")); | ||
212 | |||
213 | info.method_count = 0; | ||
214 | info.op_region_count = 0; | 200 | info.op_region_count = 0; |
215 | info.object_count = 0; | 201 | info.object_count = 0; |
216 | info.device_count = 0; | 202 | info.device_count = 0; |
217 | info.table_desc = table_desc; | 203 | info.table_desc = table_desc; |
218 | 204 | ||
219 | /* Walk entire namespace from the supplied root */ | 205 | /* Walk entire namespace from the supplied root */ |
220 | 206 | ||
221 | status = acpi_walk_namespace (ACPI_TYPE_ANY, start_node, ACPI_UINT32_MAX, | 207 | status = acpi_walk_namespace(ACPI_TYPE_ANY, start_node, ACPI_UINT32_MAX, |
222 | acpi_ds_init_one_object, &info, NULL); | 208 | acpi_ds_init_one_object, &info, NULL); |
223 | if (ACPI_FAILURE (status)) { | 209 | if (ACPI_FAILURE(status)) { |
224 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "walk_namespace failed, %s\n", | 210 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "walk_namespace failed, %s\n", |
225 | acpi_format_exception (status))); | 211 | acpi_format_exception(status))); |
226 | } | 212 | } |
227 | 213 | ||
228 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, | 214 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, |
229 | "\nTable [%4.4s](id %4.4X) - %hd Objects with %hd Devices %hd Methods %hd Regions\n", | 215 | "\nTable [%4.4s](id %4.4X) - %hd Objects with %hd Devices %hd Methods %hd Regions\n", |
230 | table_desc->pointer->signature, table_desc->owner_id, info.object_count, | 216 | table_desc->pointer->signature, |
231 | info.device_count, info.method_count, info.op_region_count)); | 217 | table_desc->owner_id, info.object_count, |
218 | info.device_count, info.method_count, | ||
219 | info.op_region_count)); | ||
232 | 220 | ||
233 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, | 221 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
234 | "%hd Methods, %hd Regions\n", info.method_count, info.op_region_count)); | 222 | "%hd Methods, %hd Regions\n", info.method_count, |
223 | info.op_region_count)); | ||
235 | 224 | ||
236 | return_ACPI_STATUS (AE_OK); | 225 | return_ACPI_STATUS(AE_OK); |
237 | } | 226 | } |
238 | |||
239 | |||
diff --git a/drivers/acpi/dispatcher/dsmethod.c b/drivers/acpi/dispatcher/dsmethod.c index e344c06ed33f..77fcfc3070db 100644 --- a/drivers/acpi/dispatcher/dsmethod.c +++ b/drivers/acpi/dispatcher/dsmethod.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> |
@@ -49,10 +48,8 @@ | |||
49 | #include <acpi/acinterp.h> | 48 | #include <acpi/acinterp.h> |
50 | #include <acpi/acnamesp.h> | 49 | #include <acpi/acnamesp.h> |
51 | 50 | ||
52 | |||
53 | #define _COMPONENT ACPI_DISPATCHER | 51 | #define _COMPONENT ACPI_DISPATCHER |
54 | ACPI_MODULE_NAME ("dsmethod") | 52 | ACPI_MODULE_NAME("dsmethod") |
55 | |||
56 | 53 | ||
57 | /******************************************************************************* | 54 | /******************************************************************************* |
58 | * | 55 | * |
@@ -67,45 +64,41 @@ | |||
67 | * MUTEX: Assumes parser is locked | 64 | * MUTEX: Assumes parser is locked |
68 | * | 65 | * |
69 | ******************************************************************************/ | 66 | ******************************************************************************/ |
70 | 67 | acpi_status acpi_ds_parse_method(struct acpi_namespace_node *node) | |
71 | acpi_status | ||
72 | acpi_ds_parse_method ( | ||
73 | struct acpi_namespace_node *node) | ||
74 | { | 68 | { |
75 | acpi_status status; | 69 | acpi_status status; |
76 | union acpi_operand_object *obj_desc; | 70 | union acpi_operand_object *obj_desc; |
77 | union acpi_parse_object *op; | 71 | union acpi_parse_object *op; |
78 | struct acpi_walk_state *walk_state; | 72 | struct acpi_walk_state *walk_state; |
79 | |||
80 | |||
81 | ACPI_FUNCTION_TRACE_PTR ("ds_parse_method", node); | ||
82 | 73 | ||
74 | ACPI_FUNCTION_TRACE_PTR("ds_parse_method", node); | ||
83 | 75 | ||
84 | /* Parameter Validation */ | 76 | /* Parameter Validation */ |
85 | 77 | ||
86 | if (!node) { | 78 | if (!node) { |
87 | return_ACPI_STATUS (AE_NULL_ENTRY); | 79 | return_ACPI_STATUS(AE_NULL_ENTRY); |
88 | } | 80 | } |
89 | 81 | ||
90 | ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Parsing [%4.4s] **** named_obj=%p\n", | 82 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, |
91 | acpi_ut_get_node_name (node), node)); | 83 | "**** Parsing [%4.4s] **** named_obj=%p\n", |
84 | acpi_ut_get_node_name(node), node)); | ||
92 | 85 | ||
93 | /* Extract the method object from the method Node */ | 86 | /* Extract the method object from the method Node */ |
94 | 87 | ||
95 | obj_desc = acpi_ns_get_attached_object (node); | 88 | obj_desc = acpi_ns_get_attached_object(node); |
96 | if (!obj_desc) { | 89 | if (!obj_desc) { |
97 | return_ACPI_STATUS (AE_NULL_OBJECT); | 90 | return_ACPI_STATUS(AE_NULL_OBJECT); |
98 | } | 91 | } |
99 | 92 | ||
100 | /* Create a mutex for the method if there is a concurrency limit */ | 93 | /* Create a mutex for the method if there is a concurrency limit */ |
101 | 94 | ||
102 | if ((obj_desc->method.concurrency != ACPI_INFINITE_CONCURRENCY) && | 95 | if ((obj_desc->method.concurrency != ACPI_INFINITE_CONCURRENCY) && |
103 | (!obj_desc->method.semaphore)) { | 96 | (!obj_desc->method.semaphore)) { |
104 | status = acpi_os_create_semaphore (obj_desc->method.concurrency, | 97 | status = acpi_os_create_semaphore(obj_desc->method.concurrency, |
105 | obj_desc->method.concurrency, | 98 | obj_desc->method.concurrency, |
106 | &obj_desc->method.semaphore); | 99 | &obj_desc->method.semaphore); |
107 | if (ACPI_FAILURE (status)) { | 100 | if (ACPI_FAILURE(status)) { |
108 | return_ACPI_STATUS (status); | 101 | return_ACPI_STATUS(status); |
109 | } | 102 | } |
110 | } | 103 | } |
111 | 104 | ||
@@ -113,14 +106,14 @@ acpi_ds_parse_method ( | |||
113 | * Allocate a new parser op to be the root of the parsed | 106 | * Allocate a new parser op to be the root of the parsed |
114 | * method tree | 107 | * method tree |
115 | */ | 108 | */ |
116 | op = acpi_ps_alloc_op (AML_METHOD_OP); | 109 | op = acpi_ps_alloc_op(AML_METHOD_OP); |
117 | if (!op) { | 110 | if (!op) { |
118 | return_ACPI_STATUS (AE_NO_MEMORY); | 111 | return_ACPI_STATUS(AE_NO_MEMORY); |
119 | } | 112 | } |
120 | 113 | ||
121 | /* Init new op with the method name and pointer back to the Node */ | 114 | /* Init new op with the method name and pointer back to the Node */ |
122 | 115 | ||
123 | acpi_ps_set_name (op, node->name.integer); | 116 | acpi_ps_set_name(op, node->name.integer); |
124 | op->common.node = node; | 117 | op->common.node = node; |
125 | 118 | ||
126 | /* | 119 | /* |
@@ -128,25 +121,26 @@ acpi_ds_parse_method ( | |||
128 | * objects (such as Operation Regions) can be created during the | 121 | * objects (such as Operation Regions) can be created during the |
129 | * first pass parse. | 122 | * first pass parse. |
130 | */ | 123 | */ |
131 | status = acpi_ut_allocate_owner_id (&obj_desc->method.owner_id); | 124 | status = acpi_ut_allocate_owner_id(&obj_desc->method.owner_id); |
132 | if (ACPI_FAILURE (status)) { | 125 | if (ACPI_FAILURE(status)) { |
133 | goto cleanup; | 126 | goto cleanup; |
134 | } | 127 | } |
135 | 128 | ||
136 | /* Create and initialize a new walk state */ | 129 | /* Create and initialize a new walk state */ |
137 | 130 | ||
138 | walk_state = acpi_ds_create_walk_state ( | 131 | walk_state = |
139 | obj_desc->method.owner_id, NULL, NULL, NULL); | 132 | acpi_ds_create_walk_state(obj_desc->method.owner_id, NULL, NULL, |
133 | NULL); | ||
140 | if (!walk_state) { | 134 | if (!walk_state) { |
141 | status = AE_NO_MEMORY; | 135 | status = AE_NO_MEMORY; |
142 | goto cleanup2; | 136 | goto cleanup2; |
143 | } | 137 | } |
144 | 138 | ||
145 | status = acpi_ds_init_aml_walk (walk_state, op, node, | 139 | status = acpi_ds_init_aml_walk(walk_state, op, node, |
146 | obj_desc->method.aml_start, | 140 | obj_desc->method.aml_start, |
147 | obj_desc->method.aml_length, NULL, 1); | 141 | obj_desc->method.aml_length, NULL, 1); |
148 | if (ACPI_FAILURE (status)) { | 142 | if (ACPI_FAILURE(status)) { |
149 | acpi_ds_delete_walk_state (walk_state); | 143 | acpi_ds_delete_walk_state(walk_state); |
150 | goto cleanup2; | 144 | goto cleanup2; |
151 | } | 145 | } |
152 | 146 | ||
@@ -159,32 +153,31 @@ acpi_ds_parse_method ( | |||
159 | * method so that operands to the named objects can take on dynamic | 153 | * method so that operands to the named objects can take on dynamic |
160 | * run-time values. | 154 | * run-time values. |
161 | */ | 155 | */ |
162 | status = acpi_ps_parse_aml (walk_state); | 156 | status = acpi_ps_parse_aml(walk_state); |
163 | if (ACPI_FAILURE (status)) { | 157 | if (ACPI_FAILURE(status)) { |
164 | goto cleanup2; | 158 | goto cleanup2; |
165 | } | 159 | } |
166 | 160 | ||
167 | ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, | 161 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, |
168 | "**** [%4.4s] Parsed **** named_obj=%p Op=%p\n", | 162 | "**** [%4.4s] Parsed **** named_obj=%p Op=%p\n", |
169 | acpi_ut_get_node_name (node), node, op)); | 163 | acpi_ut_get_node_name(node), node, op)); |
170 | 164 | ||
171 | /* | 165 | /* |
172 | * Delete the parse tree. We simply re-parse the method for every | 166 | * Delete the parse tree. We simply re-parse the method for every |
173 | * execution since there isn't much overhead (compared to keeping lots | 167 | * execution since there isn't much overhead (compared to keeping lots |
174 | * of parse trees around) | 168 | * of parse trees around) |
175 | */ | 169 | */ |
176 | acpi_ns_delete_namespace_subtree (node); | 170 | acpi_ns_delete_namespace_subtree(node); |
177 | acpi_ns_delete_namespace_by_owner (obj_desc->method.owner_id); | 171 | acpi_ns_delete_namespace_by_owner(obj_desc->method.owner_id); |
178 | 172 | ||
179 | cleanup2: | 173 | cleanup2: |
180 | acpi_ut_release_owner_id (&obj_desc->method.owner_id); | 174 | acpi_ut_release_owner_id(&obj_desc->method.owner_id); |
181 | 175 | ||
182 | cleanup: | 176 | cleanup: |
183 | acpi_ps_delete_parse_tree (op); | 177 | acpi_ps_delete_parse_tree(op); |
184 | return_ACPI_STATUS (status); | 178 | return_ACPI_STATUS(status); |
185 | } | 179 | } |
186 | 180 | ||
187 | |||
188 | /******************************************************************************* | 181 | /******************************************************************************* |
189 | * | 182 | * |
190 | * FUNCTION: acpi_ds_begin_method_execution | 183 | * FUNCTION: acpi_ds_begin_method_execution |
@@ -202,19 +195,16 @@ cleanup: | |||
202 | ******************************************************************************/ | 195 | ******************************************************************************/ |
203 | 196 | ||
204 | acpi_status | 197 | acpi_status |
205 | acpi_ds_begin_method_execution ( | 198 | acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node, |
206 | struct acpi_namespace_node *method_node, | 199 | union acpi_operand_object *obj_desc, |
207 | union acpi_operand_object *obj_desc, | 200 | struct acpi_namespace_node *calling_method_node) |
208 | struct acpi_namespace_node *calling_method_node) | ||
209 | { | 201 | { |
210 | acpi_status status = AE_OK; | 202 | acpi_status status = AE_OK; |
211 | |||
212 | |||
213 | ACPI_FUNCTION_TRACE_PTR ("ds_begin_method_execution", method_node); | ||
214 | 203 | ||
204 | ACPI_FUNCTION_TRACE_PTR("ds_begin_method_execution", method_node); | ||
215 | 205 | ||
216 | if (!method_node) { | 206 | if (!method_node) { |
217 | return_ACPI_STATUS (AE_NULL_ENTRY); | 207 | return_ACPI_STATUS(AE_NULL_ENTRY); |
218 | } | 208 | } |
219 | 209 | ||
220 | /* | 210 | /* |
@@ -231,8 +221,9 @@ acpi_ds_begin_method_execution ( | |||
231 | * thread that is making recursive method calls. | 221 | * thread that is making recursive method calls. |
232 | */ | 222 | */ |
233 | if (method_node == calling_method_node) { | 223 | if (method_node == calling_method_node) { |
234 | if (obj_desc->method.thread_count >= obj_desc->method.concurrency) { | 224 | if (obj_desc->method.thread_count >= |
235 | return_ACPI_STATUS (AE_AML_METHOD_LIMIT); | 225 | obj_desc->method.concurrency) { |
226 | return_ACPI_STATUS(AE_AML_METHOD_LIMIT); | ||
236 | } | 227 | } |
237 | } | 228 | } |
238 | 229 | ||
@@ -240,8 +231,9 @@ acpi_ds_begin_method_execution ( | |||
240 | * Get a unit from the method semaphore. This releases the | 231 | * Get a unit from the method semaphore. This releases the |
241 | * interpreter if we block | 232 | * interpreter if we block |
242 | */ | 233 | */ |
243 | status = acpi_ex_system_wait_semaphore (obj_desc->method.semaphore, | 234 | status = |
244 | ACPI_WAIT_FOREVER); | 235 | acpi_ex_system_wait_semaphore(obj_desc->method.semaphore, |
236 | ACPI_WAIT_FOREVER); | ||
245 | } | 237 | } |
246 | 238 | ||
247 | /* | 239 | /* |
@@ -249,10 +241,9 @@ acpi_ds_begin_method_execution ( | |||
249 | * reentered one more time (even if it is the same thread) | 241 | * reentered one more time (even if it is the same thread) |
250 | */ | 242 | */ |
251 | obj_desc->method.thread_count++; | 243 | obj_desc->method.thread_count++; |
252 | return_ACPI_STATUS (status); | 244 | return_ACPI_STATUS(status); |
253 | } | 245 | } |
254 | 246 | ||
255 | |||
256 | /******************************************************************************* | 247 | /******************************************************************************* |
257 | * | 248 | * |
258 | * FUNCTION: acpi_ds_call_control_method | 249 | * FUNCTION: acpi_ds_call_control_method |
@@ -268,85 +259,86 @@ acpi_ds_begin_method_execution ( | |||
268 | ******************************************************************************/ | 259 | ******************************************************************************/ |
269 | 260 | ||
270 | acpi_status | 261 | acpi_status |
271 | acpi_ds_call_control_method ( | 262 | acpi_ds_call_control_method(struct acpi_thread_state *thread, |
272 | struct acpi_thread_state *thread, | 263 | struct acpi_walk_state *this_walk_state, |
273 | struct acpi_walk_state *this_walk_state, | 264 | union acpi_parse_object *op) |
274 | union acpi_parse_object *op) | ||
275 | { | 265 | { |
276 | acpi_status status; | 266 | acpi_status status; |
277 | struct acpi_namespace_node *method_node; | 267 | struct acpi_namespace_node *method_node; |
278 | struct acpi_walk_state *next_walk_state = NULL; | 268 | struct acpi_walk_state *next_walk_state = NULL; |
279 | union acpi_operand_object *obj_desc; | 269 | union acpi_operand_object *obj_desc; |
280 | struct acpi_parameter_info info; | 270 | struct acpi_parameter_info info; |
281 | u32 i; | 271 | u32 i; |
282 | |||
283 | 272 | ||
284 | ACPI_FUNCTION_TRACE_PTR ("ds_call_control_method", this_walk_state); | 273 | ACPI_FUNCTION_TRACE_PTR("ds_call_control_method", this_walk_state); |
285 | 274 | ||
286 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Execute method %p, currentstate=%p\n", | 275 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
287 | this_walk_state->prev_op, this_walk_state)); | 276 | "Execute method %p, currentstate=%p\n", |
277 | this_walk_state->prev_op, this_walk_state)); | ||
288 | 278 | ||
289 | /* | 279 | /* |
290 | * Get the namespace entry for the control method we are about to call | 280 | * Get the namespace entry for the control method we are about to call |
291 | */ | 281 | */ |
292 | method_node = this_walk_state->method_call_node; | 282 | method_node = this_walk_state->method_call_node; |
293 | if (!method_node) { | 283 | if (!method_node) { |
294 | return_ACPI_STATUS (AE_NULL_ENTRY); | 284 | return_ACPI_STATUS(AE_NULL_ENTRY); |
295 | } | 285 | } |
296 | 286 | ||
297 | obj_desc = acpi_ns_get_attached_object (method_node); | 287 | obj_desc = acpi_ns_get_attached_object(method_node); |
298 | if (!obj_desc) { | 288 | if (!obj_desc) { |
299 | return_ACPI_STATUS (AE_NULL_OBJECT); | 289 | return_ACPI_STATUS(AE_NULL_OBJECT); |
300 | } | 290 | } |
301 | 291 | ||
302 | status = acpi_ut_allocate_owner_id (&obj_desc->method.owner_id); | 292 | status = acpi_ut_allocate_owner_id(&obj_desc->method.owner_id); |
303 | if (ACPI_FAILURE (status)) { | 293 | if (ACPI_FAILURE(status)) { |
304 | return_ACPI_STATUS (status); | 294 | return_ACPI_STATUS(status); |
305 | } | 295 | } |
306 | 296 | ||
307 | /* Init for new method, wait on concurrency semaphore */ | 297 | /* Init for new method, wait on concurrency semaphore */ |
308 | 298 | ||
309 | status = acpi_ds_begin_method_execution (method_node, obj_desc, | 299 | status = acpi_ds_begin_method_execution(method_node, obj_desc, |
310 | this_walk_state->method_node); | 300 | this_walk_state->method_node); |
311 | if (ACPI_FAILURE (status)) { | 301 | if (ACPI_FAILURE(status)) { |
312 | goto cleanup; | 302 | goto cleanup; |
313 | } | 303 | } |
314 | 304 | ||
315 | if (!(obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY)) { | 305 | if (!(obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY)) { |
316 | /* 1) Parse: Create a new walk state for the preempting walk */ | 306 | /* 1) Parse: Create a new walk state for the preempting walk */ |
317 | 307 | ||
318 | next_walk_state = acpi_ds_create_walk_state (obj_desc->method.owner_id, | 308 | next_walk_state = |
319 | op, obj_desc, NULL); | 309 | acpi_ds_create_walk_state(obj_desc->method.owner_id, op, |
310 | obj_desc, NULL); | ||
320 | if (!next_walk_state) { | 311 | if (!next_walk_state) { |
321 | return_ACPI_STATUS (AE_NO_MEMORY); | 312 | return_ACPI_STATUS(AE_NO_MEMORY); |
322 | } | 313 | } |
323 | 314 | ||
324 | /* Create and init a Root Node */ | 315 | /* Create and init a Root Node */ |
325 | 316 | ||
326 | op = acpi_ps_create_scope_op (); | 317 | op = acpi_ps_create_scope_op(); |
327 | if (!op) { | 318 | if (!op) { |
328 | status = AE_NO_MEMORY; | 319 | status = AE_NO_MEMORY; |
329 | goto cleanup; | 320 | goto cleanup; |
330 | } | 321 | } |
331 | 322 | ||
332 | status = acpi_ds_init_aml_walk (next_walk_state, op, method_node, | 323 | status = acpi_ds_init_aml_walk(next_walk_state, op, method_node, |
333 | obj_desc->method.aml_start, obj_desc->method.aml_length, | 324 | obj_desc->method.aml_start, |
334 | NULL, 1); | 325 | obj_desc->method.aml_length, |
335 | if (ACPI_FAILURE (status)) { | 326 | NULL, 1); |
336 | acpi_ds_delete_walk_state (next_walk_state); | 327 | if (ACPI_FAILURE(status)) { |
328 | acpi_ds_delete_walk_state(next_walk_state); | ||
337 | goto cleanup; | 329 | goto cleanup; |
338 | } | 330 | } |
339 | 331 | ||
340 | /* Begin AML parse */ | 332 | /* Begin AML parse */ |
341 | 333 | ||
342 | status = acpi_ps_parse_aml (next_walk_state); | 334 | status = acpi_ps_parse_aml(next_walk_state); |
343 | acpi_ps_delete_parse_tree (op); | 335 | acpi_ps_delete_parse_tree(op); |
344 | } | 336 | } |
345 | 337 | ||
346 | /* 2) Execute: Create a new state for the preempting walk */ | 338 | /* 2) Execute: Create a new state for the preempting walk */ |
347 | 339 | ||
348 | next_walk_state = acpi_ds_create_walk_state (obj_desc->method.owner_id, | 340 | next_walk_state = acpi_ds_create_walk_state(obj_desc->method.owner_id, |
349 | NULL, obj_desc, thread); | 341 | NULL, obj_desc, thread); |
350 | if (!next_walk_state) { | 342 | if (!next_walk_state) { |
351 | status = AE_NO_MEMORY; | 343 | status = AE_NO_MEMORY; |
352 | goto cleanup; | 344 | goto cleanup; |
@@ -357,15 +349,15 @@ acpi_ds_call_control_method ( | |||
357 | * start at index 0. | 349 | * start at index 0. |
358 | * Null terminate the list of arguments | 350 | * Null terminate the list of arguments |
359 | */ | 351 | */ |
360 | this_walk_state->operands [this_walk_state->num_operands] = NULL; | 352 | this_walk_state->operands[this_walk_state->num_operands] = NULL; |
361 | 353 | ||
362 | info.parameters = &this_walk_state->operands[0]; | 354 | info.parameters = &this_walk_state->operands[0]; |
363 | info.parameter_type = ACPI_PARAM_ARGS; | 355 | info.parameter_type = ACPI_PARAM_ARGS; |
364 | 356 | ||
365 | status = acpi_ds_init_aml_walk (next_walk_state, NULL, method_node, | 357 | status = acpi_ds_init_aml_walk(next_walk_state, NULL, method_node, |
366 | obj_desc->method.aml_start, obj_desc->method.aml_length, | 358 | obj_desc->method.aml_start, |
367 | &info, 3); | 359 | obj_desc->method.aml_length, &info, 3); |
368 | if (ACPI_FAILURE (status)) { | 360 | if (ACPI_FAILURE(status)) { |
369 | goto cleanup; | 361 | goto cleanup; |
370 | } | 362 | } |
371 | 363 | ||
@@ -374,40 +366,39 @@ acpi_ds_call_control_method ( | |||
374 | * (they were copied to new objects) | 366 | * (they were copied to new objects) |
375 | */ | 367 | */ |
376 | for (i = 0; i < obj_desc->method.param_count; i++) { | 368 | for (i = 0; i < obj_desc->method.param_count; i++) { |
377 | acpi_ut_remove_reference (this_walk_state->operands [i]); | 369 | acpi_ut_remove_reference(this_walk_state->operands[i]); |
378 | this_walk_state->operands [i] = NULL; | 370 | this_walk_state->operands[i] = NULL; |
379 | } | 371 | } |
380 | 372 | ||
381 | /* Clear the operand stack */ | 373 | /* Clear the operand stack */ |
382 | 374 | ||
383 | this_walk_state->num_operands = 0; | 375 | this_walk_state->num_operands = 0; |
384 | 376 | ||
385 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, | 377 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
386 | "Starting nested execution, newstate=%p\n", next_walk_state)); | 378 | "Starting nested execution, newstate=%p\n", |
379 | next_walk_state)); | ||
387 | 380 | ||
388 | if (obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY) { | 381 | if (obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY) { |
389 | status = obj_desc->method.implementation (next_walk_state); | 382 | status = obj_desc->method.implementation(next_walk_state); |
390 | return_ACPI_STATUS (status); | 383 | return_ACPI_STATUS(status); |
391 | } | 384 | } |
392 | 385 | ||
393 | return_ACPI_STATUS (AE_OK); | 386 | return_ACPI_STATUS(AE_OK); |
394 | |||
395 | 387 | ||
396 | /* On error, we must delete the new walk state */ | 388 | /* On error, we must delete the new walk state */ |
397 | 389 | ||
398 | cleanup: | 390 | cleanup: |
399 | acpi_ut_release_owner_id (&obj_desc->method.owner_id); | 391 | acpi_ut_release_owner_id(&obj_desc->method.owner_id); |
400 | if (next_walk_state && (next_walk_state->method_desc)) { | 392 | if (next_walk_state && (next_walk_state->method_desc)) { |
401 | /* Decrement the thread count on the method parse tree */ | 393 | /* Decrement the thread count on the method parse tree */ |
402 | 394 | ||
403 | next_walk_state->method_desc->method.thread_count--; | 395 | next_walk_state->method_desc->method.thread_count--; |
404 | } | 396 | } |
405 | (void) acpi_ds_terminate_control_method (next_walk_state); | 397 | (void)acpi_ds_terminate_control_method(next_walk_state); |
406 | acpi_ds_delete_walk_state (next_walk_state); | 398 | acpi_ds_delete_walk_state(next_walk_state); |
407 | return_ACPI_STATUS (status); | 399 | return_ACPI_STATUS(status); |
408 | } | 400 | } |
409 | 401 | ||
410 | |||
411 | /******************************************************************************* | 402 | /******************************************************************************* |
412 | * | 403 | * |
413 | * FUNCTION: acpi_ds_restart_control_method | 404 | * FUNCTION: acpi_ds_restart_control_method |
@@ -423,25 +414,22 @@ cleanup: | |||
423 | ******************************************************************************/ | 414 | ******************************************************************************/ |
424 | 415 | ||
425 | acpi_status | 416 | acpi_status |
426 | acpi_ds_restart_control_method ( | 417 | acpi_ds_restart_control_method(struct acpi_walk_state *walk_state, |
427 | struct acpi_walk_state *walk_state, | 418 | union acpi_operand_object *return_desc) |
428 | union acpi_operand_object *return_desc) | ||
429 | { | 419 | { |
430 | acpi_status status; | 420 | acpi_status status; |
431 | |||
432 | 421 | ||
433 | ACPI_FUNCTION_TRACE_PTR ("ds_restart_control_method", walk_state); | 422 | ACPI_FUNCTION_TRACE_PTR("ds_restart_control_method", walk_state); |
434 | 423 | ||
424 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | ||
425 | "****Restart [%4.4s] Op %p return_value_from_callee %p\n", | ||
426 | (char *)&walk_state->method_node->name, | ||
427 | walk_state->method_call_op, return_desc)); | ||
435 | 428 | ||
436 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, | 429 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
437 | "****Restart [%4.4s] Op %p return_value_from_callee %p\n", | 430 | " return_from_this_method_used?=%X res_stack %p Walk %p\n", |
438 | (char *) &walk_state->method_node->name, walk_state->method_call_op, | 431 | walk_state->return_used, |
439 | return_desc)); | 432 | walk_state->results, walk_state)); |
440 | |||
441 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, | ||
442 | " return_from_this_method_used?=%X res_stack %p Walk %p\n", | ||
443 | walk_state->return_used, | ||
444 | walk_state->results, walk_state)); | ||
445 | 433 | ||
446 | /* Did the called method return a value? */ | 434 | /* Did the called method return a value? */ |
447 | 435 | ||
@@ -451,10 +439,10 @@ acpi_ds_restart_control_method ( | |||
451 | if (walk_state->return_used) { | 439 | if (walk_state->return_used) { |
452 | /* Save the return value from the previous method */ | 440 | /* Save the return value from the previous method */ |
453 | 441 | ||
454 | status = acpi_ds_result_push (return_desc, walk_state); | 442 | status = acpi_ds_result_push(return_desc, walk_state); |
455 | if (ACPI_FAILURE (status)) { | 443 | if (ACPI_FAILURE(status)) { |
456 | acpi_ut_remove_reference (return_desc); | 444 | acpi_ut_remove_reference(return_desc); |
457 | return_ACPI_STATUS (status); | 445 | return_ACPI_STATUS(status); |
458 | } | 446 | } |
459 | 447 | ||
460 | /* | 448 | /* |
@@ -472,19 +460,19 @@ acpi_ds_restart_control_method ( | |||
472 | * NOTE: this is optional because the ASL language does not actually | 460 | * NOTE: this is optional because the ASL language does not actually |
473 | * support this behavior. | 461 | * support this behavior. |
474 | */ | 462 | */ |
475 | else if (!acpi_ds_do_implicit_return (return_desc, walk_state, FALSE)) { | 463 | else if (!acpi_ds_do_implicit_return |
464 | (return_desc, walk_state, FALSE)) { | ||
476 | /* | 465 | /* |
477 | * Delete the return value if it will not be used by the | 466 | * Delete the return value if it will not be used by the |
478 | * calling method | 467 | * calling method |
479 | */ | 468 | */ |
480 | acpi_ut_remove_reference (return_desc); | 469 | acpi_ut_remove_reference(return_desc); |
481 | } | 470 | } |
482 | } | 471 | } |
483 | 472 | ||
484 | return_ACPI_STATUS (AE_OK); | 473 | return_ACPI_STATUS(AE_OK); |
485 | } | 474 | } |
486 | 475 | ||
487 | |||
488 | /******************************************************************************* | 476 | /******************************************************************************* |
489 | * | 477 | * |
490 | * FUNCTION: acpi_ds_terminate_control_method | 478 | * FUNCTION: acpi_ds_terminate_control_method |
@@ -499,17 +487,13 @@ acpi_ds_restart_control_method ( | |||
499 | * | 487 | * |
500 | ******************************************************************************/ | 488 | ******************************************************************************/ |
501 | 489 | ||
502 | acpi_status | 490 | acpi_status acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state) |
503 | acpi_ds_terminate_control_method ( | ||
504 | struct acpi_walk_state *walk_state) | ||
505 | { | 491 | { |
506 | union acpi_operand_object *obj_desc; | 492 | union acpi_operand_object *obj_desc; |
507 | struct acpi_namespace_node *method_node; | 493 | struct acpi_namespace_node *method_node; |
508 | acpi_status status; | 494 | acpi_status status; |
509 | |||
510 | |||
511 | ACPI_FUNCTION_TRACE_PTR ("ds_terminate_control_method", walk_state); | ||
512 | 495 | ||
496 | ACPI_FUNCTION_TRACE_PTR("ds_terminate_control_method", walk_state); | ||
513 | 497 | ||
514 | if (!walk_state) { | 498 | if (!walk_state) { |
515 | return (AE_BAD_PARAMETER); | 499 | return (AE_BAD_PARAMETER); |
@@ -519,30 +503,31 @@ acpi_ds_terminate_control_method ( | |||
519 | 503 | ||
520 | obj_desc = walk_state->method_desc; | 504 | obj_desc = walk_state->method_desc; |
521 | if (!obj_desc) { | 505 | if (!obj_desc) { |
522 | return_ACPI_STATUS (AE_OK); | 506 | return_ACPI_STATUS(AE_OK); |
523 | } | 507 | } |
524 | 508 | ||
525 | /* Delete all arguments and locals */ | 509 | /* Delete all arguments and locals */ |
526 | 510 | ||
527 | acpi_ds_method_data_delete_all (walk_state); | 511 | acpi_ds_method_data_delete_all(walk_state); |
528 | 512 | ||
529 | /* | 513 | /* |
530 | * Lock the parser while we terminate this method. | 514 | * Lock the parser while we terminate this method. |
531 | * If this is the last thread executing the method, | 515 | * If this is the last thread executing the method, |
532 | * we have additional cleanup to perform | 516 | * we have additional cleanup to perform |
533 | */ | 517 | */ |
534 | status = acpi_ut_acquire_mutex (ACPI_MTX_PARSER); | 518 | status = acpi_ut_acquire_mutex(ACPI_MTX_PARSER); |
535 | if (ACPI_FAILURE (status)) { | 519 | if (ACPI_FAILURE(status)) { |
536 | return_ACPI_STATUS (status); | 520 | return_ACPI_STATUS(status); |
537 | } | 521 | } |
538 | 522 | ||
539 | /* Signal completion of the execution of this method if necessary */ | 523 | /* Signal completion of the execution of this method if necessary */ |
540 | 524 | ||
541 | if (walk_state->method_desc->method.semaphore) { | 525 | if (walk_state->method_desc->method.semaphore) { |
542 | status = acpi_os_signal_semaphore ( | 526 | status = |
543 | walk_state->method_desc->method.semaphore, 1); | 527 | acpi_os_signal_semaphore(walk_state->method_desc->method. |
544 | if (ACPI_FAILURE (status)) { | 528 | semaphore, 1); |
545 | ACPI_REPORT_ERROR (("Could not signal method semaphore\n")); | 529 | if (ACPI_FAILURE(status)) { |
530 | ACPI_REPORT_ERROR(("Could not signal method semaphore\n")); | ||
546 | status = AE_OK; | 531 | status = AE_OK; |
547 | 532 | ||
548 | /* Ignore error and continue cleanup */ | 533 | /* Ignore error and continue cleanup */ |
@@ -550,9 +535,10 @@ acpi_ds_terminate_control_method ( | |||
550 | } | 535 | } |
551 | 536 | ||
552 | if (walk_state->method_desc->method.thread_count) { | 537 | if (walk_state->method_desc->method.thread_count) { |
553 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, | 538 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
554 | "*** Not deleting method namespace, there are still %d threads\n", | 539 | "*** Not deleting method namespace, there are still %d threads\n", |
555 | walk_state->method_desc->method.thread_count)); | 540 | walk_state->method_desc->method. |
541 | thread_count)); | ||
556 | } | 542 | } |
557 | 543 | ||
558 | if (!walk_state->method_desc->method.thread_count) { | 544 | if (!walk_state->method_desc->method.thread_count) { |
@@ -567,9 +553,11 @@ acpi_ds_terminate_control_method ( | |||
567 | * before creating the synchronization semaphore. | 553 | * before creating the synchronization semaphore. |
568 | */ | 554 | */ |
569 | if ((walk_state->method_desc->method.concurrency == 1) && | 555 | if ((walk_state->method_desc->method.concurrency == 1) && |
570 | (!walk_state->method_desc->method.semaphore)) { | 556 | (!walk_state->method_desc->method.semaphore)) { |
571 | status = acpi_os_create_semaphore (1, 1, | 557 | status = acpi_os_create_semaphore(1, 1, |
572 | &walk_state->method_desc->method.semaphore); | 558 | &walk_state-> |
559 | method_desc->method. | ||
560 | semaphore); | ||
573 | } | 561 | } |
574 | 562 | ||
575 | /* | 563 | /* |
@@ -584,30 +572,30 @@ acpi_ds_terminate_control_method ( | |||
584 | * Delete any namespace entries created immediately underneath | 572 | * Delete any namespace entries created immediately underneath |
585 | * the method | 573 | * the method |
586 | */ | 574 | */ |
587 | status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); | 575 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); |
588 | if (ACPI_FAILURE (status)) { | 576 | if (ACPI_FAILURE(status)) { |
589 | return_ACPI_STATUS (status); | 577 | return_ACPI_STATUS(status); |
590 | } | 578 | } |
591 | 579 | ||
592 | if (method_node->child) { | 580 | if (method_node->child) { |
593 | acpi_ns_delete_namespace_subtree (method_node); | 581 | acpi_ns_delete_namespace_subtree(method_node); |
594 | } | 582 | } |
595 | 583 | ||
596 | /* | 584 | /* |
597 | * Delete any namespace entries created anywhere else within | 585 | * Delete any namespace entries created anywhere else within |
598 | * the namespace | 586 | * the namespace |
599 | */ | 587 | */ |
600 | acpi_ns_delete_namespace_by_owner (walk_state->method_desc->method.owner_id); | 588 | acpi_ns_delete_namespace_by_owner(walk_state->method_desc-> |
601 | status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); | 589 | method.owner_id); |
602 | acpi_ut_release_owner_id (&walk_state->method_desc->method.owner_id); | 590 | status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); |
603 | 591 | acpi_ut_release_owner_id(&walk_state->method_desc->method. | |
604 | if (ACPI_FAILURE (status)) { | 592 | owner_id); |
605 | return_ACPI_STATUS (status); | 593 | |
594 | if (ACPI_FAILURE(status)) { | ||
595 | return_ACPI_STATUS(status); | ||
606 | } | 596 | } |
607 | } | 597 | } |
608 | 598 | ||
609 | status = acpi_ut_release_mutex (ACPI_MTX_PARSER); | 599 | status = acpi_ut_release_mutex(ACPI_MTX_PARSER); |
610 | return_ACPI_STATUS (status); | 600 | return_ACPI_STATUS(status); |
611 | } | 601 | } |
612 | |||
613 | |||
diff --git a/drivers/acpi/dispatcher/dsmthdat.c b/drivers/acpi/dispatcher/dsmthdat.c index c83d53fd6398..4095ce70982b 100644 --- a/drivers/acpi/dispatcher/dsmthdat.c +++ b/drivers/acpi/dispatcher/dsmthdat.c | |||
@@ -41,41 +41,32 @@ | |||
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/acdispat.h> | 45 | #include <acpi/acdispat.h> |
47 | #include <acpi/amlcode.h> | 46 | #include <acpi/amlcode.h> |
48 | #include <acpi/acnamesp.h> | 47 | #include <acpi/acnamesp.h> |
49 | #include <acpi/acinterp.h> | 48 | #include <acpi/acinterp.h> |
50 | 49 | ||
51 | |||
52 | #define _COMPONENT ACPI_DISPATCHER | 50 | #define _COMPONENT ACPI_DISPATCHER |
53 | ACPI_MODULE_NAME ("dsmthdat") | 51 | ACPI_MODULE_NAME("dsmthdat") |
54 | 52 | ||
55 | /* Local prototypes */ | 53 | /* Local prototypes */ |
56 | |||
57 | static void | 54 | static void |
58 | acpi_ds_method_data_delete_value ( | 55 | acpi_ds_method_data_delete_value(u16 opcode, |
59 | u16 opcode, | 56 | u32 index, struct acpi_walk_state *walk_state); |
60 | u32 index, | ||
61 | struct acpi_walk_state *walk_state); | ||
62 | 57 | ||
63 | static acpi_status | 58 | static acpi_status |
64 | acpi_ds_method_data_set_value ( | 59 | acpi_ds_method_data_set_value(u16 opcode, |
65 | u16 opcode, | 60 | u32 index, |
66 | u32 index, | 61 | union acpi_operand_object *object, |
67 | union acpi_operand_object *object, | 62 | struct acpi_walk_state *walk_state); |
68 | struct acpi_walk_state *walk_state); | ||
69 | 63 | ||
70 | #ifdef ACPI_OBSOLETE_FUNCTIONS | 64 | #ifdef ACPI_OBSOLETE_FUNCTIONS |
71 | acpi_object_type | 65 | acpi_object_type |
72 | acpi_ds_method_data_get_type ( | 66 | acpi_ds_method_data_get_type(u16 opcode, |
73 | u16 opcode, | 67 | u32 index, struct acpi_walk_state *walk_state); |
74 | u32 index, | ||
75 | struct acpi_walk_state *walk_state); | ||
76 | #endif | 68 | #endif |
77 | 69 | ||
78 | |||
79 | /******************************************************************************* | 70 | /******************************************************************************* |
80 | * | 71 | * |
81 | * FUNCTION: acpi_ds_method_data_init | 72 | * FUNCTION: acpi_ds_method_data_init |
@@ -97,45 +88,41 @@ acpi_ds_method_data_get_type ( | |||
97 | * | 88 | * |
98 | ******************************************************************************/ | 89 | ******************************************************************************/ |
99 | 90 | ||
100 | void | 91 | void acpi_ds_method_data_init(struct acpi_walk_state *walk_state) |
101 | acpi_ds_method_data_init ( | ||
102 | struct acpi_walk_state *walk_state) | ||
103 | { | 92 | { |
104 | u32 i; | 93 | u32 i; |
105 | |||
106 | |||
107 | ACPI_FUNCTION_TRACE ("ds_method_data_init"); | ||
108 | 94 | ||
95 | ACPI_FUNCTION_TRACE("ds_method_data_init"); | ||
109 | 96 | ||
110 | /* Init the method arguments */ | 97 | /* Init the method arguments */ |
111 | 98 | ||
112 | for (i = 0; i < ACPI_METHOD_NUM_ARGS; i++) { | 99 | for (i = 0; i < ACPI_METHOD_NUM_ARGS; i++) { |
113 | ACPI_MOVE_32_TO_32 (&walk_state->arguments[i].name, | 100 | ACPI_MOVE_32_TO_32(&walk_state->arguments[i].name, |
114 | NAMEOF_ARG_NTE); | 101 | NAMEOF_ARG_NTE); |
115 | walk_state->arguments[i].name.integer |= (i << 24); | 102 | walk_state->arguments[i].name.integer |= (i << 24); |
116 | walk_state->arguments[i].descriptor = ACPI_DESC_TYPE_NAMED; | 103 | walk_state->arguments[i].descriptor = ACPI_DESC_TYPE_NAMED; |
117 | walk_state->arguments[i].type = ACPI_TYPE_ANY; | 104 | walk_state->arguments[i].type = ACPI_TYPE_ANY; |
118 | walk_state->arguments[i].flags = ANOBJ_END_OF_PEER_LIST | | 105 | walk_state->arguments[i].flags = ANOBJ_END_OF_PEER_LIST | |
119 | ANOBJ_METHOD_ARG; | 106 | ANOBJ_METHOD_ARG; |
120 | } | 107 | } |
121 | 108 | ||
122 | /* Init the method locals */ | 109 | /* Init the method locals */ |
123 | 110 | ||
124 | for (i = 0; i < ACPI_METHOD_NUM_LOCALS; i++) { | 111 | for (i = 0; i < ACPI_METHOD_NUM_LOCALS; i++) { |
125 | ACPI_MOVE_32_TO_32 (&walk_state->local_variables[i].name, | 112 | ACPI_MOVE_32_TO_32(&walk_state->local_variables[i].name, |
126 | NAMEOF_LOCAL_NTE); | 113 | NAMEOF_LOCAL_NTE); |
127 | 114 | ||
128 | walk_state->local_variables[i].name.integer |= (i << 24); | 115 | walk_state->local_variables[i].name.integer |= (i << 24); |
129 | walk_state->local_variables[i].descriptor = ACPI_DESC_TYPE_NAMED; | 116 | walk_state->local_variables[i].descriptor = |
130 | walk_state->local_variables[i].type = ACPI_TYPE_ANY; | 117 | ACPI_DESC_TYPE_NAMED; |
131 | walk_state->local_variables[i].flags = ANOBJ_END_OF_PEER_LIST | | 118 | walk_state->local_variables[i].type = ACPI_TYPE_ANY; |
132 | ANOBJ_METHOD_LOCAL; | 119 | walk_state->local_variables[i].flags = ANOBJ_END_OF_PEER_LIST | |
120 | ANOBJ_METHOD_LOCAL; | ||
133 | } | 121 | } |
134 | 122 | ||
135 | return_VOID; | 123 | return_VOID; |
136 | } | 124 | } |
137 | 125 | ||
138 | |||
139 | /******************************************************************************* | 126 | /******************************************************************************* |
140 | * | 127 | * |
141 | * FUNCTION: acpi_ds_method_data_delete_all | 128 | * FUNCTION: acpi_ds_method_data_delete_all |
@@ -149,26 +136,25 @@ acpi_ds_method_data_init ( | |||
149 | * | 136 | * |
150 | ******************************************************************************/ | 137 | ******************************************************************************/ |
151 | 138 | ||
152 | void | 139 | void acpi_ds_method_data_delete_all(struct acpi_walk_state *walk_state) |
153 | acpi_ds_method_data_delete_all ( | ||
154 | struct acpi_walk_state *walk_state) | ||
155 | { | 140 | { |
156 | u32 index; | 141 | u32 index; |
157 | |||
158 | |||
159 | ACPI_FUNCTION_TRACE ("ds_method_data_delete_all"); | ||
160 | 142 | ||
143 | ACPI_FUNCTION_TRACE("ds_method_data_delete_all"); | ||
161 | 144 | ||
162 | /* Detach the locals */ | 145 | /* Detach the locals */ |
163 | 146 | ||
164 | for (index = 0; index < ACPI_METHOD_NUM_LOCALS; index++) { | 147 | for (index = 0; index < ACPI_METHOD_NUM_LOCALS; index++) { |
165 | if (walk_state->local_variables[index].object) { | 148 | if (walk_state->local_variables[index].object) { |
166 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Deleting Local%d=%p\n", | 149 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Deleting Local%d=%p\n", |
167 | index, walk_state->local_variables[index].object)); | 150 | index, |
151 | walk_state->local_variables[index]. | ||
152 | object)); | ||
168 | 153 | ||
169 | /* Detach object (if present) and remove a reference */ | 154 | /* Detach object (if present) and remove a reference */ |
170 | 155 | ||
171 | acpi_ns_detach_object (&walk_state->local_variables[index]); | 156 | acpi_ns_detach_object(&walk_state-> |
157 | local_variables[index]); | ||
172 | } | 158 | } |
173 | } | 159 | } |
174 | 160 | ||
@@ -176,19 +162,19 @@ acpi_ds_method_data_delete_all ( | |||
176 | 162 | ||
177 | for (index = 0; index < ACPI_METHOD_NUM_ARGS; index++) { | 163 | for (index = 0; index < ACPI_METHOD_NUM_ARGS; index++) { |
178 | if (walk_state->arguments[index].object) { | 164 | if (walk_state->arguments[index].object) { |
179 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Deleting Arg%d=%p\n", | 165 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Deleting Arg%d=%p\n", |
180 | index, walk_state->arguments[index].object)); | 166 | index, |
167 | walk_state->arguments[index].object)); | ||
181 | 168 | ||
182 | /* Detach object (if present) and remove a reference */ | 169 | /* Detach object (if present) and remove a reference */ |
183 | 170 | ||
184 | acpi_ns_detach_object (&walk_state->arguments[index]); | 171 | acpi_ns_detach_object(&walk_state->arguments[index]); |
185 | } | 172 | } |
186 | } | 173 | } |
187 | 174 | ||
188 | return_VOID; | 175 | return_VOID; |
189 | } | 176 | } |
190 | 177 | ||
191 | |||
192 | /******************************************************************************* | 178 | /******************************************************************************* |
193 | * | 179 | * |
194 | * FUNCTION: acpi_ds_method_data_init_args | 180 | * FUNCTION: acpi_ds_method_data_init_args |
@@ -206,47 +192,44 @@ acpi_ds_method_data_delete_all ( | |||
206 | ******************************************************************************/ | 192 | ******************************************************************************/ |
207 | 193 | ||
208 | acpi_status | 194 | acpi_status |
209 | acpi_ds_method_data_init_args ( | 195 | acpi_ds_method_data_init_args(union acpi_operand_object **params, |
210 | union acpi_operand_object **params, | 196 | u32 max_param_count, |
211 | u32 max_param_count, | 197 | struct acpi_walk_state *walk_state) |
212 | struct acpi_walk_state *walk_state) | ||
213 | { | 198 | { |
214 | acpi_status status; | 199 | acpi_status status; |
215 | u32 index = 0; | 200 | u32 index = 0; |
216 | |||
217 | |||
218 | ACPI_FUNCTION_TRACE_PTR ("ds_method_data_init_args", params); | ||
219 | 201 | ||
202 | ACPI_FUNCTION_TRACE_PTR("ds_method_data_init_args", params); | ||
220 | 203 | ||
221 | if (!params) { | 204 | if (!params) { |
222 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "No param list passed to method\n")); | 205 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
223 | return_ACPI_STATUS (AE_OK); | 206 | "No param list passed to method\n")); |
207 | return_ACPI_STATUS(AE_OK); | ||
224 | } | 208 | } |
225 | 209 | ||
226 | /* Copy passed parameters into the new method stack frame */ | 210 | /* Copy passed parameters into the new method stack frame */ |
227 | 211 | ||
228 | while ((index < ACPI_METHOD_NUM_ARGS) && | 212 | while ((index < ACPI_METHOD_NUM_ARGS) && |
229 | (index < max_param_count) && | 213 | (index < max_param_count) && params[index]) { |
230 | params[index]) { | ||
231 | /* | 214 | /* |
232 | * A valid parameter. | 215 | * A valid parameter. |
233 | * Store the argument in the method/walk descriptor. | 216 | * Store the argument in the method/walk descriptor. |
234 | * Do not copy the arg in order to implement call by reference | 217 | * Do not copy the arg in order to implement call by reference |
235 | */ | 218 | */ |
236 | status = acpi_ds_method_data_set_value (AML_ARG_OP, index, | 219 | status = acpi_ds_method_data_set_value(AML_ARG_OP, index, |
237 | params[index], walk_state); | 220 | params[index], |
238 | if (ACPI_FAILURE (status)) { | 221 | walk_state); |
239 | return_ACPI_STATUS (status); | 222 | if (ACPI_FAILURE(status)) { |
223 | return_ACPI_STATUS(status); | ||
240 | } | 224 | } |
241 | 225 | ||
242 | index++; | 226 | index++; |
243 | } | 227 | } |
244 | 228 | ||
245 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%d args passed to method\n", index)); | 229 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "%d args passed to method\n", index)); |
246 | return_ACPI_STATUS (AE_OK); | 230 | return_ACPI_STATUS(AE_OK); |
247 | } | 231 | } |
248 | 232 | ||
249 | |||
250 | /******************************************************************************* | 233 | /******************************************************************************* |
251 | * | 234 | * |
252 | * FUNCTION: acpi_ds_method_data_get_node | 235 | * FUNCTION: acpi_ds_method_data_get_node |
@@ -263,14 +246,12 @@ acpi_ds_method_data_init_args ( | |||
263 | ******************************************************************************/ | 246 | ******************************************************************************/ |
264 | 247 | ||
265 | acpi_status | 248 | acpi_status |
266 | acpi_ds_method_data_get_node ( | 249 | acpi_ds_method_data_get_node(u16 opcode, |
267 | u16 opcode, | 250 | u32 index, |
268 | u32 index, | 251 | struct acpi_walk_state *walk_state, |
269 | struct acpi_walk_state *walk_state, | 252 | struct acpi_namespace_node **node) |
270 | struct acpi_namespace_node **node) | ||
271 | { | 253 | { |
272 | ACPI_FUNCTION_TRACE ("ds_method_data_get_node"); | 254 | ACPI_FUNCTION_TRACE("ds_method_data_get_node"); |
273 | |||
274 | 255 | ||
275 | /* | 256 | /* |
276 | * Method Locals and Arguments are supported | 257 | * Method Locals and Arguments are supported |
@@ -279,10 +260,10 @@ acpi_ds_method_data_get_node ( | |||
279 | case AML_LOCAL_OP: | 260 | case AML_LOCAL_OP: |
280 | 261 | ||
281 | if (index > ACPI_METHOD_MAX_LOCAL) { | 262 | if (index > ACPI_METHOD_MAX_LOCAL) { |
282 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 263 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
283 | "Local index %d is invalid (max %d)\n", | 264 | "Local index %d is invalid (max %d)\n", |
284 | index, ACPI_METHOD_MAX_LOCAL)); | 265 | index, ACPI_METHOD_MAX_LOCAL)); |
285 | return_ACPI_STATUS (AE_AML_INVALID_INDEX); | 266 | return_ACPI_STATUS(AE_AML_INVALID_INDEX); |
286 | } | 267 | } |
287 | 268 | ||
288 | /* Return a pointer to the pseudo-node */ | 269 | /* Return a pointer to the pseudo-node */ |
@@ -293,10 +274,10 @@ acpi_ds_method_data_get_node ( | |||
293 | case AML_ARG_OP: | 274 | case AML_ARG_OP: |
294 | 275 | ||
295 | if (index > ACPI_METHOD_MAX_ARG) { | 276 | if (index > ACPI_METHOD_MAX_ARG) { |
296 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 277 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
297 | "Arg index %d is invalid (max %d)\n", | 278 | "Arg index %d is invalid (max %d)\n", |
298 | index, ACPI_METHOD_MAX_ARG)); | 279 | index, ACPI_METHOD_MAX_ARG)); |
299 | return_ACPI_STATUS (AE_AML_INVALID_INDEX); | 280 | return_ACPI_STATUS(AE_AML_INVALID_INDEX); |
300 | } | 281 | } |
301 | 282 | ||
302 | /* Return a pointer to the pseudo-node */ | 283 | /* Return a pointer to the pseudo-node */ |
@@ -305,14 +286,14 @@ acpi_ds_method_data_get_node ( | |||
305 | break; | 286 | break; |
306 | 287 | ||
307 | default: | 288 | default: |
308 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Opcode %d is invalid\n", opcode)); | 289 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Opcode %d is invalid\n", |
309 | return_ACPI_STATUS (AE_AML_BAD_OPCODE); | 290 | opcode)); |
291 | return_ACPI_STATUS(AE_AML_BAD_OPCODE); | ||
310 | } | 292 | } |
311 | 293 | ||
312 | return_ACPI_STATUS (AE_OK); | 294 | return_ACPI_STATUS(AE_OK); |
313 | } | 295 | } |
314 | 296 | ||
315 | |||
316 | /******************************************************************************* | 297 | /******************************************************************************* |
317 | * | 298 | * |
318 | * FUNCTION: acpi_ds_method_data_set_value | 299 | * FUNCTION: acpi_ds_method_data_set_value |
@@ -330,29 +311,26 @@ acpi_ds_method_data_get_node ( | |||
330 | ******************************************************************************/ | 311 | ******************************************************************************/ |
331 | 312 | ||
332 | static acpi_status | 313 | static acpi_status |
333 | acpi_ds_method_data_set_value ( | 314 | acpi_ds_method_data_set_value(u16 opcode, |
334 | u16 opcode, | 315 | u32 index, |
335 | u32 index, | 316 | union acpi_operand_object *object, |
336 | union acpi_operand_object *object, | 317 | struct acpi_walk_state *walk_state) |
337 | struct acpi_walk_state *walk_state) | ||
338 | { | 318 | { |
339 | acpi_status status; | 319 | acpi_status status; |
340 | struct acpi_namespace_node *node; | 320 | struct acpi_namespace_node *node; |
341 | |||
342 | 321 | ||
343 | ACPI_FUNCTION_TRACE ("ds_method_data_set_value"); | 322 | ACPI_FUNCTION_TRACE("ds_method_data_set_value"); |
344 | 323 | ||
345 | 324 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | |
346 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, | 325 | "new_obj %p Opcode %X, Refs=%d [%s]\n", object, |
347 | "new_obj %p Opcode %X, Refs=%d [%s]\n", object, | 326 | opcode, object->common.reference_count, |
348 | opcode, object->common.reference_count, | 327 | acpi_ut_get_type_name(object->common.type))); |
349 | acpi_ut_get_type_name (object->common.type))); | ||
350 | 328 | ||
351 | /* Get the namespace node for the arg/local */ | 329 | /* Get the namespace node for the arg/local */ |
352 | 330 | ||
353 | status = acpi_ds_method_data_get_node (opcode, index, walk_state, &node); | 331 | status = acpi_ds_method_data_get_node(opcode, index, walk_state, &node); |
354 | if (ACPI_FAILURE (status)) { | 332 | if (ACPI_FAILURE(status)) { |
355 | return_ACPI_STATUS (status); | 333 | return_ACPI_STATUS(status); |
356 | } | 334 | } |
357 | 335 | ||
358 | /* | 336 | /* |
@@ -361,15 +339,14 @@ acpi_ds_method_data_set_value ( | |||
361 | * reference semantics of ACPI Control Method invocation. | 339 | * reference semantics of ACPI Control Method invocation. |
362 | * (See ACPI specification 2.0_c) | 340 | * (See ACPI specification 2.0_c) |
363 | */ | 341 | */ |
364 | acpi_ut_add_reference (object); | 342 | acpi_ut_add_reference(object); |
365 | 343 | ||
366 | /* Install the object */ | 344 | /* Install the object */ |
367 | 345 | ||
368 | node->object = object; | 346 | node->object = object; |
369 | return_ACPI_STATUS (status); | 347 | return_ACPI_STATUS(status); |
370 | } | 348 | } |
371 | 349 | ||
372 | |||
373 | /******************************************************************************* | 350 | /******************************************************************************* |
374 | * | 351 | * |
375 | * FUNCTION: acpi_ds_method_data_get_value | 352 | * FUNCTION: acpi_ds_method_data_get_value |
@@ -387,32 +364,30 @@ acpi_ds_method_data_set_value ( | |||
387 | ******************************************************************************/ | 364 | ******************************************************************************/ |
388 | 365 | ||
389 | acpi_status | 366 | acpi_status |
390 | acpi_ds_method_data_get_value ( | 367 | acpi_ds_method_data_get_value(u16 opcode, |
391 | u16 opcode, | 368 | u32 index, |
392 | u32 index, | 369 | struct acpi_walk_state *walk_state, |
393 | struct acpi_walk_state *walk_state, | 370 | union acpi_operand_object **dest_desc) |
394 | union acpi_operand_object **dest_desc) | ||
395 | { | 371 | { |
396 | acpi_status status; | 372 | acpi_status status; |
397 | struct acpi_namespace_node *node; | 373 | struct acpi_namespace_node *node; |
398 | union acpi_operand_object *object; | 374 | union acpi_operand_object *object; |
399 | |||
400 | |||
401 | ACPI_FUNCTION_TRACE ("ds_method_data_get_value"); | ||
402 | 375 | ||
376 | ACPI_FUNCTION_TRACE("ds_method_data_get_value"); | ||
403 | 377 | ||
404 | /* Validate the object descriptor */ | 378 | /* Validate the object descriptor */ |
405 | 379 | ||
406 | if (!dest_desc) { | 380 | if (!dest_desc) { |
407 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null object descriptor pointer\n")); | 381 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
408 | return_ACPI_STATUS (AE_BAD_PARAMETER); | 382 | "Null object descriptor pointer\n")); |
383 | return_ACPI_STATUS(AE_BAD_PARAMETER); | ||
409 | } | 384 | } |
410 | 385 | ||
411 | /* Get the namespace node for the arg/local */ | 386 | /* Get the namespace node for the arg/local */ |
412 | 387 | ||
413 | status = acpi_ds_method_data_get_node (opcode, index, walk_state, &node); | 388 | status = acpi_ds_method_data_get_node(opcode, index, walk_state, &node); |
414 | if (ACPI_FAILURE (status)) { | 389 | if (ACPI_FAILURE(status)) { |
415 | return_ACPI_STATUS (status); | 390 | return_ACPI_STATUS(status); |
416 | } | 391 | } |
417 | 392 | ||
418 | /* Get the object from the node */ | 393 | /* Get the object from the node */ |
@@ -433,9 +408,10 @@ acpi_ds_method_data_get_value ( | |||
433 | /* If slack enabled, init the local_x/arg_x to an Integer of value zero */ | 408 | /* If slack enabled, init the local_x/arg_x to an Integer of value zero */ |
434 | 409 | ||
435 | if (acpi_gbl_enable_interpreter_slack) { | 410 | if (acpi_gbl_enable_interpreter_slack) { |
436 | object = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); | 411 | object = |
412 | acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); | ||
437 | if (!object) { | 413 | if (!object) { |
438 | return_ACPI_STATUS (AE_NO_MEMORY); | 414 | return_ACPI_STATUS(AE_NO_MEMORY); |
439 | } | 415 | } |
440 | 416 | ||
441 | object->integer.value = 0; | 417 | object->integer.value = 0; |
@@ -444,27 +420,29 @@ acpi_ds_method_data_get_value ( | |||
444 | 420 | ||
445 | /* Otherwise, return the error */ | 421 | /* Otherwise, return the error */ |
446 | 422 | ||
447 | else switch (opcode) { | 423 | else |
448 | case AML_ARG_OP: | 424 | switch (opcode) { |
425 | case AML_ARG_OP: | ||
449 | 426 | ||
450 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 427 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
451 | "Uninitialized Arg[%d] at node %p\n", | 428 | "Uninitialized Arg[%d] at node %p\n", |
452 | index, node)); | 429 | index, node)); |
453 | 430 | ||
454 | return_ACPI_STATUS (AE_AML_UNINITIALIZED_ARG); | 431 | return_ACPI_STATUS(AE_AML_UNINITIALIZED_ARG); |
455 | 432 | ||
456 | case AML_LOCAL_OP: | 433 | case AML_LOCAL_OP: |
457 | 434 | ||
458 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 435 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
459 | "Uninitialized Local[%d] at node %p\n", | 436 | "Uninitialized Local[%d] at node %p\n", |
460 | index, node)); | 437 | index, node)); |
461 | 438 | ||
462 | return_ACPI_STATUS (AE_AML_UNINITIALIZED_LOCAL); | 439 | return_ACPI_STATUS(AE_AML_UNINITIALIZED_LOCAL); |
463 | 440 | ||
464 | default: | 441 | default: |
465 | ACPI_REPORT_ERROR (("Not Arg/Local opcode: %X\n", opcode)); | 442 | ACPI_REPORT_ERROR(("Not Arg/Local opcode: %X\n", |
466 | return_ACPI_STATUS (AE_AML_INTERNAL); | 443 | opcode)); |
467 | } | 444 | return_ACPI_STATUS(AE_AML_INTERNAL); |
445 | } | ||
468 | } | 446 | } |
469 | 447 | ||
470 | /* | 448 | /* |
@@ -472,12 +450,11 @@ acpi_ds_method_data_get_value ( | |||
472 | * Return an additional reference to the object | 450 | * Return an additional reference to the object |
473 | */ | 451 | */ |
474 | *dest_desc = object; | 452 | *dest_desc = object; |
475 | acpi_ut_add_reference (object); | 453 | acpi_ut_add_reference(object); |
476 | 454 | ||
477 | return_ACPI_STATUS (AE_OK); | 455 | return_ACPI_STATUS(AE_OK); |
478 | } | 456 | } |
479 | 457 | ||
480 | |||
481 | /******************************************************************************* | 458 | /******************************************************************************* |
482 | * | 459 | * |
483 | * FUNCTION: acpi_ds_method_data_delete_value | 460 | * FUNCTION: acpi_ds_method_data_delete_value |
@@ -494,29 +471,25 @@ acpi_ds_method_data_get_value ( | |||
494 | ******************************************************************************/ | 471 | ******************************************************************************/ |
495 | 472 | ||
496 | static void | 473 | static void |
497 | acpi_ds_method_data_delete_value ( | 474 | acpi_ds_method_data_delete_value(u16 opcode, |
498 | u16 opcode, | 475 | u32 index, struct acpi_walk_state *walk_state) |
499 | u32 index, | ||
500 | struct acpi_walk_state *walk_state) | ||
501 | { | 476 | { |
502 | acpi_status status; | 477 | acpi_status status; |
503 | struct acpi_namespace_node *node; | 478 | struct acpi_namespace_node *node; |
504 | union acpi_operand_object *object; | 479 | union acpi_operand_object *object; |
505 | |||
506 | |||
507 | ACPI_FUNCTION_TRACE ("ds_method_data_delete_value"); | ||
508 | 480 | ||
481 | ACPI_FUNCTION_TRACE("ds_method_data_delete_value"); | ||
509 | 482 | ||
510 | /* Get the namespace node for the arg/local */ | 483 | /* Get the namespace node for the arg/local */ |
511 | 484 | ||
512 | status = acpi_ds_method_data_get_node (opcode, index, walk_state, &node); | 485 | status = acpi_ds_method_data_get_node(opcode, index, walk_state, &node); |
513 | if (ACPI_FAILURE (status)) { | 486 | if (ACPI_FAILURE(status)) { |
514 | return_VOID; | 487 | return_VOID; |
515 | } | 488 | } |
516 | 489 | ||
517 | /* Get the associated object */ | 490 | /* Get the associated object */ |
518 | 491 | ||
519 | object = acpi_ns_get_attached_object (node); | 492 | object = acpi_ns_get_attached_object(node); |
520 | 493 | ||
521 | /* | 494 | /* |
522 | * Undefine the Arg or Local by setting its descriptor | 495 | * Undefine the Arg or Local by setting its descriptor |
@@ -526,19 +499,18 @@ acpi_ds_method_data_delete_value ( | |||
526 | node->object = NULL; | 499 | node->object = NULL; |
527 | 500 | ||
528 | if ((object) && | 501 | if ((object) && |
529 | (ACPI_GET_DESCRIPTOR_TYPE (object) == ACPI_DESC_TYPE_OPERAND)) { | 502 | (ACPI_GET_DESCRIPTOR_TYPE(object) == ACPI_DESC_TYPE_OPERAND)) { |
530 | /* | 503 | /* |
531 | * There is a valid object. | 504 | * There is a valid object. |
532 | * Decrement the reference count by one to balance the | 505 | * Decrement the reference count by one to balance the |
533 | * increment when the object was stored. | 506 | * increment when the object was stored. |
534 | */ | 507 | */ |
535 | acpi_ut_remove_reference (object); | 508 | acpi_ut_remove_reference(object); |
536 | } | 509 | } |
537 | 510 | ||
538 | return_VOID; | 511 | return_VOID; |
539 | } | 512 | } |
540 | 513 | ||
541 | |||
542 | /******************************************************************************* | 514 | /******************************************************************************* |
543 | * | 515 | * |
544 | * FUNCTION: acpi_ds_store_object_to_local | 516 | * FUNCTION: acpi_ds_store_object_to_local |
@@ -557,40 +529,38 @@ acpi_ds_method_data_delete_value ( | |||
557 | ******************************************************************************/ | 529 | ******************************************************************************/ |
558 | 530 | ||
559 | acpi_status | 531 | acpi_status |
560 | acpi_ds_store_object_to_local ( | 532 | acpi_ds_store_object_to_local(u16 opcode, |
561 | u16 opcode, | 533 | u32 index, |
562 | u32 index, | 534 | union acpi_operand_object *obj_desc, |
563 | union acpi_operand_object *obj_desc, | 535 | struct acpi_walk_state *walk_state) |
564 | struct acpi_walk_state *walk_state) | ||
565 | { | 536 | { |
566 | acpi_status status; | 537 | acpi_status status; |
567 | struct acpi_namespace_node *node; | 538 | struct acpi_namespace_node *node; |
568 | union acpi_operand_object *current_obj_desc; | 539 | union acpi_operand_object *current_obj_desc; |
569 | union acpi_operand_object *new_obj_desc; | 540 | union acpi_operand_object *new_obj_desc; |
570 | 541 | ||
571 | 542 | ACPI_FUNCTION_TRACE("ds_store_object_to_local"); | |
572 | ACPI_FUNCTION_TRACE ("ds_store_object_to_local"); | 543 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Opcode=%X Index=%d Obj=%p\n", |
573 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Opcode=%X Index=%d Obj=%p\n", | 544 | opcode, index, obj_desc)); |
574 | opcode, index, obj_desc)); | ||
575 | 545 | ||
576 | /* Parameter validation */ | 546 | /* Parameter validation */ |
577 | 547 | ||
578 | if (!obj_desc) { | 548 | if (!obj_desc) { |
579 | return_ACPI_STATUS (AE_BAD_PARAMETER); | 549 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
580 | } | 550 | } |
581 | 551 | ||
582 | /* Get the namespace node for the arg/local */ | 552 | /* Get the namespace node for the arg/local */ |
583 | 553 | ||
584 | status = acpi_ds_method_data_get_node (opcode, index, walk_state, &node); | 554 | status = acpi_ds_method_data_get_node(opcode, index, walk_state, &node); |
585 | if (ACPI_FAILURE (status)) { | 555 | if (ACPI_FAILURE(status)) { |
586 | return_ACPI_STATUS (status); | 556 | return_ACPI_STATUS(status); |
587 | } | 557 | } |
588 | 558 | ||
589 | current_obj_desc = acpi_ns_get_attached_object (node); | 559 | current_obj_desc = acpi_ns_get_attached_object(node); |
590 | if (current_obj_desc == obj_desc) { | 560 | if (current_obj_desc == obj_desc) { |
591 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p already installed!\n", | 561 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Obj=%p already installed!\n", |
592 | obj_desc)); | 562 | obj_desc)); |
593 | return_ACPI_STATUS (status); | 563 | return_ACPI_STATUS(status); |
594 | } | 564 | } |
595 | 565 | ||
596 | /* | 566 | /* |
@@ -602,9 +572,11 @@ acpi_ds_store_object_to_local ( | |||
602 | */ | 572 | */ |
603 | new_obj_desc = obj_desc; | 573 | new_obj_desc = obj_desc; |
604 | if (obj_desc->common.reference_count > 1) { | 574 | if (obj_desc->common.reference_count > 1) { |
605 | status = acpi_ut_copy_iobject_to_iobject (obj_desc, &new_obj_desc, walk_state); | 575 | status = |
606 | if (ACPI_FAILURE (status)) { | 576 | acpi_ut_copy_iobject_to_iobject(obj_desc, &new_obj_desc, |
607 | return_ACPI_STATUS (status); | 577 | walk_state); |
578 | if (ACPI_FAILURE(status)) { | ||
579 | return_ACPI_STATUS(status); | ||
608 | } | 580 | } |
609 | } | 581 | } |
610 | 582 | ||
@@ -636,28 +608,36 @@ acpi_ds_store_object_to_local ( | |||
636 | * If we have a valid reference object that came from ref_of(), | 608 | * If we have a valid reference object that came from ref_of(), |
637 | * do the indirect store | 609 | * do the indirect store |
638 | */ | 610 | */ |
639 | if ((ACPI_GET_DESCRIPTOR_TYPE (current_obj_desc) == ACPI_DESC_TYPE_OPERAND) && | 611 | if ((ACPI_GET_DESCRIPTOR_TYPE(current_obj_desc) == |
640 | (current_obj_desc->common.type == ACPI_TYPE_LOCAL_REFERENCE) && | 612 | ACPI_DESC_TYPE_OPERAND) |
641 | (current_obj_desc->reference.opcode == AML_REF_OF_OP)) { | 613 | && (current_obj_desc->common.type == |
642 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, | 614 | ACPI_TYPE_LOCAL_REFERENCE) |
643 | "Arg (%p) is an obj_ref(Node), storing in node %p\n", | 615 | && (current_obj_desc->reference.opcode == |
644 | new_obj_desc, current_obj_desc)); | 616 | AML_REF_OF_OP)) { |
617 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | ||
618 | "Arg (%p) is an obj_ref(Node), storing in node %p\n", | ||
619 | new_obj_desc, | ||
620 | current_obj_desc)); | ||
645 | 621 | ||
646 | /* | 622 | /* |
647 | * Store this object to the Node (perform the indirect store) | 623 | * Store this object to the Node (perform the indirect store) |
648 | * NOTE: No implicit conversion is performed, as per the ACPI | 624 | * NOTE: No implicit conversion is performed, as per the ACPI |
649 | * specification rules on storing to Locals/Args. | 625 | * specification rules on storing to Locals/Args. |
650 | */ | 626 | */ |
651 | status = acpi_ex_store_object_to_node (new_obj_desc, | 627 | status = |
652 | current_obj_desc->reference.object, walk_state, | 628 | acpi_ex_store_object_to_node(new_obj_desc, |
653 | ACPI_NO_IMPLICIT_CONVERSION); | 629 | current_obj_desc-> |
630 | reference. | ||
631 | object, | ||
632 | walk_state, | ||
633 | ACPI_NO_IMPLICIT_CONVERSION); | ||
654 | 634 | ||
655 | /* Remove local reference if we copied the object above */ | 635 | /* Remove local reference if we copied the object above */ |
656 | 636 | ||
657 | if (new_obj_desc != obj_desc) { | 637 | if (new_obj_desc != obj_desc) { |
658 | acpi_ut_remove_reference (new_obj_desc); | 638 | acpi_ut_remove_reference(new_obj_desc); |
659 | } | 639 | } |
660 | return_ACPI_STATUS (status); | 640 | return_ACPI_STATUS(status); |
661 | } | 641 | } |
662 | } | 642 | } |
663 | 643 | ||
@@ -665,7 +645,7 @@ acpi_ds_store_object_to_local ( | |||
665 | * Delete the existing object | 645 | * Delete the existing object |
666 | * before storing the new one | 646 | * before storing the new one |
667 | */ | 647 | */ |
668 | acpi_ds_method_data_delete_value (opcode, index, walk_state); | 648 | acpi_ds_method_data_delete_value(opcode, index, walk_state); |
669 | } | 649 | } |
670 | 650 | ||
671 | /* | 651 | /* |
@@ -673,18 +653,19 @@ acpi_ds_store_object_to_local ( | |||
673 | * the descriptor for the Arg or Local. | 653 | * the descriptor for the Arg or Local. |
674 | * (increments the object reference count by one) | 654 | * (increments the object reference count by one) |
675 | */ | 655 | */ |
676 | status = acpi_ds_method_data_set_value (opcode, index, new_obj_desc, walk_state); | 656 | status = |
657 | acpi_ds_method_data_set_value(opcode, index, new_obj_desc, | ||
658 | walk_state); | ||
677 | 659 | ||
678 | /* Remove local reference if we copied the object above */ | 660 | /* Remove local reference if we copied the object above */ |
679 | 661 | ||
680 | if (new_obj_desc != obj_desc) { | 662 | if (new_obj_desc != obj_desc) { |
681 | acpi_ut_remove_reference (new_obj_desc); | 663 | acpi_ut_remove_reference(new_obj_desc); |
682 | } | 664 | } |
683 | 665 | ||
684 | return_ACPI_STATUS (status); | 666 | return_ACPI_STATUS(status); |
685 | } | 667 | } |
686 | 668 | ||
687 | |||
688 | #ifdef ACPI_OBSOLETE_FUNCTIONS | 669 | #ifdef ACPI_OBSOLETE_FUNCTIONS |
689 | /******************************************************************************* | 670 | /******************************************************************************* |
690 | * | 671 | * |
@@ -701,39 +682,33 @@ acpi_ds_store_object_to_local ( | |||
701 | ******************************************************************************/ | 682 | ******************************************************************************/ |
702 | 683 | ||
703 | acpi_object_type | 684 | acpi_object_type |
704 | acpi_ds_method_data_get_type ( | 685 | acpi_ds_method_data_get_type(u16 opcode, |
705 | u16 opcode, | 686 | u32 index, struct acpi_walk_state *walk_state) |
706 | u32 index, | ||
707 | struct acpi_walk_state *walk_state) | ||
708 | { | 687 | { |
709 | acpi_status status; | 688 | acpi_status status; |
710 | struct acpi_namespace_node *node; | 689 | struct acpi_namespace_node *node; |
711 | union acpi_operand_object *object; | 690 | union acpi_operand_object *object; |
712 | |||
713 | |||
714 | ACPI_FUNCTION_TRACE ("ds_method_data_get_type"); | ||
715 | 691 | ||
692 | ACPI_FUNCTION_TRACE("ds_method_data_get_type"); | ||
716 | 693 | ||
717 | /* Get the namespace node for the arg/local */ | 694 | /* Get the namespace node for the arg/local */ |
718 | 695 | ||
719 | status = acpi_ds_method_data_get_node (opcode, index, walk_state, &node); | 696 | status = acpi_ds_method_data_get_node(opcode, index, walk_state, &node); |
720 | if (ACPI_FAILURE (status)) { | 697 | if (ACPI_FAILURE(status)) { |
721 | return_VALUE ((ACPI_TYPE_NOT_FOUND)); | 698 | return_VALUE((ACPI_TYPE_NOT_FOUND)); |
722 | } | 699 | } |
723 | 700 | ||
724 | /* Get the object */ | 701 | /* Get the object */ |
725 | 702 | ||
726 | object = acpi_ns_get_attached_object (node); | 703 | object = acpi_ns_get_attached_object(node); |
727 | if (!object) { | 704 | if (!object) { |
728 | /* Uninitialized local/arg, return TYPE_ANY */ | 705 | /* Uninitialized local/arg, return TYPE_ANY */ |
729 | 706 | ||
730 | return_VALUE (ACPI_TYPE_ANY); | 707 | return_VALUE(ACPI_TYPE_ANY); |
731 | } | 708 | } |
732 | 709 | ||
733 | /* Get the object type */ | 710 | /* Get the object type */ |
734 | 711 | ||
735 | return_VALUE (ACPI_GET_OBJECT_TYPE (object)); | 712 | return_VALUE(ACPI_GET_OBJECT_TYPE(object)); |
736 | } | 713 | } |
737 | #endif | 714 | #endif |
738 | |||
739 | |||
diff --git a/drivers/acpi/dispatcher/dsobject.c b/drivers/acpi/dispatcher/dsobject.c index 1eee2d54180f..8ac0cd93adb5 100644 --- a/drivers/acpi/dispatcher/dsobject.c +++ b/drivers/acpi/dispatcher/dsobject.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> |
@@ -50,14 +49,12 @@ | |||
50 | #include <acpi/acinterp.h> | 49 | #include <acpi/acinterp.h> |
51 | 50 | ||
52 | #define _COMPONENT ACPI_DISPATCHER | 51 | #define _COMPONENT ACPI_DISPATCHER |
53 | ACPI_MODULE_NAME ("dsobject") | 52 | ACPI_MODULE_NAME("dsobject") |
54 | 53 | ||
55 | static acpi_status | 54 | static acpi_status |
56 | acpi_ds_build_internal_object ( | 55 | acpi_ds_build_internal_object(struct acpi_walk_state *walk_state, |
57 | struct acpi_walk_state *walk_state, | 56 | union acpi_parse_object *op, |
58 | union acpi_parse_object *op, | 57 | union acpi_operand_object **obj_desc_ptr); |
59 | union acpi_operand_object **obj_desc_ptr); | ||
60 | |||
61 | 58 | ||
62 | #ifndef ACPI_NO_METHOD_EXECUTION | 59 | #ifndef ACPI_NO_METHOD_EXECUTION |
63 | /******************************************************************************* | 60 | /******************************************************************************* |
@@ -76,17 +73,14 @@ acpi_ds_build_internal_object ( | |||
76 | ******************************************************************************/ | 73 | ******************************************************************************/ |
77 | 74 | ||
78 | static acpi_status | 75 | static acpi_status |
79 | acpi_ds_build_internal_object ( | 76 | acpi_ds_build_internal_object(struct acpi_walk_state *walk_state, |
80 | struct acpi_walk_state *walk_state, | 77 | union acpi_parse_object *op, |
81 | union acpi_parse_object *op, | 78 | union acpi_operand_object **obj_desc_ptr) |
82 | union acpi_operand_object **obj_desc_ptr) | ||
83 | { | 79 | { |
84 | union acpi_operand_object *obj_desc; | 80 | union acpi_operand_object *obj_desc; |
85 | acpi_status status; | 81 | acpi_status status; |
86 | |||
87 | |||
88 | ACPI_FUNCTION_TRACE ("ds_build_internal_object"); | ||
89 | 82 | ||
83 | ACPI_FUNCTION_TRACE("ds_build_internal_object"); | ||
90 | 84 | ||
91 | *obj_desc_ptr = NULL; | 85 | *obj_desc_ptr = NULL; |
92 | if (op->common.aml_opcode == AML_INT_NAMEPATH_OP) { | 86 | if (op->common.aml_opcode == AML_INT_NAMEPATH_OP) { |
@@ -96,40 +90,44 @@ acpi_ds_build_internal_object ( | |||
96 | * Otherwise, go ahead and look it up now | 90 | * Otherwise, go ahead and look it up now |
97 | */ | 91 | */ |
98 | if (!op->common.node) { | 92 | if (!op->common.node) { |
99 | status = acpi_ns_lookup (walk_state->scope_info, | 93 | status = acpi_ns_lookup(walk_state->scope_info, |
100 | op->common.value.string, | 94 | op->common.value.string, |
101 | ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, | 95 | ACPI_TYPE_ANY, |
102 | ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, | 96 | ACPI_IMODE_EXECUTE, |
103 | NULL, | 97 | ACPI_NS_SEARCH_PARENT | |
104 | (struct acpi_namespace_node **) &(op->common.node)); | 98 | ACPI_NS_DONT_OPEN_SCOPE, NULL, |
105 | 99 | (struct acpi_namespace_node **) | |
106 | if (ACPI_FAILURE (status)) { | 100 | &(op->common.node)); |
107 | ACPI_REPORT_NSERROR (op->common.value.string, status); | 101 | |
108 | return_ACPI_STATUS (status); | 102 | if (ACPI_FAILURE(status)) { |
103 | ACPI_REPORT_NSERROR(op->common.value.string, | ||
104 | status); | ||
105 | return_ACPI_STATUS(status); | ||
109 | } | 106 | } |
110 | } | 107 | } |
111 | } | 108 | } |
112 | 109 | ||
113 | /* Create and init the internal ACPI object */ | 110 | /* Create and init the internal ACPI object */ |
114 | 111 | ||
115 | obj_desc = acpi_ut_create_internal_object ( | 112 | obj_desc = acpi_ut_create_internal_object((acpi_ps_get_opcode_info |
116 | (acpi_ps_get_opcode_info (op->common.aml_opcode))->object_type); | 113 | (op->common.aml_opcode))-> |
114 | object_type); | ||
117 | if (!obj_desc) { | 115 | if (!obj_desc) { |
118 | return_ACPI_STATUS (AE_NO_MEMORY); | 116 | return_ACPI_STATUS(AE_NO_MEMORY); |
119 | } | 117 | } |
120 | 118 | ||
121 | status = acpi_ds_init_object_from_op (walk_state, op, op->common.aml_opcode, | 119 | status = |
122 | &obj_desc); | 120 | acpi_ds_init_object_from_op(walk_state, op, op->common.aml_opcode, |
123 | if (ACPI_FAILURE (status)) { | 121 | &obj_desc); |
124 | acpi_ut_remove_reference (obj_desc); | 122 | if (ACPI_FAILURE(status)) { |
125 | return_ACPI_STATUS (status); | 123 | acpi_ut_remove_reference(obj_desc); |
124 | return_ACPI_STATUS(status); | ||
126 | } | 125 | } |
127 | 126 | ||
128 | *obj_desc_ptr = obj_desc; | 127 | *obj_desc_ptr = obj_desc; |
129 | return_ACPI_STATUS (AE_OK); | 128 | return_ACPI_STATUS(AE_OK); |
130 | } | 129 | } |
131 | 130 | ||
132 | |||
133 | /******************************************************************************* | 131 | /******************************************************************************* |
134 | * | 132 | * |
135 | * FUNCTION: acpi_ds_build_internal_buffer_obj | 133 | * FUNCTION: acpi_ds_build_internal_buffer_obj |
@@ -147,20 +145,17 @@ acpi_ds_build_internal_object ( | |||
147 | ******************************************************************************/ | 145 | ******************************************************************************/ |
148 | 146 | ||
149 | acpi_status | 147 | acpi_status |
150 | acpi_ds_build_internal_buffer_obj ( | 148 | acpi_ds_build_internal_buffer_obj(struct acpi_walk_state *walk_state, |
151 | struct acpi_walk_state *walk_state, | 149 | union acpi_parse_object *op, |
152 | union acpi_parse_object *op, | 150 | u32 buffer_length, |
153 | u32 buffer_length, | 151 | union acpi_operand_object **obj_desc_ptr) |
154 | union acpi_operand_object **obj_desc_ptr) | ||
155 | { | 152 | { |
156 | union acpi_parse_object *arg; | 153 | union acpi_parse_object *arg; |
157 | union acpi_operand_object *obj_desc; | 154 | union acpi_operand_object *obj_desc; |
158 | union acpi_parse_object *byte_list; | 155 | union acpi_parse_object *byte_list; |
159 | u32 byte_list_length = 0; | 156 | u32 byte_list_length = 0; |
160 | |||
161 | |||
162 | ACPI_FUNCTION_TRACE ("ds_build_internal_buffer_obj"); | ||
163 | 157 | ||
158 | ACPI_FUNCTION_TRACE("ds_build_internal_buffer_obj"); | ||
164 | 159 | ||
165 | obj_desc = *obj_desc_ptr; | 160 | obj_desc = *obj_desc_ptr; |
166 | if (obj_desc) { | 161 | if (obj_desc) { |
@@ -168,14 +163,13 @@ acpi_ds_build_internal_buffer_obj ( | |||
168 | * We are evaluating a Named buffer object "Name (xxxx, Buffer)". | 163 | * We are evaluating a Named buffer object "Name (xxxx, Buffer)". |
169 | * The buffer object already exists (from the NS node) | 164 | * The buffer object already exists (from the NS node) |
170 | */ | 165 | */ |
171 | } | 166 | } else { |
172 | else { | ||
173 | /* Create a new buffer object */ | 167 | /* Create a new buffer object */ |
174 | 168 | ||
175 | obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_BUFFER); | 169 | obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_BUFFER); |
176 | *obj_desc_ptr = obj_desc; | 170 | *obj_desc_ptr = obj_desc; |
177 | if (!obj_desc) { | 171 | if (!obj_desc) { |
178 | return_ACPI_STATUS (AE_NO_MEMORY); | 172 | return_ACPI_STATUS(AE_NO_MEMORY); |
179 | } | 173 | } |
180 | } | 174 | } |
181 | 175 | ||
@@ -184,16 +178,17 @@ acpi_ds_build_internal_buffer_obj ( | |||
184 | * individual bytes or a string initializer. In either case, a | 178 | * individual bytes or a string initializer. In either case, a |
185 | * byte_list appears in the AML. | 179 | * byte_list appears in the AML. |
186 | */ | 180 | */ |
187 | arg = op->common.value.arg; /* skip first arg */ | 181 | arg = op->common.value.arg; /* skip first arg */ |
188 | 182 | ||
189 | byte_list = arg->named.next; | 183 | byte_list = arg->named.next; |
190 | if (byte_list) { | 184 | if (byte_list) { |
191 | if (byte_list->common.aml_opcode != AML_INT_BYTELIST_OP) { | 185 | if (byte_list->common.aml_opcode != AML_INT_BYTELIST_OP) { |
192 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 186 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
193 | "Expecting bytelist, got AML opcode %X in op %p\n", | 187 | "Expecting bytelist, got AML opcode %X in op %p\n", |
194 | byte_list->common.aml_opcode, byte_list)); | 188 | byte_list->common.aml_opcode, |
189 | byte_list)); | ||
195 | 190 | ||
196 | acpi_ut_remove_reference (obj_desc); | 191 | acpi_ut_remove_reference(obj_desc); |
197 | return (AE_TYPE); | 192 | return (AE_TYPE); |
198 | } | 193 | } |
199 | 194 | ||
@@ -214,31 +209,29 @@ acpi_ds_build_internal_buffer_obj ( | |||
214 | 209 | ||
215 | if (obj_desc->buffer.length == 0) { | 210 | if (obj_desc->buffer.length == 0) { |
216 | obj_desc->buffer.pointer = NULL; | 211 | obj_desc->buffer.pointer = NULL; |
217 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, | 212 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
218 | "Buffer defined with zero length in AML, creating\n")); | 213 | "Buffer defined with zero length in AML, creating\n")); |
219 | } | 214 | } else { |
220 | else { | 215 | obj_desc->buffer.pointer = |
221 | obj_desc->buffer.pointer = ACPI_MEM_CALLOCATE ( | 216 | ACPI_MEM_CALLOCATE(obj_desc->buffer.length); |
222 | obj_desc->buffer.length); | ||
223 | if (!obj_desc->buffer.pointer) { | 217 | if (!obj_desc->buffer.pointer) { |
224 | acpi_ut_delete_object_desc (obj_desc); | 218 | acpi_ut_delete_object_desc(obj_desc); |
225 | return_ACPI_STATUS (AE_NO_MEMORY); | 219 | return_ACPI_STATUS(AE_NO_MEMORY); |
226 | } | 220 | } |
227 | 221 | ||
228 | /* Initialize buffer from the byte_list (if present) */ | 222 | /* Initialize buffer from the byte_list (if present) */ |
229 | 223 | ||
230 | if (byte_list) { | 224 | if (byte_list) { |
231 | ACPI_MEMCPY (obj_desc->buffer.pointer, byte_list->named.data, | 225 | ACPI_MEMCPY(obj_desc->buffer.pointer, |
232 | byte_list_length); | 226 | byte_list->named.data, byte_list_length); |
233 | } | 227 | } |
234 | } | 228 | } |
235 | 229 | ||
236 | obj_desc->buffer.flags |= AOPOBJ_DATA_VALID; | 230 | obj_desc->buffer.flags |= AOPOBJ_DATA_VALID; |
237 | op->common.node = (struct acpi_namespace_node *) obj_desc; | 231 | op->common.node = (struct acpi_namespace_node *)obj_desc; |
238 | return_ACPI_STATUS (AE_OK); | 232 | return_ACPI_STATUS(AE_OK); |
239 | } | 233 | } |
240 | 234 | ||
241 | |||
242 | /******************************************************************************* | 235 | /******************************************************************************* |
243 | * | 236 | * |
244 | * FUNCTION: acpi_ds_build_internal_package_obj | 237 | * FUNCTION: acpi_ds_build_internal_package_obj |
@@ -256,28 +249,25 @@ acpi_ds_build_internal_buffer_obj ( | |||
256 | ******************************************************************************/ | 249 | ******************************************************************************/ |
257 | 250 | ||
258 | acpi_status | 251 | acpi_status |
259 | acpi_ds_build_internal_package_obj ( | 252 | acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state, |
260 | struct acpi_walk_state *walk_state, | 253 | union acpi_parse_object *op, |
261 | union acpi_parse_object *op, | 254 | u32 package_length, |
262 | u32 package_length, | 255 | union acpi_operand_object **obj_desc_ptr) |
263 | union acpi_operand_object **obj_desc_ptr) | ||
264 | { | 256 | { |
265 | union acpi_parse_object *arg; | 257 | union acpi_parse_object *arg; |
266 | union acpi_parse_object *parent; | 258 | union acpi_parse_object *parent; |
267 | union acpi_operand_object *obj_desc = NULL; | 259 | union acpi_operand_object *obj_desc = NULL; |
268 | u32 package_list_length; | 260 | u32 package_list_length; |
269 | acpi_status status = AE_OK; | 261 | acpi_status status = AE_OK; |
270 | u32 i; | 262 | u32 i; |
271 | |||
272 | |||
273 | ACPI_FUNCTION_TRACE ("ds_build_internal_package_obj"); | ||
274 | 263 | ||
264 | ACPI_FUNCTION_TRACE("ds_build_internal_package_obj"); | ||
275 | 265 | ||
276 | /* Find the parent of a possibly nested package */ | 266 | /* Find the parent of a possibly nested package */ |
277 | 267 | ||
278 | parent = op->common.parent; | 268 | parent = op->common.parent; |
279 | while ((parent->common.aml_opcode == AML_PACKAGE_OP) || | 269 | while ((parent->common.aml_opcode == AML_PACKAGE_OP) || |
280 | (parent->common.aml_opcode == AML_VAR_PACKAGE_OP)) { | 270 | (parent->common.aml_opcode == AML_VAR_PACKAGE_OP)) { |
281 | parent = parent->common.parent; | 271 | parent = parent->common.parent; |
282 | } | 272 | } |
283 | 273 | ||
@@ -287,12 +277,11 @@ acpi_ds_build_internal_package_obj ( | |||
287 | * We are evaluating a Named package object "Name (xxxx, Package)". | 277 | * We are evaluating a Named package object "Name (xxxx, Package)". |
288 | * Get the existing package object from the NS node | 278 | * Get the existing package object from the NS node |
289 | */ | 279 | */ |
290 | } | 280 | } else { |
291 | else { | 281 | obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_PACKAGE); |
292 | obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_PACKAGE); | ||
293 | *obj_desc_ptr = obj_desc; | 282 | *obj_desc_ptr = obj_desc; |
294 | if (!obj_desc) { | 283 | if (!obj_desc) { |
295 | return_ACPI_STATUS (AE_NO_MEMORY); | 284 | return_ACPI_STATUS(AE_NO_MEMORY); |
296 | } | 285 | } |
297 | 286 | ||
298 | obj_desc->package.node = parent->common.node; | 287 | obj_desc->package.node = parent->common.node; |
@@ -323,12 +312,13 @@ acpi_ds_build_internal_package_obj ( | |||
323 | * individual objects). Add an extra pointer slot so | 312 | * individual objects). Add an extra pointer slot so |
324 | * that the list is always null terminated. | 313 | * that the list is always null terminated. |
325 | */ | 314 | */ |
326 | obj_desc->package.elements = ACPI_MEM_CALLOCATE ( | 315 | obj_desc->package.elements = ACPI_MEM_CALLOCATE(((acpi_size) obj_desc-> |
327 | ((acpi_size) obj_desc->package.count + 1) * sizeof (void *)); | 316 | package.count + |
317 | 1) * sizeof(void *)); | ||
328 | 318 | ||
329 | if (!obj_desc->package.elements) { | 319 | if (!obj_desc->package.elements) { |
330 | acpi_ut_delete_object_desc (obj_desc); | 320 | acpi_ut_delete_object_desc(obj_desc); |
331 | return_ACPI_STATUS (AE_NO_MEMORY); | 321 | return_ACPI_STATUS(AE_NO_MEMORY); |
332 | } | 322 | } |
333 | 323 | ||
334 | /* | 324 | /* |
@@ -342,11 +332,13 @@ acpi_ds_build_internal_package_obj ( | |||
342 | /* Object (package or buffer) is already built */ | 332 | /* Object (package or buffer) is already built */ |
343 | 333 | ||
344 | obj_desc->package.elements[i] = | 334 | obj_desc->package.elements[i] = |
345 | ACPI_CAST_PTR (union acpi_operand_object, arg->common.node); | 335 | ACPI_CAST_PTR(union acpi_operand_object, |
346 | } | 336 | arg->common.node); |
347 | else { | 337 | } else { |
348 | status = acpi_ds_build_internal_object (walk_state, arg, | 338 | status = acpi_ds_build_internal_object(walk_state, arg, |
349 | &obj_desc->package.elements[i]); | 339 | &obj_desc-> |
340 | package. | ||
341 | elements[i]); | ||
350 | } | 342 | } |
351 | 343 | ||
352 | i++; | 344 | i++; |
@@ -354,11 +346,10 @@ acpi_ds_build_internal_package_obj ( | |||
354 | } | 346 | } |
355 | 347 | ||
356 | obj_desc->package.flags |= AOPOBJ_DATA_VALID; | 348 | obj_desc->package.flags |= AOPOBJ_DATA_VALID; |
357 | op->common.node = (struct acpi_namespace_node *) obj_desc; | 349 | op->common.node = (struct acpi_namespace_node *)obj_desc; |
358 | return_ACPI_STATUS (status); | 350 | return_ACPI_STATUS(status); |
359 | } | 351 | } |
360 | 352 | ||
361 | |||
362 | /******************************************************************************* | 353 | /******************************************************************************* |
363 | * | 354 | * |
364 | * FUNCTION: acpi_ds_create_node | 355 | * FUNCTION: acpi_ds_create_node |
@@ -374,57 +365,53 @@ acpi_ds_build_internal_package_obj ( | |||
374 | ******************************************************************************/ | 365 | ******************************************************************************/ |
375 | 366 | ||
376 | acpi_status | 367 | acpi_status |
377 | acpi_ds_create_node ( | 368 | acpi_ds_create_node(struct acpi_walk_state *walk_state, |
378 | struct acpi_walk_state *walk_state, | 369 | struct acpi_namespace_node *node, |
379 | struct acpi_namespace_node *node, | 370 | union acpi_parse_object *op) |
380 | union acpi_parse_object *op) | ||
381 | { | 371 | { |
382 | acpi_status status; | 372 | acpi_status status; |
383 | union acpi_operand_object *obj_desc; | 373 | union acpi_operand_object *obj_desc; |
384 | |||
385 | |||
386 | ACPI_FUNCTION_TRACE_PTR ("ds_create_node", op); | ||
387 | 374 | ||
375 | ACPI_FUNCTION_TRACE_PTR("ds_create_node", op); | ||
388 | 376 | ||
389 | /* | 377 | /* |
390 | * Because of the execution pass through the non-control-method | 378 | * Because of the execution pass through the non-control-method |
391 | * parts of the table, we can arrive here twice. Only init | 379 | * parts of the table, we can arrive here twice. Only init |
392 | * the named object node the first time through | 380 | * the named object node the first time through |
393 | */ | 381 | */ |
394 | if (acpi_ns_get_attached_object (node)) { | 382 | if (acpi_ns_get_attached_object(node)) { |
395 | return_ACPI_STATUS (AE_OK); | 383 | return_ACPI_STATUS(AE_OK); |
396 | } | 384 | } |
397 | 385 | ||
398 | if (!op->common.value.arg) { | 386 | if (!op->common.value.arg) { |
399 | /* No arguments, there is nothing to do */ | 387 | /* No arguments, there is nothing to do */ |
400 | 388 | ||
401 | return_ACPI_STATUS (AE_OK); | 389 | return_ACPI_STATUS(AE_OK); |
402 | } | 390 | } |
403 | 391 | ||
404 | /* Build an internal object for the argument(s) */ | 392 | /* Build an internal object for the argument(s) */ |
405 | 393 | ||
406 | status = acpi_ds_build_internal_object (walk_state, op->common.value.arg, | 394 | status = acpi_ds_build_internal_object(walk_state, op->common.value.arg, |
407 | &obj_desc); | 395 | &obj_desc); |
408 | if (ACPI_FAILURE (status)) { | 396 | if (ACPI_FAILURE(status)) { |
409 | return_ACPI_STATUS (status); | 397 | return_ACPI_STATUS(status); |
410 | } | 398 | } |
411 | 399 | ||
412 | /* Re-type the object according to its argument */ | 400 | /* Re-type the object according to its argument */ |
413 | 401 | ||
414 | node->type = ACPI_GET_OBJECT_TYPE (obj_desc); | 402 | node->type = ACPI_GET_OBJECT_TYPE(obj_desc); |
415 | 403 | ||
416 | /* Attach obj to node */ | 404 | /* Attach obj to node */ |
417 | 405 | ||
418 | status = acpi_ns_attach_object (node, obj_desc, node->type); | 406 | status = acpi_ns_attach_object(node, obj_desc, node->type); |
419 | 407 | ||
420 | /* Remove local reference to the object */ | 408 | /* Remove local reference to the object */ |
421 | 409 | ||
422 | acpi_ut_remove_reference (obj_desc); | 410 | acpi_ut_remove_reference(obj_desc); |
423 | return_ACPI_STATUS (status); | 411 | return_ACPI_STATUS(status); |
424 | } | 412 | } |
425 | 413 | ||
426 | #endif /* ACPI_NO_METHOD_EXECUTION */ | 414 | #endif /* ACPI_NO_METHOD_EXECUTION */ |
427 | |||
428 | 415 | ||
429 | /******************************************************************************* | 416 | /******************************************************************************* |
430 | * | 417 | * |
@@ -444,55 +431,50 @@ acpi_ds_create_node ( | |||
444 | ******************************************************************************/ | 431 | ******************************************************************************/ |
445 | 432 | ||
446 | acpi_status | 433 | acpi_status |
447 | acpi_ds_init_object_from_op ( | 434 | acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state, |
448 | struct acpi_walk_state *walk_state, | 435 | union acpi_parse_object *op, |
449 | union acpi_parse_object *op, | 436 | u16 opcode, |
450 | u16 opcode, | 437 | union acpi_operand_object **ret_obj_desc) |
451 | union acpi_operand_object **ret_obj_desc) | ||
452 | { | 438 | { |
453 | const struct acpi_opcode_info *op_info; | 439 | const struct acpi_opcode_info *op_info; |
454 | union acpi_operand_object *obj_desc; | 440 | union acpi_operand_object *obj_desc; |
455 | acpi_status status = AE_OK; | 441 | acpi_status status = AE_OK; |
456 | |||
457 | |||
458 | ACPI_FUNCTION_TRACE ("ds_init_object_from_op"); | ||
459 | 442 | ||
443 | ACPI_FUNCTION_TRACE("ds_init_object_from_op"); | ||
460 | 444 | ||
461 | obj_desc = *ret_obj_desc; | 445 | obj_desc = *ret_obj_desc; |
462 | op_info = acpi_ps_get_opcode_info (opcode); | 446 | op_info = acpi_ps_get_opcode_info(opcode); |
463 | if (op_info->class == AML_CLASS_UNKNOWN) { | 447 | if (op_info->class == AML_CLASS_UNKNOWN) { |
464 | /* Unknown opcode */ | 448 | /* Unknown opcode */ |
465 | 449 | ||
466 | return_ACPI_STATUS (AE_TYPE); | 450 | return_ACPI_STATUS(AE_TYPE); |
467 | } | 451 | } |
468 | 452 | ||
469 | /* Perform per-object initialization */ | 453 | /* Perform per-object initialization */ |
470 | 454 | ||
471 | switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { | 455 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { |
472 | case ACPI_TYPE_BUFFER: | 456 | case ACPI_TYPE_BUFFER: |
473 | 457 | ||
474 | /* | 458 | /* |
475 | * Defer evaluation of Buffer term_arg operand | 459 | * Defer evaluation of Buffer term_arg operand |
476 | */ | 460 | */ |
477 | obj_desc->buffer.node = (struct acpi_namespace_node *) | 461 | obj_desc->buffer.node = (struct acpi_namespace_node *) |
478 | walk_state->operands[0]; | 462 | walk_state->operands[0]; |
479 | obj_desc->buffer.aml_start = op->named.data; | 463 | obj_desc->buffer.aml_start = op->named.data; |
480 | obj_desc->buffer.aml_length = op->named.length; | 464 | obj_desc->buffer.aml_length = op->named.length; |
481 | break; | 465 | break; |
482 | 466 | ||
483 | |||
484 | case ACPI_TYPE_PACKAGE: | 467 | case ACPI_TYPE_PACKAGE: |
485 | 468 | ||
486 | /* | 469 | /* |
487 | * Defer evaluation of Package term_arg operand | 470 | * Defer evaluation of Package term_arg operand |
488 | */ | 471 | */ |
489 | obj_desc->package.node = (struct acpi_namespace_node *) | 472 | obj_desc->package.node = (struct acpi_namespace_node *) |
490 | walk_state->operands[0]; | 473 | walk_state->operands[0]; |
491 | obj_desc->package.aml_start = op->named.data; | 474 | obj_desc->package.aml_start = op->named.data; |
492 | obj_desc->package.aml_length = op->named.length; | 475 | obj_desc->package.aml_length = op->named.length; |
493 | break; | 476 | break; |
494 | 477 | ||
495 | |||
496 | case ACPI_TYPE_INTEGER: | 478 | case ACPI_TYPE_INTEGER: |
497 | 479 | ||
498 | switch (op_info->type) { | 480 | switch (op_info->type) { |
@@ -525,7 +507,7 @@ acpi_ds_init_object_from_op ( | |||
525 | /* Truncate value if we are executing from a 32-bit ACPI table */ | 507 | /* Truncate value if we are executing from a 32-bit ACPI table */ |
526 | 508 | ||
527 | #ifndef ACPI_NO_METHOD_EXECUTION | 509 | #ifndef ACPI_NO_METHOD_EXECUTION |
528 | acpi_ex_truncate_for32bit_table (obj_desc); | 510 | acpi_ex_truncate_for32bit_table(obj_desc); |
529 | #endif | 511 | #endif |
530 | break; | 512 | break; |
531 | 513 | ||
@@ -536,36 +518,36 @@ acpi_ds_init_object_from_op ( | |||
536 | 518 | ||
537 | default: | 519 | default: |
538 | 520 | ||
539 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 521 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
540 | "Unknown constant opcode %X\n", opcode)); | 522 | "Unknown constant opcode %X\n", |
523 | opcode)); | ||
541 | status = AE_AML_OPERAND_TYPE; | 524 | status = AE_AML_OPERAND_TYPE; |
542 | break; | 525 | break; |
543 | } | 526 | } |
544 | break; | 527 | break; |
545 | 528 | ||
546 | |||
547 | case AML_TYPE_LITERAL: | 529 | case AML_TYPE_LITERAL: |
548 | 530 | ||
549 | obj_desc->integer.value = op->common.value.integer; | 531 | obj_desc->integer.value = op->common.value.integer; |
550 | #ifndef ACPI_NO_METHOD_EXECUTION | 532 | #ifndef ACPI_NO_METHOD_EXECUTION |
551 | acpi_ex_truncate_for32bit_table (obj_desc); | 533 | acpi_ex_truncate_for32bit_table(obj_desc); |
552 | #endif | 534 | #endif |
553 | break; | 535 | break; |
554 | 536 | ||
555 | |||
556 | default: | 537 | default: |
557 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Integer type %X\n", | 538 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
558 | op_info->type)); | 539 | "Unknown Integer type %X\n", |
540 | op_info->type)); | ||
559 | status = AE_AML_OPERAND_TYPE; | 541 | status = AE_AML_OPERAND_TYPE; |
560 | break; | 542 | break; |
561 | } | 543 | } |
562 | break; | 544 | break; |
563 | 545 | ||
564 | |||
565 | case ACPI_TYPE_STRING: | 546 | case ACPI_TYPE_STRING: |
566 | 547 | ||
567 | obj_desc->string.pointer = op->common.value.string; | 548 | obj_desc->string.pointer = op->common.value.string; |
568 | obj_desc->string.length = (u32) ACPI_STRLEN (op->common.value.string); | 549 | obj_desc->string.length = |
550 | (u32) ACPI_STRLEN(op->common.value.string); | ||
569 | 551 | ||
570 | /* | 552 | /* |
571 | * The string is contained in the ACPI table, don't ever try | 553 | * The string is contained in the ACPI table, don't ever try |
@@ -574,11 +556,9 @@ acpi_ds_init_object_from_op ( | |||
574 | obj_desc->common.flags |= AOPOBJ_STATIC_POINTER; | 556 | obj_desc->common.flags |= AOPOBJ_STATIC_POINTER; |
575 | break; | 557 | break; |
576 | 558 | ||
577 | |||
578 | case ACPI_TYPE_METHOD: | 559 | case ACPI_TYPE_METHOD: |
579 | break; | 560 | break; |
580 | 561 | ||
581 | |||
582 | case ACPI_TYPE_LOCAL_REFERENCE: | 562 | case ACPI_TYPE_LOCAL_REFERENCE: |
583 | 563 | ||
584 | switch (op_info->type) { | 564 | switch (op_info->type) { |
@@ -590,14 +570,17 @@ acpi_ds_init_object_from_op ( | |||
590 | obj_desc->reference.offset = opcode - AML_LOCAL_OP; | 570 | obj_desc->reference.offset = opcode - AML_LOCAL_OP; |
591 | 571 | ||
592 | #ifndef ACPI_NO_METHOD_EXECUTION | 572 | #ifndef ACPI_NO_METHOD_EXECUTION |
593 | status = acpi_ds_method_data_get_node (AML_LOCAL_OP, | 573 | status = acpi_ds_method_data_get_node(AML_LOCAL_OP, |
594 | obj_desc->reference.offset, | 574 | obj_desc-> |
595 | walk_state, | 575 | reference.offset, |
596 | (struct acpi_namespace_node **) &obj_desc->reference.object); | 576 | walk_state, |
577 | (struct | ||
578 | acpi_namespace_node | ||
579 | **)&obj_desc-> | ||
580 | reference.object); | ||
597 | #endif | 581 | #endif |
598 | break; | 582 | break; |
599 | 583 | ||
600 | |||
601 | case AML_TYPE_METHOD_ARGUMENT: | 584 | case AML_TYPE_METHOD_ARGUMENT: |
602 | 585 | ||
603 | /* Split the opcode into a base opcode + offset */ | 586 | /* Split the opcode into a base opcode + offset */ |
@@ -606,14 +589,18 @@ acpi_ds_init_object_from_op ( | |||
606 | obj_desc->reference.offset = opcode - AML_ARG_OP; | 589 | obj_desc->reference.offset = opcode - AML_ARG_OP; |
607 | 590 | ||
608 | #ifndef ACPI_NO_METHOD_EXECUTION | 591 | #ifndef ACPI_NO_METHOD_EXECUTION |
609 | status = acpi_ds_method_data_get_node (AML_ARG_OP, | 592 | status = acpi_ds_method_data_get_node(AML_ARG_OP, |
610 | obj_desc->reference.offset, | 593 | obj_desc-> |
611 | walk_state, | 594 | reference.offset, |
612 | (struct acpi_namespace_node **) &obj_desc->reference.object); | 595 | walk_state, |
596 | (struct | ||
597 | acpi_namespace_node | ||
598 | **)&obj_desc-> | ||
599 | reference.object); | ||
613 | #endif | 600 | #endif |
614 | break; | 601 | break; |
615 | 602 | ||
616 | default: /* Other literals, etc.. */ | 603 | default: /* Other literals, etc.. */ |
617 | 604 | ||
618 | if (op->common.aml_opcode == AML_INT_NAMEPATH_OP) { | 605 | if (op->common.aml_opcode == AML_INT_NAMEPATH_OP) { |
619 | /* Node was saved in Op */ | 606 | /* Node was saved in Op */ |
@@ -626,17 +613,15 @@ acpi_ds_init_object_from_op ( | |||
626 | } | 613 | } |
627 | break; | 614 | break; |
628 | 615 | ||
629 | |||
630 | default: | 616 | default: |
631 | 617 | ||
632 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unimplemented data type: %X\n", | 618 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
633 | ACPI_GET_OBJECT_TYPE (obj_desc))); | 619 | "Unimplemented data type: %X\n", |
620 | ACPI_GET_OBJECT_TYPE(obj_desc))); | ||
634 | 621 | ||
635 | status = AE_AML_OPERAND_TYPE; | 622 | status = AE_AML_OPERAND_TYPE; |
636 | break; | 623 | break; |
637 | } | 624 | } |
638 | 625 | ||
639 | return_ACPI_STATUS (status); | 626 | return_ACPI_STATUS(status); |
640 | } | 627 | } |
641 | |||
642 | |||
diff --git a/drivers/acpi/dispatcher/dsopcode.c b/drivers/acpi/dispatcher/dsopcode.c index 750bdb1ac344..939d167bf87b 100644 --- a/drivers/acpi/dispatcher/dsopcode.c +++ b/drivers/acpi/dispatcher/dsopcode.c | |||
@@ -42,7 +42,6 @@ | |||
42 | * POSSIBILITY OF SUCH DAMAGES. | 42 | * POSSIBILITY OF SUCH DAMAGES. |
43 | */ | 43 | */ |
44 | 44 | ||
45 | |||
46 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
47 | #include <acpi/acparser.h> | 46 | #include <acpi/acparser.h> |
48 | #include <acpi/amlcode.h> | 47 | #include <acpi/amlcode.h> |
@@ -52,26 +51,21 @@ | |||
52 | #include <acpi/acevents.h> | 51 | #include <acpi/acevents.h> |
53 | 52 | ||
54 | #define _COMPONENT ACPI_DISPATCHER | 53 | #define _COMPONENT ACPI_DISPATCHER |
55 | ACPI_MODULE_NAME ("dsopcode") | 54 | ACPI_MODULE_NAME("dsopcode") |
56 | 55 | ||
57 | /* Local prototypes */ | 56 | /* Local prototypes */ |
58 | |||
59 | static acpi_status | 57 | static acpi_status |
60 | acpi_ds_execute_arguments ( | 58 | acpi_ds_execute_arguments(struct acpi_namespace_node *node, |
61 | struct acpi_namespace_node *node, | 59 | struct acpi_namespace_node *scope_node, |
62 | struct acpi_namespace_node *scope_node, | 60 | u32 aml_length, u8 * aml_start); |
63 | u32 aml_length, | ||
64 | u8 *aml_start); | ||
65 | 61 | ||
66 | static acpi_status | 62 | static acpi_status |
67 | acpi_ds_init_buffer_field ( | 63 | acpi_ds_init_buffer_field(u16 aml_opcode, |
68 | u16 aml_opcode, | 64 | union acpi_operand_object *obj_desc, |
69 | union acpi_operand_object *obj_desc, | 65 | union acpi_operand_object *buffer_desc, |
70 | union acpi_operand_object *buffer_desc, | 66 | union acpi_operand_object *offset_desc, |
71 | union acpi_operand_object *offset_desc, | 67 | union acpi_operand_object *length_desc, |
72 | union acpi_operand_object *length_desc, | 68 | union acpi_operand_object *result_desc); |
73 | union acpi_operand_object *result_desc); | ||
74 | |||
75 | 69 | ||
76 | /******************************************************************************* | 70 | /******************************************************************************* |
77 | * | 71 | * |
@@ -89,26 +83,22 @@ acpi_ds_init_buffer_field ( | |||
89 | ******************************************************************************/ | 83 | ******************************************************************************/ |
90 | 84 | ||
91 | static acpi_status | 85 | static acpi_status |
92 | acpi_ds_execute_arguments ( | 86 | acpi_ds_execute_arguments(struct acpi_namespace_node *node, |
93 | struct acpi_namespace_node *node, | 87 | struct acpi_namespace_node *scope_node, |
94 | struct acpi_namespace_node *scope_node, | 88 | u32 aml_length, u8 * aml_start) |
95 | u32 aml_length, | ||
96 | u8 *aml_start) | ||
97 | { | 89 | { |
98 | acpi_status status; | 90 | acpi_status status; |
99 | union acpi_parse_object *op; | 91 | union acpi_parse_object *op; |
100 | struct acpi_walk_state *walk_state; | 92 | struct acpi_walk_state *walk_state; |
101 | |||
102 | |||
103 | ACPI_FUNCTION_TRACE ("ds_execute_arguments"); | ||
104 | 93 | ||
94 | ACPI_FUNCTION_TRACE("ds_execute_arguments"); | ||
105 | 95 | ||
106 | /* | 96 | /* |
107 | * Allocate a new parser op to be the root of the parsed tree | 97 | * Allocate a new parser op to be the root of the parsed tree |
108 | */ | 98 | */ |
109 | op = acpi_ps_alloc_op (AML_INT_EVAL_SUBTREE_OP); | 99 | op = acpi_ps_alloc_op(AML_INT_EVAL_SUBTREE_OP); |
110 | if (!op) { | 100 | if (!op) { |
111 | return_ACPI_STATUS (AE_NO_MEMORY); | 101 | return_ACPI_STATUS(AE_NO_MEMORY); |
112 | } | 102 | } |
113 | 103 | ||
114 | /* Save the Node for use in acpi_ps_parse_aml */ | 104 | /* Save the Node for use in acpi_ps_parse_aml */ |
@@ -117,16 +107,16 @@ acpi_ds_execute_arguments ( | |||
117 | 107 | ||
118 | /* Create and initialize a new parser state */ | 108 | /* Create and initialize a new parser state */ |
119 | 109 | ||
120 | walk_state = acpi_ds_create_walk_state (0, NULL, NULL, NULL); | 110 | walk_state = acpi_ds_create_walk_state(0, NULL, NULL, NULL); |
121 | if (!walk_state) { | 111 | if (!walk_state) { |
122 | status = AE_NO_MEMORY; | 112 | status = AE_NO_MEMORY; |
123 | goto cleanup; | 113 | goto cleanup; |
124 | } | 114 | } |
125 | 115 | ||
126 | status = acpi_ds_init_aml_walk (walk_state, op, NULL, aml_start, | 116 | status = acpi_ds_init_aml_walk(walk_state, op, NULL, aml_start, |
127 | aml_length, NULL, 1); | 117 | aml_length, NULL, 1); |
128 | if (ACPI_FAILURE (status)) { | 118 | if (ACPI_FAILURE(status)) { |
129 | acpi_ds_delete_walk_state (walk_state); | 119 | acpi_ds_delete_walk_state(walk_state); |
130 | goto cleanup; | 120 | goto cleanup; |
131 | } | 121 | } |
132 | 122 | ||
@@ -137,28 +127,28 @@ acpi_ds_execute_arguments ( | |||
137 | 127 | ||
138 | /* Pass1: Parse the entire declaration */ | 128 | /* Pass1: Parse the entire declaration */ |
139 | 129 | ||
140 | status = acpi_ps_parse_aml (walk_state); | 130 | status = acpi_ps_parse_aml(walk_state); |
141 | if (ACPI_FAILURE (status)) { | 131 | if (ACPI_FAILURE(status)) { |
142 | goto cleanup; | 132 | goto cleanup; |
143 | } | 133 | } |
144 | 134 | ||
145 | /* Get and init the Op created above */ | 135 | /* Get and init the Op created above */ |
146 | 136 | ||
147 | op->common.node = node; | 137 | op->common.node = node; |
148 | acpi_ps_delete_parse_tree (op); | 138 | acpi_ps_delete_parse_tree(op); |
149 | 139 | ||
150 | /* Evaluate the deferred arguments */ | 140 | /* Evaluate the deferred arguments */ |
151 | 141 | ||
152 | op = acpi_ps_alloc_op (AML_INT_EVAL_SUBTREE_OP); | 142 | op = acpi_ps_alloc_op(AML_INT_EVAL_SUBTREE_OP); |
153 | if (!op) { | 143 | if (!op) { |
154 | return_ACPI_STATUS (AE_NO_MEMORY); | 144 | return_ACPI_STATUS(AE_NO_MEMORY); |
155 | } | 145 | } |
156 | 146 | ||
157 | op->common.node = scope_node; | 147 | op->common.node = scope_node; |
158 | 148 | ||
159 | /* Create and initialize a new parser state */ | 149 | /* Create and initialize a new parser state */ |
160 | 150 | ||
161 | walk_state = acpi_ds_create_walk_state (0, NULL, NULL, NULL); | 151 | walk_state = acpi_ds_create_walk_state(0, NULL, NULL, NULL); |
162 | if (!walk_state) { | 152 | if (!walk_state) { |
163 | status = AE_NO_MEMORY; | 153 | status = AE_NO_MEMORY; |
164 | goto cleanup; | 154 | goto cleanup; |
@@ -166,24 +156,23 @@ acpi_ds_execute_arguments ( | |||
166 | 156 | ||
167 | /* Execute the opcode and arguments */ | 157 | /* Execute the opcode and arguments */ |
168 | 158 | ||
169 | status = acpi_ds_init_aml_walk (walk_state, op, NULL, aml_start, | 159 | status = acpi_ds_init_aml_walk(walk_state, op, NULL, aml_start, |
170 | aml_length, NULL, 3); | 160 | aml_length, NULL, 3); |
171 | if (ACPI_FAILURE (status)) { | 161 | if (ACPI_FAILURE(status)) { |
172 | acpi_ds_delete_walk_state (walk_state); | 162 | acpi_ds_delete_walk_state(walk_state); |
173 | goto cleanup; | 163 | goto cleanup; |
174 | } | 164 | } |
175 | 165 | ||
176 | /* Mark this execution as a deferred opcode */ | 166 | /* Mark this execution as a deferred opcode */ |
177 | 167 | ||
178 | walk_state->deferred_node = node; | 168 | walk_state->deferred_node = node; |
179 | status = acpi_ps_parse_aml (walk_state); | 169 | status = acpi_ps_parse_aml(walk_state); |
180 | 170 | ||
181 | cleanup: | 171 | cleanup: |
182 | acpi_ps_delete_parse_tree (op); | 172 | acpi_ps_delete_parse_tree(op); |
183 | return_ACPI_STATUS (status); | 173 | return_ACPI_STATUS(status); |
184 | } | 174 | } |
185 | 175 | ||
186 | |||
187 | /******************************************************************************* | 176 | /******************************************************************************* |
188 | * | 177 | * |
189 | * FUNCTION: acpi_ds_get_buffer_field_arguments | 178 | * FUNCTION: acpi_ds_get_buffer_field_arguments |
@@ -198,38 +187,36 @@ cleanup: | |||
198 | ******************************************************************************/ | 187 | ******************************************************************************/ |
199 | 188 | ||
200 | acpi_status | 189 | acpi_status |
201 | acpi_ds_get_buffer_field_arguments ( | 190 | acpi_ds_get_buffer_field_arguments(union acpi_operand_object *obj_desc) |
202 | union acpi_operand_object *obj_desc) | ||
203 | { | 191 | { |
204 | union acpi_operand_object *extra_desc; | 192 | union acpi_operand_object *extra_desc; |
205 | struct acpi_namespace_node *node; | 193 | struct acpi_namespace_node *node; |
206 | acpi_status status; | 194 | acpi_status status; |
207 | |||
208 | |||
209 | ACPI_FUNCTION_TRACE_PTR ("ds_get_buffer_field_arguments", obj_desc); | ||
210 | 195 | ||
196 | ACPI_FUNCTION_TRACE_PTR("ds_get_buffer_field_arguments", obj_desc); | ||
211 | 197 | ||
212 | if (obj_desc->common.flags & AOPOBJ_DATA_VALID) { | 198 | if (obj_desc->common.flags & AOPOBJ_DATA_VALID) { |
213 | return_ACPI_STATUS (AE_OK); | 199 | return_ACPI_STATUS(AE_OK); |
214 | } | 200 | } |
215 | 201 | ||
216 | /* Get the AML pointer (method object) and buffer_field node */ | 202 | /* Get the AML pointer (method object) and buffer_field node */ |
217 | 203 | ||
218 | extra_desc = acpi_ns_get_secondary_object (obj_desc); | 204 | extra_desc = acpi_ns_get_secondary_object(obj_desc); |
219 | node = obj_desc->buffer_field.node; | 205 | node = obj_desc->buffer_field.node; |
220 | 206 | ||
221 | ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname (ACPI_TYPE_BUFFER_FIELD, node, NULL)); | 207 | ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname |
222 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] buffer_field Arg Init\n", | 208 | (ACPI_TYPE_BUFFER_FIELD, node, NULL)); |
223 | acpi_ut_get_node_name (node))); | 209 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "[%4.4s] buffer_field Arg Init\n", |
210 | acpi_ut_get_node_name(node))); | ||
224 | 211 | ||
225 | /* Execute the AML code for the term_arg arguments */ | 212 | /* Execute the AML code for the term_arg arguments */ |
226 | 213 | ||
227 | status = acpi_ds_execute_arguments (node, acpi_ns_get_parent_node (node), | 214 | status = acpi_ds_execute_arguments(node, acpi_ns_get_parent_node(node), |
228 | extra_desc->extra.aml_length, extra_desc->extra.aml_start); | 215 | extra_desc->extra.aml_length, |
229 | return_ACPI_STATUS (status); | 216 | extra_desc->extra.aml_start); |
217 | return_ACPI_STATUS(status); | ||
230 | } | 218 | } |
231 | 219 | ||
232 | |||
233 | /******************************************************************************* | 220 | /******************************************************************************* |
234 | * | 221 | * |
235 | * FUNCTION: acpi_ds_get_buffer_arguments | 222 | * FUNCTION: acpi_ds_get_buffer_arguments |
@@ -243,40 +230,35 @@ acpi_ds_get_buffer_field_arguments ( | |||
243 | * | 230 | * |
244 | ******************************************************************************/ | 231 | ******************************************************************************/ |
245 | 232 | ||
246 | acpi_status | 233 | acpi_status acpi_ds_get_buffer_arguments(union acpi_operand_object *obj_desc) |
247 | acpi_ds_get_buffer_arguments ( | ||
248 | union acpi_operand_object *obj_desc) | ||
249 | { | 234 | { |
250 | struct acpi_namespace_node *node; | 235 | struct acpi_namespace_node *node; |
251 | acpi_status status; | 236 | acpi_status status; |
252 | |||
253 | |||
254 | ACPI_FUNCTION_TRACE_PTR ("ds_get_buffer_arguments", obj_desc); | ||
255 | 237 | ||
238 | ACPI_FUNCTION_TRACE_PTR("ds_get_buffer_arguments", obj_desc); | ||
256 | 239 | ||
257 | if (obj_desc->common.flags & AOPOBJ_DATA_VALID) { | 240 | if (obj_desc->common.flags & AOPOBJ_DATA_VALID) { |
258 | return_ACPI_STATUS (AE_OK); | 241 | return_ACPI_STATUS(AE_OK); |
259 | } | 242 | } |
260 | 243 | ||
261 | /* Get the Buffer node */ | 244 | /* Get the Buffer node */ |
262 | 245 | ||
263 | node = obj_desc->buffer.node; | 246 | node = obj_desc->buffer.node; |
264 | if (!node) { | 247 | if (!node) { |
265 | ACPI_REPORT_ERROR (( | 248 | ACPI_REPORT_ERROR(("No pointer back to NS node in buffer obj %p\n", obj_desc)); |
266 | "No pointer back to NS node in buffer obj %p\n", obj_desc)); | 249 | return_ACPI_STATUS(AE_AML_INTERNAL); |
267 | return_ACPI_STATUS (AE_AML_INTERNAL); | ||
268 | } | 250 | } |
269 | 251 | ||
270 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Buffer Arg Init\n")); | 252 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Buffer Arg Init\n")); |
271 | 253 | ||
272 | /* Execute the AML code for the term_arg arguments */ | 254 | /* Execute the AML code for the term_arg arguments */ |
273 | 255 | ||
274 | status = acpi_ds_execute_arguments (node, node, | 256 | status = acpi_ds_execute_arguments(node, node, |
275 | obj_desc->buffer.aml_length, obj_desc->buffer.aml_start); | 257 | obj_desc->buffer.aml_length, |
276 | return_ACPI_STATUS (status); | 258 | obj_desc->buffer.aml_start); |
259 | return_ACPI_STATUS(status); | ||
277 | } | 260 | } |
278 | 261 | ||
279 | |||
280 | /******************************************************************************* | 262 | /******************************************************************************* |
281 | * | 263 | * |
282 | * FUNCTION: acpi_ds_get_package_arguments | 264 | * FUNCTION: acpi_ds_get_package_arguments |
@@ -290,40 +272,36 @@ acpi_ds_get_buffer_arguments ( | |||
290 | * | 272 | * |
291 | ******************************************************************************/ | 273 | ******************************************************************************/ |
292 | 274 | ||
293 | acpi_status | 275 | acpi_status acpi_ds_get_package_arguments(union acpi_operand_object *obj_desc) |
294 | acpi_ds_get_package_arguments ( | ||
295 | union acpi_operand_object *obj_desc) | ||
296 | { | 276 | { |
297 | struct acpi_namespace_node *node; | 277 | struct acpi_namespace_node *node; |
298 | acpi_status status; | 278 | acpi_status status; |
299 | |||
300 | |||
301 | ACPI_FUNCTION_TRACE_PTR ("ds_get_package_arguments", obj_desc); | ||
302 | 279 | ||
280 | ACPI_FUNCTION_TRACE_PTR("ds_get_package_arguments", obj_desc); | ||
303 | 281 | ||
304 | if (obj_desc->common.flags & AOPOBJ_DATA_VALID) { | 282 | if (obj_desc->common.flags & AOPOBJ_DATA_VALID) { |
305 | return_ACPI_STATUS (AE_OK); | 283 | return_ACPI_STATUS(AE_OK); |
306 | } | 284 | } |
307 | 285 | ||
308 | /* Get the Package node */ | 286 | /* Get the Package node */ |
309 | 287 | ||
310 | node = obj_desc->package.node; | 288 | node = obj_desc->package.node; |
311 | if (!node) { | 289 | if (!node) { |
312 | ACPI_REPORT_ERROR (( | 290 | ACPI_REPORT_ERROR(("No pointer back to NS node in package %p\n", |
313 | "No pointer back to NS node in package %p\n", obj_desc)); | 291 | obj_desc)); |
314 | return_ACPI_STATUS (AE_AML_INTERNAL); | 292 | return_ACPI_STATUS(AE_AML_INTERNAL); |
315 | } | 293 | } |
316 | 294 | ||
317 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Package Arg Init\n")); | 295 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Package Arg Init\n")); |
318 | 296 | ||
319 | /* Execute the AML code for the term_arg arguments */ | 297 | /* Execute the AML code for the term_arg arguments */ |
320 | 298 | ||
321 | status = acpi_ds_execute_arguments (node, node, | 299 | status = acpi_ds_execute_arguments(node, node, |
322 | obj_desc->package.aml_length, obj_desc->package.aml_start); | 300 | obj_desc->package.aml_length, |
323 | return_ACPI_STATUS (status); | 301 | obj_desc->package.aml_start); |
302 | return_ACPI_STATUS(status); | ||
324 | } | 303 | } |
325 | 304 | ||
326 | |||
327 | /***************************************************************************** | 305 | /***************************************************************************** |
328 | * | 306 | * |
329 | * FUNCTION: acpi_ds_get_region_arguments | 307 | * FUNCTION: acpi_ds_get_region_arguments |
@@ -337,44 +315,43 @@ acpi_ds_get_package_arguments ( | |||
337 | * | 315 | * |
338 | ****************************************************************************/ | 316 | ****************************************************************************/ |
339 | 317 | ||
340 | acpi_status | 318 | acpi_status acpi_ds_get_region_arguments(union acpi_operand_object *obj_desc) |
341 | acpi_ds_get_region_arguments ( | ||
342 | union acpi_operand_object *obj_desc) | ||
343 | { | 319 | { |
344 | struct acpi_namespace_node *node; | 320 | struct acpi_namespace_node *node; |
345 | acpi_status status; | 321 | acpi_status status; |
346 | union acpi_operand_object *extra_desc; | 322 | union acpi_operand_object *extra_desc; |
347 | |||
348 | |||
349 | ACPI_FUNCTION_TRACE_PTR ("ds_get_region_arguments", obj_desc); | ||
350 | 323 | ||
324 | ACPI_FUNCTION_TRACE_PTR("ds_get_region_arguments", obj_desc); | ||
351 | 325 | ||
352 | if (obj_desc->region.flags & AOPOBJ_DATA_VALID) { | 326 | if (obj_desc->region.flags & AOPOBJ_DATA_VALID) { |
353 | return_ACPI_STATUS (AE_OK); | 327 | return_ACPI_STATUS(AE_OK); |
354 | } | 328 | } |
355 | 329 | ||
356 | extra_desc = acpi_ns_get_secondary_object (obj_desc); | 330 | extra_desc = acpi_ns_get_secondary_object(obj_desc); |
357 | if (!extra_desc) { | 331 | if (!extra_desc) { |
358 | return_ACPI_STATUS (AE_NOT_EXIST); | 332 | return_ACPI_STATUS(AE_NOT_EXIST); |
359 | } | 333 | } |
360 | 334 | ||
361 | /* Get the Region node */ | 335 | /* Get the Region node */ |
362 | 336 | ||
363 | node = obj_desc->region.node; | 337 | node = obj_desc->region.node; |
364 | 338 | ||
365 | ACPI_DEBUG_EXEC (acpi_ut_display_init_pathname (ACPI_TYPE_REGION, node, NULL)); | 339 | ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname |
340 | (ACPI_TYPE_REGION, node, NULL)); | ||
366 | 341 | ||
367 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] op_region Arg Init at AML %p\n", | 342 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
368 | acpi_ut_get_node_name (node), extra_desc->extra.aml_start)); | 343 | "[%4.4s] op_region Arg Init at AML %p\n", |
344 | acpi_ut_get_node_name(node), | ||
345 | extra_desc->extra.aml_start)); | ||
369 | 346 | ||
370 | /* Execute the argument AML */ | 347 | /* Execute the argument AML */ |
371 | 348 | ||
372 | status = acpi_ds_execute_arguments (node, acpi_ns_get_parent_node (node), | 349 | status = acpi_ds_execute_arguments(node, acpi_ns_get_parent_node(node), |
373 | extra_desc->extra.aml_length, extra_desc->extra.aml_start); | 350 | extra_desc->extra.aml_length, |
374 | return_ACPI_STATUS (status); | 351 | extra_desc->extra.aml_start); |
352 | return_ACPI_STATUS(status); | ||
375 | } | 353 | } |
376 | 354 | ||
377 | |||
378 | /******************************************************************************* | 355 | /******************************************************************************* |
379 | * | 356 | * |
380 | * FUNCTION: acpi_ds_initialize_region | 357 | * FUNCTION: acpi_ds_initialize_region |
@@ -387,23 +364,19 @@ acpi_ds_get_region_arguments ( | |||
387 | * | 364 | * |
388 | ******************************************************************************/ | 365 | ******************************************************************************/ |
389 | 366 | ||
390 | acpi_status | 367 | acpi_status acpi_ds_initialize_region(acpi_handle obj_handle) |
391 | acpi_ds_initialize_region ( | ||
392 | acpi_handle obj_handle) | ||
393 | { | 368 | { |
394 | union acpi_operand_object *obj_desc; | 369 | union acpi_operand_object *obj_desc; |
395 | acpi_status status; | 370 | acpi_status status; |
396 | 371 | ||
397 | 372 | obj_desc = acpi_ns_get_attached_object(obj_handle); | |
398 | obj_desc = acpi_ns_get_attached_object (obj_handle); | ||
399 | 373 | ||
400 | /* Namespace is NOT locked */ | 374 | /* Namespace is NOT locked */ |
401 | 375 | ||
402 | status = acpi_ev_initialize_region (obj_desc, FALSE); | 376 | status = acpi_ev_initialize_region(obj_desc, FALSE); |
403 | return (status); | 377 | return (status); |
404 | } | 378 | } |
405 | 379 | ||
406 | |||
407 | /******************************************************************************* | 380 | /******************************************************************************* |
408 | * | 381 | * |
409 | * FUNCTION: acpi_ds_init_buffer_field | 382 | * FUNCTION: acpi_ds_init_buffer_field |
@@ -422,30 +395,27 @@ acpi_ds_initialize_region ( | |||
422 | ******************************************************************************/ | 395 | ******************************************************************************/ |
423 | 396 | ||
424 | static acpi_status | 397 | static acpi_status |
425 | acpi_ds_init_buffer_field ( | 398 | acpi_ds_init_buffer_field(u16 aml_opcode, |
426 | u16 aml_opcode, | 399 | union acpi_operand_object *obj_desc, |
427 | union acpi_operand_object *obj_desc, | 400 | union acpi_operand_object *buffer_desc, |
428 | union acpi_operand_object *buffer_desc, | 401 | union acpi_operand_object *offset_desc, |
429 | union acpi_operand_object *offset_desc, | 402 | union acpi_operand_object *length_desc, |
430 | union acpi_operand_object *length_desc, | 403 | union acpi_operand_object *result_desc) |
431 | union acpi_operand_object *result_desc) | ||
432 | { | 404 | { |
433 | u32 offset; | 405 | u32 offset; |
434 | u32 bit_offset; | 406 | u32 bit_offset; |
435 | u32 bit_count; | 407 | u32 bit_count; |
436 | u8 field_flags; | 408 | u8 field_flags; |
437 | acpi_status status; | 409 | acpi_status status; |
438 | |||
439 | |||
440 | ACPI_FUNCTION_TRACE_PTR ("ds_init_buffer_field", obj_desc); | ||
441 | 410 | ||
411 | ACPI_FUNCTION_TRACE_PTR("ds_init_buffer_field", obj_desc); | ||
442 | 412 | ||
443 | /* Host object must be a Buffer */ | 413 | /* Host object must be a Buffer */ |
444 | 414 | ||
445 | if (ACPI_GET_OBJECT_TYPE (buffer_desc) != ACPI_TYPE_BUFFER) { | 415 | if (ACPI_GET_OBJECT_TYPE(buffer_desc) != ACPI_TYPE_BUFFER) { |
446 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 416 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
447 | "Target of Create Field is not a Buffer object - %s\n", | 417 | "Target of Create Field is not a Buffer object - %s\n", |
448 | acpi_ut_get_object_type_name (buffer_desc))); | 418 | acpi_ut_get_object_type_name(buffer_desc))); |
449 | 419 | ||
450 | status = AE_AML_OPERAND_TYPE; | 420 | status = AE_AML_OPERAND_TYPE; |
451 | goto cleanup; | 421 | goto cleanup; |
@@ -456,11 +426,11 @@ acpi_ds_init_buffer_field ( | |||
456 | * out as a name_string, and should therefore now be a NS node | 426 | * out as a name_string, and should therefore now be a NS node |
457 | * after resolution in acpi_ex_resolve_operands(). | 427 | * after resolution in acpi_ex_resolve_operands(). |
458 | */ | 428 | */ |
459 | if (ACPI_GET_DESCRIPTOR_TYPE (result_desc) != ACPI_DESC_TYPE_NAMED) { | 429 | if (ACPI_GET_DESCRIPTOR_TYPE(result_desc) != ACPI_DESC_TYPE_NAMED) { |
460 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 430 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
461 | "(%s) destination not a NS Node [%s]\n", | 431 | "(%s) destination not a NS Node [%s]\n", |
462 | acpi_ps_get_opcode_name (aml_opcode), | 432 | acpi_ps_get_opcode_name(aml_opcode), |
463 | acpi_ut_get_descriptor_name (result_desc))); | 433 | acpi_ut_get_descriptor_name(result_desc))); |
464 | 434 | ||
465 | status = AE_AML_OPERAND_TYPE; | 435 | status = AE_AML_OPERAND_TYPE; |
466 | goto cleanup; | 436 | goto cleanup; |
@@ -478,13 +448,13 @@ acpi_ds_init_buffer_field ( | |||
478 | 448 | ||
479 | field_flags = AML_FIELD_ACCESS_BYTE; | 449 | field_flags = AML_FIELD_ACCESS_BYTE; |
480 | bit_offset = offset; | 450 | bit_offset = offset; |
481 | bit_count = (u32) length_desc->integer.value; | 451 | bit_count = (u32) length_desc->integer.value; |
482 | 452 | ||
483 | /* Must have a valid (>0) bit count */ | 453 | /* Must have a valid (>0) bit count */ |
484 | 454 | ||
485 | if (bit_count == 0) { | 455 | if (bit_count == 0) { |
486 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 456 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
487 | "Attempt to create_field of length 0\n")); | 457 | "Attempt to create_field of length 0\n")); |
488 | status = AE_AML_OPERAND_VALUE; | 458 | status = AE_AML_OPERAND_VALUE; |
489 | goto cleanup; | 459 | goto cleanup; |
490 | } | 460 | } |
@@ -495,7 +465,7 @@ acpi_ds_init_buffer_field ( | |||
495 | /* Offset is in bits, Field is one bit */ | 465 | /* Offset is in bits, Field is one bit */ |
496 | 466 | ||
497 | bit_offset = offset; | 467 | bit_offset = offset; |
498 | bit_count = 1; | 468 | bit_count = 1; |
499 | field_flags = AML_FIELD_ACCESS_BYTE; | 469 | field_flags = AML_FIELD_ACCESS_BYTE; |
500 | break; | 470 | break; |
501 | 471 | ||
@@ -504,7 +474,7 @@ acpi_ds_init_buffer_field ( | |||
504 | /* Offset is in bytes, field is one byte */ | 474 | /* Offset is in bytes, field is one byte */ |
505 | 475 | ||
506 | bit_offset = 8 * offset; | 476 | bit_offset = 8 * offset; |
507 | bit_count = 8; | 477 | bit_count = 8; |
508 | field_flags = AML_FIELD_ACCESS_BYTE; | 478 | field_flags = AML_FIELD_ACCESS_BYTE; |
509 | break; | 479 | break; |
510 | 480 | ||
@@ -513,7 +483,7 @@ acpi_ds_init_buffer_field ( | |||
513 | /* Offset is in bytes, field is one word */ | 483 | /* Offset is in bytes, field is one word */ |
514 | 484 | ||
515 | bit_offset = 8 * offset; | 485 | bit_offset = 8 * offset; |
516 | bit_count = 16; | 486 | bit_count = 16; |
517 | field_flags = AML_FIELD_ACCESS_WORD; | 487 | field_flags = AML_FIELD_ACCESS_WORD; |
518 | break; | 488 | break; |
519 | 489 | ||
@@ -522,7 +492,7 @@ acpi_ds_init_buffer_field ( | |||
522 | /* Offset is in bytes, field is one dword */ | 492 | /* Offset is in bytes, field is one dword */ |
523 | 493 | ||
524 | bit_offset = 8 * offset; | 494 | bit_offset = 8 * offset; |
525 | bit_count = 32; | 495 | bit_count = 32; |
526 | field_flags = AML_FIELD_ACCESS_DWORD; | 496 | field_flags = AML_FIELD_ACCESS_DWORD; |
527 | break; | 497 | break; |
528 | 498 | ||
@@ -531,29 +501,29 @@ acpi_ds_init_buffer_field ( | |||
531 | /* Offset is in bytes, field is one qword */ | 501 | /* Offset is in bytes, field is one qword */ |
532 | 502 | ||
533 | bit_offset = 8 * offset; | 503 | bit_offset = 8 * offset; |
534 | bit_count = 64; | 504 | bit_count = 64; |
535 | field_flags = AML_FIELD_ACCESS_QWORD; | 505 | field_flags = AML_FIELD_ACCESS_QWORD; |
536 | break; | 506 | break; |
537 | 507 | ||
538 | default: | 508 | default: |
539 | 509 | ||
540 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 510 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
541 | "Unknown field creation opcode %02x\n", | 511 | "Unknown field creation opcode %02x\n", |
542 | aml_opcode)); | 512 | aml_opcode)); |
543 | status = AE_AML_BAD_OPCODE; | 513 | status = AE_AML_BAD_OPCODE; |
544 | goto cleanup; | 514 | goto cleanup; |
545 | } | 515 | } |
546 | 516 | ||
547 | /* Entire field must fit within the current length of the buffer */ | 517 | /* Entire field must fit within the current length of the buffer */ |
548 | 518 | ||
549 | if ((bit_offset + bit_count) > | 519 | if ((bit_offset + bit_count) > (8 * (u32) buffer_desc->buffer.length)) { |
550 | (8 * (u32) buffer_desc->buffer.length)) { | 520 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
551 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 521 | "Field [%4.4s] size %d exceeds Buffer [%4.4s] size %d (bits)\n", |
552 | "Field [%4.4s] size %d exceeds Buffer [%4.4s] size %d (bits)\n", | 522 | acpi_ut_get_node_name(result_desc), |
553 | acpi_ut_get_node_name (result_desc), | 523 | bit_offset + bit_count, |
554 | bit_offset + bit_count, | 524 | acpi_ut_get_node_name(buffer_desc->buffer. |
555 | acpi_ut_get_node_name (buffer_desc->buffer.node), | 525 | node), |
556 | 8 * (u32) buffer_desc->buffer.length)); | 526 | 8 * (u32) buffer_desc->buffer.length)); |
557 | status = AE_AML_BUFFER_LIMIT; | 527 | status = AE_AML_BUFFER_LIMIT; |
558 | goto cleanup; | 528 | goto cleanup; |
559 | } | 529 | } |
@@ -563,9 +533,9 @@ acpi_ds_init_buffer_field ( | |||
563 | * For field_flags, use LOCK_RULE = 0 (NO_LOCK), | 533 | * For field_flags, use LOCK_RULE = 0 (NO_LOCK), |
564 | * UPDATE_RULE = 0 (UPDATE_PRESERVE) | 534 | * UPDATE_RULE = 0 (UPDATE_PRESERVE) |
565 | */ | 535 | */ |
566 | status = acpi_ex_prep_common_field_object (obj_desc, field_flags, 0, | 536 | status = acpi_ex_prep_common_field_object(obj_desc, field_flags, 0, |
567 | bit_offset, bit_count); | 537 | bit_offset, bit_count); |
568 | if (ACPI_FAILURE (status)) { | 538 | if (ACPI_FAILURE(status)) { |
569 | goto cleanup; | 539 | goto cleanup; |
570 | } | 540 | } |
571 | 541 | ||
@@ -574,35 +544,33 @@ acpi_ds_init_buffer_field ( | |||
574 | /* Reference count for buffer_desc inherits obj_desc count */ | 544 | /* Reference count for buffer_desc inherits obj_desc count */ |
575 | 545 | ||
576 | buffer_desc->common.reference_count = (u16) | 546 | buffer_desc->common.reference_count = (u16) |
577 | (buffer_desc->common.reference_count + obj_desc->common.reference_count); | 547 | (buffer_desc->common.reference_count + |
548 | obj_desc->common.reference_count); | ||
578 | 549 | ||
579 | 550 | cleanup: | |
580 | cleanup: | ||
581 | 551 | ||
582 | /* Always delete the operands */ | 552 | /* Always delete the operands */ |
583 | 553 | ||
584 | acpi_ut_remove_reference (offset_desc); | 554 | acpi_ut_remove_reference(offset_desc); |
585 | acpi_ut_remove_reference (buffer_desc); | 555 | acpi_ut_remove_reference(buffer_desc); |
586 | 556 | ||
587 | if (aml_opcode == AML_CREATE_FIELD_OP) { | 557 | if (aml_opcode == AML_CREATE_FIELD_OP) { |
588 | acpi_ut_remove_reference (length_desc); | 558 | acpi_ut_remove_reference(length_desc); |
589 | } | 559 | } |
590 | 560 | ||
591 | /* On failure, delete the result descriptor */ | 561 | /* On failure, delete the result descriptor */ |
592 | 562 | ||
593 | if (ACPI_FAILURE (status)) { | 563 | if (ACPI_FAILURE(status)) { |
594 | acpi_ut_remove_reference (result_desc); /* Result descriptor */ | 564 | acpi_ut_remove_reference(result_desc); /* Result descriptor */ |
595 | } | 565 | } else { |
596 | else { | ||
597 | /* Now the address and length are valid for this buffer_field */ | 566 | /* Now the address and length are valid for this buffer_field */ |
598 | 567 | ||
599 | obj_desc->buffer_field.flags |= AOPOBJ_DATA_VALID; | 568 | obj_desc->buffer_field.flags |= AOPOBJ_DATA_VALID; |
600 | } | 569 | } |
601 | 570 | ||
602 | return_ACPI_STATUS (status); | 571 | return_ACPI_STATUS(status); |
603 | } | 572 | } |
604 | 573 | ||
605 | |||
606 | /******************************************************************************* | 574 | /******************************************************************************* |
607 | * | 575 | * |
608 | * FUNCTION: acpi_ds_eval_buffer_field_operands | 576 | * FUNCTION: acpi_ds_eval_buffer_field_operands |
@@ -618,24 +586,21 @@ cleanup: | |||
618 | ******************************************************************************/ | 586 | ******************************************************************************/ |
619 | 587 | ||
620 | acpi_status | 588 | acpi_status |
621 | acpi_ds_eval_buffer_field_operands ( | 589 | acpi_ds_eval_buffer_field_operands(struct acpi_walk_state *walk_state, |
622 | struct acpi_walk_state *walk_state, | 590 | union acpi_parse_object *op) |
623 | union acpi_parse_object *op) | ||
624 | { | 591 | { |
625 | acpi_status status; | 592 | acpi_status status; |
626 | union acpi_operand_object *obj_desc; | 593 | union acpi_operand_object *obj_desc; |
627 | struct acpi_namespace_node *node; | 594 | struct acpi_namespace_node *node; |
628 | union acpi_parse_object *next_op; | 595 | union acpi_parse_object *next_op; |
629 | |||
630 | |||
631 | ACPI_FUNCTION_TRACE_PTR ("ds_eval_buffer_field_operands", op); | ||
632 | 596 | ||
597 | ACPI_FUNCTION_TRACE_PTR("ds_eval_buffer_field_operands", op); | ||
633 | 598 | ||
634 | /* | 599 | /* |
635 | * This is where we evaluate the address and length fields of the | 600 | * This is where we evaluate the address and length fields of the |
636 | * create_xxx_field declaration | 601 | * create_xxx_field declaration |
637 | */ | 602 | */ |
638 | node = op->common.node; | 603 | node = op->common.node; |
639 | 604 | ||
640 | /* next_op points to the op that holds the Buffer */ | 605 | /* next_op points to the op that holds the Buffer */ |
641 | 606 | ||
@@ -643,30 +608,32 @@ acpi_ds_eval_buffer_field_operands ( | |||
643 | 608 | ||
644 | /* Evaluate/create the address and length operands */ | 609 | /* Evaluate/create the address and length operands */ |
645 | 610 | ||
646 | status = acpi_ds_create_operands (walk_state, next_op); | 611 | status = acpi_ds_create_operands(walk_state, next_op); |
647 | if (ACPI_FAILURE (status)) { | 612 | if (ACPI_FAILURE(status)) { |
648 | return_ACPI_STATUS (status); | 613 | return_ACPI_STATUS(status); |
649 | } | 614 | } |
650 | 615 | ||
651 | obj_desc = acpi_ns_get_attached_object (node); | 616 | obj_desc = acpi_ns_get_attached_object(node); |
652 | if (!obj_desc) { | 617 | if (!obj_desc) { |
653 | return_ACPI_STATUS (AE_NOT_EXIST); | 618 | return_ACPI_STATUS(AE_NOT_EXIST); |
654 | } | 619 | } |
655 | 620 | ||
656 | /* Resolve the operands */ | 621 | /* Resolve the operands */ |
657 | 622 | ||
658 | status = acpi_ex_resolve_operands (op->common.aml_opcode, | 623 | status = acpi_ex_resolve_operands(op->common.aml_opcode, |
659 | ACPI_WALK_OPERANDS, walk_state); | 624 | ACPI_WALK_OPERANDS, walk_state); |
660 | 625 | ||
661 | ACPI_DUMP_OPERANDS (ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE, | 626 | ACPI_DUMP_OPERANDS(ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE, |
662 | acpi_ps_get_opcode_name (op->common.aml_opcode), | 627 | acpi_ps_get_opcode_name(op->common.aml_opcode), |
663 | walk_state->num_operands, "after acpi_ex_resolve_operands"); | 628 | walk_state->num_operands, |
629 | "after acpi_ex_resolve_operands"); | ||
664 | 630 | ||
665 | if (ACPI_FAILURE (status)) { | 631 | if (ACPI_FAILURE(status)) { |
666 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "(%s) bad operand(s) (%X)\n", | 632 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "(%s) bad operand(s) (%X)\n", |
667 | acpi_ps_get_opcode_name (op->common.aml_opcode), status)); | 633 | acpi_ps_get_opcode_name(op->common. |
634 | aml_opcode), status)); | ||
668 | 635 | ||
669 | return_ACPI_STATUS (status); | 636 | return_ACPI_STATUS(status); |
670 | } | 637 | } |
671 | 638 | ||
672 | /* Initialize the Buffer Field */ | 639 | /* Initialize the Buffer Field */ |
@@ -674,22 +641,25 @@ acpi_ds_eval_buffer_field_operands ( | |||
674 | if (op->common.aml_opcode == AML_CREATE_FIELD_OP) { | 641 | if (op->common.aml_opcode == AML_CREATE_FIELD_OP) { |
675 | /* NOTE: Slightly different operands for this opcode */ | 642 | /* NOTE: Slightly different operands for this opcode */ |
676 | 643 | ||
677 | status = acpi_ds_init_buffer_field (op->common.aml_opcode, obj_desc, | 644 | status = |
678 | walk_state->operands[0], walk_state->operands[1], | 645 | acpi_ds_init_buffer_field(op->common.aml_opcode, obj_desc, |
679 | walk_state->operands[2], walk_state->operands[3]); | 646 | walk_state->operands[0], |
680 | } | 647 | walk_state->operands[1], |
681 | else { | 648 | walk_state->operands[2], |
649 | walk_state->operands[3]); | ||
650 | } else { | ||
682 | /* All other, create_xxx_field opcodes */ | 651 | /* All other, create_xxx_field opcodes */ |
683 | 652 | ||
684 | status = acpi_ds_init_buffer_field (op->common.aml_opcode, obj_desc, | 653 | status = |
685 | walk_state->operands[0], walk_state->operands[1], | 654 | acpi_ds_init_buffer_field(op->common.aml_opcode, obj_desc, |
686 | NULL, walk_state->operands[2]); | 655 | walk_state->operands[0], |
656 | walk_state->operands[1], NULL, | ||
657 | walk_state->operands[2]); | ||
687 | } | 658 | } |
688 | 659 | ||
689 | return_ACPI_STATUS (status); | 660 | return_ACPI_STATUS(status); |
690 | } | 661 | } |
691 | 662 | ||
692 | |||
693 | /******************************************************************************* | 663 | /******************************************************************************* |
694 | * | 664 | * |
695 | * FUNCTION: acpi_ds_eval_region_operands | 665 | * FUNCTION: acpi_ds_eval_region_operands |
@@ -705,25 +675,22 @@ acpi_ds_eval_buffer_field_operands ( | |||
705 | ******************************************************************************/ | 675 | ******************************************************************************/ |
706 | 676 | ||
707 | acpi_status | 677 | acpi_status |
708 | acpi_ds_eval_region_operands ( | 678 | acpi_ds_eval_region_operands(struct acpi_walk_state *walk_state, |
709 | struct acpi_walk_state *walk_state, | 679 | union acpi_parse_object *op) |
710 | union acpi_parse_object *op) | ||
711 | { | 680 | { |
712 | acpi_status status; | 681 | acpi_status status; |
713 | union acpi_operand_object *obj_desc; | 682 | union acpi_operand_object *obj_desc; |
714 | union acpi_operand_object *operand_desc; | 683 | union acpi_operand_object *operand_desc; |
715 | struct acpi_namespace_node *node; | 684 | struct acpi_namespace_node *node; |
716 | union acpi_parse_object *next_op; | 685 | union acpi_parse_object *next_op; |
717 | |||
718 | |||
719 | ACPI_FUNCTION_TRACE_PTR ("ds_eval_region_operands", op); | ||
720 | 686 | ||
687 | ACPI_FUNCTION_TRACE_PTR("ds_eval_region_operands", op); | ||
721 | 688 | ||
722 | /* | 689 | /* |
723 | * This is where we evaluate the address and length fields of the | 690 | * This is where we evaluate the address and length fields of the |
724 | * op_region declaration | 691 | * op_region declaration |
725 | */ | 692 | */ |
726 | node = op->common.node; | 693 | node = op->common.node; |
727 | 694 | ||
728 | /* next_op points to the op that holds the space_iD */ | 695 | /* next_op points to the op that holds the space_iD */ |
729 | 696 | ||
@@ -735,26 +702,26 @@ acpi_ds_eval_region_operands ( | |||
735 | 702 | ||
736 | /* Evaluate/create the address and length operands */ | 703 | /* Evaluate/create the address and length operands */ |
737 | 704 | ||
738 | status = acpi_ds_create_operands (walk_state, next_op); | 705 | status = acpi_ds_create_operands(walk_state, next_op); |
739 | if (ACPI_FAILURE (status)) { | 706 | if (ACPI_FAILURE(status)) { |
740 | return_ACPI_STATUS (status); | 707 | return_ACPI_STATUS(status); |
741 | } | 708 | } |
742 | 709 | ||
743 | /* Resolve the length and address operands to numbers */ | 710 | /* Resolve the length and address operands to numbers */ |
744 | 711 | ||
745 | status = acpi_ex_resolve_operands (op->common.aml_opcode, | 712 | status = acpi_ex_resolve_operands(op->common.aml_opcode, |
746 | ACPI_WALK_OPERANDS, walk_state); | 713 | ACPI_WALK_OPERANDS, walk_state); |
747 | if (ACPI_FAILURE (status)) { | 714 | if (ACPI_FAILURE(status)) { |
748 | return_ACPI_STATUS (status); | 715 | return_ACPI_STATUS(status); |
749 | } | 716 | } |
750 | 717 | ||
751 | ACPI_DUMP_OPERANDS (ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE, | 718 | ACPI_DUMP_OPERANDS(ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE, |
752 | acpi_ps_get_opcode_name (op->common.aml_opcode), | 719 | acpi_ps_get_opcode_name(op->common.aml_opcode), |
753 | 1, "after acpi_ex_resolve_operands"); | 720 | 1, "after acpi_ex_resolve_operands"); |
754 | 721 | ||
755 | obj_desc = acpi_ns_get_attached_object (node); | 722 | obj_desc = acpi_ns_get_attached_object(node); |
756 | if (!obj_desc) { | 723 | if (!obj_desc) { |
757 | return_ACPI_STATUS (AE_NOT_EXIST); | 724 | return_ACPI_STATUS(AE_NOT_EXIST); |
758 | } | 725 | } |
759 | 726 | ||
760 | /* | 727 | /* |
@@ -764,7 +731,7 @@ acpi_ds_eval_region_operands ( | |||
764 | operand_desc = walk_state->operands[walk_state->num_operands - 1]; | 731 | operand_desc = walk_state->operands[walk_state->num_operands - 1]; |
765 | 732 | ||
766 | obj_desc->region.length = (u32) operand_desc->integer.value; | 733 | obj_desc->region.length = (u32) operand_desc->integer.value; |
767 | acpi_ut_remove_reference (operand_desc); | 734 | acpi_ut_remove_reference(operand_desc); |
768 | 735 | ||
769 | /* | 736 | /* |
770 | * Get the address and save it | 737 | * Get the address and save it |
@@ -773,22 +740,21 @@ acpi_ds_eval_region_operands ( | |||
773 | operand_desc = walk_state->operands[walk_state->num_operands - 2]; | 740 | operand_desc = walk_state->operands[walk_state->num_operands - 2]; |
774 | 741 | ||
775 | obj_desc->region.address = (acpi_physical_address) | 742 | obj_desc->region.address = (acpi_physical_address) |
776 | operand_desc->integer.value; | 743 | operand_desc->integer.value; |
777 | acpi_ut_remove_reference (operand_desc); | 744 | acpi_ut_remove_reference(operand_desc); |
778 | 745 | ||
779 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "rgn_obj %p Addr %8.8X%8.8X Len %X\n", | 746 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "rgn_obj %p Addr %8.8X%8.8X Len %X\n", |
780 | obj_desc, | 747 | obj_desc, |
781 | ACPI_FORMAT_UINT64 (obj_desc->region.address), | 748 | ACPI_FORMAT_UINT64(obj_desc->region.address), |
782 | obj_desc->region.length)); | 749 | obj_desc->region.length)); |
783 | 750 | ||
784 | /* Now the address and length are valid for this opregion */ | 751 | /* Now the address and length are valid for this opregion */ |
785 | 752 | ||
786 | obj_desc->region.flags |= AOPOBJ_DATA_VALID; | 753 | obj_desc->region.flags |= AOPOBJ_DATA_VALID; |
787 | 754 | ||
788 | return_ACPI_STATUS (status); | 755 | return_ACPI_STATUS(status); |
789 | } | 756 | } |
790 | 757 | ||
791 | |||
792 | /******************************************************************************* | 758 | /******************************************************************************* |
793 | * | 759 | * |
794 | * FUNCTION: acpi_ds_eval_data_object_operands | 760 | * FUNCTION: acpi_ds_eval_data_object_operands |
@@ -805,46 +771,44 @@ acpi_ds_eval_region_operands ( | |||
805 | ******************************************************************************/ | 771 | ******************************************************************************/ |
806 | 772 | ||
807 | acpi_status | 773 | acpi_status |
808 | acpi_ds_eval_data_object_operands ( | 774 | acpi_ds_eval_data_object_operands(struct acpi_walk_state *walk_state, |
809 | struct acpi_walk_state *walk_state, | 775 | union acpi_parse_object *op, |
810 | union acpi_parse_object *op, | 776 | union acpi_operand_object *obj_desc) |
811 | union acpi_operand_object *obj_desc) | ||
812 | { | 777 | { |
813 | acpi_status status; | 778 | acpi_status status; |
814 | union acpi_operand_object *arg_desc; | 779 | union acpi_operand_object *arg_desc; |
815 | u32 length; | 780 | u32 length; |
816 | |||
817 | |||
818 | ACPI_FUNCTION_TRACE ("ds_eval_data_object_operands"); | ||
819 | 781 | ||
782 | ACPI_FUNCTION_TRACE("ds_eval_data_object_operands"); | ||
820 | 783 | ||
821 | /* The first operand (for all of these data objects) is the length */ | 784 | /* The first operand (for all of these data objects) is the length */ |
822 | 785 | ||
823 | status = acpi_ds_create_operand (walk_state, op->common.value.arg, 1); | 786 | status = acpi_ds_create_operand(walk_state, op->common.value.arg, 1); |
824 | if (ACPI_FAILURE (status)) { | 787 | if (ACPI_FAILURE(status)) { |
825 | return_ACPI_STATUS (status); | 788 | return_ACPI_STATUS(status); |
826 | } | 789 | } |
827 | 790 | ||
828 | status = acpi_ex_resolve_operands (walk_state->opcode, | 791 | status = acpi_ex_resolve_operands(walk_state->opcode, |
829 | &(walk_state->operands [walk_state->num_operands -1]), | 792 | &(walk_state-> |
830 | walk_state); | 793 | operands[walk_state->num_operands - |
831 | if (ACPI_FAILURE (status)) { | 794 | 1]), walk_state); |
832 | return_ACPI_STATUS (status); | 795 | if (ACPI_FAILURE(status)) { |
796 | return_ACPI_STATUS(status); | ||
833 | } | 797 | } |
834 | 798 | ||
835 | /* Extract length operand */ | 799 | /* Extract length operand */ |
836 | 800 | ||
837 | arg_desc = walk_state->operands [walk_state->num_operands - 1]; | 801 | arg_desc = walk_state->operands[walk_state->num_operands - 1]; |
838 | length = (u32) arg_desc->integer.value; | 802 | length = (u32) arg_desc->integer.value; |
839 | 803 | ||
840 | /* Cleanup for length operand */ | 804 | /* Cleanup for length operand */ |
841 | 805 | ||
842 | status = acpi_ds_obj_stack_pop (1, walk_state); | 806 | status = acpi_ds_obj_stack_pop(1, walk_state); |
843 | if (ACPI_FAILURE (status)) { | 807 | if (ACPI_FAILURE(status)) { |
844 | return_ACPI_STATUS (status); | 808 | return_ACPI_STATUS(status); |
845 | } | 809 | } |
846 | 810 | ||
847 | acpi_ut_remove_reference (arg_desc); | 811 | acpi_ut_remove_reference(arg_desc); |
848 | 812 | ||
849 | /* | 813 | /* |
850 | * Create the actual data object | 814 | * Create the actual data object |
@@ -852,37 +816,42 @@ acpi_ds_eval_data_object_operands ( | |||
852 | switch (op->common.aml_opcode) { | 816 | switch (op->common.aml_opcode) { |
853 | case AML_BUFFER_OP: | 817 | case AML_BUFFER_OP: |
854 | 818 | ||
855 | status = acpi_ds_build_internal_buffer_obj (walk_state, op, length, &obj_desc); | 819 | status = |
820 | acpi_ds_build_internal_buffer_obj(walk_state, op, length, | ||
821 | &obj_desc); | ||
856 | break; | 822 | break; |
857 | 823 | ||
858 | case AML_PACKAGE_OP: | 824 | case AML_PACKAGE_OP: |
859 | case AML_VAR_PACKAGE_OP: | 825 | case AML_VAR_PACKAGE_OP: |
860 | 826 | ||
861 | status = acpi_ds_build_internal_package_obj (walk_state, op, length, &obj_desc); | 827 | status = |
828 | acpi_ds_build_internal_package_obj(walk_state, op, length, | ||
829 | &obj_desc); | ||
862 | break; | 830 | break; |
863 | 831 | ||
864 | default: | 832 | default: |
865 | return_ACPI_STATUS (AE_AML_BAD_OPCODE); | 833 | return_ACPI_STATUS(AE_AML_BAD_OPCODE); |
866 | } | 834 | } |
867 | 835 | ||
868 | if (ACPI_SUCCESS (status)) { | 836 | if (ACPI_SUCCESS(status)) { |
869 | /* | 837 | /* |
870 | * Return the object in the walk_state, unless the parent is a package - | 838 | * Return the object in the walk_state, unless the parent is a package - |
871 | * in this case, the return object will be stored in the parse tree | 839 | * in this case, the return object will be stored in the parse tree |
872 | * for the package. | 840 | * for the package. |
873 | */ | 841 | */ |
874 | if ((!op->common.parent) || | 842 | if ((!op->common.parent) || |
875 | ((op->common.parent->common.aml_opcode != AML_PACKAGE_OP) && | 843 | ((op->common.parent->common.aml_opcode != AML_PACKAGE_OP) && |
876 | (op->common.parent->common.aml_opcode != AML_VAR_PACKAGE_OP) && | 844 | (op->common.parent->common.aml_opcode != |
877 | (op->common.parent->common.aml_opcode != AML_NAME_OP))) { | 845 | AML_VAR_PACKAGE_OP) |
846 | && (op->common.parent->common.aml_opcode != | ||
847 | AML_NAME_OP))) { | ||
878 | walk_state->result_obj = obj_desc; | 848 | walk_state->result_obj = obj_desc; |
879 | } | 849 | } |
880 | } | 850 | } |
881 | 851 | ||
882 | return_ACPI_STATUS (status); | 852 | return_ACPI_STATUS(status); |
883 | } | 853 | } |
884 | 854 | ||
885 | |||
886 | /******************************************************************************* | 855 | /******************************************************************************* |
887 | * | 856 | * |
888 | * FUNCTION: acpi_ds_exec_begin_control_op | 857 | * FUNCTION: acpi_ds_exec_begin_control_op |
@@ -898,19 +867,16 @@ acpi_ds_eval_data_object_operands ( | |||
898 | ******************************************************************************/ | 867 | ******************************************************************************/ |
899 | 868 | ||
900 | acpi_status | 869 | acpi_status |
901 | acpi_ds_exec_begin_control_op ( | 870 | acpi_ds_exec_begin_control_op(struct acpi_walk_state *walk_state, |
902 | struct acpi_walk_state *walk_state, | 871 | union acpi_parse_object *op) |
903 | union acpi_parse_object *op) | ||
904 | { | 872 | { |
905 | acpi_status status = AE_OK; | 873 | acpi_status status = AE_OK; |
906 | union acpi_generic_state *control_state; | 874 | union acpi_generic_state *control_state; |
907 | |||
908 | |||
909 | ACPI_FUNCTION_NAME ("ds_exec_begin_control_op"); | ||
910 | 875 | ||
876 | ACPI_FUNCTION_NAME("ds_exec_begin_control_op"); | ||
911 | 877 | ||
912 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p Opcode=%2.2X State=%p\n", op, | 878 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p Opcode=%2.2X State=%p\n", op, |
913 | op->common.aml_opcode, walk_state)); | 879 | op->common.aml_opcode, walk_state)); |
914 | 880 | ||
915 | switch (op->common.aml_opcode) { | 881 | switch (op->common.aml_opcode) { |
916 | case AML_IF_OP: | 882 | case AML_IF_OP: |
@@ -921,7 +887,7 @@ acpi_ds_exec_begin_control_op ( | |||
921 | * constructs. We need to manage these as a stack, in order | 887 | * constructs. We need to manage these as a stack, in order |
922 | * to handle nesting. | 888 | * to handle nesting. |
923 | */ | 889 | */ |
924 | control_state = acpi_ut_create_control_state (); | 890 | control_state = acpi_ut_create_control_state(); |
925 | if (!control_state) { | 891 | if (!control_state) { |
926 | status = AE_NO_MEMORY; | 892 | status = AE_NO_MEMORY; |
927 | break; | 893 | break; |
@@ -930,14 +896,16 @@ acpi_ds_exec_begin_control_op ( | |||
930 | * Save a pointer to the predicate for multiple executions | 896 | * Save a pointer to the predicate for multiple executions |
931 | * of a loop | 897 | * of a loop |
932 | */ | 898 | */ |
933 | control_state->control.aml_predicate_start = walk_state->parser_state.aml - 1; | 899 | control_state->control.aml_predicate_start = |
934 | control_state->control.package_end = walk_state->parser_state.pkg_end; | 900 | walk_state->parser_state.aml - 1; |
901 | control_state->control.package_end = | ||
902 | walk_state->parser_state.pkg_end; | ||
935 | control_state->control.opcode = op->common.aml_opcode; | 903 | control_state->control.opcode = op->common.aml_opcode; |
936 | 904 | ||
937 | |||
938 | /* Push the control state on this walk's control stack */ | 905 | /* Push the control state on this walk's control stack */ |
939 | 906 | ||
940 | acpi_ut_push_generic_state (&walk_state->control_state, control_state); | 907 | acpi_ut_push_generic_state(&walk_state->control_state, |
908 | control_state); | ||
941 | break; | 909 | break; |
942 | 910 | ||
943 | case AML_ELSE_OP: | 911 | case AML_ELSE_OP: |
@@ -962,7 +930,6 @@ acpi_ds_exec_begin_control_op ( | |||
962 | return (status); | 930 | return (status); |
963 | } | 931 | } |
964 | 932 | ||
965 | |||
966 | /******************************************************************************* | 933 | /******************************************************************************* |
967 | * | 934 | * |
968 | * FUNCTION: acpi_ds_exec_end_control_op | 935 | * FUNCTION: acpi_ds_exec_end_control_op |
@@ -978,46 +945,42 @@ acpi_ds_exec_begin_control_op ( | |||
978 | ******************************************************************************/ | 945 | ******************************************************************************/ |
979 | 946 | ||
980 | acpi_status | 947 | acpi_status |
981 | acpi_ds_exec_end_control_op ( | 948 | acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state, |
982 | struct acpi_walk_state *walk_state, | 949 | union acpi_parse_object * op) |
983 | union acpi_parse_object *op) | ||
984 | { | 950 | { |
985 | acpi_status status = AE_OK; | 951 | acpi_status status = AE_OK; |
986 | union acpi_generic_state *control_state; | 952 | union acpi_generic_state *control_state; |
987 | |||
988 | |||
989 | ACPI_FUNCTION_NAME ("ds_exec_end_control_op"); | ||
990 | 953 | ||
954 | ACPI_FUNCTION_NAME("ds_exec_end_control_op"); | ||
991 | 955 | ||
992 | switch (op->common.aml_opcode) { | 956 | switch (op->common.aml_opcode) { |
993 | case AML_IF_OP: | 957 | case AML_IF_OP: |
994 | 958 | ||
995 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[IF_OP] Op=%p\n", op)); | 959 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "[IF_OP] Op=%p\n", op)); |
996 | 960 | ||
997 | /* | 961 | /* |
998 | * Save the result of the predicate in case there is an | 962 | * Save the result of the predicate in case there is an |
999 | * ELSE to come | 963 | * ELSE to come |
1000 | */ | 964 | */ |
1001 | walk_state->last_predicate = | 965 | walk_state->last_predicate = |
1002 | (u8) walk_state->control_state->common.value; | 966 | (u8) walk_state->control_state->common.value; |
1003 | 967 | ||
1004 | /* | 968 | /* |
1005 | * Pop the control state that was created at the start | 969 | * Pop the control state that was created at the start |
1006 | * of the IF and free it | 970 | * of the IF and free it |
1007 | */ | 971 | */ |
1008 | control_state = acpi_ut_pop_generic_state (&walk_state->control_state); | 972 | control_state = |
1009 | acpi_ut_delete_generic_state (control_state); | 973 | acpi_ut_pop_generic_state(&walk_state->control_state); |
974 | acpi_ut_delete_generic_state(control_state); | ||
1010 | break; | 975 | break; |
1011 | 976 | ||
1012 | |||
1013 | case AML_ELSE_OP: | 977 | case AML_ELSE_OP: |
1014 | 978 | ||
1015 | break; | 979 | break; |
1016 | 980 | ||
1017 | |||
1018 | case AML_WHILE_OP: | 981 | case AML_WHILE_OP: |
1019 | 982 | ||
1020 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[WHILE_OP] Op=%p\n", op)); | 983 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "[WHILE_OP] Op=%p\n", op)); |
1021 | 984 | ||
1022 | if (walk_state->control_state->common.value) { | 985 | if (walk_state->control_state->common.value) { |
1023 | /* Predicate was true, go back and evaluate it again! */ | 986 | /* Predicate was true, go back and evaluate it again! */ |
@@ -1025,22 +988,24 @@ acpi_ds_exec_end_control_op ( | |||
1025 | status = AE_CTRL_PENDING; | 988 | status = AE_CTRL_PENDING; |
1026 | } | 989 | } |
1027 | 990 | ||
1028 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, | 991 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
1029 | "[WHILE_OP] termination! Op=%p\n",op)); | 992 | "[WHILE_OP] termination! Op=%p\n", op)); |
1030 | 993 | ||
1031 | /* Pop this control state and free it */ | 994 | /* Pop this control state and free it */ |
1032 | 995 | ||
1033 | control_state = acpi_ut_pop_generic_state (&walk_state->control_state); | 996 | control_state = |
997 | acpi_ut_pop_generic_state(&walk_state->control_state); | ||
1034 | 998 | ||
1035 | walk_state->aml_last_while = control_state->control.aml_predicate_start; | 999 | walk_state->aml_last_while = |
1036 | acpi_ut_delete_generic_state (control_state); | 1000 | control_state->control.aml_predicate_start; |
1001 | acpi_ut_delete_generic_state(control_state); | ||
1037 | break; | 1002 | break; |
1038 | 1003 | ||
1039 | |||
1040 | case AML_RETURN_OP: | 1004 | case AML_RETURN_OP: |
1041 | 1005 | ||
1042 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, | 1006 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
1043 | "[RETURN_OP] Op=%p Arg=%p\n",op, op->common.value.arg)); | 1007 | "[RETURN_OP] Op=%p Arg=%p\n", op, |
1008 | op->common.value.arg)); | ||
1044 | 1009 | ||
1045 | /* | 1010 | /* |
1046 | * One optional operand -- the return value | 1011 | * One optional operand -- the return value |
@@ -1050,12 +1015,14 @@ acpi_ds_exec_end_control_op ( | |||
1050 | if (op->common.value.arg) { | 1015 | if (op->common.value.arg) { |
1051 | /* Since we have a real Return(), delete any implicit return */ | 1016 | /* Since we have a real Return(), delete any implicit return */ |
1052 | 1017 | ||
1053 | acpi_ds_clear_implicit_return (walk_state); | 1018 | acpi_ds_clear_implicit_return(walk_state); |
1054 | 1019 | ||
1055 | /* Return statement has an immediate operand */ | 1020 | /* Return statement has an immediate operand */ |
1056 | 1021 | ||
1057 | status = acpi_ds_create_operands (walk_state, op->common.value.arg); | 1022 | status = |
1058 | if (ACPI_FAILURE (status)) { | 1023 | acpi_ds_create_operands(walk_state, |
1024 | op->common.value.arg); | ||
1025 | if (ACPI_FAILURE(status)) { | ||
1059 | return (status); | 1026 | return (status); |
1060 | } | 1027 | } |
1061 | 1028 | ||
@@ -1064,8 +1031,10 @@ acpi_ds_exec_end_control_op ( | |||
1064 | * an arg or local), resolve it now because it may | 1031 | * an arg or local), resolve it now because it may |
1065 | * cease to exist at the end of the method. | 1032 | * cease to exist at the end of the method. |
1066 | */ | 1033 | */ |
1067 | status = acpi_ex_resolve_to_value (&walk_state->operands [0], walk_state); | 1034 | status = |
1068 | if (ACPI_FAILURE (status)) { | 1035 | acpi_ex_resolve_to_value(&walk_state->operands[0], |
1036 | walk_state); | ||
1037 | if (ACPI_FAILURE(status)) { | ||
1069 | return (status); | 1038 | return (status); |
1070 | } | 1039 | } |
1071 | 1040 | ||
@@ -1075,12 +1044,11 @@ acpi_ds_exec_end_control_op ( | |||
1075 | * is set to anything other than zero! | 1044 | * is set to anything other than zero! |
1076 | */ | 1045 | */ |
1077 | walk_state->return_desc = walk_state->operands[0]; | 1046 | walk_state->return_desc = walk_state->operands[0]; |
1078 | } | 1047 | } else if ((walk_state->results) && |
1079 | else if ((walk_state->results) && | 1048 | (walk_state->results->results.num_results > 0)) { |
1080 | (walk_state->results->results.num_results > 0)) { | ||
1081 | /* Since we have a real Return(), delete any implicit return */ | 1049 | /* Since we have a real Return(), delete any implicit return */ |
1082 | 1050 | ||
1083 | acpi_ds_clear_implicit_return (walk_state); | 1051 | acpi_ds_clear_implicit_return(walk_state); |
1084 | 1052 | ||
1085 | /* | 1053 | /* |
1086 | * The return value has come from a previous calculation. | 1054 | * The return value has come from a previous calculation. |
@@ -1091,67 +1059,78 @@ acpi_ds_exec_end_control_op ( | |||
1091 | * | 1059 | * |
1092 | * Allow references created by the Index operator to return unchanged. | 1060 | * Allow references created by the Index operator to return unchanged. |
1093 | */ | 1061 | */ |
1094 | if ((ACPI_GET_DESCRIPTOR_TYPE (walk_state->results->results.obj_desc[0]) == ACPI_DESC_TYPE_OPERAND) && | 1062 | if ((ACPI_GET_DESCRIPTOR_TYPE |
1095 | (ACPI_GET_OBJECT_TYPE (walk_state->results->results.obj_desc [0]) == ACPI_TYPE_LOCAL_REFERENCE) && | 1063 | (walk_state->results->results.obj_desc[0]) == |
1096 | ((walk_state->results->results.obj_desc [0])->reference.opcode != AML_INDEX_OP)) { | 1064 | ACPI_DESC_TYPE_OPERAND) |
1097 | status = acpi_ex_resolve_to_value (&walk_state->results->results.obj_desc [0], walk_state); | 1065 | && |
1098 | if (ACPI_FAILURE (status)) { | 1066 | (ACPI_GET_OBJECT_TYPE |
1067 | (walk_state->results->results.obj_desc[0]) == | ||
1068 | ACPI_TYPE_LOCAL_REFERENCE) | ||
1069 | && ((walk_state->results->results.obj_desc[0])-> | ||
1070 | reference.opcode != AML_INDEX_OP)) { | ||
1071 | status = | ||
1072 | acpi_ex_resolve_to_value(&walk_state-> | ||
1073 | results->results. | ||
1074 | obj_desc[0], | ||
1075 | walk_state); | ||
1076 | if (ACPI_FAILURE(status)) { | ||
1099 | return (status); | 1077 | return (status); |
1100 | } | 1078 | } |
1101 | } | 1079 | } |
1102 | 1080 | ||
1103 | walk_state->return_desc = walk_state->results->results.obj_desc [0]; | 1081 | walk_state->return_desc = |
1104 | } | 1082 | walk_state->results->results.obj_desc[0]; |
1105 | else { | 1083 | } else { |
1106 | /* No return operand */ | 1084 | /* No return operand */ |
1107 | 1085 | ||
1108 | if (walk_state->num_operands) { | 1086 | if (walk_state->num_operands) { |
1109 | acpi_ut_remove_reference (walk_state->operands [0]); | 1087 | acpi_ut_remove_reference(walk_state-> |
1088 | operands[0]); | ||
1110 | } | 1089 | } |
1111 | 1090 | ||
1112 | walk_state->operands [0] = NULL; | 1091 | walk_state->operands[0] = NULL; |
1113 | walk_state->num_operands = 0; | 1092 | walk_state->num_operands = 0; |
1114 | walk_state->return_desc = NULL; | 1093 | walk_state->return_desc = NULL; |
1115 | } | 1094 | } |
1116 | 1095 | ||
1117 | 1096 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | |
1118 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, | 1097 | "Completed RETURN_OP State=%p, ret_val=%p\n", |
1119 | "Completed RETURN_OP State=%p, ret_val=%p\n", | 1098 | walk_state, walk_state->return_desc)); |
1120 | walk_state, walk_state->return_desc)); | ||
1121 | 1099 | ||
1122 | /* End the control method execution right now */ | 1100 | /* End the control method execution right now */ |
1123 | 1101 | ||
1124 | status = AE_CTRL_TERMINATE; | 1102 | status = AE_CTRL_TERMINATE; |
1125 | break; | 1103 | break; |
1126 | 1104 | ||
1127 | |||
1128 | case AML_NOOP_OP: | 1105 | case AML_NOOP_OP: |
1129 | 1106 | ||
1130 | /* Just do nothing! */ | 1107 | /* Just do nothing! */ |
1131 | break; | 1108 | break; |
1132 | 1109 | ||
1133 | |||
1134 | case AML_BREAK_POINT_OP: | 1110 | case AML_BREAK_POINT_OP: |
1135 | 1111 | ||
1136 | /* Call up to the OS service layer to handle this */ | 1112 | /* Call up to the OS service layer to handle this */ |
1137 | 1113 | ||
1138 | status = acpi_os_signal (ACPI_SIGNAL_BREAKPOINT, "Executed AML Breakpoint opcode"); | 1114 | status = |
1115 | acpi_os_signal(ACPI_SIGNAL_BREAKPOINT, | ||
1116 | "Executed AML Breakpoint opcode"); | ||
1139 | 1117 | ||
1140 | /* If and when it returns, all done. */ | 1118 | /* If and when it returns, all done. */ |
1141 | 1119 | ||
1142 | break; | 1120 | break; |
1143 | 1121 | ||
1144 | |||
1145 | case AML_BREAK_OP: | 1122 | case AML_BREAK_OP: |
1146 | case AML_CONTINUE_OP: /* ACPI 2.0 */ | 1123 | case AML_CONTINUE_OP: /* ACPI 2.0 */ |
1147 | |||
1148 | 1124 | ||
1149 | /* Pop and delete control states until we find a while */ | 1125 | /* Pop and delete control states until we find a while */ |
1150 | 1126 | ||
1151 | while (walk_state->control_state && | 1127 | while (walk_state->control_state && |
1152 | (walk_state->control_state->control.opcode != AML_WHILE_OP)) { | 1128 | (walk_state->control_state->control.opcode != |
1153 | control_state = acpi_ut_pop_generic_state (&walk_state->control_state); | 1129 | AML_WHILE_OP)) { |
1154 | acpi_ut_delete_generic_state (control_state); | 1130 | control_state = |
1131 | acpi_ut_pop_generic_state(&walk_state-> | ||
1132 | control_state); | ||
1133 | acpi_ut_delete_generic_state(control_state); | ||
1155 | } | 1134 | } |
1156 | 1135 | ||
1157 | /* No while found? */ | 1136 | /* No while found? */ |
@@ -1162,23 +1141,23 @@ acpi_ds_exec_end_control_op ( | |||
1162 | 1141 | ||
1163 | /* Was: walk_state->aml_last_while = walk_state->control_state->Control.aml_predicate_start; */ | 1142 | /* Was: walk_state->aml_last_while = walk_state->control_state->Control.aml_predicate_start; */ |
1164 | 1143 | ||
1165 | walk_state->aml_last_while = walk_state->control_state->control.package_end; | 1144 | walk_state->aml_last_while = |
1145 | walk_state->control_state->control.package_end; | ||
1166 | 1146 | ||
1167 | /* Return status depending on opcode */ | 1147 | /* Return status depending on opcode */ |
1168 | 1148 | ||
1169 | if (op->common.aml_opcode == AML_BREAK_OP) { | 1149 | if (op->common.aml_opcode == AML_BREAK_OP) { |
1170 | status = AE_CTRL_BREAK; | 1150 | status = AE_CTRL_BREAK; |
1171 | } | 1151 | } else { |
1172 | else { | ||
1173 | status = AE_CTRL_CONTINUE; | 1152 | status = AE_CTRL_CONTINUE; |
1174 | } | 1153 | } |
1175 | break; | 1154 | break; |
1176 | 1155 | ||
1177 | |||
1178 | default: | 1156 | default: |
1179 | 1157 | ||
1180 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown control opcode=%X Op=%p\n", | 1158 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
1181 | op->common.aml_opcode, op)); | 1159 | "Unknown control opcode=%X Op=%p\n", |
1160 | op->common.aml_opcode, op)); | ||
1182 | 1161 | ||
1183 | status = AE_AML_BAD_OPCODE; | 1162 | status = AE_AML_BAD_OPCODE; |
1184 | break; | 1163 | break; |
@@ -1186,4 +1165,3 @@ acpi_ds_exec_end_control_op ( | |||
1186 | 1165 | ||
1187 | return (status); | 1166 | return (status); |
1188 | } | 1167 | } |
1189 | |||
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 | |||
diff --git a/drivers/acpi/dispatcher/dswexec.c b/drivers/acpi/dispatcher/dswexec.c index 10f71318e23b..e522763bb692 100644 --- a/drivers/acpi/dispatcher/dswexec.c +++ b/drivers/acpi/dispatcher/dswexec.c | |||
@@ -42,7 +42,6 @@ | |||
42 | * POSSIBILITY OF SUCH DAMAGES. | 42 | * POSSIBILITY OF SUCH DAMAGES. |
43 | */ | 43 | */ |
44 | 44 | ||
45 | |||
46 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
47 | #include <acpi/acparser.h> | 46 | #include <acpi/acparser.h> |
48 | #include <acpi/amlcode.h> | 47 | #include <acpi/amlcode.h> |
@@ -52,27 +51,26 @@ | |||
52 | #include <acpi/acdebug.h> | 51 | #include <acpi/acdebug.h> |
53 | #include <acpi/acdisasm.h> | 52 | #include <acpi/acdisasm.h> |
54 | 53 | ||
55 | |||
56 | #define _COMPONENT ACPI_DISPATCHER | 54 | #define _COMPONENT ACPI_DISPATCHER |
57 | ACPI_MODULE_NAME ("dswexec") | 55 | ACPI_MODULE_NAME("dswexec") |
58 | 56 | ||
59 | /* | 57 | /* |
60 | * Dispatch table for opcode classes | 58 | * Dispatch table for opcode classes |
61 | */ | 59 | */ |
62 | static ACPI_EXECUTE_OP acpi_gbl_op_type_dispatch [] = { | 60 | static ACPI_EXECUTE_OP acpi_gbl_op_type_dispatch[] = { |
63 | acpi_ex_opcode_0A_0T_1R, | 61 | acpi_ex_opcode_0A_0T_1R, |
64 | acpi_ex_opcode_1A_0T_0R, | 62 | acpi_ex_opcode_1A_0T_0R, |
65 | acpi_ex_opcode_1A_0T_1R, | 63 | acpi_ex_opcode_1A_0T_1R, |
66 | acpi_ex_opcode_1A_1T_0R, | 64 | acpi_ex_opcode_1A_1T_0R, |
67 | acpi_ex_opcode_1A_1T_1R, | 65 | acpi_ex_opcode_1A_1T_1R, |
68 | acpi_ex_opcode_2A_0T_0R, | 66 | acpi_ex_opcode_2A_0T_0R, |
69 | acpi_ex_opcode_2A_0T_1R, | 67 | acpi_ex_opcode_2A_0T_1R, |
70 | acpi_ex_opcode_2A_1T_1R, | 68 | acpi_ex_opcode_2A_1T_1R, |
71 | acpi_ex_opcode_2A_2T_1R, | 69 | acpi_ex_opcode_2A_2T_1R, |
72 | acpi_ex_opcode_3A_0T_0R, | 70 | acpi_ex_opcode_3A_0T_0R, |
73 | acpi_ex_opcode_3A_1T_1R, | 71 | acpi_ex_opcode_3A_1T_1R, |
74 | acpi_ex_opcode_6A_0T_1R}; | 72 | acpi_ex_opcode_6A_0T_1R |
75 | 73 | }; | |
76 | 74 | ||
77 | /***************************************************************************** | 75 | /***************************************************************************** |
78 | * | 76 | * |
@@ -88,64 +86,64 @@ static ACPI_EXECUTE_OP acpi_gbl_op_type_dispatch [] = { | |||
88 | ****************************************************************************/ | 86 | ****************************************************************************/ |
89 | 87 | ||
90 | acpi_status | 88 | acpi_status |
91 | acpi_ds_get_predicate_value ( | 89 | acpi_ds_get_predicate_value(struct acpi_walk_state *walk_state, |
92 | struct acpi_walk_state *walk_state, | 90 | union acpi_operand_object *result_obj) |
93 | union acpi_operand_object *result_obj) { | 91 | { |
94 | acpi_status status = AE_OK; | 92 | acpi_status status = AE_OK; |
95 | union acpi_operand_object *obj_desc; | 93 | union acpi_operand_object *obj_desc; |
96 | union acpi_operand_object *local_obj_desc = NULL; | 94 | union acpi_operand_object *local_obj_desc = NULL; |
97 | |||
98 | |||
99 | ACPI_FUNCTION_TRACE_PTR ("ds_get_predicate_value", walk_state); | ||
100 | 95 | ||
96 | ACPI_FUNCTION_TRACE_PTR("ds_get_predicate_value", walk_state); | ||
101 | 97 | ||
102 | walk_state->control_state->common.state = 0; | 98 | walk_state->control_state->common.state = 0; |
103 | 99 | ||
104 | if (result_obj) { | 100 | if (result_obj) { |
105 | status = acpi_ds_result_pop (&obj_desc, walk_state); | 101 | status = acpi_ds_result_pop(&obj_desc, walk_state); |
106 | if (ACPI_FAILURE (status)) { | 102 | if (ACPI_FAILURE(status)) { |
107 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 103 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
108 | "Could not get result from predicate evaluation, %s\n", | 104 | "Could not get result from predicate evaluation, %s\n", |
109 | acpi_format_exception (status))); | 105 | acpi_format_exception(status))); |
110 | 106 | ||
111 | return_ACPI_STATUS (status); | 107 | return_ACPI_STATUS(status); |
112 | } | 108 | } |
113 | } | 109 | } else { |
114 | else { | 110 | status = acpi_ds_create_operand(walk_state, walk_state->op, 0); |
115 | status = acpi_ds_create_operand (walk_state, walk_state->op, 0); | 111 | if (ACPI_FAILURE(status)) { |
116 | if (ACPI_FAILURE (status)) { | 112 | return_ACPI_STATUS(status); |
117 | return_ACPI_STATUS (status); | ||
118 | } | 113 | } |
119 | 114 | ||
120 | status = acpi_ex_resolve_to_value (&walk_state->operands [0], walk_state); | 115 | status = |
121 | if (ACPI_FAILURE (status)) { | 116 | acpi_ex_resolve_to_value(&walk_state->operands[0], |
122 | return_ACPI_STATUS (status); | 117 | walk_state); |
118 | if (ACPI_FAILURE(status)) { | ||
119 | return_ACPI_STATUS(status); | ||
123 | } | 120 | } |
124 | 121 | ||
125 | obj_desc = walk_state->operands [0]; | 122 | obj_desc = walk_state->operands[0]; |
126 | } | 123 | } |
127 | 124 | ||
128 | if (!obj_desc) { | 125 | if (!obj_desc) { |
129 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 126 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
130 | "No predicate obj_desc=%p State=%p\n", | 127 | "No predicate obj_desc=%p State=%p\n", |
131 | obj_desc, walk_state)); | 128 | obj_desc, walk_state)); |
132 | 129 | ||
133 | return_ACPI_STATUS (AE_AML_NO_OPERAND); | 130 | return_ACPI_STATUS(AE_AML_NO_OPERAND); |
134 | } | 131 | } |
135 | 132 | ||
136 | /* | 133 | /* |
137 | * Result of predicate evaluation must be an Integer | 134 | * Result of predicate evaluation must be an Integer |
138 | * object. Implicitly convert the argument if necessary. | 135 | * object. Implicitly convert the argument if necessary. |
139 | */ | 136 | */ |
140 | status = acpi_ex_convert_to_integer (obj_desc, &local_obj_desc, 16); | 137 | status = acpi_ex_convert_to_integer(obj_desc, &local_obj_desc, 16); |
141 | if (ACPI_FAILURE (status)) { | 138 | if (ACPI_FAILURE(status)) { |
142 | goto cleanup; | 139 | goto cleanup; |
143 | } | 140 | } |
144 | 141 | ||
145 | if (ACPI_GET_OBJECT_TYPE (local_obj_desc) != ACPI_TYPE_INTEGER) { | 142 | if (ACPI_GET_OBJECT_TYPE(local_obj_desc) != ACPI_TYPE_INTEGER) { |
146 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 143 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
147 | "Bad predicate (not an integer) obj_desc=%p State=%p Type=%X\n", | 144 | "Bad predicate (not an integer) obj_desc=%p State=%p Type=%X\n", |
148 | obj_desc, walk_state, ACPI_GET_OBJECT_TYPE (obj_desc))); | 145 | obj_desc, walk_state, |
146 | ACPI_GET_OBJECT_TYPE(obj_desc))); | ||
149 | 147 | ||
150 | status = AE_AML_OPERAND_TYPE; | 148 | status = AE_AML_OPERAND_TYPE; |
151 | goto cleanup; | 149 | goto cleanup; |
@@ -153,7 +151,7 @@ acpi_ds_get_predicate_value ( | |||
153 | 151 | ||
154 | /* Truncate the predicate to 32-bits if necessary */ | 152 | /* Truncate the predicate to 32-bits if necessary */ |
155 | 153 | ||
156 | acpi_ex_truncate_for32bit_table (local_obj_desc); | 154 | acpi_ex_truncate_for32bit_table(local_obj_desc); |
157 | 155 | ||
158 | /* | 156 | /* |
159 | * Save the result of the predicate evaluation on | 157 | * Save the result of the predicate evaluation on |
@@ -161,8 +159,7 @@ acpi_ds_get_predicate_value ( | |||
161 | */ | 159 | */ |
162 | if (local_obj_desc->integer.value) { | 160 | if (local_obj_desc->integer.value) { |
163 | walk_state->control_state->common.value = TRUE; | 161 | walk_state->control_state->common.value = TRUE; |
164 | } | 162 | } else { |
165 | else { | ||
166 | /* | 163 | /* |
167 | * Predicate is FALSE, we will just toss the | 164 | * Predicate is FALSE, we will just toss the |
168 | * rest of the package | 165 | * rest of the package |
@@ -171,30 +168,30 @@ acpi_ds_get_predicate_value ( | |||
171 | status = AE_CTRL_FALSE; | 168 | status = AE_CTRL_FALSE; |
172 | } | 169 | } |
173 | 170 | ||
171 | cleanup: | ||
174 | 172 | ||
175 | cleanup: | 173 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Completed a predicate eval=%X Op=%p\n", |
174 | walk_state->control_state->common.value, | ||
175 | walk_state->op)); | ||
176 | 176 | ||
177 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Completed a predicate eval=%X Op=%p\n", | 177 | /* Break to debugger to display result */ |
178 | walk_state->control_state->common.value, walk_state->op)); | ||
179 | 178 | ||
180 | /* Break to debugger to display result */ | 179 | ACPI_DEBUGGER_EXEC(acpi_db_display_result_object |
181 | 180 | (local_obj_desc, walk_state)); | |
182 | ACPI_DEBUGGER_EXEC (acpi_db_display_result_object (local_obj_desc, walk_state)); | ||
183 | 181 | ||
184 | /* | 182 | /* |
185 | * Delete the predicate result object (we know that | 183 | * Delete the predicate result object (we know that |
186 | * we don't need it anymore) | 184 | * we don't need it anymore) |
187 | */ | 185 | */ |
188 | if (local_obj_desc != obj_desc) { | 186 | if (local_obj_desc != obj_desc) { |
189 | acpi_ut_remove_reference (local_obj_desc); | 187 | acpi_ut_remove_reference(local_obj_desc); |
190 | } | 188 | } |
191 | acpi_ut_remove_reference (obj_desc); | 189 | acpi_ut_remove_reference(obj_desc); |
192 | 190 | ||
193 | walk_state->control_state->common.state = ACPI_CONTROL_NORMAL; | 191 | walk_state->control_state->common.state = ACPI_CONTROL_NORMAL; |
194 | return_ACPI_STATUS (status); | 192 | return_ACPI_STATUS(status); |
195 | } | 193 | } |
196 | 194 | ||
197 | |||
198 | /***************************************************************************** | 195 | /***************************************************************************** |
199 | * | 196 | * |
200 | * FUNCTION: acpi_ds_exec_begin_op | 197 | * FUNCTION: acpi_ds_exec_begin_op |
@@ -211,38 +208,39 @@ cleanup: | |||
211 | ****************************************************************************/ | 208 | ****************************************************************************/ |
212 | 209 | ||
213 | acpi_status | 210 | acpi_status |
214 | acpi_ds_exec_begin_op ( | 211 | acpi_ds_exec_begin_op(struct acpi_walk_state *walk_state, |
215 | struct acpi_walk_state *walk_state, | 212 | union acpi_parse_object **out_op) |
216 | union acpi_parse_object **out_op) | ||
217 | { | 213 | { |
218 | union acpi_parse_object *op; | 214 | union acpi_parse_object *op; |
219 | acpi_status status = AE_OK; | 215 | acpi_status status = AE_OK; |
220 | u32 opcode_class; | 216 | u32 opcode_class; |
221 | |||
222 | |||
223 | ACPI_FUNCTION_TRACE_PTR ("ds_exec_begin_op", walk_state); | ||
224 | 217 | ||
218 | ACPI_FUNCTION_TRACE_PTR("ds_exec_begin_op", walk_state); | ||
225 | 219 | ||
226 | op = walk_state->op; | 220 | op = walk_state->op; |
227 | if (!op) { | 221 | if (!op) { |
228 | status = acpi_ds_load2_begin_op (walk_state, out_op); | 222 | status = acpi_ds_load2_begin_op(walk_state, out_op); |
229 | if (ACPI_FAILURE (status)) { | 223 | if (ACPI_FAILURE(status)) { |
230 | return_ACPI_STATUS (status); | 224 | return_ACPI_STATUS(status); |
231 | } | 225 | } |
232 | 226 | ||
233 | op = *out_op; | 227 | op = *out_op; |
234 | walk_state->op = op; | 228 | walk_state->op = op; |
235 | walk_state->opcode = op->common.aml_opcode; | 229 | walk_state->opcode = op->common.aml_opcode; |
236 | walk_state->op_info = acpi_ps_get_opcode_info (op->common.aml_opcode); | 230 | walk_state->op_info = |
237 | 231 | acpi_ps_get_opcode_info(op->common.aml_opcode); | |
238 | if (acpi_ns_opens_scope (walk_state->op_info->object_type)) { | 232 | |
239 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, | 233 | if (acpi_ns_opens_scope(walk_state->op_info->object_type)) { |
240 | "(%s) Popping scope for Op %p\n", | 234 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
241 | acpi_ut_get_type_name (walk_state->op_info->object_type), op)); | 235 | "(%s) Popping scope for Op %p\n", |
242 | 236 | acpi_ut_get_type_name(walk_state-> | |
243 | status = acpi_ds_scope_stack_pop (walk_state); | 237 | op_info-> |
244 | if (ACPI_FAILURE (status)) { | 238 | object_type), |
245 | return_ACPI_STATUS (status); | 239 | op)); |
240 | |||
241 | status = acpi_ds_scope_stack_pop(walk_state); | ||
242 | if (ACPI_FAILURE(status)) { | ||
243 | return_ACPI_STATUS(status); | ||
246 | } | 244 | } |
247 | } | 245 | } |
248 | } | 246 | } |
@@ -252,7 +250,7 @@ acpi_ds_exec_begin_op ( | |||
252 | *out_op = op; | 250 | *out_op = op; |
253 | } | 251 | } |
254 | 252 | ||
255 | return_ACPI_STATUS (AE_OK); | 253 | return_ACPI_STATUS(AE_OK); |
256 | } | 254 | } |
257 | 255 | ||
258 | /* | 256 | /* |
@@ -261,19 +259,20 @@ acpi_ds_exec_begin_op ( | |||
261 | * Save this knowledge in the current scope descriptor | 259 | * Save this knowledge in the current scope descriptor |
262 | */ | 260 | */ |
263 | if ((walk_state->control_state) && | 261 | if ((walk_state->control_state) && |
264 | (walk_state->control_state->common.state == | 262 | (walk_state->control_state->common.state == |
265 | ACPI_CONTROL_CONDITIONAL_EXECUTING)) { | 263 | ACPI_CONTROL_CONDITIONAL_EXECUTING)) { |
266 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Exec predicate Op=%p State=%p\n", | 264 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
267 | op, walk_state)); | 265 | "Exec predicate Op=%p State=%p\n", op, |
266 | walk_state)); | ||
268 | 267 | ||
269 | walk_state->control_state->common.state = ACPI_CONTROL_PREDICATE_EXECUTING; | 268 | walk_state->control_state->common.state = |
269 | ACPI_CONTROL_PREDICATE_EXECUTING; | ||
270 | 270 | ||
271 | /* Save start of predicate */ | 271 | /* Save start of predicate */ |
272 | 272 | ||
273 | walk_state->control_state->control.predicate_op = op; | 273 | walk_state->control_state->control.predicate_op = op; |
274 | } | 274 | } |
275 | 275 | ||
276 | |||
277 | opcode_class = walk_state->op_info->class; | 276 | opcode_class = walk_state->op_info->class; |
278 | 277 | ||
279 | /* We want to send namepaths to the load code */ | 278 | /* We want to send namepaths to the load code */ |
@@ -288,15 +287,14 @@ acpi_ds_exec_begin_op ( | |||
288 | switch (opcode_class) { | 287 | switch (opcode_class) { |
289 | case AML_CLASS_CONTROL: | 288 | case AML_CLASS_CONTROL: |
290 | 289 | ||
291 | status = acpi_ds_result_stack_push (walk_state); | 290 | status = acpi_ds_result_stack_push(walk_state); |
292 | if (ACPI_FAILURE (status)) { | 291 | if (ACPI_FAILURE(status)) { |
293 | return_ACPI_STATUS (status); | 292 | return_ACPI_STATUS(status); |
294 | } | 293 | } |
295 | 294 | ||
296 | status = acpi_ds_exec_begin_control_op (walk_state, op); | 295 | status = acpi_ds_exec_begin_control_op(walk_state, op); |
297 | break; | 296 | break; |
298 | 297 | ||
299 | |||
300 | case AML_CLASS_NAMED_OBJECT: | 298 | case AML_CLASS_NAMED_OBJECT: |
301 | 299 | ||
302 | if (walk_state->walk_type == ACPI_WALK_METHOD) { | 300 | if (walk_state->walk_type == ACPI_WALK_METHOD) { |
@@ -306,15 +304,14 @@ acpi_ds_exec_begin_op ( | |||
306 | * object is temporary and will be deleted upon completion of | 304 | * object is temporary and will be deleted upon completion of |
307 | * the execution of this method. | 305 | * the execution of this method. |
308 | */ | 306 | */ |
309 | status = acpi_ds_load2_begin_op (walk_state, NULL); | 307 | status = acpi_ds_load2_begin_op(walk_state, NULL); |
310 | } | 308 | } |
311 | 309 | ||
312 | if (op->common.aml_opcode == AML_REGION_OP) { | 310 | if (op->common.aml_opcode == AML_REGION_OP) { |
313 | status = acpi_ds_result_stack_push (walk_state); | 311 | status = acpi_ds_result_stack_push(walk_state); |
314 | } | 312 | } |
315 | break; | 313 | break; |
316 | 314 | ||
317 | |||
318 | case AML_CLASS_EXECUTE: | 315 | case AML_CLASS_EXECUTE: |
319 | case AML_CLASS_CREATE: | 316 | case AML_CLASS_CREATE: |
320 | 317 | ||
@@ -322,20 +319,18 @@ acpi_ds_exec_begin_op ( | |||
322 | * Most operators with arguments. | 319 | * Most operators with arguments. |
323 | * Start a new result/operand state | 320 | * Start a new result/operand state |
324 | */ | 321 | */ |
325 | status = acpi_ds_result_stack_push (walk_state); | 322 | status = acpi_ds_result_stack_push(walk_state); |
326 | break; | 323 | break; |
327 | 324 | ||
328 | |||
329 | default: | 325 | default: |
330 | break; | 326 | break; |
331 | } | 327 | } |
332 | 328 | ||
333 | /* Nothing to do here during method execution */ | 329 | /* Nothing to do here during method execution */ |
334 | 330 | ||
335 | return_ACPI_STATUS (status); | 331 | return_ACPI_STATUS(status); |
336 | } | 332 | } |
337 | 333 | ||
338 | |||
339 | /***************************************************************************** | 334 | /***************************************************************************** |
340 | * | 335 | * |
341 | * FUNCTION: acpi_ds_exec_end_op | 336 | * FUNCTION: acpi_ds_exec_end_op |
@@ -350,28 +345,25 @@ acpi_ds_exec_begin_op ( | |||
350 | * | 345 | * |
351 | ****************************************************************************/ | 346 | ****************************************************************************/ |
352 | 347 | ||
353 | acpi_status | 348 | acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) |
354 | acpi_ds_exec_end_op ( | ||
355 | struct acpi_walk_state *walk_state) | ||
356 | { | 349 | { |
357 | union acpi_parse_object *op; | 350 | union acpi_parse_object *op; |
358 | acpi_status status = AE_OK; | 351 | acpi_status status = AE_OK; |
359 | u32 op_type; | 352 | u32 op_type; |
360 | u32 op_class; | 353 | u32 op_class; |
361 | union acpi_parse_object *next_op; | 354 | union acpi_parse_object *next_op; |
362 | union acpi_parse_object *first_arg; | 355 | union acpi_parse_object *first_arg; |
363 | 356 | ||
357 | ACPI_FUNCTION_TRACE_PTR("ds_exec_end_op", walk_state); | ||
364 | 358 | ||
365 | ACPI_FUNCTION_TRACE_PTR ("ds_exec_end_op", walk_state); | 359 | op = walk_state->op; |
366 | |||
367 | |||
368 | op = walk_state->op; | ||
369 | op_type = walk_state->op_info->type; | 360 | op_type = walk_state->op_info->type; |
370 | op_class = walk_state->op_info->class; | 361 | op_class = walk_state->op_info->class; |
371 | 362 | ||
372 | if (op_class == AML_CLASS_UNKNOWN) { | 363 | if (op_class == AML_CLASS_UNKNOWN) { |
373 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown opcode %X\n", op->common.aml_opcode)); | 364 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unknown opcode %X\n", |
374 | return_ACPI_STATUS (AE_NOT_IMPLEMENTED); | 365 | op->common.aml_opcode)); |
366 | return_ACPI_STATUS(AE_NOT_IMPLEMENTED); | ||
375 | } | 367 | } |
376 | 368 | ||
377 | first_arg = op->common.value.arg; | 369 | first_arg = op->common.value.arg; |
@@ -384,29 +376,31 @@ acpi_ds_exec_end_op ( | |||
384 | 376 | ||
385 | /* Call debugger for single step support (DEBUG build only) */ | 377 | /* Call debugger for single step support (DEBUG build only) */ |
386 | 378 | ||
387 | ACPI_DEBUGGER_EXEC (status = acpi_db_single_step (walk_state, op, op_class)); | 379 | ACPI_DEBUGGER_EXEC(status = |
388 | ACPI_DEBUGGER_EXEC (if (ACPI_FAILURE (status)) {return_ACPI_STATUS (status);}); | 380 | acpi_db_single_step(walk_state, op, op_class)); |
381 | ACPI_DEBUGGER_EXEC(if (ACPI_FAILURE(status)) { | ||
382 | return_ACPI_STATUS(status);} | ||
383 | ) ; | ||
389 | 384 | ||
390 | /* Decode the Opcode Class */ | 385 | /* Decode the Opcode Class */ |
391 | 386 | ||
392 | switch (op_class) { | 387 | switch (op_class) { |
393 | case AML_CLASS_ARGUMENT: /* constants, literals, etc. - do nothing */ | 388 | case AML_CLASS_ARGUMENT: /* constants, literals, etc. - do nothing */ |
394 | break; | 389 | break; |
395 | 390 | ||
396 | 391 | case AML_CLASS_EXECUTE: /* most operators with arguments */ | |
397 | case AML_CLASS_EXECUTE: /* most operators with arguments */ | ||
398 | 392 | ||
399 | /* Build resolved operand stack */ | 393 | /* Build resolved operand stack */ |
400 | 394 | ||
401 | status = acpi_ds_create_operands (walk_state, first_arg); | 395 | status = acpi_ds_create_operands(walk_state, first_arg); |
402 | if (ACPI_FAILURE (status)) { | 396 | if (ACPI_FAILURE(status)) { |
403 | goto cleanup; | 397 | goto cleanup; |
404 | } | 398 | } |
405 | 399 | ||
406 | /* Done with this result state (Now that operand stack is built) */ | 400 | /* Done with this result state (Now that operand stack is built) */ |
407 | 401 | ||
408 | status = acpi_ds_result_stack_pop (walk_state); | 402 | status = acpi_ds_result_stack_pop(walk_state); |
409 | if (ACPI_FAILURE (status)) { | 403 | if (ACPI_FAILURE(status)) { |
410 | goto cleanup; | 404 | goto cleanup; |
411 | } | 405 | } |
412 | 406 | ||
@@ -417,86 +411,93 @@ acpi_ds_exec_end_op ( | |||
417 | if (!(walk_state->op_info->flags & AML_NO_OPERAND_RESOLVE)) { | 411 | if (!(walk_state->op_info->flags & AML_NO_OPERAND_RESOLVE)) { |
418 | /* Resolve all operands */ | 412 | /* Resolve all operands */ |
419 | 413 | ||
420 | status = acpi_ex_resolve_operands (walk_state->opcode, | 414 | status = acpi_ex_resolve_operands(walk_state->opcode, |
421 | &(walk_state->operands [walk_state->num_operands -1]), | 415 | &(walk_state-> |
422 | walk_state); | 416 | operands |
423 | if (ACPI_SUCCESS (status)) { | 417 | [walk_state-> |
424 | ACPI_DUMP_OPERANDS (ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE, | 418 | num_operands - 1]), |
425 | acpi_ps_get_opcode_name (walk_state->opcode), | 419 | walk_state); |
426 | walk_state->num_operands, "after ex_resolve_operands"); | 420 | if (ACPI_SUCCESS(status)) { |
421 | ACPI_DUMP_OPERANDS(ACPI_WALK_OPERANDS, | ||
422 | ACPI_IMODE_EXECUTE, | ||
423 | acpi_ps_get_opcode_name | ||
424 | (walk_state->opcode), | ||
425 | walk_state->num_operands, | ||
426 | "after ex_resolve_operands"); | ||
427 | } | 427 | } |
428 | } | 428 | } |
429 | 429 | ||
430 | if (ACPI_SUCCESS (status)) { | 430 | if (ACPI_SUCCESS(status)) { |
431 | /* | 431 | /* |
432 | * Dispatch the request to the appropriate interpreter handler | 432 | * Dispatch the request to the appropriate interpreter handler |
433 | * routine. There is one routine per opcode "type" based upon the | 433 | * routine. There is one routine per opcode "type" based upon the |
434 | * number of opcode arguments and return type. | 434 | * number of opcode arguments and return type. |
435 | */ | 435 | */ |
436 | status = acpi_gbl_op_type_dispatch[op_type] (walk_state); | 436 | status = |
437 | } | 437 | acpi_gbl_op_type_dispatch[op_type] (walk_state); |
438 | else { | 438 | } else { |
439 | /* | 439 | /* |
440 | * Treat constructs of the form "Store(local_x,local_x)" as noops when the | 440 | * Treat constructs of the form "Store(local_x,local_x)" as noops when the |
441 | * Local is uninitialized. | 441 | * Local is uninitialized. |
442 | */ | 442 | */ |
443 | if ((status == AE_AML_UNINITIALIZED_LOCAL) && | 443 | if ((status == AE_AML_UNINITIALIZED_LOCAL) && |
444 | (walk_state->opcode == AML_STORE_OP) && | 444 | (walk_state->opcode == AML_STORE_OP) && |
445 | (walk_state->operands[0]->common.type == ACPI_TYPE_LOCAL_REFERENCE) && | 445 | (walk_state->operands[0]->common.type == |
446 | (walk_state->operands[1]->common.type == ACPI_TYPE_LOCAL_REFERENCE) && | 446 | ACPI_TYPE_LOCAL_REFERENCE) |
447 | (walk_state->operands[0]->reference.opcode == | 447 | && (walk_state->operands[1]->common.type == |
448 | walk_state->operands[1]->reference.opcode) && | 448 | ACPI_TYPE_LOCAL_REFERENCE) |
449 | (walk_state->operands[0]->reference.offset == | 449 | && (walk_state->operands[0]->reference.opcode == |
450 | walk_state->operands[1]->reference.offset)) { | 450 | walk_state->operands[1]->reference.opcode) |
451 | && (walk_state->operands[0]->reference.offset == | ||
452 | walk_state->operands[1]->reference.offset)) { | ||
451 | status = AE_OK; | 453 | status = AE_OK; |
452 | } | 454 | } else { |
453 | else { | 455 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
454 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 456 | "[%s]: Could not resolve operands, %s\n", |
455 | "[%s]: Could not resolve operands, %s\n", | 457 | acpi_ps_get_opcode_name |
456 | acpi_ps_get_opcode_name (walk_state->opcode), | 458 | (walk_state->opcode), |
457 | acpi_format_exception (status))); | 459 | acpi_format_exception |
460 | (status))); | ||
458 | } | 461 | } |
459 | } | 462 | } |
460 | 463 | ||
461 | /* Always delete the argument objects and clear the operand stack */ | 464 | /* Always delete the argument objects and clear the operand stack */ |
462 | 465 | ||
463 | acpi_ds_clear_operands (walk_state); | 466 | acpi_ds_clear_operands(walk_state); |
464 | 467 | ||
465 | /* | 468 | /* |
466 | * If a result object was returned from above, push it on the | 469 | * If a result object was returned from above, push it on the |
467 | * current result stack | 470 | * current result stack |
468 | */ | 471 | */ |
469 | if (ACPI_SUCCESS (status) && | 472 | if (ACPI_SUCCESS(status) && walk_state->result_obj) { |
470 | walk_state->result_obj) { | 473 | status = |
471 | status = acpi_ds_result_push (walk_state->result_obj, walk_state); | 474 | acpi_ds_result_push(walk_state->result_obj, |
475 | walk_state); | ||
472 | } | 476 | } |
473 | 477 | ||
474 | break; | 478 | break; |
475 | 479 | ||
476 | |||
477 | default: | 480 | default: |
478 | 481 | ||
479 | switch (op_type) { | 482 | switch (op_type) { |
480 | case AML_TYPE_CONTROL: /* Type 1 opcode, IF/ELSE/WHILE/NOOP */ | 483 | case AML_TYPE_CONTROL: /* Type 1 opcode, IF/ELSE/WHILE/NOOP */ |
481 | 484 | ||
482 | /* 1 Operand, 0 external_result, 0 internal_result */ | 485 | /* 1 Operand, 0 external_result, 0 internal_result */ |
483 | 486 | ||
484 | status = acpi_ds_exec_end_control_op (walk_state, op); | 487 | status = acpi_ds_exec_end_control_op(walk_state, op); |
485 | 488 | ||
486 | /* Make sure to properly pop the result stack */ | 489 | /* Make sure to properly pop the result stack */ |
487 | 490 | ||
488 | if (ACPI_SUCCESS (status)) { | 491 | if (ACPI_SUCCESS(status)) { |
489 | status = acpi_ds_result_stack_pop (walk_state); | 492 | status = acpi_ds_result_stack_pop(walk_state); |
490 | } | 493 | } else if (status == AE_CTRL_PENDING) { |
491 | else if (status == AE_CTRL_PENDING) { | 494 | status = acpi_ds_result_stack_pop(walk_state); |
492 | status = acpi_ds_result_stack_pop (walk_state); | 495 | if (ACPI_SUCCESS(status)) { |
493 | if (ACPI_SUCCESS (status)) { | ||
494 | status = AE_CTRL_PENDING; | 496 | status = AE_CTRL_PENDING; |
495 | } | 497 | } |
496 | } | 498 | } |
497 | break; | 499 | break; |
498 | 500 | ||
499 | |||
500 | case AML_TYPE_METHOD_CALL: | 501 | case AML_TYPE_METHOD_CALL: |
501 | 502 | ||
502 | /* | 503 | /* |
@@ -505,16 +506,22 @@ acpi_ds_exec_end_op ( | |||
505 | * a reference to it. | 506 | * a reference to it. |
506 | */ | 507 | */ |
507 | if ((op->asl.parent) && | 508 | if ((op->asl.parent) && |
508 | ((op->asl.parent->asl.aml_opcode == AML_PACKAGE_OP) || | 509 | ((op->asl.parent->asl.aml_opcode == AML_PACKAGE_OP) |
509 | (op->asl.parent->asl.aml_opcode == AML_VAR_PACKAGE_OP))) { | 510 | || (op->asl.parent->asl.aml_opcode == |
510 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, | 511 | AML_VAR_PACKAGE_OP))) { |
511 | "Method Reference in a Package, Op=%p\n", op)); | 512 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
512 | op->common.node = (struct acpi_namespace_node *) op->asl.value.arg->asl.node->object; | 513 | "Method Reference in a Package, Op=%p\n", |
513 | acpi_ut_add_reference (op->asl.value.arg->asl.node->object); | 514 | op)); |
514 | return_ACPI_STATUS (AE_OK); | 515 | op->common.node = |
516 | (struct acpi_namespace_node *)op->asl.value. | ||
517 | arg->asl.node->object; | ||
518 | acpi_ut_add_reference(op->asl.value.arg->asl. | ||
519 | node->object); | ||
520 | return_ACPI_STATUS(AE_OK); | ||
515 | } | 521 | } |
516 | 522 | ||
517 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Method invocation, Op=%p\n", op)); | 523 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
524 | "Method invocation, Op=%p\n", op)); | ||
518 | 525 | ||
519 | /* | 526 | /* |
520 | * (AML_METHODCALL) Op->Asl.Value.Arg->Asl.Node contains | 527 | * (AML_METHODCALL) Op->Asl.Value.Arg->Asl.Node contains |
@@ -531,8 +538,8 @@ acpi_ds_exec_end_op ( | |||
531 | /* | 538 | /* |
532 | * Get the method's arguments and put them on the operand stack | 539 | * Get the method's arguments and put them on the operand stack |
533 | */ | 540 | */ |
534 | status = acpi_ds_create_operands (walk_state, next_op); | 541 | status = acpi_ds_create_operands(walk_state, next_op); |
535 | if (ACPI_FAILURE (status)) { | 542 | if (ACPI_FAILURE(status)) { |
536 | break; | 543 | break; |
537 | } | 544 | } |
538 | 545 | ||
@@ -541,11 +548,11 @@ acpi_ds_exec_end_op ( | |||
541 | * we must resolve all local references here (Local variables, | 548 | * we must resolve all local references here (Local variables, |
542 | * arguments to *this* method, etc.) | 549 | * arguments to *this* method, etc.) |
543 | */ | 550 | */ |
544 | status = acpi_ds_resolve_operands (walk_state); | 551 | status = acpi_ds_resolve_operands(walk_state); |
545 | if (ACPI_FAILURE (status)) { | 552 | if (ACPI_FAILURE(status)) { |
546 | /* On error, clear all resolved operands */ | 553 | /* On error, clear all resolved operands */ |
547 | 554 | ||
548 | acpi_ds_clear_operands (walk_state); | 555 | acpi_ds_clear_operands(walk_state); |
549 | break; | 556 | break; |
550 | } | 557 | } |
551 | 558 | ||
@@ -559,27 +566,28 @@ acpi_ds_exec_end_op ( | |||
559 | * Return now; we don't want to disturb anything, | 566 | * Return now; we don't want to disturb anything, |
560 | * especially the operand count! | 567 | * especially the operand count! |
561 | */ | 568 | */ |
562 | return_ACPI_STATUS (status); | 569 | return_ACPI_STATUS(status); |
563 | |||
564 | 570 | ||
565 | case AML_TYPE_CREATE_FIELD: | 571 | case AML_TYPE_CREATE_FIELD: |
566 | 572 | ||
567 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, | 573 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
568 | "Executing create_field Buffer/Index Op=%p\n", op)); | 574 | "Executing create_field Buffer/Index Op=%p\n", |
575 | op)); | ||
569 | 576 | ||
570 | status = acpi_ds_load2_end_op (walk_state); | 577 | status = acpi_ds_load2_end_op(walk_state); |
571 | if (ACPI_FAILURE (status)) { | 578 | if (ACPI_FAILURE(status)) { |
572 | break; | 579 | break; |
573 | } | 580 | } |
574 | 581 | ||
575 | status = acpi_ds_eval_buffer_field_operands (walk_state, op); | 582 | status = |
583 | acpi_ds_eval_buffer_field_operands(walk_state, op); | ||
576 | break; | 584 | break; |
577 | 585 | ||
578 | |||
579 | case AML_TYPE_CREATE_OBJECT: | 586 | case AML_TYPE_CREATE_OBJECT: |
580 | 587 | ||
581 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, | 588 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
582 | "Executing create_object (Buffer/Package) Op=%p\n", op)); | 589 | "Executing create_object (Buffer/Package) Op=%p\n", |
590 | op)); | ||
583 | 591 | ||
584 | switch (op->common.parent->common.aml_opcode) { | 592 | switch (op->common.parent->common.aml_opcode) { |
585 | case AML_NAME_OP: | 593 | case AML_NAME_OP: |
@@ -588,13 +596,15 @@ acpi_ds_exec_end_op ( | |||
588 | * Put the Node on the object stack (Contains the ACPI Name | 596 | * Put the Node on the object stack (Contains the ACPI Name |
589 | * of this object) | 597 | * of this object) |
590 | */ | 598 | */ |
591 | walk_state->operands[0] = (void *) op->common.parent->common.node; | 599 | walk_state->operands[0] = |
600 | (void *)op->common.parent->common.node; | ||
592 | walk_state->num_operands = 1; | 601 | walk_state->num_operands = 1; |
593 | 602 | ||
594 | status = acpi_ds_create_node (walk_state, | 603 | status = acpi_ds_create_node(walk_state, |
595 | op->common.parent->common.node, | 604 | op->common.parent-> |
596 | op->common.parent); | 605 | common.node, |
597 | if (ACPI_FAILURE (status)) { | 606 | op->common.parent); |
607 | if (ACPI_FAILURE(status)) { | ||
598 | break; | 608 | break; |
599 | } | 609 | } |
600 | 610 | ||
@@ -603,20 +613,26 @@ acpi_ds_exec_end_op ( | |||
603 | 613 | ||
604 | case AML_INT_EVAL_SUBTREE_OP: | 614 | case AML_INT_EVAL_SUBTREE_OP: |
605 | 615 | ||
606 | status = acpi_ds_eval_data_object_operands (walk_state, op, | 616 | status = |
607 | acpi_ns_get_attached_object (op->common.parent->common.node)); | 617 | acpi_ds_eval_data_object_operands |
618 | (walk_state, op, | ||
619 | acpi_ns_get_attached_object(op->common. | ||
620 | parent->common. | ||
621 | node)); | ||
608 | break; | 622 | break; |
609 | 623 | ||
610 | default: | 624 | default: |
611 | 625 | ||
612 | status = acpi_ds_eval_data_object_operands (walk_state, op, NULL); | 626 | status = |
627 | acpi_ds_eval_data_object_operands | ||
628 | (walk_state, op, NULL); | ||
613 | break; | 629 | break; |
614 | } | 630 | } |
615 | 631 | ||
616 | /* Done with result state (Now that operand stack is built) */ | 632 | /* Done with result state (Now that operand stack is built) */ |
617 | 633 | ||
618 | status = acpi_ds_result_stack_pop (walk_state); | 634 | status = acpi_ds_result_stack_pop(walk_state); |
619 | if (ACPI_FAILURE (status)) { | 635 | if (ACPI_FAILURE(status)) { |
620 | goto cleanup; | 636 | goto cleanup; |
621 | } | 637 | } |
622 | 638 | ||
@@ -625,56 +641,58 @@ acpi_ds_exec_end_op ( | |||
625 | * current result stack | 641 | * current result stack |
626 | */ | 642 | */ |
627 | if (walk_state->result_obj) { | 643 | if (walk_state->result_obj) { |
628 | status = acpi_ds_result_push (walk_state->result_obj, walk_state); | 644 | status = |
645 | acpi_ds_result_push(walk_state->result_obj, | ||
646 | walk_state); | ||
629 | } | 647 | } |
630 | break; | 648 | break; |
631 | 649 | ||
632 | |||
633 | case AML_TYPE_NAMED_FIELD: | 650 | case AML_TYPE_NAMED_FIELD: |
634 | case AML_TYPE_NAMED_COMPLEX: | 651 | case AML_TYPE_NAMED_COMPLEX: |
635 | case AML_TYPE_NAMED_SIMPLE: | 652 | case AML_TYPE_NAMED_SIMPLE: |
636 | case AML_TYPE_NAMED_NO_OBJ: | 653 | case AML_TYPE_NAMED_NO_OBJ: |
637 | 654 | ||
638 | status = acpi_ds_load2_end_op (walk_state); | 655 | status = acpi_ds_load2_end_op(walk_state); |
639 | if (ACPI_FAILURE (status)) { | 656 | if (ACPI_FAILURE(status)) { |
640 | break; | 657 | break; |
641 | } | 658 | } |
642 | 659 | ||
643 | if (op->common.aml_opcode == AML_REGION_OP) { | 660 | if (op->common.aml_opcode == AML_REGION_OP) { |
644 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, | 661 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
645 | "Executing op_region Address/Length Op=%p\n", op)); | 662 | "Executing op_region Address/Length Op=%p\n", |
646 | 663 | op)); | |
647 | status = acpi_ds_eval_region_operands (walk_state, op); | 664 | |
648 | if (ACPI_FAILURE (status)) { | 665 | status = |
666 | acpi_ds_eval_region_operands(walk_state, | ||
667 | op); | ||
668 | if (ACPI_FAILURE(status)) { | ||
649 | break; | 669 | break; |
650 | } | 670 | } |
651 | 671 | ||
652 | status = acpi_ds_result_stack_pop (walk_state); | 672 | status = acpi_ds_result_stack_pop(walk_state); |
653 | } | 673 | } |
654 | 674 | ||
655 | break; | 675 | break; |
656 | 676 | ||
657 | |||
658 | case AML_TYPE_UNDEFINED: | 677 | case AML_TYPE_UNDEFINED: |
659 | 678 | ||
660 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 679 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
661 | "Undefined opcode type Op=%p\n", op)); | 680 | "Undefined opcode type Op=%p\n", op)); |
662 | return_ACPI_STATUS (AE_NOT_IMPLEMENTED); | 681 | return_ACPI_STATUS(AE_NOT_IMPLEMENTED); |
663 | |||
664 | 682 | ||
665 | case AML_TYPE_BOGUS: | 683 | case AML_TYPE_BOGUS: |
666 | 684 | ||
667 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, | 685 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
668 | "Internal opcode=%X type Op=%p\n", | 686 | "Internal opcode=%X type Op=%p\n", |
669 | walk_state->opcode, op)); | 687 | walk_state->opcode, op)); |
670 | break; | 688 | break; |
671 | 689 | ||
672 | |||
673 | default: | 690 | default: |
674 | 691 | ||
675 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 692 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
676 | "Unimplemented opcode, class=%X type=%X Opcode=%X Op=%p\n", | 693 | "Unimplemented opcode, class=%X type=%X Opcode=%X Op=%p\n", |
677 | op_class, op_type, op->common.aml_opcode, op)); | 694 | op_class, op_type, |
695 | op->common.aml_opcode, op)); | ||
678 | 696 | ||
679 | status = AE_NOT_IMPLEMENTED; | 697 | status = AE_NOT_IMPLEMENTED; |
680 | break; | 698 | break; |
@@ -685,55 +703,58 @@ acpi_ds_exec_end_op ( | |||
685 | * ACPI 2.0 support for 64-bit integers: Truncate numeric | 703 | * ACPI 2.0 support for 64-bit integers: Truncate numeric |
686 | * result value if we are executing from a 32-bit ACPI table | 704 | * result value if we are executing from a 32-bit ACPI table |
687 | */ | 705 | */ |
688 | acpi_ex_truncate_for32bit_table (walk_state->result_obj); | 706 | acpi_ex_truncate_for32bit_table(walk_state->result_obj); |
689 | 707 | ||
690 | /* | 708 | /* |
691 | * Check if we just completed the evaluation of a | 709 | * Check if we just completed the evaluation of a |
692 | * conditional predicate | 710 | * conditional predicate |
693 | */ | 711 | */ |
694 | 712 | ||
695 | if ((ACPI_SUCCESS (status)) && | 713 | if ((ACPI_SUCCESS(status)) && |
696 | (walk_state->control_state) && | 714 | (walk_state->control_state) && |
697 | (walk_state->control_state->common.state == | 715 | (walk_state->control_state->common.state == |
698 | ACPI_CONTROL_PREDICATE_EXECUTING) && | 716 | ACPI_CONTROL_PREDICATE_EXECUTING) && |
699 | (walk_state->control_state->control.predicate_op == op)) { | 717 | (walk_state->control_state->control.predicate_op == op)) { |
700 | status = acpi_ds_get_predicate_value (walk_state, walk_state->result_obj); | 718 | status = |
719 | acpi_ds_get_predicate_value(walk_state, | ||
720 | walk_state->result_obj); | ||
701 | walk_state->result_obj = NULL; | 721 | walk_state->result_obj = NULL; |
702 | } | 722 | } |
703 | 723 | ||
704 | 724 | cleanup: | |
705 | cleanup: | ||
706 | 725 | ||
707 | /* Invoke exception handler on error */ | 726 | /* Invoke exception handler on error */ |
708 | 727 | ||
709 | if (ACPI_FAILURE (status) && | 728 | if (ACPI_FAILURE(status) && |
710 | acpi_gbl_exception_handler && | 729 | acpi_gbl_exception_handler && !(status & AE_CODE_CONTROL)) { |
711 | !(status & AE_CODE_CONTROL)) { | 730 | acpi_ex_exit_interpreter(); |
712 | acpi_ex_exit_interpreter (); | 731 | status = acpi_gbl_exception_handler(status, |
713 | status = acpi_gbl_exception_handler (status, | 732 | walk_state->method_node-> |
714 | walk_state->method_node->name.integer, walk_state->opcode, | 733 | name.integer, |
715 | walk_state->aml_offset, NULL); | 734 | walk_state->opcode, |
716 | (void) acpi_ex_enter_interpreter (); | 735 | walk_state->aml_offset, |
736 | NULL); | ||
737 | (void)acpi_ex_enter_interpreter(); | ||
717 | } | 738 | } |
718 | 739 | ||
719 | if (walk_state->result_obj) { | 740 | if (walk_state->result_obj) { |
720 | /* Break to debugger to display result */ | 741 | /* Break to debugger to display result */ |
721 | 742 | ||
722 | ACPI_DEBUGGER_EXEC (acpi_db_display_result_object (walk_state->result_obj, | 743 | ACPI_DEBUGGER_EXEC(acpi_db_display_result_object |
723 | walk_state)); | 744 | (walk_state->result_obj, walk_state)); |
724 | 745 | ||
725 | /* | 746 | /* |
726 | * Delete the result op if and only if: | 747 | * Delete the result op if and only if: |
727 | * Parent will not use the result -- such as any | 748 | * Parent will not use the result -- such as any |
728 | * non-nested type2 op in a method (parent will be method) | 749 | * non-nested type2 op in a method (parent will be method) |
729 | */ | 750 | */ |
730 | acpi_ds_delete_result_if_not_used (op, walk_state->result_obj, walk_state); | 751 | acpi_ds_delete_result_if_not_used(op, walk_state->result_obj, |
752 | walk_state); | ||
731 | } | 753 | } |
732 | |||
733 | #ifdef _UNDER_DEVELOPMENT | 754 | #ifdef _UNDER_DEVELOPMENT |
734 | 755 | ||
735 | if (walk_state->parser_state.aml == walk_state->parser_state.aml_end) { | 756 | if (walk_state->parser_state.aml == walk_state->parser_state.aml_end) { |
736 | acpi_db_method_end (walk_state); | 757 | acpi_db_method_end(walk_state); |
737 | } | 758 | } |
738 | #endif | 759 | #endif |
739 | 760 | ||
@@ -745,12 +766,10 @@ cleanup: | |||
745 | 766 | ||
746 | /* On error, display method locals/args */ | 767 | /* On error, display method locals/args */ |
747 | 768 | ||
748 | if (ACPI_FAILURE (status)) { | 769 | if (ACPI_FAILURE(status)) { |
749 | acpi_dm_dump_method_info (status, walk_state, op); | 770 | acpi_dm_dump_method_info(status, walk_state, op); |
750 | } | 771 | } |
751 | #endif | 772 | #endif |
752 | 773 | ||
753 | return_ACPI_STATUS (status); | 774 | return_ACPI_STATUS(status); |
754 | } | 775 | } |
755 | |||
756 | |||
diff --git a/drivers/acpi/dispatcher/dswload.c b/drivers/acpi/dispatcher/dswload.c index 9100c0bda470..362bbcfc1718 100644 --- a/drivers/acpi/dispatcher/dswload.c +++ b/drivers/acpi/dispatcher/dswload.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> |
@@ -55,8 +54,7 @@ | |||
55 | #endif | 54 | #endif |
56 | 55 | ||
57 | #define _COMPONENT ACPI_DISPATCHER | 56 | #define _COMPONENT ACPI_DISPATCHER |
58 | ACPI_MODULE_NAME ("dswload") | 57 | ACPI_MODULE_NAME("dswload") |
59 | |||
60 | 58 | ||
61 | /******************************************************************************* | 59 | /******************************************************************************* |
62 | * | 60 | * |
@@ -70,32 +68,29 @@ | |||
70 | * DESCRIPTION: Init walk state callbacks | 68 | * DESCRIPTION: Init walk state callbacks |
71 | * | 69 | * |
72 | ******************************************************************************/ | 70 | ******************************************************************************/ |
73 | |||
74 | acpi_status | 71 | acpi_status |
75 | acpi_ds_init_callbacks ( | 72 | acpi_ds_init_callbacks(struct acpi_walk_state *walk_state, u32 pass_number) |
76 | struct acpi_walk_state *walk_state, | ||
77 | u32 pass_number) | ||
78 | { | 73 | { |
79 | 74 | ||
80 | switch (pass_number) { | 75 | switch (pass_number) { |
81 | case 1: | 76 | case 1: |
82 | walk_state->parse_flags = ACPI_PARSE_LOAD_PASS1 | | 77 | walk_state->parse_flags = ACPI_PARSE_LOAD_PASS1 | |
83 | ACPI_PARSE_DELETE_TREE; | 78 | ACPI_PARSE_DELETE_TREE; |
84 | walk_state->descending_callback = acpi_ds_load1_begin_op; | 79 | walk_state->descending_callback = acpi_ds_load1_begin_op; |
85 | walk_state->ascending_callback = acpi_ds_load1_end_op; | 80 | walk_state->ascending_callback = acpi_ds_load1_end_op; |
86 | break; | 81 | break; |
87 | 82 | ||
88 | case 2: | 83 | case 2: |
89 | walk_state->parse_flags = ACPI_PARSE_LOAD_PASS1 | | 84 | walk_state->parse_flags = ACPI_PARSE_LOAD_PASS1 | |
90 | ACPI_PARSE_DELETE_TREE; | 85 | ACPI_PARSE_DELETE_TREE; |
91 | walk_state->descending_callback = acpi_ds_load2_begin_op; | 86 | walk_state->descending_callback = acpi_ds_load2_begin_op; |
92 | walk_state->ascending_callback = acpi_ds_load2_end_op; | 87 | walk_state->ascending_callback = acpi_ds_load2_end_op; |
93 | break; | 88 | break; |
94 | 89 | ||
95 | case 3: | 90 | case 3: |
96 | #ifndef ACPI_NO_METHOD_EXECUTION | 91 | #ifndef ACPI_NO_METHOD_EXECUTION |
97 | walk_state->parse_flags |= ACPI_PARSE_EXECUTE | | 92 | walk_state->parse_flags |= ACPI_PARSE_EXECUTE | |
98 | ACPI_PARSE_DELETE_TREE; | 93 | ACPI_PARSE_DELETE_TREE; |
99 | walk_state->descending_callback = acpi_ds_exec_begin_op; | 94 | walk_state->descending_callback = acpi_ds_exec_begin_op; |
100 | walk_state->ascending_callback = acpi_ds_exec_end_op; | 95 | walk_state->ascending_callback = acpi_ds_exec_end_op; |
101 | #endif | 96 | #endif |
@@ -108,7 +103,6 @@ acpi_ds_init_callbacks ( | |||
108 | return (AE_OK); | 103 | return (AE_OK); |
109 | } | 104 | } |
110 | 105 | ||
111 | |||
112 | /******************************************************************************* | 106 | /******************************************************************************* |
113 | * | 107 | * |
114 | * FUNCTION: acpi_ds_load1_begin_op | 108 | * FUNCTION: acpi_ds_load1_begin_op |
@@ -123,23 +117,21 @@ acpi_ds_init_callbacks ( | |||
123 | ******************************************************************************/ | 117 | ******************************************************************************/ |
124 | 118 | ||
125 | acpi_status | 119 | acpi_status |
126 | acpi_ds_load1_begin_op ( | 120 | acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, |
127 | struct acpi_walk_state *walk_state, | 121 | union acpi_parse_object ** out_op) |
128 | union acpi_parse_object **out_op) | ||
129 | { | 122 | { |
130 | union acpi_parse_object *op; | 123 | union acpi_parse_object *op; |
131 | struct acpi_namespace_node *node; | 124 | struct acpi_namespace_node *node; |
132 | acpi_status status; | 125 | acpi_status status; |
133 | acpi_object_type object_type; | 126 | acpi_object_type object_type; |
134 | char *path; | 127 | char *path; |
135 | u32 flags; | 128 | u32 flags; |
136 | |||
137 | |||
138 | ACPI_FUNCTION_NAME ("ds_load1_begin_op"); | ||
139 | 129 | ||
130 | ACPI_FUNCTION_NAME("ds_load1_begin_op"); | ||
140 | 131 | ||
141 | op = walk_state->op; | 132 | op = walk_state->op; |
142 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, walk_state)); | 133 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, |
134 | walk_state)); | ||
143 | 135 | ||
144 | /* We are only interested in opcodes that have an associated name */ | 136 | /* We are only interested in opcodes that have an associated name */ |
145 | 137 | ||
@@ -157,14 +149,15 @@ acpi_ds_load1_begin_op ( | |||
157 | } | 149 | } |
158 | } | 150 | } |
159 | 151 | ||
160 | path = acpi_ps_get_next_namestring (&walk_state->parser_state); | 152 | path = acpi_ps_get_next_namestring(&walk_state->parser_state); |
161 | 153 | ||
162 | /* Map the raw opcode into an internal object type */ | 154 | /* Map the raw opcode into an internal object type */ |
163 | 155 | ||
164 | object_type = walk_state->op_info->object_type; | 156 | object_type = walk_state->op_info->object_type; |
165 | 157 | ||
166 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, | 158 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
167 | "State=%p Op=%p [%s]\n", walk_state, op, acpi_ut_get_type_name (object_type))); | 159 | "State=%p Op=%p [%s]\n", walk_state, op, |
160 | acpi_ut_get_type_name(object_type))); | ||
168 | 161 | ||
169 | switch (walk_state->opcode) { | 162 | switch (walk_state->opcode) { |
170 | case AML_SCOPE_OP: | 163 | case AML_SCOPE_OP: |
@@ -174,8 +167,10 @@ acpi_ds_load1_begin_op ( | |||
174 | * that we can actually open the scope to enter new names underneath it. | 167 | * that we can actually open the scope to enter new names underneath it. |
175 | * Allow search-to-root for single namesegs. | 168 | * Allow search-to-root for single namesegs. |
176 | */ | 169 | */ |
177 | status = acpi_ns_lookup (walk_state->scope_info, path, object_type, | 170 | status = |
178 | ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, walk_state, &(node)); | 171 | acpi_ns_lookup(walk_state->scope_info, path, object_type, |
172 | ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, | ||
173 | walk_state, &(node)); | ||
179 | #ifdef ACPI_ASL_COMPILER | 174 | #ifdef ACPI_ASL_COMPILER |
180 | if (status == AE_NOT_FOUND) { | 175 | if (status == AE_NOT_FOUND) { |
181 | /* | 176 | /* |
@@ -183,14 +178,16 @@ acpi_ds_load1_begin_op ( | |||
183 | * Target of Scope() not found. Generate an External for it, and | 178 | * Target of Scope() not found. Generate an External for it, and |
184 | * insert the name into the namespace. | 179 | * insert the name into the namespace. |
185 | */ | 180 | */ |
186 | acpi_dm_add_to_external_list (path); | 181 | acpi_dm_add_to_external_list(path); |
187 | status = acpi_ns_lookup (walk_state->scope_info, path, object_type, | 182 | status = |
188 | ACPI_IMODE_LOAD_PASS1, ACPI_NS_SEARCH_PARENT, | 183 | acpi_ns_lookup(walk_state->scope_info, path, |
189 | walk_state, &(node)); | 184 | object_type, ACPI_IMODE_LOAD_PASS1, |
185 | ACPI_NS_SEARCH_PARENT, walk_state, | ||
186 | &(node)); | ||
190 | } | 187 | } |
191 | #endif | 188 | #endif |
192 | if (ACPI_FAILURE (status)) { | 189 | if (ACPI_FAILURE(status)) { |
193 | ACPI_REPORT_NSERROR (path, status); | 190 | ACPI_REPORT_NSERROR(path, status); |
194 | return (status); | 191 | return (status); |
195 | } | 192 | } |
196 | 193 | ||
@@ -199,7 +196,7 @@ acpi_ds_load1_begin_op ( | |||
199 | * one of the opcodes that actually opens a scope | 196 | * one of the opcodes that actually opens a scope |
200 | */ | 197 | */ |
201 | switch (node->type) { | 198 | switch (node->type) { |
202 | case ACPI_TYPE_LOCAL_SCOPE: /* Scope */ | 199 | case ACPI_TYPE_LOCAL_SCOPE: /* Scope */ |
203 | case ACPI_TYPE_DEVICE: | 200 | case ACPI_TYPE_DEVICE: |
204 | case ACPI_TYPE_POWER: | 201 | case ACPI_TYPE_POWER: |
205 | case ACPI_TYPE_PROCESSOR: | 202 | case ACPI_TYPE_PROCESSOR: |
@@ -223,9 +220,10 @@ acpi_ds_load1_begin_op ( | |||
223 | * a warning | 220 | * a warning |
224 | */ | 221 | */ |
225 | 222 | ||
226 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, | 223 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
227 | "Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n", | 224 | "Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n", |
228 | path, acpi_ut_get_type_name (node->type))); | 225 | path, |
226 | acpi_ut_get_type_name(node->type))); | ||
229 | 227 | ||
230 | node->type = ACPI_TYPE_ANY; | 228 | node->type = ACPI_TYPE_ANY; |
231 | walk_state->scope_info->common.value = ACPI_TYPE_ANY; | 229 | walk_state->scope_info->common.value = ACPI_TYPE_ANY; |
@@ -235,15 +233,12 @@ acpi_ds_load1_begin_op ( | |||
235 | 233 | ||
236 | /* All other types are an error */ | 234 | /* All other types are an error */ |
237 | 235 | ||
238 | ACPI_REPORT_ERROR (( | 236 | ACPI_REPORT_ERROR(("Invalid type (%s) for target of Scope operator [%4.4s] (Cannot override)\n", acpi_ut_get_type_name(node->type), path)); |
239 | "Invalid type (%s) for target of Scope operator [%4.4s] (Cannot override)\n", | ||
240 | acpi_ut_get_type_name (node->type), path)); | ||
241 | 237 | ||
242 | return (AE_AML_OPERAND_TYPE); | 238 | return (AE_AML_OPERAND_TYPE); |
243 | } | 239 | } |
244 | break; | 240 | break; |
245 | 241 | ||
246 | |||
247 | default: | 242 | default: |
248 | 243 | ||
249 | /* | 244 | /* |
@@ -272,15 +267,15 @@ acpi_ds_load1_begin_op ( | |||
272 | 267 | ||
273 | flags = ACPI_NS_NO_UPSEARCH; | 268 | flags = ACPI_NS_NO_UPSEARCH; |
274 | if ((walk_state->opcode != AML_SCOPE_OP) && | 269 | if ((walk_state->opcode != AML_SCOPE_OP) && |
275 | (!(walk_state->parse_flags & ACPI_PARSE_DEFERRED_OP))) { | 270 | (!(walk_state->parse_flags & ACPI_PARSE_DEFERRED_OP))) { |
276 | flags |= ACPI_NS_ERROR_IF_FOUND; | 271 | flags |= ACPI_NS_ERROR_IF_FOUND; |
277 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[%s] Cannot already exist\n", | 272 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
278 | acpi_ut_get_type_name (object_type))); | 273 | "[%s] Cannot already exist\n", |
279 | } | 274 | acpi_ut_get_type_name(object_type))); |
280 | else { | 275 | } else { |
281 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, | 276 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
282 | "[%s] Both Find or Create allowed\n", | 277 | "[%s] Both Find or Create allowed\n", |
283 | acpi_ut_get_type_name (object_type))); | 278 | acpi_ut_get_type_name(object_type))); |
284 | } | 279 | } |
285 | 280 | ||
286 | /* | 281 | /* |
@@ -289,22 +284,23 @@ acpi_ds_load1_begin_op ( | |||
289 | * involve arguments to the opcode must be created as we go back up the | 284 | * involve arguments to the opcode must be created as we go back up the |
290 | * parse tree later. | 285 | * parse tree later. |
291 | */ | 286 | */ |
292 | status = acpi_ns_lookup (walk_state->scope_info, path, object_type, | 287 | status = |
293 | ACPI_IMODE_LOAD_PASS1, flags, walk_state, &(node)); | 288 | acpi_ns_lookup(walk_state->scope_info, path, object_type, |
294 | if (ACPI_FAILURE (status)) { | 289 | ACPI_IMODE_LOAD_PASS1, flags, walk_state, |
295 | ACPI_REPORT_NSERROR (path, status); | 290 | &(node)); |
291 | if (ACPI_FAILURE(status)) { | ||
292 | ACPI_REPORT_NSERROR(path, status); | ||
296 | return (status); | 293 | return (status); |
297 | } | 294 | } |
298 | break; | 295 | break; |
299 | } | 296 | } |
300 | 297 | ||
301 | |||
302 | /* Common exit */ | 298 | /* Common exit */ |
303 | 299 | ||
304 | if (!op) { | 300 | if (!op) { |
305 | /* Create a new op */ | 301 | /* Create a new op */ |
306 | 302 | ||
307 | op = acpi_ps_alloc_op (walk_state->opcode); | 303 | op = acpi_ps_alloc_op(walk_state->opcode); |
308 | if (!op) { | 304 | if (!op) { |
309 | return (AE_NO_MEMORY); | 305 | return (AE_NO_MEMORY); |
310 | } | 306 | } |
@@ -318,19 +314,18 @@ acpi_ds_load1_begin_op ( | |||
318 | op->named.path = (u8 *) path; | 314 | op->named.path = (u8 *) path; |
319 | #endif | 315 | #endif |
320 | 316 | ||
321 | |||
322 | /* | 317 | /* |
323 | * Put the Node in the "op" object that the parser uses, so we | 318 | * Put the Node in the "op" object that the parser uses, so we |
324 | * can get it again quickly when this scope is closed | 319 | * can get it again quickly when this scope is closed |
325 | */ | 320 | */ |
326 | op->common.node = node; | 321 | op->common.node = node; |
327 | acpi_ps_append_arg (acpi_ps_get_parent_scope (&walk_state->parser_state), op); | 322 | acpi_ps_append_arg(acpi_ps_get_parent_scope(&walk_state->parser_state), |
323 | op); | ||
328 | 324 | ||
329 | *out_op = op; | 325 | *out_op = op; |
330 | return (status); | 326 | return (status); |
331 | } | 327 | } |
332 | 328 | ||
333 | |||
334 | /******************************************************************************* | 329 | /******************************************************************************* |
335 | * | 330 | * |
336 | * FUNCTION: acpi_ds_load1_end_op | 331 | * FUNCTION: acpi_ds_load1_end_op |
@@ -344,20 +339,17 @@ acpi_ds_load1_begin_op ( | |||
344 | * | 339 | * |
345 | ******************************************************************************/ | 340 | ******************************************************************************/ |
346 | 341 | ||
347 | acpi_status | 342 | acpi_status acpi_ds_load1_end_op(struct acpi_walk_state * walk_state) |
348 | acpi_ds_load1_end_op ( | ||
349 | struct acpi_walk_state *walk_state) | ||
350 | { | 343 | { |
351 | union acpi_parse_object *op; | 344 | union acpi_parse_object *op; |
352 | acpi_object_type object_type; | 345 | acpi_object_type object_type; |
353 | acpi_status status = AE_OK; | 346 | acpi_status status = AE_OK; |
354 | |||
355 | |||
356 | ACPI_FUNCTION_NAME ("ds_load1_end_op"); | ||
357 | 347 | ||
348 | ACPI_FUNCTION_NAME("ds_load1_end_op"); | ||
358 | 349 | ||
359 | op = walk_state->op; | 350 | op = walk_state->op; |
360 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, walk_state)); | 351 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, |
352 | walk_state)); | ||
361 | 353 | ||
362 | /* We are only interested in opcodes that have an associated name */ | 354 | /* We are only interested in opcodes that have an associated name */ |
363 | 355 | ||
@@ -371,21 +363,20 @@ acpi_ds_load1_end_op ( | |||
371 | 363 | ||
372 | #ifndef ACPI_NO_METHOD_EXECUTION | 364 | #ifndef ACPI_NO_METHOD_EXECUTION |
373 | if (walk_state->op_info->flags & AML_FIELD) { | 365 | if (walk_state->op_info->flags & AML_FIELD) { |
374 | if (walk_state->opcode == AML_FIELD_OP || | 366 | if (walk_state->opcode == AML_FIELD_OP || |
375 | walk_state->opcode == AML_BANK_FIELD_OP || | 367 | walk_state->opcode == AML_BANK_FIELD_OP || |
376 | walk_state->opcode == AML_INDEX_FIELD_OP) { | 368 | walk_state->opcode == AML_INDEX_FIELD_OP) { |
377 | status = acpi_ds_init_field_objects (op, walk_state); | 369 | status = acpi_ds_init_field_objects(op, walk_state); |
378 | } | 370 | } |
379 | return (status); | 371 | return (status); |
380 | } | 372 | } |
381 | 373 | ||
382 | |||
383 | if (op->common.aml_opcode == AML_REGION_OP) { | 374 | if (op->common.aml_opcode == AML_REGION_OP) { |
384 | status = acpi_ex_create_region (op->named.data, op->named.length, | 375 | status = acpi_ex_create_region(op->named.data, op->named.length, |
385 | (acpi_adr_space_type) | 376 | (acpi_adr_space_type) |
386 | ((op->common.value.arg)->common.value.integer), | 377 | ((op->common.value.arg)->common. |
387 | walk_state); | 378 | value.integer), walk_state); |
388 | if (ACPI_FAILURE (status)) { | 379 | if (ACPI_FAILURE(status)) { |
389 | return (status); | 380 | return (status); |
390 | } | 381 | } |
391 | } | 382 | } |
@@ -395,8 +386,11 @@ acpi_ds_load1_end_op ( | |||
395 | /* For Name opcode, get the object type from the argument */ | 386 | /* For Name opcode, get the object type from the argument */ |
396 | 387 | ||
397 | if (op->common.value.arg) { | 388 | if (op->common.value.arg) { |
398 | object_type = (acpi_ps_get_opcode_info ( | 389 | object_type = (acpi_ps_get_opcode_info((op->common. |
399 | (op->common.value.arg)->common.aml_opcode))->object_type; | 390 | value.arg)-> |
391 | common. | ||
392 | aml_opcode))-> | ||
393 | object_type; | ||
400 | op->common.node->type = (u8) object_type; | 394 | op->common.node->type = (u8) object_type; |
401 | } | 395 | } |
402 | } | 396 | } |
@@ -410,23 +404,26 @@ acpi_ds_load1_end_op ( | |||
410 | * of invocations of the method (need to know the number of | 404 | * of invocations of the method (need to know the number of |
411 | * arguments.) | 405 | * arguments.) |
412 | */ | 406 | */ |
413 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, | 407 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
414 | "LOADING-Method: State=%p Op=%p named_obj=%p\n", | 408 | "LOADING-Method: State=%p Op=%p named_obj=%p\n", |
415 | walk_state, op, op->named.node)); | 409 | walk_state, op, op->named.node)); |
416 | 410 | ||
417 | if (!acpi_ns_get_attached_object (op->named.node)) { | 411 | if (!acpi_ns_get_attached_object(op->named.node)) { |
418 | walk_state->operands[0] = (void *) op->named.node; | 412 | walk_state->operands[0] = (void *)op->named.node; |
419 | walk_state->num_operands = 1; | 413 | walk_state->num_operands = 1; |
420 | 414 | ||
421 | status = acpi_ds_create_operands (walk_state, op->common.value.arg); | 415 | status = |
422 | if (ACPI_SUCCESS (status)) { | 416 | acpi_ds_create_operands(walk_state, |
423 | status = acpi_ex_create_method (op->named.data, | 417 | op->common.value.arg); |
424 | op->named.length, walk_state); | 418 | if (ACPI_SUCCESS(status)) { |
419 | status = acpi_ex_create_method(op->named.data, | ||
420 | op->named.length, | ||
421 | walk_state); | ||
425 | } | 422 | } |
426 | walk_state->operands[0] = NULL; | 423 | walk_state->operands[0] = NULL; |
427 | walk_state->num_operands = 0; | 424 | walk_state->num_operands = 0; |
428 | 425 | ||
429 | if (ACPI_FAILURE (status)) { | 426 | if (ACPI_FAILURE(status)) { |
430 | return (status); | 427 | return (status); |
431 | } | 428 | } |
432 | } | 429 | } |
@@ -434,17 +431,17 @@ acpi_ds_load1_end_op ( | |||
434 | 431 | ||
435 | /* Pop the scope stack */ | 432 | /* Pop the scope stack */ |
436 | 433 | ||
437 | if (acpi_ns_opens_scope (object_type)) { | 434 | if (acpi_ns_opens_scope(object_type)) { |
438 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s): Popping scope for Op %p\n", | 435 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
439 | acpi_ut_get_type_name (object_type), op)); | 436 | "(%s): Popping scope for Op %p\n", |
437 | acpi_ut_get_type_name(object_type), op)); | ||
440 | 438 | ||
441 | status = acpi_ds_scope_stack_pop (walk_state); | 439 | status = acpi_ds_scope_stack_pop(walk_state); |
442 | } | 440 | } |
443 | 441 | ||
444 | return (status); | 442 | return (status); |
445 | } | 443 | } |
446 | 444 | ||
447 | |||
448 | /******************************************************************************* | 445 | /******************************************************************************* |
449 | * | 446 | * |
450 | * FUNCTION: acpi_ds_load2_begin_op | 447 | * FUNCTION: acpi_ds_load2_begin_op |
@@ -459,50 +456,50 @@ acpi_ds_load1_end_op ( | |||
459 | ******************************************************************************/ | 456 | ******************************************************************************/ |
460 | 457 | ||
461 | acpi_status | 458 | acpi_status |
462 | acpi_ds_load2_begin_op ( | 459 | acpi_ds_load2_begin_op(struct acpi_walk_state * walk_state, |
463 | struct acpi_walk_state *walk_state, | 460 | union acpi_parse_object ** out_op) |
464 | union acpi_parse_object **out_op) | ||
465 | { | 461 | { |
466 | union acpi_parse_object *op; | 462 | union acpi_parse_object *op; |
467 | struct acpi_namespace_node *node; | 463 | struct acpi_namespace_node *node; |
468 | acpi_status status; | 464 | acpi_status status; |
469 | acpi_object_type object_type; | 465 | acpi_object_type object_type; |
470 | char *buffer_ptr; | 466 | char *buffer_ptr; |
471 | |||
472 | |||
473 | ACPI_FUNCTION_TRACE ("ds_load2_begin_op"); | ||
474 | 467 | ||
468 | ACPI_FUNCTION_TRACE("ds_load2_begin_op"); | ||
475 | 469 | ||
476 | op = walk_state->op; | 470 | op = walk_state->op; |
477 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, walk_state)); | 471 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, |
472 | walk_state)); | ||
478 | 473 | ||
479 | if (op) { | 474 | if (op) { |
480 | if ((walk_state->control_state) && | 475 | if ((walk_state->control_state) && |
481 | (walk_state->control_state->common.state == | 476 | (walk_state->control_state->common.state == |
482 | ACPI_CONTROL_CONDITIONAL_EXECUTING)) { | 477 | ACPI_CONTROL_CONDITIONAL_EXECUTING)) { |
483 | /* We are executing a while loop outside of a method */ | 478 | /* We are executing a while loop outside of a method */ |
484 | 479 | ||
485 | status = acpi_ds_exec_begin_op (walk_state, out_op); | 480 | status = acpi_ds_exec_begin_op(walk_state, out_op); |
486 | return_ACPI_STATUS (status); | 481 | return_ACPI_STATUS(status); |
487 | } | 482 | } |
488 | 483 | ||
489 | /* We only care about Namespace opcodes here */ | 484 | /* We only care about Namespace opcodes here */ |
490 | 485 | ||
491 | if ((!(walk_state->op_info->flags & AML_NSOPCODE) && | 486 | if ((!(walk_state->op_info->flags & AML_NSOPCODE) && |
492 | (walk_state->opcode != AML_INT_NAMEPATH_OP)) || | 487 | (walk_state->opcode != AML_INT_NAMEPATH_OP)) || |
493 | (!(walk_state->op_info->flags & AML_NAMED))) { | 488 | (!(walk_state->op_info->flags & AML_NAMED))) { |
494 | if ((walk_state->op_info->class == AML_CLASS_EXECUTE) || | 489 | if ((walk_state->op_info->class == AML_CLASS_EXECUTE) || |
495 | (walk_state->op_info->class == AML_CLASS_CONTROL)) { | 490 | (walk_state->op_info->class == AML_CLASS_CONTROL)) { |
496 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, | 491 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
497 | "Begin/EXEC: %s (fl %8.8X)\n", walk_state->op_info->name, | 492 | "Begin/EXEC: %s (fl %8.8X)\n", |
498 | walk_state->op_info->flags)); | 493 | walk_state->op_info->name, |
494 | walk_state->op_info->flags)); | ||
499 | 495 | ||
500 | /* Executing a type1 or type2 opcode outside of a method */ | 496 | /* Executing a type1 or type2 opcode outside of a method */ |
501 | 497 | ||
502 | status = acpi_ds_exec_begin_op (walk_state, out_op); | 498 | status = |
503 | return_ACPI_STATUS (status); | 499 | acpi_ds_exec_begin_op(walk_state, out_op); |
500 | return_ACPI_STATUS(status); | ||
504 | } | 501 | } |
505 | return_ACPI_STATUS (AE_OK); | 502 | return_ACPI_STATUS(AE_OK); |
506 | } | 503 | } |
507 | 504 | ||
508 | /* Get the name we are going to enter or lookup in the namespace */ | 505 | /* Get the name we are going to enter or lookup in the namespace */ |
@@ -514,28 +511,27 @@ acpi_ds_load2_begin_op ( | |||
514 | if (!buffer_ptr) { | 511 | if (!buffer_ptr) { |
515 | /* No name, just exit */ | 512 | /* No name, just exit */ |
516 | 513 | ||
517 | return_ACPI_STATUS (AE_OK); | 514 | return_ACPI_STATUS(AE_OK); |
518 | } | 515 | } |
519 | } | 516 | } else { |
520 | else { | ||
521 | /* Get name from the op */ | 517 | /* Get name from the op */ |
522 | 518 | ||
523 | buffer_ptr = (char *) &op->named.name; | 519 | buffer_ptr = (char *)&op->named.name; |
524 | } | 520 | } |
525 | } | 521 | } else { |
526 | else { | ||
527 | /* Get the namestring from the raw AML */ | 522 | /* Get the namestring from the raw AML */ |
528 | 523 | ||
529 | buffer_ptr = acpi_ps_get_next_namestring (&walk_state->parser_state); | 524 | buffer_ptr = |
525 | acpi_ps_get_next_namestring(&walk_state->parser_state); | ||
530 | } | 526 | } |
531 | 527 | ||
532 | /* Map the opcode into an internal object type */ | 528 | /* Map the opcode into an internal object type */ |
533 | 529 | ||
534 | object_type = walk_state->op_info->object_type; | 530 | object_type = walk_state->op_info->object_type; |
535 | 531 | ||
536 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, | 532 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
537 | "State=%p Op=%p Type=%X\n", walk_state, op, object_type)); | 533 | "State=%p Op=%p Type=%X\n", walk_state, op, |
538 | 534 | object_type)); | |
539 | 535 | ||
540 | switch (walk_state->opcode) { | 536 | switch (walk_state->opcode) { |
541 | case AML_FIELD_OP: | 537 | case AML_FIELD_OP: |
@@ -553,9 +549,10 @@ acpi_ds_load2_begin_op ( | |||
553 | * Don't enter the name into the namespace, but look it up | 549 | * Don't enter the name into the namespace, but look it up |
554 | * for use later. | 550 | * for use later. |
555 | */ | 551 | */ |
556 | status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, object_type, | 552 | status = |
557 | ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, | 553 | acpi_ns_lookup(walk_state->scope_info, buffer_ptr, |
558 | walk_state, &(node)); | 554 | object_type, ACPI_IMODE_EXECUTE, |
555 | ACPI_NS_SEARCH_PARENT, walk_state, &(node)); | ||
559 | break; | 556 | break; |
560 | 557 | ||
561 | case AML_SCOPE_OP: | 558 | case AML_SCOPE_OP: |
@@ -565,28 +562,28 @@ acpi_ds_load2_begin_op ( | |||
565 | * Don't enter the name into the namespace, but look it up | 562 | * Don't enter the name into the namespace, but look it up |
566 | * for use later. | 563 | * for use later. |
567 | */ | 564 | */ |
568 | status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, object_type, | 565 | status = |
569 | ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, | 566 | acpi_ns_lookup(walk_state->scope_info, buffer_ptr, |
570 | walk_state, &(node)); | 567 | object_type, ACPI_IMODE_EXECUTE, |
571 | if (ACPI_FAILURE (status)) { | 568 | ACPI_NS_SEARCH_PARENT, walk_state, &(node)); |
569 | if (ACPI_FAILURE(status)) { | ||
572 | #ifdef ACPI_ASL_COMPILER | 570 | #ifdef ACPI_ASL_COMPILER |
573 | if (status == AE_NOT_FOUND) { | 571 | if (status == AE_NOT_FOUND) { |
574 | status = AE_OK; | 572 | status = AE_OK; |
575 | } | 573 | } else { |
576 | else { | 574 | ACPI_REPORT_NSERROR(buffer_ptr, status); |
577 | ACPI_REPORT_NSERROR (buffer_ptr, status); | ||
578 | } | 575 | } |
579 | #else | 576 | #else |
580 | ACPI_REPORT_NSERROR (buffer_ptr, status); | 577 | ACPI_REPORT_NSERROR(buffer_ptr, status); |
581 | #endif | 578 | #endif |
582 | return_ACPI_STATUS (status); | 579 | return_ACPI_STATUS(status); |
583 | } | 580 | } |
584 | /* | 581 | /* |
585 | * We must check to make sure that the target is | 582 | * We must check to make sure that the target is |
586 | * one of the opcodes that actually opens a scope | 583 | * one of the opcodes that actually opens a scope |
587 | */ | 584 | */ |
588 | switch (node->type) { | 585 | switch (node->type) { |
589 | case ACPI_TYPE_LOCAL_SCOPE: /* Scope */ | 586 | case ACPI_TYPE_LOCAL_SCOPE: /* Scope */ |
590 | case ACPI_TYPE_DEVICE: | 587 | case ACPI_TYPE_DEVICE: |
591 | case ACPI_TYPE_POWER: | 588 | case ACPI_TYPE_POWER: |
592 | case ACPI_TYPE_PROCESSOR: | 589 | case ACPI_TYPE_PROCESSOR: |
@@ -607,9 +604,7 @@ acpi_ds_load2_begin_op ( | |||
607 | * Scope (DEB) { ... } | 604 | * Scope (DEB) { ... } |
608 | */ | 605 | */ |
609 | 606 | ||
610 | ACPI_REPORT_WARNING (( | 607 | ACPI_REPORT_WARNING(("Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n", buffer_ptr, acpi_ut_get_type_name(node->type))); |
611 | "Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n", | ||
612 | buffer_ptr, acpi_ut_get_type_name (node->type))); | ||
613 | 608 | ||
614 | node->type = ACPI_TYPE_ANY; | 609 | node->type = ACPI_TYPE_ANY; |
615 | walk_state->scope_info->common.value = ACPI_TYPE_ANY; | 610 | walk_state->scope_info->common.value = ACPI_TYPE_ANY; |
@@ -619,9 +614,7 @@ acpi_ds_load2_begin_op ( | |||
619 | 614 | ||
620 | /* All other types are an error */ | 615 | /* All other types are an error */ |
621 | 616 | ||
622 | ACPI_REPORT_ERROR (( | 617 | ACPI_REPORT_ERROR(("Invalid type (%s) for target of Scope operator [%4.4s]\n", acpi_ut_get_type_name(node->type), buffer_ptr)); |
623 | "Invalid type (%s) for target of Scope operator [%4.4s]\n", | ||
624 | acpi_ut_get_type_name (node->type), buffer_ptr)); | ||
625 | 618 | ||
626 | return (AE_AML_OPERAND_TYPE); | 619 | return (AE_AML_OPERAND_TYPE); |
627 | } | 620 | } |
@@ -636,14 +629,16 @@ acpi_ds_load2_begin_op ( | |||
636 | 629 | ||
637 | node = op->common.node; | 630 | node = op->common.node; |
638 | 631 | ||
639 | if (acpi_ns_opens_scope (object_type)) { | 632 | if (acpi_ns_opens_scope(object_type)) { |
640 | status = acpi_ds_scope_stack_push (node, object_type, walk_state); | 633 | status = |
641 | if (ACPI_FAILURE (status)) { | 634 | acpi_ds_scope_stack_push(node, object_type, |
642 | return_ACPI_STATUS (status); | 635 | walk_state); |
636 | if (ACPI_FAILURE(status)) { | ||
637 | return_ACPI_STATUS(status); | ||
643 | } | 638 | } |
644 | 639 | ||
645 | } | 640 | } |
646 | return_ACPI_STATUS (AE_OK); | 641 | return_ACPI_STATUS(AE_OK); |
647 | } | 642 | } |
648 | 643 | ||
649 | /* | 644 | /* |
@@ -664,23 +659,24 @@ acpi_ds_load2_begin_op ( | |||
664 | 659 | ||
665 | /* Add new entry into namespace */ | 660 | /* Add new entry into namespace */ |
666 | 661 | ||
667 | status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, object_type, | 662 | status = |
668 | ACPI_IMODE_LOAD_PASS2, ACPI_NS_NO_UPSEARCH, | 663 | acpi_ns_lookup(walk_state->scope_info, buffer_ptr, |
669 | walk_state, &(node)); | 664 | object_type, ACPI_IMODE_LOAD_PASS2, |
665 | ACPI_NS_NO_UPSEARCH, walk_state, &(node)); | ||
670 | break; | 666 | break; |
671 | } | 667 | } |
672 | 668 | ||
673 | if (ACPI_FAILURE (status)) { | 669 | if (ACPI_FAILURE(status)) { |
674 | ACPI_REPORT_NSERROR (buffer_ptr, status); | 670 | ACPI_REPORT_NSERROR(buffer_ptr, status); |
675 | return_ACPI_STATUS (status); | 671 | return_ACPI_STATUS(status); |
676 | } | 672 | } |
677 | 673 | ||
678 | if (!op) { | 674 | if (!op) { |
679 | /* Create a new op */ | 675 | /* Create a new op */ |
680 | 676 | ||
681 | op = acpi_ps_alloc_op (walk_state->opcode); | 677 | op = acpi_ps_alloc_op(walk_state->opcode); |
682 | if (!op) { | 678 | if (!op) { |
683 | return_ACPI_STATUS (AE_NO_MEMORY); | 679 | return_ACPI_STATUS(AE_NO_MEMORY); |
684 | } | 680 | } |
685 | 681 | ||
686 | /* Initialize the new op */ | 682 | /* Initialize the new op */ |
@@ -697,10 +693,9 @@ acpi_ds_load2_begin_op ( | |||
697 | */ | 693 | */ |
698 | op->common.node = node; | 694 | op->common.node = node; |
699 | 695 | ||
700 | return_ACPI_STATUS (status); | 696 | return_ACPI_STATUS(status); |
701 | } | 697 | } |
702 | 698 | ||
703 | |||
704 | /******************************************************************************* | 699 | /******************************************************************************* |
705 | * | 700 | * |
706 | * FUNCTION: acpi_ds_load2_end_op | 701 | * FUNCTION: acpi_ds_load2_end_op |
@@ -714,26 +709,23 @@ acpi_ds_load2_begin_op ( | |||
714 | * | 709 | * |
715 | ******************************************************************************/ | 710 | ******************************************************************************/ |
716 | 711 | ||
717 | acpi_status | 712 | acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state) |
718 | acpi_ds_load2_end_op ( | ||
719 | struct acpi_walk_state *walk_state) | ||
720 | { | 713 | { |
721 | union acpi_parse_object *op; | 714 | union acpi_parse_object *op; |
722 | acpi_status status = AE_OK; | 715 | acpi_status status = AE_OK; |
723 | acpi_object_type object_type; | 716 | acpi_object_type object_type; |
724 | struct acpi_namespace_node *node; | 717 | struct acpi_namespace_node *node; |
725 | union acpi_parse_object *arg; | 718 | union acpi_parse_object *arg; |
726 | struct acpi_namespace_node *new_node; | 719 | struct acpi_namespace_node *new_node; |
727 | #ifndef ACPI_NO_METHOD_EXECUTION | 720 | #ifndef ACPI_NO_METHOD_EXECUTION |
728 | u32 i; | 721 | u32 i; |
729 | #endif | 722 | #endif |
730 | 723 | ||
731 | 724 | ACPI_FUNCTION_TRACE("ds_load2_end_op"); | |
732 | ACPI_FUNCTION_TRACE ("ds_load2_end_op"); | ||
733 | 725 | ||
734 | op = walk_state->op; | 726 | op = walk_state->op; |
735 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Opcode [%s] Op %p State %p\n", | 727 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Opcode [%s] Op %p State %p\n", |
736 | walk_state->op_info->name, op, walk_state)); | 728 | walk_state->op_info->name, op, walk_state)); |
737 | 729 | ||
738 | /* Check if opcode had an associated namespace object */ | 730 | /* Check if opcode had an associated namespace object */ |
739 | 731 | ||
@@ -742,23 +734,25 @@ acpi_ds_load2_end_op ( | |||
742 | /* No namespace object. Executable opcode? */ | 734 | /* No namespace object. Executable opcode? */ |
743 | 735 | ||
744 | if ((walk_state->op_info->class == AML_CLASS_EXECUTE) || | 736 | if ((walk_state->op_info->class == AML_CLASS_EXECUTE) || |
745 | (walk_state->op_info->class == AML_CLASS_CONTROL)) { | 737 | (walk_state->op_info->class == AML_CLASS_CONTROL)) { |
746 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, | 738 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
747 | "End/EXEC: %s (fl %8.8X)\n", walk_state->op_info->name, | 739 | "End/EXEC: %s (fl %8.8X)\n", |
748 | walk_state->op_info->flags)); | 740 | walk_state->op_info->name, |
741 | walk_state->op_info->flags)); | ||
749 | 742 | ||
750 | /* Executing a type1 or type2 opcode outside of a method */ | 743 | /* Executing a type1 or type2 opcode outside of a method */ |
751 | 744 | ||
752 | status = acpi_ds_exec_end_op (walk_state); | 745 | status = acpi_ds_exec_end_op(walk_state); |
753 | return_ACPI_STATUS (status); | 746 | return_ACPI_STATUS(status); |
754 | } | 747 | } |
755 | #endif | 748 | #endif |
756 | return_ACPI_STATUS (AE_OK); | 749 | return_ACPI_STATUS(AE_OK); |
757 | } | 750 | } |
758 | 751 | ||
759 | if (op->common.aml_opcode == AML_SCOPE_OP) { | 752 | if (op->common.aml_opcode == AML_SCOPE_OP) { |
760 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, | 753 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
761 | "Ending scope Op=%p State=%p\n", op, walk_state)); | 754 | "Ending scope Op=%p State=%p\n", op, |
755 | walk_state)); | ||
762 | } | 756 | } |
763 | 757 | ||
764 | object_type = walk_state->op_info->object_type; | 758 | object_type = walk_state->op_info->object_type; |
@@ -773,18 +767,19 @@ acpi_ds_load2_end_op ( | |||
773 | * Put the Node on the object stack (Contains the ACPI Name of | 767 | * Put the Node on the object stack (Contains the ACPI Name of |
774 | * this object) | 768 | * this object) |
775 | */ | 769 | */ |
776 | walk_state->operands[0] = (void *) node; | 770 | walk_state->operands[0] = (void *)node; |
777 | walk_state->num_operands = 1; | 771 | walk_state->num_operands = 1; |
778 | 772 | ||
779 | /* Pop the scope stack */ | 773 | /* Pop the scope stack */ |
780 | 774 | ||
781 | if (acpi_ns_opens_scope (object_type) && | 775 | if (acpi_ns_opens_scope(object_type) && |
782 | (op->common.aml_opcode != AML_INT_METHODCALL_OP)) { | 776 | (op->common.aml_opcode != AML_INT_METHODCALL_OP)) { |
783 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s) Popping scope for Op %p\n", | 777 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
784 | acpi_ut_get_type_name (object_type), op)); | 778 | "(%s) Popping scope for Op %p\n", |
779 | acpi_ut_get_type_name(object_type), op)); | ||
785 | 780 | ||
786 | status = acpi_ds_scope_stack_pop (walk_state); | 781 | status = acpi_ds_scope_stack_pop(walk_state); |
787 | if (ACPI_FAILURE (status)) { | 782 | if (ACPI_FAILURE(status)) { |
788 | goto cleanup; | 783 | goto cleanup; |
789 | } | 784 | } |
790 | } | 785 | } |
@@ -817,9 +812,10 @@ acpi_ds_load2_end_op ( | |||
817 | * AML_THERMALZONE | 812 | * AML_THERMALZONE |
818 | */ | 813 | */ |
819 | 814 | ||
820 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, | 815 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
821 | "Create-Load [%s] State=%p Op=%p named_obj=%p\n", | 816 | "Create-Load [%s] State=%p Op=%p named_obj=%p\n", |
822 | acpi_ps_get_opcode_name (op->common.aml_opcode), walk_state, op, node)); | 817 | acpi_ps_get_opcode_name(op->common.aml_opcode), |
818 | walk_state, op, node)); | ||
823 | 819 | ||
824 | /* Decode the opcode */ | 820 | /* Decode the opcode */ |
825 | 821 | ||
@@ -834,27 +830,32 @@ acpi_ds_load2_end_op ( | |||
834 | * Create the field object, but the field buffer and index must | 830 | * Create the field object, but the field buffer and index must |
835 | * be evaluated later during the execution phase | 831 | * be evaluated later during the execution phase |
836 | */ | 832 | */ |
837 | status = acpi_ds_create_buffer_field (op, walk_state); | 833 | status = acpi_ds_create_buffer_field(op, walk_state); |
838 | break; | 834 | break; |
839 | 835 | ||
840 | 836 | case AML_TYPE_NAMED_FIELD: | |
841 | case AML_TYPE_NAMED_FIELD: | ||
842 | 837 | ||
843 | switch (op->common.aml_opcode) { | 838 | switch (op->common.aml_opcode) { |
844 | case AML_INDEX_FIELD_OP: | 839 | case AML_INDEX_FIELD_OP: |
845 | 840 | ||
846 | status = acpi_ds_create_index_field (op, (acpi_handle) arg->common.node, | 841 | status = |
847 | walk_state); | 842 | acpi_ds_create_index_field(op, |
843 | (acpi_handle) arg-> | ||
844 | common.node, walk_state); | ||
848 | break; | 845 | break; |
849 | 846 | ||
850 | case AML_BANK_FIELD_OP: | 847 | case AML_BANK_FIELD_OP: |
851 | 848 | ||
852 | status = acpi_ds_create_bank_field (op, arg->common.node, walk_state); | 849 | status = |
850 | acpi_ds_create_bank_field(op, arg->common.node, | ||
851 | walk_state); | ||
853 | break; | 852 | break; |
854 | 853 | ||
855 | case AML_FIELD_OP: | 854 | case AML_FIELD_OP: |
856 | 855 | ||
857 | status = acpi_ds_create_field (op, arg->common.node, walk_state); | 856 | status = |
857 | acpi_ds_create_field(op, arg->common.node, | ||
858 | walk_state); | ||
858 | break; | 859 | break; |
859 | 860 | ||
860 | default: | 861 | default: |
@@ -863,43 +864,42 @@ acpi_ds_load2_end_op ( | |||
863 | } | 864 | } |
864 | break; | 865 | break; |
865 | 866 | ||
867 | case AML_TYPE_NAMED_SIMPLE: | ||
866 | 868 | ||
867 | case AML_TYPE_NAMED_SIMPLE: | 869 | status = acpi_ds_create_operands(walk_state, arg); |
868 | 870 | if (ACPI_FAILURE(status)) { | |
869 | status = acpi_ds_create_operands (walk_state, arg); | ||
870 | if (ACPI_FAILURE (status)) { | ||
871 | goto cleanup; | 871 | goto cleanup; |
872 | } | 872 | } |
873 | 873 | ||
874 | switch (op->common.aml_opcode) { | 874 | switch (op->common.aml_opcode) { |
875 | case AML_PROCESSOR_OP: | 875 | case AML_PROCESSOR_OP: |
876 | 876 | ||
877 | status = acpi_ex_create_processor (walk_state); | 877 | status = acpi_ex_create_processor(walk_state); |
878 | break; | 878 | break; |
879 | 879 | ||
880 | case AML_POWER_RES_OP: | 880 | case AML_POWER_RES_OP: |
881 | 881 | ||
882 | status = acpi_ex_create_power_resource (walk_state); | 882 | status = acpi_ex_create_power_resource(walk_state); |
883 | break; | 883 | break; |
884 | 884 | ||
885 | case AML_MUTEX_OP: | 885 | case AML_MUTEX_OP: |
886 | 886 | ||
887 | status = acpi_ex_create_mutex (walk_state); | 887 | status = acpi_ex_create_mutex(walk_state); |
888 | break; | 888 | break; |
889 | 889 | ||
890 | case AML_EVENT_OP: | 890 | case AML_EVENT_OP: |
891 | 891 | ||
892 | status = acpi_ex_create_event (walk_state); | 892 | status = acpi_ex_create_event(walk_state); |
893 | break; | 893 | break; |
894 | 894 | ||
895 | case AML_DATA_REGION_OP: | 895 | case AML_DATA_REGION_OP: |
896 | 896 | ||
897 | status = acpi_ex_create_table_region (walk_state); | 897 | status = acpi_ex_create_table_region(walk_state); |
898 | break; | 898 | break; |
899 | 899 | ||
900 | case AML_ALIAS_OP: | 900 | case AML_ALIAS_OP: |
901 | 901 | ||
902 | status = acpi_ex_create_alias (walk_state); | 902 | status = acpi_ex_create_alias(walk_state); |
903 | break; | 903 | break; |
904 | 904 | ||
905 | default: | 905 | default: |
@@ -912,12 +912,12 @@ acpi_ds_load2_end_op ( | |||
912 | /* Delete operands */ | 912 | /* Delete operands */ |
913 | 913 | ||
914 | for (i = 1; i < walk_state->num_operands; i++) { | 914 | for (i = 1; i < walk_state->num_operands; i++) { |
915 | acpi_ut_remove_reference (walk_state->operands[i]); | 915 | acpi_ut_remove_reference(walk_state->operands[i]); |
916 | walk_state->operands[i] = NULL; | 916 | walk_state->operands[i] = NULL; |
917 | } | 917 | } |
918 | 918 | ||
919 | break; | 919 | break; |
920 | #endif /* ACPI_NO_METHOD_EXECUTION */ | 920 | #endif /* ACPI_NO_METHOD_EXECUTION */ |
921 | 921 | ||
922 | case AML_TYPE_NAMED_COMPLEX: | 922 | case AML_TYPE_NAMED_COMPLEX: |
923 | 923 | ||
@@ -933,9 +933,10 @@ acpi_ds_load2_end_op ( | |||
933 | * If we have a valid region, initialize it | 933 | * If we have a valid region, initialize it |
934 | * Namespace is NOT locked at this point. | 934 | * Namespace is NOT locked at this point. |
935 | */ | 935 | */ |
936 | status = acpi_ev_initialize_region (acpi_ns_get_attached_object (node), | 936 | status = |
937 | FALSE); | 937 | acpi_ev_initialize_region |
938 | if (ACPI_FAILURE (status)) { | 938 | (acpi_ns_get_attached_object(node), FALSE); |
939 | if (ACPI_FAILURE(status)) { | ||
939 | /* | 940 | /* |
940 | * If AE_NOT_EXIST is returned, it is not fatal | 941 | * If AE_NOT_EXIST is returned, it is not fatal |
941 | * because many regions get created before a handler | 942 | * because many regions get created before a handler |
@@ -947,13 +948,11 @@ acpi_ds_load2_end_op ( | |||
947 | } | 948 | } |
948 | break; | 949 | break; |
949 | 950 | ||
950 | |||
951 | case AML_NAME_OP: | 951 | case AML_NAME_OP: |
952 | 952 | ||
953 | status = acpi_ds_create_node (walk_state, node, op); | 953 | status = acpi_ds_create_node(walk_state, node, op); |
954 | break; | 954 | break; |
955 | #endif /* ACPI_NO_METHOD_EXECUTION */ | 955 | #endif /* ACPI_NO_METHOD_EXECUTION */ |
956 | |||
957 | 956 | ||
958 | default: | 957 | default: |
959 | /* All NAMED_COMPLEX opcodes must be handled above */ | 958 | /* All NAMED_COMPLEX opcodes must be handled above */ |
@@ -962,27 +961,28 @@ acpi_ds_load2_end_op ( | |||
962 | } | 961 | } |
963 | break; | 962 | break; |
964 | 963 | ||
965 | |||
966 | case AML_CLASS_INTERNAL: | 964 | case AML_CLASS_INTERNAL: |
967 | 965 | ||
968 | /* case AML_INT_NAMEPATH_OP: */ | 966 | /* case AML_INT_NAMEPATH_OP: */ |
969 | break; | 967 | break; |
970 | 968 | ||
971 | |||
972 | case AML_CLASS_METHOD_CALL: | 969 | case AML_CLASS_METHOD_CALL: |
973 | 970 | ||
974 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, | 971 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
975 | "RESOLVING-method_call: State=%p Op=%p named_obj=%p\n", | 972 | "RESOLVING-method_call: State=%p Op=%p named_obj=%p\n", |
976 | walk_state, op, node)); | 973 | walk_state, op, node)); |
977 | 974 | ||
978 | /* | 975 | /* |
979 | * Lookup the method name and save the Node | 976 | * Lookup the method name and save the Node |
980 | */ | 977 | */ |
981 | status = acpi_ns_lookup (walk_state->scope_info, arg->common.value.string, | 978 | status = |
982 | ACPI_TYPE_ANY, ACPI_IMODE_LOAD_PASS2, | 979 | acpi_ns_lookup(walk_state->scope_info, |
983 | ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, | 980 | arg->common.value.string, ACPI_TYPE_ANY, |
984 | walk_state, &(new_node)); | 981 | ACPI_IMODE_LOAD_PASS2, |
985 | if (ACPI_SUCCESS (status)) { | 982 | ACPI_NS_SEARCH_PARENT | |
983 | ACPI_NS_DONT_OPEN_SCOPE, walk_state, | ||
984 | &(new_node)); | ||
985 | if (ACPI_SUCCESS(status)) { | ||
986 | 986 | ||
987 | /* | 987 | /* |
988 | * Make sure that what we found is indeed a method | 988 | * Make sure that what we found is indeed a method |
@@ -998,24 +998,20 @@ acpi_ds_load2_end_op ( | |||
998 | * parser uses, so we can get it again at the end of this scope | 998 | * parser uses, so we can get it again at the end of this scope |
999 | */ | 999 | */ |
1000 | op->common.node = new_node; | 1000 | op->common.node = new_node; |
1001 | } | 1001 | } else { |
1002 | else { | 1002 | ACPI_REPORT_NSERROR(arg->common.value.string, status); |
1003 | ACPI_REPORT_NSERROR (arg->common.value.string, status); | ||
1004 | } | 1003 | } |
1005 | break; | 1004 | break; |
1006 | 1005 | ||
1007 | |||
1008 | default: | 1006 | default: |
1009 | break; | 1007 | break; |
1010 | } | 1008 | } |
1011 | 1009 | ||
1012 | cleanup: | 1010 | cleanup: |
1013 | 1011 | ||
1014 | /* Remove the Node pushed at the very beginning */ | 1012 | /* Remove the Node pushed at the very beginning */ |
1015 | 1013 | ||
1016 | walk_state->operands[0] = NULL; | 1014 | walk_state->operands[0] = NULL; |
1017 | walk_state->num_operands = 0; | 1015 | walk_state->num_operands = 0; |
1018 | return_ACPI_STATUS (status); | 1016 | return_ACPI_STATUS(status); |
1019 | } | 1017 | } |
1020 | |||
1021 | |||
diff --git a/drivers/acpi/dispatcher/dswscope.c b/drivers/acpi/dispatcher/dswscope.c index 21f4548ff323..defe956ef751 100644 --- a/drivers/acpi/dispatcher/dswscope.c +++ b/drivers/acpi/dispatcher/dswscope.c | |||
@@ -41,14 +41,11 @@ | |||
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/acdispat.h> | 45 | #include <acpi/acdispat.h> |
47 | 46 | ||
48 | |||
49 | #define _COMPONENT ACPI_DISPATCHER | 47 | #define _COMPONENT ACPI_DISPATCHER |
50 | ACPI_MODULE_NAME ("dswscope") | 48 | ACPI_MODULE_NAME("dswscope") |
51 | |||
52 | 49 | ||
53 | /**************************************************************************** | 50 | /**************************************************************************** |
54 | * | 51 | * |
@@ -62,15 +59,11 @@ | |||
62 | * root scope object (which remains at the stack top.) | 59 | * root scope object (which remains at the stack top.) |
63 | * | 60 | * |
64 | ***************************************************************************/ | 61 | ***************************************************************************/ |
65 | 62 | void acpi_ds_scope_stack_clear(struct acpi_walk_state *walk_state) | |
66 | void | ||
67 | acpi_ds_scope_stack_clear ( | ||
68 | struct acpi_walk_state *walk_state) | ||
69 | { | 63 | { |
70 | union acpi_generic_state *scope_info; | 64 | union acpi_generic_state *scope_info; |
71 | |||
72 | ACPI_FUNCTION_NAME ("ds_scope_stack_clear"); | ||
73 | 65 | ||
66 | ACPI_FUNCTION_NAME("ds_scope_stack_clear"); | ||
74 | 67 | ||
75 | while (walk_state->scope_info) { | 68 | while (walk_state->scope_info) { |
76 | /* Pop a scope off the stack */ | 69 | /* Pop a scope off the stack */ |
@@ -78,14 +71,14 @@ acpi_ds_scope_stack_clear ( | |||
78 | scope_info = walk_state->scope_info; | 71 | scope_info = walk_state->scope_info; |
79 | walk_state->scope_info = scope_info->scope.next; | 72 | walk_state->scope_info = scope_info->scope.next; |
80 | 73 | ||
81 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, | 74 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
82 | "Popped object type (%s)\n", | 75 | "Popped object type (%s)\n", |
83 | acpi_ut_get_type_name (scope_info->common.value))); | 76 | acpi_ut_get_type_name(scope_info->common. |
84 | acpi_ut_delete_generic_state (scope_info); | 77 | value))); |
78 | acpi_ut_delete_generic_state(scope_info); | ||
85 | } | 79 | } |
86 | } | 80 | } |
87 | 81 | ||
88 | |||
89 | /**************************************************************************** | 82 | /**************************************************************************** |
90 | * | 83 | * |
91 | * FUNCTION: acpi_ds_scope_stack_push | 84 | * FUNCTION: acpi_ds_scope_stack_push |
@@ -102,74 +95,70 @@ acpi_ds_scope_stack_clear ( | |||
102 | ***************************************************************************/ | 95 | ***************************************************************************/ |
103 | 96 | ||
104 | acpi_status | 97 | acpi_status |
105 | acpi_ds_scope_stack_push ( | 98 | acpi_ds_scope_stack_push(struct acpi_namespace_node *node, |
106 | struct acpi_namespace_node *node, | 99 | acpi_object_type type, |
107 | acpi_object_type type, | 100 | struct acpi_walk_state *walk_state) |
108 | struct acpi_walk_state *walk_state) | ||
109 | { | 101 | { |
110 | union acpi_generic_state *scope_info; | 102 | union acpi_generic_state *scope_info; |
111 | union acpi_generic_state *old_scope_info; | 103 | union acpi_generic_state *old_scope_info; |
112 | |||
113 | |||
114 | ACPI_FUNCTION_TRACE ("ds_scope_stack_push"); | ||
115 | 104 | ||
105 | ACPI_FUNCTION_TRACE("ds_scope_stack_push"); | ||
116 | 106 | ||
117 | if (!node) { | 107 | if (!node) { |
118 | /* Invalid scope */ | 108 | /* Invalid scope */ |
119 | 109 | ||
120 | ACPI_REPORT_ERROR (("ds_scope_stack_push: null scope passed\n")); | 110 | ACPI_REPORT_ERROR(("ds_scope_stack_push: null scope passed\n")); |
121 | return_ACPI_STATUS (AE_BAD_PARAMETER); | 111 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
122 | } | 112 | } |
123 | 113 | ||
124 | /* Make sure object type is valid */ | 114 | /* Make sure object type is valid */ |
125 | 115 | ||
126 | if (!acpi_ut_valid_object_type (type)) { | 116 | if (!acpi_ut_valid_object_type(type)) { |
127 | ACPI_REPORT_WARNING (( | 117 | ACPI_REPORT_WARNING(("ds_scope_stack_push: Invalid object type: 0x%X\n", type)); |
128 | "ds_scope_stack_push: Invalid object type: 0x%X\n", type)); | ||
129 | } | 118 | } |
130 | 119 | ||
131 | /* Allocate a new scope object */ | 120 | /* Allocate a new scope object */ |
132 | 121 | ||
133 | scope_info = acpi_ut_create_generic_state (); | 122 | scope_info = acpi_ut_create_generic_state(); |
134 | if (!scope_info) { | 123 | if (!scope_info) { |
135 | return_ACPI_STATUS (AE_NO_MEMORY); | 124 | return_ACPI_STATUS(AE_NO_MEMORY); |
136 | } | 125 | } |
137 | 126 | ||
138 | /* Init new scope object */ | 127 | /* Init new scope object */ |
139 | 128 | ||
140 | scope_info->common.data_type = ACPI_DESC_TYPE_STATE_WSCOPE; | 129 | scope_info->common.data_type = ACPI_DESC_TYPE_STATE_WSCOPE; |
141 | scope_info->scope.node = node; | 130 | scope_info->scope.node = node; |
142 | scope_info->common.value = (u16) type; | 131 | scope_info->common.value = (u16) type; |
143 | 132 | ||
144 | walk_state->scope_depth++; | 133 | walk_state->scope_depth++; |
145 | 134 | ||
146 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, | 135 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
147 | "[%.2d] Pushed scope ", (u32) walk_state->scope_depth)); | 136 | "[%.2d] Pushed scope ", |
137 | (u32) walk_state->scope_depth)); | ||
148 | 138 | ||
149 | old_scope_info = walk_state->scope_info; | 139 | old_scope_info = walk_state->scope_info; |
150 | if (old_scope_info) { | 140 | if (old_scope_info) { |
151 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC, | 141 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_EXEC, |
152 | "[%4.4s] (%s)", | 142 | "[%4.4s] (%s)", |
153 | acpi_ut_get_node_name (old_scope_info->scope.node), | 143 | acpi_ut_get_node_name(old_scope_info-> |
154 | acpi_ut_get_type_name (old_scope_info->common.value))); | 144 | scope.node), |
155 | } | 145 | acpi_ut_get_type_name(old_scope_info-> |
156 | else { | 146 | common.value))); |
157 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC, | 147 | } else { |
158 | "[\\___] (%s)", "ROOT")); | 148 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_EXEC, "[\\___] (%s)", "ROOT")); |
159 | } | 149 | } |
160 | 150 | ||
161 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC, | 151 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_EXEC, |
162 | ", New scope -> [%4.4s] (%s)\n", | 152 | ", New scope -> [%4.4s] (%s)\n", |
163 | acpi_ut_get_node_name (scope_info->scope.node), | 153 | acpi_ut_get_node_name(scope_info->scope.node), |
164 | acpi_ut_get_type_name (scope_info->common.value))); | 154 | acpi_ut_get_type_name(scope_info->common.value))); |
165 | 155 | ||
166 | /* Push new scope object onto stack */ | 156 | /* Push new scope object onto stack */ |
167 | 157 | ||
168 | acpi_ut_push_generic_state (&walk_state->scope_info, scope_info); | 158 | acpi_ut_push_generic_state(&walk_state->scope_info, scope_info); |
169 | return_ACPI_STATUS (AE_OK); | 159 | return_ACPI_STATUS(AE_OK); |
170 | } | 160 | } |
171 | 161 | ||
172 | |||
173 | /**************************************************************************** | 162 | /**************************************************************************** |
174 | * | 163 | * |
175 | * FUNCTION: acpi_ds_scope_stack_pop | 164 | * FUNCTION: acpi_ds_scope_stack_pop |
@@ -182,47 +171,41 @@ acpi_ds_scope_stack_push ( | |||
182 | * | 171 | * |
183 | ***************************************************************************/ | 172 | ***************************************************************************/ |
184 | 173 | ||
185 | acpi_status | 174 | acpi_status acpi_ds_scope_stack_pop(struct acpi_walk_state *walk_state) |
186 | acpi_ds_scope_stack_pop ( | ||
187 | struct acpi_walk_state *walk_state) | ||
188 | { | 175 | { |
189 | union acpi_generic_state *scope_info; | 176 | union acpi_generic_state *scope_info; |
190 | union acpi_generic_state *new_scope_info; | 177 | union acpi_generic_state *new_scope_info; |
191 | |||
192 | |||
193 | ACPI_FUNCTION_TRACE ("ds_scope_stack_pop"); | ||
194 | 178 | ||
179 | ACPI_FUNCTION_TRACE("ds_scope_stack_pop"); | ||
195 | 180 | ||
196 | /* | 181 | /* |
197 | * Pop scope info object off the stack. | 182 | * Pop scope info object off the stack. |
198 | */ | 183 | */ |
199 | scope_info = acpi_ut_pop_generic_state (&walk_state->scope_info); | 184 | scope_info = acpi_ut_pop_generic_state(&walk_state->scope_info); |
200 | if (!scope_info) { | 185 | if (!scope_info) { |
201 | return_ACPI_STATUS (AE_STACK_UNDERFLOW); | 186 | return_ACPI_STATUS(AE_STACK_UNDERFLOW); |
202 | } | 187 | } |
203 | 188 | ||
204 | walk_state->scope_depth--; | 189 | walk_state->scope_depth--; |
205 | 190 | ||
206 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, | 191 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
207 | "[%.2d] Popped scope [%4.4s] (%s), New scope -> ", | 192 | "[%.2d] Popped scope [%4.4s] (%s), New scope -> ", |
208 | (u32) walk_state->scope_depth, | 193 | (u32) walk_state->scope_depth, |
209 | acpi_ut_get_node_name (scope_info->scope.node), | 194 | acpi_ut_get_node_name(scope_info->scope.node), |
210 | acpi_ut_get_type_name (scope_info->common.value))); | 195 | acpi_ut_get_type_name(scope_info->common.value))); |
211 | 196 | ||
212 | new_scope_info = walk_state->scope_info; | 197 | new_scope_info = walk_state->scope_info; |
213 | if (new_scope_info) { | 198 | if (new_scope_info) { |
214 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC, | 199 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_EXEC, |
215 | "[%4.4s] (%s)\n", | 200 | "[%4.4s] (%s)\n", |
216 | acpi_ut_get_node_name (new_scope_info->scope.node), | 201 | acpi_ut_get_node_name(new_scope_info-> |
217 | acpi_ut_get_type_name (new_scope_info->common.value))); | 202 | scope.node), |
218 | } | 203 | acpi_ut_get_type_name(new_scope_info-> |
219 | else { | 204 | common.value))); |
220 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC, | 205 | } else { |
221 | "[\\___] (ROOT)\n")); | 206 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_EXEC, "[\\___] (ROOT)\n")); |
222 | } | 207 | } |
223 | 208 | ||
224 | acpi_ut_delete_generic_state (scope_info); | 209 | acpi_ut_delete_generic_state(scope_info); |
225 | return_ACPI_STATUS (AE_OK); | 210 | return_ACPI_STATUS(AE_OK); |
226 | } | 211 | } |
227 | |||
228 | |||
diff --git a/drivers/acpi/dispatcher/dswstate.c b/drivers/acpi/dispatcher/dswstate.c index 5621665991b5..7d68a5aaf3c4 100644 --- a/drivers/acpi/dispatcher/dswstate.c +++ b/drivers/acpi/dispatcher/dswstate.c | |||
@@ -41,37 +41,28 @@ | |||
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/acdispat.h> | 46 | #include <acpi/acdispat.h> |
48 | #include <acpi/acnamesp.h> | 47 | #include <acpi/acnamesp.h> |
49 | 48 | ||
50 | #define _COMPONENT ACPI_DISPATCHER | 49 | #define _COMPONENT ACPI_DISPATCHER |
51 | ACPI_MODULE_NAME ("dswstate") | 50 | ACPI_MODULE_NAME("dswstate") |
52 | 51 | ||
53 | /* Local prototypes */ | 52 | /* Local prototypes */ |
54 | |||
55 | #ifdef ACPI_OBSOLETE_FUNCTIONS | 53 | #ifdef ACPI_OBSOLETE_FUNCTIONS |
56 | acpi_status | 54 | acpi_status |
57 | acpi_ds_result_insert ( | 55 | acpi_ds_result_insert(void *object, |
58 | void *object, | 56 | u32 index, struct acpi_walk_state *walk_state); |
59 | u32 index, | ||
60 | struct acpi_walk_state *walk_state); | ||
61 | 57 | ||
62 | acpi_status | 58 | acpi_status acpi_ds_obj_stack_delete_all(struct acpi_walk_state *walk_state); |
63 | acpi_ds_obj_stack_delete_all ( | ||
64 | struct acpi_walk_state *walk_state); | ||
65 | 59 | ||
66 | acpi_status | 60 | acpi_status |
67 | acpi_ds_obj_stack_pop_object ( | 61 | acpi_ds_obj_stack_pop_object(union acpi_operand_object **object, |
68 | union acpi_operand_object **object, | 62 | struct acpi_walk_state *walk_state); |
69 | struct acpi_walk_state *walk_state); | 63 | |
70 | 64 | void *acpi_ds_obj_stack_get_value(u32 index, | |
71 | void * | 65 | struct acpi_walk_state *walk_state); |
72 | acpi_ds_obj_stack_get_value ( | ||
73 | u32 index, | ||
74 | struct acpi_walk_state *walk_state); | ||
75 | #endif | 66 | #endif |
76 | 67 | ||
77 | #ifdef ACPI_FUTURE_USAGE | 68 | #ifdef ACPI_FUTURE_USAGE |
@@ -92,36 +83,35 @@ acpi_ds_obj_stack_get_value ( | |||
92 | ******************************************************************************/ | 83 | ******************************************************************************/ |
93 | 84 | ||
94 | acpi_status | 85 | acpi_status |
95 | acpi_ds_result_remove ( | 86 | acpi_ds_result_remove(union acpi_operand_object **object, |
96 | union acpi_operand_object **object, | 87 | u32 index, struct acpi_walk_state *walk_state) |
97 | u32 index, | ||
98 | struct acpi_walk_state *walk_state) | ||
99 | { | 88 | { |
100 | union acpi_generic_state *state; | 89 | union acpi_generic_state *state; |
101 | |||
102 | |||
103 | ACPI_FUNCTION_NAME ("ds_result_remove"); | ||
104 | 90 | ||
91 | ACPI_FUNCTION_NAME("ds_result_remove"); | ||
105 | 92 | ||
106 | state = walk_state->results; | 93 | state = walk_state->results; |
107 | if (!state) { | 94 | if (!state) { |
108 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result object pushed! State=%p\n", | 95 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
109 | walk_state)); | 96 | "No result object pushed! State=%p\n", |
97 | walk_state)); | ||
110 | return (AE_NOT_EXIST); | 98 | return (AE_NOT_EXIST); |
111 | } | 99 | } |
112 | 100 | ||
113 | if (index >= ACPI_OBJ_MAX_OPERAND) { | 101 | if (index >= ACPI_OBJ_MAX_OPERAND) { |
114 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 102 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
115 | "Index out of range: %X State=%p Num=%X\n", | 103 | "Index out of range: %X State=%p Num=%X\n", |
116 | index, walk_state, state->results.num_results)); | 104 | index, walk_state, |
105 | state->results.num_results)); | ||
117 | } | 106 | } |
118 | 107 | ||
119 | /* Check for a valid result object */ | 108 | /* Check for a valid result object */ |
120 | 109 | ||
121 | if (!state->results.obj_desc [index]) { | 110 | if (!state->results.obj_desc[index]) { |
122 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 111 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
123 | "Null operand! State=%p #Ops=%X, Index=%X\n", | 112 | "Null operand! State=%p #Ops=%X, Index=%X\n", |
124 | walk_state, state->results.num_results, index)); | 113 | walk_state, state->results.num_results, |
114 | index)); | ||
125 | return (AE_AML_NO_RETURN_VALUE); | 115 | return (AE_AML_NO_RETURN_VALUE); |
126 | } | 116 | } |
127 | 117 | ||
@@ -129,18 +119,20 @@ acpi_ds_result_remove ( | |||
129 | 119 | ||
130 | state->results.num_results--; | 120 | state->results.num_results--; |
131 | 121 | ||
132 | *object = state->results.obj_desc [index]; | 122 | *object = state->results.obj_desc[index]; |
133 | state->results.obj_desc [index] = NULL; | 123 | state->results.obj_desc[index] = NULL; |
134 | 124 | ||
135 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, | 125 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
136 | "Obj=%p [%s] Index=%X State=%p Num=%X\n", | 126 | "Obj=%p [%s] Index=%X State=%p Num=%X\n", |
137 | *object, (*object) ? acpi_ut_get_object_type_name (*object) : "NULL", | 127 | *object, |
138 | index, walk_state, state->results.num_results)); | 128 | (*object) ? acpi_ut_get_object_type_name(*object) : |
129 | "NULL", index, walk_state, | ||
130 | state->results.num_results)); | ||
139 | 131 | ||
140 | return (AE_OK); | 132 | return (AE_OK); |
141 | } | 133 | } |
142 | 134 | ||
143 | #endif /* ACPI_FUTURE_USAGE */ | 135 | #endif /* ACPI_FUTURE_USAGE */ |
144 | 136 | ||
145 | /******************************************************************************* | 137 | /******************************************************************************* |
146 | * | 138 | * |
@@ -157,16 +149,13 @@ acpi_ds_result_remove ( | |||
157 | ******************************************************************************/ | 149 | ******************************************************************************/ |
158 | 150 | ||
159 | acpi_status | 151 | acpi_status |
160 | acpi_ds_result_pop ( | 152 | acpi_ds_result_pop(union acpi_operand_object ** object, |
161 | union acpi_operand_object **object, | 153 | struct acpi_walk_state * walk_state) |
162 | struct acpi_walk_state *walk_state) | ||
163 | { | 154 | { |
164 | acpi_native_uint index; | 155 | acpi_native_uint index; |
165 | union acpi_generic_state *state; | 156 | union acpi_generic_state *state; |
166 | |||
167 | |||
168 | ACPI_FUNCTION_NAME ("ds_result_pop"); | ||
169 | 157 | ||
158 | ACPI_FUNCTION_NAME("ds_result_pop"); | ||
170 | 159 | ||
171 | state = walk_state->results; | 160 | state = walk_state->results; |
172 | if (!state) { | 161 | if (!state) { |
@@ -174,8 +163,9 @@ acpi_ds_result_pop ( | |||
174 | } | 163 | } |
175 | 164 | ||
176 | if (!state->results.num_results) { | 165 | if (!state->results.num_results) { |
177 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Result stack is empty! State=%p\n", | 166 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
178 | walk_state)); | 167 | "Result stack is empty! State=%p\n", |
168 | walk_state)); | ||
179 | return (AE_AML_NO_RETURN_VALUE); | 169 | return (AE_AML_NO_RETURN_VALUE); |
180 | } | 170 | } |
181 | 171 | ||
@@ -186,26 +176,27 @@ acpi_ds_result_pop ( | |||
186 | for (index = ACPI_OBJ_NUM_OPERANDS; index; index--) { | 176 | for (index = ACPI_OBJ_NUM_OPERANDS; index; index--) { |
187 | /* Check for a valid result object */ | 177 | /* Check for a valid result object */ |
188 | 178 | ||
189 | if (state->results.obj_desc [index -1]) { | 179 | if (state->results.obj_desc[index - 1]) { |
190 | *object = state->results.obj_desc [index -1]; | 180 | *object = state->results.obj_desc[index - 1]; |
191 | state->results.obj_desc [index -1] = NULL; | 181 | state->results.obj_desc[index - 1] = NULL; |
192 | 182 | ||
193 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, | 183 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
194 | "Obj=%p [%s] Index=%X State=%p Num=%X\n", | 184 | "Obj=%p [%s] Index=%X State=%p Num=%X\n", |
195 | *object, | 185 | *object, |
196 | (*object) ? acpi_ut_get_object_type_name (*object) : "NULL", | 186 | (*object) ? |
197 | (u32) index -1, walk_state, state->results.num_results)); | 187 | acpi_ut_get_object_type_name(*object) |
188 | : "NULL", (u32) index - 1, walk_state, | ||
189 | state->results.num_results)); | ||
198 | 190 | ||
199 | return (AE_OK); | 191 | return (AE_OK); |
200 | } | 192 | } |
201 | } | 193 | } |
202 | 194 | ||
203 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 195 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
204 | "No result objects! State=%p\n", walk_state)); | 196 | "No result objects! State=%p\n", walk_state)); |
205 | return (AE_AML_NO_RETURN_VALUE); | 197 | return (AE_AML_NO_RETURN_VALUE); |
206 | } | 198 | } |
207 | 199 | ||
208 | |||
209 | /******************************************************************************* | 200 | /******************************************************************************* |
210 | * | 201 | * |
211 | * FUNCTION: acpi_ds_result_pop_from_bottom | 202 | * FUNCTION: acpi_ds_result_pop_from_bottom |
@@ -221,38 +212,37 @@ acpi_ds_result_pop ( | |||
221 | ******************************************************************************/ | 212 | ******************************************************************************/ |
222 | 213 | ||
223 | acpi_status | 214 | acpi_status |
224 | acpi_ds_result_pop_from_bottom ( | 215 | acpi_ds_result_pop_from_bottom(union acpi_operand_object ** object, |
225 | union acpi_operand_object **object, | 216 | struct acpi_walk_state * walk_state) |
226 | struct acpi_walk_state *walk_state) | ||
227 | { | 217 | { |
228 | acpi_native_uint index; | 218 | acpi_native_uint index; |
229 | union acpi_generic_state *state; | 219 | union acpi_generic_state *state; |
230 | |||
231 | |||
232 | ACPI_FUNCTION_NAME ("ds_result_pop_from_bottom"); | ||
233 | 220 | ||
221 | ACPI_FUNCTION_NAME("ds_result_pop_from_bottom"); | ||
234 | 222 | ||
235 | state = walk_state->results; | 223 | state = walk_state->results; |
236 | if (!state) { | 224 | if (!state) { |
237 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 225 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
238 | "Warning: No result object pushed! State=%p\n", walk_state)); | 226 | "Warning: No result object pushed! State=%p\n", |
227 | walk_state)); | ||
239 | return (AE_NOT_EXIST); | 228 | return (AE_NOT_EXIST); |
240 | } | 229 | } |
241 | 230 | ||
242 | if (!state->results.num_results) { | 231 | if (!state->results.num_results) { |
243 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result objects! State=%p\n", | 232 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
244 | walk_state)); | 233 | "No result objects! State=%p\n", walk_state)); |
245 | return (AE_AML_NO_RETURN_VALUE); | 234 | return (AE_AML_NO_RETURN_VALUE); |
246 | } | 235 | } |
247 | 236 | ||
248 | /* Remove Bottom element */ | 237 | /* Remove Bottom element */ |
249 | 238 | ||
250 | *object = state->results.obj_desc [0]; | 239 | *object = state->results.obj_desc[0]; |
251 | 240 | ||
252 | /* Push entire stack down one element */ | 241 | /* Push entire stack down one element */ |
253 | 242 | ||
254 | for (index = 0; index < state->results.num_results; index++) { | 243 | for (index = 0; index < state->results.num_results; index++) { |
255 | state->results.obj_desc [index] = state->results.obj_desc [index + 1]; | 244 | state->results.obj_desc[index] = |
245 | state->results.obj_desc[index + 1]; | ||
256 | } | 246 | } |
257 | 247 | ||
258 | state->results.num_results--; | 248 | state->results.num_results--; |
@@ -260,20 +250,21 @@ acpi_ds_result_pop_from_bottom ( | |||
260 | /* Check for a valid result object */ | 250 | /* Check for a valid result object */ |
261 | 251 | ||
262 | if (!*object) { | 252 | if (!*object) { |
263 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 253 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
264 | "Null operand! State=%p #Ops=%X Index=%X\n", | 254 | "Null operand! State=%p #Ops=%X Index=%X\n", |
265 | walk_state, state->results.num_results, (u32) index)); | 255 | walk_state, state->results.num_results, |
256 | (u32) index)); | ||
266 | return (AE_AML_NO_RETURN_VALUE); | 257 | return (AE_AML_NO_RETURN_VALUE); |
267 | } | 258 | } |
268 | 259 | ||
269 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] Results=%p State=%p\n", | 260 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Obj=%p [%s] Results=%p State=%p\n", |
270 | *object, (*object) ? acpi_ut_get_object_type_name (*object) : "NULL", | 261 | *object, |
271 | state, walk_state)); | 262 | (*object) ? acpi_ut_get_object_type_name(*object) : |
263 | "NULL", state, walk_state)); | ||
272 | 264 | ||
273 | return (AE_OK); | 265 | return (AE_OK); |
274 | } | 266 | } |
275 | 267 | ||
276 | |||
277 | /******************************************************************************* | 268 | /******************************************************************************* |
278 | * | 269 | * |
279 | * FUNCTION: acpi_ds_result_push | 270 | * FUNCTION: acpi_ds_result_push |
@@ -288,47 +279,50 @@ acpi_ds_result_pop_from_bottom ( | |||
288 | ******************************************************************************/ | 279 | ******************************************************************************/ |
289 | 280 | ||
290 | acpi_status | 281 | acpi_status |
291 | acpi_ds_result_push ( | 282 | acpi_ds_result_push(union acpi_operand_object * object, |
292 | union acpi_operand_object *object, | 283 | struct acpi_walk_state * walk_state) |
293 | struct acpi_walk_state *walk_state) | ||
294 | { | 284 | { |
295 | union acpi_generic_state *state; | 285 | union acpi_generic_state *state; |
296 | |||
297 | |||
298 | ACPI_FUNCTION_NAME ("ds_result_push"); | ||
299 | 286 | ||
287 | ACPI_FUNCTION_NAME("ds_result_push"); | ||
300 | 288 | ||
301 | state = walk_state->results; | 289 | state = walk_state->results; |
302 | if (!state) { | 290 | if (!state) { |
303 | ACPI_REPORT_ERROR (("No result stack frame during push\n")); | 291 | ACPI_REPORT_ERROR(("No result stack frame during push\n")); |
304 | return (AE_AML_INTERNAL); | 292 | return (AE_AML_INTERNAL); |
305 | } | 293 | } |
306 | 294 | ||
307 | if (state->results.num_results == ACPI_OBJ_NUM_OPERANDS) { | 295 | if (state->results.num_results == ACPI_OBJ_NUM_OPERANDS) { |
308 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 296 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
309 | "Result stack overflow: Obj=%p State=%p Num=%X\n", | 297 | "Result stack overflow: Obj=%p State=%p Num=%X\n", |
310 | object, walk_state, state->results.num_results)); | 298 | object, walk_state, |
299 | state->results.num_results)); | ||
311 | return (AE_STACK_OVERFLOW); | 300 | return (AE_STACK_OVERFLOW); |
312 | } | 301 | } |
313 | 302 | ||
314 | if (!object) { | 303 | if (!object) { |
315 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 304 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
316 | "Null Object! Obj=%p State=%p Num=%X\n", | 305 | "Null Object! Obj=%p State=%p Num=%X\n", |
317 | object, walk_state, state->results.num_results)); | 306 | object, walk_state, |
307 | state->results.num_results)); | ||
318 | return (AE_BAD_PARAMETER); | 308 | return (AE_BAD_PARAMETER); |
319 | } | 309 | } |
320 | 310 | ||
321 | state->results.obj_desc [state->results.num_results] = object; | 311 | state->results.obj_desc[state->results.num_results] = object; |
322 | state->results.num_results++; | 312 | state->results.num_results++; |
323 | 313 | ||
324 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] State=%p Num=%X Cur=%X\n", | 314 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Obj=%p [%s] State=%p Num=%X Cur=%X\n", |
325 | object, object ? acpi_ut_get_object_type_name ((union acpi_operand_object *) object) : "NULL", | 315 | object, |
326 | walk_state, state->results.num_results, walk_state->current_result)); | 316 | object ? |
317 | acpi_ut_get_object_type_name((union | ||
318 | acpi_operand_object *) | ||
319 | object) : "NULL", | ||
320 | walk_state, state->results.num_results, | ||
321 | walk_state->current_result)); | ||
327 | 322 | ||
328 | return (AE_OK); | 323 | return (AE_OK); |
329 | } | 324 | } |
330 | 325 | ||
331 | |||
332 | /******************************************************************************* | 326 | /******************************************************************************* |
333 | * | 327 | * |
334 | * FUNCTION: acpi_ds_result_stack_push | 328 | * FUNCTION: acpi_ds_result_stack_push |
@@ -341,30 +335,26 @@ acpi_ds_result_push ( | |||
341 | * | 335 | * |
342 | ******************************************************************************/ | 336 | ******************************************************************************/ |
343 | 337 | ||
344 | acpi_status | 338 | acpi_status acpi_ds_result_stack_push(struct acpi_walk_state * walk_state) |
345 | acpi_ds_result_stack_push ( | ||
346 | struct acpi_walk_state *walk_state) | ||
347 | { | 339 | { |
348 | union acpi_generic_state *state; | 340 | union acpi_generic_state *state; |
349 | 341 | ||
350 | ACPI_FUNCTION_NAME ("ds_result_stack_push"); | 342 | ACPI_FUNCTION_NAME("ds_result_stack_push"); |
351 | 343 | ||
352 | 344 | state = acpi_ut_create_generic_state(); | |
353 | state = acpi_ut_create_generic_state (); | ||
354 | if (!state) { | 345 | if (!state) { |
355 | return (AE_NO_MEMORY); | 346 | return (AE_NO_MEMORY); |
356 | } | 347 | } |
357 | 348 | ||
358 | state->common.data_type = ACPI_DESC_TYPE_STATE_RESULT; | 349 | state->common.data_type = ACPI_DESC_TYPE_STATE_RESULT; |
359 | acpi_ut_push_generic_state (&walk_state->results, state); | 350 | acpi_ut_push_generic_state(&walk_state->results, state); |
360 | 351 | ||
361 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Results=%p State=%p\n", | 352 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Results=%p State=%p\n", |
362 | state, walk_state)); | 353 | state, walk_state)); |
363 | 354 | ||
364 | return (AE_OK); | 355 | return (AE_OK); |
365 | } | 356 | } |
366 | 357 | ||
367 | |||
368 | /******************************************************************************* | 358 | /******************************************************************************* |
369 | * | 359 | * |
370 | * FUNCTION: acpi_ds_result_stack_pop | 360 | * FUNCTION: acpi_ds_result_stack_pop |
@@ -377,35 +367,31 @@ acpi_ds_result_stack_push ( | |||
377 | * | 367 | * |
378 | ******************************************************************************/ | 368 | ******************************************************************************/ |
379 | 369 | ||
380 | acpi_status | 370 | acpi_status acpi_ds_result_stack_pop(struct acpi_walk_state * walk_state) |
381 | acpi_ds_result_stack_pop ( | ||
382 | struct acpi_walk_state *walk_state) | ||
383 | { | 371 | { |
384 | union acpi_generic_state *state; | 372 | union acpi_generic_state *state; |
385 | |||
386 | ACPI_FUNCTION_NAME ("ds_result_stack_pop"); | ||
387 | 373 | ||
374 | ACPI_FUNCTION_NAME("ds_result_stack_pop"); | ||
388 | 375 | ||
389 | /* Check for stack underflow */ | 376 | /* Check for stack underflow */ |
390 | 377 | ||
391 | if (walk_state->results == NULL) { | 378 | if (walk_state->results == NULL) { |
392 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Underflow - State=%p\n", | 379 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Underflow - State=%p\n", |
393 | walk_state)); | 380 | walk_state)); |
394 | return (AE_AML_NO_OPERAND); | 381 | return (AE_AML_NO_OPERAND); |
395 | } | 382 | } |
396 | 383 | ||
397 | state = acpi_ut_pop_generic_state (&walk_state->results); | 384 | state = acpi_ut_pop_generic_state(&walk_state->results); |
398 | 385 | ||
399 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, | 386 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
400 | "Result=%p remaining_results=%X State=%p\n", | 387 | "Result=%p remaining_results=%X State=%p\n", |
401 | state, state->results.num_results, walk_state)); | 388 | state, state->results.num_results, walk_state)); |
402 | 389 | ||
403 | acpi_ut_delete_generic_state (state); | 390 | acpi_ut_delete_generic_state(state); |
404 | 391 | ||
405 | return (AE_OK); | 392 | return (AE_OK); |
406 | } | 393 | } |
407 | 394 | ||
408 | |||
409 | /******************************************************************************* | 395 | /******************************************************************************* |
410 | * | 396 | * |
411 | * FUNCTION: acpi_ds_obj_stack_push | 397 | * FUNCTION: acpi_ds_obj_stack_push |
@@ -420,35 +406,35 @@ acpi_ds_result_stack_pop ( | |||
420 | ******************************************************************************/ | 406 | ******************************************************************************/ |
421 | 407 | ||
422 | acpi_status | 408 | acpi_status |
423 | acpi_ds_obj_stack_push ( | 409 | acpi_ds_obj_stack_push(void *object, struct acpi_walk_state * walk_state) |
424 | void *object, | ||
425 | struct acpi_walk_state *walk_state) | ||
426 | { | 410 | { |
427 | ACPI_FUNCTION_NAME ("ds_obj_stack_push"); | 411 | ACPI_FUNCTION_NAME("ds_obj_stack_push"); |
428 | |||
429 | 412 | ||
430 | /* Check for stack overflow */ | 413 | /* Check for stack overflow */ |
431 | 414 | ||
432 | if (walk_state->num_operands >= ACPI_OBJ_NUM_OPERANDS) { | 415 | if (walk_state->num_operands >= ACPI_OBJ_NUM_OPERANDS) { |
433 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 416 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
434 | "overflow! Obj=%p State=%p #Ops=%X\n", | 417 | "overflow! Obj=%p State=%p #Ops=%X\n", |
435 | object, walk_state, walk_state->num_operands)); | 418 | object, walk_state, |
419 | walk_state->num_operands)); | ||
436 | return (AE_STACK_OVERFLOW); | 420 | return (AE_STACK_OVERFLOW); |
437 | } | 421 | } |
438 | 422 | ||
439 | /* Put the object onto the stack */ | 423 | /* Put the object onto the stack */ |
440 | 424 | ||
441 | walk_state->operands [walk_state->num_operands] = object; | 425 | walk_state->operands[walk_state->num_operands] = object; |
442 | walk_state->num_operands++; | 426 | walk_state->num_operands++; |
443 | 427 | ||
444 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] State=%p #Ops=%X\n", | 428 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Obj=%p [%s] State=%p #Ops=%X\n", |
445 | object, acpi_ut_get_object_type_name ((union acpi_operand_object *) object), | 429 | object, |
446 | walk_state, walk_state->num_operands)); | 430 | acpi_ut_get_object_type_name((union |
431 | acpi_operand_object *) | ||
432 | object), walk_state, | ||
433 | walk_state->num_operands)); | ||
447 | 434 | ||
448 | return (AE_OK); | 435 | return (AE_OK); |
449 | } | 436 | } |
450 | 437 | ||
451 | |||
452 | /******************************************************************************* | 438 | /******************************************************************************* |
453 | * | 439 | * |
454 | * FUNCTION: acpi_ds_obj_stack_pop | 440 | * FUNCTION: acpi_ds_obj_stack_pop |
@@ -464,38 +450,35 @@ acpi_ds_obj_stack_push ( | |||
464 | ******************************************************************************/ | 450 | ******************************************************************************/ |
465 | 451 | ||
466 | acpi_status | 452 | acpi_status |
467 | acpi_ds_obj_stack_pop ( | 453 | acpi_ds_obj_stack_pop(u32 pop_count, struct acpi_walk_state * walk_state) |
468 | u32 pop_count, | ||
469 | struct acpi_walk_state *walk_state) | ||
470 | { | 454 | { |
471 | u32 i; | 455 | u32 i; |
472 | |||
473 | ACPI_FUNCTION_NAME ("ds_obj_stack_pop"); | ||
474 | 456 | ||
457 | ACPI_FUNCTION_NAME("ds_obj_stack_pop"); | ||
475 | 458 | ||
476 | for (i = 0; i < pop_count; i++) { | 459 | for (i = 0; i < pop_count; i++) { |
477 | /* Check for stack underflow */ | 460 | /* Check for stack underflow */ |
478 | 461 | ||
479 | if (walk_state->num_operands == 0) { | 462 | if (walk_state->num_operands == 0) { |
480 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 463 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
481 | "Underflow! Count=%X State=%p #Ops=%X\n", | 464 | "Underflow! Count=%X State=%p #Ops=%X\n", |
482 | pop_count, walk_state, walk_state->num_operands)); | 465 | pop_count, walk_state, |
466 | walk_state->num_operands)); | ||
483 | return (AE_STACK_UNDERFLOW); | 467 | return (AE_STACK_UNDERFLOW); |
484 | } | 468 | } |
485 | 469 | ||
486 | /* Just set the stack entry to null */ | 470 | /* Just set the stack entry to null */ |
487 | 471 | ||
488 | walk_state->num_operands--; | 472 | walk_state->num_operands--; |
489 | walk_state->operands [walk_state->num_operands] = NULL; | 473 | walk_state->operands[walk_state->num_operands] = NULL; |
490 | } | 474 | } |
491 | 475 | ||
492 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Count=%X State=%p #Ops=%X\n", | 476 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Count=%X State=%p #Ops=%X\n", |
493 | pop_count, walk_state, walk_state->num_operands)); | 477 | pop_count, walk_state, walk_state->num_operands)); |
494 | 478 | ||
495 | return (AE_OK); | 479 | return (AE_OK); |
496 | } | 480 | } |
497 | 481 | ||
498 | |||
499 | /******************************************************************************* | 482 | /******************************************************************************* |
500 | * | 483 | * |
501 | * FUNCTION: acpi_ds_obj_stack_pop_and_delete | 484 | * FUNCTION: acpi_ds_obj_stack_pop_and_delete |
@@ -511,44 +494,43 @@ acpi_ds_obj_stack_pop ( | |||
511 | ******************************************************************************/ | 494 | ******************************************************************************/ |
512 | 495 | ||
513 | acpi_status | 496 | acpi_status |
514 | acpi_ds_obj_stack_pop_and_delete ( | 497 | acpi_ds_obj_stack_pop_and_delete(u32 pop_count, |
515 | u32 pop_count, | 498 | struct acpi_walk_state * walk_state) |
516 | struct acpi_walk_state *walk_state) | ||
517 | { | 499 | { |
518 | u32 i; | 500 | u32 i; |
519 | union acpi_operand_object *obj_desc; | 501 | union acpi_operand_object *obj_desc; |
520 | |||
521 | |||
522 | ACPI_FUNCTION_NAME ("ds_obj_stack_pop_and_delete"); | ||
523 | 502 | ||
503 | ACPI_FUNCTION_NAME("ds_obj_stack_pop_and_delete"); | ||
524 | 504 | ||
525 | for (i = 0; i < pop_count; i++) { | 505 | for (i = 0; i < pop_count; i++) { |
526 | /* Check for stack underflow */ | 506 | /* Check for stack underflow */ |
527 | 507 | ||
528 | if (walk_state->num_operands == 0) { | 508 | if (walk_state->num_operands == 0) { |
529 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 509 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
530 | "Underflow! Count=%X State=%p #Ops=%X\n", | 510 | "Underflow! Count=%X State=%p #Ops=%X\n", |
531 | pop_count, walk_state, walk_state->num_operands)); | 511 | pop_count, walk_state, |
512 | walk_state->num_operands)); | ||
532 | return (AE_STACK_UNDERFLOW); | 513 | return (AE_STACK_UNDERFLOW); |
533 | } | 514 | } |
534 | 515 | ||
535 | /* Pop the stack and delete an object if present in this stack entry */ | 516 | /* Pop the stack and delete an object if present in this stack entry */ |
536 | 517 | ||
537 | walk_state->num_operands--; | 518 | walk_state->num_operands--; |
538 | obj_desc = walk_state->operands [walk_state->num_operands]; | 519 | obj_desc = walk_state->operands[walk_state->num_operands]; |
539 | if (obj_desc) { | 520 | if (obj_desc) { |
540 | acpi_ut_remove_reference (walk_state->operands [walk_state->num_operands]); | 521 | acpi_ut_remove_reference(walk_state-> |
541 | walk_state->operands [walk_state->num_operands] = NULL; | 522 | operands[walk_state-> |
523 | num_operands]); | ||
524 | walk_state->operands[walk_state->num_operands] = NULL; | ||
542 | } | 525 | } |
543 | } | 526 | } |
544 | 527 | ||
545 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Count=%X State=%p #Ops=%X\n", | 528 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Count=%X State=%p #Ops=%X\n", |
546 | pop_count, walk_state, walk_state->num_operands)); | 529 | pop_count, walk_state, walk_state->num_operands)); |
547 | 530 | ||
548 | return (AE_OK); | 531 | return (AE_OK); |
549 | } | 532 | } |
550 | 533 | ||
551 | |||
552 | /******************************************************************************* | 534 | /******************************************************************************* |
553 | * | 535 | * |
554 | * FUNCTION: acpi_ds_get_current_walk_state | 536 | * FUNCTION: acpi_ds_get_current_walk_state |
@@ -562,25 +544,21 @@ acpi_ds_obj_stack_pop_and_delete ( | |||
562 | * | 544 | * |
563 | ******************************************************************************/ | 545 | ******************************************************************************/ |
564 | 546 | ||
565 | struct acpi_walk_state * | 547 | struct acpi_walk_state *acpi_ds_get_current_walk_state(struct acpi_thread_state |
566 | acpi_ds_get_current_walk_state ( | 548 | *thread) |
567 | struct acpi_thread_state *thread) | ||
568 | |||
569 | { | 549 | { |
570 | ACPI_FUNCTION_NAME ("ds_get_current_walk_state"); | 550 | ACPI_FUNCTION_NAME("ds_get_current_walk_state"); |
571 | |||
572 | 551 | ||
573 | if (!thread) { | 552 | if (!thread) { |
574 | return (NULL); | 553 | return (NULL); |
575 | } | 554 | } |
576 | 555 | ||
577 | ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Current walk_state %p\n", | 556 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "Current walk_state %p\n", |
578 | thread->walk_state_list)); | 557 | thread->walk_state_list)); |
579 | 558 | ||
580 | return (thread->walk_state_list); | 559 | return (thread->walk_state_list); |
581 | } | 560 | } |
582 | 561 | ||
583 | |||
584 | /******************************************************************************* | 562 | /******************************************************************************* |
585 | * | 563 | * |
586 | * FUNCTION: acpi_ds_push_walk_state | 564 | * FUNCTION: acpi_ds_push_walk_state |
@@ -595,20 +573,17 @@ acpi_ds_get_current_walk_state ( | |||
595 | ******************************************************************************/ | 573 | ******************************************************************************/ |
596 | 574 | ||
597 | void | 575 | void |
598 | acpi_ds_push_walk_state ( | 576 | acpi_ds_push_walk_state(struct acpi_walk_state *walk_state, |
599 | struct acpi_walk_state *walk_state, | 577 | struct acpi_thread_state *thread) |
600 | struct acpi_thread_state *thread) | ||
601 | { | 578 | { |
602 | ACPI_FUNCTION_TRACE ("ds_push_walk_state"); | 579 | ACPI_FUNCTION_TRACE("ds_push_walk_state"); |
603 | |||
604 | 580 | ||
605 | walk_state->next = thread->walk_state_list; | 581 | walk_state->next = thread->walk_state_list; |
606 | thread->walk_state_list = walk_state; | 582 | thread->walk_state_list = walk_state; |
607 | 583 | ||
608 | return_VOID; | 584 | return_VOID; |
609 | } | 585 | } |
610 | 586 | ||
611 | |||
612 | /******************************************************************************* | 587 | /******************************************************************************* |
613 | * | 588 | * |
614 | * FUNCTION: acpi_ds_pop_walk_state | 589 | * FUNCTION: acpi_ds_pop_walk_state |
@@ -623,15 +598,11 @@ acpi_ds_push_walk_state ( | |||
623 | * | 598 | * |
624 | ******************************************************************************/ | 599 | ******************************************************************************/ |
625 | 600 | ||
626 | struct acpi_walk_state * | 601 | struct acpi_walk_state *acpi_ds_pop_walk_state(struct acpi_thread_state *thread) |
627 | acpi_ds_pop_walk_state ( | ||
628 | struct acpi_thread_state *thread) | ||
629 | { | 602 | { |
630 | struct acpi_walk_state *walk_state; | 603 | struct acpi_walk_state *walk_state; |
631 | |||
632 | |||
633 | ACPI_FUNCTION_TRACE ("ds_pop_walk_state"); | ||
634 | 604 | ||
605 | ACPI_FUNCTION_TRACE("ds_pop_walk_state"); | ||
635 | 606 | ||
636 | walk_state = thread->walk_state_list; | 607 | walk_state = thread->walk_state_list; |
637 | 608 | ||
@@ -647,10 +618,9 @@ acpi_ds_pop_walk_state ( | |||
647 | */ | 618 | */ |
648 | } | 619 | } |
649 | 620 | ||
650 | return_PTR (walk_state); | 621 | return_PTR(walk_state); |
651 | } | 622 | } |
652 | 623 | ||
653 | |||
654 | /******************************************************************************* | 624 | /******************************************************************************* |
655 | * | 625 | * |
656 | * FUNCTION: acpi_ds_create_walk_state | 626 | * FUNCTION: acpi_ds_create_walk_state |
@@ -667,57 +637,55 @@ acpi_ds_pop_walk_state ( | |||
667 | * | 637 | * |
668 | ******************************************************************************/ | 638 | ******************************************************************************/ |
669 | 639 | ||
670 | struct acpi_walk_state * | 640 | struct acpi_walk_state *acpi_ds_create_walk_state(acpi_owner_id owner_id, |
671 | acpi_ds_create_walk_state ( | 641 | union acpi_parse_object |
672 | acpi_owner_id owner_id, | 642 | *origin, |
673 | union acpi_parse_object *origin, | 643 | union acpi_operand_object |
674 | union acpi_operand_object *mth_desc, | 644 | *mth_desc, |
675 | struct acpi_thread_state *thread) | 645 | struct acpi_thread_state |
646 | *thread) | ||
676 | { | 647 | { |
677 | struct acpi_walk_state *walk_state; | 648 | struct acpi_walk_state *walk_state; |
678 | acpi_status status; | 649 | acpi_status status; |
679 | |||
680 | |||
681 | ACPI_FUNCTION_TRACE ("ds_create_walk_state"); | ||
682 | 650 | ||
651 | ACPI_FUNCTION_TRACE("ds_create_walk_state"); | ||
683 | 652 | ||
684 | walk_state = ACPI_MEM_CALLOCATE (sizeof (struct acpi_walk_state)); | 653 | walk_state = ACPI_MEM_CALLOCATE(sizeof(struct acpi_walk_state)); |
685 | if (!walk_state) { | 654 | if (!walk_state) { |
686 | return_PTR (NULL); | 655 | return_PTR(NULL); |
687 | } | 656 | } |
688 | 657 | ||
689 | walk_state->data_type = ACPI_DESC_TYPE_WALK; | 658 | walk_state->data_type = ACPI_DESC_TYPE_WALK; |
690 | walk_state->owner_id = owner_id; | 659 | walk_state->owner_id = owner_id; |
691 | walk_state->origin = origin; | 660 | walk_state->origin = origin; |
692 | walk_state->method_desc = mth_desc; | 661 | walk_state->method_desc = mth_desc; |
693 | walk_state->thread = thread; | 662 | walk_state->thread = thread; |
694 | 663 | ||
695 | walk_state->parser_state.start_op = origin; | 664 | walk_state->parser_state.start_op = origin; |
696 | 665 | ||
697 | /* Init the method args/local */ | 666 | /* Init the method args/local */ |
698 | 667 | ||
699 | #if (!defined (ACPI_NO_METHOD_EXECUTION) && !defined (ACPI_CONSTANT_EVAL_ONLY)) | 668 | #if (!defined (ACPI_NO_METHOD_EXECUTION) && !defined (ACPI_CONSTANT_EVAL_ONLY)) |
700 | acpi_ds_method_data_init (walk_state); | 669 | acpi_ds_method_data_init(walk_state); |
701 | #endif | 670 | #endif |
702 | 671 | ||
703 | /* Create an initial result stack entry */ | 672 | /* Create an initial result stack entry */ |
704 | 673 | ||
705 | status = acpi_ds_result_stack_push (walk_state); | 674 | status = acpi_ds_result_stack_push(walk_state); |
706 | if (ACPI_FAILURE (status)) { | 675 | if (ACPI_FAILURE(status)) { |
707 | ACPI_MEM_FREE (walk_state); | 676 | ACPI_MEM_FREE(walk_state); |
708 | return_PTR (NULL); | 677 | return_PTR(NULL); |
709 | } | 678 | } |
710 | 679 | ||
711 | /* Put the new state at the head of the walk list */ | 680 | /* Put the new state at the head of the walk list */ |
712 | 681 | ||
713 | if (thread) { | 682 | if (thread) { |
714 | acpi_ds_push_walk_state (walk_state, thread); | 683 | acpi_ds_push_walk_state(walk_state, thread); |
715 | } | 684 | } |
716 | 685 | ||
717 | return_PTR (walk_state); | 686 | return_PTR(walk_state); |
718 | } | 687 | } |
719 | 688 | ||
720 | |||
721 | /******************************************************************************* | 689 | /******************************************************************************* |
722 | * | 690 | * |
723 | * FUNCTION: acpi_ds_init_aml_walk | 691 | * FUNCTION: acpi_ds_init_aml_walk |
@@ -737,27 +705,23 @@ acpi_ds_create_walk_state ( | |||
737 | ******************************************************************************/ | 705 | ******************************************************************************/ |
738 | 706 | ||
739 | acpi_status | 707 | acpi_status |
740 | acpi_ds_init_aml_walk ( | 708 | acpi_ds_init_aml_walk(struct acpi_walk_state *walk_state, |
741 | struct acpi_walk_state *walk_state, | 709 | union acpi_parse_object *op, |
742 | union acpi_parse_object *op, | 710 | struct acpi_namespace_node *method_node, |
743 | struct acpi_namespace_node *method_node, | 711 | u8 * aml_start, |
744 | u8 *aml_start, | 712 | u32 aml_length, |
745 | u32 aml_length, | 713 | struct acpi_parameter_info *info, u8 pass_number) |
746 | struct acpi_parameter_info *info, | ||
747 | u8 pass_number) | ||
748 | { | 714 | { |
749 | acpi_status status; | 715 | acpi_status status; |
750 | struct acpi_parse_state *parser_state = &walk_state->parser_state; | 716 | struct acpi_parse_state *parser_state = &walk_state->parser_state; |
751 | union acpi_parse_object *extra_op; | 717 | union acpi_parse_object *extra_op; |
752 | |||
753 | 718 | ||
754 | ACPI_FUNCTION_TRACE ("ds_init_aml_walk"); | 719 | ACPI_FUNCTION_TRACE("ds_init_aml_walk"); |
755 | 720 | ||
756 | 721 | walk_state->parser_state.aml = | |
757 | walk_state->parser_state.aml = | 722 | walk_state->parser_state.aml_start = aml_start; |
758 | walk_state->parser_state.aml_start = aml_start; | ||
759 | walk_state->parser_state.aml_end = | 723 | walk_state->parser_state.aml_end = |
760 | walk_state->parser_state.pkg_end = aml_start + aml_length; | 724 | walk_state->parser_state.pkg_end = aml_start + aml_length; |
761 | 725 | ||
762 | /* The next_op of the next_walk will be the beginning of the method */ | 726 | /* The next_op of the next_walk will be the beginning of the method */ |
763 | 727 | ||
@@ -766,42 +730,45 @@ acpi_ds_init_aml_walk ( | |||
766 | 730 | ||
767 | if (info) { | 731 | if (info) { |
768 | if (info->parameter_type == ACPI_PARAM_GPE) { | 732 | if (info->parameter_type == ACPI_PARAM_GPE) { |
769 | walk_state->gpe_event_info = ACPI_CAST_PTR (struct acpi_gpe_event_info, | 733 | walk_state->gpe_event_info = |
770 | info->parameters); | 734 | ACPI_CAST_PTR(struct acpi_gpe_event_info, |
771 | } | 735 | info->parameters); |
772 | else { | 736 | } else { |
773 | walk_state->params = info->parameters; | 737 | walk_state->params = info->parameters; |
774 | walk_state->caller_return_desc = &info->return_object; | 738 | walk_state->caller_return_desc = &info->return_object; |
775 | } | 739 | } |
776 | } | 740 | } |
777 | 741 | ||
778 | status = acpi_ps_init_scope (&walk_state->parser_state, op); | 742 | status = acpi_ps_init_scope(&walk_state->parser_state, op); |
779 | if (ACPI_FAILURE (status)) { | 743 | if (ACPI_FAILURE(status)) { |
780 | return_ACPI_STATUS (status); | 744 | return_ACPI_STATUS(status); |
781 | } | 745 | } |
782 | 746 | ||
783 | if (method_node) { | 747 | if (method_node) { |
784 | walk_state->parser_state.start_node = method_node; | 748 | walk_state->parser_state.start_node = method_node; |
785 | walk_state->walk_type = ACPI_WALK_METHOD; | 749 | walk_state->walk_type = ACPI_WALK_METHOD; |
786 | walk_state->method_node = method_node; | 750 | walk_state->method_node = method_node; |
787 | walk_state->method_desc = acpi_ns_get_attached_object (method_node); | 751 | walk_state->method_desc = |
752 | acpi_ns_get_attached_object(method_node); | ||
788 | 753 | ||
789 | /* Push start scope on scope stack and make it current */ | 754 | /* Push start scope on scope stack and make it current */ |
790 | 755 | ||
791 | status = acpi_ds_scope_stack_push (method_node, ACPI_TYPE_METHOD, walk_state); | 756 | status = |
792 | if (ACPI_FAILURE (status)) { | 757 | acpi_ds_scope_stack_push(method_node, ACPI_TYPE_METHOD, |
793 | return_ACPI_STATUS (status); | 758 | walk_state); |
759 | if (ACPI_FAILURE(status)) { | ||
760 | return_ACPI_STATUS(status); | ||
794 | } | 761 | } |
795 | 762 | ||
796 | /* Init the method arguments */ | 763 | /* Init the method arguments */ |
797 | 764 | ||
798 | status = acpi_ds_method_data_init_args (walk_state->params, | 765 | status = acpi_ds_method_data_init_args(walk_state->params, |
799 | ACPI_METHOD_NUM_ARGS, walk_state); | 766 | ACPI_METHOD_NUM_ARGS, |
800 | if (ACPI_FAILURE (status)) { | 767 | walk_state); |
801 | return_ACPI_STATUS (status); | 768 | if (ACPI_FAILURE(status)) { |
769 | return_ACPI_STATUS(status); | ||
802 | } | 770 | } |
803 | } | 771 | } else { |
804 | else { | ||
805 | /* | 772 | /* |
806 | * Setup the current scope. | 773 | * Setup the current scope. |
807 | * Find a Named Op that has a namespace node associated with it. | 774 | * Find a Named Op that has a namespace node associated with it. |
@@ -815,27 +782,27 @@ acpi_ds_init_aml_walk ( | |||
815 | 782 | ||
816 | if (!extra_op) { | 783 | if (!extra_op) { |
817 | parser_state->start_node = NULL; | 784 | parser_state->start_node = NULL; |
818 | } | 785 | } else { |
819 | else { | ||
820 | parser_state->start_node = extra_op->common.node; | 786 | parser_state->start_node = extra_op->common.node; |
821 | } | 787 | } |
822 | 788 | ||
823 | if (parser_state->start_node) { | 789 | if (parser_state->start_node) { |
824 | /* Push start scope on scope stack and make it current */ | 790 | /* Push start scope on scope stack and make it current */ |
825 | 791 | ||
826 | status = acpi_ds_scope_stack_push (parser_state->start_node, | 792 | status = |
827 | parser_state->start_node->type, walk_state); | 793 | acpi_ds_scope_stack_push(parser_state->start_node, |
828 | if (ACPI_FAILURE (status)) { | 794 | parser_state->start_node-> |
829 | return_ACPI_STATUS (status); | 795 | type, walk_state); |
796 | if (ACPI_FAILURE(status)) { | ||
797 | return_ACPI_STATUS(status); | ||
830 | } | 798 | } |
831 | } | 799 | } |
832 | } | 800 | } |
833 | 801 | ||
834 | status = acpi_ds_init_callbacks (walk_state, pass_number); | 802 | status = acpi_ds_init_callbacks(walk_state, pass_number); |
835 | return_ACPI_STATUS (status); | 803 | return_ACPI_STATUS(status); |
836 | } | 804 | } |
837 | 805 | ||
838 | |||
839 | /******************************************************************************* | 806 | /******************************************************************************* |
840 | * | 807 | * |
841 | * FUNCTION: acpi_ds_delete_walk_state | 808 | * FUNCTION: acpi_ds_delete_walk_state |
@@ -848,29 +815,27 @@ acpi_ds_init_aml_walk ( | |||
848 | * | 815 | * |
849 | ******************************************************************************/ | 816 | ******************************************************************************/ |
850 | 817 | ||
851 | void | 818 | void acpi_ds_delete_walk_state(struct acpi_walk_state *walk_state) |
852 | acpi_ds_delete_walk_state ( | ||
853 | struct acpi_walk_state *walk_state) | ||
854 | { | 819 | { |
855 | union acpi_generic_state *state; | 820 | union acpi_generic_state *state; |
856 | |||
857 | |||
858 | ACPI_FUNCTION_TRACE_PTR ("ds_delete_walk_state", walk_state); | ||
859 | 821 | ||
822 | ACPI_FUNCTION_TRACE_PTR("ds_delete_walk_state", walk_state); | ||
860 | 823 | ||
861 | if (!walk_state) { | 824 | if (!walk_state) { |
862 | return; | 825 | return; |
863 | } | 826 | } |
864 | 827 | ||
865 | if (walk_state->data_type != ACPI_DESC_TYPE_WALK) { | 828 | if (walk_state->data_type != ACPI_DESC_TYPE_WALK) { |
866 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%p is not a valid walk state\n", | 829 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
867 | walk_state)); | 830 | "%p is not a valid walk state\n", |
831 | walk_state)); | ||
868 | return; | 832 | return; |
869 | } | 833 | } |
870 | 834 | ||
871 | if (walk_state->parser_state.scope) { | 835 | if (walk_state->parser_state.scope) { |
872 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%p walk still has a scope list\n", | 836 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
873 | walk_state)); | 837 | "%p walk still has a scope list\n", |
838 | walk_state)); | ||
874 | } | 839 | } |
875 | 840 | ||
876 | /* Always must free any linked control states */ | 841 | /* Always must free any linked control states */ |
@@ -879,7 +844,7 @@ acpi_ds_delete_walk_state ( | |||
879 | state = walk_state->control_state; | 844 | state = walk_state->control_state; |
880 | walk_state->control_state = state->common.next; | 845 | walk_state->control_state = state->common.next; |
881 | 846 | ||
882 | acpi_ut_delete_generic_state (state); | 847 | acpi_ut_delete_generic_state(state); |
883 | } | 848 | } |
884 | 849 | ||
885 | /* Always must free any linked parse states */ | 850 | /* Always must free any linked parse states */ |
@@ -888,7 +853,7 @@ acpi_ds_delete_walk_state ( | |||
888 | state = walk_state->scope_info; | 853 | state = walk_state->scope_info; |
889 | walk_state->scope_info = state->common.next; | 854 | walk_state->scope_info = state->common.next; |
890 | 855 | ||
891 | acpi_ut_delete_generic_state (state); | 856 | acpi_ut_delete_generic_state(state); |
892 | } | 857 | } |
893 | 858 | ||
894 | /* Always must free any stacked result states */ | 859 | /* Always must free any stacked result states */ |
@@ -897,14 +862,13 @@ acpi_ds_delete_walk_state ( | |||
897 | state = walk_state->results; | 862 | state = walk_state->results; |
898 | walk_state->results = state->common.next; | 863 | walk_state->results = state->common.next; |
899 | 864 | ||
900 | acpi_ut_delete_generic_state (state); | 865 | acpi_ut_delete_generic_state(state); |
901 | } | 866 | } |
902 | 867 | ||
903 | ACPI_MEM_FREE (walk_state); | 868 | ACPI_MEM_FREE(walk_state); |
904 | return_VOID; | 869 | return_VOID; |
905 | } | 870 | } |
906 | 871 | ||
907 | |||
908 | #ifdef ACPI_OBSOLETE_FUNCTIONS | 872 | #ifdef ACPI_OBSOLETE_FUNCTIONS |
909 | /******************************************************************************* | 873 | /******************************************************************************* |
910 | * | 874 | * |
@@ -921,50 +885,53 @@ acpi_ds_delete_walk_state ( | |||
921 | ******************************************************************************/ | 885 | ******************************************************************************/ |
922 | 886 | ||
923 | acpi_status | 887 | acpi_status |
924 | acpi_ds_result_insert ( | 888 | acpi_ds_result_insert(void *object, |
925 | void *object, | 889 | u32 index, struct acpi_walk_state *walk_state) |
926 | u32 index, | ||
927 | struct acpi_walk_state *walk_state) | ||
928 | { | 890 | { |
929 | union acpi_generic_state *state; | 891 | union acpi_generic_state *state; |
930 | |||
931 | |||
932 | ACPI_FUNCTION_NAME ("ds_result_insert"); | ||
933 | 892 | ||
893 | ACPI_FUNCTION_NAME("ds_result_insert"); | ||
934 | 894 | ||
935 | state = walk_state->results; | 895 | state = walk_state->results; |
936 | if (!state) { | 896 | if (!state) { |
937 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result object pushed! State=%p\n", | 897 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
938 | walk_state)); | 898 | "No result object pushed! State=%p\n", |
899 | walk_state)); | ||
939 | return (AE_NOT_EXIST); | 900 | return (AE_NOT_EXIST); |
940 | } | 901 | } |
941 | 902 | ||
942 | if (index >= ACPI_OBJ_NUM_OPERANDS) { | 903 | if (index >= ACPI_OBJ_NUM_OPERANDS) { |
943 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 904 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
944 | "Index out of range: %X Obj=%p State=%p Num=%X\n", | 905 | "Index out of range: %X Obj=%p State=%p Num=%X\n", |
945 | index, object, walk_state, state->results.num_results)); | 906 | index, object, walk_state, |
907 | state->results.num_results)); | ||
946 | return (AE_BAD_PARAMETER); | 908 | return (AE_BAD_PARAMETER); |
947 | } | 909 | } |
948 | 910 | ||
949 | if (!object) { | 911 | if (!object) { |
950 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 912 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
951 | "Null Object! Index=%X Obj=%p State=%p Num=%X\n", | 913 | "Null Object! Index=%X Obj=%p State=%p Num=%X\n", |
952 | index, object, walk_state, state->results.num_results)); | 914 | index, object, walk_state, |
915 | state->results.num_results)); | ||
953 | return (AE_BAD_PARAMETER); | 916 | return (AE_BAD_PARAMETER); |
954 | } | 917 | } |
955 | 918 | ||
956 | state->results.obj_desc [index] = object; | 919 | state->results.obj_desc[index] = object; |
957 | state->results.num_results++; | 920 | state->results.num_results++; |
958 | 921 | ||
959 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, | 922 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
960 | "Obj=%p [%s] State=%p Num=%X Cur=%X\n", | 923 | "Obj=%p [%s] State=%p Num=%X Cur=%X\n", |
961 | object, object ? acpi_ut_get_object_type_name ((union acpi_operand_object *) object) : "NULL", | 924 | object, |
962 | walk_state, state->results.num_results, walk_state->current_result)); | 925 | object ? |
926 | acpi_ut_get_object_type_name((union | ||
927 | acpi_operand_object *) | ||
928 | object) : "NULL", | ||
929 | walk_state, state->results.num_results, | ||
930 | walk_state->current_result)); | ||
963 | 931 | ||
964 | return (AE_OK); | 932 | return (AE_OK); |
965 | } | 933 | } |
966 | 934 | ||
967 | |||
968 | /******************************************************************************* | 935 | /******************************************************************************* |
969 | * | 936 | * |
970 | * FUNCTION: acpi_ds_obj_stack_delete_all | 937 | * FUNCTION: acpi_ds_obj_stack_delete_all |
@@ -978,29 +945,24 @@ acpi_ds_result_insert ( | |||
978 | * | 945 | * |
979 | ******************************************************************************/ | 946 | ******************************************************************************/ |
980 | 947 | ||
981 | acpi_status | 948 | acpi_status acpi_ds_obj_stack_delete_all(struct acpi_walk_state * walk_state) |
982 | acpi_ds_obj_stack_delete_all ( | ||
983 | struct acpi_walk_state *walk_state) | ||
984 | { | 949 | { |
985 | u32 i; | 950 | u32 i; |
986 | |||
987 | |||
988 | ACPI_FUNCTION_TRACE_PTR ("ds_obj_stack_delete_all", walk_state); | ||
989 | 951 | ||
952 | ACPI_FUNCTION_TRACE_PTR("ds_obj_stack_delete_all", walk_state); | ||
990 | 953 | ||
991 | /* The stack size is configurable, but fixed */ | 954 | /* The stack size is configurable, but fixed */ |
992 | 955 | ||
993 | for (i = 0; i < ACPI_OBJ_NUM_OPERANDS; i++) { | 956 | for (i = 0; i < ACPI_OBJ_NUM_OPERANDS; i++) { |
994 | if (walk_state->operands[i]) { | 957 | if (walk_state->operands[i]) { |
995 | acpi_ut_remove_reference (walk_state->operands[i]); | 958 | acpi_ut_remove_reference(walk_state->operands[i]); |
996 | walk_state->operands[i] = NULL; | 959 | walk_state->operands[i] = NULL; |
997 | } | 960 | } |
998 | } | 961 | } |
999 | 962 | ||
1000 | return_ACPI_STATUS (AE_OK); | 963 | return_ACPI_STATUS(AE_OK); |
1001 | } | 964 | } |
1002 | 965 | ||
1003 | |||
1004 | /******************************************************************************* | 966 | /******************************************************************************* |
1005 | * | 967 | * |
1006 | * FUNCTION: acpi_ds_obj_stack_pop_object | 968 | * FUNCTION: acpi_ds_obj_stack_pop_object |
@@ -1016,19 +978,17 @@ acpi_ds_obj_stack_delete_all ( | |||
1016 | ******************************************************************************/ | 978 | ******************************************************************************/ |
1017 | 979 | ||
1018 | acpi_status | 980 | acpi_status |
1019 | acpi_ds_obj_stack_pop_object ( | 981 | acpi_ds_obj_stack_pop_object(union acpi_operand_object **object, |
1020 | union acpi_operand_object **object, | 982 | struct acpi_walk_state *walk_state) |
1021 | struct acpi_walk_state *walk_state) | ||
1022 | { | 983 | { |
1023 | ACPI_FUNCTION_NAME ("ds_obj_stack_pop_object"); | 984 | ACPI_FUNCTION_NAME("ds_obj_stack_pop_object"); |
1024 | |||
1025 | 985 | ||
1026 | /* Check for stack underflow */ | 986 | /* Check for stack underflow */ |
1027 | 987 | ||
1028 | if (walk_state->num_operands == 0) { | 988 | if (walk_state->num_operands == 0) { |
1029 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 989 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
1030 | "Missing operand/stack empty! State=%p #Ops=%X\n", | 990 | "Missing operand/stack empty! State=%p #Ops=%X\n", |
1031 | walk_state, walk_state->num_operands)); | 991 | walk_state, walk_state->num_operands)); |
1032 | *object = NULL; | 992 | *object = NULL; |
1033 | return (AE_AML_NO_OPERAND); | 993 | return (AE_AML_NO_OPERAND); |
1034 | } | 994 | } |
@@ -1039,27 +999,26 @@ acpi_ds_obj_stack_pop_object ( | |||
1039 | 999 | ||
1040 | /* Check for a valid operand */ | 1000 | /* Check for a valid operand */ |
1041 | 1001 | ||
1042 | if (!walk_state->operands [walk_state->num_operands]) { | 1002 | if (!walk_state->operands[walk_state->num_operands]) { |
1043 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 1003 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
1044 | "Null operand! State=%p #Ops=%X\n", | 1004 | "Null operand! State=%p #Ops=%X\n", |
1045 | walk_state, walk_state->num_operands)); | 1005 | walk_state, walk_state->num_operands)); |
1046 | *object = NULL; | 1006 | *object = NULL; |
1047 | return (AE_AML_NO_OPERAND); | 1007 | return (AE_AML_NO_OPERAND); |
1048 | } | 1008 | } |
1049 | 1009 | ||
1050 | /* Get operand and set stack entry to null */ | 1010 | /* Get operand and set stack entry to null */ |
1051 | 1011 | ||
1052 | *object = walk_state->operands [walk_state->num_operands]; | 1012 | *object = walk_state->operands[walk_state->num_operands]; |
1053 | walk_state->operands [walk_state->num_operands] = NULL; | 1013 | walk_state->operands[walk_state->num_operands] = NULL; |
1054 | 1014 | ||
1055 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] State=%p #Ops=%X\n", | 1015 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Obj=%p [%s] State=%p #Ops=%X\n", |
1056 | *object, acpi_ut_get_object_type_name (*object), | 1016 | *object, acpi_ut_get_object_type_name(*object), |
1057 | walk_state, walk_state->num_operands)); | 1017 | walk_state, walk_state->num_operands)); |
1058 | 1018 | ||
1059 | return (AE_OK); | 1019 | return (AE_OK); |
1060 | } | 1020 | } |
1061 | 1021 | ||
1062 | |||
1063 | /******************************************************************************* | 1022 | /******************************************************************************* |
1064 | * | 1023 | * |
1065 | * FUNCTION: acpi_ds_obj_stack_get_value | 1024 | * FUNCTION: acpi_ds_obj_stack_get_value |
@@ -1075,30 +1034,25 @@ acpi_ds_obj_stack_pop_object ( | |||
1075 | * | 1034 | * |
1076 | ******************************************************************************/ | 1035 | ******************************************************************************/ |
1077 | 1036 | ||
1078 | void * | 1037 | void *acpi_ds_obj_stack_get_value(u32 index, struct acpi_walk_state *walk_state) |
1079 | acpi_ds_obj_stack_get_value ( | ||
1080 | u32 index, | ||
1081 | struct acpi_walk_state *walk_state) | ||
1082 | { | 1038 | { |
1083 | 1039 | ||
1084 | ACPI_FUNCTION_TRACE_PTR ("ds_obj_stack_get_value", walk_state); | 1040 | ACPI_FUNCTION_TRACE_PTR("ds_obj_stack_get_value", walk_state); |
1085 | |||
1086 | 1041 | ||
1087 | /* Can't do it if the stack is empty */ | 1042 | /* Can't do it if the stack is empty */ |
1088 | 1043 | ||
1089 | if (walk_state->num_operands == 0) { | 1044 | if (walk_state->num_operands == 0) { |
1090 | return_PTR (NULL); | 1045 | return_PTR(NULL); |
1091 | } | 1046 | } |
1092 | 1047 | ||
1093 | /* or if the index is past the top of the stack */ | 1048 | /* or if the index is past the top of the stack */ |
1094 | 1049 | ||
1095 | if (index > (walk_state->num_operands - (u32) 1)) { | 1050 | if (index > (walk_state->num_operands - (u32) 1)) { |
1096 | return_PTR (NULL); | 1051 | return_PTR(NULL); |
1097 | } | 1052 | } |
1098 | 1053 | ||
1099 | return_PTR (walk_state->operands[(acpi_native_uint)(walk_state->num_operands - 1) - | 1054 | return_PTR(walk_state-> |
1100 | index]); | 1055 | operands[(acpi_native_uint) (walk_state->num_operands - 1) - |
1056 | index]); | ||
1101 | } | 1057 | } |
1102 | #endif | 1058 | #endif |
1103 | |||
1104 | |||