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

📄 dsutils.c

📁 acpi tools for linux include acpiexec and acpixtract
💻 C
📖 第 1 页 / 共 3 页
字号:
        case AML_WHILE_OP:            /*             * If we are executing the predicate AND this is the predicate op,             * we will use the return value             */            if ((WalkState->ControlState->Common.State == ACPI_CONTROL_PREDICATE_EXECUTING) &&                (WalkState->ControlState->Control.PredicateOp == Op))            {                goto ResultUsed;            }            break;        default:            /* Ignore other control opcodes */            break;        }        /* The general control opcode returns no result */        goto ResultNotUsed;    case AML_CLASS_CREATE:        /*         * These opcodes allow TermArg(s) as operands and therefore         * the operands can be method calls.  The result is used.         */        goto ResultUsed;    case AML_CLASS_NAMED_OBJECT:        if ((Op->Common.Parent->Common.AmlOpcode == AML_REGION_OP)       ||            (Op->Common.Parent->Common.AmlOpcode == AML_DATA_REGION_OP)  ||            (Op->Common.Parent->Common.AmlOpcode == AML_PACKAGE_OP)      ||            (Op->Common.Parent->Common.AmlOpcode == AML_VAR_PACKAGE_OP)  ||            (Op->Common.Parent->Common.AmlOpcode == AML_BUFFER_OP)       ||            (Op->Common.Parent->Common.AmlOpcode == AML_INT_EVAL_SUBTREE_OP) ||            (Op->Common.Parent->Common.AmlOpcode == AML_BANK_FIELD_OP))        {            /*             * These opcodes allow TermArg(s) as operands and therefore             * the operands can be method calls.  The result is used.             */            goto ResultUsed;        }        goto ResultNotUsed;    default:        /*         * In all other cases. the parent will actually use the return         * object, so keep it.         */        goto ResultUsed;    }ResultUsed:    ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,        "Result of [%s] used by Parent [%s] Op=%p\n",        AcpiPsGetOpcodeName (Op->Common.AmlOpcode),        AcpiPsGetOpcodeName (Op->Common.Parent->Common.AmlOpcode), Op));    return_UINT8 (TRUE);ResultNotUsed:    ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,        "Result of [%s] not used by Parent [%s] Op=%p\n",        AcpiPsGetOpcodeName (Op->Common.AmlOpcode),        AcpiPsGetOpcodeName (Op->Common.Parent->Common.AmlOpcode), Op));    return_UINT8 (FALSE);}/******************************************************************************* * * FUNCTION:    AcpiDsDeleteResultIfNotUsed * * PARAMETERS:  Op              - Current parse Op *              ResultObj       - Result of the operation *              WalkState       - Current state * * RETURN:      Status * * DESCRIPTION: Used after interpretation of an opcode.  If there is an internal *              result descriptor, check if the parent opcode will actually use *              this result.  If not, delete the result now so that it will *              not become orphaned. * ******************************************************************************/voidAcpiDsDeleteResultIfNotUsed (    ACPI_PARSE_OBJECT       *Op,    ACPI_OPERAND_OBJECT     *ResultObj,    ACPI_WALK_STATE         *WalkState){    ACPI_OPERAND_OBJECT     *ObjDesc;    ACPI_STATUS             Status;    ACPI_FUNCTION_TRACE_PTR (DsDeleteResultIfNotUsed, ResultObj);    if (!Op)    {        ACPI_ERROR ((AE_INFO, "Null Op"));        return_VOID;    }    if (!ResultObj)    {        return_VOID;    }    if (!AcpiDsIsResultUsed (Op, WalkState))    {        /* Must pop the result stack (ObjDesc should be equal to ResultObj) */        Status = AcpiDsResultPop (&ObjDesc, WalkState);        if (ACPI_SUCCESS (Status))        {            AcpiUtRemoveReference (ResultObj);        }    }    return_VOID;}/******************************************************************************* * * FUNCTION:    AcpiDsResolveOperands * * PARAMETERS:  WalkState           - Current walk state with operands on stack * * RETURN:      Status * * DESCRIPTION: Resolve all operands to their values.  Used to prepare *              arguments to a control method invocation (a call from one *              method to another.) * ******************************************************************************/ACPI_STATUSAcpiDsResolveOperands (    ACPI_WALK_STATE         *WalkState){    UINT32                  i;    ACPI_STATUS             Status = AE_OK;    ACPI_FUNCTION_TRACE_PTR (DsResolveOperands, WalkState);    /*     * Attempt to resolve each of the valid operands     * Method arguments are passed by reference, not by value.  This means     * that the actual objects are passed, not copies of the objects.     */    for (i = 0; i < WalkState->NumOperands; i++)    {        Status = AcpiExResolveToValue (&WalkState->Operands[i], WalkState);        if (ACPI_FAILURE (Status))        {            break;        }    }    return_ACPI_STATUS (Status);}/******************************************************************************* * * FUNCTION:    AcpiDsClearOperands * * PARAMETERS:  WalkState           - Current walk state with operands on stack * * RETURN:      None * * DESCRIPTION: Clear all operands on the current walk state operand stack. * ******************************************************************************/voidAcpiDsClearOperands (    ACPI_WALK_STATE         *WalkState){    UINT32                  i;    ACPI_FUNCTION_TRACE_PTR (DsClearOperands, WalkState);    /* Remove a reference on each operand on the stack */    for (i = 0; i < WalkState->NumOperands; i++)    {        /*         * Remove a reference to all operands, including both         * "Arguments" and "Targets".         */        AcpiUtRemoveReference (WalkState->Operands[i]);        WalkState->Operands[i] = NULL;    }    WalkState->NumOperands = 0;    return_VOID;}#endif/******************************************************************************* * * FUNCTION:    AcpiDsCreateOperand * * PARAMETERS:  WalkState       - Current walk state *              Arg             - Parse object for the argument *              ArgIndex        - Which argument (zero based) * * RETURN:      Status * * DESCRIPTION: Translate a parse tree object that is an argument to an AML *              opcode to the equivalent interpreter object.  This may include *              looking up a name or entering a new name into the internal *              namespace. * ******************************************************************************/ACPI_STATUSAcpiDsCreateOperand (    ACPI_WALK_STATE         *WalkState,    ACPI_PARSE_OBJECT       *Arg,    UINT32                  ArgIndex){    ACPI_STATUS             Status = AE_OK;    char                    *NameString;    UINT32                  NameLength;    ACPI_OPERAND_OBJECT     *ObjDesc;    ACPI_PARSE_OBJECT       *ParentOp;    UINT16                  Opcode;    ACPI_INTERPRETER_MODE   InterpreterMode;    const ACPI_OPCODE_INFO  *OpInfo;    ACPI_FUNCTION_TRACE_PTR (DsCreateOperand, Arg);    /* A valid name must be looked up in the namespace */    if ((Arg->Common.AmlOpcode == AML_INT_NAMEPATH_OP) &&        (Arg->Common.Value.String) &&        !(Arg->Common.Flags & ACPI_PARSEOP_IN_STACK))    {        ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Getting a name: Arg=%p\n", Arg));        /* Get the entire name string from the AML stream */        Status = AcpiExGetNameString (ACPI_TYPE_ANY, Arg->Common.Value.Buffer,                        &NameString, &NameLength);        if (ACPI_FAILURE (Status))        {            return_ACPI_STATUS (Status);        }        /* All prefixes have been handled, and the name is in NameString */        /*         * Special handling for BufferField declarations.  This is a deferred         * opcode that unfortunately defines the field name as the last         * parameter instead of the first.  We get here when we are performing         * the deferred execution, so the actual name of the field is already         * in the namespace.  We don't want to attempt to look it up again         * because we may be executing in a different scope than where the         * actual opcode exists.         */        if ((WalkState->DeferredNode) &&            (WalkState->DeferredNode->Type == ACPI_TYPE_BUFFER_FIELD) &&            (ArgIndex == (UINT32) ((WalkState->Opcode == AML_CREATE_FIELD_OP) ? 3 : 2)))        {            ObjDesc = ACPI_CAST_PTR (                        ACPI_OPERAND_OBJECT, WalkState->DeferredNode);            Status = AE_OK;        }        else    /* All other opcodes */        {            /*             * Differentiate between a namespace "create" operation             * versus a "lookup" operation (IMODE_LOAD_PASS2 vs.             * IMODE_EXECUTE) in order to support the creation of             * namespace objects during the execution of control methods.             */            ParentOp = Arg->Common.Parent;            OpInfo = AcpiPsGetOpcodeInfo (ParentOp->Common.AmlOpcode);            if ((OpInfo->Flags & AML_NSNODE) &&                (ParentOp->Common.AmlOpcode != AML_INT_METHODCALL_OP) &&                (ParentOp->Common.AmlOpcode != AML_REGION_OP) &&                (ParentOp->Common.AmlOpcode != AML_INT_NAMEPATH_OP))            {                /* Enter name into namespace if not found */                InterpreterMode = ACPI_IMODE_LOAD_PASS2;            }            else            {                /* Return a failure if name not found */                InterpreterMode = ACPI_IMODE_EXECUTE;            }            Status = AcpiNsLookup (WalkState->ScopeInfo, NameString,                        ACPI_TYPE_ANY, InterpreterMode,                        ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,                        WalkState,                        ACPI_CAST_INDIRECT_PTR (ACPI_NAMESPACE_NODE, &ObjDesc));            /*             * The only case where we pass through (ignore) a NOT_FOUND             * error is for the CondRefOf opcode.             */            if (Status == AE_NOT_FOUND)            {                if (ParentOp->Common.AmlOpcode == AML_COND_REF_OF_OP)                {                    /*                     * For the Conditional Reference op, it's OK if                     * the name is not found;  We just need a way to                     * indicate this to the interpreter, set the                     * object to the root

⌨️ 快捷键说明

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