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

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

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

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

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

示例1: AcpiDsMethodDataSetEntry

ACPI_STATUSAcpiDsMethodDataSetEntry (    UINT16                  Opcode,    UINT32                  Index,    ACPI_OPERAND_OBJECT     *Object,    ACPI_WALK_STATE         *WalkState){    ACPI_STATUS             Status;    ACPI_OPERAND_OBJECT     **Entry;    FUNCTION_TRACE ("DsMethodDataSetEntry");    /* Get a pointer to the stack entry to set */    Status = AcpiDsMethodDataGetEntry (Opcode, Index, WalkState, &Entry);    if (ACPI_FAILURE (Status))    {        return_ACPI_STATUS (Status);    }    /* Increment ref count so object can't be deleted while installed */    AcpiUtAddReference (Object);    /* Install the object into the stack entry */    *Entry = Object;    return_ACPI_STATUS (AE_OK);}
开发者ID:MarginC,项目名称:kame,代码行数:32,


示例2: AcpiEvAttachRegion

ACPI_STATUSAcpiEvAttachRegion (    ACPI_OPERAND_OBJECT     *HandlerObj,    ACPI_OPERAND_OBJECT     *RegionObj,    BOOLEAN                 AcpiNsIsLocked){    ACPI_FUNCTION_TRACE (EvAttachRegion);    ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,        "Adding Region [%4.4s] %p to address handler %p [%s]/n",        AcpiUtGetNodeName (RegionObj->Region.Node),        RegionObj, HandlerObj,        AcpiUtGetRegionName (RegionObj->Region.SpaceId)));    /* Link this region to the front of the handler's list */    RegionObj->Region.Next = HandlerObj->AddressSpace.RegionList;    HandlerObj->AddressSpace.RegionList = RegionObj;    /* Install the region's handler */    if (RegionObj->Region.Handler)    {        return_ACPI_STATUS (AE_ALREADY_EXISTS);    }    RegionObj->Region.Handler = HandlerObj;    AcpiUtAddReference (HandlerObj);    return_ACPI_STATUS (AE_OK);}
开发者ID:JasonFord53,项目名称:freebsd,代码行数:33,


示例3: AcpiNsResolveReferences

static voidAcpiNsResolveReferences (    ACPI_EVALUATE_INFO      *Info){    ACPI_OPERAND_OBJECT     *ObjDesc = NULL;    ACPI_NAMESPACE_NODE     *Node;    /* We are interested in reference objects only */    if ((Info->ReturnObject)->Common.Type != ACPI_TYPE_LOCAL_REFERENCE)    {        return;    }    /*     * Two types of references are supported - those created by Index and     * RefOf operators. A name reference (AML_NAMEPATH_OP) can be converted     * to an ACPI_OBJECT, so it is not dereferenced here. A DdbHandle     * (AML_LOAD_OP) cannot be dereferenced, nor can it be converted to     * an ACPI_OBJECT.     */    switch (Info->ReturnObject->Reference.Class)    {    case ACPI_REFCLASS_INDEX:        ObjDesc = *(Info->ReturnObject->Reference.Where);        break;    case ACPI_REFCLASS_REFOF:        Node = Info->ReturnObject->Reference.Object;        if (Node)        {            ObjDesc = Node->Object;        }        break;    default:        return;    }    /* Replace the existing reference object */    if (ObjDesc)    {        AcpiUtAddReference (ObjDesc);        AcpiUtRemoveReference (Info->ReturnObject);        Info->ReturnObject = ObjDesc;    }    return;}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:54,


示例4: AcpiDsDoImplicitReturn

BOOLEANAcpiDsDoImplicitReturn (    ACPI_OPERAND_OBJECT     *ReturnDesc,    ACPI_WALK_STATE         *WalkState,    BOOLEAN                 AddReference){    ACPI_FUNCTION_NAME (DsDoImplicitReturn);    /*     * Slack must be enabled for this feature, and we must     * have a valid return object     */    if ((!AcpiGbl_EnableInterpreterSlack) ||        (!ReturnDesc))    {        return (FALSE);    }    ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,            "Result %p will be implicitly returned; Prev=%p/n",            ReturnDesc,            WalkState->ImplicitReturnObj));    /*     * Delete any "stale" implicit return value first. However, in     * complex statements, the implicit return value can be     * bubbled up several levels, so we don't clear the value if it     * is the same as the ReturnDesc.     */    if (WalkState->ImplicitReturnObj)    {        if (WalkState->ImplicitReturnObj == ReturnDesc)        {            return (TRUE);        }        AcpiDsClearImplicitReturn (WalkState);    }    /* Save the implicit return value, add a reference if requested */    WalkState->ImplicitReturnObj = ReturnDesc;    if (AddReference)    {        AcpiUtAddReference (ReturnDesc);    }    return (TRUE);}
开发者ID:ornarium,项目名称:freebsd,代码行数:49,


示例5: AcpiDsMethodDataSetValue

static ACPI_STATUSAcpiDsMethodDataSetValue (    UINT8                   Type,    UINT32                  Index,    ACPI_OPERAND_OBJECT     *Object,    ACPI_WALK_STATE         *WalkState){    ACPI_STATUS             Status;    ACPI_NAMESPACE_NODE     *Node;    ACPI_FUNCTION_TRACE (DsMethodDataSetValue);    ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,        "NewObj %p Type %2.2X, Refs=%u [%s]/n", Object,        Type, Object->Common.ReferenceCount,        AcpiUtGetTypeName (Object->Common.Type)));    /* Get the namespace node for the arg/local */    Status = AcpiDsMethodDataGetNode (Type, Index, WalkState, &Node);    if (ACPI_FAILURE (Status))    {        return_ACPI_STATUS (Status);    }    /*     * Increment ref count so object can't be deleted while installed.     * NOTE: We do not copy the object in order to preserve the call by     * reference semantics of ACPI Control Method invocation.     * (See ACPI Specification 2.0C)     */    AcpiUtAddReference (Object);    /* Install the object */    Node->Object = Object;    return_ACPI_STATUS (Status);}
开发者ID:ksashtekar,项目名称:Ganoid,代码行数:40,


示例6: AcpiInstallNotifyHandler

