Path: blob/main/sys/contrib/dev/acpica/components/dispatcher/dswexec.c
48521 views
/******************************************************************************1*2* Module Name: dswexec - Dispatcher method execution callbacks;3* dispatch to interpreter.4*5*****************************************************************************/67/******************************************************************************8*9* 1. Copyright Notice10*11* Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp.12* All rights reserved.13*14* 2. License15*16* 2.1. This is your license from Intel Corp. under its intellectual property17* rights. You may have additional license terms from the party that provided18* you this software, covering your right to use that party's intellectual19* property rights.20*21* 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a22* copy of the source code appearing in this file ("Covered Code") an23* irrevocable, perpetual, worldwide license under Intel's copyrights in the24* base code distributed originally by Intel ("Original Intel Code") to copy,25* make derivatives, distribute, use and display any portion of the Covered26* Code in any form, with the right to sublicense such rights; and27*28* 2.3. Intel grants Licensee a non-exclusive and non-transferable patent29* license (with the right to sublicense), under only those claims of Intel30* 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 thereof32* solely to the minimum extent necessary to exercise the above copyright33* license, and in no event shall the patent license extend to any additions34* to or modifications of the Original Intel Code. No other license or right35* is granted directly or by implication, estoppel or otherwise;36*37* The above copyright and patent license is granted only if the following38* conditions are met:39*40* 3. Conditions41*42* 3.1. Redistribution of Source with Rights to Further Distribute Source.43* Redistribution of source code of any substantial portion of the Covered44* Code or modification with rights to further distribute source must include45* 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 to48* contain a file documenting the changes Licensee made to create that Covered49* Code and the date of any change. Licensee must include in that file the50* documentation of any changes made by any predecessor Licensee. Licensee51* 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 Covered56* Code or modification without rights to further distribute source must57* include the following Disclaimer and Export Compliance provision in the58* documentation and/or other materials provided with distribution. In59* addition, Licensee may not authorize further sublicense of source of any60* portion of the Covered Code, and must include terms to the effect that the61* license from Licensee to its licensee is limited to the intellectual62* property embodied in the software Licensee provides to its licensee, and63* not to intellectual property embodied in modifications its licensee may64* make.65*66* 3.3. Redistribution of Executable. Redistribution in executable form of any67* substantial portion of the Covered Code or modification must reproduce the68* above Copyright Notice, and the following Disclaimer and Export Compliance69* provision in the documentation and/or other materials provided with the70* distribution.71*72* 3.4. Intel retains all right, title, and interest in and to the Original73* Intel Code.74*75* 3.5. Neither the name Intel nor any other trademark owned or controlled by76* Intel shall be used in advertising or otherwise to promote the sale, use or77* other dealings in products derived from or relating to the Covered Code78* without prior written authorization from Intel.79*80* 4. Disclaimer and Export Compliance81*82* 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED83* HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE84* IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,85* INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY86* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY87* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A88* PARTICULAR PURPOSE.89*90* 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES91* OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR92* COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,93* SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY94* CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL95* HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS96* SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY97* LIMITED REMEDY.98*99* 4.3. Licensee shall not export, either directly or indirectly, any of this100* software or system incorporating such software without first obtaining any101* required license or other approval from the U. S. Department of Commerce or102* any other agency or department of the United States Government. In the103* event Licensee exports any such software from the United States or104* re-exports any such software from a foreign destination, Licensee shall105* ensure that the distribution and export/re-export of the software is in106* compliance with all laws, regulations, orders, or other restrictions of the107* U.S. Export Administration Regulations. Licensee agrees that neither it nor108* any of its subsidiaries will export/re-export any technical data, process,109* software, or service, directly or indirectly, to any country for which the110* United States government or any agency thereof requires an export license,111* other governmental approval, or letter of assurance, without first obtaining112* such license, approval or letter.113*114*****************************************************************************115*116* Alternatively, you may choose to be licensed under the terms of the117* following license:118*119* Redistribution and use in source and binary forms, with or without120* modification, are permitted provided that the following conditions121* are met:122* 1. Redistributions of source code must retain the above copyright123* notice, this list of conditions, and the following disclaimer,124* without modification.125* 2. Redistributions in binary form must reproduce at minimum a disclaimer126* substantially similar to the "NO WARRANTY" disclaimer below127* ("Disclaimer") and any redistribution must be conditioned upon128* including a substantially similar Disclaimer requirement for further129* binary redistribution.130* 3. Neither the names of the above-listed copyright holders nor the names131* of any contributors may be used to endorse or promote products derived132* from this software without specific prior written permission.133*134* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS135* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT136* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR137* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT138* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,139* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT140* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,141* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY142* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT143* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE144* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.145*146* Alternatively, you may choose to be licensed under the terms of the147* GNU General Public License ("GPL") version 2 as published by the Free148* Software Foundation.149*150*****************************************************************************/151152#include <contrib/dev/acpica/include/acpi.h>153#include <contrib/dev/acpica/include/accommon.h>154#include <contrib/dev/acpica/include/acparser.h>155#include <contrib/dev/acpica/include/amlcode.h>156#include <contrib/dev/acpica/include/acdispat.h>157#include <contrib/dev/acpica/include/acinterp.h>158#include <contrib/dev/acpica/include/acnamesp.h>159#include <contrib/dev/acpica/include/acdebug.h>160#if !defined(ACPI_DB_APP) && defined(ACPI_EXEC_APP)161#include "aecommon.h"162#endif163164#define _COMPONENT ACPI_DISPATCHER165ACPI_MODULE_NAME ("dswexec")166167/*168* Dispatch table for opcode classes169*/170static ACPI_EXECUTE_OP AcpiGbl_OpTypeDispatch [] =171{172AcpiExOpcode_0A_0T_1R,173AcpiExOpcode_1A_0T_0R,174AcpiExOpcode_1A_0T_1R,175NULL, /* Was: AcpiExOpcode_1A_0T_0R (Was for Load operator) */176AcpiExOpcode_1A_1T_1R,177AcpiExOpcode_2A_0T_0R,178AcpiExOpcode_2A_0T_1R,179AcpiExOpcode_2A_1T_1R,180AcpiExOpcode_2A_2T_1R,181AcpiExOpcode_3A_0T_0R,182AcpiExOpcode_3A_1T_1R,183AcpiExOpcode_6A_0T_1R184};185186187/*****************************************************************************188*189* FUNCTION: AcpiDsGetPredicateValue190*191* PARAMETERS: WalkState - Current state of the parse tree walk192* ResultObj - if non-zero, pop result from result stack193*194* RETURN: Status195*196* DESCRIPTION: Get the result of a predicate evaluation197*198****************************************************************************/199200ACPI_STATUS201AcpiDsGetPredicateValue (202ACPI_WALK_STATE *WalkState,203ACPI_OPERAND_OBJECT *ResultObj)204{205ACPI_STATUS Status = AE_OK;206ACPI_OPERAND_OBJECT *ObjDesc;207ACPI_OPERAND_OBJECT *LocalObjDesc = NULL;208209210ACPI_FUNCTION_TRACE_PTR (DsGetPredicateValue, WalkState);211212213WalkState->ControlState->Common.State = 0;214215if (ResultObj)216{217Status = AcpiDsResultPop (&ObjDesc, WalkState);218if (ACPI_FAILURE (Status))219{220ACPI_EXCEPTION ((AE_INFO, Status,221"Could not get result from predicate evaluation"));222223return_ACPI_STATUS (Status);224}225}226else227{228Status = AcpiDsCreateOperand (WalkState, WalkState->Op, 0);229if (ACPI_FAILURE (Status))230{231return_ACPI_STATUS (Status);232}233234Status = AcpiExResolveToValue (&WalkState->Operands [0], WalkState);235if (ACPI_FAILURE (Status))236{237return_ACPI_STATUS (Status);238}239240ObjDesc = WalkState->Operands [0];241}242243if (!ObjDesc)244{245ACPI_ERROR ((AE_INFO,246"No predicate ObjDesc=%p State=%p",247ObjDesc, WalkState));248249return_ACPI_STATUS (AE_AML_NO_OPERAND);250}251252/*253* Result of predicate evaluation must be an Integer254* object. Implicitly convert the argument if necessary.255*/256Status = AcpiExConvertToInteger (ObjDesc, &LocalObjDesc,257ACPI_IMPLICIT_CONVERSION);258if (ACPI_FAILURE (Status))259{260goto Cleanup;261}262263if (LocalObjDesc->Common.Type != ACPI_TYPE_INTEGER)264{265ACPI_ERROR ((AE_INFO,266"Bad predicate (not an integer) ObjDesc=%p State=%p Type=0x%X",267ObjDesc, WalkState, ObjDesc->Common.Type));268269Status = AE_AML_OPERAND_TYPE;270goto Cleanup;271}272273/* Truncate the predicate to 32-bits if necessary */274275(void) AcpiExTruncateFor32bitTable (LocalObjDesc);276277/*278* Save the result of the predicate evaluation on279* the control stack280*/281if (LocalObjDesc->Integer.Value)282{283WalkState->ControlState->Common.Value = TRUE;284}285else286{287/*288* Predicate is FALSE, we will just toss the289* rest of the package290*/291WalkState->ControlState->Common.Value = FALSE;292Status = AE_CTRL_FALSE;293}294295/* Predicate can be used for an implicit return value */296297(void) AcpiDsDoImplicitReturn (LocalObjDesc, WalkState, TRUE);298299300Cleanup:301302ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,303"Completed a predicate eval=%X Op=%p\n",304WalkState->ControlState->Common.Value, WalkState->Op));305306/* Break to debugger to display result */307308AcpiDbDisplayResultObject (LocalObjDesc, WalkState);309310/*311* Delete the predicate result object (we know that312* we don't need it anymore)313*/314if (LocalObjDesc != ObjDesc)315{316AcpiUtRemoveReference (LocalObjDesc);317}318AcpiUtRemoveReference (ObjDesc);319320WalkState->ControlState->Common.State = ACPI_CONTROL_NORMAL;321return_ACPI_STATUS (Status);322}323324325/*****************************************************************************326*327* FUNCTION: AcpiDsExecBeginOp328*329* PARAMETERS: WalkState - Current state of the parse tree walk330* OutOp - Where to return op if a new one is created331*332* RETURN: Status333*334* DESCRIPTION: Descending callback used during the execution of control335* methods. This is where most operators and operands are336* dispatched to the interpreter.337*338****************************************************************************/339340ACPI_STATUS341AcpiDsExecBeginOp (342ACPI_WALK_STATE *WalkState,343ACPI_PARSE_OBJECT **OutOp)344{345ACPI_PARSE_OBJECT *Op;346ACPI_STATUS Status = AE_OK;347UINT32 OpcodeClass;348349350ACPI_FUNCTION_TRACE_PTR (DsExecBeginOp, WalkState);351352353Op = WalkState->Op;354if (!Op)355{356Status = AcpiDsLoad2BeginOp (WalkState, OutOp);357if (ACPI_FAILURE (Status))358{359goto ErrorExit;360}361362Op = *OutOp;363WalkState->Op = Op;364WalkState->Opcode = Op->Common.AmlOpcode;365WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);366367if (AcpiNsOpensScope (WalkState->OpInfo->ObjectType))368{369ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,370"(%s) Popping scope for Op %p\n",371AcpiUtGetTypeName (WalkState->OpInfo->ObjectType), Op));372373Status = AcpiDsScopeStackPop (WalkState);374if (ACPI_FAILURE (Status))375{376goto ErrorExit;377}378}379}380381if (Op == WalkState->Origin)382{383if (OutOp)384{385*OutOp = Op;386}387388return_ACPI_STATUS (AE_OK);389}390391/*392* If the previous opcode was a conditional, this opcode393* must be the beginning of the associated predicate.394* Save this knowledge in the current scope descriptor395*/396if ((WalkState->ControlState) &&397(WalkState->ControlState->Common.State ==398ACPI_CONTROL_CONDITIONAL_EXECUTING))399{400ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,401"Exec predicate Op=%p State=%p\n",402Op, WalkState));403404WalkState->ControlState->Common.State =405ACPI_CONTROL_PREDICATE_EXECUTING;406407/* Save start of predicate */408409WalkState->ControlState->Control.PredicateOp = Op;410}411412413OpcodeClass = WalkState->OpInfo->Class;414415/* We want to send namepaths to the load code */416417if (Op->Common.AmlOpcode == AML_INT_NAMEPATH_OP)418{419OpcodeClass = AML_CLASS_NAMED_OBJECT;420}421422/*423* Handle the opcode based upon the opcode type424*/425switch (OpcodeClass)426{427case AML_CLASS_CONTROL:428429Status = AcpiDsExecBeginControlOp (WalkState, Op);430break;431432case AML_CLASS_NAMED_OBJECT:433434if (WalkState->WalkType & ACPI_WALK_METHOD)435{436/*437* Found a named object declaration during method execution;438* we must enter this object into the namespace. The created439* object is temporary and will be deleted upon completion of440* the execution of this method.441*442* Note 10/2010: Except for the Scope() op. This opcode does443* not actually create a new object, it refers to an existing444* object. However, for Scope(), we want to indeed open a445* new scope.446*/447if (Op->Common.AmlOpcode != AML_SCOPE_OP)448{449Status = AcpiDsLoad2BeginOp (WalkState, NULL);450}451else452{453Status = AcpiDsScopeStackPush (454Op->Named.Node, Op->Named.Node->Type, WalkState);455if (ACPI_FAILURE (Status))456{457return_ACPI_STATUS (Status);458}459}460}461break;462463case AML_CLASS_EXECUTE:464case AML_CLASS_CREATE:465466break;467468default:469470break;471}472473/* Nothing to do here during method execution */474475return_ACPI_STATUS (Status);476477478ErrorExit:479Status = AcpiDsMethodError (Status, WalkState);480return_ACPI_STATUS (Status);481}482483484/*****************************************************************************485*486* FUNCTION: AcpiDsExecEndOp487*488* PARAMETERS: WalkState - Current state of the parse tree walk489*490* RETURN: Status491*492* DESCRIPTION: Ascending callback used during the execution of control493* methods. The only thing we really need to do here is to494* notice the beginning of IF, ELSE, and WHILE blocks.495*496****************************************************************************/497498ACPI_STATUS499AcpiDsExecEndOp (500ACPI_WALK_STATE *WalkState)501{502ACPI_PARSE_OBJECT *Op;503ACPI_STATUS Status = AE_OK;504UINT32 OpType;505UINT32 OpClass;506ACPI_PARSE_OBJECT *NextOp;507ACPI_PARSE_OBJECT *FirstArg;508#if !defined(ACPI_DB_APP) && defined(ACPI_EXEC_APP)509char *Namepath;510ACPI_OPERAND_OBJECT *ObjDesc;511#endif512513ACPI_FUNCTION_TRACE_PTR (DsExecEndOp, WalkState);514515516Op = WalkState->Op;517OpType = WalkState->OpInfo->Type;518OpClass = WalkState->OpInfo->Class;519520if (OpClass == AML_CLASS_UNKNOWN)521{522ACPI_ERROR ((AE_INFO, "Unknown opcode 0x%X", Op->Common.AmlOpcode));523return_ACPI_STATUS (AE_NOT_IMPLEMENTED);524}525526FirstArg = Op->Common.Value.Arg;527528/* Init the walk state */529530WalkState->NumOperands = 0;531WalkState->OperandIndex = 0;532WalkState->ReturnDesc = NULL;533WalkState->ResultObj = NULL;534535/* Call debugger for single step support (DEBUG build only) */536537Status = AcpiDbSingleStep (WalkState, Op, OpClass);538if (ACPI_FAILURE (Status))539{540return_ACPI_STATUS (Status);541}542543/* Decode the Opcode Class */544545switch (OpClass)546{547case AML_CLASS_ARGUMENT: /* Constants, literals, etc. */548549if (WalkState->Opcode == AML_INT_NAMEPATH_OP)550{551Status = AcpiDsEvaluateNamePath (WalkState);552if (ACPI_FAILURE (Status))553{554goto Cleanup;555}556}557break;558559case AML_CLASS_EXECUTE: /* Most operators with arguments */560561/* Build resolved operand stack */562563Status = AcpiDsCreateOperands (WalkState, FirstArg);564if (ACPI_FAILURE (Status))565{566goto Cleanup;567}568569/*570* All opcodes require operand resolution, with the only exceptions571* being the ObjectType and SizeOf operators as well as opcodes that572* take no arguments.573*/574if (!(WalkState->OpInfo->Flags & AML_NO_OPERAND_RESOLVE) &&575(WalkState->OpInfo->Flags & AML_HAS_ARGS))576{577/* Resolve all operands */578579Status = AcpiExResolveOperands (WalkState->Opcode,580&(WalkState->Operands [WalkState->NumOperands -1]),581WalkState);582}583584if (ACPI_SUCCESS (Status))585{586/*587* Dispatch the request to the appropriate interpreter handler588* routine. There is one routine per opcode "type" based upon the589* number of opcode arguments and return type.590*/591Status = AcpiGbl_OpTypeDispatch[OpType] (WalkState);592}593else594{595/*596* Treat constructs of the form "Store(LocalX,LocalX)" as noops when the597* Local is uninitialized.598*/599if ((Status == AE_AML_UNINITIALIZED_LOCAL) &&600(WalkState->Opcode == AML_STORE_OP) &&601(WalkState->Operands[0]->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) &&602(WalkState->Operands[1]->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) &&603(WalkState->Operands[0]->Reference.Class ==604WalkState->Operands[1]->Reference.Class) &&605(WalkState->Operands[0]->Reference.Value ==606WalkState->Operands[1]->Reference.Value))607{608Status = AE_OK;609}610else611{612ACPI_EXCEPTION ((AE_INFO, Status,613"While resolving operands for [%s]",614AcpiPsGetOpcodeName (WalkState->Opcode)));615}616}617618/* Always delete the argument objects and clear the operand stack */619620AcpiDsClearOperands (WalkState);621622/*623* If a result object was returned from above, push it on the624* current result stack625*/626if (ACPI_SUCCESS (Status) &&627WalkState->ResultObj)628{629Status = AcpiDsResultPush (WalkState->ResultObj, WalkState);630}631break;632633default:634635switch (OpType)636{637case AML_TYPE_CONTROL: /* Type 1 opcode, IF/ELSE/WHILE/NOOP */638639/* 1 Operand, 0 ExternalResult, 0 InternalResult */640641Status = AcpiDsExecEndControlOp (WalkState, Op);642643break;644645case AML_TYPE_METHOD_CALL:646/*647* If the method is referenced from within a package648* declaration, it is not a invocation of the method, just649* a reference to it.650*/651if ((Op->Asl.Parent) &&652((Op->Asl.Parent->Asl.AmlOpcode == AML_PACKAGE_OP) ||653(Op->Asl.Parent->Asl.AmlOpcode == AML_VARIABLE_PACKAGE_OP)))654{655ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,656"Method Reference in a Package, Op=%p\n", Op));657658Op->Common.Node = (ACPI_NAMESPACE_NODE *)659Op->Asl.Value.Arg->Asl.Node;660AcpiUtAddReference (Op->Asl.Value.Arg->Asl.Node->Object);661return_ACPI_STATUS (AE_OK);662}663664ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,665"Method invocation, Op=%p\n", Op));666667/*668* (AML_METHODCALL) Op->Asl.Value.Arg->Asl.Node contains669* the method Node pointer670*/671/* NextOp points to the op that holds the method name */672673NextOp = FirstArg;674675/* NextOp points to first argument op */676677NextOp = NextOp->Common.Next;678679/*680* Get the method's arguments and put them on the operand stack681*/682Status = AcpiDsCreateOperands (WalkState, NextOp);683if (ACPI_FAILURE (Status))684{685break;686}687688/*689* Since the operands will be passed to another control method,690* we must resolve all local references here (Local variables,691* arguments to *this* method, etc.)692*/693Status = AcpiDsResolveOperands (WalkState);694if (ACPI_FAILURE (Status))695{696/* On error, clear all resolved operands */697698AcpiDsClearOperands (WalkState);699break;700}701702/*703* Tell the walk loop to preempt this running method and704* execute the new method705*/706Status = AE_CTRL_TRANSFER;707708/*709* Return now; we don't want to disturb anything,710* especially the operand count!711*/712return_ACPI_STATUS (Status);713714case AML_TYPE_CREATE_FIELD:715716ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,717"Executing CreateField Buffer/Index Op=%p\n", Op));718719Status = AcpiDsLoad2EndOp (WalkState);720if (ACPI_FAILURE (Status))721{722break;723}724725Status = AcpiDsEvalBufferFieldOperands (WalkState, Op);726if (ACPI_FAILURE (Status))727{728break;729}730731#if !defined(ACPI_DB_APP) && defined(ACPI_EXEC_APP)732/*733* AcpiExec support for namespace initialization file (initialize734* BufferFields in this code.)735*/736Namepath = AcpiNsGetExternalPathname (Op->Common.Node);737Status = AeLookupInitFileEntry (Namepath, &ObjDesc);738if (ACPI_SUCCESS (Status))739{740Status = AcpiExWriteDataToField (ObjDesc, Op->Common.Node->Object, NULL);741if (ACPI_FAILURE (Status))742{743ACPI_EXCEPTION ((AE_INFO, Status, "While writing to buffer field"));744}745}746ACPI_FREE (Namepath);747Status = AE_OK;748#endif749break;750751752case AML_TYPE_CREATE_OBJECT:753754ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,755"Executing CreateObject (Buffer/Package) Op=%p Child=%p ParentOpcode=%4.4X\n",756Op, Op->Named.Value.Arg, Op->Common.Parent->Common.AmlOpcode));757758switch (Op->Common.Parent->Common.AmlOpcode)759{760case AML_NAME_OP:761/*762* Put the Node on the object stack (Contains the ACPI Name763* of this object)764*/765WalkState->Operands[0] = (void *)766Op->Common.Parent->Common.Node;767WalkState->NumOperands = 1;768769Status = AcpiDsCreateNode (WalkState,770Op->Common.Parent->Common.Node, Op->Common.Parent);771if (ACPI_FAILURE (Status))772{773break;774}775776ACPI_FALLTHROUGH;777778case AML_INT_EVAL_SUBTREE_OP:779780Status = AcpiDsEvalDataObjectOperands (WalkState, Op,781AcpiNsGetAttachedObject (Op->Common.Parent->Common.Node));782break;783784default:785786Status = AcpiDsEvalDataObjectOperands (WalkState, Op, NULL);787break;788}789790/*791* If a result object was returned from above, push it on the792* current result stack793*/794if (WalkState->ResultObj)795{796Status = AcpiDsResultPush (WalkState->ResultObj, WalkState);797}798break;799800case AML_TYPE_NAMED_FIELD:801case AML_TYPE_NAMED_COMPLEX:802case AML_TYPE_NAMED_SIMPLE:803case AML_TYPE_NAMED_NO_OBJ:804805Status = AcpiDsLoad2EndOp (WalkState);806if (ACPI_FAILURE (Status))807{808break;809}810811if (Op->Common.AmlOpcode == AML_REGION_OP)812{813ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,814"Executing OpRegion Address/Length Op=%p\n", Op));815816Status = AcpiDsEvalRegionOperands (WalkState, Op);817if (ACPI_FAILURE (Status))818{819break;820}821}822else if (Op->Common.AmlOpcode == AML_DATA_REGION_OP)823{824ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,825"Executing DataTableRegion Strings Op=%p\n", Op));826827Status = AcpiDsEvalTableRegionOperands (WalkState, Op);828if (ACPI_FAILURE (Status))829{830break;831}832}833else if (Op->Common.AmlOpcode == AML_BANK_FIELD_OP)834{835ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,836"Executing BankField Op=%p\n", Op));837838Status = AcpiDsEvalBankFieldOperands (WalkState, Op);839if (ACPI_FAILURE (Status))840{841break;842}843}844break;845846case AML_TYPE_UNDEFINED:847848ACPI_ERROR ((AE_INFO,849"Undefined opcode type Op=%p", Op));850return_ACPI_STATUS (AE_NOT_IMPLEMENTED);851852case AML_TYPE_BOGUS:853854ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,855"Internal opcode=%X type Op=%p\n",856WalkState->Opcode, Op));857break;858859default:860861ACPI_ERROR ((AE_INFO,862"Unimplemented opcode, class=0x%X "863"type=0x%X Opcode=0x%X Op=%p",864OpClass, OpType, Op->Common.AmlOpcode, Op));865866Status = AE_NOT_IMPLEMENTED;867break;868}869}870871/*872* ACPI 2.0 support for 64-bit integers: Truncate numeric873* result value if we are executing from a 32-bit ACPI table874*/875(void) AcpiExTruncateFor32bitTable (WalkState->ResultObj);876877/*878* Check if we just completed the evaluation of a879* conditional predicate880*/881if ((ACPI_SUCCESS (Status)) &&882(WalkState->ControlState) &&883(WalkState->ControlState->Common.State ==884ACPI_CONTROL_PREDICATE_EXECUTING) &&885(WalkState->ControlState->Control.PredicateOp == Op))886{887Status = AcpiDsGetPredicateValue (WalkState, WalkState->ResultObj);888WalkState->ResultObj = NULL;889}890891892Cleanup:893894if (WalkState->ResultObj)895{896/* Break to debugger to display result */897898AcpiDbDisplayResultObject (WalkState->ResultObj,WalkState);899900/*901* Delete the result op if and only if:902* Parent will not use the result -- such as any903* non-nested type2 op in a method (parent will be method)904*/905AcpiDsDeleteResultIfNotUsed (Op, WalkState->ResultObj, WalkState);906}907908#ifdef _UNDER_DEVELOPMENT909910if (WalkState->ParserState.Aml == WalkState->ParserState.AmlEnd)911{912AcpiDbMethodEnd (WalkState);913}914#endif915916/* Invoke exception handler on error */917918if (ACPI_FAILURE (Status))919{920Status = AcpiDsMethodError (Status, WalkState);921}922923/* Always clear the object stack */924925WalkState->NumOperands = 0;926return_ACPI_STATUS (Status);927}928929930