1 /******************************************************************************
2  *
3  * Module Name: dsobject - Dispatcher object management routines
4  *              $Revision: 124 $
5  *
6  *****************************************************************************/
7 
8 /******************************************************************************
9  *
10  * 1. Copyright Notice
11  *
12  * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
13  * All rights reserved.
14  *
15  * 2. License
16  *
17  * 2.1. This is your license from Intel Corp. under its intellectual property
18  * rights.  You may have additional license terms from the party that provided
19  * you this software, covering your right to use that party's intellectual
20  * property rights.
21  *
22  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
23  * copy of the source code appearing in this file ("Covered Code") an
24  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
25  * base code distributed originally by Intel ("Original Intel Code") to copy,
26  * make derivatives, distribute, use and display any portion of the Covered
27  * Code in any form, with the right to sublicense such rights; and
28  *
29  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
30  * license (with the right to sublicense), under only those claims of Intel
31  * patents that are infringed by the Original Intel Code, to make, use, sell,
32  * offer to sell, and import the Covered Code and derivative works thereof
33  * solely to the minimum extent necessary to exercise the above copyright
34  * license, and in no event shall the patent license extend to any additions
35  * to or modifications of the Original Intel Code.  No other license or right
36  * is granted directly or by implication, estoppel or otherwise;
37  *
38  * The above copyright and patent license is granted only if the following
39  * conditions are met:
40  *
41  * 3. Conditions
42  *
43  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
44  * Redistribution of source code of any substantial portion of the Covered
45  * Code or modification with rights to further distribute source must include
46  * the above Copyright Notice, the above License, this list of Conditions,
47  * and the following Disclaimer and Export Compliance provision.  In addition,
48  * Licensee must cause all Covered Code to which Licensee contributes to
49  * contain a file documenting the changes Licensee made to create that Covered
50  * Code and the date of any change.  Licensee must include in that file the
51  * documentation of any changes made by any predecessor Licensee.  Licensee
52  * must include a prominent statement that the modification is derived,
53  * directly or indirectly, from Original Intel Code.
54  *
55  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
56  * Redistribution of source code of any substantial portion of the Covered
57  * Code or modification without rights to further distribute source must
58  * include the following Disclaimer and Export Compliance provision in the
59  * documentation and/or other materials provided with distribution.  In
60  * addition, Licensee may not authorize further sublicense of source of any
61  * portion of the Covered Code, and must include terms to the effect that the
62  * license from Licensee to its licensee is limited to the intellectual
63  * property embodied in the software Licensee provides to its licensee, and
64  * not to intellectual property embodied in modifications its licensee may
65  * make.
66  *
67  * 3.3. Redistribution of Executable. Redistribution in executable form of any
68  * substantial portion of the Covered Code or modification must reproduce the
69  * above Copyright Notice, and the following Disclaimer and Export Compliance
70  * provision in the documentation and/or other materials provided with the
71  * distribution.
72  *
73  * 3.4. Intel retains all right, title, and interest in and to the Original
74  * Intel Code.
75  *
76  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
77  * Intel shall be used in advertising or otherwise to promote the sale, use or
78  * other dealings in products derived from or relating to the Covered Code
79  * without prior written authorization from Intel.
80  *
81  * 4. Disclaimer and Export Compliance
82  *
83  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
84  * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
85  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
86  * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
87  * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
88  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
89  * PARTICULAR PURPOSE.
90  *
91  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
92  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
93  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
94  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
95  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
96  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
97  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
98  * LIMITED REMEDY.
99  *
100  * 4.3. Licensee shall not export, either directly or indirectly, any of this
101  * software or system incorporating such software without first obtaining any
102  * required license or other approval from the U. S. Department of Commerce or
103  * any other agency or department of the United States Government.  In the
104  * event Licensee exports any such software from the United States or
105  * re-exports any such software from a foreign destination, Licensee shall
106  * ensure that the distribution and export/re-export of the software is in
107  * compliance with all laws, regulations, orders, or other restrictions of the
108  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
109  * any of its subsidiaries will export/re-export any technical data, process,
110  * software, or service, directly or indirectly, to any country for which the
111  * United States government or any agency thereof requires an export license,
112  * other governmental approval, or letter of assurance, without first obtaining
113  * such license, approval or letter.
114  *
115  *****************************************************************************/
116 
117 #define __DSOBJECT_C__
118 
119 #include "acpi.h"
120 #include "acparser.h"
121 #include "amlcode.h"
122 #include "acdispat.h"
123 #include "acnamesp.h"
124 #include "acinterp.h"
125 
126 #define _COMPONENT          ACPI_DISPATCHER
127         ACPI_MODULE_NAME    ("dsobject")
128 
129 static ACPI_STATUS
130 AcpiDsBuildInternalObject (
131     ACPI_WALK_STATE         *WalkState,
132     ACPI_PARSE_OBJECT       *Op,
133     ACPI_OPERAND_OBJECT     **ObjDescPtr);
134 
135 
136 #ifndef ACPI_NO_METHOD_EXECUTION
137 /*******************************************************************************
138  *
139  * FUNCTION:    AcpiDsBuildInternalObject
140  *
141  * PARAMETERS:  WalkState       - Current walk state
142  *              Op              - Parser object to be translated
143  *              ObjDescPtr      - Where the ACPI internal object is returned
144  *
145  * RETURN:      Status
146  *
147  * DESCRIPTION: Translate a parser Op object to the equivalent namespace object
148  *              Simple objects are any objects other than a package object!
149  *
150  ******************************************************************************/
151 
152 static ACPI_STATUS
153 AcpiDsBuildInternalObject (
154     ACPI_WALK_STATE         *WalkState,
155     ACPI_PARSE_OBJECT       *Op,
156     ACPI_OPERAND_OBJECT     **ObjDescPtr)
157 {
158     ACPI_OPERAND_OBJECT     *ObjDesc;
159     ACPI_STATUS             Status;
160 
161 
162     ACPI_FUNCTION_TRACE ("DsBuildInternalObject");
163 
164 
165     *ObjDescPtr = NULL;
166     if (Op->Common.AmlOpcode == AML_INT_NAMEPATH_OP)
167     {
168         /*
169          * This is an named object reference.  If this name was
170          * previously looked up in the namespace, it was stored in this op.
171          * Otherwise, go ahead and look it up now
172          */
173         if (!Op->Common.Node)
174         {
175             Status = AcpiNsLookup (WalkState->ScopeInfo,
176                             Op->Common.Value.String,
177                             ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
178                             ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
179                             NULL,
180                             (ACPI_NAMESPACE_NODE **) &(Op->Common.Node));
181 
182             if (ACPI_FAILURE (Status))
183             {
184                 ACPI_REPORT_NSERROR (Op->Common.Value.String, Status);
185                 return_ACPI_STATUS (Status);
186             }
187         }
188     }
189 
190     /* Create and init the internal ACPI object */
191 
192     ObjDesc = AcpiUtCreateInternalObject (
193                 (AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode))->ObjectType);
194     if (!ObjDesc)
195     {
196         return_ACPI_STATUS (AE_NO_MEMORY);
197     }
198 
199     Status = AcpiDsInitObjectFromOp (WalkState, Op, Op->Common.AmlOpcode,
200                 &ObjDesc);
201     if (ACPI_FAILURE (Status))
202     {
203         AcpiUtRemoveReference (ObjDesc);
204         return_ACPI_STATUS (Status);
205     }
206 
207     *ObjDescPtr = ObjDesc;
208     return_ACPI_STATUS (AE_OK);
209 }
210 
211 
212 /*******************************************************************************
213  *
214  * FUNCTION:    AcpiDsBuildInternalBufferObj
215  *
216  * PARAMETERS:  WalkState       - Current walk state
217  *              Op              - Parser object to be translated
218  *              BufferLength    - Length of the buffer
219  *              ObjDescPtr      - Where the ACPI internal object is returned
220  *
221  * RETURN:      Status
222  *
223  * DESCRIPTION: Translate a parser Op package object to the equivalent
224  *              namespace object
225  *
226  ******************************************************************************/
227 
228 ACPI_STATUS
229 AcpiDsBuildInternalBufferObj (
230     ACPI_WALK_STATE         *WalkState,
231     ACPI_PARSE_OBJECT       *Op,
232     UINT32                  BufferLength,
233     ACPI_OPERAND_OBJECT     **ObjDescPtr)
234 {
235     ACPI_PARSE_OBJECT       *Arg;
236     ACPI_OPERAND_OBJECT     *ObjDesc;
237     ACPI_PARSE_OBJECT       *ByteList;
238     UINT32                  ByteListLength = 0;
239 
240 
241     ACPI_FUNCTION_TRACE ("DsBuildInternalBufferObj");
242 
243 
244     ObjDesc = *ObjDescPtr;
245     if (ObjDesc)
246     {
247         /*
248          * We are evaluating a Named buffer object "Name (xxxx, Buffer)".
249          * The buffer object already exists (from the NS node)
250          */
251     }
252     else
253     {
254         /* Create a new buffer object */
255 
256         ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_BUFFER);
257         *ObjDescPtr = ObjDesc;
258         if (!ObjDesc)
259         {
260             return_ACPI_STATUS (AE_NO_MEMORY);
261         }
262     }
263 
264     /*
265      * Second arg is the buffer data (optional) ByteList can be either
266      * individual bytes or a string initializer.  In either case, a
267      * ByteList appears in the AML.
268      */
269     Arg = Op->Common.Value.Arg;         /* skip first arg */
270 
271     ByteList = Arg->Named.Next;
272     if (ByteList)
273     {
274         if (ByteList->Common.AmlOpcode != AML_INT_BYTELIST_OP)
275         {
276             ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
277                 "Expecting bytelist, got AML opcode %X in op %p\n",
278                 ByteList->Common.AmlOpcode, ByteList));
279 
280             AcpiUtRemoveReference (ObjDesc);
281             return (AE_TYPE);
282         }
283 
284         ByteListLength = (UINT32) ByteList->Common.Value.Integer;
285     }
286 
287     /*
288      * The buffer length (number of bytes) will be the larger of:
289      * 1) The specified buffer length and
290      * 2) The length of the initializer byte list
291      */
292     ObjDesc->Buffer.Length = BufferLength;
293     if (ByteListLength > BufferLength)
294     {
295         ObjDesc->Buffer.Length = ByteListLength;
296     }
297 
298     /* Allocate the buffer */
299 
300     if (ObjDesc->Buffer.Length == 0)
301     {
302         ObjDesc->Buffer.Pointer = NULL;
303         ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
304             "Buffer defined with zero length in AML, creating\n"));
305     }
306     else
307     {
308         ObjDesc->Buffer.Pointer = ACPI_MEM_CALLOCATE (
309                                         ObjDesc->Buffer.Length);
310         if (!ObjDesc->Buffer.Pointer)
311         {
312             AcpiUtDeleteObjectDesc (ObjDesc);
313             return_ACPI_STATUS (AE_NO_MEMORY);
314         }
315 
316         /* Initialize buffer from the ByteList (if present) */
317 
318         if (ByteList)
319         {
320             ACPI_MEMCPY (ObjDesc->Buffer.Pointer, ByteList->Named.Data,
321                          ByteListLength);
322         }
323     }
324 
325     ObjDesc->Buffer.Flags |= AOPOBJ_DATA_VALID;
326     Op->Common.Node = (ACPI_NAMESPACE_NODE *) ObjDesc;
327     return_ACPI_STATUS (AE_OK);
328 }
329 
330 
331 /*******************************************************************************
332  *
333  * FUNCTION:    AcpiDsBuildInternalPackageObj
334  *
335  * PARAMETERS:  WalkState       - Current walk state
336  *              Op              - Parser object to be translated
337  *              PackageLength   - Number of elements in the package
338  *              ObjDescPtr      - Where the ACPI internal object is returned
339  *
340  * RETURN:      Status
341  *
342  * DESCRIPTION: Translate a parser Op package object to the equivalent
343  *              namespace object
344  *
345  ******************************************************************************/
346 
347 ACPI_STATUS
348 AcpiDsBuildInternalPackageObj (
349     ACPI_WALK_STATE         *WalkState,
350     ACPI_PARSE_OBJECT       *Op,
351     UINT32                  PackageLength,
352     ACPI_OPERAND_OBJECT     **ObjDescPtr)
353 {
354     ACPI_PARSE_OBJECT       *Arg;
355     ACPI_PARSE_OBJECT       *Parent;
356     ACPI_OPERAND_OBJECT     *ObjDesc = NULL;
357     UINT32                  PackageListLength;
358     ACPI_STATUS             Status = AE_OK;
359     UINT32                  i;
360 
361 
362     ACPI_FUNCTION_TRACE ("DsBuildInternalPackageObj");
363 
364 
365     /* Find the parent of a possibly nested package */
366 
367     Parent = Op->Common.Parent;
368     while ((Parent->Common.AmlOpcode == AML_PACKAGE_OP)     ||
369            (Parent->Common.AmlOpcode == AML_VAR_PACKAGE_OP))
370     {
371         Parent = Parent->Common.Parent;
372     }
373 
374     ObjDesc = *ObjDescPtr;
375     if (ObjDesc)
376     {
377         /*
378          * We are evaluating a Named package object "Name (xxxx, Package)".
379          * Get the existing package object from the NS node
380          */
381     }
382     else
383     {
384         ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_PACKAGE);
385         *ObjDescPtr = ObjDesc;
386         if (!ObjDesc)
387         {
388             return_ACPI_STATUS (AE_NO_MEMORY);
389         }
390 
391         ObjDesc->Package.Node = Parent->Common.Node;
392     }
393 
394     ObjDesc->Package.Count = PackageLength;
395 
396     /* Count the number of items in the package list */
397 
398     PackageListLength = 0;
399     Arg = Op->Common.Value.Arg;
400     Arg = Arg->Common.Next;
401     while (Arg)
402     {
403         PackageListLength++;
404         Arg = Arg->Common.Next;
405     }
406 
407     /*
408      * The package length (number of elements) will be the greater
409      * of the specified length and the length of the initializer list
410      */
411     if (PackageListLength > PackageLength)
412     {
413         ObjDesc->Package.Count = PackageListLength;
414     }
415 
416     /*
417      * Allocate the pointer array (array of pointers to the
418      * individual objects). Add an extra pointer slot so
419      * that the list is always null terminated.
420      */
421     ObjDesc->Package.Elements = ACPI_MEM_CALLOCATE (
422                 ((ACPI_SIZE) ObjDesc->Package.Count + 1) * sizeof (void *));
423 
424     if (!ObjDesc->Package.Elements)
425     {
426         AcpiUtDeleteObjectDesc (ObjDesc);
427         return_ACPI_STATUS (AE_NO_MEMORY);
428     }
429 
430     /*
431      * Now init the elements of the package
432      */
433     i = 0;
434     Arg = Op->Common.Value.Arg;
435     Arg = Arg->Common.Next;
436     while (Arg)
437     {
438         if (Arg->Common.AmlOpcode == AML_INT_RETURN_VALUE_OP)
439         {
440             /* Object (package or buffer) is already built */
441 
442             ObjDesc->Package.Elements[i] =
443                 ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Arg->Common.Node);
444         }
445         else
446         {
447             Status = AcpiDsBuildInternalObject (WalkState, Arg,
448                         &ObjDesc->Package.Elements[i]);
449         }
450 
451         i++;
452         Arg = Arg->Common.Next;
453     }
454 
455     ObjDesc->Package.Flags |= AOPOBJ_DATA_VALID;
456     Op->Common.Node = (ACPI_NAMESPACE_NODE *) ObjDesc;
457     return_ACPI_STATUS (Status);
458 }
459 
460 
461 /*******************************************************************************
462  *
463  * FUNCTION:    AcpiDsCreateNode
464  *
465  * PARAMETERS:  WalkState       - Current walk state
466  *              Node            - NS Node to be initialized
467  *              Op              - Parser object to be translated
468  *
469  * RETURN:      Status
470  *
471  * DESCRIPTION: Create the object to be associated with a namespace node
472  *
473  ******************************************************************************/
474 
475 ACPI_STATUS
476 AcpiDsCreateNode (
477     ACPI_WALK_STATE         *WalkState,
478     ACPI_NAMESPACE_NODE     *Node,
479     ACPI_PARSE_OBJECT       *Op)
480 {
481     ACPI_STATUS             Status;
482     ACPI_OPERAND_OBJECT     *ObjDesc;
483 
484 
485     ACPI_FUNCTION_TRACE_PTR ("DsCreateNode", Op);
486 
487 
488     /*
489      * Because of the execution pass through the non-control-method
490      * parts of the table, we can arrive here twice.  Only init
491      * the named object node the first time through
492      */
493     if (AcpiNsGetAttachedObject (Node))
494     {
495         return_ACPI_STATUS (AE_OK);
496     }
497 
498     if (!Op->Common.Value.Arg)
499     {
500         /* No arguments, there is nothing to do */
501 
502         return_ACPI_STATUS (AE_OK);
503     }
504 
505     /* Build an internal object for the argument(s) */
506 
507     Status = AcpiDsBuildInternalObject (WalkState, Op->Common.Value.Arg,
508                 &ObjDesc);
509     if (ACPI_FAILURE (Status))
510     {
511         return_ACPI_STATUS (Status);
512     }
513 
514     /* Re-type the object according to its argument */
515 
516     Node->Type = ACPI_GET_OBJECT_TYPE (ObjDesc);
517 
518     /* Attach obj to node */
519 
520     Status = AcpiNsAttachObject (Node, ObjDesc, Node->Type);
521 
522     /* Remove local reference to the object */
523 
524     AcpiUtRemoveReference (ObjDesc);
525     return_ACPI_STATUS (Status);
526 }
527 
528 #endif /* ACPI_NO_METHOD_EXECUTION */
529 
530 
531 /*******************************************************************************
532  *
533  * FUNCTION:    AcpiDsInitObjectFromOp
534  *
535  * PARAMETERS:  WalkState       - Current walk state
536  *              Op              - Parser op used to init the internal object
537  *              Opcode          - AML opcode associated with the object
538  *              RetObjDesc      - Namespace object to be initialized
539  *
540  * RETURN:      Status
541  *
542  * DESCRIPTION: Initialize a namespace object from a parser Op and its
543  *              associated arguments.  The namespace object is a more compact
544  *              representation of the Op and its arguments.
545  *
546  ******************************************************************************/
547 
548 ACPI_STATUS
549 AcpiDsInitObjectFromOp (
550     ACPI_WALK_STATE         *WalkState,
551     ACPI_PARSE_OBJECT       *Op,
552     UINT16                  Opcode,
553     ACPI_OPERAND_OBJECT     **RetObjDesc)
554 {
555     const ACPI_OPCODE_INFO  *OpInfo;
556     ACPI_OPERAND_OBJECT     *ObjDesc;
557     ACPI_STATUS             Status = AE_OK;
558 
559 
560     ACPI_FUNCTION_TRACE ("DsInitObjectFromOp");
561 
562 
563     ObjDesc = *RetObjDesc;
564     OpInfo = AcpiPsGetOpcodeInfo (Opcode);
565     if (OpInfo->Class == AML_CLASS_UNKNOWN)
566     {
567         /* Unknown opcode */
568 
569         return_ACPI_STATUS (AE_TYPE);
570     }
571 
572     /* Perform per-object initialization */
573 
574     switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
575     {
576     case ACPI_TYPE_BUFFER:
577 
578         /*
579          * Defer evaluation of Buffer TermArg operand
580          */
581         ObjDesc->Buffer.Node      = (ACPI_NAMESPACE_NODE *)
582                                         WalkState->Operands[0];
583         ObjDesc->Buffer.AmlStart  = Op->Named.Data;
584         ObjDesc->Buffer.AmlLength = Op->Named.Length;
585         break;
586 
587 
588     case ACPI_TYPE_PACKAGE:
589 
590         /*
591          * Defer evaluation of Package TermArg operand
592          */
593         ObjDesc->Package.Node      = (ACPI_NAMESPACE_NODE *)
594                                         WalkState->Operands[0];
595         ObjDesc->Package.AmlStart  = Op->Named.Data;
596         ObjDesc->Package.AmlLength = Op->Named.Length;
597         break;
598 
599 
600     case ACPI_TYPE_INTEGER:
601 
602         switch (OpInfo->Type)
603         {
604         case AML_TYPE_CONSTANT:
605             /*
606              * Resolve AML Constants here - AND ONLY HERE!
607              * All constants are integers.
608              * We mark the integer with a flag that indicates that it started
609              * life as a constant -- so that stores to constants will perform
610              * as expected (noop). ZeroOp is used as a placeholder for optional
611              * target operands.
612              */
613             ObjDesc->Common.Flags = AOPOBJ_AML_CONSTANT;
614 
615             switch (Opcode)
616             {
617             case AML_ZERO_OP:
618 
619                 ObjDesc->Integer.Value = 0;
620                 break;
621 
622             case AML_ONE_OP:
623 
624                 ObjDesc->Integer.Value = 1;
625                 break;
626 
627             case AML_ONES_OP:
628 
629                 ObjDesc->Integer.Value = ACPI_INTEGER_MAX;
630 
631                 /* Truncate value if we are executing from a 32-bit ACPI table */
632 
633 #ifndef ACPI_NO_METHOD_EXECUTION
634                 AcpiExTruncateFor32bitTable (ObjDesc);
635 #endif
636                 break;
637 
638             case AML_REVISION_OP:
639 
640                 ObjDesc->Integer.Value = ACPI_CA_VERSION;
641                 break;
642 
643             default:
644 
645                 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
646                     "Unknown constant opcode %X\n", Opcode));
647                 Status = AE_AML_OPERAND_TYPE;
648                 break;
649             }
650             break;
651 
652 
653         case AML_TYPE_LITERAL:
654 
655             ObjDesc->Integer.Value = Op->Common.Value.Integer;
656 #ifndef ACPI_NO_METHOD_EXECUTION
657             AcpiExTruncateFor32bitTable (ObjDesc);
658 #endif
659             break;
660 
661 
662         default:
663             ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Integer type %X\n",
664                 OpInfo->Type));
665             Status = AE_AML_OPERAND_TYPE;
666             break;
667         }
668         break;
669 
670 
671     case ACPI_TYPE_STRING:
672 
673         ObjDesc->String.Pointer = Op->Common.Value.String;
674         ObjDesc->String.Length = (UINT32) ACPI_STRLEN (Op->Common.Value.String);
675 
676         /*
677          * The string is contained in the ACPI table, don't ever try
678          * to delete it
679          */
680         ObjDesc->Common.Flags |= AOPOBJ_STATIC_POINTER;
681         break;
682 
683 
684     case ACPI_TYPE_METHOD:
685         break;
686 
687 
688     case ACPI_TYPE_LOCAL_REFERENCE:
689 
690         switch (OpInfo->Type)
691         {
692         case AML_TYPE_LOCAL_VARIABLE:
693 
694             /* Split the opcode into a base opcode + offset */
695 
696             ObjDesc->Reference.Opcode = AML_LOCAL_OP;
697             ObjDesc->Reference.Offset = Opcode - AML_LOCAL_OP;
698 
699 #ifndef ACPI_NO_METHOD_EXECUTION
700             Status = AcpiDsMethodDataGetNode (AML_LOCAL_OP,
701                         ObjDesc->Reference.Offset,
702                         WalkState,
703                         (ACPI_NAMESPACE_NODE **) &ObjDesc->Reference.Object);
704 #endif
705             break;
706 
707 
708         case AML_TYPE_METHOD_ARGUMENT:
709 
710             /* Split the opcode into a base opcode + offset */
711 
712             ObjDesc->Reference.Opcode = AML_ARG_OP;
713             ObjDesc->Reference.Offset = Opcode - AML_ARG_OP;
714 
715 #ifndef ACPI_NO_METHOD_EXECUTION
716             Status = AcpiDsMethodDataGetNode (AML_ARG_OP,
717                         ObjDesc->Reference.Offset,
718                         WalkState,
719                         (ACPI_NAMESPACE_NODE **) &ObjDesc->Reference.Object);
720 #endif
721             break;
722 
723         default: /* Other literals, etc.. */
724 
725             if (Op->Common.AmlOpcode == AML_INT_NAMEPATH_OP)
726             {
727                 /* Node was saved in Op */
728 
729                 ObjDesc->Reference.Node = Op->Common.Node;
730             }
731 
732             ObjDesc->Reference.Opcode = Opcode;
733             break;
734         }
735         break;
736 
737 
738     default:
739 
740         ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unimplemented data type: %X\n",
741             ACPI_GET_OBJECT_TYPE (ObjDesc)));
742 
743         Status = AE_AML_OPERAND_TYPE;
744         break;
745     }
746 
747     return_ACPI_STATUS (Status);
748 }
749 
750 
751