//.........这里部分代码省略.........    }    /*     * All Other Objects:     * Caller will only receive notifications specific to the target     * object. Note that only certain object types are allowed to     * receive notifications.     */    /* Are Notifies allowed on this object? */    if (!AcpiEvIsNotifyObject (Node))    {        Status = AE_TYPE;        goto UnlockAndExit;    }    /* Check for an existing internal object, might not exist */    ObjDesc = AcpiNsGetAttachedObject (Node);    if (!ObjDesc)    {        /* Create a new object */        ObjDesc = AcpiUtCreateInternalObject (Node->Type);        if (!ObjDesc)        {            Status = AE_NO_MEMORY;            goto UnlockAndExit;        }        /* Attach new object to the Node, remove local reference */        Status = AcpiNsAttachObject (Device, ObjDesc, Node->Type);        AcpiUtRemoveReference (ObjDesc);        if (ACPI_FAILURE (Status))        {            goto UnlockAndExit;        }    }    /* Ensure that the handler is not already installed in the lists */    for (i = 0; i < ACPI_NUM_NOTIFY_TYPES; i++)    {        if (HandlerType & (i+1))        {            HandlerObj = ObjDesc->CommonNotify.NotifyList[i];            while (HandlerObj)            {                if (HandlerObj->Notify.Handler == Handler)                {                    Status = AE_ALREADY_EXISTS;                    goto UnlockAndExit;                }                HandlerObj = HandlerObj->Notify.Next[i];            }        }    }    /* Create and populate a new notify handler object */    HandlerObj = AcpiUtCreateInternalObject (ACPI_TYPE_LOCAL_NOTIFY);    if (!HandlerObj)    {        Status = AE_NO_MEMORY;        goto UnlockAndExit;    }    HandlerObj->Notify.Node = Node;    HandlerObj->Notify.HandlerType = HandlerType;    HandlerObj->Notify.Handler = Handler;    HandlerObj->Notify.Context = Context;    /* Install the handler at the list head(s) */    for (i = 0; i < ACPI_NUM_NOTIFY_TYPES; i++)    {        if (HandlerType & (i+1))        {            HandlerObj->Notify.Next[i] =                ObjDesc->CommonNotify.NotifyList[i];            ObjDesc->CommonNotify.NotifyList[i] = HandlerObj;        }    }    /* Add an extra reference if handler was installed in both lists */    if (HandlerType == ACPI_ALL_NOTIFY)    {        AcpiUtAddReference (HandlerObj);    }UnlockAndExit:    (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);    return_ACPI_STATUS (Status);}
开发者ID:ikitayama,项目名称:acpica-tools,代码行数:101,


示例7: AcpiNsConvertToReference

ACPI_STATUSAcpiNsConvertToReference (    ACPI_NAMESPACE_NODE     *Scope,    ACPI_OPERAND_OBJECT     *OriginalObject,    ACPI_OPERAND_OBJECT     **ReturnObject){    ACPI_OPERAND_OBJECT     *NewObject = NULL;    ACPI_STATUS             Status;    ACPI_NAMESPACE_NODE     *Node;    ACPI_GENERIC_STATE      ScopeInfo;    char                    *Name;    ACPI_FUNCTION_NAME (NsConvertToReference);    /* Convert path into internal presentation */    Status = AcpiNsInternalizeName (OriginalObject->String.Pointer, &Name);    if (ACPI_FAILURE (Status))    {        return_ACPI_STATUS (Status);    }    /* Find the namespace node */    ScopeInfo.Scope.Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Scope);    Status = AcpiNsLookup (&ScopeInfo, Name,        ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,        ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, NULL, &Node);    if (ACPI_FAILURE (Status))    {        /* Check if we are resolving a named reference within a package */        ACPI_ERROR_NAMESPACE (&ScopeInfo,            OriginalObject->String.Pointer, Status);        goto ErrorExit;    }    /* Create and init a new internal ACPI object */    NewObject = AcpiUtCreateInternalObject (ACPI_TYPE_LOCAL_REFERENCE);    if (!NewObject)    {        Status = AE_NO_MEMORY;        goto ErrorExit;    }    NewObject->Reference.Node = Node;    NewObject->Reference.Object = Node->Object;    NewObject->Reference.Class = ACPI_REFCLASS_NAME;    /*     * Increase reference of the object if needed (the object is likely a     * null for device nodes).     */    AcpiUtAddReference (Node->Object);ErrorExit:    ACPI_FREE (Name);    *ReturnObject = NewObject;    return (AE_OK);}
开发者ID:9elements,项目名称:fwts,代码行数:62,


示例8: AcpiDsExecEndOp

//.........这里部分代码省略.........            WalkState->ResultObj)        {            Status = AcpiDsResultPush (WalkState->ResultObj, WalkState);        }        break;    default:        switch (OpType)        {        case AML_TYPE_CONTROL:    /* Type 1 opcode, IF/ELSE/WHILE/NOOP */            /* 1 Operand, 0 ExternalResult, 0 InternalResult */            Status = AcpiDsExecEndControlOp (WalkState, Op);            break;        case AML_TYPE_METHOD_CALL:            /*             * If the method is referenced from within a package             * declaration, it is not a invocation of the method, just             * a reference to it.             */            if ((Op->Asl.Parent) &&               ((Op->Asl.Parent->Asl.AmlOpcode == AML_PACKAGE_OP) ||                (Op->Asl.Parent->Asl.AmlOpcode == AML_VAR_PACKAGE_OP)))            {                ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,                    "Method Reference in a Package, Op=%p/n", Op));                Op->Common.Node = (ACPI_NAMESPACE_NODE *)                    Op->Asl.Value.Arg->Asl.Node;                AcpiUtAddReference (Op->Asl.Value.Arg->Asl.Node->Object);                return_ACPI_STATUS (AE_OK);            }            ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,                "Method invocation, Op=%p/n", Op));            /*             * (AML_METHODCALL) Op->Asl.Value.Arg->Asl.Node contains             * the method Node pointer             */            /* NextOp points to the op that holds the method name */            NextOp = FirstArg;            /* NextOp points to first argument op */            NextOp = NextOp->Common.Next;            /*             * Get the method's arguments and put them on the operand stack             */            Status = AcpiDsCreateOperands (WalkState, NextOp);            if (ACPI_FAILURE (Status))            {                break;            }            /*             * Since the operands will be passed to another control method,             * we must resolve all local references here (Local variables,             * arguments to *this* method, etc.)             */
开发者ID:AmirAbrams,项目名称:haiku,代码行数:67,


示例9: AcpiExResolveNodeToValue

