您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ AcpiPsGetOpcodeInfo函数代码示例

51自学网 2021-06-01 19:39:54
  C++
这篇教程C++ AcpiPsGetOpcodeInfo函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中AcpiPsGetOpcodeInfo函数的典型用法代码示例。如果您正苦于以下问题:C++ AcpiPsGetOpcodeInfo函数的具体用法?C++ AcpiPsGetOpcodeInfo怎么用?C++ AcpiPsGetOpcodeInfo使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了AcpiPsGetOpcodeInfo函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: AcpiPsGetArg

ACPI_PARSE_OBJECT *AcpiPsGetArg (    ACPI_PARSE_OBJECT       *Op,    UINT32                  Argn){    ACPI_PARSE_OBJECT       *Arg = NULL;    const ACPI_OPCODE_INFO  *OpInfo;    ACPI_FUNCTION_ENTRY ();/*    if (Op->Common.AmlOpcode == AML_INT_CONNECTION_OP)    {        return (Op->Common.Value.Arg);    }*/    /* Get the info structure for this opcode */    OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);    if (OpInfo->Class == AML_CLASS_UNKNOWN)    {        /* Invalid opcode or ASCII character */        return (NULL);    }    /* Check if this opcode requires argument sub-objects */    if (!(OpInfo->Flags & AML_HAS_ARGS))    {        /* Has no linked argument objects */        return (NULL);    }    /* Get the requested argument object */    Arg = Op->Common.Value.Arg;    while (Arg && Argn)    {        Argn--;        Arg = Arg->Common.Next;    }    return (Arg);}
开发者ID:victoredwardocallaghan,项目名称:DragonFlyBSD,代码行数:47,


示例2: AcpiDmListType

UINT32AcpiDmListType (    ACPI_PARSE_OBJECT       *Op){    const ACPI_OPCODE_INFO  *OpInfo;    if (!Op)    {        return (BLOCK_NONE);    }    switch (Op->Common.AmlOpcode)    {    case AML_ELSE_OP:    case AML_METHOD_OP:    case AML_DEVICE_OP:    case AML_SCOPE_OP:    case AML_POWER_RES_OP:    case AML_PROCESSOR_OP:    case AML_THERMAL_ZONE_OP:    case AML_IF_OP:    case AML_WHILE_OP:    case AML_FIELD_OP:    case AML_INDEX_FIELD_OP:    case AML_BANK_FIELD_OP:        return (BLOCK_NONE);    case AML_BUFFER_OP:    case AML_PACKAGE_OP:    case AML_VAR_PACKAGE_OP:        return (BLOCK_COMMA_LIST);    default:        OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);        if (OpInfo->Flags & AML_HAS_ARGS)        {            return (BLOCK_COMMA_LIST);        }        return (BLOCK_NONE);    }}
开发者ID:rebost,项目名称:freebsd,代码行数:47,


示例3: AcpiDmInspectPossibleArgs

static UINT32AcpiDmInspectPossibleArgs (    UINT32                  CurrentOpArgCount,    UINT32                  TargetCount,    ACPI_PARSE_OBJECT       *Op){    const ACPI_OPCODE_INFO  *OpInfo;    UINT32                  i;    UINT32                  Last = 0;    UINT32                  Lookahead;    Lookahead = (ACPI_METHOD_NUM_ARGS + TargetCount) - CurrentOpArgCount;    /* Lookahead for the maximum number of possible arguments */    for (i = 0; i < Lookahead; i++)    {        if (!Op)        {            break;        }        OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);        /*         * Any one of these operators is "very probably" not a method arg         */        if ((Op->Common.AmlOpcode == AML_STORE_OP) ||            (Op->Common.AmlOpcode == AML_NOTIFY_OP))        {            break;        }        if ((OpInfo->Class != AML_CLASS_EXECUTE) &&            (OpInfo->Class != AML_CLASS_CONTROL))        {            Last = i+1;        }        Op = Op->Common.Next;    }    return (Last);}
开发者ID:DangerDexter,项目名称:FreeBSD-8.0-dyntick,代码行数:45,


示例4: XfNamespaceLocateEnd

static ACPI_STATUSXfNamespaceLocateEnd (    ACPI_PARSE_OBJECT       *Op,    UINT32                  Level,    void                    *Context){    ACPI_WALK_STATE         *WalkState = (ACPI_WALK_STATE *) Context;    const ACPI_OPCODE_INFO  *OpInfo;    ACPI_FUNCTION_TRACE (XfNamespaceLocateEnd);    /* We are only interested in opcodes that have an associated name */    OpInfo = AcpiPsGetOpcodeInfo (Op->Asl.AmlOpcode);    if (!(OpInfo->Flags & AML_NAMED))    {        return_ACPI_STATUS (AE_OK);    }    /* Not interested in name references, we did not open a scope for them */    if ((Op->Asl.ParseOpcode == PARSEOP_NAMESTRING) ||        (Op->Asl.ParseOpcode == PARSEOP_NAMESEG)    ||        (Op->Asl.ParseOpcode == PARSEOP_METHODCALL) ||        (Op->Asl.ParseOpcode == PARSEOP_EXTERNAL))    {        return_ACPI_STATUS (AE_OK);    }    /* Pop the scope stack if necessary */    if (AcpiNsOpensScope (AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode)))    {        ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,            "%s: Popping scope for Op %p/n",            AcpiUtGetTypeName (OpInfo->ObjectType), Op));        (void) AcpiDsScopeStackPop (WalkState);    }    return_ACPI_STATUS (AE_OK);}
开发者ID:kusumi,项目名称:DragonFlyBSD,代码行数:45,


示例5: AcpiDbDumpParserDescriptor

voidAcpiDbDumpParserDescriptor (    ACPI_PARSE_OBJECT       *Op){    const ACPI_OPCODE_INFO  *Info;    Info = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);    AcpiOsPrintf ("Parser Op Descriptor:/n");    AcpiOsPrintf ("%20.20s : %4.4X/n", "Opcode", Op->Common.AmlOpcode);    ACPI_DEBUG_ONLY_MEMBERS (AcpiOsPrintf ("%20.20s : %s/n", "Opcode Name", Info->Name));    AcpiOsPrintf ("%20.20s : %p/n", "Value/ArgList", Op->Common.Value.Arg);    AcpiOsPrintf ("%20.20s : %p/n", "Parent", Op->Common.Parent);    AcpiOsPrintf ("%20.20s : %p/n", "NextOp", Op->Common.Next);}
开发者ID:UnitedMarsupials,项目名称:kame,代码行数:18,


示例6: AcpiPsGetOpcodeName

