exresnte.c revision 69450
1209231Sjchandra
2178580Simp/******************************************************************************
3178580Simp *
4178580Simp * Module Name: amresnte - AML Interpreter object resolution
5178580Simp *              $Revision: 24 $
6178580Simp *
7178580Simp *****************************************************************************/
8178580Simp
9178580Simp/******************************************************************************
10178580Simp *
11178580Simp * 1. Copyright Notice
12178580Simp *
13178580Simp * Some or all of this work - Copyright (c) 1999, Intel Corp.  All rights
14178580Simp * reserved.
15178580Simp *
16178580Simp * 2. License
17178580Simp *
18178580Simp * 2.1. This is your license from Intel Corp. under its intellectual property
19178580Simp * rights.  You may have additional license terms from the party that provided
20178580Simp * you this software, covering your right to use that party's intellectual
21178580Simp * property rights.
22178580Simp *
23178580Simp * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
24178580Simp * copy of the source code appearing in this file ("Covered Code") an
25178580Simp * irrevocable, perpetual, worldwide license under Intel's copyrights in the
26178580Simp * base code distributed originally by Intel ("Original Intel Code") to copy,
27178580Simp * make derivatives, distribute, use and display any portion of the Covered
28178580Simp * Code in any form, with the right to sublicense such rights; and
29178580Simp *
30178580Simp * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
31178580Simp * license (with the right to sublicense), under only those claims of Intel
32178580Simp * patents that are infringed by the Original Intel Code, to make, use, sell,
33178580Simp * offer to sell, and import the Covered Code and derivative works thereof
34178580Simp * solely to the minimum extent necessary to exercise the above copyright
35178580Simp * license, and in no event shall the patent license extend to any additions
36178580Simp * to or modifications of the Original Intel Code.  No other license or right
37178580Simp * is granted directly or by implication, estoppel or otherwise;
38209231Sjchandra *
39209231Sjchandra * The above copyright and patent license is granted only if the following
40209231Sjchandra * conditions are met:
41178580Simp *
42209231Sjchandra * 3. Conditions
43178580Simp *
44209231Sjchandra * 3.1. Redistribution of Source with Rights to Further Distribute Source.
45209231Sjchandra * Redistribution of source code of any substantial portion of the Covered
46209231Sjchandra * Code or modification with rights to further distribute source must include
47178580Simp * the above Copyright Notice, the above License, this list of Conditions,
48178580Simp * and the following Disclaimer and Export Compliance provision.  In addition,
49178580Simp * Licensee must cause all Covered Code to which Licensee contributes to
50178580Simp * contain a file documenting the changes Licensee made to create that Covered
51178580Simp * Code and the date of any change.  Licensee must include in that file the
52178580Simp * documentation of any changes made by any predecessor Licensee.  Licensee
53178580Simp * must include a prominent statement that the modification is derived,
54178580Simp * directly or indirectly, from Original Intel Code.
55178580Simp *
56178580Simp * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
57178580Simp * Redistribution of source code of any substantial portion of the Covered
58209231Sjchandra * Code or modification without rights to further distribute source must
59209231Sjchandra * include the following Disclaimer and Export Compliance provision in the
60209231Sjchandra * documentation and/or other materials provided with distribution.  In
61209231Sjchandra * addition, Licensee may not authorize further sublicense of source of any
62209231Sjchandra * portion of the Covered Code, and must include terms to the effect that the
63209231Sjchandra * license from Licensee to its licensee is limited to the intellectual
64178580Simp * property embodied in the software Licensee provides to its licensee, and
65209231Sjchandra * not to intellectual property embodied in modifications its licensee may
66209231Sjchandra * make.
67209231Sjchandra *
68209231Sjchandra * 3.3. Redistribution of Executable. Redistribution in executable form of any
69209231Sjchandra * substantial portion of the Covered Code or modification must reproduce the
70209231Sjchandra * above Copyright Notice, and the following Disclaimer and Export Compliance
71209231Sjchandra * provision in the documentation and/or other materials provided with the
72209231Sjchandra * distribution.
73178580Simp *
74209231Sjchandra * 3.4. Intel retains all right, title, and interest in and to the Original
75209231Sjchandra * Intel Code.
76209231Sjchandra *
77178580Simp * 3.5. Neither the name Intel nor any other trademark owned or controlled by
78209231Sjchandra * Intel shall be used in advertising or otherwise to promote the sale, use or
79209231Sjchandra * other dealings in products derived from or relating to the Covered Code
80209231Sjchandra * without prior written authorization from Intel.
81209231Sjchandra *
82209231Sjchandra * 4. Disclaimer and Export Compliance
83209231Sjchandra *
84178580Simp * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
85209231Sjchandra * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
86178580Simp * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
87178580Simp * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
88209231Sjchandra * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
89209231Sjchandra * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
90209231Sjchandra * PARTICULAR PURPOSE.
91178580Simp *
92209231Sjchandra * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
93209231Sjchandra * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
94209231Sjchandra * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
95209231Sjchandra * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
96209231Sjchandra * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
97209231Sjchandra * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
98178580Simp * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
99178580Simp * LIMITED REMEDY.
100209231Sjchandra *
101209231Sjchandra * 4.3. Licensee shall not export, either directly or indirectly, any of this
102209231Sjchandra * software or system incorporating such software without first obtaining any
103178580Simp * required license or other approval from the U. S. Department of Commerce or
104209231Sjchandra * any other agency or department of the United States Government.  In the
105209231Sjchandra * event Licensee exports any such software from the United States or
106209231Sjchandra * re-exports any such software from a foreign destination, Licensee shall
107209231Sjchandra * ensure that the distribution and export/re-export of the software is in
108209231Sjchandra * compliance with all laws, regulations, orders, or other restrictions of the
109209231Sjchandra * U.S. Export Administration Regulations. Licensee agrees that neither it nor
110209231Sjchandra * any of its subsidiaries will export/re-export any technical data, process,
111178580Simp * software, or service, directly or indirectly, to any country for which the
112178580Simp * United States government or any agency thereof requires an export license,
113209231Sjchandra * other governmental approval, or letter of assurance, without first obtaining
114209231Sjchandra * such license, approval or letter.
115178580Simp *
116209231Sjchandra *****************************************************************************/
117209231Sjchandra
118209231Sjchandra#define __AMRESNTE_C__
119209231Sjchandra
120209231Sjchandra#include "acpi.h"
121209231Sjchandra#include "amlcode.h"
122178580Simp#include "acparser.h"
123178580Simp#include "acdispat.h"
124209231Sjchandra#include "acinterp.h"
125209231Sjchandra#include "acnamesp.h"
126178580Simp#include "actables.h"
127209231Sjchandra#include "acevents.h"
128209231Sjchandra
129178580Simp
130178580Simp#define _COMPONENT          INTERPRETER
131        MODULE_NAME         ("amresnte")
132
133
134/*******************************************************************************
135 *
136 * FUNCTION:    AcpiAmlResolveNodeToValue
137 *
138 * PARAMETERS:  StackPtr        - Pointer to a location on a stack that contains
139 *                                a pointer to an Node
140 *
141 * RETURN:      Status
142 *
143 * DESCRIPTION: Resolve a ACPI_NAMESPACE_NODE (Node,
144 *              A.K.A. a "direct name pointer")
145 *
146 * Note: for some of the data types, the pointer attached to the Node
147 * can be either a pointer to an actual internal object or a pointer into the
148 * AML stream itself.  These types are currently:
149 *
150 *      ACPI_TYPE_NUMBER
151 *      ACPI_TYPE_STRING
152 *      ACPI_TYPE_BUFFER
153 *      ACPI_TYPE_MUTEX
154 *      ACPI_TYPE_PACKAGE
155 *
156 ******************************************************************************/
157
158ACPI_STATUS
159AcpiAmlResolveNodeToValue (
160    ACPI_NAMESPACE_NODE     **StackPtr,
161    ACPI_WALK_STATE         *WalkState)
162
163{
164    ACPI_STATUS             Status = AE_OK;
165    ACPI_OPERAND_OBJECT     *ValDesc = NULL;
166    ACPI_OPERAND_OBJECT     *ObjDesc = NULL;
167    ACPI_NAMESPACE_NODE     *Node;
168    UINT8                   *AmlPointer = NULL;
169    OBJECT_TYPE_INTERNAL    EntryType;
170    BOOLEAN                 Locked;
171    BOOLEAN                 AttachedAmlPointer = FALSE;
172    UINT8                   AmlOpcode = 0;
173    ACPI_INTEGER            TempVal;
174    OBJECT_TYPE_INTERNAL    ObjectType;
175
176
177    FUNCTION_TRACE ("AmlResolveEntryToValue");
178
179    Node = *StackPtr;
180
181
182    /*
183     * The stack pointer is a "Direct name ptr", and points to a
184     * a ACPI_NAMESPACE_NODE (Node).  Get the pointer that is attached to
185     * the Node.
186     */
187
188    ValDesc     = AcpiNsGetAttachedObject ((ACPI_HANDLE) Node);
189    EntryType   = AcpiNsGetType ((ACPI_HANDLE) Node);
190
191    DEBUG_PRINT (TRACE_EXEC,
192        ("AmlResolveEntryToValue: Entry=%p ValDesc=%p Type=%X\n",
193         Node, ValDesc, EntryType));
194
195    /*
196     * The ValDesc attached to the Node can be either:
197     * 1) An internal ACPI object
198     * 2) A pointer into the AML stream (into one of the ACPI system tables)
199     */
200
201    if (AcpiTbSystemTablePointer (ValDesc))
202    {
203        AttachedAmlPointer = TRUE;
204        AmlOpcode = *((UINT8 *) ValDesc);
205        AmlPointer = ((UINT8 *) ValDesc) + 1;
206
207        DEBUG_PRINT (TRACE_EXEC,
208            ("AmlResolveEntryToValue: Unparsed AML: %p Len=%X\n",
209            AmlOpcode, AmlPointer));
210    }
211
212
213    /*
214     * Several EntryTypes do not require further processing, so
215     *  we will return immediately
216     */
217    /* Devices rarely have an attached object, return the Node
218     *  and Method locals and arguments have a pseudo-Node
219     */
220    if (EntryType == ACPI_TYPE_DEVICE ||
221        EntryType == INTERNAL_TYPE_METHOD_ARGUMENT ||
222        EntryType == INTERNAL_TYPE_METHOD_LOCAL_VAR)
223    {
224        return_ACPI_STATUS (AE_OK);
225    }
226
227    if (!ValDesc)
228    {
229        DEBUG_PRINT (ACPI_ERROR,
230            ("AmlResolveEntryToValue: No object attached to node %p\n",
231            Node));
232        return_ACPI_STATUS (AE_AML_NO_OPERAND);
233    }
234
235    /*
236     * Action is based on the type of the Node, which indicates the type
237     * of the attached object or pointer
238     */
239    switch (EntryType)
240    {
241
242    case ACPI_TYPE_PACKAGE:
243
244        if (AttachedAmlPointer)
245        {
246            /*
247             * This means that the package initialization is not parsed
248             * -- should not happen
249             */
250            DEBUG_PRINT (ACPI_ERROR,
251                ("AmlResolveEntryToValue: Unparsed Packages not supported!\n"));
252            return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
253        }
254
255        /* ValDesc is an internal object in all cases by the time we get here */
256
257        if (ACPI_TYPE_PACKAGE != ValDesc->Common.Type)
258        {
259            DEBUG_PRINT (ACPI_ERROR,
260                ("AmlResolveEntryToValue: Object not a package, type %X\n",
261                ValDesc->Common.Type));
262            return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
263        }
264
265        /* Return an additional reference to the object */
266
267        ObjDesc = ValDesc;
268        AcpiCmAddReference (ObjDesc);
269        break;
270
271
272    case ACPI_TYPE_BUFFER:
273
274        if (AttachedAmlPointer)
275        {
276            /*
277             * This means that the buffer initialization is not parsed
278             * -- should not happen
279             */
280            DEBUG_PRINT (ACPI_ERROR,
281                ("AmlResolveEntryToValue: Unparsed Buffers not supported!\n"));
282            return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
283        }
284
285        /* ValDesc is an internal object in all cases by the time we get here */
286
287        if (ACPI_TYPE_BUFFER != ValDesc->Common.Type)
288        {
289            DEBUG_PRINT (ACPI_ERROR,
290                ("AmlResolveEntryToValue: Object not a buffer, type %X\n",
291                ValDesc->Common.Type));
292            return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
293        }
294
295        /* Return an additional reference to the object */
296
297        ObjDesc = ValDesc;
298        AcpiCmAddReference (ObjDesc);
299        break;
300
301
302    case ACPI_TYPE_STRING:
303
304        if (AttachedAmlPointer)
305        {
306            /* Allocate a new string object */
307
308            ObjDesc = AcpiCmCreateInternalObject (ACPI_TYPE_STRING);
309            if (!ObjDesc)
310            {
311                return_ACPI_STATUS (AE_NO_MEMORY);
312            }
313
314            /* Init the internal object */
315
316            ObjDesc->String.Pointer = (NATIVE_CHAR *) AmlPointer;
317            ObjDesc->String.Length = STRLEN (ObjDesc->String.Pointer);
318        }
319
320        else
321        {
322            if (ACPI_TYPE_STRING != ValDesc->Common.Type)
323            {
324                DEBUG_PRINT (ACPI_ERROR,
325                    ("AmlResolveEntryToValue: Object not a string, type %X\n",
326                    ValDesc->Common.Type));
327                return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
328            }
329
330            /* Return an additional reference to the object */
331
332            ObjDesc = ValDesc;
333            AcpiCmAddReference (ObjDesc);
334        }
335
336        break;
337
338
339    case ACPI_TYPE_NUMBER:
340
341        DEBUG_PRINT (TRACE_EXEC, ("AmlResolveEntryToValue: case Number \n"));
342
343        /*
344         * The Node has an attached internal object, make sure that it's a
345         * number
346         */
347
348        if (ACPI_TYPE_NUMBER != ValDesc->Common.Type)
349        {
350            DEBUG_PRINT (ACPI_ERROR,
351                ("AmlResolveToValue: Object not a Number, type %X\n",
352                ValDesc->Common.Type));
353            return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
354        }
355
356        /* Return an additional reference to the object */
357
358        ObjDesc = ValDesc;
359        AcpiCmAddReference (ObjDesc);
360        break;
361
362
363    case INTERNAL_TYPE_DEF_FIELD:
364
365        /*
366         * TBD: [Investigate] Is this the correct solution?
367         *
368         * This section was extended to convert to generic buffer if
369         *  the return length is greater than 32 bits, but still allows
370         *  for returning a type Number for smaller values because the
371         *  caller can then apply arithmetic operators on those fields.
372         *
373         * XXX - Implementation limitation: Fields are implemented as type
374         * XXX - Number, but they really are supposed to be type Buffer.
375         * XXX - The two are interchangeable only for lengths <= 32 bits.
376         */
377        if(ValDesc->Field.Length > 32)
378        {
379            ObjectType = ACPI_TYPE_BUFFER;
380        }
381        else
382        {
383            ObjectType = ACPI_TYPE_NUMBER;
384        }
385
386        /*
387         * Create the destination buffer object and the buffer space.
388         */
389        ObjDesc = AcpiCmCreateInternalObject (ObjectType);
390        if (!ObjDesc)
391        {
392            return_ACPI_STATUS (AE_NO_MEMORY);
393        }
394
395        /*
396         * Fill in the object specific details
397         */
398        if (ACPI_TYPE_BUFFER == ObjectType)
399        {
400            ObjDesc->Buffer.Pointer = AcpiCmCallocate (ValDesc->Field.Length);
401            if (!ObjDesc->Buffer.Pointer)
402            {
403                AcpiCmRemoveReference(ObjDesc);
404                return_ACPI_STATUS (AE_NO_MEMORY);
405            }
406
407            ObjDesc->Buffer.Length = ValDesc->Field.Length;
408
409            Status = AcpiAmlAccessNamedField (ACPI_READ, (ACPI_HANDLE) Node,
410                            ObjDesc->Buffer.Pointer, ObjDesc->Buffer.Length);
411
412            if (ACPI_FAILURE (Status))
413            {
414                return_ACPI_STATUS (Status);
415            }
416        }
417        else
418        {
419            Status = AcpiAmlAccessNamedField (ACPI_READ, (ACPI_HANDLE) Node,
420                            &TempVal, sizeof (TempVal));
421
422            if (ACPI_FAILURE (Status))
423            {
424                return_ACPI_STATUS (Status);
425            }
426
427            ObjDesc->Number.Value = TempVal;
428        }
429
430
431        DEBUG_PRINT (TRACE_EXEC,
432            ("AmlResolveEntryToValue: DefField Entry=%p ValDesc=%p Type=%X\n",
433            Node, ValDesc, EntryType));
434        break;
435
436
437    case INTERNAL_TYPE_BANK_FIELD:
438
439        if (AttachedAmlPointer)
440        {
441            DEBUG_PRINT (ACPI_ERROR,
442                ("AmlResolveEntryToValue: BankField cannot be an Aml ptr\n"));
443            return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
444        }
445
446        if (INTERNAL_TYPE_BANK_FIELD != ValDesc->Common.Type)
447        {
448            DEBUG_PRINT (ACPI_ERROR, (
449                "AmlResolveToValue: Object not a BankField, type %X\n",
450                ValDesc->Common.Type));
451
452            return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
453        }
454
455
456        /* Get the global lock if needed */
457
458        ObjDesc = (ACPI_OPERAND_OBJECT  *) *StackPtr;
459        Locked = AcpiAmlAcquireGlobalLock (ObjDesc->FieldUnit.LockRule);
460
461        /* Set Index value to select proper Data register */
462        /* perform the update */
463
464        Status = AcpiAmlAccessNamedField (ACPI_WRITE,
465                    ValDesc->BankField.BankSelect, &ValDesc->BankField.Value,
466                    sizeof (ValDesc->BankField.Value));
467
468        AcpiAmlReleaseGlobalLock (Locked);
469
470
471        if (ACPI_FAILURE (Status))
472        {
473            return_ACPI_STATUS (Status);
474        }
475
476        /* Read Data value */
477
478        Status = AcpiAmlAccessNamedField (ACPI_READ,
479                    (ACPI_HANDLE) ValDesc->BankField.Container,
480                    &TempVal, sizeof (TempVal));
481        if (ACPI_FAILURE (Status))
482        {
483            return_ACPI_STATUS (Status);
484        }
485
486        /* Create an object for the result */
487
488        ObjDesc = AcpiCmCreateInternalObject (ACPI_TYPE_NUMBER);
489        if (!ObjDesc)
490        {
491            return_ACPI_STATUS (AE_NO_MEMORY);
492        }
493
494        ObjDesc->Number.Value = TempVal;
495        break;
496
497
498    case INTERNAL_TYPE_INDEX_FIELD:
499
500        if (AttachedAmlPointer)
501        {
502            DEBUG_PRINT (ACPI_ERROR, ("AmlResolveEntryToValue: Internal - IndexField cannot be an Aml ptr\n"));
503            return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
504        }
505
506        if (INTERNAL_TYPE_INDEX_FIELD != ValDesc->Common.Type)
507        {
508            DEBUG_PRINT (ACPI_ERROR, (
509                "AmlResolveToValue: Object not an IndexField, type %X\n",
510                ValDesc->Common.Type));
511
512            return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
513        }
514
515
516        /* Set Index value to select proper Data register */
517        /* Get the global lock if needed */
518
519        ObjDesc = (ACPI_OPERAND_OBJECT  *) *StackPtr;
520        Locked = AcpiAmlAcquireGlobalLock (ObjDesc->FieldUnit.LockRule);
521
522        /* Perform the update */
523
524        Status = AcpiAmlAccessNamedField (ACPI_WRITE,
525                        ValDesc->IndexField.Index, &ValDesc->IndexField.Value,
526                        sizeof (ValDesc->IndexField.Value));
527
528        AcpiAmlReleaseGlobalLock (Locked);
529
530        if (ACPI_FAILURE (Status))
531        {
532            return_ACPI_STATUS (Status);
533        }
534
535        /* Read Data value */
536
537        Status = AcpiAmlAccessNamedField (ACPI_READ, ValDesc->IndexField.Data,
538                        &TempVal, sizeof (TempVal));
539        if (ACPI_FAILURE (Status))
540        {
541            return_ACPI_STATUS (Status);
542        }
543
544        /* Create an object for the result */
545
546        ObjDesc = AcpiCmCreateInternalObject (ACPI_TYPE_NUMBER);
547        if (!ObjDesc)
548        {
549            return_ACPI_STATUS (AE_NO_MEMORY);
550        }
551
552        ObjDesc->Number.Value = TempVal;
553        break;
554
555
556    case ACPI_TYPE_FIELD_UNIT:
557
558        if (AttachedAmlPointer)
559        {
560            DEBUG_PRINT (ACPI_ERROR,
561                ("AmlResolveEntryToValue: FieldUnit cannot be an Aml ptr\n"));
562            return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
563        }
564
565        if (ValDesc->Common.Type != (UINT8) EntryType)
566        {
567            DEBUG_PRINT (ACPI_ERROR, (
568                "AmlResolveToValue: Object type %X not same as EntryType %X\n",
569                ValDesc->Common.Type, EntryType));
570
571            return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
572            break;
573        }
574
575        /* Create object for result */
576
577        ObjDesc = AcpiCmCreateInternalObject (ACPI_TYPE_ANY);
578        if (!ObjDesc)
579        {
580            return_ACPI_STATUS (AE_NO_MEMORY);
581        }
582
583        Status = AcpiAmlGetFieldUnitValue (ValDesc, ObjDesc);
584        if (ACPI_FAILURE (Status))
585        {
586            AcpiCmRemoveReference (ObjDesc);
587            return_ACPI_STATUS (Status);
588        }
589
590        break;
591
592
593    /*
594     * For these objects, just return the object attached to the Node
595     */
596
597    case ACPI_TYPE_MUTEX:
598    case ACPI_TYPE_METHOD:
599    case ACPI_TYPE_POWER:
600    case ACPI_TYPE_PROCESSOR:
601    case ACPI_TYPE_THERMAL:
602    case ACPI_TYPE_EVENT:
603    case ACPI_TYPE_REGION:
604
605
606        /* Return an additional reference to the object */
607
608        ObjDesc = ValDesc;
609        AcpiCmAddReference (ObjDesc);
610        break;
611
612
613    /* TYPE_Any is untyped, and thus there is no object associated with it */
614
615    case ACPI_TYPE_ANY:
616
617        DEBUG_PRINT (ACPI_ERROR,
618            ("AmlResolveEntryToValue: Untyped entry %p, no attached object!\n",
619            Node));
620
621        return_ACPI_STATUS (AE_AML_OPERAND_TYPE);  /* Cannot be AE_TYPE */
622        break;
623
624
625    /*
626     * The only named references allowed are named constants
627     *
628     * e.g.     Name (\OSFL, Ones)
629     */
630    case INTERNAL_TYPE_REFERENCE:
631
632        switch (ValDesc->Reference.OpCode)
633        {
634
635        case AML_ZERO_OP:
636
637            TempVal = 0;
638            break;
639
640
641        case AML_ONE_OP:
642
643            TempVal = 1;
644            break;
645
646
647        case AML_ONES_OP:
648
649            TempVal = ACPI_INTEGER_MAX;
650            break;
651
652
653        default:
654
655            DEBUG_PRINT (ACPI_ERROR,
656                ("AmlResolveToValue/Number: Unsupported reference opcode %X\n",
657                ValDesc->Reference.OpCode));
658
659            return_ACPI_STATUS (AE_AML_BAD_OPCODE);
660        }
661
662        /* Create object for result */
663
664        ObjDesc = AcpiCmCreateInternalObject (ACPI_TYPE_NUMBER);
665        if (!ObjDesc)
666        {
667            return_ACPI_STATUS (AE_NO_MEMORY);
668        }
669
670        ObjDesc->Number.Value = TempVal;
671
672        /* Truncate value if we are executing from a 32-bit ACPI table */
673
674        AcpiAmlTruncateFor32bitTable (ObjDesc, WalkState);
675        break;
676
677
678    /* Default case is for unknown types */
679
680    default:
681
682        DEBUG_PRINT (ACPI_ERROR,
683            ("AmlResolveEntryToValue: Node %p - Unknown object type %X\n",
684            Node, EntryType));
685
686        return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
687
688    } /* switch (EntryType) */
689
690
691    /* Put the object descriptor on the stack */
692
693    *StackPtr = (void *) ObjDesc;
694
695    return_ACPI_STATUS (Status);
696}
697
698
699