ACPI_STATUSAcpiExResolveNodeToValue (    ACPI_NAMESPACE_NODE     **ObjectPtr,    ACPI_WALK_STATE         *WalkState){    ACPI_STATUS             Status = AE_OK;    ACPI_OPERAND_OBJECT     *SourceDesc;    ACPI_OPERAND_OBJECT     *ObjDesc = NULL;    ACPI_NAMESPACE_NODE     *Node;    ACPI_OBJECT_TYPE        EntryType;    ACPI_FUNCTION_TRACE (ExResolveNodeToValue);    /*     * The stack pointer points to a ACPI_NAMESPACE_NODE (Node). Get the     * object that is attached to the Node.     */    Node       = *ObjectPtr;    SourceDesc = AcpiNsGetAttachedObject (Node);    EntryType  = AcpiNsGetType ((ACPI_HANDLE) Node);    ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Entry=%p SourceDesc=%p [%s]/n",         Node, SourceDesc, AcpiUtGetTypeName (EntryType)));    if ((EntryType == ACPI_TYPE_LOCAL_ALIAS) ||        (EntryType == ACPI_TYPE_LOCAL_METHOD_ALIAS))    {        /* There is always exactly one level of indirection */        Node       = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Node->Object);        SourceDesc = AcpiNsGetAttachedObject (Node);        EntryType  = AcpiNsGetType ((ACPI_HANDLE) Node);        *ObjectPtr = Node;    }    /*     * Several object types require no further processing:     * 1) Device/Thermal objects don't have a "real" subobject, return the Node     * 2) Method locals and arguments have a pseudo-Node     * 3) 10/2007: Added method type to assist with Package construction.     */    if ((EntryType == ACPI_TYPE_DEVICE)  ||        (EntryType == ACPI_TYPE_THERMAL) ||        (EntryType == ACPI_TYPE_METHOD)  ||        (Node->Flags & (ANOBJ_METHOD_ARG | ANOBJ_METHOD_LOCAL)))    {        return_ACPI_STATUS (AE_OK);    }    if (!SourceDesc)    {        ACPI_ERROR ((AE_INFO, "No object attached to node %p",            Node));        return_ACPI_STATUS (AE_AML_NO_OPERAND);    }    /*     * Action is based on the type of the Node, which indicates the type     * of the attached object or pointer     */    switch (EntryType)    {    case ACPI_TYPE_PACKAGE:        if (SourceDesc->Common.Type != ACPI_TYPE_PACKAGE)        {            ACPI_ERROR ((AE_INFO, "Object not a Package, type %s",                AcpiUtGetObjectTypeName (SourceDesc)));            return_ACPI_STATUS (AE_AML_OPERAND_TYPE);        }        Status = AcpiDsGetPackageArguments (SourceDesc);        if (ACPI_SUCCESS (Status))        {            /* Return an additional reference to the object */            ObjDesc = SourceDesc;            AcpiUtAddReference (ObjDesc);        }        break;    case ACPI_TYPE_BUFFER:        if (SourceDesc->Common.Type != ACPI_TYPE_BUFFER)        {            ACPI_ERROR ((AE_INFO, "Object not a Buffer, type %s",                AcpiUtGetObjectTypeName (SourceDesc)));            return_ACPI_STATUS (AE_AML_OPERAND_TYPE);        }        Status = AcpiDsGetBufferArguments (SourceDesc);        if (ACPI_SUCCESS (Status))        {            /* Return an additional reference to the object */            ObjDesc = SourceDesc;//.........这里部分代码省略.........
开发者ID:cloudius-systems,项目名称:acpica,代码行数:101,


示例10: AcpiExOpcode_1A_0T_1R

ACPI_STATUSAcpiExOpcode_1A_0T_1R (    ACPI_WALK_STATE         *WalkState){    ACPI_OPERAND_OBJECT     **Operand = &WalkState->Operands[0];    ACPI_OPERAND_OBJECT     *TempDesc;    ACPI_OPERAND_OBJECT     *ReturnDesc = NULL;    ACPI_STATUS             Status = AE_OK;    UINT32                  Type;    UINT64                  Value;    ACPI_FUNCTION_TRACE_STR (ExOpcode_1A_0T_1R,        AcpiPsGetOpcodeName (WalkState->Opcode));    /* Examine the AML opcode */    switch (WalkState->Opcode)    {    case AML_LNOT_OP:               /* LNot (Operand) */        ReturnDesc = AcpiUtCreateIntegerObject ((UINT64) 0);        if (!ReturnDesc)        {            Status = AE_NO_MEMORY;            goto Cleanup;        }        /*         * Set result to ONES (TRUE) if Value == 0. Note:         * ReturnDesc->Integer.Value is initially == 0 (FALSE) from above.         */        if (!Operand[0]->Integer.Value)        {            ReturnDesc->Integer.Value = ACPI_UINT64_MAX;        }        break;    case AML_DECREMENT_OP:          /* Decrement (Operand)  */    case AML_INCREMENT_OP:          /* Increment (Operand)  */        /*         * Create a new integer. Can't just get the base integer and         * increment it because it may be an Arg or Field.         */        ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);        if (!ReturnDesc)        {            Status = AE_NO_MEMORY;            goto Cleanup;        }        /*         * Since we are expecting a Reference operand, it can be either a         * NS Node or an internal object.         */        TempDesc = Operand[0];        if (ACPI_GET_DESCRIPTOR_TYPE (TempDesc) == ACPI_DESC_TYPE_OPERAND)        {            /* Internal reference object - prevent deletion */            AcpiUtAddReference (TempDesc);        }        /*         * Convert the Reference operand to an Integer (This removes a         * reference on the Operand[0] object)         *         * NOTE:  We use LNOT_OP here in order to force resolution of the         * reference operand to an actual integer.         */        Status = AcpiExResolveOperands (AML_LNOT_OP, &TempDesc, WalkState);        if (ACPI_FAILURE (Status))        {            ACPI_EXCEPTION ((AE_INFO, Status,                "While resolving operands for [%s]",                AcpiPsGetOpcodeName (WalkState->Opcode)));            goto Cleanup;        }        /*         * TempDesc is now guaranteed to be an Integer object --         * Perform the actual increment or decrement         */        if (WalkState->Opcode == AML_INCREMENT_OP)        {            ReturnDesc->Integer.Value = TempDesc->Integer.Value + 1;        }        else        {            ReturnDesc->Integer.Value = TempDesc->Integer.Value - 1;        }        /* Finished with this Integer object */        AcpiUtRemoveReference (TempDesc);        /*         * Store the result back (indirectly) through the original//.........这里部分代码省略.........
开发者ID:jaredmcneill,项目名称:freebsd,代码行数:101,


示例11: AcpiPsxExecute

ACPI_STATUSAcpiPsxExecute (    ACPI_NAMESPACE_NODE     *MethodNode,    ACPI_OPERAND_OBJECT     **Params,    ACPI_OPERAND_OBJECT     **ReturnObjDesc){    ACPI_STATUS             Status;    ACPI_OPERAND_OBJECT     *ObjDesc;    UINT32                  i;    ACPI_PARSE_OBJECT       *Op;    ACPI_WALK_STATE         *WalkState;    ACPI_FUNCTION_TRACE ("PsxExecute");    /* Validate the Node and get the attached object */    if (!MethodNode)    {        return_ACPI_STATUS (AE_NULL_ENTRY);    }    ObjDesc = AcpiNsGetAttachedObject (MethodNode);    if (!ObjDesc)    {        return_ACPI_STATUS (AE_NULL_OBJECT);    }    /* Init for new method, wait on concurrency semaphore */    Status = AcpiDsBeginMethodExecution (MethodNode, ObjDesc, NULL);    if (ACPI_FAILURE (Status))    {        return_ACPI_STATUS (Status);    }    if (Params)    {        /*         * The caller "owns" the parameters, so give each one an extra         * reference         */        for (i = 0; Params[i]; i++)        {            AcpiUtAddReference (Params[i]);        }    }    /*     * 1) Perform the first pass parse of the method to enter any     * named objects that it creates into the namespace     */    ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,        "**** Begin Method Parse **** Entry=%p obj=%p/n",        MethodNode, ObjDesc));    /* Create and init a Root Node */    Op = AcpiPsCreateScopeOp ();    if (!Op)    {        return_ACPI_STATUS (AE_NO_MEMORY);    }    /*     * Get a new OwnerId for objects created by this method.  Namespace     * objects (such as Operation Regions) can be created during the     * first pass parse.     */    ObjDesc->Method.OwningId = AcpiUtAllocateOwnerId (ACPI_OWNER_TYPE_METHOD);    /* Create and initialize a new walk state */    WalkState = AcpiDsCreateWalkState (ObjDesc->Method.OwningId,                                    NULL, NULL, NULL);    if (!WalkState)    {        return_ACPI_STATUS (AE_NO_MEMORY);    }    Status = AcpiDsInitAmlWalk (WalkState, Op, MethodNode, ObjDesc->Method.AmlStart,                    ObjDesc->Method.AmlLength, NULL, NULL, 1);    if (ACPI_FAILURE (Status))    {        AcpiDsDeleteWalkState (WalkState);        return_ACPI_STATUS (Status);    }    /* Parse the AML */    Status = AcpiPsParseAml (WalkState);    AcpiPsDeleteParseTree (Op);    /*     * 2) Execute the method.  Performs second pass parse simultaneously     */    ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,        "**** Begin Method Execution **** Entry=%p obj=%p/n",        MethodNode, ObjDesc));//.........这里部分代码省略.........
开发者ID:UnitedMarsupials,项目名称:kame,代码行数:101,