char *AcpiPsGetOpcodeName (    UINT16                  Opcode){#if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUG_OUTPUT)    const ACPI_OPCODE_INFO  *Op;    Op = AcpiPsGetOpcodeInfo (Opcode);    /* Always guaranteed to return a valid pointer */    return (Op->Name);#else    return ("OpcodeName unavailable");#endif}
开发者ID:AgamAgarwal,项目名称:minix,代码行数:20,


示例7: LkGetNameOp

static ACPI_PARSE_OBJECT *LkGetNameOp (    ACPI_PARSE_OBJECT       *Op){    const ACPI_OPCODE_INFO  *OpInfo;    ACPI_PARSE_OBJECT       *NameOp = Op;    OpInfo = AcpiPsGetOpcodeInfo (Op->Asl.AmlOpcode);    /* Get the NamePath from the appropriate place */    if (OpInfo->Flags & AML_NAMED)    {        /* For nearly all NAMED operators, the name reference is the first child */        NameOp = Op->Asl.Child;        if (Op->Asl.AmlOpcode == AML_ALIAS_OP)        {            /*             * ALIAS is the only oddball opcode, the name declaration             * (alias name) is the second operand             */            NameOp = Op->Asl.Child->Asl.Next;        }    }    else if (OpInfo->Flags & AML_CREATE)    {        /* Name must appear as the last parameter */        NameOp = Op->Asl.Child;        while (!(NameOp->Asl.CompileFlags & NODE_IS_NAME_DECLARATION))        {            NameOp = NameOp->Asl.Next;        }    }    return (NameOp);}
开发者ID:eyberg,项目名称:rumpkernel-netbsd-src,代码行数:40,


示例8: MtCheckNamedObjectInMethod

static voidMtCheckNamedObjectInMethod (    ACPI_PARSE_OBJECT       *Op,    ASL_METHOD_INFO         *MethodInfo){    const ACPI_OPCODE_INFO  *OpInfo;    /* We don't care about actual method declarations or scopes */    if ((Op->Asl.AmlOpcode == AML_METHOD_OP) ||        (Op->Asl.AmlOpcode == AML_SCOPE_OP))    {        return;    }    /* Determine if we are creating a named object */    OpInfo = AcpiPsGetOpcodeInfo (Op->Asl.AmlOpcode);    if (OpInfo->Class == AML_CLASS_NAMED_OBJECT)    {        /*         * If we have a named object created within a non-serialized method,         * emit a remark that the method should be serialized.         *         * Reason: If a thread blocks within the method for any reason, and         * another thread enters the method, the method will fail because an         * attempt will be made to create the same object twice.         */        if (MethodInfo && !MethodInfo->ShouldBeSerialized)        {            AslError (ASL_REMARK, ASL_MSG_SERIALIZED_REQUIRED, MethodInfo->Op,                "due to creation of named objects within");            /* Emit message only ONCE per method */            MethodInfo->ShouldBeSerialized = TRUE;        }    }}
开发者ID:olsner,项目名称:acpica,代码行数:40,


示例9: AcpiDmResourceDescendingOp

static ACPI_STATUSAcpiDmResourceDescendingOp (    ACPI_PARSE_OBJECT       *Op,    UINT32                  Level,    void                    *Context){    ACPI_OP_WALK_INFO       *Info = Context;    const ACPI_OPCODE_INFO  *OpInfo;    ACPI_WALK_STATE         *WalkState;    ACPI_OBJECT_TYPE        ObjectType;    ACPI_STATUS             Status;    WalkState = Info->WalkState;    OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);    /* Open new scope if necessary */    ObjectType = OpInfo->ObjectType;    if (AcpiNsOpensScope (ObjectType))    {        if (Op->Common.Node)        {            Status = AcpiDsScopeStackPush (Op->Common.Node, ObjectType, WalkState);            if (ACPI_FAILURE (Status))            {                return (Status);            }        }    }    /*     * Check if this operator contains a reference to a resource descriptor.     * If so, convert the reference into a symbolic reference.     */    AcpiDmCheckResourceReference (Op, WalkState);    return (AE_OK);}
开发者ID:DangerDexter,项目名称:FreeBSD-8.0-dyntick,代码行数:39,


示例10: AcpiDmCommonAscendingOp

static ACPI_STATUSAcpiDmCommonAscendingOp (    ACPI_PARSE_OBJECT       *Op,    UINT32                  Level,    void                    *Context){    ACPI_OP_WALK_INFO       *Info = Context;    const ACPI_OPCODE_INFO  *OpInfo;    ACPI_OBJECT_TYPE        ObjectType;    /* Close scope if necessary */    OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);    ObjectType = OpInfo->ObjectType;    ObjectType = AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode);    if (AcpiNsOpensScope (ObjectType))    {        (void) AcpiDsScopeStackPop (Info->WalkState);    }    return (AE_OK);}
开发者ID:DangerDexter,项目名称:FreeBSD-8.0-dyntick,代码行数:24,


示例11: AcpiDsBuildInternalObject

ACPI_STATUSAcpiDsBuildInternalObject (    ACPI_WALK_STATE         *WalkState,    ACPI_PARSE_OBJECT       *Op,    ACPI_OPERAND_OBJECT     **ObjDescPtr){    ACPI_OPERAND_OBJECT     *ObjDesc;    ACPI_STATUS             Status;    ACPI_FUNCTION_TRACE (DsBuildInternalObject);    *ObjDescPtr = NULL;    if (Op->Common.AmlOpcode == AML_INT_NAMEPATH_OP)    {        /*         * This is a named object reference. If this name was         * previously looked up in the namespace, it was stored in         * this op. Otherwise, go ahead and look it up now         */        if (!Op->Common.Node)        {            /* Check if we are resolving a named reference within a package */            if ((Op->Common.Parent->Common.AmlOpcode == AML_PACKAGE_OP) ||                (Op->Common.Parent->Common.AmlOpcode == AML_VARIABLE_PACKAGE_OP))            {                /*                 * We won't resolve package elements here, we will do this                 * after all ACPI tables are loaded into the namespace. This                 * behavior supports both forward references to named objects                 * and external references to objects in other tables.                 */                goto CreateNewObject;            }            else            {                Status = AcpiNsLookup (WalkState->ScopeInfo,                    Op->Common.Value.String,                    ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,                    ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, NULL,                    ACPI_CAST_INDIRECT_PTR (                        ACPI_NAMESPACE_NODE, &(Op->Common.Node)));                if (ACPI_FAILURE (Status))                {                    ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo,                        Op->Common.Value.String, Status);                    return_ACPI_STATUS (Status);                }            }        }    }CreateNewObject:    /* Create and init a new internal ACPI object */    ObjDesc = AcpiUtCreateInternalObject (        (AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode))->ObjectType);    if (!ObjDesc)    {        return_ACPI_STATUS (AE_NO_MEMORY);    }    Status = AcpiDsInitObjectFromOp (        WalkState, Op, Op->Common.AmlOpcode, &ObjDesc);    if (ACPI_FAILURE (Status))    {        AcpiUtRemoveReference (ObjDesc);        return_ACPI_STATUS (Status);    }    /*     * Handling for unresolved package reference elements.     * These are elements that are namepaths.     */    if ((Op->Common.Parent->Common.AmlOpcode == AML_PACKAGE_OP) ||        (Op->Common.Parent->Common.AmlOpcode == AML_VARIABLE_PACKAGE_OP))    {        ObjDesc->Reference.Resolved = TRUE;        if ((Op->Common.AmlOpcode == AML_INT_NAMEPATH_OP) &&            !ObjDesc->Reference.Node)        {            /*             * Name was unresolved above.             * Get the prefix node for later lookup             */            ObjDesc->Reference.Node = WalkState->ScopeInfo->Scope.Node;            ObjDesc->Reference.Aml = Op->Common.Aml;            ObjDesc->Reference.Resolved = FALSE;        }    }    *ObjDescPtr = ObjDesc;    return_ACPI_STATUS (Status);}
开发者ID:2trill2spill,项目名称:freebsd,代码行数:98,


示例12: AcpiDmCheckResourceReference

