xref: /haiku/src/add-ons/kernel/bus_managers/acpi/acpica/components/executer/exoparg2.c (revision 81ec973846ea4816c53ed8901822e43c8b06878d)
1 /******************************************************************************
2  *
3  * Module Name: exoparg2 - AML execution - opcodes with 2 arguments
4  *
5  *****************************************************************************/
6 
7 /******************************************************************************
8  *
9  * 1. Copyright Notice
10  *
11  * Some or all of this work - Copyright (c) 1999 - 2014, 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 
117 #define __EXOPARG2_C__
118 
119 #include "acpi.h"
120 #include "accommon.h"
121 #include "acparser.h"
122 #include "acinterp.h"
123 #include "acevents.h"
124 #include "amlcode.h"
125 
126 
127 #define _COMPONENT          ACPI_EXECUTER
128         ACPI_MODULE_NAME    ("exoparg2")
129 
130 
131 /*!
132  * Naming convention for AML interpreter execution routines.
133  *
134  * The routines that begin execution of AML opcodes are named with a common
135  * convention based upon the number of arguments, the number of target operands,
136  * and whether or not a value is returned:
137  *
138  *      AcpiExOpcode_xA_yT_zR
139  *
140  * Where:
141  *
142  * xA - ARGUMENTS:    The number of arguments (input operands) that are
143  *                    required for this opcode type (1 through 6 args).
144  * yT - TARGETS:      The number of targets (output operands) that are required
145  *                    for this opcode type (0, 1, or 2 targets).
146  * zR - RETURN VALUE: Indicates whether this opcode type returns a value
147  *                    as the function return (0 or 1).
148  *
149  * The AcpiExOpcode* functions are called via the Dispatcher component with
150  * fully resolved operands.
151 !*/
152 
153 
154 /*******************************************************************************
155  *
156  * FUNCTION:    AcpiExOpcode_2A_0T_0R
157  *
158  * PARAMETERS:  WalkState           - Current walk state
159  *
160  * RETURN:      Status
161  *
162  * DESCRIPTION: Execute opcode with two arguments, no target, and no return
163  *              value.
164  *
165  * ALLOCATION:  Deletes both operands
166  *
167  ******************************************************************************/
168 
169 ACPI_STATUS
170 AcpiExOpcode_2A_0T_0R (
171     ACPI_WALK_STATE         *WalkState)
172 {
173     ACPI_OPERAND_OBJECT     **Operand = &WalkState->Operands[0];
174     ACPI_NAMESPACE_NODE     *Node;
175     UINT32                  Value;
176     ACPI_STATUS             Status = AE_OK;
177 
178 
179     ACPI_FUNCTION_TRACE_STR (ExOpcode_2A_0T_0R,
180             AcpiPsGetOpcodeName (WalkState->Opcode));
181 
182 
183     /* Examine the opcode */
184 
185     switch (WalkState->Opcode)
186     {
187     case AML_NOTIFY_OP:         /* Notify (NotifyObject, NotifyValue) */
188 
189         /* The first operand is a namespace node */
190 
191         Node = (ACPI_NAMESPACE_NODE *) Operand[0];
192 
193         /* Second value is the notify value */
194 
195         Value = (UINT32) Operand[1]->Integer.Value;
196 
197         /* Are notifies allowed on this object? */
198 
199         if (!AcpiEvIsNotifyObject (Node))
200         {
201             ACPI_ERROR ((AE_INFO,
202                 "Unexpected notify object type [%s]",
203                 AcpiUtGetTypeName (Node->Type)));
204 
205             Status = AE_AML_OPERAND_TYPE;
206             break;
207         }
208 
209         /*
210          * Dispatch the notify to the appropriate handler
211          * NOTE: the request is queued for execution after this method
212          * completes. The notify handlers are NOT invoked synchronously
213          * from this thread -- because handlers may in turn run other
214          * control methods.
215          */
216         Status = AcpiEvQueueNotifyRequest (Node, Value);
217         break;
218 
219     default:
220 
221         ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X",
222             WalkState->Opcode));
223         Status = AE_AML_BAD_OPCODE;
224     }
225 
226     return_ACPI_STATUS (Status);
227 }
228 
229 
230 /*******************************************************************************
231  *
232  * FUNCTION:    AcpiExOpcode_2A_2T_1R
233  *
234  * PARAMETERS:  WalkState           - Current walk state
235  *
236  * RETURN:      Status
237  *
238  * DESCRIPTION: Execute a dyadic operator (2 operands) with 2 output targets
239  *              and one implicit return value.
240  *
241  ******************************************************************************/
242 
243 ACPI_STATUS
244 AcpiExOpcode_2A_2T_1R (
245     ACPI_WALK_STATE         *WalkState)
246 {
247     ACPI_OPERAND_OBJECT     **Operand = &WalkState->Operands[0];
248     ACPI_OPERAND_OBJECT     *ReturnDesc1 = NULL;
249     ACPI_OPERAND_OBJECT     *ReturnDesc2 = NULL;
250     ACPI_STATUS             Status;
251 
252 
253     ACPI_FUNCTION_TRACE_STR (ExOpcode_2A_2T_1R,
254         AcpiPsGetOpcodeName (WalkState->Opcode));
255 
256 
257     /* Execute the opcode */
258 
259     switch (WalkState->Opcode)
260     {
261     case AML_DIVIDE_OP:
262 
263         /* Divide (Dividend, Divisor, RemainderResult QuotientResult) */
264 
265         ReturnDesc1 = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
266         if (!ReturnDesc1)
267         {
268             Status = AE_NO_MEMORY;
269             goto Cleanup;
270         }
271 
272         ReturnDesc2 = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
273         if (!ReturnDesc2)
274         {
275             Status = AE_NO_MEMORY;
276             goto Cleanup;
277         }
278 
279         /* Quotient to ReturnDesc1, remainder to ReturnDesc2 */
280 
281         Status = AcpiUtDivide (Operand[0]->Integer.Value,
282                                Operand[1]->Integer.Value,
283                                &ReturnDesc1->Integer.Value,
284                                &ReturnDesc2->Integer.Value);
285         if (ACPI_FAILURE (Status))
286         {
287             goto Cleanup;
288         }
289         break;
290 
291     default:
292 
293         ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X",
294             WalkState->Opcode));
295         Status = AE_AML_BAD_OPCODE;
296         goto Cleanup;
297     }
298 
299     /* Store the results to the target reference operands */
300 
301     Status = AcpiExStore (ReturnDesc2, Operand[2], WalkState);
302     if (ACPI_FAILURE (Status))
303     {
304         goto Cleanup;
305     }
306 
307     Status = AcpiExStore (ReturnDesc1, Operand[3], WalkState);
308     if (ACPI_FAILURE (Status))
309     {
310         goto Cleanup;
311     }
312 
313 Cleanup:
314     /*
315      * Since the remainder is not returned indirectly, remove a reference to
316      * it. Only the quotient is returned indirectly.
317      */
318     AcpiUtRemoveReference (ReturnDesc2);
319 
320     if (ACPI_FAILURE (Status))
321     {
322         /* Delete the return object */
323 
324         AcpiUtRemoveReference (ReturnDesc1);
325     }
326 
327     /* Save return object (the remainder) on success */
328 
329     else
330     {
331         WalkState->ResultObj = ReturnDesc1;
332     }
333 
334     return_ACPI_STATUS (Status);
335 }
336 
337 
338 /*******************************************************************************
339  *
340  * FUNCTION:    AcpiExOpcode_2A_1T_1R
341  *
342  * PARAMETERS:  WalkState           - Current walk state
343  *
344  * RETURN:      Status
345  *
346  * DESCRIPTION: Execute opcode with two arguments, one target, and a return
347  *              value.
348  *
349  ******************************************************************************/
350 
351 ACPI_STATUS
352 AcpiExOpcode_2A_1T_1R (
353     ACPI_WALK_STATE         *WalkState)
354 {
355     ACPI_OPERAND_OBJECT     **Operand = &WalkState->Operands[0];
356     ACPI_OPERAND_OBJECT     *ReturnDesc = NULL;
357     UINT64                  Index;
358     ACPI_STATUS             Status = AE_OK;
359     ACPI_SIZE               Length = 0;
360 
361 
362     ACPI_FUNCTION_TRACE_STR (ExOpcode_2A_1T_1R,
363         AcpiPsGetOpcodeName (WalkState->Opcode));
364 
365 
366     /* Execute the opcode */
367 
368     if (WalkState->OpInfo->Flags & AML_MATH)
369     {
370         /* All simple math opcodes (add, etc.) */
371 
372         ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
373         if (!ReturnDesc)
374         {
375             Status = AE_NO_MEMORY;
376             goto Cleanup;
377         }
378 
379         ReturnDesc->Integer.Value = AcpiExDoMathOp (WalkState->Opcode,
380                                                 Operand[0]->Integer.Value,
381                                                 Operand[1]->Integer.Value);
382         goto StoreResultToTarget;
383     }
384 
385     switch (WalkState->Opcode)
386     {
387     case AML_MOD_OP: /* Mod (Dividend, Divisor, RemainderResult (ACPI 2.0) */
388 
389         ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
390         if (!ReturnDesc)
391         {
392             Status = AE_NO_MEMORY;
393             goto Cleanup;
394         }
395 
396         /* ReturnDesc will contain the remainder */
397 
398         Status = AcpiUtDivide (Operand[0]->Integer.Value,
399                                Operand[1]->Integer.Value,
400                                NULL,
401                                &ReturnDesc->Integer.Value);
402         break;
403 
404     case AML_CONCAT_OP: /* Concatenate (Data1, Data2, Result) */
405 
406         Status = AcpiExDoConcatenate (Operand[0], Operand[1],
407                     &ReturnDesc, WalkState);
408         break;
409 
410     case AML_TO_STRING_OP: /* ToString (Buffer, Length, Result) (ACPI 2.0) */
411         /*
412          * Input object is guaranteed to be a buffer at this point (it may have
413          * been converted.)  Copy the raw buffer data to a new object of
414          * type String.
415          */
416 
417         /*
418          * Get the length of the new string. It is the smallest of:
419          * 1) Length of the input buffer
420          * 2) Max length as specified in the ToString operator
421          * 3) Length of input buffer up to a zero byte (null terminator)
422          *
423          * NOTE: A length of zero is ok, and will create a zero-length, null
424          *       terminated string.
425          */
426         while ((Length < Operand[0]->Buffer.Length) &&
427                (Length < Operand[1]->Integer.Value) &&
428                (Operand[0]->Buffer.Pointer[Length]))
429         {
430             Length++;
431         }
432 
433         /* Allocate a new string object */
434 
435         ReturnDesc = AcpiUtCreateStringObject (Length);
436         if (!ReturnDesc)
437         {
438             Status = AE_NO_MEMORY;
439             goto Cleanup;
440         }
441 
442         /*
443          * Copy the raw buffer data with no transform.
444          * (NULL terminated already)
445          */
446         ACPI_MEMCPY (ReturnDesc->String.Pointer,
447             Operand[0]->Buffer.Pointer, Length);
448         break;
449 
450     case AML_CONCAT_RES_OP:
451 
452         /* ConcatenateResTemplate (Buffer, Buffer, Result) (ACPI 2.0) */
453 
454         Status = AcpiExConcatTemplate (Operand[0], Operand[1],
455                     &ReturnDesc, WalkState);
456         break;
457 
458     case AML_INDEX_OP:              /* Index (Source Index Result) */
459 
460         /* Create the internal return object */
461 
462         ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_LOCAL_REFERENCE);
463         if (!ReturnDesc)
464         {
465             Status = AE_NO_MEMORY;
466             goto Cleanup;
467         }
468 
469         /* Initialize the Index reference object */
470 
471         Index = Operand[1]->Integer.Value;
472         ReturnDesc->Reference.Value = (UINT32) Index;
473         ReturnDesc->Reference.Class = ACPI_REFCLASS_INDEX;
474 
475         /*
476          * At this point, the Source operand is a String, Buffer, or Package.
477          * Verify that the index is within range.
478          */
479         switch ((Operand[0])->Common.Type)
480         {
481         case ACPI_TYPE_STRING:
482 
483             if (Index >= Operand[0]->String.Length)
484             {
485                 Length = Operand[0]->String.Length;
486                 Status = AE_AML_STRING_LIMIT;
487             }
488 
489             ReturnDesc->Reference.TargetType = ACPI_TYPE_BUFFER_FIELD;
490             break;
491 
492         case ACPI_TYPE_BUFFER:
493 
494             if (Index >= Operand[0]->Buffer.Length)
495             {
496                 Length = Operand[0]->Buffer.Length;
497                 Status = AE_AML_BUFFER_LIMIT;
498             }
499 
500             ReturnDesc->Reference.TargetType = ACPI_TYPE_BUFFER_FIELD;
501             break;
502 
503         case ACPI_TYPE_PACKAGE:
504 
505             if (Index >= Operand[0]->Package.Count)
506             {
507                 Length = Operand[0]->Package.Count;
508                 Status = AE_AML_PACKAGE_LIMIT;
509             }
510 
511             ReturnDesc->Reference.TargetType = ACPI_TYPE_PACKAGE;
512             ReturnDesc->Reference.Where = &Operand[0]->Package.Elements [Index];
513             break;
514 
515         default:
516 
517             Status = AE_AML_INTERNAL;
518             goto Cleanup;
519         }
520 
521         /* Failure means that the Index was beyond the end of the object */
522 
523         if (ACPI_FAILURE (Status))
524         {
525             ACPI_EXCEPTION ((AE_INFO, Status,
526                 "Index (0x%X%8.8X) is beyond end of object (length 0x%X)",
527                 ACPI_FORMAT_UINT64 (Index), (UINT32) Length));
528             goto Cleanup;
529         }
530 
531         /*
532          * Save the target object and add a reference to it for the life
533          * of the index
534          */
535         ReturnDesc->Reference.Object = Operand[0];
536         AcpiUtAddReference (Operand[0]);
537 
538         /* Store the reference to the Target */
539 
540         Status = AcpiExStore (ReturnDesc, Operand[2], WalkState);
541 
542         /* Return the reference */
543 
544         WalkState->ResultObj = ReturnDesc;
545         goto Cleanup;
546 
547     default:
548 
549         ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X",
550             WalkState->Opcode));
551         Status = AE_AML_BAD_OPCODE;
552         break;
553     }
554 
555 
556 StoreResultToTarget:
557 
558     if (ACPI_SUCCESS (Status))
559     {
560         /*
561          * Store the result of the operation (which is now in ReturnDesc) into
562          * the Target descriptor.
563          */
564         Status = AcpiExStore (ReturnDesc, Operand[2], WalkState);
565         if (ACPI_FAILURE (Status))
566         {
567             goto Cleanup;
568         }
569 
570         if (!WalkState->ResultObj)
571         {
572             WalkState->ResultObj = ReturnDesc;
573         }
574     }
575 
576 
577 Cleanup:
578 
579     /* Delete return object on error */
580 
581     if (ACPI_FAILURE (Status))
582     {
583         AcpiUtRemoveReference (ReturnDesc);
584         WalkState->ResultObj = NULL;
585     }
586 
587     return_ACPI_STATUS (Status);
588 }
589 
590 
591 /*******************************************************************************
592  *
593  * FUNCTION:    AcpiExOpcode_2A_0T_1R
594  *
595  * PARAMETERS:  WalkState           - Current walk state
596  *
597  * RETURN:      Status
598  *
599  * DESCRIPTION: Execute opcode with 2 arguments, no target, and a return value
600  *
601  ******************************************************************************/
602 
603 ACPI_STATUS
604 AcpiExOpcode_2A_0T_1R (
605     ACPI_WALK_STATE         *WalkState)
606 {
607     ACPI_OPERAND_OBJECT     **Operand = &WalkState->Operands[0];
608     ACPI_OPERAND_OBJECT     *ReturnDesc = NULL;
609     ACPI_STATUS             Status = AE_OK;
610     BOOLEAN                 LogicalResult = FALSE;
611 
612 
613     ACPI_FUNCTION_TRACE_STR (ExOpcode_2A_0T_1R,
614         AcpiPsGetOpcodeName (WalkState->Opcode));
615 
616 
617     /* Create the internal return object */
618 
619     ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
620     if (!ReturnDesc)
621     {
622         Status = AE_NO_MEMORY;
623         goto Cleanup;
624     }
625 
626     /* Execute the Opcode */
627 
628     if (WalkState->OpInfo->Flags & AML_LOGICAL_NUMERIC)
629     {
630         /* LogicalOp  (Operand0, Operand1) */
631 
632         Status = AcpiExDoLogicalNumericOp (WalkState->Opcode,
633                         Operand[0]->Integer.Value, Operand[1]->Integer.Value,
634                         &LogicalResult);
635         goto StoreLogicalResult;
636     }
637     else if (WalkState->OpInfo->Flags & AML_LOGICAL)
638     {
639         /* LogicalOp  (Operand0, Operand1) */
640 
641         Status = AcpiExDoLogicalOp (WalkState->Opcode, Operand[0],
642                     Operand[1], &LogicalResult);
643         goto StoreLogicalResult;
644     }
645 
646     switch (WalkState->Opcode)
647     {
648     case AML_ACQUIRE_OP:            /* Acquire (MutexObject, Timeout) */
649 
650         Status = AcpiExAcquireMutex (Operand[1], Operand[0], WalkState);
651         if (Status == AE_TIME)
652         {
653             LogicalResult = TRUE;       /* TRUE = Acquire timed out */
654             Status = AE_OK;
655         }
656         break;
657 
658 
659     case AML_WAIT_OP:               /* Wait (EventObject, Timeout) */
660 
661         Status = AcpiExSystemWaitEvent (Operand[1], Operand[0]);
662         if (Status == AE_TIME)
663         {
664             LogicalResult = TRUE;       /* TRUE, Wait timed out */
665             Status = AE_OK;
666         }
667         break;
668 
669     default:
670 
671         ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X",
672             WalkState->Opcode));
673         Status = AE_AML_BAD_OPCODE;
674         goto Cleanup;
675     }
676 
677 
678 StoreLogicalResult:
679     /*
680      * Set return value to according to LogicalResult. logical TRUE (all ones)
681      * Default is FALSE (zero)
682      */
683     if (LogicalResult)
684     {
685         ReturnDesc->Integer.Value = ACPI_UINT64_MAX;
686     }
687 
688 Cleanup:
689 
690     /* Delete return object on error */
691 
692     if (ACPI_FAILURE (Status))
693     {
694         AcpiUtRemoveReference (ReturnDesc);
695     }
696 
697     /* Save return object on success */
698 
699     else
700     {
701         WalkState->ResultObj = ReturnDesc;
702     }
703 
704     return_ACPI_STATUS (Status);
705 }
706