示例12: AcpiDsMethodDataGetValue

ACPI_STATUSAcpiDsMethodDataGetValue (    UINT16                  Opcode,    UINT32                  Index,    ACPI_WALK_STATE         *WalkState,    ACPI_OPERAND_OBJECT     **DestDesc){    ACPI_STATUS             Status;    ACPI_OPERAND_OBJECT     **Entry;    ACPI_OPERAND_OBJECT     *Object;    FUNCTION_TRACE ("DsMethodDataGetValue");    /* Validate the object descriptor */    if (!DestDesc)    {        ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null object descriptor pointer/n"));        return_ACPI_STATUS (AE_BAD_PARAMETER);    }    /* Get a pointer to the requested method stack entry */    Status = AcpiDsMethodDataGetEntry (Opcode, Index, WalkState, &Entry);    if (ACPI_FAILURE (Status))    {        return_ACPI_STATUS (Status);    }    /* Get the object from the method stack */    Object = *Entry;    /* Examine the returned object, it must be valid. */    if (!Object)    {        /*         * Index points to uninitialized object stack value.         * This means that either 1) The expected argument was         * not passed to the method, or 2) A local variable         * was referenced by the method (via the ASL)         * before it was initialized.  Either case is an error.         */        switch (Opcode)        {        case AML_ARG_OP:            ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Uninitialized Arg[%d] at entry %p/n",                               Index, Entry));            return_ACPI_STATUS (AE_AML_UNINITIALIZED_ARG);            break;        case AML_LOCAL_OP:            ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Uninitialized Local[%d] at entry %p/n",                               Index, Entry));            return_ACPI_STATUS (AE_AML_UNINITIALIZED_LOCAL);            break;        }    }    /*     * Index points to initialized and valid object stack value.     * Return an additional reference to the object     */    *DestDesc = Object;    AcpiUtAddReference (Object);    return_ACPI_STATUS (AE_OK);}
开发者ID:MarginC,项目名称:kame,代码行数:78,


示例13: AcpiExResolveObjectToValue