voidAcpiDmCheckResourceReference (    ACPI_PARSE_OBJECT       *Op,    ACPI_WALK_STATE         *WalkState){    ACPI_STATUS             Status;    ACPI_PARSE_OBJECT       *BufferNameOp;    ACPI_PARSE_OBJECT       *IndexOp;    ACPI_NAMESPACE_NODE     *BufferNode;    ACPI_NAMESPACE_NODE     *ResourceNode;    const ACPI_OPCODE_INFO  *OpInfo;    UINT32                  BitIndex;    /* We are only interested in the CreateXxxxField opcodes */    OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);    if (OpInfo->Type != AML_TYPE_CREATE_FIELD)    {        return;    }    /* Get the buffer term operand */    BufferNameOp = AcpiPsGetDepthNext (NULL, Op);    /* Must be a named buffer, not an arg or local or method call */    if (BufferNameOp->Common.AmlOpcode != AML_INT_NAMEPATH_OP)    {        return;    }    /* Get the Index term, must be an integer constant to convert */    IndexOp = BufferNameOp->Common.Next;    /* Major cheat: The Node field is also used for the Tag ptr. Clear it now */    IndexOp->Common.Node = NULL;    OpInfo = AcpiPsGetOpcodeInfo (IndexOp->Common.AmlOpcode);    if (OpInfo->ObjectType != ACPI_TYPE_INTEGER)    {        return;    }    /* Get the bit offset of the descriptor within the buffer */    if ((Op->Common.AmlOpcode == AML_CREATE_BIT_FIELD_OP) ||        (Op->Common.AmlOpcode == AML_CREATE_FIELD_OP))    {        /* Index operand is a bit offset */        BitIndex = (UINT32) IndexOp->Common.Value.Integer;    }    else    {        /* Index operand is a byte offset, convert to bits */        BitIndex = (UINT32) ACPI_MUL_8 (IndexOp->Common.Value.Integer);    }    /* Lookup the buffer in the namespace */    Status = AcpiNsLookup (WalkState->ScopeInfo,        BufferNameOp->Common.Value.String, ACPI_TYPE_BUFFER,        ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, WalkState,        &BufferNode);    if (ACPI_FAILURE (Status))    {        return;    }    /* Validate object type, we must have a buffer */    if (BufferNode->Type != ACPI_TYPE_BUFFER)    {        return;    }    /* Find the resource descriptor node corresponding to the index */    ResourceNode = AcpiDmGetResourceNode (BufferNode, BitIndex);    if (!ResourceNode)    {        return;    }    /* Translate the Index to a resource tag pathname */    AcpiGetTagPathname (IndexOp, BufferNode, ResourceNode, BitIndex);}
开发者ID:Raphine,项目名称:Raph_Kernel,代码行数:93,


示例13: AcpiPsCompleteOp

static ACPI_STATUSAcpiPsCompleteOp (    ACPI_WALK_STATE         *WalkState,    ACPI_PARSE_OBJECT       **Op,    ACPI_STATUS             Status){    ACPI_STATUS             Status2;    ACPI_FUNCTION_TRACE_PTR (PsCompleteOp, WalkState);    /*     * Finished one argument of the containing scope     */    WalkState->ParserState.Scope->ParseScope.ArgCount--;    /* Close this Op (will result in parse subtree deletion) */    Status2 = AcpiPsCompleteThisOp (WalkState, *Op);    if (ACPI_FAILURE (Status2))    {        return_ACPI_STATUS (Status2);    }    *Op = NULL;    switch (Status)    {    case AE_OK:        break;    case AE_CTRL_TRANSFER:        /* We are about to transfer to a called method */        WalkState->PrevOp = NULL;        WalkState->PrevArgTypes = WalkState->ArgTypes;        return_ACPI_STATUS (Status);    case AE_CTRL_END:        AcpiPsPopScope (&(WalkState->ParserState), Op,            &WalkState->ArgTypes, &WalkState->ArgCount);        if (*Op)        {            WalkState->Op = *Op;            WalkState->OpInfo = AcpiPsGetOpcodeInfo ((*Op)->Common.AmlOpcode);            WalkState->Opcode = (*Op)->Common.AmlOpcode;            Status = WalkState->AscendingCallback (WalkState);            Status = AcpiPsNextParseState (WalkState, *Op, Status);            Status2 = AcpiPsCompleteThisOp (WalkState, *Op);            if (ACPI_FAILURE (Status2))            {                return_ACPI_STATUS (Status2);            }        }        Status = AE_OK;        break;    case AE_CTRL_BREAK:    case AE_CTRL_CONTINUE:        /* Pop off scopes until we find the While */        while (!(*Op) || ((*Op)->Common.AmlOpcode != AML_WHILE_OP))        {            AcpiPsPopScope (&(WalkState->ParserState), Op,                &WalkState->ArgTypes, &WalkState->ArgCount);        }        /* Close this iteration of the While loop */        WalkState->Op = *Op;        WalkState->OpInfo = AcpiPsGetOpcodeInfo ((*Op)->Common.AmlOpcode);        WalkState->Opcode = (*Op)->Common.AmlOpcode;        Status = WalkState->AscendingCallback (WalkState);        Status = AcpiPsNextParseState (WalkState, *Op, Status);        Status2 = AcpiPsCompleteThisOp (WalkState, *Op);        if (ACPI_FAILURE (Status2))        {            return_ACPI_STATUS (Status2);        }        Status = AE_OK;        break;    case AE_CTRL_TERMINATE:        /* Clean up *///.........这里部分代码省略.........
开发者ID:Jyang772,项目名称:XEOS,代码行数:101,


示例14: AcpiDbDisplayMethodInfo

voidAcpiDbDisplayMethodInfo (    ACPI_PARSE_OBJECT       *StartOp){    ACPI_WALK_STATE         *WalkState;    ACPI_OPERAND_OBJECT     *ObjDesc;    ACPI_NAMESPACE_NODE     *Node;    ACPI_PARSE_OBJECT       *RootOp;    ACPI_PARSE_OBJECT       *Op;    const ACPI_OPCODE_INFO  *OpInfo;    UINT32                  NumOps = 0;    UINT32                  NumOperands = 0;    UINT32                  NumOperators = 0;    UINT32                  NumRemainingOps = 0;    UINT32                  NumRemainingOperands = 0;    UINT32                  NumRemainingOperators = 0;    BOOLEAN                 CountRemaining = FALSE;    WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList);    if (!WalkState)    {        AcpiOsPrintf ("There is no method currently executing/n");        return;    }    ObjDesc = WalkState->MethodDesc;    Node    = WalkState->MethodNode;    AcpiOsPrintf ("Currently executing control method is [%4.4s]/n",            AcpiUtGetNodeName (Node));    AcpiOsPrintf ("%X Arguments, SyncLevel = %X/n",            (UINT32) ObjDesc->Method.ParamCount,            (UINT32) ObjDesc->Method.SyncLevel);    RootOp = StartOp;    while (RootOp->Common.Parent)    {        RootOp = RootOp->Common.Parent;    }    Op = RootOp;    while (Op)    {        if (Op == StartOp)        {            CountRemaining = TRUE;        }        NumOps++;        if (CountRemaining)        {            NumRemainingOps++;        }        /* Decode the opcode */        OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);        switch (OpInfo->Class)        {        case AML_CLASS_ARGUMENT:            if (CountRemaining)            {                NumRemainingOperands++;            }            NumOperands++;            break;        case AML_CLASS_UNKNOWN:            /* Bad opcode or ASCII character */            continue;        default:            if (CountRemaining)            {                NumRemainingOperators++;            }            NumOperators++;            break;        }        Op = AcpiPsGetDepthNext (StartOp, Op);    }    AcpiOsPrintf (        "Method contains:       %X AML Opcodes - %X Operators, %X Operands/n",        NumOps, NumOperators, NumOperands);    AcpiOsPrintf (        "Remaining to execute:  %X AML Opcodes - %X Operators, %X Operands/n",        NumRemainingOps, NumRemainingOperators, NumRemainingOperands);}
开发者ID:iHaD,项目名称:DragonFlyBSD,代码行数:100,


示例15: AcpiPsCreateOp

