aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/dispatcher/dsmthdat.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/dispatcher/dsmthdat.c')
-rw-r--r--drivers/acpi/dispatcher/dsmthdat.c413
1 files changed, 194 insertions, 219 deletions
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") 51ACPI_MODULE_NAME("dsmthdat")
54 52
55/* Local prototypes */ 53/* Local prototypes */
56
57static void 54static void
58acpi_ds_method_data_delete_value ( 55acpi_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
63static acpi_status 58static acpi_status
64acpi_ds_method_data_set_value ( 59acpi_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
71acpi_object_type 65acpi_object_type
72acpi_ds_method_data_get_type ( 66acpi_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
100void 91void acpi_ds_method_data_init(struct acpi_walk_state *walk_state)
101acpi_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
152void 139void acpi_ds_method_data_delete_all(struct acpi_walk_state *walk_state)
153acpi_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
208acpi_status 194acpi_status
209acpi_ds_method_data_init_args ( 195acpi_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
265acpi_status 248acpi_status
266acpi_ds_method_data_get_node ( 249acpi_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
332static acpi_status 313static acpi_status
333acpi_ds_method_data_set_value ( 314acpi_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
389acpi_status 366acpi_status
390acpi_ds_method_data_get_value ( 367acpi_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
496static void 473static void
497acpi_ds_method_data_delete_value ( 474acpi_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
559acpi_status 531acpi_status
560acpi_ds_store_object_to_local ( 532acpi_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
703acpi_object_type 684acpi_object_type
704acpi_ds_method_data_get_type ( 685acpi_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