static ACPI_STATUSAcpiExResolveObjectToValue (    ACPI_OPERAND_OBJECT     **StackPtr,    ACPI_WALK_STATE         *WalkState){    ACPI_STATUS             Status = AE_OK;    ACPI_OPERAND_OBJECT     *StackDesc;    ACPI_OPERAND_OBJECT     *ObjDesc = NULL;    UINT8                   RefType;    ACPI_FUNCTION_TRACE (ExResolveObjectToValue);    StackDesc = *StackPtr;    /* This is an object of type ACPI_OPERAND_OBJECT */    switch (StackDesc->Common.Type)    {    case ACPI_TYPE_LOCAL_REFERENCE:        RefType = StackDesc->Reference.Class;        switch (RefType)        {        case ACPI_REFCLASS_LOCAL:        case ACPI_REFCLASS_ARG:            /*             * Get the local from the method's state info             * Note: this increments the local's object reference count             */            Status = AcpiDsMethodDataGetValue (RefType,                StackDesc->Reference.Value, WalkState, &ObjDesc);            if (ACPI_FAILURE (Status))            {                return_ACPI_STATUS (Status);            }            ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Arg/Local %X] ValueObj is %p/n",                StackDesc->Reference.Value, ObjDesc));            /*             * Now we can delete the original Reference Object and             * replace it with the resolved value             */            AcpiUtRemoveReference (StackDesc);            *StackPtr = ObjDesc;            break;        case ACPI_REFCLASS_INDEX:            switch (StackDesc->Reference.TargetType)            {            case ACPI_TYPE_BUFFER_FIELD:                /* Just return - do not dereference */                break;            case ACPI_TYPE_PACKAGE:                /* If method call or CopyObject - do not dereference */                if ((WalkState->Opcode == AML_INT_METHODCALL_OP) ||                    (WalkState->Opcode == AML_COPY_OBJECT_OP))                {                    break;                }                /* Otherwise, dereference the PackageIndex to a package element */                ObjDesc = *StackDesc->Reference.Where;                if (ObjDesc)                {                    /*                     * Valid object descriptor, copy pointer to return value                     * (i.e., dereference the package index)                     * Delete the ref object, increment the returned object                     */                    AcpiUtAddReference (ObjDesc);                    *StackPtr = ObjDesc;                }                else                {                    /*                     * A NULL object descriptor means an uninitialized element of                     * the package, can't dereference it                     */                    ACPI_ERROR ((AE_INFO,                        "Attempt to dereference an Index to "                        "NULL package element Idx=%p",                        StackDesc));                    Status = AE_AML_UNINITIALIZED_ELEMENT;                }                break;            default:                /* Invalid reference object *///.........这里部分代码省略.........
开发者ID:ChaiSoft,项目名称:ChaiOS,代码行数:101,


示例14: AcpiExOpcode_2A_1T_1R

//.........这里部分代码省略.........            ReturnDesc->Reference.TargetType = ACPI_TYPE_BUFFER_FIELD;            break;        case ACPI_TYPE_BUFFER:            if (Index >= Operand[0]->Buffer.Length)            {                Length = Operand[0]->Buffer.Length;                Status = AE_AML_BUFFER_LIMIT;            }            ReturnDesc->Reference.TargetType = ACPI_TYPE_BUFFER_FIELD;            break;        case ACPI_TYPE_PACKAGE:            if (Index >= Operand[0]->Package.Count)            {                Length = Operand[0]->Package.Count;                Status = AE_AML_PACKAGE_LIMIT;            }            ReturnDesc->Reference.TargetType = ACPI_TYPE_PACKAGE;            ReturnDesc->Reference.Where = &Operand[0]->Package.Elements [Index];            break;        default:            Status = AE_AML_INTERNAL;            goto Cleanup;        }        /* Failure means that the Index was beyond the end of the object */        if (ACPI_FAILURE (Status))        {            ACPI_EXCEPTION ((AE_INFO, Status,                "Index (0x%X%8.8X) is beyond end of object (length 0x%X)",                ACPI_FORMAT_UINT64 (Index), (UINT32) Length));            goto Cleanup;        }        /*         * Save the target object and add a reference to it for the life         * of the index         */        ReturnDesc->Reference.Object = Operand[0];        AcpiUtAddReference (Operand[0]);        /* Store the reference to the Target */        Status = AcpiExStore (ReturnDesc, Operand[2], WalkState);        /* Return the reference */        WalkState->ResultObj = ReturnDesc;        goto Cleanup;    default:        ACPI_ERROR ((AE_INFO, "Unknown AML opcode 0x%X",            WalkState->Opcode));        Status = AE_AML_BAD_OPCODE;        break;    }StoreResultToTarget:    if (ACPI_SUCCESS (Status))    {        /*         * Store the result of the operation (which is now in ReturnDesc) into         * the Target descriptor.         */        Status = AcpiExStore (ReturnDesc, Operand[2], WalkState);        if (ACPI_FAILURE (Status))        {            goto Cleanup;        }        if (!WalkState->ResultObj)        {            WalkState->ResultObj = ReturnDesc;        }    }Cleanup:    /* Delete return object on error */    if (ACPI_FAILURE (Status))    {        AcpiUtRemoveReference (ReturnDesc);        WalkState->ResultObj = NULL;    }    return_ACPI_STATUS (Status);}
开发者ID:LauraBerry,项目名称:A2cpsc457,代码行数:101,


示例15: AcpiExPrepFieldValue

//.........这里部分代码省略.........                {                    AcpiUtDeleteObjectDesc (ObjDesc);                    return_ACPI_STATUS (Status);                }            }            ObjDesc->Field.ResourceBuffer = SecondDesc->Buffer.Pointer;            ObjDesc->Field.ResourceLength = (UINT16) SecondDesc->Buffer.Length;        }        else if (Info->ResourceBuffer)        {            ObjDesc->Field.ResourceBuffer = Info->ResourceBuffer;            ObjDesc->Field.ResourceLength = Info->ResourceLength;        }        /* Allow full data read from EC address space */        if ((ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_EC) &&            (ObjDesc->CommonField.BitLength > 8))        {            AccessByteWidth = ACPI_ROUND_BITS_UP_TO_BYTES (                ObjDesc->CommonField.BitLength);            /* Maximum byte width supported is 255 */            if (AccessByteWidth < 256)            {                ObjDesc->CommonField.AccessByteWidth = (UINT8) AccessByteWidth;            }        }        /* An additional reference for the container */        AcpiUtAddReference (ObjDesc->Field.RegionObj);        ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,            "RegionField: BitOff %X, Off %X, Gran %X, Region %p/n",            ObjDesc->Field.StartFieldBitOffset, ObjDesc->Field.BaseByteOffset,            ObjDesc->Field.AccessByteWidth, ObjDesc->Field.RegionObj));        break;    case ACPI_TYPE_LOCAL_BANK_FIELD:        ObjDesc->BankField.Value = Info->BankValue;        ObjDesc->BankField.RegionObj =            AcpiNsGetAttachedObject (Info->RegionNode);        ObjDesc->BankField.BankObj =            AcpiNsGetAttachedObject (Info->RegisterNode);        /* An additional reference for the attached objects */        AcpiUtAddReference (ObjDesc->BankField.RegionObj);        AcpiUtAddReference (ObjDesc->BankField.BankObj);        ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,            "Bank Field: BitOff %X, Off %X, Gran %X, Region %p, BankReg %p/n",            ObjDesc->BankField.StartFieldBitOffset,            ObjDesc->BankField.BaseByteOffset,            ObjDesc->Field.AccessByteWidth,            ObjDesc->BankField.RegionObj,            ObjDesc->BankField.BankObj));        /*         * Remember location in AML stream of the field unit         * opcode and operands -- since the BankValue         * operands must be evaluated.
开发者ID:CSharpLover,项目名称:MosquitOS,代码行数:67,


示例16: AcpiDsMethodDataGetValue

ACPI_STATUSAcpiDsMethodDataGetValue (    UINT8                   Type,    UINT32                  Index,    ACPI_WALK_STATE         *WalkState,    ACPI_OPERAND_OBJECT     **DestDesc){    ACPI_STATUS             Status;    ACPI_NAMESPACE_NODE     *Node;    ACPI_OPERAND_OBJECT     *Object;    ACPI_FUNCTION_TRACE (DsMethodDataGetValue);    /* Validate the object descriptor */    if (!DestDesc)    {        ACPI_ERROR ((AE_INFO, "Null object descriptor pointer"));        return_ACPI_STATUS (AE_BAD_PARAMETER);    }    /* Get the namespace node for the arg/local */    Status = AcpiDsMethodDataGetNode (Type, Index, WalkState, &Node);    if (ACPI_FAILURE (Status))    {        return_ACPI_STATUS (Status);    }    /* Get the object from the node */    Object = Node->Object;    /* Examine the returned object, it must be valid. */    if (!Object)    {        /*         * Index points to uninitialized object.         * This means that either 1) The expected argument was         * not passed to the method, or 2) A local variable         * was referenced by the method (via the ASL)         * before it was initialized.  Either case is an error.         */        /* If slack enabled, init the LocalX/ArgX to an Integer of value zero */        if (AcpiGbl_EnableInterpreterSlack)        {            Object = AcpiUtCreateIntegerObject ((UINT64) 0);            if (!Object)            {                return_ACPI_STATUS (AE_NO_MEMORY);            }            Node->Object = Object;        }        /* Otherwise, return the error */        else switch (Type)        {        case ACPI_REFCLASS_ARG:            ACPI_ERROR ((AE_INFO,                "Uninitialized Arg[%u] at node %p",                Index, Node));            return_ACPI_STATUS (AE_AML_UNINITIALIZED_ARG);        case ACPI_REFCLASS_LOCAL:            /*             * No error message for this case, will be trapped again later to             * detect and ignore cases of Store(LocalX,LocalX)             */            return_ACPI_STATUS (AE_AML_UNINITIALIZED_LOCAL);        default:            ACPI_ERROR ((AE_INFO, "Not a Arg/Local opcode: 0x%X", Type));            return_ACPI_STATUS (AE_AML_INTERNAL);        }    }    /*     * The Index points to an initialized and valid object.     * Return an additional reference to the object     */    *DestDesc = Object;    AcpiUtAddReference (Object);    return_ACPI_STATUS (AE_OK);}
开发者ID:ksashtekar,项目名称:Ganoid,代码行数:96,


示例17: 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,


示例18: AcpiNsExecModuleCode

static voidAcpiNsExecModuleCode (    ACPI_OPERAND_OBJECT     *MethodObj,    ACPI_EVALUATE_INFO      *Info){    ACPI_OPERAND_OBJECT     *ParentObj;    ACPI_NAMESPACE_NODE     *ParentNode;    ACPI_OBJECT_TYPE        Type;    ACPI_STATUS             Status;    ACPI_FUNCTION_TRACE (NsExecModuleCode);    /*     * Get the parent node. We cheat by using the NextObject field     * of the method object descriptor.     */    ParentNode = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE,                    MethodObj->Method.NextObject);    Type = AcpiNsGetType (ParentNode);    /*     * Get the region handler and save it in the method object. We may need     * this if an operation region declaration causes a _REG method to be run.     *     * We can't do this in AcpiPsLinkModuleCode because     * AcpiGbl_RootNode->Object is NULL at PASS1.     */    if ((Type == ACPI_TYPE_DEVICE) && ParentNode->Object)    {        MethodObj->Method.Dispatch.Handler =            ParentNode->Object->Device.Handler;    }    /* Must clear NextObject (AcpiNsAttachObject needs the field) */    MethodObj->Method.NextObject = NULL;    /* Initialize the evaluation information block */    ACPI_MEMSET (Info, 0, sizeof (ACPI_EVALUATE_INFO));    Info->PrefixNode = ParentNode;    /*     * Get the currently attached parent object. Add a reference, because the     * ref count will be decreased when the method object is installed to     * the parent node.     */    ParentObj = AcpiNsGetAttachedObject (ParentNode);    if (ParentObj)    {        AcpiUtAddReference (ParentObj);    }    /* Install the method (module-level code) in the parent node */    Status = AcpiNsAttachObject (ParentNode, MethodObj,                ACPI_TYPE_METHOD);    if (ACPI_FAILURE (Status))    {        goto Exit;    }    /* Execute the parent node as a control method */    Status = AcpiNsEvaluate (Info);    ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "Executed module-level code at %p/n",        MethodObj->Method.AmlStart));    /* Delete a possible implicit return value (in slack mode) */    if (Info->ReturnObject)    {        AcpiUtRemoveReference (Info->ReturnObject);    }    /* Detach the temporary method object */    AcpiNsDetachObject (ParentNode);    /* Restore the original parent object */    if (ParentObj)    {        Status = AcpiNsAttachObject (ParentNode, ParentObj, Type);    }    else    {        ParentNode->Type = (UINT8) Type;    }Exit:    if (ParentObj)    {        AcpiUtRemoveReference (ParentObj);    }    return_VOID;}
开发者ID:LauraBerry,项目名称:A2cpsc457,代码行数:100,


示例19: AcpiExResolveObjectToValue

//.........这里部分代码省略.........        case AML_ONES_OP:            StackDesc->Common.Type = (UINT8) ACPI_TYPE_INTEGER;            StackDesc->Integer.Value = ACPI_INTEGER_MAX;            /* Truncate value if we are executing from a 32-bit ACPI table */            AcpiExTruncateFor32bitTable (StackDesc, WalkState);            break;        case AML_INDEX_OP:            switch (StackDesc->Reference.TargetType)            {            case ACPI_TYPE_BUFFER_FIELD:                /* Just return - leave the Reference on the stack */                break;            case ACPI_TYPE_PACKAGE:                ObjDesc = *StackDesc->Reference.Where;                if (ObjDesc)                {                    /*                     * Valid obj descriptor, copy pointer to return value                     * (i.e., dereference the package index)                     * Delete the ref object, increment the returned object                     */                    AcpiUtRemoveReference (StackDesc);                    AcpiUtAddReference (ObjDesc);                    *StackPtr = ObjDesc;                }                else                {                    /*                     * A NULL object descriptor means an unitialized element of                     * the package, can't dereference it                     */                    ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,                        "Attempt to deref an Index to NULL pkg element Idx=%p/n",                        StackDesc));                    Status = AE_AML_UNINITIALIZED_ELEMENT;                }                break;            default:                /* Invalid reference object */                ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,                    "Unknown TargetType %X in Index/Reference obj %p/n",                    StackDesc->Reference.TargetType, StackDesc));                Status = AE_AML_INTERNAL;                break;            }            break;        case AML_DEBUG_OP:            /* Just leave the object as-is */
开发者ID:MarginC,项目名称:kame,代码行数:67,


示例20: AcpiExOpcode_1A_1T_1R

//.........这里部分代码省略.........        /* It is possible that the Store already produced a return object */        if (!WalkState->ResultObj)        {            /*             * Normally, we would remove a reference on the Operand[0]             * parameter; But since it is being used as the internal return             * object (meaning we would normally increment it), the two             * cancel out, and we simply don't do anything.             */            WalkState->ResultObj = Operand[0];            WalkState->Operands[0] = NULL;  /* Prevent deletion */        }        return_ACPI_STATUS (Status);    /*     * ACPI 2.0 Opcodes     */    case AML_COPY_OP:               /* Copy (Source, Target) */        Status = AcpiUtCopyIobjectToIobject (            Operand[0], &ReturnDesc, WalkState);        break;    case AML_TO_DECSTRING_OP:       /* ToDecimalString (Data, Result) */        Status = AcpiExConvertToString (            Operand[0], &ReturnDesc, ACPI_EXPLICIT_CONVERT_DECIMAL);        if (ReturnDesc == Operand[0])        {            /* No conversion performed, add ref to handle return value */            AcpiUtAddReference (ReturnDesc);        }        break;    case AML_TO_HEXSTRING_OP:       /* ToHexString (Data, Result) */        Status = AcpiExConvertToString (            Operand[0], &ReturnDesc, ACPI_EXPLICIT_CONVERT_HEX);        if (ReturnDesc == Operand[0])        {            /* No conversion performed, add ref to handle return value */            AcpiUtAddReference (ReturnDesc);        }        break;    case AML_TO_BUFFER_OP:          /* ToBuffer (Data, Result) */        Status = AcpiExConvertToBuffer (Operand[0], &ReturnDesc);        if (ReturnDesc == Operand[0])        {            /* No conversion performed, add ref to handle return value */            AcpiUtAddReference (ReturnDesc);        }        break;    case AML_TO_INTEGER_OP:         /* ToInteger (Data, Result) */        /* Perform "explicit" conversion */        Status = AcpiExConvertToInteger (Operand[0], &ReturnDesc, 0);        if (ReturnDesc == Operand[0])
开发者ID:jaredmcneill,项目名称:freebsd,代码行数:67,


示例21: AcpiNsAttachObject

//.........这里部分代码省略.........        ACPI_ERROR ((AE_INFO,            "Null object, but type not ACPI_TYPE_ANY"));        return_ACPI_STATUS (AE_BAD_PARAMETER);    }    if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED)    {        /* Not a name handle */        ACPI_ERROR ((AE_INFO, "Invalid handle %p [%s]",            Node, AcpiUtGetDescriptorName (Node)));        return_ACPI_STATUS (AE_BAD_PARAMETER);    }    /* Check if this object is already attached */    if (Node->Object == Object)    {        ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,            "Obj %p already installed in NameObj %p/n",            Object, Node));        return_ACPI_STATUS (AE_OK);    }    /* If null object, we will just install it */    if (!Object)    {        ObjDesc    = NULL;        ObjectType = ACPI_TYPE_ANY;    }    /*     * If the source object is a namespace Node with an attached object,     * we will use that (attached) object     */    else if ((ACPI_GET_DESCRIPTOR_TYPE (Object) == ACPI_DESC_TYPE_NAMED) &&            ((ACPI_NAMESPACE_NODE *) Object)->Object)    {        /*         * Value passed is a name handle and that name has a         * non-null value. Use that name's value and type.         */        ObjDesc = ((ACPI_NAMESPACE_NODE *) Object)->Object;        ObjectType = ((ACPI_NAMESPACE_NODE *) Object)->Type;    }    /*     * Otherwise, we will use the parameter object, but we must type     * it first     */    else    {        ObjDesc = (ACPI_OPERAND_OBJECT  *) Object;        /* Use the given type */        ObjectType = Type;    }    ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Installing %p into Node %p [%4.4s]/n",        ObjDesc, Node, AcpiUtGetNodeName (Node)));    /* Detach an existing attached object if present */    if (Node->Object)    {        AcpiNsDetachObject (Node);    }    if (ObjDesc)    {        /*         * Must increment the new value's reference count         * (if it is an internal object)         */        AcpiUtAddReference (ObjDesc);        /*         * Handle objects with multiple descriptors - walk         * to the end of the descriptor list         */        LastObjDesc = ObjDesc;        while (LastObjDesc->Common.NextObject)        {            LastObjDesc = LastObjDesc->Common.NextObject;        }        /* Install the object at the front of the object list */        LastObjDesc->Common.NextObject = Node->Object;    }    Node->Type = (UINT8) ObjectType;    Node->Object = ObjDesc;    return_ACPI_STATUS (AE_OK);}
开发者ID:ahs3,项目名称:acpica-tools,代码行数:101,


示例22: AcpiDsBuildInternalPackageObj

//.........这里部分代码省略.........    for (i = 0; Arg && (i < ElementCount); i++)    {        if (Arg->Common.AmlOpcode == AML_INT_RETURN_VALUE_OP)        {            if (Arg->Common.Node->Type == ACPI_TYPE_METHOD)            {                /*                 * A method reference "looks" to the parser to be a method                 * invocation, so we special case it here                 */                Arg->Common.AmlOpcode = AML_INT_NAMEPATH_OP;                Status = AcpiDsBuildInternalObject (WalkState, Arg,                            &ObjDesc->Package.Elements[i]);            }            else            {                /* This package element is already built, just get it */                ObjDesc->Package.Elements[i] =                    ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Arg->Common.Node);            }        }        else        {            Status = AcpiDsBuildInternalObject (WalkState, Arg,                        &ObjDesc->Package.Elements[i]);        }        if (*ObjDescPtr)        {            /* Existing package, get existing reference count */            ReferenceCount = (*ObjDescPtr)->Common.ReferenceCount;            if (ReferenceCount > 1)            {                /* Make new element ref count match original ref count */                for (Index = 0; Index < (ReferenceCount - 1); Index++)                {                    AcpiUtAddReference ((ObjDesc->Package.Elements[i]));                }            }        }        Arg = Arg->Common.Next;    }    /* Check for match between NumElements and actual length of PackageList */    if (Arg)    {        /*         * NumElements was exhausted, but there are remaining elements in the         * PackageList. Truncate the package to NumElements.         *         * Note: technically, this is an error, from ACPI spec: "It is an error         * for NumElements to be less than the number of elements in the         * PackageList". However, we just print a message and         * no exception is returned. This provides Windows compatibility. Some         * BIOSs will alter the NumElements on the fly, creating this type         * of ill-formed package object.         */        while (Arg)        {            /*             * We must delete any package elements that were created earlier             * and are not going to be used because of the package truncation.             */            if (Arg->Common.Node)            {                AcpiUtRemoveReference (                    ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Arg->Common.Node));                Arg->Common.Node = NULL;            }            /* Find out how many elements there really are */            i++;            Arg = Arg->Common.Next;        }        ACPI_INFO ((AE_INFO,            "Actual Package length (%u) is larger than NumElements field (%u), truncated",            i, ElementCount));    }    else if (i < ElementCount)    {        /*         * Arg list (elements) was exhausted, but we did not reach NumElements count.         * Note: this is not an error, the package is padded out with NULLs.         */        ACPI_DEBUG_PRINT ((ACPI_DB_INFO,            "Package List length (%u) smaller than NumElements count (%u), padded with null elements/n",            i, ElementCount));    }    ObjDesc->Package.Flags |= AOPOBJ_DATA_VALID;    Op->Common.Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, ObjDesc);    return_ACPI_STATUS (Status);}
开发者ID:ornarium,项目名称:freebsd,代码行数:101,


示例23: AcpiInstallNotifyHandler

//.........这里部分代码省略.........        {            AcpiGbl_DeviceNotify.Node    = Node;            AcpiGbl_DeviceNotify.Handler = Handler;            AcpiGbl_DeviceNotify.Context = Context;        }        /* Global notify handler installed */    }    /*     * All Other Objects:     * Caller will only receive notifications specific to the target object.     * Note that only certain object types can receive notifications.     */    else    {        /* Notifies allowed on this object? */        if (!AcpiEvIsNotifyObject (Node))        {            Status = AE_TYPE;            goto UnlockAndExit;        }        /* Check for an existing internal object */        ObjDesc = AcpiNsGetAttachedObject (Node);        if (ObjDesc)        {            /* Object exists - make sure there's no handler */            if (((HandlerType & ACPI_SYSTEM_NOTIFY) &&                    ObjDesc->CommonNotify.SystemNotify)   ||                ((HandlerType & ACPI_DEVICE_NOTIFY) &&                    ObjDesc->CommonNotify.DeviceNotify))            {                Status = AE_ALREADY_EXISTS;                goto UnlockAndExit;            }        }        else        {            /* Create a new object */            ObjDesc = AcpiUtCreateInternalObject (Node->Type);            if (!ObjDesc)            {                Status = AE_NO_MEMORY;                goto UnlockAndExit;            }            /* Attach new object to the Node */            Status = AcpiNsAttachObject (Device, ObjDesc, Node->Type);            /* Remove local reference to the object */            AcpiUtRemoveReference (ObjDesc);            if (ACPI_FAILURE (Status))            {                goto UnlockAndExit;            }        }        /* Install the handler */        NotifyObj = AcpiUtCreateInternalObject (ACPI_TYPE_LOCAL_NOTIFY);        if (!NotifyObj)        {            Status = AE_NO_MEMORY;            goto UnlockAndExit;        }        NotifyObj->Notify.Node    = Node;        NotifyObj->Notify.Handler = Handler;        NotifyObj->Notify.Context = Context;        if (HandlerType & ACPI_SYSTEM_NOTIFY)        {            ObjDesc->CommonNotify.SystemNotify = NotifyObj;        }        if (HandlerType & ACPI_DEVICE_NOTIFY)        {            ObjDesc->CommonNotify.DeviceNotify = NotifyObj;        }        if (HandlerType == ACPI_ALL_NOTIFY)        {            /* Extra ref if installed in both */            AcpiUtAddReference (NotifyObj);        }    }UnlockAndExit:    (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);    return_ACPI_STATUS (Status);}
开发者ID:oza,项目名称:FreeBSD-7.3-dyntick,代码行数:101,