static ACPI_STATUSAcpiPsCreateOp (    ACPI_WALK_STATE         *WalkState,    UINT8                   *AmlOpStart,    ACPI_PARSE_OBJECT       **NewOp){    ACPI_STATUS             Status = AE_OK;    ACPI_PARSE_OBJECT       *Op;    ACPI_PARSE_OBJECT       *NamedOp = NULL;    ACPI_PARSE_OBJECT       *ParentScope;    UINT8                   ArgumentCount;    const ACPI_OPCODE_INFO  *OpInfo;    ACPI_FUNCTION_TRACE_PTR (PsCreateOp, WalkState);    Status = AcpiPsGetAmlOpcode (WalkState);    if (Status == AE_CTRL_PARSE_CONTINUE)    {        return_ACPI_STATUS (AE_CTRL_PARSE_CONTINUE);    }    /* Create Op structure and append to parent's argument list */    WalkState->OpInfo = AcpiPsGetOpcodeInfo (WalkState->Opcode);    Op = AcpiPsAllocOp (WalkState->Opcode);    if (!Op)    {        return_ACPI_STATUS (AE_NO_MEMORY);    }    if (WalkState->OpInfo->Flags & AML_NAMED)    {        Status = AcpiPsBuildNamedOp (WalkState, AmlOpStart, Op, &NamedOp);        AcpiPsFreeOp (Op);        if (ACPI_FAILURE (Status))        {            return_ACPI_STATUS (Status);        }        *NewOp = NamedOp;        return_ACPI_STATUS (AE_OK);    }    /* Not a named opcode, just allocate Op and append to parent */    if (WalkState->OpInfo->Flags & AML_CREATE)    {        /*         * Backup to beginning of CreateXXXfield declaration         * BodyLength is unknown until we parse the body         */        Op->Named.Data = AmlOpStart;        Op->Named.Length = 0;    }    if (WalkState->Opcode == AML_BANK_FIELD_OP)    {        /*         * Backup to beginning of BankField declaration         * BodyLength is unknown until we parse the body         */        Op->Named.Data = AmlOpStart;        Op->Named.Length = 0;    }    ParentScope = AcpiPsGetParentScope (&(WalkState->ParserState));    AcpiPsAppendArg (ParentScope, Op);    if (ParentScope)    {        OpInfo = AcpiPsGetOpcodeInfo (ParentScope->Common.AmlOpcode);        if (OpInfo->Flags & AML_HAS_TARGET)        {            ArgumentCount = AcpiPsGetArgumentCount (OpInfo->Type);            if (ParentScope->Common.ArgListLength > ArgumentCount)            {                Op->Common.Flags |= ACPI_PARSEOP_TARGET;            }        }        else if (ParentScope->Common.AmlOpcode == AML_INCREMENT_OP)        {            Op->Common.Flags |= ACPI_PARSEOP_TARGET;        }    }    if (WalkState->DescendingCallback != NULL)    {        /*         * Find the object. This will either insert the object into         * the namespace or simply look it up         */        WalkState->Op = *NewOp = Op;        Status = WalkState->DescendingCallback (WalkState, &Op);        Status = AcpiPsNextParseState (WalkState, Op, Status);        if (Status == AE_CTRL_PENDING)        {            Status = AE_CTRL_PARSE_PENDING;//.........这里部分代码省略.........
开发者ID:Jyang772,项目名称:XEOS,代码行数:101,


示例16: AcpiPsGetArguments

//.........这里部分代码省略.........                /*                 * Currently supported module-level opcodes are:                 * IF/ELSE/WHILE. These appear to be the most common,                 * and easiest to support since they open an AML                 * package.                 */                if (WalkState->PassNumber == ACPI_IMODE_LOAD_PASS1)                {                    AcpiPsLinkModuleCode (Op->Common.Parent, AmlOpStart,                        (UINT32) (WalkState->ParserState.PkgEnd - AmlOpStart),                        WalkState->OwnerId);                }                ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,                    "Pass1: Skipping an If/Else/While body/n"));                /* Skip body of if/else/while in pass 1 */                WalkState->ParserState.Aml = WalkState->ParserState.PkgEnd;                WalkState->ArgCount = 0;                break;            default:                /*                 * Check for an unsupported executable opcode at module                 * level. We must be in PASS1, the parent must be a SCOPE,                 * The opcode class must be EXECUTE, and the opcode must                 * not be an argument to another opcode.                 */                if ((WalkState->PassNumber == ACPI_IMODE_LOAD_PASS1) &&                    (Op->Common.Parent->Common.AmlOpcode == AML_SCOPE_OP))                {                    OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);                    if ((OpInfo->Class == AML_CLASS_EXECUTE) &&                        (!Arg))                    {                        ACPI_WARNING ((AE_INFO,                            "Unsupported module-level executable opcode "                            "0x%.2X at table offset 0x%.4X",                            Op->Common.AmlOpcode,                            (UINT32) (ACPI_PTR_DIFF (AmlOpStart,                                WalkState->ParserState.AmlStart) +                                sizeof (ACPI_TABLE_HEADER))));                    }                }                break;            }        }        /* Special processing for certain opcodes */        switch (Op->Common.AmlOpcode)        {        case AML_METHOD_OP:            /*             * Skip parsing of control method because we don't have enough             * info in the first pass to parse it correctly.             *             * Save the length and address of the body             */            Op->Named.Data = WalkState->ParserState.Aml;            Op->Named.Length = (UINT32)                (WalkState->ParserState.PkgEnd - WalkState->ParserState.Aml);            /* Skip body of method */
开发者ID:Jyang772,项目名称:XEOS,代码行数:67,


示例17: AcpiPsParseLoop

//.........这里部分代码省略.........                continue;            }        }        /* Check for arguments that need to be processed */        if (WalkState->ArgCount)        {            /*             * There are arguments (complex ones), push Op and             * prepare for argument             */            Status = AcpiPsPushScope (ParserState, Op,                        WalkState->ArgTypes, WalkState->ArgCount);            if (ACPI_FAILURE (Status))            {                Status = AcpiPsCompleteOp (WalkState, &Op, Status);                if (ACPI_FAILURE (Status))                {                    return_ACPI_STATUS (Status);                }                continue;            }            Op = NULL;            continue;        }        /*         * All arguments have been processed -- Op is complete,         * prepare for next         */        WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);        if (WalkState->OpInfo->Flags & AML_NAMED)        {            if (AcpiGbl_Depth)            {                AcpiGbl_Depth--;            }            if (Op->Common.AmlOpcode == AML_REGION_OP ||                Op->Common.AmlOpcode == AML_DATA_REGION_OP)            {                /*                 * Skip parsing of control method or opregion body,                 * because we don't have enough info in the first pass                 * to parse them correctly.                 *                 * Completed parsing an OpRegion declaration, we now                 * know the length.                 */                Op->Named.Length = (UINT32) (ParserState->Aml - Op->Named.Data);            }        }        if (WalkState->OpInfo->Flags & AML_CREATE)        {            /*             * Backup to beginning of CreateXXXfield declaration (1 for             * Opcode)             *             * BodyLength is unknown until we parse the body             */            Op->Named.Length = (UINT32) (ParserState->Aml - Op->Named.Data);        }
开发者ID:Jyang772,项目名称:XEOS,代码行数:67,


示例18: AcpiPsGetAmlOpcode

static ACPI_STATUSAcpiPsGetAmlOpcode (    ACPI_WALK_STATE         *WalkState){    ACPI_FUNCTION_TRACE_PTR (PsGetAmlOpcode, WalkState);    WalkState->AmlOffset = (UINT32) ACPI_PTR_DIFF (WalkState->ParserState.Aml,                                WalkState->ParserState.AmlStart);    WalkState->Opcode = AcpiPsPeekOpcode (&(WalkState->ParserState));    /*     * First cut to determine what we have found:     * 1) A valid AML opcode     * 2) A name string     * 3) An unknown/invalid opcode     */    WalkState->OpInfo = AcpiPsGetOpcodeInfo (WalkState->Opcode);    switch (WalkState->OpInfo->Class)    {    case AML_CLASS_ASCII:    case AML_CLASS_PREFIX:        /*         * Starts with a valid prefix or ASCII char, this is a name         * string. Convert the bare name string to a namepath.         */        WalkState->Opcode = AML_INT_NAMEPATH_OP;        WalkState->ArgTypes = ARGP_NAMESTRING;        break;    case AML_CLASS_UNKNOWN:        /* The opcode is unrecognized. Complain and skip unknown opcodes */        if (WalkState->PassNumber == 2)        {            ACPI_ERROR ((AE_INFO,                "Unknown opcode 0x%.2X at table offset 0x%.4X, ignoring",                WalkState->Opcode,                (UINT32) (WalkState->AmlOffset + sizeof (ACPI_TABLE_HEADER))));            ACPI_DUMP_BUFFER ((WalkState->ParserState.Aml - 16), 48);#ifdef ACPI_ASL_COMPILER            /*             * This is executed for the disassembler only. Output goes             * to the disassembled ASL output file.             */            AcpiOsPrintf (                "/*/nError: Unknown opcode 0x%.2X at table offset 0x%.4X, context:/n",                WalkState->Opcode,                (UINT32) (WalkState->AmlOffset + sizeof (ACPI_TABLE_HEADER)));            /* Dump the context surrounding the invalid opcode */            AcpiUtDumpBuffer (((UINT8 *) WalkState->ParserState.Aml - 16),                48, DB_BYTE_DISPLAY,                (WalkState->AmlOffset + sizeof (ACPI_TABLE_HEADER) - 16));            AcpiOsPrintf (" *//n");#endif        }        /* Increment past one-byte or two-byte opcode */        WalkState->ParserState.Aml++;        if (WalkState->Opcode > 0xFF) /* Can only happen if first byte is 0x5B */        {            WalkState->ParserState.Aml++;        }        return_ACPI_STATUS (AE_CTRL_PARSE_CONTINUE);    default:        /* Found opcode info, this is a normal opcode */        WalkState->ParserState.Aml += AcpiPsGetOpcodeSize (WalkState->Opcode);        WalkState->ArgTypes = WalkState->OpInfo->ParseArgs;        break;    }    return_ACPI_STATUS (AE_OK);}
开发者ID:Jyang772,项目名称:XEOS,代码行数:85,


示例19: AcpiDmDisplayPath

voidAcpiDmDisplayPath (    ACPI_PARSE_OBJECT       *Op){    ACPI_PARSE_OBJECT       *Prev;    ACPI_PARSE_OBJECT       *Search;    UINT32                  Name;    BOOLEAN                 DoDot = FALSE;    ACPI_PARSE_OBJECT       *NamePath;    const ACPI_OPCODE_INFO  *OpInfo;    /* We are only interested in named objects */    OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);    if (!(OpInfo->Flags & AML_NSNODE))    {        return;    }    if (OpInfo->Flags & AML_CREATE)    {        /* Field creation - check for a fully qualified namepath */        if (Op->Common.AmlOpcode == AML_CREATE_FIELD_OP)        {            NamePath = AcpiPsGetArg (Op, 3);        }        else        {            NamePath = AcpiPsGetArg (Op, 2);        }        if ((NamePath) &&            (NamePath->Common.Value.String) &&            (ACPI_IS_ROOT_PREFIX (NamePath->Common.Value.String[0])))        {            AcpiDmNamestring (NamePath->Common.Value.String);            return;        }    }    Prev = NULL;            /* Start with Root Node */    while (Prev != Op)    {        /* Search upwards in the tree to find scope with "prev" as its parent */        Search = Op;        for (; ;)        {            if (Search->Common.Parent == Prev)            {                break;            }            /* Go up one level */            Search = Search->Common.Parent;        }        if (Prev)        {            OpInfo = AcpiPsGetOpcodeInfo (Search->Common.AmlOpcode);            if (!(OpInfo->Flags & AML_FIELD))            {                /* Below root scope, append scope name */                if (DoDot)                {                    /* Append dot */                    AcpiOsPrintf (".");                }                if (OpInfo->Flags & AML_CREATE)                {                    if (Op->Common.AmlOpcode == AML_CREATE_FIELD_OP)                    {                        NamePath = AcpiPsGetArg (Op, 3);                    }                    else                    {                        NamePath = AcpiPsGetArg (Op, 2);                    }                    if ((NamePath) &&                        (NamePath->Common.Value.String))                    {                        AcpiDmDumpName (NamePath->Common.Value.String);                    }                }                else                {                    Name = AcpiPsGetName (Search);                    AcpiDmDumpName ((char *) &Name);                }                DoDot = TRUE;            }//.........这里部分代码省略.........
开发者ID:coyizumi,项目名称:cs111,代码行数:101,


示例20: AcpiPsCompleteFinalOp

static ACPI_STATUSAcpiPsCompleteFinalOp (    ACPI_WALK_STATE         *WalkState,    ACPI_PARSE_OBJECT       *Op,    ACPI_STATUS             Status){    ACPI_STATUS             Status2;    ACPI_FUNCTION_TRACE_PTR (PsCompleteFinalOp, WalkState);    /*     * Complete the last Op (if not completed), and clear the scope stack.     * It is easily possible to end an AML "package" with an unbounded number     * of open scopes (such as when several ASL blocks are closed with     * sequential closing braces). We want to terminate each one cleanly.     */    ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "AML package complete at Op %p/n", Op));    do    {        if (Op)        {            if (WalkState->AscendingCallback != NULL)            {                WalkState->Op = Op;                WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);                WalkState->Opcode = Op->Common.AmlOpcode;                Status = WalkState->AscendingCallback (WalkState);                Status = AcpiPsNextParseState (WalkState, Op, Status);                if (Status == AE_CTRL_PENDING)                {                    Status = AcpiPsCompleteOp (WalkState, &Op, AE_OK);                    if (ACPI_FAILURE (Status))                    {                        return_ACPI_STATUS (Status);                    }                }                if (Status == AE_CTRL_TERMINATE)                {                    Status = AE_OK;                    /* Clean up */                    do                    {                        if (Op)                        {                            Status2 = AcpiPsCompleteThisOp (WalkState, Op);                            if (ACPI_FAILURE (Status2))                            {                                return_ACPI_STATUS (Status2);                            }                        }                        AcpiPsPopScope (&(WalkState->ParserState), &Op,                            &WalkState->ArgTypes, &WalkState->ArgCount);                    } while (Op);                    return_ACPI_STATUS (Status);                }                else if (ACPI_FAILURE (Status))                {                    /* First error is most important */                    (void) AcpiPsCompleteThisOp (WalkState, Op);                    return_ACPI_STATUS (Status);                }            }            Status2 = AcpiPsCompleteThisOp (WalkState, Op);            if (ACPI_FAILURE (Status2))            {                return_ACPI_STATUS (Status2);            }        }        AcpiPsPopScope (&(WalkState->ParserState), &Op, &WalkState->ArgTypes,            &WalkState->ArgCount);    } while (Op);    return_ACPI_STATUS (Status);}
开发者ID:Jyang772,项目名称:XEOS,代码行数:87,


示例21: AcpiDsIsResultUsed

BOOLEANAcpiDsIsResultUsed (    ACPI_PARSE_OBJECT       *Op,    ACPI_WALK_STATE         *WalkState){    const ACPI_OPCODE_INFO  *ParentInfo;    ACPI_FUNCTION_TRACE_PTR (DsIsResultUsed, Op);    /* Must have both an Op and a Result Object */    if (!Op)    {        ACPI_ERROR ((AE_INFO, "Null Op"));        return_UINT8 (TRUE);    }    /*     * We know that this operator is not a     * Return() operator (would not come here.) The following code is the     * optional support for a so-called "implicit return". Some AML code     * assumes that the last value of the method is "implicitly" returned     * to the caller. Just save the last result as the return value.     * NOTE: this is optional because the ASL language does not actually     * support this behavior.     */    (void) AcpiDsDoImplicitReturn (WalkState->ResultObj, WalkState, TRUE);    /*     * Now determine if the parent will use the result     *     * If there is no parent, or the parent is a ScopeOp, we are executing     * at the method level. An executing method typically has no parent,     * since each method is parsed separately. A method invoked externally     * via ExecuteControlMethod has a ScopeOp as the parent.     */    if ((!Op->Common.Parent) ||        (Op->Common.Parent->Common.AmlOpcode == AML_SCOPE_OP))    {        /* No parent, the return value cannot possibly be used */        ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,            "At Method level, result of [%s] not used/n",            AcpiPsGetOpcodeName (Op->Common.AmlOpcode)));        return_UINT8 (FALSE);    }    /* Get info on the parent. The RootOp is AML_SCOPE */    ParentInfo = AcpiPsGetOpcodeInfo (Op->Common.Parent->Common.AmlOpcode);    if (ParentInfo->Class == AML_CLASS_UNKNOWN)    {        ACPI_ERROR ((AE_INFO,            "Unknown parent opcode Op=%p", Op));        return_UINT8 (FALSE);    }    /*     * Decide what to do with the result based on the parent. If     * the parent opcode will not use the result, delete the object.     * Otherwise leave it as is, it will be deleted when it is used     * as an operand later.     */    switch (ParentInfo->Class)    {    case AML_CLASS_CONTROL:        switch (Op->Common.Parent->Common.AmlOpcode)        {        case AML_RETURN_OP:            /* Never delete the return value associated with a return opcode */            goto ResultUsed;        case AML_IF_OP:        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;//.........这里部分代码省略.........
开发者ID:ornarium,项目名称:freebsd,代码行数:101,


示例22: AcpiDsInitObjectFromOp

ACPI_STATUSAcpiDsInitObjectFromOp (    ACPI_WALK_STATE         *WalkState,    ACPI_PARSE_OBJECT       *Op,    UINT16                  Opcode,    ACPI_OPERAND_OBJECT     **RetObjDesc){    const ACPI_OPCODE_INFO  *OpInfo;    ACPI_OPERAND_OBJECT     *ObjDesc;    ACPI_STATUS             Status = AE_OK;    ACPI_FUNCTION_TRACE (DsInitObjectFromOp);    ObjDesc = *RetObjDesc;    OpInfo = AcpiPsGetOpcodeInfo (Opcode);    if (OpInfo->Class == AML_CLASS_UNKNOWN)    {        /* Unknown opcode */        return_ACPI_STATUS (AE_TYPE);    }    /* Perform per-object initialization */    switch (ObjDesc->Common.Type)    {    case ACPI_TYPE_BUFFER:        /*         * Defer evaluation of Buffer TermArg operand         */        ObjDesc->Buffer.Node      = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE,                                        WalkState->Operands[0]);        ObjDesc->Buffer.AmlStart  = Op->Named.Data;        ObjDesc->Buffer.AmlLength = Op->Named.Length;        break;    case ACPI_TYPE_PACKAGE:        /*         * Defer evaluation of Package TermArg operand         */        ObjDesc->Package.Node      = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE,                                        WalkState->Operands[0]);        ObjDesc->Package.AmlStart  = Op->Named.Data;        ObjDesc->Package.AmlLength = Op->Named.Length;        break;    case ACPI_TYPE_INTEGER:        switch (OpInfo->Type)        {        case AML_TYPE_CONSTANT:            /*             * Resolve AML Constants here - AND ONLY HERE!             * All constants are integers.             * We mark the integer with a flag that indicates that it started             * life as a constant -- so that stores to constants will perform             * as expected (noop). ZeroOp is used as a placeholder for optional             * target operands.             */            ObjDesc->Common.Flags = AOPOBJ_AML_CONSTANT;            switch (Opcode)            {            case AML_ZERO_OP:                ObjDesc->Integer.Value = 0;                break;            case AML_ONE_OP:                ObjDesc->Integer.Value = 1;                break;            case AML_ONES_OP:                ObjDesc->Integer.Value = ACPI_UINT64_MAX;                /* Truncate value if we are executing from a 32-bit ACPI table */#ifndef ACPI_NO_METHOD_EXECUTION                (void) AcpiExTruncateFor32bitTable (ObjDesc);#endif                break;            case AML_REVISION_OP:                ObjDesc->Integer.Value = ACPI_CA_VERSION;                break;            default:                ACPI_ERROR ((AE_INFO,                    "Unknown constant opcode 0x%X", Opcode));                Status = AE_AML_OPERAND_TYPE;//.........这里部分代码省略.........
开发者ID:ornarium,项目名称:freebsd,代码行数:101,


示例23: AcpiPsCompleteThisOp

ACPI_STATUSAcpiPsCompleteThisOp (    ACPI_WALK_STATE         *WalkState,    ACPI_PARSE_OBJECT       *Op){    ACPI_PARSE_OBJECT       *Prev;    ACPI_PARSE_OBJECT       *Next;    const ACPI_OPCODE_INFO  *ParentInfo;    ACPI_PARSE_OBJECT       *ReplacementOp = NULL;    ACPI_STATUS             Status = AE_OK;    ACPI_FUNCTION_TRACE_PTR (PsCompleteThisOp, Op);    /* Check for null Op, can happen if AML code is corrupt */    if (!Op)    {        return_ACPI_STATUS (AE_OK);  /* OK for now */    }    AcpiExStopTraceOpcode (Op, WalkState);    /* Delete this op and the subtree below it if asked to */    if (((WalkState->ParseFlags & ACPI_PARSE_TREE_MASK) != ACPI_PARSE_DELETE_TREE) ||         (WalkState->OpInfo->Class == AML_CLASS_ARGUMENT))    {        return_ACPI_STATUS (AE_OK);    }    /* Make sure that we only delete this subtree */    if (Op->Common.Parent)    {        Prev = Op->Common.Parent->Common.Value.Arg;        if (!Prev)        {            /* Nothing more to do */            goto Cleanup;        }        /*         * Check if we need to replace the operator and its subtree         * with a return value op (placeholder op)         */        ParentInfo = AcpiPsGetOpcodeInfo (Op->Common.Parent->Common.AmlOpcode);        switch (ParentInfo->Class)        {        case AML_CLASS_CONTROL:            break;        case AML_CLASS_CREATE:            /*             * These opcodes contain TermArg operands. The current             * op must be replaced by a placeholder return op             */            ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP,                                Op->Common.Aml);            if (!ReplacementOp)            {                Status = AE_NO_MEMORY;            }            break;        case AML_CLASS_NAMED_OBJECT:            /*             * These opcodes contain TermArg operands. The current             * op must be replaced by a placeholder return op             */            if ((Op->Common.Parent->Common.AmlOpcode == AML_REGION_OP)       ||                (Op->Common.Parent->Common.AmlOpcode == AML_DATA_REGION_OP)  ||                (Op->Common.Parent->Common.AmlOpcode == AML_BUFFER_OP)       ||                (Op->Common.Parent->Common.AmlOpcode == AML_PACKAGE_OP)      ||                (Op->Common.Parent->Common.AmlOpcode == AML_BANK_FIELD_OP)   ||                (Op->Common.Parent->Common.AmlOpcode == AML_VAR_PACKAGE_OP))            {                ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP,                                    Op->Common.Aml);                if (!ReplacementOp)                {                    Status = AE_NO_MEMORY;                }            }            else if ((Op->Common.Parent->Common.AmlOpcode == AML_NAME_OP) &&                     (WalkState->PassNumber <= ACPI_IMODE_LOAD_PASS2))            {                if ((Op->Common.AmlOpcode == AML_BUFFER_OP) ||                    (Op->Common.AmlOpcode == AML_PACKAGE_OP) ||                    (Op->Common.AmlOpcode == AML_VAR_PACKAGE_OP))                {                    ReplacementOp = AcpiPsAllocOp (Op->Common.AmlOpcode,                                        Op->Common.Aml);                    if (!ReplacementOp)                    {                        Status = AE_NO_MEMORY;//.........这里部分代码省略.........
开发者ID:ModeenF,项目名称:haiku,代码行数:101,


示例24: AcpiDmParseDeferredOps

ACPI_STATUSAcpiDmParseDeferredOps (    ACPI_PARSE_OBJECT       *Root){    const ACPI_OPCODE_INFO  *OpInfo;    ACPI_PARSE_OBJECT       *Op = Root;    ACPI_STATUS             Status;    ACPI_FUNCTION_ENTRY ();    /* Traverse the entire parse tree */    while (Op)    {        OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);        if (!(OpInfo->Flags & AML_DEFER))        {            Op = AcpiPsGetDepthNext (Root, Op);            continue;        }        /* Now we know we have a deferred opcode */        switch (Op->Common.AmlOpcode)        {        case AML_METHOD_OP:        case AML_BUFFER_OP:        case AML_PACKAGE_OP:        case AML_VAR_PACKAGE_OP:            Status = AcpiDmDeferredParse (Op, Op->Named.Data, Op->Named.Length);            if (ACPI_FAILURE (Status))            {                return (Status);            }            break;        /* We don't need to do anything for these deferred opcodes */        case AML_REGION_OP:        case AML_DATA_REGION_OP:        case AML_CREATE_QWORD_FIELD_OP:        case AML_CREATE_DWORD_FIELD_OP:        case AML_CREATE_WORD_FIELD_OP:        case AML_CREATE_BYTE_FIELD_OP:        case AML_CREATE_BIT_FIELD_OP:        case AML_CREATE_FIELD_OP:        case AML_BANK_FIELD_OP:            break;        default:            ACPI_ERROR ((AE_INFO, "Unhandled deferred AML opcode [0x%.4X]",                 Op->Common.AmlOpcode));            break;        }        Op = AcpiPsGetDepthNext (Root, Op);    }    return (AE_OK);}
开发者ID:99corps,项目名称:runtime,代码行数:65,


示例25: LsWriteNodeToListing

static voidLsWriteNodeToListing (    ACPI_PARSE_OBJECT       *Op,    UINT32                  FileId){    const ACPI_OPCODE_INFO  *OpInfo;    UINT32                  OpClass;    char                    *Pathname;    UINT32                  Length;    UINT32                  i;    OpInfo  = AcpiPsGetOpcodeInfo (Op->Asl.AmlOpcode);    OpClass = OpInfo->Class;    /* TBD: clean this up with a single flag that says:     * I start a named output block     */    if (FileId == ASL_FILE_C_SOURCE_OUTPUT)    {        switch (Op->Asl.ParseOpcode)        {        case PARSEOP_DEFINITION_BLOCK:        case PARSEOP_METHODCALL:        case PARSEOP_INCLUDE:        case PARSEOP_INCLUDE_END:        case PARSEOP_DEFAULT_ARG:            break;        default:            switch (OpClass)            {            case AML_CLASS_NAMED_OBJECT:                switch (Op->Asl.AmlOpcode)                {                case AML_SCOPE_OP:                case AML_ALIAS_OP:                    break;                default:                    if (Op->Asl.ExternalName)                    {                        LsFlushListingBuffer (FileId);                        FlPrintFile (FileId, "    };/n");                    }                    break;                }                break;            default:                /* Don't care about other objects */                break;            }            break;        }    }    /* These cases do not have a corresponding AML opcode */    switch (Op->Asl.ParseOpcode)    {    case PARSEOP_DEFINITION_BLOCK:        /* Always start a definition block at AML offset zero */        Gbl_CurrentAmlOffset = 0;        LsWriteSourceLines (Op->Asl.EndLine, Op->Asl.EndLogicalLine, FileId);        /* Use the table Signature and TableId to build a unique name */        switch (FileId)        {        case ASL_FILE_ASM_SOURCE_OUTPUT:            FlPrintFile (FileId,                "%s_%s_Header ///n",                Gbl_TableSignature, Gbl_TableId);            break;        case ASL_FILE_C_SOURCE_OUTPUT:            FlPrintFile (FileId,                "    unsigned char    %s_%s_Header [] =/n    {/n",                Gbl_TableSignature, Gbl_TableId);            break;        case ASL_FILE_ASM_INCLUDE_OUTPUT:            FlPrintFile (FileId,                "extrn %s_%s_Header : byte/n",                Gbl_TableSignature, Gbl_TableId);            break;//.........这里部分代码省略.........
开发者ID:Raphine,项目名称:Raph_Kernel,代码行数:101,


示例26: AcpiDsBuildInternalObject

//.........这里部分代码省略.........        if ((Op->Common.Parent->Common.AmlOpcode == AML_PACKAGE_OP) ||            (Op->Common.Parent->Common.AmlOpcode == AML_VAR_PACKAGE_OP))        {            /*             * Attempt to resolve the node to a value before we insert it into             * the package. If this is a reference to a common data type,             * resolve it immediately. According to the ACPI spec, package             * elements can only be "data objects" or method references.             * Attempt to resolve to an Integer, Buffer, String or Package.             * If cannot, return the named reference (for things like Devices,             * Methods, etc.) Buffer Fields and Fields will resolve to simple             * objects (int/buf/str/pkg).             *             * NOTE: References to things like Devices, Methods, Mutexes, etc.             * will remain as named references. This behavior is not described             * in the ACPI spec, but it appears to be an oversight.             */            ObjDesc = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Op->Common.Node);            Status = AcpiExResolveNodeToValue (                        ACPI_CAST_INDIRECT_PTR (ACPI_NAMESPACE_NODE, &ObjDesc),                        WalkState);            if (ACPI_FAILURE (Status))            {                return_ACPI_STATUS (Status);            }            /*             * Special handling for Alias objects. We need to setup the type             * and the Op->Common.Node to point to the Alias target. Note,             * Alias has at most one level of indirection internally.             */            Type = Op->Common.Node->Type;            if (Type == ACPI_TYPE_LOCAL_ALIAS)            {                Type = ObjDesc->Common.Type;                Op->Common.Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE,                    Op->Common.Node->Object);            }            switch (Type)            {            /*             * For these types, we need the actual node, not the subobject.             * However, the subobject did not get an extra reference count above.             *             * TBD: should ExResolveNodeToValue be changed to fix this?             */            case ACPI_TYPE_DEVICE:            case ACPI_TYPE_THERMAL:                AcpiUtAddReference (Op->Common.Node->Object);                /*lint -fallthrough */            /*             * For these types, we need the actual node, not the subobject.             * The subobject got an extra reference count in ExResolveNodeToValue.             */            case ACPI_TYPE_MUTEX:            case ACPI_TYPE_METHOD:            case ACPI_TYPE_POWER:            case ACPI_TYPE_PROCESSOR:            case ACPI_TYPE_EVENT:            case ACPI_TYPE_REGION:                /* We will create a reference object for these types below */                break;            default:                /*                 * All other types - the node was resolved to an actual                 * object, we are done.                 */                goto Exit;            }        }    }    /* Create and init a new internal ACPI object */    ObjDesc = AcpiUtCreateInternalObject (                (AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode))->ObjectType);    if (!ObjDesc)    {        return_ACPI_STATUS (AE_NO_MEMORY);    }    Status = AcpiDsInitObjectFromOp (WalkState, Op, Op->Common.AmlOpcode,                &ObjDesc);    if (ACPI_FAILURE (Status))    {        AcpiUtRemoveReference (ObjDesc);        return_ACPI_STATUS (Status);    }Exit:    *ObjDescPtr = ObjDesc;    return_ACPI_STATUS (Status);}
开发者ID:ornarium,项目名称:freebsd,代码行数:101,


示例27: XfNamespaceLocateBegin

static ACPI_STATUSXfNamespaceLocateBegin (    ACPI_PARSE_OBJECT       *Op,    UINT32                  Level,    void                    *Context){    ACPI_WALK_STATE         *WalkState = (ACPI_WALK_STATE *) Context;    ACPI_NAMESPACE_NODE     *Node;    ACPI_STATUS             Status;    ACPI_OBJECT_TYPE        ObjectType;    char                    *Path;    UINT8                   PassedArgs;    ACPI_PARSE_OBJECT       *NextOp;    ACPI_PARSE_OBJECT       *OwningOp;    ACPI_PARSE_OBJECT       *SpaceIdOp;    UINT32                  MinimumLength;    UINT32                  Offset;    UINT32                  FieldBitLength;    UINT32                  TagBitLength;    UINT8                   Message = 0;    const ACPI_OPCODE_INFO  *OpInfo;    UINT32                  Flags;    ASL_METHOD_LOCAL        *MethodLocals = NULL;    ASL_METHOD_LOCAL        *MethodArgs = NULL;    int                     RegisterNumber;    UINT32                  i;    ACPI_FUNCTION_TRACE_PTR (XfNamespaceLocateBegin, Op);    if ((Op->Asl.AmlOpcode == AML_METHOD_OP) && Op->Asl.Node)    {        Node = Op->Asl.Node;        /* Support for method LocalX/ArgX analysis */        if (!Node->MethodLocals)        {            /* Create local/arg info blocks */            MethodLocals = UtLocalCalloc (                sizeof (ASL_METHOD_LOCAL) * ACPI_METHOD_NUM_LOCALS);            Node->MethodLocals = MethodLocals;            MethodArgs = UtLocalCalloc (                sizeof (ASL_METHOD_LOCAL) * ACPI_METHOD_NUM_ARGS);            Node->MethodArgs = MethodArgs;            /*             * Get the method argument count             * First, get the name node             */            NextOp = Op->Asl.Child;            /* Get the NumArguments node */            NextOp = NextOp->Asl.Next;            Node->ArgCount = (UINT8)                (((UINT8) NextOp->Asl.Value.Integer) & 0x07);            /* We will track all possible ArgXs */            for (i = 0; i < ACPI_METHOD_NUM_ARGS; i++)            {                if (i < Node->ArgCount)                {                    /* Real Args are always "initialized" */                    MethodArgs[i].Flags = ASL_ARG_INITIALIZED;                }                else                {                    /* Other ArgXs can be used as locals */                    MethodArgs[i].Flags = ASL_ARG_IS_LOCAL;                }                MethodArgs[i].Op = Op;            }        }    }    /*     * If this node is the actual declaration of a name     * [such as the XXXX name in "Method (XXXX)"],     * we are not interested in it here. We only care about names that are     * references to other objects within the namespace and the parent objects     * of name declarations     */    if (Op->Asl.CompileFlags & OP_IS_NAME_DECLARATION)    {        return_ACPI_STATUS (AE_OK);    }    OpInfo = AcpiPsGetOpcodeInfo (Op->Asl.AmlOpcode);    /* Check method LocalX variables */    if (OpInfo->Type == AML_TYPE_LOCAL_VARIABLE)//.........这里部分代码省略.........
开发者ID:kusumi,项目名称:DragonFlyBSD,代码行数:101,


示例28: AcpiDsCreateOperand

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//.........这里部分代码省略.........
开发者ID:ornarium,项目名称:freebsd,代码行数:101,


示例29: AcpiDsLoad1EndOp

ACPI_STATUSAcpiDsLoad1EndOp (    ACPI_WALK_STATE         *WalkState){    ACPI_PARSE_OBJECT       *Op;    ACPI_OBJECT_TYPE        ObjectType;    ACPI_STATUS             Status = AE_OK;    ACPI_FUNCTION_TRACE (DsLoad1EndOp);    Op = WalkState->Op;    ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p/n", Op, WalkState));    /* We are only interested in opcodes that have an associated name */    if (!(WalkState->OpInfo->Flags & (AML_NAMED | AML_FIELD)))    {        return_ACPI_STATUS (AE_OK);    }    /* Get the object type to determine if we should pop the scope */    ObjectType = WalkState->OpInfo->ObjectType;#ifndef ACPI_NO_METHOD_EXECUTION    if (WalkState->OpInfo->Flags & AML_FIELD)    {        /*         * If we are executing a method, do not create any namespace objects         * during the load phase, only during execution.         */        if (!WalkState->MethodNode)        {            if (WalkState->Opcode == AML_FIELD_OP          ||                WalkState->Opcode == AML_BANK_FIELD_OP     ||                WalkState->Opcode == AML_INDEX_FIELD_OP)            {                Status = AcpiDsInitFieldObjects (Op, WalkState);            }        }        return_ACPI_STATUS (Status);    }    /*     * If we are executing a method, do not create any namespace objects     * during the load phase, only during execution.     */    if (!WalkState->MethodNode)    {        if (Op->Common.AmlOpcode == AML_REGION_OP)        {            Status = AcpiExCreateRegion (Op->Named.Data, Op->Named.Length,                        (ACPI_ADR_SPACE_TYPE) ((Op->Common.Value.Arg)->Common.Value.Integer),                        WalkState);            if (ACPI_FAILURE (Status))            {                return_ACPI_STATUS (Status);            }        }        else if (Op->Common.AmlOpcode == AML_DATA_REGION_OP)        {            Status = AcpiExCreateRegion (Op->Named.Data, Op->Named.Length,                        ACPI_ADR_SPACE_DATA_TABLE, WalkState);            if (ACPI_FAILURE (Status))            {                return_ACPI_STATUS (Status);            }        }    }#endif    if (Op->Common.AmlOpcode == AML_NAME_OP)    {        /* For Name opcode, get the object type from the argument */        if (Op->Common.Value.Arg)        {            ObjectType = (AcpiPsGetOpcodeInfo (                (Op->Common.Value.Arg)->Common.AmlOpcode))->ObjectType;            /* Set node type if we have a namespace node */            if (Op->Common.Node)            {                Op->Common.Node->Type = (UINT8) ObjectType;            }        }    }    /*     * If we are executing a method, do not create any namespace objects     * during the load phase, only during execution.     */    if (!WalkState->MethodNode)    {        if (Op->Common.AmlOpcode == AML_METHOD_OP)        {            /*//.........这里部分代码省略.........
开发者ID:wan721,项目名称:DragonFlyBSD,代码行数:101,



注:本文中的AcpiPsGetOpcodeInfo函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ AcpiPsGetOpcodeName函数代码示例
C++ AcpiPsGetDepthNext函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。