aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/executer/exstore.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/executer/exstore.c')
-rw-r--r--drivers/acpi/executer/exstore.c415
1 files changed, 208 insertions, 207 deletions
diff --git a/drivers/acpi/executer/exstore.c b/drivers/acpi/executer/exstore.c
index 59dbfeaa54c0..a7d8eea305c2 100644
--- a/drivers/acpi/executer/exstore.c
+++ b/drivers/acpi/executer/exstore.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/acdispat.h> 46#include <acpi/acdispat.h>
48#include <acpi/acinterp.h> 47#include <acpi/acinterp.h>
@@ -50,24 +49,18 @@
50#include <acpi/acnamesp.h> 49#include <acpi/acnamesp.h>
51#include <acpi/acparser.h> 50#include <acpi/acparser.h>
52 51
53
54#define _COMPONENT ACPI_EXECUTER 52#define _COMPONENT ACPI_EXECUTER
55 ACPI_MODULE_NAME ("exstore") 53ACPI_MODULE_NAME("exstore")
56 54
57/* Local prototypes */ 55/* Local prototypes */
58
59static void 56static void
60acpi_ex_do_debug_object ( 57acpi_ex_do_debug_object(union acpi_operand_object *source_desc,
61 union acpi_operand_object *source_desc, 58 u32 level, u32 index);
62 u32 level,
63 u32 index);
64 59
65static acpi_status 60static acpi_status
66acpi_ex_store_object_to_index ( 61acpi_ex_store_object_to_index(union acpi_operand_object *val_desc,
67 union acpi_operand_object *val_desc, 62 union acpi_operand_object *dest_desc,
68 union acpi_operand_object *dest_desc, 63 struct acpi_walk_state *walk_state);
69 struct acpi_walk_state *walk_state);
70
71 64
72/******************************************************************************* 65/*******************************************************************************
73 * 66 *
@@ -84,136 +77,146 @@ acpi_ex_store_object_to_index (
84 ******************************************************************************/ 77 ******************************************************************************/
85 78
86static void 79static void
87acpi_ex_do_debug_object ( 80acpi_ex_do_debug_object(union acpi_operand_object *source_desc,
88 union acpi_operand_object *source_desc, 81 u32 level, u32 index)
89 u32 level,
90 u32 index)
91{ 82{
92 u32 i; 83 u32 i;
93
94 84
95 ACPI_FUNCTION_TRACE_PTR ("ex_do_debug_object", source_desc); 85 ACPI_FUNCTION_TRACE_PTR("ex_do_debug_object", source_desc);
96 86
97 87 ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "[ACPI Debug] %*s",
98 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[ACPI Debug] %*s", 88 level, " "));
99 level, " "));
100 89
101 /* Display index for package output only */ 90 /* Display index for package output only */
102 91
103 if (index > 0) { 92 if (index > 0) {
104 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, 93 ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT,
105 "(%.2u) ", index -1)); 94 "(%.2u) ", index - 1));
106 } 95 }
107 96
108 if (!source_desc) { 97 if (!source_desc) {
109 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "<Null Object>\n")); 98 ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "<Null Object>\n"));
110 return_VOID; 99 return_VOID;
111 } 100 }
112 101
113 if (ACPI_GET_DESCRIPTOR_TYPE (source_desc) == ACPI_DESC_TYPE_OPERAND) { 102 if (ACPI_GET_DESCRIPTOR_TYPE(source_desc) == ACPI_DESC_TYPE_OPERAND) {
114 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%s: ", 103 ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "%s: ",
115 acpi_ut_get_object_type_name (source_desc))); 104 acpi_ut_get_object_type_name
105 (source_desc)));
116 106
117 if (!acpi_ut_valid_internal_object (source_desc)) { 107 if (!acpi_ut_valid_internal_object(source_desc)) {
118 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, 108 ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT,
119 "%p, Invalid Internal Object!\n", source_desc)); 109 "%p, Invalid Internal Object!\n",
120 return_VOID; 110 source_desc));
111 return_VOID;
121 } 112 }
122 } 113 } else if (ACPI_GET_DESCRIPTOR_TYPE(source_desc) ==
123 else if (ACPI_GET_DESCRIPTOR_TYPE (source_desc) == ACPI_DESC_TYPE_NAMED) { 114 ACPI_DESC_TYPE_NAMED) {
124 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%s: %p\n", 115 ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "%s: %p\n",
125 acpi_ut_get_type_name (((struct acpi_namespace_node *) source_desc)->type), 116 acpi_ut_get_type_name(((struct
126 source_desc)); 117 acpi_namespace_node
118 *)source_desc)->
119 type),
120 source_desc));
127 return_VOID; 121 return_VOID;
128 } 122 } else {
129 else {
130 return_VOID; 123 return_VOID;
131 } 124 }
132 125
133 switch (ACPI_GET_OBJECT_TYPE (source_desc)) { 126 switch (ACPI_GET_OBJECT_TYPE(source_desc)) {
134 case ACPI_TYPE_INTEGER: 127 case ACPI_TYPE_INTEGER:
135 128
136 /* Output correct integer width */ 129 /* Output correct integer width */
137 130
138 if (acpi_gbl_integer_byte_width == 4) { 131 if (acpi_gbl_integer_byte_width == 4) {
139 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "0x%8.8X\n", 132 ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "0x%8.8X\n",
140 (u32) source_desc->integer.value)); 133 (u32) source_desc->integer.
141 } 134 value));
142 else { 135 } else {
143 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "0x%8.8X%8.8X\n", 136 ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT,
144 ACPI_FORMAT_UINT64 (source_desc->integer.value))); 137 "0x%8.8X%8.8X\n",
138 ACPI_FORMAT_UINT64(source_desc->
139 integer.
140 value)));
145 } 141 }
146 break; 142 break;
147 143
148 case ACPI_TYPE_BUFFER: 144 case ACPI_TYPE_BUFFER:
149 145
150 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X]\n", 146 ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "[0x%.2X]\n",
151 (u32) source_desc->buffer.length)); 147 (u32) source_desc->buffer.length));
152 ACPI_DUMP_BUFFER (source_desc->buffer.pointer, 148 ACPI_DUMP_BUFFER(source_desc->buffer.pointer,
153 (source_desc->buffer.length < 32) ? source_desc->buffer.length : 32); 149 (source_desc->buffer.length <
150 32) ? source_desc->buffer.length : 32);
154 break; 151 break;
155 152
156 case ACPI_TYPE_STRING: 153 case ACPI_TYPE_STRING:
157 154
158 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X] \"%s\"\n", 155 ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "[0x%.2X] \"%s\"\n",
159 source_desc->string.length, source_desc->string.pointer)); 156 source_desc->string.length,
157 source_desc->string.pointer));
160 break; 158 break;
161 159
162 case ACPI_TYPE_PACKAGE: 160 case ACPI_TYPE_PACKAGE:
163 161
164 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X Elements]\n", 162 ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT,
165 source_desc->package.count)); 163 "[0x%.2X Elements]\n",
164 source_desc->package.count));
166 165
167 /* Output the entire contents of the package */ 166 /* Output the entire contents of the package */
168 167
169 for (i = 0; i < source_desc->package.count; i++) { 168 for (i = 0; i < source_desc->package.count; i++) {
170 acpi_ex_do_debug_object (source_desc->package.elements[i], 169 acpi_ex_do_debug_object(source_desc->package.
171 level+4, i+1); 170 elements[i], level + 4, i + 1);
172 } 171 }
173 break; 172 break;
174 173
175 case ACPI_TYPE_LOCAL_REFERENCE: 174 case ACPI_TYPE_LOCAL_REFERENCE:
176 175
177 if (source_desc->reference.opcode == AML_INDEX_OP) { 176 if (source_desc->reference.opcode == AML_INDEX_OP) {
178 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[%s, 0x%X]\n", 177 ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT,
179 acpi_ps_get_opcode_name (source_desc->reference.opcode), 178 "[%s, 0x%X]\n",
180 source_desc->reference.offset)); 179 acpi_ps_get_opcode_name
180 (source_desc->reference.opcode),
181 source_desc->reference.offset));
182 } else {
183 ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "[%s]\n",
184 acpi_ps_get_opcode_name
185 (source_desc->reference.opcode)));
181 } 186 }
182 else {
183 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[%s]\n",
184 acpi_ps_get_opcode_name (source_desc->reference.opcode)));
185 }
186
187 187
188 if (source_desc->reference.object) { 188 if (source_desc->reference.object) {
189 if (ACPI_GET_DESCRIPTOR_TYPE (source_desc->reference.object) == 189 if (ACPI_GET_DESCRIPTOR_TYPE
190 ACPI_DESC_TYPE_NAMED) { 190 (source_desc->reference.object) ==
191 acpi_ex_do_debug_object (((struct acpi_namespace_node *) 191 ACPI_DESC_TYPE_NAMED) {
192 source_desc->reference.object)->object, 192 acpi_ex_do_debug_object(((struct
193 level+4, 0); 193 acpi_namespace_node *)
194 source_desc->reference.
195 object)->object,
196 level + 4, 0);
197 } else {
198 acpi_ex_do_debug_object(source_desc->reference.
199 object, level + 4, 0);
194 } 200 }
195 else { 201 } else if (source_desc->reference.node) {
196 acpi_ex_do_debug_object (source_desc->reference.object, level+4, 0); 202 acpi_ex_do_debug_object((source_desc->reference.node)->
197 } 203 object, level + 4, 0);
198 }
199 else if (source_desc->reference.node) {
200 acpi_ex_do_debug_object ((source_desc->reference.node)->object,
201 level+4, 0);
202 } 204 }
203 break; 205 break;
204 206
205 default: 207 default:
206 208
207 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%p %s\n", 209 ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "%p %s\n",
208 source_desc, acpi_ut_get_object_type_name (source_desc))); 210 source_desc,
211 acpi_ut_get_object_type_name
212 (source_desc)));
209 break; 213 break;
210 } 214 }
211 215
212 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC, "\n")); 216 ACPI_DEBUG_PRINT_RAW((ACPI_DB_EXEC, "\n"));
213 return_VOID; 217 return_VOID;
214} 218}
215 219
216
217/******************************************************************************* 220/*******************************************************************************
218 * 221 *
219 * FUNCTION: acpi_ex_store 222 * FUNCTION: acpi_ex_store
@@ -235,42 +238,41 @@ acpi_ex_do_debug_object (
235 ******************************************************************************/ 238 ******************************************************************************/
236 239
237acpi_status 240acpi_status
238acpi_ex_store ( 241acpi_ex_store(union acpi_operand_object *source_desc,
239 union acpi_operand_object *source_desc, 242 union acpi_operand_object *dest_desc,
240 union acpi_operand_object *dest_desc, 243 struct acpi_walk_state *walk_state)
241 struct acpi_walk_state *walk_state)
242{ 244{
243 acpi_status status = AE_OK; 245 acpi_status status = AE_OK;
244 union acpi_operand_object *ref_desc = dest_desc; 246 union acpi_operand_object *ref_desc = dest_desc;
245
246
247 ACPI_FUNCTION_TRACE_PTR ("ex_store", dest_desc);
248 247
248 ACPI_FUNCTION_TRACE_PTR("ex_store", dest_desc);
249 249
250 /* Validate parameters */ 250 /* Validate parameters */
251 251
252 if (!source_desc || !dest_desc) { 252 if (!source_desc || !dest_desc) {
253 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null parameter\n")); 253 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Null parameter\n"));
254 return_ACPI_STATUS (AE_AML_NO_OPERAND); 254 return_ACPI_STATUS(AE_AML_NO_OPERAND);
255 } 255 }
256 256
257 /* dest_desc can be either a namespace node or an ACPI object */ 257 /* dest_desc can be either a namespace node or an ACPI object */
258 258
259 if (ACPI_GET_DESCRIPTOR_TYPE (dest_desc) == ACPI_DESC_TYPE_NAMED) { 259 if (ACPI_GET_DESCRIPTOR_TYPE(dest_desc) == ACPI_DESC_TYPE_NAMED) {
260 /* 260 /*
261 * Dest is a namespace node, 261 * Dest is a namespace node,
262 * Storing an object into a Named node. 262 * Storing an object into a Named node.
263 */ 263 */
264 status = acpi_ex_store_object_to_node (source_desc, 264 status = acpi_ex_store_object_to_node(source_desc,
265 (struct acpi_namespace_node *) dest_desc, walk_state, 265 (struct
266 ACPI_IMPLICIT_CONVERSION); 266 acpi_namespace_node *)
267 dest_desc, walk_state,
268 ACPI_IMPLICIT_CONVERSION);
267 269
268 return_ACPI_STATUS (status); 270 return_ACPI_STATUS(status);
269 } 271 }
270 272
271 /* Destination object must be a Reference or a Constant object */ 273 /* Destination object must be a Reference or a Constant object */
272 274
273 switch (ACPI_GET_OBJECT_TYPE (dest_desc)) { 275 switch (ACPI_GET_OBJECT_TYPE(dest_desc)) {
274 case ACPI_TYPE_LOCAL_REFERENCE: 276 case ACPI_TYPE_LOCAL_REFERENCE:
275 break; 277 break;
276 278
@@ -279,7 +281,7 @@ acpi_ex_store (
279 /* Allow stores to Constants -- a Noop as per ACPI spec */ 281 /* Allow stores to Constants -- a Noop as per ACPI spec */
280 282
281 if (dest_desc->common.flags & AOPOBJ_AML_CONSTANT) { 283 if (dest_desc->common.flags & AOPOBJ_AML_CONSTANT) {
282 return_ACPI_STATUS (AE_OK); 284 return_ACPI_STATUS(AE_OK);
283 } 285 }
284 286
285 /*lint -fallthrough */ 287 /*lint -fallthrough */
@@ -288,16 +290,18 @@ acpi_ex_store (
288 290
289 /* Destination is not a Reference object */ 291 /* Destination is not a Reference object */
290 292
291 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 293 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
292 "Target is not a Reference or Constant object - %s [%p]\n", 294 "Target is not a Reference or Constant object - %s [%p]\n",
293 acpi_ut_get_object_type_name (dest_desc), dest_desc)); 295 acpi_ut_get_object_type_name(dest_desc),
296 dest_desc));
294 297
295 ACPI_DUMP_STACK_ENTRY (source_desc); 298 ACPI_DUMP_STACK_ENTRY(source_desc);
296 ACPI_DUMP_STACK_ENTRY (dest_desc); 299 ACPI_DUMP_STACK_ENTRY(dest_desc);
297 ACPI_DUMP_OPERANDS (&dest_desc, ACPI_IMODE_EXECUTE, "ex_store", 300 ACPI_DUMP_OPERANDS(&dest_desc, ACPI_IMODE_EXECUTE, "ex_store",
298 2, "Target is not a Reference or Constant object"); 301 2,
302 "Target is not a Reference or Constant object");
299 303
300 return_ACPI_STATUS (AE_AML_OPERAND_TYPE); 304 return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
301 } 305 }
302 306
303 /* 307 /*
@@ -314,58 +318,59 @@ acpi_ex_store (
314 318
315 /* Storing an object into a Name "container" */ 319 /* Storing an object into a Name "container" */
316 320
317 status = acpi_ex_store_object_to_node (source_desc, 321 status = acpi_ex_store_object_to_node(source_desc,
318 ref_desc->reference.object, 322 ref_desc->reference.
319 walk_state, ACPI_IMPLICIT_CONVERSION); 323 object, walk_state,
324 ACPI_IMPLICIT_CONVERSION);
320 break; 325 break;
321 326
322
323 case AML_INDEX_OP: 327 case AML_INDEX_OP:
324 328
325 /* Storing to an Index (pointer into a packager or buffer) */ 329 /* Storing to an Index (pointer into a packager or buffer) */
326 330
327 status = acpi_ex_store_object_to_index (source_desc, ref_desc, walk_state); 331 status =
332 acpi_ex_store_object_to_index(source_desc, ref_desc,
333 walk_state);
328 break; 334 break;
329 335
330
331 case AML_LOCAL_OP: 336 case AML_LOCAL_OP:
332 case AML_ARG_OP: 337 case AML_ARG_OP:
333 338
334 /* Store to a method local/arg */ 339 /* Store to a method local/arg */
335 340
336 status = acpi_ds_store_object_to_local (ref_desc->reference.opcode, 341 status =
337 ref_desc->reference.offset, source_desc, walk_state); 342 acpi_ds_store_object_to_local(ref_desc->reference.opcode,
343 ref_desc->reference.offset,
344 source_desc, walk_state);
338 break; 345 break;
339 346
340
341 case AML_DEBUG_OP: 347 case AML_DEBUG_OP:
342 348
343 /* 349 /*
344 * Storing to the Debug object causes the value stored to be 350 * Storing to the Debug object causes the value stored to be
345 * displayed and otherwise has no effect -- see ACPI Specification 351 * displayed and otherwise has no effect -- see ACPI Specification
346 */ 352 */
347 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, 353 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
348 "**** Write to Debug Object: Object %p %s ****:\n\n", 354 "**** Write to Debug Object: Object %p %s ****:\n\n",
349 source_desc, acpi_ut_get_object_type_name (source_desc))); 355 source_desc,
356 acpi_ut_get_object_type_name(source_desc)));
350 357
351 acpi_ex_do_debug_object (source_desc, 0, 0); 358 acpi_ex_do_debug_object(source_desc, 0, 0);
352 break; 359 break;
353 360
354
355 default: 361 default:
356 362
357 ACPI_REPORT_ERROR (("ex_store: Unknown Reference opcode %X\n", 363 ACPI_REPORT_ERROR(("ex_store: Unknown Reference opcode %X\n",
358 ref_desc->reference.opcode)); 364 ref_desc->reference.opcode));
359 ACPI_DUMP_ENTRY (ref_desc, ACPI_LV_ERROR); 365 ACPI_DUMP_ENTRY(ref_desc, ACPI_LV_ERROR);
360 366
361 status = AE_AML_INTERNAL; 367 status = AE_AML_INTERNAL;
362 break; 368 break;
363 } 369 }
364 370
365 return_ACPI_STATUS (status); 371 return_ACPI_STATUS(status);
366} 372}
367 373
368
369/******************************************************************************* 374/*******************************************************************************
370 * 375 *
371 * FUNCTION: acpi_ex_store_object_to_index 376 * FUNCTION: acpi_ex_store_object_to_index
@@ -381,20 +386,17 @@ acpi_ex_store (
381 ******************************************************************************/ 386 ******************************************************************************/
382 387
383static acpi_status 388static acpi_status
384acpi_ex_store_object_to_index ( 389acpi_ex_store_object_to_index(union acpi_operand_object *source_desc,
385 union acpi_operand_object *source_desc, 390 union acpi_operand_object *index_desc,
386 union acpi_operand_object *index_desc, 391 struct acpi_walk_state *walk_state)
387 struct acpi_walk_state *walk_state)
388{ 392{
389 acpi_status status = AE_OK; 393 acpi_status status = AE_OK;
390 union acpi_operand_object *obj_desc; 394 union acpi_operand_object *obj_desc;
391 union acpi_operand_object *new_desc; 395 union acpi_operand_object *new_desc;
392 u8 value = 0; 396 u8 value = 0;
393 u32 i; 397 u32 i;
394
395
396 ACPI_FUNCTION_TRACE ("ex_store_object_to_index");
397 398
399 ACPI_FUNCTION_TRACE("ex_store_object_to_index");
398 400
399 /* 401 /*
400 * Destination must be a reference pointer, and 402 * Destination must be a reference pointer, and
@@ -413,19 +415,20 @@ acpi_ex_store_object_to_index (
413 */ 415 */
414 obj_desc = *(index_desc->reference.where); 416 obj_desc = *(index_desc->reference.where);
415 417
416 status = acpi_ut_copy_iobject_to_iobject (source_desc, &new_desc, walk_state); 418 status =
417 if (ACPI_FAILURE (status)) { 419 acpi_ut_copy_iobject_to_iobject(source_desc, &new_desc,
418 return_ACPI_STATUS (status); 420 walk_state);
421 if (ACPI_FAILURE(status)) {
422 return_ACPI_STATUS(status);
419 } 423 }
420 424
421 if (obj_desc) { 425 if (obj_desc) {
422 /* Decrement reference count by the ref count of the parent package */ 426 /* Decrement reference count by the ref count of the parent package */
423 427
424 for (i = 0; 428 for (i = 0; i < ((union acpi_operand_object *)
425 i < ((union acpi_operand_object *) 429 index_desc->reference.object)->common.
426 index_desc->reference.object)->common.reference_count; 430 reference_count; i++) {
427 i++) { 431 acpi_ut_remove_reference(obj_desc);
428 acpi_ut_remove_reference (obj_desc);
429 } 432 }
430 } 433 }
431 434
@@ -433,16 +436,14 @@ acpi_ex_store_object_to_index (
433 436
434 /* Increment ref count by the ref count of the parent package-1 */ 437 /* Increment ref count by the ref count of the parent package-1 */
435 438
436 for (i = 1; 439 for (i = 1; i < ((union acpi_operand_object *)
437 i < ((union acpi_operand_object *) 440 index_desc->reference.object)->common.
438 index_desc->reference.object)->common.reference_count; 441 reference_count; i++) {
439 i++) { 442 acpi_ut_add_reference(new_desc);
440 acpi_ut_add_reference (new_desc);
441 } 443 }
442 444
443 break; 445 break;
444 446
445
446 case ACPI_TYPE_BUFFER_FIELD: 447 case ACPI_TYPE_BUFFER_FIELD:
447 448
448 /* 449 /*
@@ -460,16 +461,16 @@ acpi_ex_store_object_to_index (
460 * by the INDEX_OP code. 461 * by the INDEX_OP code.
461 */ 462 */
462 obj_desc = index_desc->reference.object; 463 obj_desc = index_desc->reference.object;
463 if ((ACPI_GET_OBJECT_TYPE (obj_desc) != ACPI_TYPE_BUFFER) && 464 if ((ACPI_GET_OBJECT_TYPE(obj_desc) != ACPI_TYPE_BUFFER) &&
464 (ACPI_GET_OBJECT_TYPE (obj_desc) != ACPI_TYPE_STRING)) { 465 (ACPI_GET_OBJECT_TYPE(obj_desc) != ACPI_TYPE_STRING)) {
465 return_ACPI_STATUS (AE_AML_OPERAND_TYPE); 466 return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
466 } 467 }
467 468
468 /* 469 /*
469 * The assignment of the individual elements will be slightly 470 * The assignment of the individual elements will be slightly
470 * different for each source type. 471 * different for each source type.
471 */ 472 */
472 switch (ACPI_GET_OBJECT_TYPE (source_desc)) { 473 switch (ACPI_GET_OBJECT_TYPE(source_desc)) {
473 case ACPI_TYPE_INTEGER: 474 case ACPI_TYPE_INTEGER:
474 475
475 /* Use the least-significant byte of the integer */ 476 /* Use the least-significant byte of the integer */
@@ -489,10 +490,11 @@ acpi_ex_store_object_to_index (
489 490
490 /* All other types are invalid */ 491 /* All other types are invalid */
491 492
492 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 493 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
493 "Source must be Integer/Buffer/String type, not %s\n", 494 "Source must be Integer/Buffer/String type, not %s\n",
494 acpi_ut_get_object_type_name (source_desc))); 495 acpi_ut_get_object_type_name
495 return_ACPI_STATUS (AE_AML_OPERAND_TYPE); 496 (source_desc)));
497 return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
496 } 498 }
497 499
498 /* Store the source value into the target buffer byte */ 500 /* Store the source value into the target buffer byte */
@@ -500,18 +502,16 @@ acpi_ex_store_object_to_index (
500 obj_desc->buffer.pointer[index_desc->reference.offset] = value; 502 obj_desc->buffer.pointer[index_desc->reference.offset] = value;
501 break; 503 break;
502 504
503
504 default: 505 default:
505 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 506 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
506 "Target is not a Package or buffer_field\n")); 507 "Target is not a Package or buffer_field\n"));
507 status = AE_AML_OPERAND_TYPE; 508 status = AE_AML_OPERAND_TYPE;
508 break; 509 break;
509 } 510 }
510 511
511 return_ACPI_STATUS (status); 512 return_ACPI_STATUS(status);
512} 513}
513 514
514
515/******************************************************************************* 515/*******************************************************************************
516 * 516 *
517 * FUNCTION: acpi_ex_store_object_to_node 517 * FUNCTION: acpi_ex_store_object_to_node
@@ -539,37 +539,35 @@ acpi_ex_store_object_to_index (
539 ******************************************************************************/ 539 ******************************************************************************/
540 540
541acpi_status 541acpi_status
542acpi_ex_store_object_to_node ( 542acpi_ex_store_object_to_node(union acpi_operand_object *source_desc,
543 union acpi_operand_object *source_desc, 543 struct acpi_namespace_node *node,
544 struct acpi_namespace_node *node, 544 struct acpi_walk_state *walk_state,
545 struct acpi_walk_state *walk_state, 545 u8 implicit_conversion)
546 u8 implicit_conversion)
547{ 546{
548 acpi_status status = AE_OK; 547 acpi_status status = AE_OK;
549 union acpi_operand_object *target_desc; 548 union acpi_operand_object *target_desc;
550 union acpi_operand_object *new_desc; 549 union acpi_operand_object *new_desc;
551 acpi_object_type target_type; 550 acpi_object_type target_type;
552
553
554 ACPI_FUNCTION_TRACE_PTR ("ex_store_object_to_node", source_desc);
555 551
552 ACPI_FUNCTION_TRACE_PTR("ex_store_object_to_node", source_desc);
556 553
557 /* Get current type of the node, and object attached to Node */ 554 /* Get current type of the node, and object attached to Node */
558 555
559 target_type = acpi_ns_get_type (node); 556 target_type = acpi_ns_get_type(node);
560 target_desc = acpi_ns_get_attached_object (node); 557 target_desc = acpi_ns_get_attached_object(node);
561 558
562 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Storing %p(%s) into node %p(%s)\n", 559 ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Storing %p(%s) into node %p(%s)\n",
563 source_desc, acpi_ut_get_object_type_name (source_desc), 560 source_desc,
564 node, acpi_ut_get_type_name (target_type))); 561 acpi_ut_get_object_type_name(source_desc), node,
562 acpi_ut_get_type_name(target_type)));
565 563
566 /* 564 /*
567 * Resolve the source object to an actual value 565 * Resolve the source object to an actual value
568 * (If it is a reference object) 566 * (If it is a reference object)
569 */ 567 */
570 status = acpi_ex_resolve_object (&source_desc, target_type, walk_state); 568 status = acpi_ex_resolve_object(&source_desc, target_type, walk_state);
571 if (ACPI_FAILURE (status)) { 569 if (ACPI_FAILURE(status)) {
572 return_ACPI_STATUS (status); 570 return_ACPI_STATUS(status);
573 } 571 }
574 572
575 /* If no implicit conversion, drop into the default case below */ 573 /* If no implicit conversion, drop into the default case below */
@@ -590,11 +588,10 @@ acpi_ex_store_object_to_node (
590 588
591 /* For fields, copy the source data to the target field. */ 589 /* For fields, copy the source data to the target field. */
592 590
593 status = acpi_ex_write_data_to_field (source_desc, target_desc, 591 status = acpi_ex_write_data_to_field(source_desc, target_desc,
594 &walk_state->result_obj); 592 &walk_state->result_obj);
595 break; 593 break;
596 594
597
598 case ACPI_TYPE_INTEGER: 595 case ACPI_TYPE_INTEGER:
599 case ACPI_TYPE_STRING: 596 case ACPI_TYPE_STRING:
600 case ACPI_TYPE_BUFFER: 597 case ACPI_TYPE_BUFFER:
@@ -605,10 +602,11 @@ acpi_ex_store_object_to_node (
605 * 602 *
606 * Copy and/or convert the source object to a new target object 603 * Copy and/or convert the source object to a new target object
607 */ 604 */
608 status = acpi_ex_store_object_to_object (source_desc, target_desc, 605 status =
609 &new_desc, walk_state); 606 acpi_ex_store_object_to_object(source_desc, target_desc,
610 if (ACPI_FAILURE (status)) { 607 &new_desc, walk_state);
611 return_ACPI_STATUS (status); 608 if (ACPI_FAILURE(status)) {
609 return_ACPI_STATUS(status);
612 } 610 }
613 611
614 if (new_desc != target_desc) { 612 if (new_desc != target_desc) {
@@ -621,30 +619,33 @@ acpi_ex_store_object_to_node (
621 * has been performed such that the node/object type has been 619 * has been performed such that the node/object type has been
622 * changed. 620 * changed.
623 */ 621 */
624 status = acpi_ns_attach_object (node, new_desc, new_desc->common.type); 622 status =
625 623 acpi_ns_attach_object(node, new_desc,
626 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, 624 new_desc->common.type);
627 "Store %s into %s via Convert/Attach\n", 625
628 acpi_ut_get_object_type_name (source_desc), 626 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
629 acpi_ut_get_object_type_name (new_desc))); 627 "Store %s into %s via Convert/Attach\n",
628 acpi_ut_get_object_type_name
629 (source_desc),
630 acpi_ut_get_object_type_name
631 (new_desc)));
630 } 632 }
631 break; 633 break;
632 634
633
634 default: 635 default:
635 636
636 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, 637 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
637 "Storing %s (%p) directly into node (%p) with no implicit conversion\n", 638 "Storing %s (%p) directly into node (%p) with no implicit conversion\n",
638 acpi_ut_get_object_type_name (source_desc), source_desc, node)); 639 acpi_ut_get_object_type_name(source_desc),
640 source_desc, node));
639 641
640 /* No conversions for all other types. Just attach the source object */ 642 /* No conversions for all other types. Just attach the source object */
641 643
642 status = acpi_ns_attach_object (node, source_desc, 644 status = acpi_ns_attach_object(node, source_desc,
643 ACPI_GET_OBJECT_TYPE (source_desc)); 645 ACPI_GET_OBJECT_TYPE
646 (source_desc));
644 break; 647 break;
645 } 648 }
646 649
647 return_ACPI_STATUS (status); 650 return_ACPI_STATUS(status);
648} 651}
649
650