⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dsopcode.c

📁 acpi tools for linux include acpiexec and acpixtract
💻 C
📖 第 1 页 / 共 4 页
字号:
    ACPI_FUNCTION_TRACE_PTR (DsEvalBankFieldOperands, Op);    /*     * This is where we evaluate the BankValue field of the     * BankField declaration     */    /* NextOp points to the op that holds the Region */    NextOp = Op->Common.Value.Arg;    /* NextOp points to the op that holds the Bank Register */    NextOp = NextOp->Common.Next;    /* NextOp points to the op that holds the Bank Value */    NextOp = NextOp->Common.Next;    /*     * Set proper index into operand stack for AcpiDsObjStackPush     * invoked inside AcpiDsCreateOperand.     *     * We use WalkState->Operands[0] to store the evaluated BankValue     */    WalkState->OperandIndex = 0;    Status = AcpiDsCreateOperand (WalkState, NextOp, 0);    if (ACPI_FAILURE (Status))    {        return_ACPI_STATUS (Status);    }    Status = AcpiExResolveToValue (&WalkState->Operands[0], WalkState);    if (ACPI_FAILURE (Status))    {        return_ACPI_STATUS (Status);    }    ACPI_DUMP_OPERANDS (ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE,                    AcpiPsGetOpcodeName (Op->Common.AmlOpcode),                    1, "after AcpiExResolveOperands");    /*     * Get the BankValue operand and save it     * (at Top of stack)     */    OperandDesc = WalkState->Operands[0];    /* Arg points to the start Bank Field */    Arg = AcpiPsGetArg (Op, 4);    while (Arg)    {        /* Ignore OFFSET and ACCESSAS terms here */        if (Arg->Common.AmlOpcode == AML_INT_NAMEDFIELD_OP)        {            Node = Arg->Common.Node;            ObjDesc = AcpiNsGetAttachedObject (Node);            if (!ObjDesc)            {                return_ACPI_STATUS (AE_NOT_EXIST);            }            ObjDesc->BankField.Value = (UINT32) OperandDesc->Integer.Value;        }        /* Move to next field in the list */        Arg = Arg->Common.Next;    }    AcpiUtRemoveReference (OperandDesc);    return_ACPI_STATUS (Status);}/******************************************************************************* * * FUNCTION:    AcpiDsExecBeginControlOp * * PARAMETERS:  WalkList        - The list that owns the walk stack *              Op              - The control Op * * RETURN:      Status * * DESCRIPTION: Handles all control ops encountered during control method *              execution. * ******************************************************************************/ACPI_STATUSAcpiDsExecBeginControlOp (    ACPI_WALK_STATE         *WalkState,    ACPI_PARSE_OBJECT       *Op){    ACPI_STATUS             Status = AE_OK;    ACPI_GENERIC_STATE      *ControlState;    ACPI_FUNCTION_NAME (DsExecBeginControlOp);    ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p Opcode=%2.2X State=%p\n", Op,        Op->Common.AmlOpcode, WalkState));    switch (Op->Common.AmlOpcode)    {    case AML_IF_OP:    case AML_WHILE_OP:        /*         * IF/WHILE: Create a new control state to manage these         * constructs. We need to manage these as a stack, in order         * to handle nesting.         */        ControlState = AcpiUtCreateControlState ();        if (!ControlState)        {            Status = AE_NO_MEMORY;            break;        }        /*         * Save a pointer to the predicate for multiple executions         * of a loop         */        ControlState->Control.AmlPredicateStart = WalkState->ParserState.Aml - 1;        ControlState->Control.PackageEnd = WalkState->ParserState.PkgEnd;        ControlState->Control.Opcode = Op->Common.AmlOpcode;        /* Push the control state on this walk's control stack */        AcpiUtPushGenericState (&WalkState->ControlState, ControlState);        break;    case AML_ELSE_OP:        /* Predicate is in the state object */        /* If predicate is true, the IF was executed, ignore ELSE part */        if (WalkState->LastPredicate)        {            Status = AE_CTRL_TRUE;        }        break;    case AML_RETURN_OP:        break;    default:        break;    }    return (Status);}/******************************************************************************* * * FUNCTION:    AcpiDsExecEndControlOp * * PARAMETERS:  WalkList        - The list that owns the walk stack *              Op              - The control Op * * RETURN:      Status * * DESCRIPTION: Handles all control ops encountered during control method *              execution. * ******************************************************************************/ACPI_STATUSAcpiDsExecEndControlOp (    ACPI_WALK_STATE         *WalkState,    ACPI_PARSE_OBJECT       *Op){    ACPI_STATUS             Status = AE_OK;    ACPI_GENERIC_STATE      *ControlState;    ACPI_FUNCTION_NAME (DsExecEndControlOp);    switch (Op->Common.AmlOpcode)    {    case AML_IF_OP:        ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[IF_OP] Op=%p\n", Op));        /*         * Save the result of the predicate in case there is an         * ELSE to come         */        WalkState->LastPredicate =            (BOOLEAN) WalkState->ControlState->Common.Value;        /*         * Pop the control state that was created at the start         * of the IF and free it         */        ControlState = AcpiUtPopGenericState (&WalkState->ControlState);        AcpiUtDeleteGenericState (ControlState);        break;    case AML_ELSE_OP:        break;    case AML_WHILE_OP:        ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[WHILE_OP] Op=%p\n", Op));        if (WalkState->ControlState->Common.Value)        {            /* Predicate was true, go back and evaluate it again! */            Status = AE_CTRL_PENDING;        }        ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,            "[WHILE_OP] termination! Op=%p\n",Op));        /* Pop this control state and free it */        ControlState = AcpiUtPopGenericState (&WalkState->ControlState);        WalkState->AmlLastWhile = ControlState->Control.AmlPredicateStart;        AcpiUtDeleteGenericState (ControlState);        break;    case AML_RETURN_OP:        ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,            "[RETURN_OP] Op=%p Arg=%p\n",Op, Op->Common.Value.Arg));        /*         * One optional operand -- the return value         * It can be either an immediate operand or a result that         * has been bubbled up the tree         */        if (Op->Common.Value.Arg)        {            /* Since we have a real Return(), delete any implicit return */            AcpiDsClearImplicitReturn (WalkState);            /* Return statement has an immediate operand */            Status = AcpiDsCreateOperands (WalkState, Op->Common.Value.Arg);            if (ACPI_FAILURE (Status))            {                return (Status);            }            /*             * If value being returned is a Reference (such as             * an arg or local), resolve it now because it may             * cease to exist at the end of the method.             */            Status = AcpiExResolveToValue (&WalkState->Operands [0], WalkState);            if (ACPI_FAILURE (Status))            {                return (Status);            }            /*             * Get the return value and save as the last result             * value.  This is the only place where WalkState->ReturnDesc             * is set to anything other than zero!             */            WalkState->ReturnDesc = WalkState->Operands[0];        }        else if (WalkState->ResultCount)        {            /* Since we have a real Return(), delete any implicit return */            AcpiDsClearImplicitReturn (WalkState);            /*             * The return value has come from a previous calculation.             *             * If value being returned is a Reference (such as             * an arg or local), resolve it now because it may             * cease to exist at the end of the method.             *             * Allow references created by the Index operator to return unchanged.             */            if ((ACPI_GET_DESCRIPTOR_TYPE (WalkState->Results->Results.ObjDesc[0]) == ACPI_DESC_TYPE_OPERAND) &&                (ACPI_GET_OBJECT_TYPE (WalkState->Results->Results.ObjDesc [0]) == ACPI_TYPE_LOCAL_REFERENCE) &&                ((WalkState->Results->Results.ObjDesc [0])->Reference.Opcode != AML_INDEX_OP))            {                Status = AcpiExResolveToValue (&WalkState->Results->Results.ObjDesc [0], WalkState);                if (ACPI_FAILURE (Status))                {                    return (Status);                }            }            WalkState->ReturnDesc = WalkState->Results->Results.ObjDesc [0];        }        else        {            /* No return operand */            if (WalkState->NumOperands)            {                AcpiUtRemoveReference (WalkState->Operands [0]);            }            WalkState->Operands [0]     = NULL;            WalkState->NumOperands      = 0;            WalkState->ReturnDesc       = NULL;        }        ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,            "Completed RETURN_OP State=%p, RetVal=%p\n",            WalkState, WalkState->ReturnDesc));        /* End the control method execution right now */        Status = AE_CTRL_TERMINATE;        break;    case AML_NOOP_OP:        /* Just do nothing! */        break;    case AML_BREAK_POINT_OP:        /* Call up to the OS service layer to handle this */        Status = AcpiOsSignal (ACPI_SIGNAL_BREAKPOINT, "Executed AML Breakpoint opcode");        /* If and when it returns, all done. */        break;    case AML_BREAK_OP:    case AML_CONTINUE_OP: /* ACPI 2.0 */        /* Pop and delete control states until we find a while */        while (WalkState->ControlState &&                (WalkState->ControlState->Control.Opcode != AML_WHILE_OP))        {            ControlState = AcpiUtPopGenericState (&WalkState->ControlState);            AcpiUtDeleteGenericState (ControlState);        }        /* No while found? */        if (!WalkState->ControlState)        {            return (AE_AML_NO_WHILE);        }        /* Was: WalkState->AmlLastWhile = WalkState->ControlState->Control.AmlPredicateStart; */        WalkState->AmlLastWhile = WalkState->ControlState->Control.PackageEnd;        /* Return status depending on opcode */        if (Op->Common.AmlOpcode == AML_BREAK_OP)        {            Status = AE_CTRL_BREAK;        }        else        {            Status = AE_CTRL_CONTINUE;        }        break;    default:        ACPI_ERROR ((AE_INFO, "Unknown control opcode=%X Op=%p",            Op->Common.AmlOpcode, Op));        Status = AE_AML_BAD_OPCODE;        break;    }    return (Status);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -