Back to home page

Quest Cross Reference

 
 

    


Warning, cross-references for /kernel/drivers/acpica/exoparg2.c need to be fixed.

0001 /******************************************************************************
0002  *
0003  * Module Name: exoparg2 - AML execution - opcodes with 2 arguments
0004  *
0005  *****************************************************************************/
0006 
0007 /******************************************************************************
0008  *
0009  * 1. Copyright Notice
0010  *
0011  * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
0012  * All rights reserved.
0013  *
0014  * 2. License
0015  *
0016  * 2.1. This is your license from Intel Corp. under its intellectual property
0017  * rights.  You may have additional license terms from the party that provided
0018  * you this software, covering your right to use that party's intellectual
0019  * property rights.
0020  *
0021  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
0022  * copy of the source code appearing in this file ("Covered Code") an
0023  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
0024  * base code distributed originally by Intel ("Original Intel Code") to copy,
0025  * make derivatives, distribute, use and display any portion of the Covered
0026  * Code in any form, with the right to sublicense such rights; and
0027  *
0028  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
0029  * license (with the right to sublicense), under only those claims of Intel
0030  * patents that are infringed by the Original Intel Code, to make, use, sell,
0031  * offer to sell, and import the Covered Code and derivative works thereof
0032  * solely to the minimum extent necessary to exercise the above copyright
0033  * license, and in no event shall the patent license extend to any additions
0034  * to or modifications of the Original Intel Code.  No other license or right
0035  * is granted directly or by implication, estoppel or otherwise;
0036  *
0037  * The above copyright and patent license is granted only if the following
0038  * conditions are met:
0039  *
0040  * 3. Conditions
0041  *
0042  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
0043  * Redistribution of source code of any substantial portion of the Covered
0044  * Code or modification with rights to further distribute source must include
0045  * the above Copyright Notice, the above License, this list of Conditions,
0046  * and the following Disclaimer and Export Compliance provision.  In addition,
0047  * Licensee must cause all Covered Code to which Licensee contributes to
0048  * contain a file documenting the changes Licensee made to create that Covered
0049  * Code and the date of any change.  Licensee must include in that file the
0050  * documentation of any changes made by any predecessor Licensee.  Licensee
0051  * must include a prominent statement that the modification is derived,
0052  * directly or indirectly, from Original Intel Code.
0053  *
0054  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
0055  * Redistribution of source code of any substantial portion of the Covered
0056  * Code or modification without rights to further distribute source must
0057  * include the following Disclaimer and Export Compliance provision in the
0058  * documentation and/or other materials provided with distribution.  In
0059  * addition, Licensee may not authorize further sublicense of source of any
0060  * portion of the Covered Code, and must include terms to the effect that the
0061  * license from Licensee to its licensee is limited to the intellectual
0062  * property embodied in the software Licensee provides to its licensee, and
0063  * not to intellectual property embodied in modifications its licensee may
0064  * make.
0065  *
0066  * 3.3. Redistribution of Executable. Redistribution in executable form of any
0067  * substantial portion of the Covered Code or modification must reproduce the
0068  * above Copyright Notice, and the following Disclaimer and Export Compliance
0069  * provision in the documentation and/or other materials provided with the
0070  * distribution.
0071  *
0072  * 3.4. Intel retains all right, title, and interest in and to the Original
0073  * Intel Code.
0074  *
0075  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
0076  * Intel shall be used in advertising or otherwise to promote the sale, use or
0077  * other dealings in products derived from or relating to the Covered Code
0078  * without prior written authorization from Intel.
0079  *
0080  * 4. Disclaimer and Export Compliance
0081  *
0082  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
0083  * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
0084  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
0085  * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
0086  * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
0087  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
0088  * PARTICULAR PURPOSE.
0089  *
0090  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
0091  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
0092  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
0093  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
0094  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
0095  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
0096  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
0097  * LIMITED REMEDY.
0098  *
0099  * 4.3. Licensee shall not export, either directly or indirectly, any of this
0100  * software or system incorporating such software without first obtaining any
0101  * required license or other approval from the U. S. Department of Commerce or
0102  * any other agency or department of the United States Government.  In the
0103  * event Licensee exports any such software from the United States or
0104  * re-exports any such software from a foreign destination, Licensee shall
0105  * ensure that the distribution and export/re-export of the software is in
0106  * compliance with all laws, regulations, orders, or other restrictions of the
0107  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
0108  * any of its subsidiaries will export/re-export any technical data, process,
0109  * software, or service, directly or indirectly, to any country for which the
0110  * United States government or any agency thereof requires an export license,
0111  * other governmental approval, or letter of assurance, without first obtaining
0112  * such license, approval or letter.
0113  *
0114  *****************************************************************************/
0115 
0116 
0117 #define __EXOPARG2_C__
0118 
0119 #include "acpi.h"
0120 #include "accommon.h"
0121 #include "acparser.h"
0122 #include "acinterp.h"
0123 #include "acevents.h"
0124 #include "amlcode.h"
0125 
0126 
0127 #define _COMPONENT          ACPI_EXECUTER
0128         ACPI_MODULE_NAME    ("exoparg2")
0129 
0130 
0131 /*!
0132  * Naming convention for AML interpreter execution routines.
0133  *
0134  * The routines that begin execution of AML opcodes are named with a common
0135  * convention based upon the number of arguments, the number of target operands,
0136  * and whether or not a value is returned:
0137  *
0138  *      AcpiExOpcode_xA_yT_zR
0139  *
0140  * Where:
0141  *
0142  * xA - ARGUMENTS:    The number of arguments (input operands) that are
0143  *                    required for this opcode type (1 through 6 args).
0144  * yT - TARGETS:      The number of targets (output operands) that are required
0145  *                    for this opcode type (0, 1, or 2 targets).
0146  * zR - RETURN VALUE: Indicates whether this opcode type returns a value
0147  *                    as the function return (0 or 1).
0148  *
0149  * The AcpiExOpcode* functions are called via the Dispatcher component with
0150  * fully resolved operands.
0151 !*/
0152 
0153 
0154 /*******************************************************************************
0155  *
0156  * FUNCTION:    AcpiExOpcode_2A_0T_0R
0157  *
0158  * PARAMETERS:  WalkState           - Current walk state
0159  *
0160  * RETURN:      Status
0161  *
0162  * DESCRIPTION: Execute opcode with two arguments, no target, and no return
0163  *              value.
0164  *
0165  * ALLOCATION:  Deletes both operands
0166  *
0167  ******************************************************************************/
0168 
0169 ACPI_STATUS
0170 AcpiExOpcode_2A_0T_0R (
0171     ACPI_WALK_STATE         *WalkState)
0172 {
0173     ACPI_OPERAND_OBJECT     **Operand = &WalkState->Operands[0];
0174     ACPI_NAMESPACE_NODE     *Node;
0175     UINT32                  Value;
0176     ACPI_STATUS             Status = AE_OK;
0177 
0178 
0179     ACPI_FUNCTION_TRACE_STR (ExOpcode_2A_0T_0R,
0180             AcpiPsGetOpcodeName (WalkState->Opcode));
0181 
0182 
0183     /* Examine the opcode */
0184 
0185     switch (WalkState->Opcode)
0186     {
0187     case AML_NOTIFY_OP:         /* Notify (NotifyObject, NotifyValue) */
0188 
0189         /* The first operand is a namespace node */
0190 
0191         Node = (ACPI_NAMESPACE_NODE *) Operand[0];
0192 
0193         /* Second value is the notify value */
0194 
0195         Value = (UINT32) Operand[1]->Integer.Value;
0196 
0197         /* Are notifies allowed on this object? */
0198 
0199         if (!AcpiEvIsNotifyObject (Node))
0200         {
0201             ACPI_ERROR ((AE_INFO,
0202                 "Unexpected notify object type [%s]",
0203                 AcpiUtGetTypeName (Node->Type)));
0204 
0205             Status = AE_AML_OPERAND_TYPE;
0206             break;
0207         }
0208 
0209 #ifdef ACPI_GPE_NOTIFY_CHECK
0210         /*
0211          * GPE method wake/notify check.  Here, we want to ensure that we
0212          * don't receive any "DeviceWake" Notifies from a GPE _Lxx or _Exx
0213          * GPE method during system runtime.  If we do, the GPE is marked
0214          * as "wake-only" and disabled.
0215          *
0216          * 1) Is the Notify() value == DeviceWake?
0217          * 2) Is this a GPE deferred method?  (An _Lxx or _Exx method)
0218          * 3) Did the original GPE happen at system runtime?
0219          *    (versus during wake)
0220          *
0221          * If all three cases are true, this is a wake-only GPE that should
0222          * be disabled at runtime.
0223          */
0224         if (Value == 2)     /* DeviceWake */
0225         {
0226             Status = AcpiEvCheckForWakeOnlyGpe (WalkState->GpeEventInfo);
0227             if (ACPI_FAILURE (Status))
0228             {
0229                 /* AE_WAKE_ONLY_GPE only error, means ignore this notify */
0230 
0231                 return_ACPI_STATUS (AE_OK)
0232             }
0233         }
0234 #endif
0235 
0236         /*
0237          * Dispatch the notify to the appropriate handler
0238          * NOTE: the request is queued for execution after this method
0239          * completes.  The notify handlers are NOT invoked synchronously
0240          * from this thread -- because handlers may in turn run other
0241          * control methods.
0242          */
0243         Status = AcpiEvQueueNotifyRequest (Node, Value);
0244         break;
0245 
0246 
0247     default:
0248 
0249         ACPI_ERROR ((AE_INFO, "Unknown AML opcode %X",
0250             WalkState->Opcode));
0251         Status = AE_AML_BAD_OPCODE;
0252     }
0253 
0254     return_ACPI_STATUS (Status);
0255 }
0256 
0257 
0258 /*******************************************************************************
0259  *
0260  * FUNCTION:    AcpiExOpcode_2A_2T_1R
0261  *
0262  * PARAMETERS:  WalkState           - Current walk state
0263  *
0264  * RETURN:      Status
0265  *
0266  * DESCRIPTION: Execute a dyadic operator (2 operands) with 2 output targets
0267  *              and one implicit return value.
0268  *
0269  ******************************************************************************/
0270 
0271 ACPI_STATUS
0272 AcpiExOpcode_2A_2T_1R (
0273     ACPI_WALK_STATE         *WalkState)
0274 {
0275     ACPI_OPERAND_OBJECT     **Operand = &WalkState->Operands[0];
0276     ACPI_OPERAND_OBJECT     *ReturnDesc1 = NULL;
0277     ACPI_OPERAND_OBJECT     *ReturnDesc2 = NULL;
0278     ACPI_STATUS             Status;
0279 
0280 
0281     ACPI_FUNCTION_TRACE_STR (ExOpcode_2A_2T_1R,
0282         AcpiPsGetOpcodeName (WalkState->Opcode));
0283 
0284 
0285     /* Execute the opcode */
0286 
0287     switch (WalkState->Opcode)
0288     {
0289     case AML_DIVIDE_OP:
0290 
0291         /* Divide (Dividend, Divisor, RemainderResult QuotientResult) */
0292 
0293         ReturnDesc1 = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
0294         if (!ReturnDesc1)
0295         {
0296             Status = AE_NO_MEMORY;
0297             goto Cleanup;
0298         }
0299 
0300         ReturnDesc2 = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
0301         if (!ReturnDesc2)
0302         {
0303             Status = AE_NO_MEMORY;
0304             goto Cleanup;
0305         }
0306 
0307         /* Quotient to ReturnDesc1, remainder to ReturnDesc2 */
0308 
0309         Status = AcpiUtDivide (Operand[0]->Integer.Value,
0310                                Operand[1]->Integer.Value,
0311                                &ReturnDesc1->Integer.Value,
0312                                &ReturnDesc2->Integer.Value);
0313         if (ACPI_FAILURE (Status))
0314         {
0315             goto Cleanup;
0316         }
0317         break;
0318 
0319 
0320     default:
0321 
0322         ACPI_ERROR ((AE_INFO, "Unknown AML opcode %X",
0323             WalkState->Opcode));
0324         Status = AE_AML_BAD_OPCODE;
0325         goto Cleanup;
0326     }
0327 
0328     /* Store the results to the target reference operands */
0329 
0330     Status = AcpiExStore (ReturnDesc2, Operand[2], WalkState);
0331     if (ACPI_FAILURE (Status))
0332     {
0333         goto Cleanup;
0334     }
0335 
0336     Status = AcpiExStore (ReturnDesc1, Operand[3], WalkState);
0337     if (ACPI_FAILURE (Status))
0338     {
0339         goto Cleanup;
0340     }
0341 
0342 Cleanup:
0343     /*
0344      * Since the remainder is not returned indirectly, remove a reference to
0345      * it. Only the quotient is returned indirectly.
0346      */
0347     AcpiUtRemoveReference (ReturnDesc2);
0348 
0349     if (ACPI_FAILURE (Status))
0350     {
0351         /* Delete the return object */
0352 
0353         AcpiUtRemoveReference (ReturnDesc1);
0354     }
0355 
0356     /* Save return object (the remainder) on success */
0357 
0358     else
0359     {
0360         WalkState->ResultObj = ReturnDesc1;
0361     }
0362 
0363     return_ACPI_STATUS (Status);
0364 }
0365 
0366 
0367 /*******************************************************************************
0368  *
0369  * FUNCTION:    AcpiExOpcode_2A_1T_1R
0370  *
0371  * PARAMETERS:  WalkState           - Current walk state
0372  *
0373  * RETURN:      Status
0374  *
0375  * DESCRIPTION: Execute opcode with two arguments, one target, and a return
0376  *              value.
0377  *
0378  ******************************************************************************/
0379 
0380 ACPI_STATUS
0381 AcpiExOpcode_2A_1T_1R (
0382     ACPI_WALK_STATE         *WalkState)
0383 {
0384     ACPI_OPERAND_OBJECT     **Operand = &WalkState->Operands[0];
0385     ACPI_OPERAND_OBJECT     *ReturnDesc = NULL;
0386     ACPI_INTEGER            Index;
0387     ACPI_STATUS             Status = AE_OK;
0388     ACPI_SIZE               Length;
0389 
0390 
0391     ACPI_FUNCTION_TRACE_STR (ExOpcode_2A_1T_1R,
0392         AcpiPsGetOpcodeName (WalkState->Opcode));
0393 
0394 
0395     /* Execute the opcode */
0396 
0397     if (WalkState->OpInfo->Flags & AML_MATH)
0398     {
0399         /* All simple math opcodes (add, etc.) */
0400 
0401         ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
0402         if (!ReturnDesc)
0403         {
0404             Status = AE_NO_MEMORY;
0405             goto Cleanup;
0406         }
0407 
0408         ReturnDesc->Integer.Value = AcpiExDoMathOp (WalkState->Opcode,
0409                                                 Operand[0]->Integer.Value,
0410                                                 Operand[1]->Integer.Value);
0411         goto StoreResultToTarget;
0412     }
0413 
0414     switch (WalkState->Opcode)
0415     {
0416     case AML_MOD_OP: /* Mod (Dividend, Divisor, RemainderResult (ACPI 2.0) */
0417 
0418         ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
0419         if (!ReturnDesc)
0420         {
0421             Status = AE_NO_MEMORY;
0422             goto Cleanup;
0423         }
0424 
0425         /* ReturnDesc will contain the remainder */
0426 
0427         Status = AcpiUtDivide (Operand[0]->Integer.Value,
0428                                Operand[1]->Integer.Value,
0429                                NULL,
0430                                &ReturnDesc->Integer.Value);
0431         break;
0432 
0433 
0434     case AML_CONCAT_OP: /* Concatenate (Data1, Data2, Result) */
0435 
0436         Status = AcpiExDoConcatenate (Operand[0], Operand[1],
0437                     &ReturnDesc, WalkState);
0438         break;
0439 
0440 
0441     case AML_TO_STRING_OP: /* ToString (Buffer, Length, Result) (ACPI 2.0) */
0442 
0443         /*
0444          * Input object is guaranteed to be a buffer at this point (it may have
0445          * been converted.)  Copy the raw buffer data to a new object of
0446          * type String.
0447          */
0448 
0449         /*
0450          * Get the length of the new string. It is the smallest of:
0451          * 1) Length of the input buffer
0452          * 2) Max length as specified in the ToString operator
0453          * 3) Length of input buffer up to a zero byte (null terminator)
0454          *
0455          * NOTE: A length of zero is ok, and will create a zero-length, null
0456          *       terminated string.
0457          */
0458         Length = 0;
0459         while ((Length < Operand[0]->Buffer.Length) &&
0460                (Length < Operand[1]->Integer.Value) &&
0461                (Operand[0]->Buffer.Pointer[Length]))
0462         {
0463             Length++;
0464         }
0465 
0466         /* Allocate a new string object */
0467 
0468         ReturnDesc = AcpiUtCreateStringObject (Length);
0469         if (!ReturnDesc)
0470         {
0471             Status = AE_NO_MEMORY;
0472             goto Cleanup;
0473         }
0474 
0475         /*
0476          * Copy the raw buffer data with no transform.
0477          * (NULL terminated already)
0478          */
0479         ACPI_MEMCPY (ReturnDesc->String.Pointer,
0480             Operand[0]->Buffer.Pointer, Length);
0481         break;
0482 
0483 
0484     case AML_CONCAT_RES_OP:
0485 
0486         /* ConcatenateResTemplate (Buffer, Buffer, Result) (ACPI 2.0) */
0487 
0488         Status = AcpiExConcatTemplate (Operand[0], Operand[1],
0489                     &ReturnDesc, WalkState);
0490         break;
0491 
0492 
0493     case AML_INDEX_OP:              /* Index (Source Index Result) */
0494 
0495         /* Create the internal return object */
0496 
0497         ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_LOCAL_REFERENCE);
0498         if (!ReturnDesc)
0499         {
0500             Status = AE_NO_MEMORY;
0501             goto Cleanup;
0502         }
0503 
0504         /* Initialize the Index reference object */
0505 
0506         Index = Operand[1]->Integer.Value;
0507         ReturnDesc->Reference.Value = (UINT32) Index;
0508         ReturnDesc->Reference.Class = ACPI_REFCLASS_INDEX;
0509 
0510         /*
0511          * At this point, the Source operand is a String, Buffer, or Package.
0512          * Verify that the index is within range.
0513          */
0514         switch ((Operand[0])->Common.Type)
0515         {
0516         case ACPI_TYPE_STRING:
0517 
0518             if (Index >= Operand[0]->String.Length)
0519             {
0520                 Status = AE_AML_STRING_LIMIT;
0521             }
0522 
0523             ReturnDesc->Reference.TargetType = ACPI_TYPE_BUFFER_FIELD;
0524             break;
0525 
0526         case ACPI_TYPE_BUFFER:
0527 
0528             if (Index >= Operand[0]->Buffer.Length)
0529             {
0530                 Status = AE_AML_BUFFER_LIMIT;
0531             }
0532 
0533             ReturnDesc->Reference.TargetType = ACPI_TYPE_BUFFER_FIELD;
0534             break;
0535 
0536         case ACPI_TYPE_PACKAGE:
0537 
0538             if (Index >= Operand[0]->Package.Count)
0539             {
0540                 Status = AE_AML_PACKAGE_LIMIT;
0541             }
0542 
0543             ReturnDesc->Reference.TargetType = ACPI_TYPE_PACKAGE;
0544             ReturnDesc->Reference.Where = &Operand[0]->Package.Elements [Index];
0545             break;
0546 
0547         default:
0548 
0549             Status = AE_AML_INTERNAL;
0550             goto Cleanup;
0551         }
0552 
0553         /* Failure means that the Index was beyond the end of the object */
0554 
0555         if (ACPI_FAILURE (Status))
0556         {
0557             ACPI_EXCEPTION ((AE_INFO, Status,
0558                 "Index (%X%8.8X) is beyond end of object",
0559                 ACPI_FORMAT_UINT64 (Index)));
0560             goto Cleanup;
0561         }
0562 
0563         /*
0564          * Save the target object and add a reference to it for the life
0565          * of the index
0566          */
0567         ReturnDesc->Reference.Object = Operand[0];
0568         AcpiUtAddReference (Operand[0]);
0569 
0570         /* Store the reference to the Target */
0571 
0572         Status = AcpiExStore (ReturnDesc, Operand[2], WalkState);
0573 
0574         /* Return the reference */
0575 
0576         WalkState->ResultObj = ReturnDesc;
0577         goto Cleanup;
0578 
0579 
0580     default:
0581 
0582         ACPI_ERROR ((AE_INFO, "Unknown AML opcode %X",
0583             WalkState->Opcode));
0584         Status = AE_AML_BAD_OPCODE;
0585         break;
0586     }
0587 
0588 
0589 StoreResultToTarget:
0590 
0591     if (ACPI_SUCCESS (Status))
0592     {
0593         /*
0594          * Store the result of the operation (which is now in ReturnDesc) into
0595          * the Target descriptor.
0596          */
0597         Status = AcpiExStore (ReturnDesc, Operand[2], WalkState);
0598         if (ACPI_FAILURE (Status))
0599         {
0600             goto Cleanup;
0601         }
0602 
0603         if (!WalkState->ResultObj)
0604         {
0605             WalkState->ResultObj = ReturnDesc;
0606         }
0607     }
0608 
0609 
0610 Cleanup:
0611 
0612     /* Delete return object on error */
0613 
0614     if (ACPI_FAILURE (Status))
0615     {
0616         AcpiUtRemoveReference (ReturnDesc);
0617         WalkState->ResultObj = NULL;
0618     }
0619 
0620     return_ACPI_STATUS (Status);
0621 }
0622 
0623 
0624 /*******************************************************************************
0625  *
0626  * FUNCTION:    AcpiExOpcode_2A_0T_1R
0627  *
0628  * PARAMETERS:  WalkState           - Current walk state
0629  *
0630  * RETURN:      Status
0631  *
0632  * DESCRIPTION: Execute opcode with 2 arguments, no target, and a return value
0633  *
0634  ******************************************************************************/
0635 
0636 ACPI_STATUS
0637 AcpiExOpcode_2A_0T_1R (
0638     ACPI_WALK_STATE         *WalkState)
0639 {
0640     ACPI_OPERAND_OBJECT     **Operand = &WalkState->Operands[0];
0641     ACPI_OPERAND_OBJECT     *ReturnDesc = NULL;
0642     ACPI_STATUS             Status = AE_OK;
0643     BOOLEAN                 LogicalResult = FALSE;
0644 
0645 
0646     ACPI_FUNCTION_TRACE_STR (ExOpcode_2A_0T_1R,
0647         AcpiPsGetOpcodeName (WalkState->Opcode));
0648 
0649 
0650     /* Create the internal return object */
0651 
0652     ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
0653     if (!ReturnDesc)
0654     {
0655         Status = AE_NO_MEMORY;
0656         goto Cleanup;
0657     }
0658 
0659     /* Execute the Opcode */
0660 
0661     if (WalkState->OpInfo->Flags & AML_LOGICAL_NUMERIC)
0662     {
0663         /* LogicalOp  (Operand0, Operand1) */
0664 
0665         Status = AcpiExDoLogicalNumericOp (WalkState->Opcode,
0666                         Operand[0]->Integer.Value, Operand[1]->Integer.Value,
0667                         &LogicalResult);
0668         goto StoreLogicalResult;
0669     }
0670     else if (WalkState->OpInfo->Flags & AML_LOGICAL)
0671     {
0672         /* LogicalOp  (Operand0, Operand1) */
0673 
0674         Status = AcpiExDoLogicalOp (WalkState->Opcode, Operand[0],
0675                     Operand[1], &LogicalResult);
0676         goto StoreLogicalResult;
0677     }
0678 
0679     switch (WalkState->Opcode)
0680     {
0681     case AML_ACQUIRE_OP:            /* Acquire (MutexObject, Timeout) */
0682 
0683         Status = AcpiExAcquireMutex (Operand[1], Operand[0], WalkState);
0684         if (Status == AE_TIME)
0685         {
0686             LogicalResult = TRUE;       /* TRUE = Acquire timed out */
0687             Status = AE_OK;
0688         }
0689         break;
0690 
0691 
0692     case AML_WAIT_OP:               /* Wait (EventObject, Timeout) */
0693 
0694         Status = AcpiExSystemWaitEvent (Operand[1], Operand[0]);
0695         if (Status == AE_TIME)
0696         {
0697             LogicalResult = TRUE;       /* TRUE, Wait timed out */
0698             Status = AE_OK;
0699         }
0700         break;
0701 
0702 
0703     default:
0704 
0705         ACPI_ERROR ((AE_INFO, "Unknown AML opcode %X",
0706             WalkState->Opcode));
0707         Status = AE_AML_BAD_OPCODE;
0708         goto Cleanup;
0709     }
0710 
0711 
0712 StoreLogicalResult:
0713     /*
0714      * Set return value to according to LogicalResult. logical TRUE (all ones)
0715      * Default is FALSE (zero)
0716      */
0717     if (LogicalResult)
0718     {
0719         ReturnDesc->Integer.Value = ACPI_INTEGER_MAX;
0720     }
0721 
0722 Cleanup:
0723 
0724     /* Delete return object on error */
0725 
0726     if (ACPI_FAILURE (Status))
0727     {
0728         AcpiUtRemoveReference (ReturnDesc);
0729     }
0730 
0731     /* Save return object on success */
0732 
0733     else
0734     {
0735         WalkState->ResultObj = ReturnDesc;
0736     }
0737 
0738     return_ACPI_STATUS (Status);
0739 }
0740 
0741