exmisc.c revision 82367
1
2/******************************************************************************
3 *
4 * Module Name: exmisc - ACPI AML (p-code) execution - specific opcodes
5 *              $Revision: 80 $
6 *
7 *****************************************************************************/
8
9/******************************************************************************
10 *
11 * 1. Copyright Notice
12 *
13 * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
14 * All rights reserved.
15 *
16 * 2. License
17 *
18 * 2.1. This is your license from Intel Corp. under its intellectual property
19 * rights.  You may have additional license terms from the party that provided
20 * you this software, covering your right to use that party's intellectual
21 * property rights.
22 *
23 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
24 * copy of the source code appearing in this file ("Covered Code") an
25 * irrevocable, perpetual, worldwide license under Intel's copyrights in the
26 * base code distributed originally by Intel ("Original Intel Code") to copy,
27 * make derivatives, distribute, use and display any portion of the Covered
28 * Code in any form, with the right to sublicense such rights; and
29 *
30 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
31 * license (with the right to sublicense), under only those claims of Intel
32 * patents that are infringed by the Original Intel Code, to make, use, sell,
33 * offer to sell, and import the Covered Code and derivative works thereof
34 * solely to the minimum extent necessary to exercise the above copyright
35 * license, and in no event shall the patent license extend to any additions
36 * to or modifications of the Original Intel Code.  No other license or right
37 * is granted directly or by implication, estoppel or otherwise;
38 *
39 * The above copyright and patent license is granted only if the following
40 * conditions are met:
41 *
42 * 3. Conditions
43 *
44 * 3.1. Redistribution of Source with Rights to Further Distribute Source.
45 * Redistribution of source code of any substantial portion of the Covered
46 * Code or modification with rights to further distribute source must include
47 * the above Copyright Notice, the above License, this list of Conditions,
48 * and the following Disclaimer and Export Compliance provision.  In addition,
49 * Licensee must cause all Covered Code to which Licensee contributes to
50 * contain a file documenting the changes Licensee made to create that Covered
51 * Code and the date of any change.  Licensee must include in that file the
52 * documentation of any changes made by any predecessor Licensee.  Licensee
53 * must include a prominent statement that the modification is derived,
54 * directly or indirectly, from Original Intel Code.
55 *
56 * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
57 * Redistribution of source code of any substantial portion of the Covered
58 * Code or modification without rights to further distribute source must
59 * include the following Disclaimer and Export Compliance provision in the
60 * documentation and/or other materials provided with distribution.  In
61 * addition, Licensee may not authorize further sublicense of source of any
62 * portion of the Covered Code, and must include terms to the effect that the
63 * license from Licensee to its licensee is limited to the intellectual
64 * property embodied in the software Licensee provides to its licensee, and
65 * not to intellectual property embodied in modifications its licensee may
66 * make.
67 *
68 * 3.3. Redistribution of Executable. Redistribution in executable form of any
69 * substantial portion of the Covered Code or modification must reproduce the
70 * above Copyright Notice, and the following Disclaimer and Export Compliance
71 * provision in the documentation and/or other materials provided with the
72 * distribution.
73 *
74 * 3.4. Intel retains all right, title, and interest in and to the Original
75 * Intel Code.
76 *
77 * 3.5. Neither the name Intel nor any other trademark owned or controlled by
78 * Intel shall be used in advertising or otherwise to promote the sale, use or
79 * other dealings in products derived from or relating to the Covered Code
80 * without prior written authorization from Intel.
81 *
82 * 4. Disclaimer and Export Compliance
83 *
84 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
85 * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
86 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
87 * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
88
89 * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
90 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
91 * PARTICULAR PURPOSE.
92 *
93 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
94 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
95 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
96 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
97 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
98 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
99 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
100 * LIMITED REMEDY.
101 *
102 * 4.3. Licensee shall not export, either directly or indirectly, any of this
103 * software or system incorporating such software without first obtaining any
104 * required license or other approval from the U. S. Department of Commerce or
105 * any other agency or department of the United States Government.  In the
106 * event Licensee exports any such software from the United States or
107 * re-exports any such software from a foreign destination, Licensee shall
108 * ensure that the distribution and export/re-export of the software is in
109 * compliance with all laws, regulations, orders, or other restrictions of the
110 * U.S. Export Administration Regulations. Licensee agrees that neither it nor
111 * any of its subsidiaries will export/re-export any technical data, process,
112 * software, or service, directly or indirectly, to any country for which the
113 * United States government or any agency thereof requires an export license,
114 * other governmental approval, or letter of assurance, without first obtaining
115 * such license, approval or letter.
116 *
117 *****************************************************************************/
118
119#define __EXMISC_C__
120
121#include "acpi.h"
122#include "acparser.h"
123#include "acinterp.h"
124#include "amlcode.h"
125#include "acdispat.h"
126
127
128#define _COMPONENT          ACPI_EXECUTER
129        MODULE_NAME         ("exmisc")
130
131
132/*******************************************************************************
133 *
134 * FUNCTION:    AcpiExFatal
135 *
136 * PARAMETERS:  none
137 *
138 * RETURN:      Status.  If the OS returns from the OSD call, we just keep
139 *              on going.
140 *
141 * DESCRIPTION: Execute Fatal operator
142 *
143 * ACPI SPECIFICATION REFERENCES:
144 *  DefFatal    :=  FatalOp FatalType   FatalCode   FatalArg
145 *  FatalType   :=  ByteData
146 *  FatalCode   :=  DWordData
147 *  FatalArg    :=  TermArg=>Integer
148 *
149 ******************************************************************************/
150
151ACPI_STATUS
152AcpiExFatal (
153    ACPI_WALK_STATE         *WalkState)
154{
155    ACPI_OPERAND_OBJECT     *TypeDesc;
156    ACPI_OPERAND_OBJECT     *CodeDesc;
157    ACPI_OPERAND_OBJECT     *ArgDesc;
158    ACPI_STATUS             Status;
159
160
161    FUNCTION_TRACE ("ExFatal");
162
163
164    /* Resolve operands */
165
166    Status = AcpiExResolveOperands (AML_FATAL_OP, WALK_OPERANDS, WalkState);
167    DUMP_OPERANDS (WALK_OPERANDS, IMODE_EXECUTE,
168                    AcpiPsGetOpcodeName (AML_FATAL_OP),
169                    3, "after AcpiExResolveOperands");
170
171    /* Get operands */
172
173    Status |= AcpiDsObjStackPopObject (&ArgDesc, WalkState);
174    Status |= AcpiDsObjStackPopObject (&CodeDesc, WalkState);
175    Status |= AcpiDsObjStackPopObject (&TypeDesc, WalkState);
176    if (ACPI_FAILURE (Status))
177    {
178        /* Invalid parameters on object stack  */
179
180        ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "bad operand(s) (Status=%X)\n",
181            Status));
182        goto Cleanup;
183    }
184
185
186    /* DefFatal    :=  FatalOp FatalType   FatalCode   FatalArg    */
187
188    ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
189        "Type %x Code %x Arg %x <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n",
190        TypeDesc->Integer.Value, CodeDesc->Integer.Value, ArgDesc->Integer.Value));
191
192
193    /*
194     * TBD: [Unhandled] call OSD interface to notify OS of fatal error
195     * requiring shutdown!
196     */
197
198
199Cleanup:
200
201    /* Free the operands */
202
203    AcpiUtRemoveReference (ArgDesc);
204    AcpiUtRemoveReference (CodeDesc);
205    AcpiUtRemoveReference (TypeDesc);
206
207
208    /* If we get back from the OS call, we might as well keep going. */
209
210    REPORT_WARNING (("An AML \"Fatal\" Opcode (FatalOp) was executed\n"));
211    return_ACPI_STATUS (AE_OK);
212}
213
214
215/*******************************************************************************
216 *
217 * FUNCTION:    AcpiExTriadic
218 *
219 * PARAMETERS:  Opcode              - The opcode to be executed
220 *              WalkState           - Current walk state
221 *              ReturnDesc          - Where to store the return object
222 *
223 * RETURN:      Status
224 *
225 * DESCRIPTION: Execute Triadic operator (3 operands)
226 *
227 * ALLOCATION:  Deletes one operand descriptor -- other remains on stack
228 *
229 ******************************************************************************/
230
231ACPI_STATUS
232AcpiExTriadic (
233    UINT16                  Opcode,
234    ACPI_WALK_STATE         *WalkState,
235    ACPI_OPERAND_OBJECT     **ReturnDesc)
236{
237    ACPI_OPERAND_OBJECT     *ObjDesc1;
238    ACPI_OPERAND_OBJECT     *ObjDesc2;
239    ACPI_OPERAND_OBJECT     *ResDesc;
240    ACPI_OPERAND_OBJECT     *RetDesc = NULL;
241    ACPI_OPERAND_OBJECT     *TmpDesc;
242    ACPI_SIGNAL_FATAL_INFO  *Fatal;
243    ACPI_STATUS             Status;
244
245
246
247    FUNCTION_TRACE ("ExTriadic");
248
249
250    /* Resolve operands */
251    /* First operand can be either a package or a buffer */
252
253    Status = AcpiExResolveOperands (AML_INDEX_OP, WALK_OPERANDS, WalkState);
254    DUMP_OPERANDS (WALK_OPERANDS, IMODE_EXECUTE,
255                    AcpiPsGetOpcodeName (AML_INDEX_OP),
256                    3, "after AcpiExResolveOperands");
257
258    /* Get all operands */
259
260    Status |= AcpiDsObjStackPopObject (&ResDesc, WalkState);
261    Status |= AcpiDsObjStackPopObject (&ObjDesc2, WalkState);
262    Status |= AcpiDsObjStackPopObject (&ObjDesc1, WalkState);
263    if (ACPI_FAILURE (Status))
264    {
265        /* Invalid parameters on object stack  */
266
267        ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "bad operand(s) (Status=%X)\n",
268            Status));
269        goto Cleanup;
270    }
271
272
273
274    switch (Opcode)
275    {
276
277    case AML_FATAL_OP:
278
279        /* DefFatal    :=  FatalOp  FatalType   FatalCode   FatalArg    */
280
281        ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
282            "FatalOp: Type %x Code %x Arg %x <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n",
283            (UINT32) ObjDesc1->Integer.Value, (UINT32) ObjDesc2->Integer.Value,
284            (UINT32) ResDesc->Integer.Value));
285
286
287        Fatal = ACPI_MEM_ALLOCATE (sizeof (ACPI_SIGNAL_FATAL_INFO));
288        if (Fatal)
289        {
290            Fatal->Type = (UINT32) ObjDesc1->Integer.Value;
291            Fatal->Code = (UINT32) ObjDesc2->Integer.Value;
292            Fatal->Argument = (UINT32) ResDesc->Integer.Value;
293        }
294
295        /*
296         * Signal the OS
297         */
298        AcpiOsSignal (ACPI_SIGNAL_FATAL, Fatal);
299
300        /* Might return while OS is shutting down */
301
302        ACPI_MEM_FREE (Fatal);
303        break;
304
305
306
307    case AML_MID_OP:
308
309        /* DefMid       := MidOp Source Index  Length Result */
310
311        /* Create the internal return object (string or buffer) */
312
313        break;
314
315
316    case AML_INDEX_OP:
317
318        /* DefIndex     := IndexOp Source Index Destination */
319
320        /* Create the internal return object */
321
322        RetDesc = AcpiUtCreateInternalObject (INTERNAL_TYPE_REFERENCE);
323        if (!RetDesc)
324        {
325            Status = AE_NO_MEMORY;
326            goto Cleanup;
327        }
328        /*
329         * At this point, the ObjDesc1 operand is either a Package or a Buffer
330         */
331        if (ObjDesc1->Common.Type == ACPI_TYPE_PACKAGE)
332        {
333            /* Object to be indexed is a Package */
334
335            if (ObjDesc2->Integer.Value >= ObjDesc1->Package.Count)
336            {
337                ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Index value beyond package end\n"));
338                Status = AE_AML_PACKAGE_LIMIT;
339                goto Cleanup;
340            }
341
342            if ((ResDesc->Common.Type == INTERNAL_TYPE_REFERENCE) &&
343                (ResDesc->Reference.Opcode == AML_ZERO_OP))
344            {
345                /*
346                 * There is no actual result descriptor (the ZeroOp Result
347                 * descriptor is a placeholder), so just delete the placeholder and
348                 * return a reference to the package element
349                 */
350                AcpiUtRemoveReference (ResDesc);
351            }
352
353            else
354            {
355                /*
356                 * Each element of the package is an internal object.  Get the one
357                 * we are after.
358                 */
359                TmpDesc                       = ObjDesc1->Package.Elements[ObjDesc2->Integer.Value];
360                RetDesc->Reference.Opcode     = AML_INDEX_OP;
361                RetDesc->Reference.TargetType = TmpDesc->Common.Type;
362                RetDesc->Reference.Object     = TmpDesc;
363
364                Status = AcpiExStore (RetDesc, ResDesc, WalkState);
365                RetDesc->Reference.Object     = NULL;
366            }
367
368            /*
369             * The local return object must always be a reference to the package element,
370             * not the element itself.
371             */
372            RetDesc->Reference.Opcode     = AML_INDEX_OP;
373            RetDesc->Reference.TargetType = ACPI_TYPE_PACKAGE;
374            RetDesc->Reference.Where      = &ObjDesc1->Package.Elements[ObjDesc2->Integer.Value];
375        }
376
377        else
378        {
379            /* Object to be indexed is a Buffer */
380
381            if (ObjDesc2->Integer.Value >= ObjDesc1->Buffer.Length)
382            {
383                ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Index value beyond end of buffer\n"));
384                Status = AE_AML_BUFFER_LIMIT;
385                goto Cleanup;
386            }
387
388            RetDesc->Reference.Opcode       = AML_INDEX_OP;
389            RetDesc->Reference.TargetType   = ACPI_TYPE_BUFFER_FIELD;
390            RetDesc->Reference.Object       = ObjDesc1;
391            RetDesc->Reference.Offset       = (UINT32) ObjDesc2->Integer.Value;
392
393            Status = AcpiExStore (RetDesc, ResDesc, WalkState);
394        }
395        break;
396    }
397
398
399
400Cleanup:
401
402    /* Always delete operands */
403
404    AcpiUtRemoveReference (ObjDesc1);
405    AcpiUtRemoveReference (ObjDesc2);
406
407    /* Delete return object on error */
408
409    if (ACPI_FAILURE (Status))
410    {
411        AcpiUtRemoveReference (ResDesc);
412
413        if (RetDesc)
414        {
415            AcpiUtRemoveReference (RetDesc);
416            RetDesc = NULL;
417        }
418    }
419
420    /* Set the return object and exit */
421
422    *ReturnDesc = RetDesc;
423    return_ACPI_STATUS (Status);
424}
425
426
427/*******************************************************************************
428 *
429 * FUNCTION:    AcpiExHexadic
430 *
431 * PARAMETERS:  Opcode              - The opcode to be executed
432 *              WalkState           - Current walk state
433 *              ReturnDesc          - Where to store the return object
434 *
435 * RETURN:      Status
436 *
437 * DESCRIPTION: Execute Match operator
438 *
439 ******************************************************************************/
440
441ACPI_STATUS
442AcpiExHexadic (
443    UINT16                  Opcode,
444    ACPI_WALK_STATE         *WalkState,
445    ACPI_OPERAND_OBJECT     **ReturnDesc)
446{
447    ACPI_OPERAND_OBJECT     *PkgDesc;
448    ACPI_OPERAND_OBJECT     *Op1Desc;
449    ACPI_OPERAND_OBJECT     *V1Desc;
450    ACPI_OPERAND_OBJECT     *Op2Desc;
451    ACPI_OPERAND_OBJECT     *V2Desc;
452    ACPI_OPERAND_OBJECT     *StartDesc;
453    ACPI_OPERAND_OBJECT     *RetDesc = NULL;
454    ACPI_STATUS             Status;
455    UINT32                  Index;
456    UINT32                  MatchValue = (UINT32) -1;
457
458
459    FUNCTION_TRACE ("ExHexadic");
460
461
462    /* Resolve all operands */
463
464    Status = AcpiExResolveOperands (AML_MATCH_OP, WALK_OPERANDS, WalkState);
465    DUMP_OPERANDS (WALK_OPERANDS, IMODE_EXECUTE,
466                    AcpiPsGetOpcodeName (AML_MATCH_OP),
467                    6, "after AcpiExResolveOperands");
468
469    /* Get all operands */
470
471    Status |= AcpiDsObjStackPopObject (&StartDesc, WalkState);
472    Status |= AcpiDsObjStackPopObject (&V2Desc, WalkState);
473    Status |= AcpiDsObjStackPopObject (&Op2Desc, WalkState);
474    Status |= AcpiDsObjStackPopObject (&V1Desc, WalkState);
475    Status |= AcpiDsObjStackPopObject (&Op1Desc, WalkState);
476    Status |= AcpiDsObjStackPopObject (&PkgDesc, WalkState);
477
478    if (ACPI_FAILURE (Status))
479    {
480        /* Invalid parameters on object stack  */
481
482        ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "bad operand(s) (Status=%X)\n",
483            Status));
484        goto Cleanup;
485    }
486
487
488    switch (Opcode)
489    {
490
491        case AML_MATCH_OP:
492
493        /* Validate match comparison sub-opcodes */
494
495        if ((Op1Desc->Integer.Value > MAX_MATCH_OPERATOR) ||
496            (Op2Desc->Integer.Value > MAX_MATCH_OPERATOR))
497        {
498            ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "operation encoding out of range\n"));
499            Status = AE_AML_OPERAND_VALUE;
500            goto Cleanup;
501        }
502
503        Index = (UINT32) StartDesc->Integer.Value;
504        if (Index >= (UINT32) PkgDesc->Package.Count)
505        {
506            ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Start position value out of range\n"));
507            Status = AE_AML_PACKAGE_LIMIT;
508            goto Cleanup;
509        }
510
511        RetDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
512        if (!RetDesc)
513        {
514            Status = AE_NO_MEMORY;
515            goto Cleanup;
516
517        }
518
519        /*
520         * Examine each element until a match is found.  Within the loop,
521         * "continue" signifies that the current element does not match
522         * and the next should be examined.
523         * Upon finding a match, the loop will terminate via "break" at
524         * the bottom.  If it terminates "normally", MatchValue will be -1
525         * (its initial value) indicating that no match was found.  When
526         * returned as a Number, this will produce the Ones value as specified.
527         */
528
529        for ( ; Index < PkgDesc->Package.Count; ++Index)
530        {
531            /*
532             * Treat any NULL or non-numeric elements as non-matching.
533             * TBD [Unhandled] - if an element is a Name,
534             *      should we examine its value?
535             */
536            if (!PkgDesc->Package.Elements[Index] ||
537                ACPI_TYPE_INTEGER != PkgDesc->Package.Elements[Index]->Common.Type)
538            {
539                continue;
540            }
541
542            /*
543             * Within these switch statements:
544             *      "break" (exit from the switch) signifies a match;
545             *      "continue" (proceed to next iteration of enclosing
546             *          "for" loop) signifies a non-match.
547             */
548            switch (Op1Desc->Integer.Value)
549            {
550
551            case MATCH_MTR:   /* always true */
552
553                break;
554
555
556            case MATCH_MEQ:   /* true if equal   */
557
558                if (PkgDesc->Package.Elements[Index]->Integer.Value
559                     != V1Desc->Integer.Value)
560                {
561                    continue;
562                }
563                break;
564
565
566            case MATCH_MLE:   /* true if less than or equal  */
567
568                if (PkgDesc->Package.Elements[Index]->Integer.Value
569                     > V1Desc->Integer.Value)
570                {
571                    continue;
572                }
573                break;
574
575
576            case MATCH_MLT:   /* true if less than   */
577
578                if (PkgDesc->Package.Elements[Index]->Integer.Value
579                     >= V1Desc->Integer.Value)
580                {
581                    continue;
582                }
583                break;
584
585
586            case MATCH_MGE:   /* true if greater than or equal   */
587
588                if (PkgDesc->Package.Elements[Index]->Integer.Value
589                     < V1Desc->Integer.Value)
590                {
591                    continue;
592                }
593                break;
594
595
596            case MATCH_MGT:   /* true if greater than    */
597
598                if (PkgDesc->Package.Elements[Index]->Integer.Value
599                     <= V1Desc->Integer.Value)
600                {
601                    continue;
602                }
603                break;
604
605
606            default:    /* undefined   */
607
608                continue;
609            }
610
611
612            switch(Op2Desc->Integer.Value)
613            {
614
615            case MATCH_MTR:
616
617                break;
618
619
620            case MATCH_MEQ:
621
622                if (PkgDesc->Package.Elements[Index]->Integer.Value
623                     != V2Desc->Integer.Value)
624                {
625                    continue;
626                }
627                break;
628
629
630            case MATCH_MLE:
631
632                if (PkgDesc->Package.Elements[Index]->Integer.Value
633                     > V2Desc->Integer.Value)
634                {
635                    continue;
636                }
637                break;
638
639
640            case MATCH_MLT:
641
642                if (PkgDesc->Package.Elements[Index]->Integer.Value
643                     >= V2Desc->Integer.Value)
644                {
645                    continue;
646                }
647                break;
648
649
650            case MATCH_MGE:
651
652                if (PkgDesc->Package.Elements[Index]->Integer.Value
653                     < V2Desc->Integer.Value)
654                {
655                    continue;
656                }
657                break;
658
659
660            case MATCH_MGT:
661
662                if (PkgDesc->Package.Elements[Index]->Integer.Value
663                     <= V2Desc->Integer.Value)
664                {
665                    continue;
666                }
667                break;
668
669
670            default:
671
672                continue;
673            }
674
675            /* Match found: exit from loop */
676
677            MatchValue = Index;
678            break;
679        }
680
681        /* MatchValue is the return value */
682
683        RetDesc->Integer.Value = MatchValue;
684        break;
685
686    }
687
688
689
690Cleanup:
691
692    /* Free the operands */
693
694    AcpiUtRemoveReference (StartDesc);
695    AcpiUtRemoveReference (V2Desc);
696    AcpiUtRemoveReference (Op2Desc);
697    AcpiUtRemoveReference (V1Desc);
698    AcpiUtRemoveReference (Op1Desc);
699    AcpiUtRemoveReference (PkgDesc);
700
701
702    /* Delete return object on error */
703
704    if (ACPI_FAILURE (Status) &&
705        (RetDesc))
706    {
707        AcpiUtRemoveReference (RetDesc);
708        RetDesc = NULL;
709    }
710
711
712    /* Set the return object and exit */
713
714    *ReturnDesc = RetDesc;
715    return_ACPI_STATUS (Status);
716}
717