diff options
Diffstat (limited to 'drivers/acpi/dispatcher/dsobject.c')
-rw-r--r-- | drivers/acpi/dispatcher/dsobject.c | 329 |
1 files changed, 157 insertions, 172 deletions
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 | |||