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

📄 dsutils.c

📁 acpi tools for linux include acpiexec and acpixtract
💻 C
📖 第 1 页 / 共 3 页
字号:
                     */                    ObjDesc = ACPI_CAST_PTR (                                ACPI_OPERAND_OBJECT, AcpiGbl_RootNode);                    Status = AE_OK;                }                else                {                    /*                     * We just plain didn't find it -- which is a                     * very serious error at this point                     */                    Status = AE_AML_NAME_NOT_FOUND;                }            }            if (ACPI_FAILURE (Status))            {                ACPI_ERROR_NAMESPACE (NameString, Status);            }        }        /* Free the namestring created above */        ACPI_FREE (NameString);        /* Check status from the lookup */        if (ACPI_FAILURE (Status))        {            return_ACPI_STATUS (Status);        }        /* Put the resulting object onto the current object stack */        Status = AcpiDsObjStackPush (ObjDesc, WalkState);        if (ACPI_FAILURE (Status))        {            return_ACPI_STATUS (Status);        }        ACPI_DEBUGGER_EXEC (AcpiDbDisplayArgumentObject (ObjDesc, WalkState));    }    else    {        /* Check for null name case */        if ((Arg->Common.AmlOpcode == AML_INT_NAMEPATH_OP) &&            !(Arg->Common.Flags & ACPI_PARSEOP_IN_STACK))        {            /*             * If the name is null, this means that this is an             * optional result parameter that was not specified             * in the original ASL.  Create a Zero Constant for a             * placeholder.  (Store to a constant is a Noop.)             */            Opcode = AML_ZERO_OP;       /* Has no arguments! */            ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,                "Null namepath: Arg=%p\n", Arg));        }        else        {            Opcode = Arg->Common.AmlOpcode;        }        /* Get the object type of the argument */        OpInfo = AcpiPsGetOpcodeInfo (Opcode);        if (OpInfo->ObjectType == ACPI_TYPE_INVALID)        {            return_ACPI_STATUS (AE_NOT_IMPLEMENTED);        }        if ((OpInfo->Flags & AML_HAS_RETVAL) || (Arg->Common.Flags & ACPI_PARSEOP_IN_STACK))        {            ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,                "Argument previously created, already stacked\n"));            ACPI_DEBUGGER_EXEC (AcpiDbDisplayArgumentObject (                WalkState->Operands [WalkState->NumOperands - 1], WalkState));            /*             * Use value that was already previously returned             * by the evaluation of this argument             */            Status = AcpiDsResultPop (&ObjDesc, WalkState);            if (ACPI_FAILURE (Status))            {                /*                 * Only error is underflow, and this indicates                 * a missing or null operand!                 */                ACPI_EXCEPTION ((AE_INFO, Status,                    "Missing or null operand"));                return_ACPI_STATUS (Status);            }        }        else        {            /* Create an ACPI_INTERNAL_OBJECT for the argument */            ObjDesc = AcpiUtCreateInternalObject (OpInfo->ObjectType);            if (!ObjDesc)            {                return_ACPI_STATUS (AE_NO_MEMORY);            }            /* Initialize the new object */            Status = AcpiDsInitObjectFromOp (                        WalkState, Arg, Opcode, &ObjDesc);            if (ACPI_FAILURE (Status))            {                AcpiUtDeleteObjectDesc (ObjDesc);                return_ACPI_STATUS (Status);            }        }        /* Put the operand object on the object stack */        Status = AcpiDsObjStackPush (ObjDesc, WalkState);        if (ACPI_FAILURE (Status))        {            return_ACPI_STATUS (Status);        }        ACPI_DEBUGGER_EXEC (AcpiDbDisplayArgumentObject (ObjDesc, WalkState));    }    return_ACPI_STATUS (AE_OK);}/******************************************************************************* * * FUNCTION:    AcpiDsCreateOperands * * PARAMETERS:  WalkState           - Current state *              FirstArg            - First argument of a parser argument tree * * RETURN:      Status * * DESCRIPTION: Convert an operator's arguments from a parse tree format to *              namespace objects and place those argument object on the object *              stack in preparation for evaluation by the interpreter. * ******************************************************************************/ACPI_STATUSAcpiDsCreateOperands (    ACPI_WALK_STATE         *WalkState,    ACPI_PARSE_OBJECT       *FirstArg){    ACPI_STATUS             Status = AE_OK;    ACPI_PARSE_OBJECT       *Arg;    ACPI_PARSE_OBJECT       *Arguments[ACPI_OBJ_NUM_OPERANDS];    UINT32                  ArgCount = 0;    UINT32                  Index = WalkState->NumOperands;    UINT32                  i;    ACPI_FUNCTION_TRACE_PTR (DsCreateOperands, FirstArg);    /* Get all arguments in the list */    Arg = FirstArg;    while (Arg)    {        if (Index >= ACPI_OBJ_NUM_OPERANDS)        {            return_ACPI_STATUS (AE_BAD_DATA);        }        Arguments[Index] = Arg;        WalkState->Operands [Index] = NULL;        /* Move on to next argument, if any */        Arg = Arg->Common.Next;        ArgCount++;        Index++;    }    Index--;    /* It is the appropriate order to get objects from the Result stack */    for (i = 0; i < ArgCount; i++)    {        Arg = Arguments[Index];        /* Force the filling of the operand stack in inverse order */        WalkState->OperandIndex = (UINT8) Index;        Status = AcpiDsCreateOperand (WalkState, Arg, Index);        if (ACPI_FAILURE (Status))        {            goto Cleanup;        }        Index--;        ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Arg #%d (%p) done, Arg1=%p\n",            Index, Arg, FirstArg));    }    return_ACPI_STATUS (Status);Cleanup:    /*     * We must undo everything done above; meaning that we must     * pop everything off of the operand stack and delete those     * objects     */    AcpiDsObjStackPopAndDelete (ArgCount, WalkState);    ACPI_EXCEPTION ((AE_INFO, Status, "While creating Arg %d", Index));    return_ACPI_STATUS (Status);}/***************************************************************************** * * FUNCTION:    AcpiDsEvaluateNamePath * * PARAMETERS:  WalkState       - Current state of the parse tree walk, *                                the opcode of current operation should be *                                AML_INT_NAMEPATH_OP * * RETURN:      Status * * DESCRIPTION: Translate the -NamePath- parse tree object to the equivalent *              interpreter object, convert it to value, if needed, duplicate *              it, if needed, and push it onto the current result stack. * ****************************************************************************/ACPI_STATUSAcpiDsEvaluateNamePath (    ACPI_WALK_STATE         *WalkState){    ACPI_STATUS             Status = AE_OK;    ACPI_PARSE_OBJECT       *Op = WalkState->Op;    ACPI_OPERAND_OBJECT     **Operand = &WalkState->Operands[0];    ACPI_OPERAND_OBJECT     *NewObjDesc;    UINT8                   Type;    ACPI_FUNCTION_TRACE_PTR (DsEvaluateNamePath, WalkState);    if (!Op->Common.Parent)    {        /* This happens after certain exception processing */        goto Exit;    }    if ((Op->Common.Parent->Common.AmlOpcode == AML_PACKAGE_OP) ||        (Op->Common.Parent->Common.AmlOpcode == AML_VAR_PACKAGE_OP) ||        (Op->Common.Parent->Common.AmlOpcode == AML_REF_OF_OP))    {        /* TBD: Should we specify this feature as a bit of OpInfo->Flags of these opcodes? */        goto Exit;    }    Status = AcpiDsCreateOperand (WalkState, Op, 0);    if (ACPI_FAILURE (Status))    {        goto Exit;    }    if (Op->Common.Flags & ACPI_PARSEOP_TARGET)    {        NewObjDesc = *Operand;        goto PushResult;    }    Type = ACPI_GET_OBJECT_TYPE (*Operand);    Status = AcpiExResolveToValue (Operand, WalkState);    if (ACPI_FAILURE (Status))    {        goto Exit;    }    if (Type == ACPI_TYPE_INTEGER)    {        /* It was incremented by AcpiExResolveToValue */        AcpiUtRemoveReference (*Operand);        Status = AcpiUtCopyIobjectToIobject (*Operand, &NewObjDesc, WalkState);        if (ACPI_FAILURE (Status))        {            goto Exit;        }    }    else    {        /*         * The object either was anew created or is         * a Namespace node - don't decrement it.         */        NewObjDesc = *Operand;    }    /* Cleanup for name-path operand */    Status = AcpiDsObjStackPop (1, WalkState);    if (ACPI_FAILURE (Status))    {        WalkState->ResultObj = NewObjDesc;        goto Exit;    }PushResult:    WalkState->ResultObj = NewObjDesc;    Status = AcpiDsResultPush (WalkState->ResultObj, WalkState);    if (ACPI_SUCCESS (Status))    {        /* Force to take it from stack */        Op->Common.Flags |= ACPI_PARSEOP_IN_STACK;    }Exit:    return_ACPI_STATUS (Status);}

⌨️ 快捷键说明

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