xref: /freebsd/sys/contrib/dev/acpica/components/dispatcher/dsobject.c (revision d93a896ef95946b0bf1219866fcb324b78543444)
1 /******************************************************************************
2  *
3  * Module Name: dsobject - Dispatcher object management routines
4  *
5  *****************************************************************************/
6 
7 /******************************************************************************
8  *
9  * 1. Copyright Notice
10  *
11  * Some or all of this work - Copyright (c) 1999 - 2017, 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  * Alternatively, you may choose to be licensed under the terms of the
117  * following license:
118  *
119  * Redistribution and use in source and binary forms, with or without
120  * modification, are permitted provided that the following conditions
121  * are met:
122  * 1. Redistributions of source code must retain the above copyright
123  *    notice, this list of conditions, and the following disclaimer,
124  *    without modification.
125  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
126  *    substantially similar to the "NO WARRANTY" disclaimer below
127  *    ("Disclaimer") and any redistribution must be conditioned upon
128  *    including a substantially similar Disclaimer requirement for further
129  *    binary redistribution.
130  * 3. Neither the names of the above-listed copyright holders nor the names
131  *    of any contributors may be used to endorse or promote products derived
132  *    from this software without specific prior written permission.
133  *
134  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
135  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
136  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
137  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
138  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
139  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
140  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
141  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
142  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
143  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
144  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
145  *
146  * Alternatively, you may choose to be licensed under the terms of the
147  * GNU General Public License ("GPL") version 2 as published by the Free
148  * Software Foundation.
149  *
150  *****************************************************************************/
151 
152 #include <contrib/dev/acpica/include/acpi.h>
153 #include <contrib/dev/acpica/include/accommon.h>
154 #include <contrib/dev/acpica/include/acparser.h>
155 #include <contrib/dev/acpica/include/amlcode.h>
156 #include <contrib/dev/acpica/include/acdispat.h>
157 #include <contrib/dev/acpica/include/acnamesp.h>
158 #include <contrib/dev/acpica/include/acinterp.h>
159 
160 #define _COMPONENT          ACPI_DISPATCHER
161         ACPI_MODULE_NAME    ("dsobject")
162 
163 
164 #ifndef ACPI_NO_METHOD_EXECUTION
165 /*******************************************************************************
166  *
167  * FUNCTION:    AcpiDsBuildInternalObject
168  *
169  * PARAMETERS:  WalkState       - Current walk state
170  *              Op              - Parser object to be translated
171  *              ObjDescPtr      - Where the ACPI internal object is returned
172  *
173  * RETURN:      Status
174  *
175  * DESCRIPTION: Translate a parser Op object to the equivalent namespace object
176  *              Simple objects are any objects other than a package object!
177  *
178  ******************************************************************************/
179 
180 ACPI_STATUS
181 AcpiDsBuildInternalObject (
182     ACPI_WALK_STATE         *WalkState,
183     ACPI_PARSE_OBJECT       *Op,
184     ACPI_OPERAND_OBJECT     **ObjDescPtr)
185 {
186     ACPI_OPERAND_OBJECT     *ObjDesc;
187     ACPI_STATUS             Status;
188 
189 
190     ACPI_FUNCTION_TRACE (DsBuildInternalObject);
191 
192 
193     *ObjDescPtr = NULL;
194     if (Op->Common.AmlOpcode == AML_INT_NAMEPATH_OP)
195     {
196         /*
197          * This is a named object reference. If this name was
198          * previously looked up in the namespace, it was stored in
199          * this op. Otherwise, go ahead and look it up now
200          */
201         if (!Op->Common.Node)
202         {
203             /* Check if we are resolving a named reference within a package */
204 
205             if ((Op->Common.Parent->Common.AmlOpcode == AML_PACKAGE_OP) ||
206                 (Op->Common.Parent->Common.AmlOpcode == AML_VARIABLE_PACKAGE_OP))
207             {
208                 /*
209                  * We won't resolve package elements here, we will do this
210                  * after all ACPI tables are loaded into the namespace. This
211                  * behavior supports both forward references to named objects
212                  * and external references to objects in other tables.
213                  */
214                 goto CreateNewObject;
215             }
216             else
217             {
218                 Status = AcpiNsLookup (WalkState->ScopeInfo,
219                     Op->Common.Value.String,
220                     ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
221                     ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, NULL,
222                     ACPI_CAST_INDIRECT_PTR (
223                         ACPI_NAMESPACE_NODE, &(Op->Common.Node)));
224                 if (ACPI_FAILURE (Status))
225                 {
226                     ACPI_ERROR_NAMESPACE (Op->Common.Value.String, Status);
227                     return_ACPI_STATUS (Status);
228                 }
229             }
230         }
231     }
232 
233 CreateNewObject:
234 
235     /* Create and init a new internal ACPI object */
236 
237     ObjDesc = AcpiUtCreateInternalObject (
238         (AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode))->ObjectType);
239     if (!ObjDesc)
240     {
241         return_ACPI_STATUS (AE_NO_MEMORY);
242     }
243 
244     Status = AcpiDsInitObjectFromOp (
245         WalkState, Op, Op->Common.AmlOpcode, &ObjDesc);
246     if (ACPI_FAILURE (Status))
247     {
248         AcpiUtRemoveReference (ObjDesc);
249         return_ACPI_STATUS (Status);
250     }
251 
252     /*
253      * Handling for unresolved package reference elements.
254      * These are elements that are namepaths.
255      */
256     if ((Op->Common.Parent->Common.AmlOpcode == AML_PACKAGE_OP) ||
257         (Op->Common.Parent->Common.AmlOpcode == AML_VARIABLE_PACKAGE_OP))
258     {
259         ObjDesc->Reference.Resolved = TRUE;
260 
261         if ((Op->Common.AmlOpcode == AML_INT_NAMEPATH_OP) &&
262             !ObjDesc->Reference.Node)
263         {
264             /*
265              * Name was unresolved above.
266              * Get the prefix node for later lookup
267              */
268             ObjDesc->Reference.Node = WalkState->ScopeInfo->Scope.Node;
269             ObjDesc->Reference.Aml = Op->Common.Aml;
270             ObjDesc->Reference.Resolved = FALSE;
271         }
272     }
273 
274     *ObjDescPtr = ObjDesc;
275     return_ACPI_STATUS (Status);
276 }
277 
278 
279 /*******************************************************************************
280  *
281  * FUNCTION:    AcpiDsBuildInternalBufferObj
282  *
283  * PARAMETERS:  WalkState       - Current walk state
284  *              Op              - Parser object to be translated
285  *              BufferLength    - Length of the buffer
286  *              ObjDescPtr      - Where the ACPI internal object is returned
287  *
288  * RETURN:      Status
289  *
290  * DESCRIPTION: Translate a parser Op package object to the equivalent
291  *              namespace object
292  *
293  ******************************************************************************/
294 
295 ACPI_STATUS
296 AcpiDsBuildInternalBufferObj (
297     ACPI_WALK_STATE         *WalkState,
298     ACPI_PARSE_OBJECT       *Op,
299     UINT32                  BufferLength,
300     ACPI_OPERAND_OBJECT     **ObjDescPtr)
301 {
302     ACPI_PARSE_OBJECT       *Arg;
303     ACPI_OPERAND_OBJECT     *ObjDesc;
304     ACPI_PARSE_OBJECT       *ByteList;
305     UINT32                  ByteListLength = 0;
306 
307 
308     ACPI_FUNCTION_TRACE (DsBuildInternalBufferObj);
309 
310 
311     /*
312      * If we are evaluating a Named buffer object "Name (xxxx, Buffer)".
313      * The buffer object already exists (from the NS node), otherwise it must
314      * be created.
315      */
316     ObjDesc = *ObjDescPtr;
317     if (!ObjDesc)
318     {
319         /* Create a new buffer object */
320 
321         ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_BUFFER);
322         *ObjDescPtr = ObjDesc;
323         if (!ObjDesc)
324         {
325             return_ACPI_STATUS (AE_NO_MEMORY);
326         }
327     }
328 
329     /*
330      * Second arg is the buffer data (optional) ByteList can be either
331      * individual bytes or a string initializer. In either case, a
332      * ByteList appears in the AML.
333      */
334     Arg = Op->Common.Value.Arg;         /* skip first arg */
335 
336     ByteList = Arg->Named.Next;
337     if (ByteList)
338     {
339         if (ByteList->Common.AmlOpcode != AML_INT_BYTELIST_OP)
340         {
341             ACPI_ERROR ((AE_INFO,
342                 "Expecting bytelist, found AML opcode 0x%X in op %p",
343                 ByteList->Common.AmlOpcode, ByteList));
344 
345             AcpiUtRemoveReference (ObjDesc);
346             return (AE_TYPE);
347         }
348 
349         ByteListLength = (UINT32) ByteList->Common.Value.Integer;
350     }
351 
352     /*
353      * The buffer length (number of bytes) will be the larger of:
354      * 1) The specified buffer length and
355      * 2) The length of the initializer byte list
356      */
357     ObjDesc->Buffer.Length = BufferLength;
358     if (ByteListLength > BufferLength)
359     {
360         ObjDesc->Buffer.Length = ByteListLength;
361     }
362 
363     /* Allocate the buffer */
364 
365     if (ObjDesc->Buffer.Length == 0)
366     {
367         ObjDesc->Buffer.Pointer = NULL;
368         ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
369             "Buffer defined with zero length in AML, creating\n"));
370     }
371     else
372     {
373         ObjDesc->Buffer.Pointer =
374             ACPI_ALLOCATE_ZEROED (ObjDesc->Buffer.Length);
375         if (!ObjDesc->Buffer.Pointer)
376         {
377             AcpiUtDeleteObjectDesc (ObjDesc);
378             return_ACPI_STATUS (AE_NO_MEMORY);
379         }
380 
381         /* Initialize buffer from the ByteList (if present) */
382 
383         if (ByteList)
384         {
385             memcpy (ObjDesc->Buffer.Pointer, ByteList->Named.Data,
386                 ByteListLength);
387         }
388     }
389 
390     ObjDesc->Buffer.Flags |= AOPOBJ_DATA_VALID;
391     Op->Common.Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, ObjDesc);
392     return_ACPI_STATUS (AE_OK);
393 }
394 
395 /*******************************************************************************
396  *
397  * FUNCTION:    AcpiDsCreateNode
398  *
399  * PARAMETERS:  WalkState       - Current walk state
400  *              Node            - NS Node to be initialized
401  *              Op              - Parser object to be translated
402  *
403  * RETURN:      Status
404  *
405  * DESCRIPTION: Create the object to be associated with a namespace node
406  *
407  ******************************************************************************/
408 
409 ACPI_STATUS
410 AcpiDsCreateNode (
411     ACPI_WALK_STATE         *WalkState,
412     ACPI_NAMESPACE_NODE     *Node,
413     ACPI_PARSE_OBJECT       *Op)
414 {
415     ACPI_STATUS             Status;
416     ACPI_OPERAND_OBJECT     *ObjDesc;
417 
418 
419     ACPI_FUNCTION_TRACE_PTR (DsCreateNode, Op);
420 
421 
422     /*
423      * Because of the execution pass through the non-control-method
424      * parts of the table, we can arrive here twice. Only init
425      * the named object node the first time through
426      */
427     if (AcpiNsGetAttachedObject (Node))
428     {
429         return_ACPI_STATUS (AE_OK);
430     }
431 
432     if (!Op->Common.Value.Arg)
433     {
434         /* No arguments, there is nothing to do */
435 
436         return_ACPI_STATUS (AE_OK);
437     }
438 
439     /* Build an internal object for the argument(s) */
440 
441     Status = AcpiDsBuildInternalObject (
442         WalkState, Op->Common.Value.Arg, &ObjDesc);
443     if (ACPI_FAILURE (Status))
444     {
445         return_ACPI_STATUS (Status);
446     }
447 
448     /* Re-type the object according to its argument */
449 
450     Node->Type = ObjDesc->Common.Type;
451 
452     /* Attach obj to node */
453 
454     Status = AcpiNsAttachObject (Node, ObjDesc, Node->Type);
455 
456     /* Remove local reference to the object */
457 
458     AcpiUtRemoveReference (ObjDesc);
459     return_ACPI_STATUS (Status);
460 }
461 
462 #endif /* ACPI_NO_METHOD_EXECUTION */
463 
464 
465 /*******************************************************************************
466  *
467  * FUNCTION:    AcpiDsInitObjectFromOp
468  *
469  * PARAMETERS:  WalkState       - Current walk state
470  *              Op              - Parser op used to init the internal object
471  *              Opcode          - AML opcode associated with the object
472  *              RetObjDesc      - Namespace object to be initialized
473  *
474  * RETURN:      Status
475  *
476  * DESCRIPTION: Initialize a namespace object from a parser Op and its
477  *              associated arguments. The namespace object is a more compact
478  *              representation of the Op and its arguments.
479  *
480  ******************************************************************************/
481 
482 ACPI_STATUS
483 AcpiDsInitObjectFromOp (
484     ACPI_WALK_STATE         *WalkState,
485     ACPI_PARSE_OBJECT       *Op,
486     UINT16                  Opcode,
487     ACPI_OPERAND_OBJECT     **RetObjDesc)
488 {
489     const ACPI_OPCODE_INFO  *OpInfo;
490     ACPI_OPERAND_OBJECT     *ObjDesc;
491     ACPI_STATUS             Status = AE_OK;
492 
493 
494     ACPI_FUNCTION_TRACE (DsInitObjectFromOp);
495 
496 
497     ObjDesc = *RetObjDesc;
498     OpInfo = AcpiPsGetOpcodeInfo (Opcode);
499     if (OpInfo->Class == AML_CLASS_UNKNOWN)
500     {
501         /* Unknown opcode */
502 
503         return_ACPI_STATUS (AE_TYPE);
504     }
505 
506     /* Perform per-object initialization */
507 
508     switch (ObjDesc->Common.Type)
509     {
510     case ACPI_TYPE_BUFFER:
511         /*
512          * Defer evaluation of Buffer TermArg operand
513          */
514         ObjDesc->Buffer.Node = ACPI_CAST_PTR (
515             ACPI_NAMESPACE_NODE, WalkState->Operands[0]);
516         ObjDesc->Buffer.AmlStart = Op->Named.Data;
517         ObjDesc->Buffer.AmlLength = Op->Named.Length;
518         break;
519 
520     case ACPI_TYPE_PACKAGE:
521         /*
522          * Defer evaluation of Package TermArg operand and all
523          * package elements. (01/2017): We defer the element
524          * resolution to allow forward references from the package
525          * in order to provide compatibility with other ACPI
526          * implementations.
527          */
528         ObjDesc->Package.Node = ACPI_CAST_PTR (
529             ACPI_NAMESPACE_NODE, WalkState->Operands[0]);
530 
531         if (!Op->Named.Data)
532         {
533             return_ACPI_STATUS (AE_OK);
534         }
535 
536         ObjDesc->Package.AmlStart = Op->Named.Data;
537         ObjDesc->Package.AmlLength = Op->Named.Length;
538         break;
539 
540     case ACPI_TYPE_INTEGER:
541 
542         switch (OpInfo->Type)
543         {
544         case AML_TYPE_CONSTANT:
545             /*
546              * Resolve AML Constants here - AND ONLY HERE!
547              * All constants are integers.
548              * We mark the integer with a flag that indicates that it started
549              * life as a constant -- so that stores to constants will perform
550              * as expected (noop). ZeroOp is used as a placeholder for optional
551              * target operands.
552              */
553             ObjDesc->Common.Flags = AOPOBJ_AML_CONSTANT;
554 
555             switch (Opcode)
556             {
557             case AML_ZERO_OP:
558 
559                 ObjDesc->Integer.Value = 0;
560                 break;
561 
562             case AML_ONE_OP:
563 
564                 ObjDesc->Integer.Value = 1;
565                 break;
566 
567             case AML_ONES_OP:
568 
569                 ObjDesc->Integer.Value = ACPI_UINT64_MAX;
570 
571                 /* Truncate value if we are executing from a 32-bit ACPI table */
572 
573 #ifndef ACPI_NO_METHOD_EXECUTION
574                 (void) AcpiExTruncateFor32bitTable (ObjDesc);
575 #endif
576                 break;
577 
578             case AML_REVISION_OP:
579 
580                 ObjDesc->Integer.Value = ACPI_CA_VERSION;
581                 break;
582 
583             default:
584 
585                 ACPI_ERROR ((AE_INFO,
586                     "Unknown constant opcode 0x%X", Opcode));
587                 Status = AE_AML_OPERAND_TYPE;
588                 break;
589             }
590             break;
591 
592         case AML_TYPE_LITERAL:
593 
594             ObjDesc->Integer.Value = Op->Common.Value.Integer;
595 
596 #ifndef ACPI_NO_METHOD_EXECUTION
597             if (AcpiExTruncateFor32bitTable (ObjDesc))
598             {
599                 /* Warn if we found a 64-bit constant in a 32-bit table */
600 
601                 ACPI_WARNING ((AE_INFO,
602                     "Truncated 64-bit constant found in 32-bit table: %8.8X%8.8X => %8.8X",
603                     ACPI_FORMAT_UINT64 (Op->Common.Value.Integer),
604                     (UINT32) ObjDesc->Integer.Value));
605             }
606 #endif
607             break;
608 
609         default:
610 
611             ACPI_ERROR ((AE_INFO, "Unknown Integer type 0x%X",
612                 OpInfo->Type));
613             Status = AE_AML_OPERAND_TYPE;
614             break;
615         }
616         break;
617 
618     case ACPI_TYPE_STRING:
619 
620         ObjDesc->String.Pointer = Op->Common.Value.String;
621         ObjDesc->String.Length = (UINT32) strlen (Op->Common.Value.String);
622 
623         /*
624          * The string is contained in the ACPI table, don't ever try
625          * to delete it
626          */
627         ObjDesc->Common.Flags |= AOPOBJ_STATIC_POINTER;
628         break;
629 
630     case ACPI_TYPE_METHOD:
631         break;
632 
633     case ACPI_TYPE_LOCAL_REFERENCE:
634 
635         switch (OpInfo->Type)
636         {
637         case AML_TYPE_LOCAL_VARIABLE:
638 
639             /* Local ID (0-7) is (AML opcode - base AML_FIRST_LOCAL_OP) */
640 
641             ObjDesc->Reference.Value = ((UINT32) Opcode) - AML_FIRST_LOCAL_OP;
642             ObjDesc->Reference.Class = ACPI_REFCLASS_LOCAL;
643 
644 #ifndef ACPI_NO_METHOD_EXECUTION
645             Status = AcpiDsMethodDataGetNode (ACPI_REFCLASS_LOCAL,
646                 ObjDesc->Reference.Value, WalkState,
647                 ACPI_CAST_INDIRECT_PTR (ACPI_NAMESPACE_NODE,
648                     &ObjDesc->Reference.Object));
649 #endif
650             break;
651 
652         case AML_TYPE_METHOD_ARGUMENT:
653 
654             /* Arg ID (0-6) is (AML opcode - base AML_FIRST_ARG_OP) */
655 
656             ObjDesc->Reference.Value = ((UINT32) Opcode) - AML_FIRST_ARG_OP;
657             ObjDesc->Reference.Class = ACPI_REFCLASS_ARG;
658 
659 #ifndef ACPI_NO_METHOD_EXECUTION
660             Status = AcpiDsMethodDataGetNode (ACPI_REFCLASS_ARG,
661                 ObjDesc->Reference.Value, WalkState,
662                 ACPI_CAST_INDIRECT_PTR (ACPI_NAMESPACE_NODE,
663                     &ObjDesc->Reference.Object));
664 #endif
665             break;
666 
667         default: /* Object name or Debug object */
668 
669             switch (Op->Common.AmlOpcode)
670             {
671             case AML_INT_NAMEPATH_OP:
672 
673                 /* Node was saved in Op */
674 
675                 ObjDesc->Reference.Node = Op->Common.Node;
676                 ObjDesc->Reference.Class = ACPI_REFCLASS_NAME;
677                 if (Op->Common.Node)
678                 {
679                     ObjDesc->Reference.Object = Op->Common.Node->Object;
680                 }
681                 break;
682 
683             case AML_DEBUG_OP:
684 
685                 ObjDesc->Reference.Class = ACPI_REFCLASS_DEBUG;
686                 break;
687 
688             default:
689 
690                 ACPI_ERROR ((AE_INFO,
691                     "Unimplemented reference type for AML opcode: 0x%4.4X", Opcode));
692                 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
693             }
694             break;
695         }
696         break;
697 
698     default:
699 
700         ACPI_ERROR ((AE_INFO, "Unimplemented data type: 0x%X",
701             ObjDesc->Common.Type));
702 
703         Status = AE_AML_OPERAND_TYPE;
704         break;
705     }
706 
707     return_ACPI_STATUS (Status);
708 }
709