Merge from vendor branch OPENSSH:
[dragonfly.git] / sys / contrib / dev / acpica / dsobject.c
1 /******************************************************************************
2  *
3  * Module Name: dsobject - Dispatcher object management routines
4  *              $Revision: 114 $
5  *
6  *****************************************************************************/
7
8 /******************************************************************************
9  *
10  * 1. Copyright Notice
11  *
12  * Some or all of this work - Copyright (c) 1999 - 2003, 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 /* $DragonFly: src/sys/contrib/dev/acpica/Attic/dsobject.c,v 1.1 2003/09/24 03:32:15 drhodus Exp $                                                               */
117
118 #define __DSOBJECT_C__
119
120 #include "acpi.h"
121 #include "acparser.h"
122 #include "amlcode.h"
123 #include "acdispat.h"
124 #include "acnamesp.h"
125 #include "acinterp.h"
126
127 #define _COMPONENT          ACPI_DISPATCHER
128         ACPI_MODULE_NAME    ("dsobject")
129
130
131 #ifndef ACPI_NO_METHOD_EXECUTION
132 /*****************************************************************************
133  *
134  * FUNCTION:    AcpiDsBuildInternalObject
135  *
136  * PARAMETERS:  WalkState       - Current walk state
137  *              Op              - Parser object to be translated
138  *              ObjDescPtr      - Where the ACPI internal object is returned
139  *
140  * RETURN:      Status
141  *
142  * DESCRIPTION: Translate a parser Op object to the equivalent namespace object
143  *              Simple objects are any objects other than a package object!
144  *
145  ****************************************************************************/
146
147 ACPI_STATUS
148 AcpiDsBuildInternalObject (
149     ACPI_WALK_STATE         *WalkState,
150     ACPI_PARSE_OBJECT       *Op,
151     ACPI_OPERAND_OBJECT     **ObjDescPtr)
152 {
153     ACPI_OPERAND_OBJECT     *ObjDesc;
154     ACPI_STATUS             Status;
155
156
157     ACPI_FUNCTION_TRACE ("DsBuildInternalObject");
158
159
160     *ObjDescPtr = NULL;
161     if (Op->Common.AmlOpcode == AML_INT_NAMEPATH_OP)
162     {
163         /*
164          * This is an named object reference.  If this name was
165          * previously looked up in the namespace, it was stored in this op.
166          * Otherwise, go ahead and look it up now
167          */
168         if (!Op->Common.Node)
169         {
170             Status = AcpiNsLookup (WalkState->ScopeInfo, Op->Common.Value.String,
171                             ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
172                             ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, NULL,
173                             (ACPI_NAMESPACE_NODE **) &(Op->Common.Node));
174
175             if (ACPI_FAILURE (Status))
176             {
177                 ACPI_REPORT_NSERROR (Op->Common.Value.String, Status);
178                 return_ACPI_STATUS (Status);
179             }
180         }
181     }
182
183     /* Create and init the internal ACPI object */
184
185     ObjDesc = AcpiUtCreateInternalObject ((AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode))->ObjectType);
186     if (!ObjDesc)
187     {
188         return_ACPI_STATUS (AE_NO_MEMORY);
189     }
190
191     Status = AcpiDsInitObjectFromOp (WalkState, Op, Op->Common.AmlOpcode, &ObjDesc);
192     if (ACPI_FAILURE (Status))
193     {
194         AcpiUtRemoveReference (ObjDesc);
195         return_ACPI_STATUS (Status);
196     }
197
198     *ObjDescPtr = ObjDesc;
199     return_ACPI_STATUS (AE_OK);
200 }
201
202
203 /*****************************************************************************
204  *
205  * FUNCTION:    AcpiDsBuildInternalBufferObj
206  *
207  * PARAMETERS:  WalkState       - Current walk state
208  *              Op              - Parser object to be translated
209  *              BufferLength    - Length of the buffer
210  *              ObjDescPtr      - Where the ACPI internal object is returned
211  *
212  * RETURN:      Status
213  *
214  * DESCRIPTION: Translate a parser Op package object to the equivalent
215  *              namespace object
216  *
217  ****************************************************************************/
218
219 ACPI_STATUS
220 AcpiDsBuildInternalBufferObj (
221     ACPI_WALK_STATE         *WalkState,
222     ACPI_PARSE_OBJECT       *Op,
223     UINT32                  BufferLength,
224     ACPI_OPERAND_OBJECT     **ObjDescPtr)
225 {
226     ACPI_PARSE_OBJECT       *Arg;
227     ACPI_OPERAND_OBJECT     *ObjDesc;
228     ACPI_PARSE_OBJECT       *ByteList;
229     UINT32                  ByteListLength = 0;
230
231
232     ACPI_FUNCTION_TRACE ("DsBuildInternalBufferObj");
233
234
235     ObjDesc = *ObjDescPtr;
236     if (ObjDesc)
237     {
238         /*
239          * We are evaluating a Named buffer object "Name (xxxx, Buffer)".
240          * The buffer object already exists (from the NS node)
241          */
242     }
243     else
244     {
245         /* Create a new buffer object */
246
247         ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_BUFFER);
248         *ObjDescPtr = ObjDesc;
249         if (!ObjDesc)
250         {
251             return_ACPI_STATUS (AE_NO_MEMORY);
252         }
253     }
254
255     /*
256      * Second arg is the buffer data (optional) ByteList can be either
257      * individual bytes or a string initializer.  In either case, a
258      * ByteList appears in the AML.
259      */
260     Arg = Op->Common.Value.Arg;         /* skip first arg */
261
262     ByteList = Arg->Named.Next;
263     if (ByteList)
264     {
265         if (ByteList->Common.AmlOpcode != AML_INT_BYTELIST_OP)
266         {
267             ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
268                 "Expecting bytelist, got AML opcode %X in op %p\n",
269                 ByteList->Common.AmlOpcode, ByteList));
270
271             AcpiUtRemoveReference (ObjDesc);
272             return (AE_TYPE);
273         }
274
275         ByteListLength = ByteList->Common.Value.Integer32;
276     }
277
278     /*
279      * The buffer length (number of bytes) will be the larger of:
280      * 1) The specified buffer length and
281      * 2) The length of the initializer byte list
282      */
283     ObjDesc->Buffer.Length = BufferLength;
284     if (ByteListLength > BufferLength)
285     {
286         ObjDesc->Buffer.Length = ByteListLength;
287     }
288
289     /* Allocate the buffer */
290
291     if (ObjDesc->Buffer.Length == 0)
292     {
293         ObjDesc->Buffer.Pointer = NULL;
294         ACPI_REPORT_WARNING (("Buffer created with zero length in AML\n"));
295     }
296     else
297     {
298         ObjDesc->Buffer.Pointer = ACPI_MEM_CALLOCATE (
299                                         ObjDesc->Buffer.Length);
300         if (!ObjDesc->Buffer.Pointer)
301         {
302             AcpiUtDeleteObjectDesc (ObjDesc);
303             return_ACPI_STATUS (AE_NO_MEMORY);
304         }
305
306         /* Initialize buffer from the ByteList (if present) */
307
308         if (ByteList)
309         {
310             ACPI_MEMCPY (ObjDesc->Buffer.Pointer, ByteList->Named.Data,
311                          ByteListLength);
312         }
313     }
314
315     ObjDesc->Buffer.Flags |= AOPOBJ_DATA_VALID;
316     Op->Common.Node = (ACPI_NAMESPACE_NODE *) ObjDesc;
317     return_ACPI_STATUS (AE_OK);
318 }
319
320
321 /*****************************************************************************
322  *
323  * FUNCTION:    AcpiDsBuildInternalPackageObj
324  *
325  * PARAMETERS:  WalkState       - Current walk state
326  *              Op              - Parser object to be translated
327  *              PackageLength   - Number of elements in the package
328  *              ObjDescPtr      - Where the ACPI internal object is returned
329  *
330  * RETURN:      Status
331  *
332  * DESCRIPTION: Translate a parser Op package object to the equivalent
333  *              namespace object
334  *
335  ****************************************************************************/
336
337 ACPI_STATUS
338 AcpiDsBuildInternalPackageObj (
339     ACPI_WALK_STATE         *WalkState,
340     ACPI_PARSE_OBJECT       *Op,
341     UINT32                  PackageLength,
342     ACPI_OPERAND_OBJECT     **ObjDescPtr)
343 {
344     ACPI_PARSE_OBJECT       *Arg;
345     ACPI_PARSE_OBJECT       *Parent;
346     ACPI_OPERAND_OBJECT     *ObjDesc = NULL;
347     UINT32                  PackageListLength;
348     ACPI_STATUS             Status = AE_OK;
349     UINT32                  i;
350
351
352     ACPI_FUNCTION_TRACE ("DsBuildInternalPackageObj");
353
354
355     /* Find the parent of a possibly nested package */
356
357     Parent = Op->Common.Parent;
358     while ((Parent->Common.AmlOpcode == AML_PACKAGE_OP)     ||
359            (Parent->Common.AmlOpcode == AML_VAR_PACKAGE_OP))
360     {
361         Parent = Parent->Common.Parent;
362     }
363
364     ObjDesc = *ObjDescPtr;
365     if (ObjDesc)
366     {
367         /*
368          * We are evaluating a Named package object "Name (xxxx, Package)".
369          * Get the existing package object from the NS node
370          */
371     }
372     else
373     {
374         ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_PACKAGE);
375         *ObjDescPtr = ObjDesc;
376         if (!ObjDesc)
377         {
378             return_ACPI_STATUS (AE_NO_MEMORY);
379         }
380
381         ObjDesc->Package.Node = Parent->Common.Node;
382     }
383
384     ObjDesc->Package.Count = PackageLength;
385
386     /* Count the number of items in the package list */
387
388     PackageListLength = 0;
389     Arg = Op->Common.Value.Arg;
390     Arg = Arg->Common.Next;
391     while (Arg)
392     {
393         PackageListLength++;
394         Arg = Arg->Common.Next;
395     }
396
397     /*
398      * The package length (number of elements) will be the greater
399      * of the specified length and the length of the initializer list
400      */
401     if (PackageListLength > PackageLength)
402     {
403         ObjDesc->Package.Count = PackageListLength;
404     }
405
406     /*
407      * Allocate the pointer array (array of pointers to the
408      * individual objects). Add an extra pointer slot so
409      * that the list is always null terminated.
410      */
411     ObjDesc->Package.Elements = ACPI_MEM_CALLOCATE (
412                 ((ACPI_SIZE) ObjDesc->Package.Count + 1) * sizeof (void *));
413
414     if (!ObjDesc->Package.Elements)
415     {
416         AcpiUtDeleteObjectDesc (ObjDesc);
417         return_ACPI_STATUS (AE_NO_MEMORY);
418     }
419
420     /*
421      * Now init the elements of the package
422      */
423     i = 0;
424     Arg = Op->Common.Value.Arg;
425     Arg = Arg->Common.Next;
426     while (Arg)
427     {
428         if (Arg->Common.AmlOpcode == AML_INT_RETURN_VALUE_OP)
429         {
430             /* Object (package or buffer) is already built */
431
432             ObjDesc->Package.Elements[i] = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Arg->Common.Node);
433         }
434         else
435         {
436             Status = AcpiDsBuildInternalObject (WalkState, Arg,
437                                         &ObjDesc->Package.Elements[i]);
438         }
439
440         i++;
441         Arg = Arg->Common.Next;
442     }
443
444     ObjDesc->Package.Flags |= AOPOBJ_DATA_VALID;
445     Op->Common.Node = (ACPI_NAMESPACE_NODE *) ObjDesc;
446     return_ACPI_STATUS (Status);
447 }
448
449
450 /*****************************************************************************
451  *
452  * FUNCTION:    AcpiDsCreateNode
453  *
454  * PARAMETERS:  WalkState       - Current walk state
455  *              Node            - NS Node to be initialized
456  *              Op              - Parser object to be translated
457  *
458  * RETURN:      Status
459  *
460  * DESCRIPTION: Create the object to be associated with a namespace node
461  *
462  ****************************************************************************/
463
464 ACPI_STATUS
465 AcpiDsCreateNode (
466     ACPI_WALK_STATE         *WalkState,
467     ACPI_NAMESPACE_NODE     *Node,
468     ACPI_PARSE_OBJECT       *Op)
469 {
470     ACPI_STATUS             Status;
471     ACPI_OPERAND_OBJECT     *ObjDesc;
472
473
474     ACPI_FUNCTION_TRACE_PTR ("DsCreateNode", Op);
475
476
477     /*
478      * Because of the execution pass through the non-control-method
479      * parts of the table, we can arrive here twice.  Only init
480      * the named object node the first time through
481      */
482     if (AcpiNsGetAttachedObject (Node))
483     {
484         return_ACPI_STATUS (AE_OK);
485     }
486
487     if (!Op->Common.Value.Arg)
488     {
489         /* No arguments, there is nothing to do */
490
491         return_ACPI_STATUS (AE_OK);
492     }
493
494     /* Build an internal object for the argument(s) */
495
496     Status = AcpiDsBuildInternalObject (WalkState, Op->Common.Value.Arg, &ObjDesc);
497     if (ACPI_FAILURE (Status))
498     {
499         return_ACPI_STATUS (Status);
500     }
501
502     /* Re-type the object according to its argument */
503
504     Node->Type = ACPI_GET_OBJECT_TYPE (ObjDesc);
505
506     /* Attach obj to node */
507
508     Status = AcpiNsAttachObject (Node, ObjDesc, Node->Type);
509
510     /* Remove local reference to the object */
511
512     AcpiUtRemoveReference (ObjDesc);
513     return_ACPI_STATUS (Status);
514 }
515
516 #endif /* ACPI_NO_METHOD_EXECUTION */
517
518
519 /*****************************************************************************
520  *
521  * FUNCTION:    AcpiDsInitObjectFromOp
522  *
523  * PARAMETERS:  WalkState       - Current walk state
524  *              Op              - Parser op used to init the internal object
525  *              Opcode          - AML opcode associated with the object
526  *              RetObjDesc      - Namespace object to be initialized
527  *
528  * RETURN:      Status
529  *
530  * DESCRIPTION: Initialize a namespace object from a parser Op and its
531  *              associated arguments.  The namespace object is a more compact
532  *              representation of the Op and its arguments.
533  *
534  ****************************************************************************/
535
536 ACPI_STATUS
537 AcpiDsInitObjectFromOp (
538     ACPI_WALK_STATE         *WalkState,
539     ACPI_PARSE_OBJECT       *Op,
540     UINT16                  Opcode,
541     ACPI_OPERAND_OBJECT     **RetObjDesc)
542 {
543     const ACPI_OPCODE_INFO  *OpInfo;
544     ACPI_OPERAND_OBJECT     *ObjDesc;
545     ACPI_STATUS             Status = AE_OK;
546
547
548     ACPI_FUNCTION_TRACE ("DsInitObjectFromOp");
549
550
551     ObjDesc = *RetObjDesc;
552     OpInfo = AcpiPsGetOpcodeInfo (Opcode);
553     if (OpInfo->Class == AML_CLASS_UNKNOWN)
554     {
555         /* Unknown opcode */
556
557         return_ACPI_STATUS (AE_TYPE);
558     }
559
560     /* Perform per-object initialization */
561
562     switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
563     {
564     case ACPI_TYPE_BUFFER:
565
566         /*
567          * Defer evaluation of Buffer TermArg operand
568          */
569         ObjDesc->Buffer.Node      = (ACPI_NAMESPACE_NODE *) WalkState->Operands[0];
570         ObjDesc->Buffer.AmlStart  = Op->Named.Data;
571         ObjDesc->Buffer.AmlLength = Op->Named.Length;
572         break;
573
574
575     case ACPI_TYPE_PACKAGE:
576
577         /*
578          * Defer evaluation of Package TermArg operand
579          */
580         ObjDesc->Package.Node      = (ACPI_NAMESPACE_NODE *) WalkState->Operands[0];
581         ObjDesc->Package.AmlStart  = Op->Named.Data;
582         ObjDesc->Package.AmlLength = Op->Named.Length;
583         break;
584
585
586     case ACPI_TYPE_INTEGER:
587
588         switch (OpInfo->Type)
589         {
590         case AML_TYPE_CONSTANT:
591             /*
592              * Resolve AML Constants here - AND ONLY HERE!
593              * All constants are integers.
594              * We mark the integer with a flag that indicates that it started life
595              * as a constant -- so that stores to constants will perform as expected (noop).
596              * (ZeroOp is used as a placeholder for optional target operands.)
597              */
598             ObjDesc->Common.Flags = AOPOBJ_AML_CONSTANT;
599
600             switch (Opcode)
601             {
602             case AML_ZERO_OP:
603
604                 ObjDesc->Integer.Value = 0;
605                 break;
606
607             case AML_ONE_OP:
608
609                 ObjDesc->Integer.Value = 1;
610                 break;
611
612             case AML_ONES_OP:
613
614                 ObjDesc->Integer.Value = ACPI_INTEGER_MAX;
615
616                 /* Truncate value if we are executing from a 32-bit ACPI table */
617
618 #ifndef ACPI_NO_METHOD_EXECUTION
619                 AcpiExTruncateFor32bitTable (ObjDesc);
620 #endif
621                 break;
622
623             case AML_REVISION_OP:
624
625                 ObjDesc->Integer.Value = ACPI_CA_SUPPORT_LEVEL;
626                 break;
627
628             default:
629
630                 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown constant opcode %X\n", Opcode));
631                 Status = AE_AML_OPERAND_TYPE;
632                 break;
633             }
634             break;
635
636
637         case AML_TYPE_LITERAL:
638
639             ObjDesc->Integer.Value = Op->Common.Value.Integer;
640             break;
641
642
643         default:
644             ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Integer type %X\n", OpInfo->Type));
645             Status = AE_AML_OPERAND_TYPE;
646             break;
647         }
648         break;
649
650
651     case ACPI_TYPE_STRING:
652
653         ObjDesc->String.Pointer = Op->Common.Value.String;
654         ObjDesc->String.Length = (UINT32) ACPI_STRLEN (Op->Common.Value.String);
655
656         /*
657          * The string is contained in the ACPI table, don't ever try
658          * to delete it
659          */
660         ObjDesc->Common.Flags |= AOPOBJ_STATIC_POINTER;
661         break;
662
663
664     case ACPI_TYPE_METHOD:
665         break;
666
667
668     case ACPI_TYPE_LOCAL_REFERENCE:
669
670         switch (OpInfo->Type)
671         {
672         case AML_TYPE_LOCAL_VARIABLE:
673
674             /* Split the opcode into a base opcode + offset */
675
676             ObjDesc->Reference.Opcode = AML_LOCAL_OP;
677             ObjDesc->Reference.Offset = Opcode - AML_LOCAL_OP;
678
679 #ifndef ACPI_NO_METHOD_EXECUTION
680             Status = AcpiDsMethodDataGetNode (AML_LOCAL_OP, ObjDesc->Reference.Offset,
681                         WalkState, (ACPI_NAMESPACE_NODE **) &ObjDesc->Reference.Object);
682 #endif
683             break;
684
685
686         case AML_TYPE_METHOD_ARGUMENT:
687
688             /* Split the opcode into a base opcode + offset */
689
690             ObjDesc->Reference.Opcode = AML_ARG_OP;
691             ObjDesc->Reference.Offset = Opcode - AML_ARG_OP;
692             break;
693
694         default: /* Other literals, etc.. */
695
696             if (Op->Common.AmlOpcode == AML_INT_NAMEPATH_OP)
697             {
698                 /* Node was saved in Op */
699
700                 ObjDesc->Reference.Node = Op->Common.Node;
701             }
702
703             ObjDesc->Reference.Opcode = Opcode;
704             break;
705         }
706         break;
707
708
709     default:
710
711         ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unimplemented data type: %X\n",
712             ACPI_GET_OBJECT_TYPE (ObjDesc)));
713
714         Status = AE_AML_OPERAND_TYPE;
715         break;
716     }
717
718     return_ACPI_STATUS (Status);
719 }
720
721