示例24: AcpiExStoreObjectToIndex

static ACPI_STATUSAcpiExStoreObjectToIndex (    ACPI_OPERAND_OBJECT     *SourceDesc,    ACPI_OPERAND_OBJECT     *IndexDesc,    ACPI_WALK_STATE         *WalkState){    ACPI_STATUS             Status = AE_OK;    ACPI_OPERAND_OBJECT     *ObjDesc;    ACPI_OPERAND_OBJECT     *NewDesc;    UINT8                   Value = 0;    UINT32                  i;    ACPI_FUNCTION_TRACE (ExStoreObjectToIndex);    /*     * Destination must be a reference pointer, and     * must point to either a buffer or a package     */    switch (IndexDesc->Reference.TargetType)    {    case ACPI_TYPE_PACKAGE:        /*         * Storing to a package element. Copy the object and replace         * any existing object with the new object. No implicit         * conversion is performed.         *         * The object at *(IndexDesc->Reference.Where) is the         * element within the package that is to be modified.         * The parent package object is at IndexDesc->Reference.Object         */        ObjDesc = *(IndexDesc->Reference.Where);        if (SourceDesc->Common.Type == ACPI_TYPE_LOCAL_REFERENCE &&            SourceDesc->Reference.Class == ACPI_REFCLASS_TABLE)        {            /* This is a DDBHandle, just add a reference to it */            AcpiUtAddReference (SourceDesc);            NewDesc = SourceDesc;        }        else        {            /* Normal object, copy it */            Status = AcpiUtCopyIobjectToIobject (SourceDesc, &NewDesc, WalkState);            if (ACPI_FAILURE (Status))            {                return_ACPI_STATUS (Status);            }        }        if (ObjDesc)        {            /* Decrement reference count by the ref count of the parent package */            for (i = 0;                 i < ((ACPI_OPERAND_OBJECT *)                        IndexDesc->Reference.Object)->Common.ReferenceCount;                 i++)            {                AcpiUtRemoveReference (ObjDesc);            }        }        *(IndexDesc->Reference.Where) = NewDesc;        /* Increment ref count by the ref count of the parent package-1 */        for (i = 1;             i < ((ACPI_OPERAND_OBJECT *)                    IndexDesc->Reference.Object)->Common.ReferenceCount;             i++)        {            AcpiUtAddReference (NewDesc);        }        break;    case ACPI_TYPE_BUFFER_FIELD:        /*         * Store into a Buffer or String (not actually a real BufferField)         * at a location defined by an Index.         *         * The first 8-bit element of the source object is written to the         * 8-bit Buffer location defined by the Index destination object,         * according to the ACPI 2.0 specification.         */        /*         * Make sure the target is a Buffer or String. An error should         * not happen here, since the ReferenceObject was constructed         * by the INDEX_OP code.         */        ObjDesc = IndexDesc->Reference.Object;        if ((ObjDesc->Common.Type != ACPI_TYPE_BUFFER) &&            (ObjDesc->Common.Type != ACPI_TYPE_STRING))        {            return_ACPI_STATUS (AE_AML_OPERAND_TYPE);//.........这里部分代码省略.........
开发者ID:JasonFord53,项目名称:freebsd,代码行数:101,


示例25: AcpiDsBuildInternalPackageObj

ACPI_STATUSAcpiDsBuildInternalPackageObj (    ACPI_WALK_STATE         *WalkState,    ACPI_PARSE_OBJECT       *Op,    UINT32                  ElementCount,    ACPI_OPERAND_OBJECT     **ObjDescPtr){    ACPI_PARSE_OBJECT       *Arg;    ACPI_PARSE_OBJECT       *Parent;    ACPI_OPERAND_OBJECT     *ObjDesc = NULL;    ACPI_STATUS             Status = AE_OK;    ACPI_NATIVE_UINT        i;    UINT16                  Index;    UINT16                  ReferenceCount;    ACPI_FUNCTION_TRACE (DsBuildInternalPackageObj);    /* Find the parent of a possibly nested package */    Parent = Op->Common.Parent;    while ((Parent->Common.AmlOpcode == AML_PACKAGE_OP) ||           (Parent->Common.AmlOpcode == AML_VAR_PACKAGE_OP))    {        Parent = Parent->Common.Parent;    }    /*     * If we are evaluating a Named package object "Name (xxxx, Package)",     * the package object already exists, otherwise it must be created.     */    ObjDesc = *ObjDescPtr;    if (!ObjDesc)    {        ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_PACKAGE);        *ObjDescPtr = ObjDesc;        if (!ObjDesc)        {            return_ACPI_STATUS (AE_NO_MEMORY);        }        ObjDesc->Package.Node = Parent->Common.Node;    }    /*     * Allocate the element array (array of pointers to the individual     * objects) based on the NumElements parameter. Add an extra pointer slot     * so that the list is always null terminated.     */    ObjDesc->Package.Elements = ACPI_ALLOCATE_ZEROED (        ((ACPI_SIZE) ElementCount + 1) * sizeof (void *));    if (!ObjDesc->Package.Elements)    {        AcpiUtDeleteObjectDesc (ObjDesc);        return_ACPI_STATUS (AE_NO_MEMORY);    }    ObjDesc->Package.Count = ElementCount;    /*     * Initialize the elements of the package, up to the NumElements count.     * Package is automatically padded with uninitialized (NULL) elements     * if NumElements is greater than the package list length. Likewise,     * Package is truncated if NumElements is less than the list length.     */    Arg = Op->Common.Value.Arg;    Arg = Arg->Common.Next;    for (i = 0; Arg && (i < ElementCount); i++)    {        if (Arg->Common.AmlOpcode == AML_INT_RETURN_VALUE_OP)        {            /* This package element is already built, just get it */            ObjDesc->Package.Elements[i] =                ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Arg->Common.Node);        }        else        {            Status = AcpiDsBuildInternalObject (WalkState, Arg,                        &ObjDesc->Package.Elements[i]);        }        if (*ObjDescPtr)        {            /* Existing package, get existing reference count */            ReferenceCount = (*ObjDescPtr)->Common.ReferenceCount;            if (ReferenceCount > 1)            {                /* Make new element ref count match original ref count */                for (Index = 0; Index < (ReferenceCount - 1); Index++)                {                    AcpiUtAddReference ((ObjDesc->Package.Elements[i]));                }            }        }//.........这里部分代码省略.........
开发者ID:oza,项目名称:FreeBSD-7.3-dyntick,代码行数:101,



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


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