[ACPICA]
[reactos.git] / reactos / drivers / bus / acpi / acpica / executer / exstore.c
1 /******************************************************************************
2 *
3 * Module Name: exstore - AML Interpreter object store support
4 *
5 *****************************************************************************/
6
7 /******************************************************************************
8 *
9 * 1. Copyright Notice
10 *
11 * Some or all of this work - Copyright (c) 1999 - 2015, Intel Corp.
12 * All rights reserved.
13 *
14 * 2. License
15 *
16 * 2.1. This is your license from Intel Corp. under its intellectual property
17 * rights. You may have additional license terms from the party that provided
18 * you this software, covering your right to use that party's intellectual
19 * property rights.
20 *
21 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
22 * copy of the source code appearing in this file ("Covered Code") an
23 * irrevocable, perpetual, worldwide license under Intel's copyrights in the
24 * base code distributed originally by Intel ("Original Intel Code") to copy,
25 * make derivatives, distribute, use and display any portion of the Covered
26 * Code in any form, with the right to sublicense such rights; and
27 *
28 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
29 * license (with the right to sublicense), under only those claims of Intel
30 * patents that are infringed by the Original Intel Code, to make, use, sell,
31 * offer to sell, and import the Covered Code and derivative works thereof
32 * solely to the minimum extent necessary to exercise the above copyright
33 * license, and in no event shall the patent license extend to any additions
34 * to or modifications of the Original Intel Code. No other license or right
35 * is granted directly or by implication, estoppel or otherwise;
36 *
37 * The above copyright and patent license is granted only if the following
38 * conditions are met:
39 *
40 * 3. Conditions
41 *
42 * 3.1. Redistribution of Source with Rights to Further Distribute Source.
43 * Redistribution of source code of any substantial portion of the Covered
44 * Code or modification with rights to further distribute source must include
45 * the above Copyright Notice, the above License, this list of Conditions,
46 * and the following Disclaimer and Export Compliance provision. In addition,
47 * Licensee must cause all Covered Code to which Licensee contributes to
48 * contain a file documenting the changes Licensee made to create that Covered
49 * Code and the date of any change. Licensee must include in that file the
50 * documentation of any changes made by any predecessor Licensee. Licensee
51 * must include a prominent statement that the modification is derived,
52 * directly or indirectly, from Original Intel Code.
53 *
54 * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
55 * Redistribution of source code of any substantial portion of the Covered
56 * Code or modification without rights to further distribute source must
57 * include the following Disclaimer and Export Compliance provision in the
58 * documentation and/or other materials provided with distribution. In
59 * addition, Licensee may not authorize further sublicense of source of any
60 * portion of the Covered Code, and must include terms to the effect that the
61 * license from Licensee to its licensee is limited to the intellectual
62 * property embodied in the software Licensee provides to its licensee, and
63 * not to intellectual property embodied in modifications its licensee may
64 * make.
65 *
66 * 3.3. Redistribution of Executable. Redistribution in executable form of any
67 * substantial portion of the Covered Code or modification must reproduce the
68 * above Copyright Notice, and the following Disclaimer and Export Compliance
69 * provision in the documentation and/or other materials provided with the
70 * distribution.
71 *
72 * 3.4. Intel retains all right, title, and interest in and to the Original
73 * Intel Code.
74 *
75 * 3.5. Neither the name Intel nor any other trademark owned or controlled by
76 * Intel shall be used in advertising or otherwise to promote the sale, use or
77 * other dealings in products derived from or relating to the Covered Code
78 * without prior written authorization from Intel.
79 *
80 * 4. Disclaimer and Export Compliance
81 *
82 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
83 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
84 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
85 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
86 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
87 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
88 * PARTICULAR PURPOSE.
89 *
90 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
91 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
92 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
93 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
94 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
95 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
96 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
97 * LIMITED REMEDY.
98 *
99 * 4.3. Licensee shall not export, either directly or indirectly, any of this
100 * software or system incorporating such software without first obtaining any
101 * required license or other approval from the U. S. Department of Commerce or
102 * any other agency or department of the United States Government. In the
103 * event Licensee exports any such software from the United States or
104 * re-exports any such software from a foreign destination, Licensee shall
105 * ensure that the distribution and export/re-export of the software is in
106 * compliance with all laws, regulations, orders, or other restrictions of the
107 * U.S. Export Administration Regulations. Licensee agrees that neither it nor
108 * any of its subsidiaries will export/re-export any technical data, process,
109 * software, or service, directly or indirectly, to any country for which the
110 * United States government or any agency thereof requires an export license,
111 * other governmental approval, or letter of assurance, without first obtaining
112 * such license, approval or letter.
113 *
114 *****************************************************************************/
115
116 #include "acpi.h"
117 #include "accommon.h"
118 #include "acdispat.h"
119 #include "acinterp.h"
120 #include "amlcode.h"
121 #include "acnamesp.h"
122
123
124 #define _COMPONENT ACPI_EXECUTER
125 ACPI_MODULE_NAME ("exstore")
126
127 /* Local prototypes */
128
129 static ACPI_STATUS
130 AcpiExStoreObjectToIndex (
131 ACPI_OPERAND_OBJECT *ValDesc,
132 ACPI_OPERAND_OBJECT *DestDesc,
133 ACPI_WALK_STATE *WalkState);
134
135 static ACPI_STATUS
136 AcpiExStoreDirectToNode (
137 ACPI_OPERAND_OBJECT *SourceDesc,
138 ACPI_NAMESPACE_NODE *Node,
139 ACPI_WALK_STATE *WalkState);
140
141
142 /*******************************************************************************
143 *
144 * FUNCTION: AcpiExStore
145 *
146 * PARAMETERS: *SourceDesc - Value to be stored
147 * *DestDesc - Where to store it. Must be an NS node
148 * or ACPI_OPERAND_OBJECT of type
149 * Reference;
150 * WalkState - Current walk state
151 *
152 * RETURN: Status
153 *
154 * DESCRIPTION: Store the value described by SourceDesc into the location
155 * described by DestDesc. Called by various interpreter
156 * functions to store the result of an operation into
157 * the destination operand -- not just simply the actual "Store"
158 * ASL operator.
159 *
160 ******************************************************************************/
161
162 ACPI_STATUS
163 AcpiExStore (
164 ACPI_OPERAND_OBJECT *SourceDesc,
165 ACPI_OPERAND_OBJECT *DestDesc,
166 ACPI_WALK_STATE *WalkState)
167 {
168 ACPI_STATUS Status = AE_OK;
169 ACPI_OPERAND_OBJECT *RefDesc = DestDesc;
170
171
172 ACPI_FUNCTION_TRACE_PTR (ExStore, DestDesc);
173
174
175 /* Validate parameters */
176
177 if (!SourceDesc || !DestDesc)
178 {
179 ACPI_ERROR ((AE_INFO, "Null parameter"));
180 return_ACPI_STATUS (AE_AML_NO_OPERAND);
181 }
182
183 /* DestDesc can be either a namespace node or an ACPI object */
184
185 if (ACPI_GET_DESCRIPTOR_TYPE (DestDesc) == ACPI_DESC_TYPE_NAMED)
186 {
187 /*
188 * Dest is a namespace node,
189 * Storing an object into a Named node.
190 */
191 Status = AcpiExStoreObjectToNode (SourceDesc,
192 (ACPI_NAMESPACE_NODE *) DestDesc, WalkState,
193 ACPI_IMPLICIT_CONVERSION);
194
195 return_ACPI_STATUS (Status);
196 }
197
198 /* Destination object must be a Reference or a Constant object */
199
200 switch (DestDesc->Common.Type)
201 {
202 case ACPI_TYPE_LOCAL_REFERENCE:
203
204 break;
205
206 case ACPI_TYPE_INTEGER:
207
208 /* Allow stores to Constants -- a Noop as per ACPI spec */
209
210 if (DestDesc->Common.Flags & AOPOBJ_AML_CONSTANT)
211 {
212 return_ACPI_STATUS (AE_OK);
213 }
214
215 /*lint -fallthrough */
216
217 default:
218
219 /* Destination is not a Reference object */
220
221 ACPI_ERROR ((AE_INFO,
222 "Target is not a Reference or Constant object - [%s] %p",
223 AcpiUtGetObjectTypeName (DestDesc), DestDesc));
224
225 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
226 }
227
228 /*
229 * Examine the Reference class. These cases are handled:
230 *
231 * 1) Store to Name (Change the object associated with a name)
232 * 2) Store to an indexed area of a Buffer or Package
233 * 3) Store to a Method Local or Arg
234 * 4) Store to the debug object
235 */
236 switch (RefDesc->Reference.Class)
237 {
238 case ACPI_REFCLASS_REFOF:
239
240 /* Storing an object into a Name "container" */
241
242 Status = AcpiExStoreObjectToNode (SourceDesc,
243 RefDesc->Reference.Object,
244 WalkState, ACPI_IMPLICIT_CONVERSION);
245 break;
246
247 case ACPI_REFCLASS_INDEX:
248
249 /* Storing to an Index (pointer into a packager or buffer) */
250
251 Status = AcpiExStoreObjectToIndex (SourceDesc, RefDesc, WalkState);
252 break;
253
254 case ACPI_REFCLASS_LOCAL:
255 case ACPI_REFCLASS_ARG:
256
257 /* Store to a method local/arg */
258
259 Status = AcpiDsStoreObjectToLocal (RefDesc->Reference.Class,
260 RefDesc->Reference.Value, SourceDesc, WalkState);
261 break;
262
263 case ACPI_REFCLASS_DEBUG:
264 /*
265 * Storing to the Debug object causes the value stored to be
266 * displayed and otherwise has no effect -- see ACPI Specification
267 */
268 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
269 "**** Write to Debug Object: Object %p [%s] ****:\n\n",
270 SourceDesc, AcpiUtGetObjectTypeName (SourceDesc)));
271
272 ACPI_DEBUG_OBJECT (SourceDesc, 0, 0);
273 break;
274
275 default:
276
277 ACPI_ERROR ((AE_INFO, "Unknown Reference Class 0x%2.2X",
278 RefDesc->Reference.Class));
279 ACPI_DUMP_ENTRY (RefDesc, ACPI_LV_INFO);
280
281 Status = AE_AML_INTERNAL;
282 break;
283 }
284
285 return_ACPI_STATUS (Status);
286 }
287
288
289 /*******************************************************************************
290 *
291 * FUNCTION: AcpiExStoreObjectToIndex
292 *
293 * PARAMETERS: *SourceDesc - Value to be stored
294 * *DestDesc - Named object to receive the value
295 * WalkState - Current walk state
296 *
297 * RETURN: Status
298 *
299 * DESCRIPTION: Store the object to indexed Buffer or Package element
300 *
301 ******************************************************************************/
302
303 static ACPI_STATUS
304 AcpiExStoreObjectToIndex (
305 ACPI_OPERAND_OBJECT *SourceDesc,
306 ACPI_OPERAND_OBJECT *IndexDesc,
307 ACPI_WALK_STATE *WalkState)
308 {
309 ACPI_STATUS Status = AE_OK;
310 ACPI_OPERAND_OBJECT *ObjDesc;
311 ACPI_OPERAND_OBJECT *NewDesc;
312 UINT8 Value = 0;
313 UINT32 i;
314
315
316 ACPI_FUNCTION_TRACE (ExStoreObjectToIndex);
317
318
319 /*
320 * Destination must be a reference pointer, and
321 * must point to either a buffer or a package
322 */
323 switch (IndexDesc->Reference.TargetType)
324 {
325 case ACPI_TYPE_PACKAGE:
326 /*
327 * Storing to a package element. Copy the object and replace
328 * any existing object with the new object. No implicit
329 * conversion is performed.
330 *
331 * The object at *(IndexDesc->Reference.Where) is the
332 * element within the package that is to be modified.
333 * The parent package object is at IndexDesc->Reference.Object
334 */
335 ObjDesc = *(IndexDesc->Reference.Where);
336
337 if (SourceDesc->Common.Type == ACPI_TYPE_LOCAL_REFERENCE &&
338 SourceDesc->Reference.Class == ACPI_REFCLASS_TABLE)
339 {
340 /* This is a DDBHandle, just add a reference to it */
341
342 AcpiUtAddReference (SourceDesc);
343 NewDesc = SourceDesc;
344 }
345 else
346 {
347 /* Normal object, copy it */
348
349 Status = AcpiUtCopyIobjectToIobject (SourceDesc, &NewDesc, WalkState);
350 if (ACPI_FAILURE (Status))
351 {
352 return_ACPI_STATUS (Status);
353 }
354 }
355
356 if (ObjDesc)
357 {
358 /* Decrement reference count by the ref count of the parent package */
359
360 for (i = 0;
361 i < ((ACPI_OPERAND_OBJECT *)
362 IndexDesc->Reference.Object)->Common.ReferenceCount;
363 i++)
364 {
365 AcpiUtRemoveReference (ObjDesc);
366 }
367 }
368
369 *(IndexDesc->Reference.Where) = NewDesc;
370
371 /* Increment ref count by the ref count of the parent package-1 */
372
373 for (i = 1;
374 i < ((ACPI_OPERAND_OBJECT *)
375 IndexDesc->Reference.Object)->Common.ReferenceCount;
376 i++)
377 {
378 AcpiUtAddReference (NewDesc);
379 }
380
381 break;
382
383 case ACPI_TYPE_BUFFER_FIELD:
384 /*
385 * Store into a Buffer or String (not actually a real BufferField)
386 * at a location defined by an Index.
387 *
388 * The first 8-bit element of the source object is written to the
389 * 8-bit Buffer location defined by the Index destination object,
390 * according to the ACPI 2.0 specification.
391 */
392
393 /*
394 * Make sure the target is a Buffer or String. An error should
395 * not happen here, since the ReferenceObject was constructed
396 * by the INDEX_OP code.
397 */
398 ObjDesc = IndexDesc->Reference.Object;
399 if ((ObjDesc->Common.Type != ACPI_TYPE_BUFFER) &&
400 (ObjDesc->Common.Type != ACPI_TYPE_STRING))
401 {
402 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
403 }
404
405 /*
406 * The assignment of the individual elements will be slightly
407 * different for each source type.
408 */
409 switch (SourceDesc->Common.Type)
410 {
411 case ACPI_TYPE_INTEGER:
412
413 /* Use the least-significant byte of the integer */
414
415 Value = (UINT8) (SourceDesc->Integer.Value);
416 break;
417
418 case ACPI_TYPE_BUFFER:
419 case ACPI_TYPE_STRING:
420
421 /* Note: Takes advantage of common string/buffer fields */
422
423 Value = SourceDesc->Buffer.Pointer[0];
424 break;
425
426 default:
427
428 /* All other types are invalid */
429
430 ACPI_ERROR ((AE_INFO,
431 "Source must be type [Integer/Buffer/String], found [%s]",
432 AcpiUtGetObjectTypeName (SourceDesc)));
433 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
434 }
435
436 /* Store the source value into the target buffer byte */
437
438 ObjDesc->Buffer.Pointer[IndexDesc->Reference.Value] = Value;
439 break;
440
441 default:
442 ACPI_ERROR ((AE_INFO,
443 "Target is not of type [Package/BufferField]"));
444 Status = AE_AML_TARGET_TYPE;
445 break;
446 }
447
448 return_ACPI_STATUS (Status);
449 }
450
451
452 /*******************************************************************************
453 *
454 * FUNCTION: AcpiExStoreObjectToNode
455 *
456 * PARAMETERS: SourceDesc - Value to be stored
457 * Node - Named object to receive the value
458 * WalkState - Current walk state
459 * ImplicitConversion - Perform implicit conversion (yes/no)
460 *
461 * RETURN: Status
462 *
463 * DESCRIPTION: Store the object to the named object.
464 *
465 * The assignment of an object to a named object is handled here.
466 * The value passed in will replace the current value (if any)
467 * with the input value.
468 *
469 * When storing into an object the data is converted to the
470 * target object type then stored in the object. This means
471 * that the target object type (for an initialized target) will
472 * not be changed by a store operation. A CopyObject can change
473 * the target type, however.
474 *
475 * The ImplicitConversion flag is set to NO/FALSE only when
476 * storing to an ArgX -- as per the rules of the ACPI spec.
477 *
478 * Assumes parameters are already validated.
479 *
480 ******************************************************************************/
481
482 ACPI_STATUS
483 AcpiExStoreObjectToNode (
484 ACPI_OPERAND_OBJECT *SourceDesc,
485 ACPI_NAMESPACE_NODE *Node,
486 ACPI_WALK_STATE *WalkState,
487 UINT8 ImplicitConversion)
488 {
489 ACPI_STATUS Status = AE_OK;
490 ACPI_OPERAND_OBJECT *TargetDesc;
491 ACPI_OPERAND_OBJECT *NewDesc;
492 ACPI_OBJECT_TYPE TargetType;
493
494
495 ACPI_FUNCTION_TRACE_PTR (ExStoreObjectToNode, SourceDesc);
496
497
498 /* Get current type of the node, and object attached to Node */
499
500 TargetType = AcpiNsGetType (Node);
501 TargetDesc = AcpiNsGetAttachedObject (Node);
502
503 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Storing %p [%s] to node %p [%s]\n",
504 SourceDesc, AcpiUtGetObjectTypeName (SourceDesc),
505 Node, AcpiUtGetTypeName (TargetType)));
506
507 /* Only limited target types possible for everything except CopyObject */
508
509 if (WalkState->Opcode != AML_COPY_OP)
510 {
511 /*
512 * Only CopyObject allows all object types to be overwritten. For
513 * TargetRef(s), there are restrictions on the object types that
514 * are allowed.
515 *
516 * Allowable operations/typing for Store:
517 *
518 * 1) Simple Store
519 * Integer --> Integer (Named/Local/Arg)
520 * String --> String (Named/Local/Arg)
521 * Buffer --> Buffer (Named/Local/Arg)
522 * Package --> Package (Named/Local/Arg)
523 *
524 * 2) Store with implicit conversion
525 * Integer --> String or Buffer (Named)
526 * String --> Integer or Buffer (Named)
527 * Buffer --> Integer or String (Named)
528 */
529 switch (TargetType)
530 {
531 case ACPI_TYPE_PACKAGE:
532 /*
533 * Here, can only store a package to an existing package.
534 * Storing a package to a Local/Arg is OK, and handled
535 * elsewhere.
536 */
537 if (WalkState->Opcode == AML_STORE_OP)
538 {
539 if (SourceDesc->Common.Type != ACPI_TYPE_PACKAGE)
540 {
541 ACPI_ERROR ((AE_INFO,
542 "Cannot assign type [%s] to [Package] "
543 "(source must be type Pkg)",
544 AcpiUtGetObjectTypeName (SourceDesc)));
545
546 return_ACPI_STATUS (AE_AML_TARGET_TYPE);
547 }
548 break;
549 }
550
551 /* Fallthrough */
552
553 case ACPI_TYPE_DEVICE:
554 case ACPI_TYPE_EVENT:
555 case ACPI_TYPE_MUTEX:
556 case ACPI_TYPE_REGION:
557 case ACPI_TYPE_POWER:
558 case ACPI_TYPE_PROCESSOR:
559 case ACPI_TYPE_THERMAL:
560
561 ACPI_ERROR ((AE_INFO,
562 "Target must be [Buffer/Integer/String/Reference], found [%s] (%4.4s)",
563 AcpiUtGetTypeName (Node->Type), Node->Name.Ascii));
564
565 return_ACPI_STATUS (AE_AML_TARGET_TYPE);
566
567 default:
568 break;
569 }
570 }
571
572 /*
573 * Resolve the source object to an actual value
574 * (If it is a reference object)
575 */
576 Status = AcpiExResolveObject (&SourceDesc, TargetType, WalkState);
577 if (ACPI_FAILURE (Status))
578 {
579 return_ACPI_STATUS (Status);
580 }
581
582 /* Do the actual store operation */
583
584 switch (TargetType)
585 {
586 /*
587 * The simple data types all support implicit source operand
588 * conversion before the store.
589 */
590 case ACPI_TYPE_INTEGER:
591 case ACPI_TYPE_STRING:
592 case ACPI_TYPE_BUFFER:
593
594 if ((WalkState->Opcode == AML_COPY_OP) ||
595 !ImplicitConversion)
596 {
597 /*
598 * However, CopyObject and Stores to ArgX do not perform
599 * an implicit conversion, as per the ACPI specification.
600 * A direct store is performed instead.
601 */
602 Status = AcpiExStoreDirectToNode (SourceDesc, Node,
603 WalkState);
604 break;
605 }
606
607 /* Store with implicit source operand conversion support */
608
609 Status = AcpiExStoreObjectToObject (SourceDesc, TargetDesc,
610 &NewDesc, WalkState);
611 if (ACPI_FAILURE (Status))
612 {
613 return_ACPI_STATUS (Status);
614 }
615
616 if (NewDesc != TargetDesc)
617 {
618 /*
619 * Store the new NewDesc as the new value of the Name, and set
620 * the Name's type to that of the value being stored in it.
621 * SourceDesc reference count is incremented by AttachObject.
622 *
623 * Note: This may change the type of the node if an explicit
624 * store has been performed such that the node/object type
625 * has been changed.
626 */
627 Status = AcpiNsAttachObject (Node, NewDesc,
628 NewDesc->Common.Type);
629
630 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
631 "Store type [%s] into [%s] via Convert/Attach\n",
632 AcpiUtGetObjectTypeName (SourceDesc),
633 AcpiUtGetObjectTypeName (NewDesc)));
634 }
635 break;
636
637 case ACPI_TYPE_BUFFER_FIELD:
638 case ACPI_TYPE_LOCAL_REGION_FIELD:
639 case ACPI_TYPE_LOCAL_BANK_FIELD:
640 case ACPI_TYPE_LOCAL_INDEX_FIELD:
641 /*
642 * For all fields, always write the source data to the target
643 * field. Any required implicit source operand conversion is
644 * performed in the function below as necessary. Note, field
645 * objects must retain their original type permanently.
646 */
647 Status = AcpiExWriteDataToField (SourceDesc, TargetDesc,
648 &WalkState->ResultObj);
649 break;
650
651 default:
652 /*
653 * CopyObject operator: No conversions for all other types.
654 * Instead, directly store a copy of the source object.
655 *
656 * This is the ACPI spec-defined behavior for the CopyObject
657 * operator. (Note, for this default case, all normal
658 * Store/Target operations exited above with an error).
659 */
660 Status = AcpiExStoreDirectToNode (SourceDesc, Node,
661 WalkState);
662 break;
663 }
664
665 return_ACPI_STATUS (Status);
666 }
667
668
669 /*******************************************************************************
670 *
671 * FUNCTION: AcpiExStoreDirectToNode
672 *
673 * PARAMETERS: SourceDesc - Value to be stored
674 * Node - Named object to receive the value
675 * WalkState - Current walk state
676 *
677 * RETURN: Status
678 *
679 * DESCRIPTION: "Store" an object directly to a node. This involves a copy
680 * and an attach.
681 *
682 ******************************************************************************/
683
684 static ACPI_STATUS
685 AcpiExStoreDirectToNode (
686 ACPI_OPERAND_OBJECT *SourceDesc,
687 ACPI_NAMESPACE_NODE *Node,
688 ACPI_WALK_STATE *WalkState)
689 {
690 ACPI_STATUS Status;
691 ACPI_OPERAND_OBJECT *NewDesc;
692
693
694 ACPI_FUNCTION_TRACE (ExStoreDirectToNode);
695
696
697 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
698 "Storing [%s] (%p) directly into node [%s] (%p)"
699 " with no implicit conversion\n",
700 AcpiUtGetObjectTypeName (SourceDesc), SourceDesc,
701 AcpiUtGetTypeName (Node->Type), Node));
702
703 /* Copy the source object to a new object */
704
705 Status = AcpiUtCopyIobjectToIobject (SourceDesc, &NewDesc, WalkState);
706 if (ACPI_FAILURE (Status))
707 {
708 return_ACPI_STATUS (Status);
709 }
710
711 /* Attach the new object to the node */
712
713 Status = AcpiNsAttachObject (Node, NewDesc, NewDesc->Common.Type);
714 AcpiUtRemoveReference (NewDesc);
715 return_ACPI_STATUS (Status);
716 }