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