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

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

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

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

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

示例1: AcpiDbReadTable

//.........这里部分代码省略.........                sizeof (ACPI_TABLE_HEADER))        {            AcpiOsPrintf ("Could not read the table header/n");            return (AE_BAD_HEADER);        }#if 0        /* Validate the table header/length */        Status = AcpiTbValidateTableHeader (&TableHeader);        if (ACPI_FAILURE (Status))        {            AcpiOsPrintf ("Table header is invalid!/n");            return (Status);        }#endif        /* File size must be at least as long as the Header-specified length */        if (TableHeader.Length > FileSize)        {            AcpiOsPrintf (                "TableHeader length [0x%X] greater than the input file size [0x%X]/n",                TableHeader.Length, FileSize);#ifdef ACPI_ASL_COMPILER            Status = FlCheckForAscii (fp, NULL, FALSE);            if (ACPI_SUCCESS (Status))            {                AcpiOsPrintf ("File appears to be ASCII only, must be binary/n",                    TableHeader.Length, FileSize);            }#endif            return (AE_BAD_HEADER);        }#ifdef ACPI_OBSOLETE_CODE        /* We only support a limited number of table types */        if (!ACPI_COMPARE_NAME ((char *) TableHeader.Signature, ACPI_SIG_DSDT) &&            !ACPI_COMPARE_NAME ((char *) TableHeader.Signature, ACPI_SIG_PSDT) &&            !ACPI_COMPARE_NAME ((char *) TableHeader.Signature, ACPI_SIG_SSDT))        {            AcpiOsPrintf ("Table signature [%4.4s] is invalid or not supported/n",                (char *) TableHeader.Signature);            ACPI_DUMP_BUFFER (&TableHeader, sizeof (ACPI_TABLE_HEADER));            return (AE_ERROR);        }#endif        *TableLength = TableHeader.Length;    }    /* Allocate a buffer for the table */    *Table = AcpiOsAllocate ((size_t) FileSize);    if (!*Table)    {        AcpiOsPrintf (            "Could not allocate memory for ACPI table %4.4s (size=0x%X)/n",            TableHeader.Signature, *TableLength);        return (AE_NO_MEMORY);    }    /* Get the rest of the table */    fseek (fp, 0, SEEK_SET);    Actual = fread (*Table, 1, (size_t) FileSize, fp);    if (Actual == FileSize)    {        if (StandardHeader)        {            /* Now validate the checksum */            Status = AcpiTbVerifyChecksum ((void *) *Table,                        ACPI_CAST_PTR (ACPI_TABLE_HEADER, *Table)->Length);            if (Status == AE_BAD_CHECKSUM)            {                Status = AcpiDbCheckTextModeCorruption ((UINT8 *) *Table,                            FileSize, (*Table)->Length);                return (Status);            }        }        return (AE_OK);    }    if (Actual > 0)    {        AcpiOsPrintf ("Warning - reading table, asked for %X got %X/n",            FileSize, Actual);        return (AE_OK);    }    AcpiOsPrintf ("Error - could not read the table file/n");    AcpiOsFree (*Table);    *Table = NULL;    *TableLength = 0;    return (AE_ERROR);}
开发者ID:cloudius-systems,项目名称:acpica,代码行数:101,


示例2: 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 */    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_NAMES,        "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:ycui1984,项目名称:netbsd-src,代码行数:100,


示例3: AcpiExLoadTableOp

//.........这里部分代码省略.........        DdbHandle = AcpiUtCreateIntegerObject ((UINT64) 0);        if (!DdbHandle)        {            return_ACPI_STATUS (AE_NO_MEMORY);        }        *ReturnDesc = DdbHandle;        return_ACPI_STATUS (AE_OK);    }    /* Default nodes */    StartNode = WalkState->ScopeInfo->Scope.Node;    ParentNode = AcpiGbl_RootNode;    /* RootPath (optional parameter) */    if (Operand[3]->String.Length > 0)    {        /*         * Find the node referenced by the RootPathString.  This is the         * location within the namespace where the table will be loaded.         */        Status = AcpiNsGetNode (StartNode, Operand[3]->String.Pointer,                    ACPI_NS_SEARCH_PARENT, &ParentNode);        if (ACPI_FAILURE (Status))        {            return_ACPI_STATUS (Status);        }    }    /* ParameterPath (optional parameter) */    if (Operand[4]->String.Length > 0)    {        if ((Operand[4]->String.Pointer[0] != '//') &&            (Operand[4]->String.Pointer[0] != '^'))        {            /*             * Path is not absolute, so it will be relative to the node             * referenced by the RootPathString (or the NS root if omitted)             */            StartNode = ParentNode;        }        /* Find the node referenced by the ParameterPathString */        Status = AcpiNsGetNode (StartNode, Operand[4]->String.Pointer,                    ACPI_NS_SEARCH_PARENT, &ParameterNode);        if (ACPI_FAILURE (Status))        {            return_ACPI_STATUS (Status);        }    }    /* Load the table into the namespace */    Status = AcpiExAddTable (TableIndex, ParentNode, &DdbHandle);    if (ACPI_FAILURE (Status))    {        return_ACPI_STATUS (Status);    }    /* Parameter Data (optional) */    if (ParameterNode)    {        /* Store the parameter data into the optional parameter object */        Status = AcpiExStore (Operand[5],                    ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, ParameterNode),                    WalkState);        if (ACPI_FAILURE (Status))        {            (void) AcpiExUnloadTable (DdbHandle);            AcpiUtRemoveReference (DdbHandle);            return_ACPI_STATUS (Status);        }    }    Status = AcpiGetTableByIndex (TableIndex, &Table);    if (ACPI_SUCCESS (Status))    {        ACPI_INFO ((AE_INFO, "Dynamic OEM Table Load:"));        AcpiTbPrintTableHeader (0, Table);    }    /* Invoke table handler if present */    if (AcpiGbl_TableHandler)    {        (void) AcpiGbl_TableHandler (ACPI_TABLE_EVENT_LOAD, Table,                    AcpiGbl_TableHandlerContext);    }    *ReturnDesc = DdbHandle;    return_ACPI_STATUS  (Status);}
开发者ID:AhmadTux,项目名称:DragonFlyBSD,代码行数:101,


示例4: LdNamespace2Begin

//.........这里部分代码省略.........    ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op %p [%s]/n",        Op, Op->Asl.ParseOpName));    /* Ignore Ops with no namespace node */    Node = Op->Asl.Node;    if (!Node)    {        return (AE_OK);    }    /* Get the type to determine if we should push the scope */    if ((Op->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG) &&        (Op->Asl.CompileFlags == OP_IS_RESOURCE_DESC))    {        ObjectType = ACPI_TYPE_LOCAL_RESOURCE;    }    else    {        ObjectType = AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode);    }    /* Push scope for Resource Templates */    if (Op->Asl.ParseOpcode == PARSEOP_NAME)    {        if (Op->Asl.CompileFlags & OP_IS_RESOURCE_DESC)        {            ForceNewScope = TRUE;        }    }    /* Push the scope stack */    if (ForceNewScope || AcpiNsOpensScope (ObjectType))    {        Status = AcpiDsScopeStackPush (Node, ObjectType, WalkState);        if (ACPI_FAILURE (Status))        {            return_ACPI_STATUS (Status);        }    }    if (Op->Asl.ParseOpcode == PARSEOP_ALIAS)    {        /* Complete the alias node by getting and saving the target node */        /* First child is the alias target */        Arg = Op->Asl.Child;        /* Get the target pathname */        Path = Arg->Asl.Namepath;        if (!Path)        {            Status = UtInternalizeName (Arg->Asl.ExternalName, &Path);            if (ACPI_FAILURE (Status))            {                return (Status);            }        }        /* Get the NS node associated with the target. It must exist. */        Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ACPI_TYPE_ANY,            ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,            WalkState, &TargetNode);        if (ACPI_FAILURE (Status))        {            if (Status == AE_NOT_FOUND)            {                AslError (ASL_ERROR, ASL_MSG_NOT_FOUND, Op,                    Op->Asl.ExternalName);                /*                 * The name was not found, go ahead and create it.                 * This prevents more errors later.                 */                Status = AcpiNsLookup (WalkState->ScopeInfo, Path,                    ACPI_TYPE_ANY,                    ACPI_IMODE_LOAD_PASS1, ACPI_NS_NO_UPSEARCH,                    WalkState, &(Node));                return (AE_OK);            }            AslCoreSubsystemError (Op, Status,                "Failure from namespace lookup", FALSE);            return (AE_OK);        }        /* Save the target node within the alias node */        Node->Object = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, TargetNode);    }    return (AE_OK);}
开发者ID:illumos,项目名称:illumos-gate,代码行数:101,


示例5: AcpiExNameSegment

static ACPI_STATUSAcpiExNameSegment (    UINT8                   **InAmlAddress,    char                    *NameString){    char                    *AmlAddress = (void *) *InAmlAddress;    ACPI_STATUS             Status = AE_OK;    UINT32                  Index;    char                    CharBuf[5];    ACPI_FUNCTION_TRACE (ExNameSegment);    /*     * If first character is a digit, then we know that we aren't looking at a     * valid name segment     */    CharBuf[0] = *AmlAddress;    if ('0' <= CharBuf[0] && CharBuf[0] <= '9')    {        ACPI_ERROR ((AE_INFO, "Invalid leading digit: %c", CharBuf[0]));        return_ACPI_STATUS (AE_CTRL_PENDING);    }    ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "Bytes from stream:/n"));    for (Index = 0;        (Index < ACPI_NAME_SIZE) && (AcpiUtValidAcpiChar (*AmlAddress, 0));        Index++)    {        CharBuf[Index] = *AmlAddress++;        ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "%c/n", CharBuf[Index]));    }    /* Valid name segment  */    if (Index == 4)    {        /* Found 4 valid characters */        CharBuf[4] = '/0';        if (NameString)        {            ACPI_STRCAT (NameString, CharBuf);            ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,                "Appended to - %s/n", NameString));        }        else        {            ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,                "No Name string - %s/n", CharBuf));        }    }    else if (Index == 0)    {        /*         * First character was not a valid name character,         * so we are looking at something other than a name.         */        ACPI_DEBUG_PRINT ((ACPI_DB_INFO,            "Leading character is not alpha: %02Xh (not a name)/n",            CharBuf[0]));        Status = AE_CTRL_PENDING;    }    else    {        /*         * Segment started with one or more valid characters, but fewer than         * the required 4         */        Status = AE_AML_BAD_NAME;        ACPI_ERROR ((AE_INFO,            "Bad character 0x%02x in name, at %p",            *AmlAddress, AmlAddress));    }    *InAmlAddress = ACPI_CAST_PTR (UINT8, AmlAddress);    return_ACPI_STATUS (Status);}
开发者ID:victoredwardocallaghan,项目名称:DragonFlyBSD,代码行数:83,


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


示例7: AcpiWalkResourceBuffer

ACPI_STATUSAcpiWalkResourceBuffer (    ACPI_BUFFER                 *Buffer,    ACPI_WALK_RESOURCE_CALLBACK UserFunction,    void                        *Context){    ACPI_STATUS                 Status = AE_OK;    ACPI_RESOURCE               *Resource;    ACPI_RESOURCE               *ResourceEnd;    ACPI_FUNCTION_TRACE (AcpiWalkResourceBuffer);    /* Parameter validation */    if (!Buffer || !Buffer->Pointer || !UserFunction)    {        return_ACPI_STATUS (AE_BAD_PARAMETER);    }    /* Buffer contains the resource list and length */    Resource = ACPI_CAST_PTR (ACPI_RESOURCE, Buffer->Pointer);    ResourceEnd = ACPI_ADD_PTR (        ACPI_RESOURCE, Buffer->Pointer, Buffer->Length);    /* Walk the resource list until the EndTag is found (or buffer end) */    while (Resource < ResourceEnd)    {        /* Sanity check the resource type */        if (Resource->Type > ACPI_RESOURCE_TYPE_MAX)        {            Status = AE_AML_INVALID_RESOURCE_TYPE;            break;        }        /* Sanity check the length. It must not be zero, or we loop forever */        if (!Resource->Length)        {            return_ACPI_STATUS (AE_AML_BAD_RESOURCE_LENGTH);        }        /* Invoke the user function, abort on any error returned */        Status = UserFunction (Resource, Context);        if (ACPI_FAILURE (Status))        {            if (Status == AE_CTRL_TERMINATE)            {                /* This is an OK termination by the user function */                Status = AE_OK;            }            break;        }        /* EndTag indicates end-of-list */        if (Resource->Type == ACPI_RESOURCE_TYPE_END_TAG)        {            break;        }        /* Get the next resource descriptor */        Resource = ACPI_NEXT_RESOURCE (Resource);    }    return_ACPI_STATUS (Status);}
开发者ID:Paradoxianer,项目名称:haiku,代码行数:74,


示例8: AeBuildLocalTables

ACPI_STATUSAeBuildLocalTables (    UINT32                  TableCount,    AE_TABLE_DESC           *TableList){    ACPI_PHYSICAL_ADDRESS   DsdtAddress = 0;    UINT32                  XsdtSize;    AE_TABLE_DESC           *NextTable;    UINT32                  NextIndex;    ACPI_TABLE_FADT         *ExternalFadt = NULL;    /*     * Update the table count. For the DSDT, it is not put into the XSDT.     * For the FADT, this table is already accounted for since we usually     * install a local FADT.     */    NextTable = TableList;    while (NextTable)    {        if (ACPI_COMPARE_NAME (NextTable->Table->Signature, ACPI_SIG_DSDT) ||                ACPI_COMPARE_NAME (NextTable->Table->Signature, ACPI_SIG_FADT))        {            TableCount--;        }        NextTable = NextTable->Next;    }    XsdtSize = (((TableCount + 1) * sizeof (UINT64)) + sizeof (ACPI_TABLE_HEADER));    if (AcpiGbl_LoadTestTables)    {        XsdtSize += BASE_XSDT_SIZE;    }    /* Build an XSDT */    LocalXSDT = AcpiOsAllocate (XsdtSize);    if (!LocalXSDT)    {        return (AE_NO_MEMORY);    }    memset (LocalXSDT, 0, XsdtSize);    AeInitializeTableHeader ((void *) LocalXSDT, ACPI_SIG_XSDT, XsdtSize);    LocalXSDT->TableOffsetEntry[0] = ACPI_PTR_TO_PHYSADDR (&LocalFADT);    NextIndex = 1;    /*     * Install the user tables. The DSDT must be installed in the FADT.     * All other tables are installed directly into the XSDT.     *     * Note: The tables are loaded in reverse order from the incoming     * input, which makes it match the command line order.     */    NextTable = TableList;    while (NextTable)    {        /*         * Incoming DSDT or FADT are special cases. All other tables are         * just immediately installed into the XSDT.         */        if (ACPI_COMPARE_NAME (NextTable->Table->Signature, ACPI_SIG_DSDT))        {            if (DsdtAddress)            {                printf ("Already found a DSDT, only one allowed/n");                return (AE_ALREADY_EXISTS);            }            /* The incoming user table is a DSDT */            DsdtAddress = ACPI_PTR_TO_PHYSADDR (NextTable->Table);            DsdtToInstallOverride = NextTable->Table;        }        else if (ACPI_COMPARE_NAME (NextTable->Table->Signature, ACPI_SIG_FADT))        {            ExternalFadt = ACPI_CAST_PTR (ACPI_TABLE_FADT, NextTable->Table);            LocalXSDT->TableOffsetEntry[0] = ACPI_PTR_TO_PHYSADDR (NextTable->Table);        }        else        {            /* Install the table in the XSDT */            LocalXSDT->TableOffsetEntry[TableCount - NextIndex + 1] =                ACPI_PTR_TO_PHYSADDR (NextTable->Table);            NextIndex++;        }        NextTable = NextTable->Next;    }    /* Install the optional extra local tables */    if (AcpiGbl_LoadTestTables)    {        LocalXSDT->TableOffsetEntry[NextIndex++] = ACPI_PTR_TO_PHYSADDR (&LocalTEST);        LocalXSDT->TableOffsetEntry[NextIndex++] = ACPI_PTR_TO_PHYSADDR (&LocalBADTABLE);        /* Install two SSDTs to test multiple table support *///.........这里部分代码省略.........
开发者ID:yazshel,项目名称:netbsd-kernel,代码行数:101,


示例9: acpi_decode_pld_buffer

/******************************************************************************* * * FUNCTION:    acpi_decode_pld_buffer * * PARAMETERS:  in_buffer           - Buffer returned by _PLD method *              length              - Length of the in_buffer *              return_buffer       - Where the decode buffer is returned * * RETURN:      Status and the decoded _PLD buffer. User must deallocate *              the buffer via ACPI_FREE. * * DESCRIPTION: Decode the bit-packed buffer returned by the _PLD method into *              a local struct that is much more useful to an ACPI driver. * ******************************************************************************/acpi_statusacpi_decode_pld_buffer(u8 *in_buffer,                       acpi_size length, struct acpi_pld_info ** return_buffer){    struct acpi_pld_info *pld_info;    u32 *buffer = ACPI_CAST_PTR(u32, in_buffer);    u32 dword;    /* Parameter validation */    if (!in_buffer || !return_buffer || (length < 16)) {        return (AE_BAD_PARAMETER);    }    pld_info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_pld_info));    if (!pld_info) {        return (AE_NO_MEMORY);    }    /* First 32-bit DWord */    ACPI_MOVE_32_TO_32(&dword, &buffer[0]);    pld_info->revision = ACPI_PLD_GET_REVISION(&dword);    pld_info->ignore_color = ACPI_PLD_GET_IGNORE_COLOR(&dword);    pld_info->color = ACPI_PLD_GET_COLOR(&dword);    /* Second 32-bit DWord */    ACPI_MOVE_32_TO_32(&dword, &buffer[1]);    pld_info->width = ACPI_PLD_GET_WIDTH(&dword);    pld_info->height = ACPI_PLD_GET_HEIGHT(&dword);    /* Third 32-bit DWord */    ACPI_MOVE_32_TO_32(&dword, &buffer[2]);    pld_info->user_visible = ACPI_PLD_GET_USER_VISIBLE(&dword);    pld_info->dock = ACPI_PLD_GET_DOCK(&dword);    pld_info->lid = ACPI_PLD_GET_LID(&dword);    pld_info->panel = ACPI_PLD_GET_PANEL(&dword);    pld_info->vertical_position = ACPI_PLD_GET_VERTICAL(&dword);    pld_info->horizontal_position = ACPI_PLD_GET_HORIZONTAL(&dword);    pld_info->shape = ACPI_PLD_GET_SHAPE(&dword);    pld_info->group_orientation = ACPI_PLD_GET_ORIENTATION(&dword);    pld_info->group_token = ACPI_PLD_GET_TOKEN(&dword);    pld_info->group_position = ACPI_PLD_GET_POSITION(&dword);    pld_info->bay = ACPI_PLD_GET_BAY(&dword);    /* Fourth 32-bit DWord */    ACPI_MOVE_32_TO_32(&dword, &buffer[3]);    pld_info->ejectable = ACPI_PLD_GET_EJECTABLE(&dword);    pld_info->ospm_eject_required = ACPI_PLD_GET_OSPM_EJECT(&dword);    pld_info->cabinet_number = ACPI_PLD_GET_CABINET(&dword);    pld_info->card_cage_number = ACPI_PLD_GET_CARD_CAGE(&dword);    pld_info->reference = ACPI_PLD_GET_REFERENCE(&dword);    pld_info->rotation = ACPI_PLD_GET_ROTATION(&dword);    pld_info->order = ACPI_PLD_GET_ORDER(&dword);    if (length >= ACPI_PLD_BUFFER_SIZE) {        /* Fifth 32-bit DWord (Revision 2 of _PLD) */        ACPI_MOVE_32_TO_32(&dword, &buffer[4]);        pld_info->vertical_offset = ACPI_PLD_GET_VERT_OFFSET(&dword);        pld_info->horizontal_offset = ACPI_PLD_GET_HORIZ_OFFSET(&dword);    }    *return_buffer = pld_info;    return (AE_OK);}
开发者ID:kjedruczyk,项目名称:parallella-linux-old,代码行数:85,


示例10: AcpiExResolveMultiple

 * RETURN:      Status * * DESCRIPTION: Return the base object and type. Traverse a reference list if *              necessary to get to the base object. * ******************************************************************************/ACPI_STATUSAcpiExResolveMultiple (    ACPI_WALK_STATE         *WalkState,    ACPI_OPERAND_OBJECT     *Operand,    ACPI_OBJECT_TYPE        *ReturnType,    ACPI_OPERAND_OBJECT     **ReturnDesc){    ACPI_OPERAND_OBJECT     *ObjDesc = ACPI_CAST_PTR (void, Operand);    ACPI_NAMESPACE_NODE     *Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Operand);    ACPI_OBJECT_TYPE        Type;    ACPI_STATUS             Status;    ACPI_FUNCTION_TRACE (AcpiExResolveMultiple);    /* Operand can be either a namespace node or an operand descriptor */    switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc))    {    case ACPI_DESC_TYPE_OPERAND:        Type = ObjDesc->Common.Type;        break;
开发者ID:derekmarcotte,项目名称:freebsd,代码行数:31,


示例11: AcpiEvMatchGpeMethod

ACPI_STATUSAcpiEvMatchGpeMethod (    ACPI_HANDLE             ObjHandle,    UINT32                  Level,    void                    *Context,    void                    **ReturnValue){    ACPI_NAMESPACE_NODE     *MethodNode = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, ObjHandle);    ACPI_GPE_WALK_INFO      *WalkInfo = ACPI_CAST_PTR (ACPI_GPE_WALK_INFO, Context);    ACPI_GPE_EVENT_INFO     *GpeEventInfo;    UINT32                  GpeNumber;    char                    Name[ACPI_NAME_SIZE + 1];    UINT8                   Type;    ACPI_FUNCTION_TRACE (EvMatchGpeMethod);    /* Check if requested OwnerId matches this OwnerId */    if ((WalkInfo->ExecuteByOwnerId) &&        (MethodNode->OwnerId != WalkInfo->OwnerId))    {        return_ACPI_STATUS (AE_OK);    }    /*     * Match and decode the _Lxx and _Exx GPE method names     *     * 1) Extract the method name and null terminate it     */    ACPI_MOVE_32_TO_32 (Name, &MethodNode->Name.Integer);    Name[ACPI_NAME_SIZE] = 0;    /* 2) Name must begin with an underscore */    if (Name[0] != '_')    {        return_ACPI_STATUS (AE_OK); /* Ignore this method */    }    /*     * 3) Edge/Level determination is based on the 2nd character     *    of the method name     */    switch (Name[1])    {    case 'L':        Type = ACPI_GPE_LEVEL_TRIGGERED;        break;    case 'E':        Type = ACPI_GPE_EDGE_TRIGGERED;        break;    default:        /* Unknown method type, just ignore it */        ACPI_DEBUG_PRINT ((ACPI_DB_LOAD,            "Ignoring unknown GPE method type: %s "            "(name not of form _Lxx or _Exx)", Name));        return_ACPI_STATUS (AE_OK);    }    /* 4) The last two characters of the name are the hex GPE Number */    GpeNumber = ACPI_STRTOUL (&Name[2], NULL, 16);    if (GpeNumber == ACPI_UINT32_MAX)    {        /* Conversion failed; invalid method, just ignore it */        ACPI_DEBUG_PRINT ((ACPI_DB_LOAD,            "Could not extract GPE number from name: %s "            "(name is not of form _Lxx or _Exx)", Name));        return_ACPI_STATUS (AE_OK);    }    /* Ensure that we have a valid GPE number for this GPE block */    GpeEventInfo = AcpiEvLowGetGpeInfo (GpeNumber, WalkInfo->GpeBlock);    if (!GpeEventInfo)    {        /*         * This GpeNumber is not valid for this GPE block, just ignore it.         * However, it may be valid for a different GPE block, since GPE0         * and GPE1 methods both appear under /_GPE.         */        return_ACPI_STATUS (AE_OK);    }    if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) ==            ACPI_GPE_DISPATCH_HANDLER)    {        /* If there is already a handler, ignore this GPE method */        return_ACPI_STATUS (AE_OK);    }//.........这里部分代码省略.........
开发者ID:hoangduit,项目名称:reactos,代码行数:101,


示例12: AcpiUtInitGlobals

//.........这里部分代码省略.........    for (i = 0; i < ACPI_NUM_OWNERID_MASKS; i++)    {        AcpiGbl_OwnerIdMask[i]              = 0;    }    /* Last OwnerID is never valid */    AcpiGbl_OwnerIdMask[ACPI_NUM_OWNERID_MASKS - 1] = 0x80000000;    /* Event counters */    AcpiMethodCount                     = 0;    AcpiSciCount                        = 0;    AcpiGpeCount                        = 0;    for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++)    {        AcpiFixedEventCount[i]              = 0;    }#if (!ACPI_REDUCED_HARDWARE)    /* GPE/SCI support */    AcpiGbl_AllGpesInitialized          = FALSE;    AcpiGbl_GpeXruptListHead            = NULL;    AcpiGbl_GpeFadtBlocks[0]            = NULL;    AcpiGbl_GpeFadtBlocks[1]            = NULL;    AcpiCurrentGpeCount                 = 0;    AcpiGbl_GlobalEventHandler          = NULL;    AcpiGbl_SciHandlerList              = NULL;#endif /* !ACPI_REDUCED_HARDWARE */    /* Global handlers */    AcpiGbl_GlobalNotify[0].Handler     = NULL;    AcpiGbl_GlobalNotify[1].Handler     = NULL;    AcpiGbl_ExceptionHandler            = NULL;    AcpiGbl_InitHandler                 = NULL;    AcpiGbl_TableHandler                = NULL;    AcpiGbl_InterfaceHandler            = NULL;    /* Global Lock support */    AcpiGbl_GlobalLockSemaphore         = NULL;    AcpiGbl_GlobalLockMutex             = NULL;    AcpiGbl_GlobalLockAcquired          = FALSE;    AcpiGbl_GlobalLockHandle            = 0;    AcpiGbl_GlobalLockPresent           = FALSE;    /* Miscellaneous variables */    AcpiGbl_DSDT                        = NULL;    AcpiGbl_CmSingleStep                = FALSE;    AcpiGbl_Shutdown                    = FALSE;    AcpiGbl_NsLookupCount               = 0;    AcpiGbl_PsFindCount                 = 0;    AcpiGbl_AcpiHardwarePresent         = TRUE;    AcpiGbl_LastOwnerIdIndex            = 0;    AcpiGbl_NextOwnerIdOffset           = 0;    AcpiGbl_DebuggerConfiguration       = DEBUGGER_THREADING;    AcpiGbl_OsiMutex                    = NULL;    /* Hardware oriented */    AcpiGbl_EventsInitialized           = FALSE;    AcpiGbl_SystemAwakeAndRunning       = TRUE;    /* Namespace */    AcpiGbl_ModuleCodeList              = NULL;    AcpiGbl_RootNode                    = NULL;    AcpiGbl_RootNodeStruct.Name.Integer = ACPI_ROOT_NAME;    AcpiGbl_RootNodeStruct.DescriptorType = ACPI_DESC_TYPE_NAMED;    AcpiGbl_RootNodeStruct.Type         = ACPI_TYPE_DEVICE;    AcpiGbl_RootNodeStruct.Parent       = NULL;    AcpiGbl_RootNodeStruct.Child        = NULL;    AcpiGbl_RootNodeStruct.Peer         = NULL;    AcpiGbl_RootNodeStruct.Object       = NULL;#ifdef ACPI_DISASSEMBLER    AcpiGbl_ExternalList                = NULL;    AcpiGbl_NumExternalMethods          = 0;    AcpiGbl_ResolvedExternalMethods     = 0;#endif#ifdef ACPI_DEBUG_OUTPUT    AcpiGbl_LowestStackPointer          = ACPI_CAST_PTR (ACPI_SIZE, ACPI_SIZE_MAX);#endif#ifdef ACPI_DBG_TRACK_ALLOCATIONS    AcpiGbl_DisplayFinalMemStats        = FALSE;    AcpiGbl_DisableMemTracking          = FALSE;#endif    return_ACPI_STATUS (AE_OK);}
开发者ID:Moteesh,项目名称:reactos,代码行数:101,


示例13: 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 and all         * package elements. (01/2017): We defer the element         * resolution to allow forward references from the package         * in order to provide compatibility with other ACPI         * implementations.         */        ObjDesc->Package.Node = ACPI_CAST_PTR (            ACPI_NAMESPACE_NODE, WalkState->Operands[0]);        if (!Op->Named.Data)        {            return_ACPI_STATUS (AE_OK);        }        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 */                (void) AcpiExTruncateFor32bitTable (ObjDesc);                break;            case AML_REVISION_OP:                ObjDesc->Integer.Value = ACPI_CA_VERSION;                break;            default://.........这里部分代码省略.........
开发者ID:Moteesh,项目名称:reactos,代码行数:101,


示例14: AcpiDbDeviceResources

static ACPI_STATUSAcpiDbDeviceResources (    ACPI_HANDLE             ObjHandle,    UINT32                  NestingLevel,    void                    *Context,    void                    **ReturnValue){    ACPI_NAMESPACE_NODE     *Node;    ACPI_NAMESPACE_NODE     *PrtNode = NULL;    ACPI_NAMESPACE_NODE     *CrsNode = NULL;    ACPI_NAMESPACE_NODE     *PrsNode = NULL;    ACPI_NAMESPACE_NODE     *AeiNode = NULL;    char                    *ParentPath;    ACPI_BUFFER             ReturnBuffer;    ACPI_STATUS             Status;    Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, ObjHandle);    ParentPath = AcpiNsGetExternalPathname (Node);    if (!ParentPath)    {        return (AE_NO_MEMORY);    }    /* Get handles to the resource methods for this device */    (void) AcpiGetHandle (Node, METHOD_NAME__PRT, ACPI_CAST_PTR (ACPI_HANDLE, &PrtNode));    (void) AcpiGetHandle (Node, METHOD_NAME__CRS, ACPI_CAST_PTR (ACPI_HANDLE, &CrsNode));    (void) AcpiGetHandle (Node, METHOD_NAME__PRS, ACPI_CAST_PTR (ACPI_HANDLE, &PrsNode));    (void) AcpiGetHandle (Node, METHOD_NAME__AEI, ACPI_CAST_PTR (ACPI_HANDLE, &AeiNode));    if (!PrtNode && !CrsNode && !PrsNode && !AeiNode)    {        goto Cleanup;   /* Nothing to do */    }    AcpiOsPrintf ("/nDevice: %s/n", ParentPath);    /* Prepare for a return object of arbitrary size */    ReturnBuffer.Pointer = AcpiGbl_DbBuffer;    ReturnBuffer.Length  = ACPI_DEBUG_BUFFER_SIZE;    /* _PRT */    if (PrtNode)    {        AcpiOsPrintf ("Evaluating _PRT/n");        Status = AcpiEvaluateObject (PrtNode, NULL, NULL, &ReturnBuffer);        if (ACPI_FAILURE (Status))        {            AcpiOsPrintf ("Could not evaluate _PRT: %s/n",                AcpiFormatException (Status));            goto GetCrs;        }        ReturnBuffer.Pointer = AcpiGbl_DbBuffer;        ReturnBuffer.Length  = ACPI_DEBUG_BUFFER_SIZE;        Status = AcpiGetIrqRoutingTable (Node, &ReturnBuffer);        if (ACPI_FAILURE (Status))        {            AcpiOsPrintf ("GetIrqRoutingTable failed: %s/n",                AcpiFormatException (Status));            goto GetCrs;        }        AcpiRsDumpIrqList (ACPI_CAST_PTR (UINT8, AcpiGbl_DbBuffer));    }    /* _CRS */GetCrs:    if (CrsNode)    {        AcpiOsPrintf ("Evaluating _CRS/n");        ReturnBuffer.Pointer = AcpiGbl_DbBuffer;        ReturnBuffer.Length  = ACPI_DEBUG_BUFFER_SIZE;        Status = AcpiEvaluateObject (CrsNode, NULL, NULL, &ReturnBuffer);        if (ACPI_FAILURE (Status))        {            AcpiOsPrintf ("Could not evaluate _CRS: %s/n",                AcpiFormatException (Status));            goto GetPrs;        }        /* This code exercises the AcpiWalkResources interface */        Status = AcpiWalkResources (Node, METHOD_NAME__CRS,            AcpiDbResourceCallback, NULL);        if (ACPI_FAILURE (Status))        {            AcpiOsPrintf ("AcpiWalkResources failed: %s/n",                AcpiFormatException (Status));            goto GetPrs;        }//.........这里部分代码省略.........
开发者ID:wan721,项目名称:DragonFlyBSD,代码行数:101,


示例15: AcpiNsEvaluate

ACPI_STATUSAcpiNsEvaluate (    ACPI_EVALUATE_INFO      *Info){    ACPI_STATUS             Status;    ACPI_NAMESPACE_NODE     *Node;    ACPI_FUNCTION_TRACE (NsEvaluate);    if (!Info)    {        return_ACPI_STATUS (AE_BAD_PARAMETER);    }    /* Initialize the return value to an invalid object */    Info->ReturnObject = NULL;    Info->ParamCount = 0;    if (!Info->ResolvedNode)    {        /*         * Get the actual namespace node for the target object if we need to.         * Handles these cases:         *         * 1) Null node, Pathname (absolute path)         * 2) Node, Pathname (path relative to Node)         * 3) Node, Null Pathname         */        Status = AcpiNsGetNode (Info->PrefixNode, Info->Pathname,                    ACPI_NS_NO_UPSEARCH, &Info->ResolvedNode);        if (ACPI_FAILURE (Status))        {            return_ACPI_STATUS (Status);        }    }    /*     * For a method alias, we must grab the actual method node so that proper     * scoping context will be established before execution.     */    if (AcpiNsGetType (Info->ResolvedNode) == ACPI_TYPE_LOCAL_METHOD_ALIAS)    {        Info->ResolvedNode =            ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Info->ResolvedNode->Object);    }    ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "%s [%p] Value %p/n", Info->Pathname,        Info->ResolvedNode, AcpiNsGetAttachedObject (Info->ResolvedNode)));    Node = Info->ResolvedNode;    /*     * Two major cases here:     *     * 1) The object is a control method -- execute it     * 2) The object is not a method -- just return it's current value     */    if (AcpiNsGetType (Info->ResolvedNode) == ACPI_TYPE_METHOD)    {        /*         * 1) Object is a control method - execute it         */        /* Verify that there is a method object associated with this node */        Info->ObjDesc = AcpiNsGetAttachedObject (Info->ResolvedNode);        if (!Info->ObjDesc)        {            ACPI_ERROR ((AE_INFO, "Control method has no attached sub-object"));            return_ACPI_STATUS (AE_NULL_OBJECT);        }        /* Count the number of arguments being passed to the method */        if (Info->Parameters)        {            while (Info->Parameters[Info->ParamCount])            {                if (Info->ParamCount > ACPI_METHOD_MAX_ARG)                {                    return_ACPI_STATUS (AE_LIMIT);                }                Info->ParamCount++;            }        }        ACPI_DUMP_PATHNAME (Info->ResolvedNode, "ACPI: Execute Method",            ACPI_LV_INFO, _COMPONENT);        ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,            "Method at AML address %p Length %X/n",            Info->ObjDesc->Method.AmlStart + 1,            Info->ObjDesc->Method.AmlLength - 1));        /*         * Any namespace deletion must acquire both the namespace and         * interpreter locks to ensure that no thread is using the portion of//.........这里部分代码省略.........
开发者ID:sdcrook,项目名称:acpica,代码行数:101,


示例16: AcpiDsBuildInternalBufferObj

ACPI_STATUSAcpiDsBuildInternalBufferObj (    ACPI_WALK_STATE         *WalkState,    ACPI_PARSE_OBJECT       *Op,    UINT32                  BufferLength,    ACPI_OPERAND_OBJECT     **ObjDescPtr){    ACPI_PARSE_OBJECT       *Arg;    ACPI_OPERAND_OBJECT     *ObjDesc;    ACPI_PARSE_OBJECT       *ByteList;    UINT32                  ByteListLength = 0;    ACPI_FUNCTION_TRACE (DsBuildInternalBufferObj);    /*     * If we are evaluating a Named buffer object "Name (xxxx, Buffer)".     * The buffer object already exists (from the NS node), otherwise it must     * be created.     */    ObjDesc = *ObjDescPtr;    if (!ObjDesc)    {        /* Create a new buffer object */        ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_BUFFER);        *ObjDescPtr = ObjDesc;        if (!ObjDesc)        {            return_ACPI_STATUS (AE_NO_MEMORY);        }    }    /*     * Second arg is the buffer data (optional) ByteList can be either     * individual bytes or a string initializer.  In either case, a     * ByteList appears in the AML.     */    Arg = Op->Common.Value.Arg;         /* skip first arg */    ByteList = Arg->Named.Next;    if (ByteList)    {        if (ByteList->Common.AmlOpcode != AML_INT_BYTELIST_OP)        {            ACPI_ERROR ((AE_INFO,                "Expecting bytelist, got AML opcode %X in op %p",                ByteList->Common.AmlOpcode, ByteList));            AcpiUtRemoveReference (ObjDesc);            return (AE_TYPE);        }        ByteListLength = (UINT32) ByteList->Common.Value.Integer;    }    /*     * The buffer length (number of bytes) will be the larger of:     * 1) The specified buffer length and     * 2) The length of the initializer byte list     */    ObjDesc->Buffer.Length = BufferLength;    if (ByteListLength > BufferLength)    {        ObjDesc->Buffer.Length = ByteListLength;    }    /* Allocate the buffer */    if (ObjDesc->Buffer.Length == 0)    {        ObjDesc->Buffer.Pointer = NULL;        ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,            "Buffer defined with zero length in AML, creating/n"));    }    else    {        ObjDesc->Buffer.Pointer = ACPI_ALLOCATE_ZEROED (                                        ObjDesc->Buffer.Length);        if (!ObjDesc->Buffer.Pointer)        {            AcpiUtDeleteObjectDesc (ObjDesc);            return_ACPI_STATUS (AE_NO_MEMORY);        }        /* Initialize buffer from the ByteList (if present) */        if (ByteList)        {            ACPI_MEMCPY (ObjDesc->Buffer.Pointer, ByteList->Named.Data,                         ByteListLength);        }    }    ObjDesc->Buffer.Flags |= AOPOBJ_DATA_VALID;    Op->Common.Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, ObjDesc);    return_ACPI_STATUS (AE_OK);}
开发者ID:oza,项目名称:FreeBSD-7.3-dyntick,代码行数:99,


示例17: acpi_get_firmware_table

//.........这里部分代码省略.........	status = acpi_tb_get_table(&address, rsdt_info);	if (ACPI_FAILURE(status)) {		goto cleanup;	}	status = acpi_tb_validate_rsdt(rsdt_info->pointer);	if (ACPI_FAILURE(status)) {		goto cleanup;	}	/* Allocate a scratch table header and table descriptor */	header = ACPI_MEM_ALLOCATE(sizeof(struct acpi_table_header));	if (!header) {		status = AE_NO_MEMORY;		goto cleanup;	}	table_info = ACPI_MEM_ALLOCATE(sizeof(struct acpi_table_desc));	if (!table_info) {		status = AE_NO_MEMORY;		goto cleanup;	}	/* Get the number of table pointers within the RSDT */	table_count =	    acpi_tb_get_table_count(acpi_gbl_RSDP, rsdt_info->pointer);	address.pointer_type = acpi_gbl_table_flags | flags;	/*	 * Search the RSDT/XSDT for the correct instance of the	 * requested table	 */	for (i = 0, j = 0; i < table_count; i++) {		/*		 * Get the next table pointer, handle RSDT vs. XSDT		 * RSDT pointers are 32 bits, XSDT pointers are 64 bits		 */		if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) {			address.pointer.value =			    (ACPI_CAST_PTR			     (RSDT_DESCRIPTOR,			      rsdt_info->pointer))->table_offset_entry[i];		} else {			address.pointer.value =			    (ACPI_CAST_PTR			     (XSDT_DESCRIPTOR,			      rsdt_info->pointer))->table_offset_entry[i];		}		/* Get the table header */		status = acpi_tb_get_table_header(&address, header);		if (ACPI_FAILURE(status)) {			goto cleanup;		}		/* Compare table signatures and table instance */		if (!ACPI_STRNCMP(header->signature, signature, ACPI_NAME_SIZE)) {			/* An instance of the table was found */			j++;			if (j >= instance) {				/* Found the correct instance, get the entire table */				status =				    acpi_tb_get_table_body(&address, header,							   table_info);				if (ACPI_FAILURE(status)) {					goto cleanup;				}				*table_pointer = table_info->pointer;				goto cleanup;			}		}	}	/* Did not find the table */	status = AE_NOT_EXIST;      cleanup:	if (rsdt_info->pointer) {		acpi_os_unmap_memory(rsdt_info->pointer,				     (acpi_size) rsdt_info->pointer->length);	}	ACPI_MEM_FREE(rsdt_info);	if (header) {		ACPI_MEM_FREE(header);	}	if (table_info) {		ACPI_MEM_FREE(table_info);	}	return_ACPI_STATUS(status);}
开发者ID:BackupTheBerlios,项目名称:tew632-brp-svn,代码行数:101,


示例18: 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 (ACPI_GET_OBJECT_TYPE (ObjDesc))    {    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_INTEGER_MAX;                /* Truncate value if we are executing from a 32-bit ACPI table */#ifndef ACPI_NO_METHOD_EXECUTION                AcpiExTruncateFor32bitTable (ObjDesc);#endif                break;            case AML_REVISION_OP:                ObjDesc->Integer.Value = ACPI_CA_VERSION;                break;            default:                ACPI_ERROR ((AE_INFO,                    "Unknown constant opcode %X", Opcode));                Status = AE_AML_OPERAND_TYPE;//.........这里部分代码省略.........
开发者ID:oza,项目名称:FreeBSD-7.3-dyntick,代码行数:101,


示例19: AcpiUnloadParentTable

ACPI_STATUSAcpiUnloadParentTable (    ACPI_HANDLE             Object){    ACPI_NAMESPACE_NODE     *Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Object);    ACPI_STATUS             Status = AE_NOT_EXIST;    ACPI_OWNER_ID           OwnerId;    UINT32                  i;    ACPI_FUNCTION_TRACE (AcpiUnloadParentTable);    /* Parameter validation */    if (!Object)    {        return_ACPI_STATUS (AE_BAD_PARAMETER);    }    /*     * The node OwnerId is currently the same as the parent table ID.     * However, this could change in the future.     */    OwnerId = Node->OwnerId;    if (!OwnerId)    {        /* OwnerId==0 means DSDT is the owner. DSDT cannot be unloaded */        return_ACPI_STATUS (AE_TYPE);    }    /* Must acquire the table lock during this operation */    Status = AcpiUtAcquireMutex (ACPI_MTX_TABLES);    if (ACPI_FAILURE (Status))    {        return_ACPI_STATUS (Status);    }    /* Find the table in the global table list */    for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; i++)    {        if (OwnerId != AcpiGbl_RootTableList.Tables[i].OwnerId)        {            continue;        }        /*         * Allow unload of SSDT and OEMx tables only. Do not allow unload         * of the DSDT. No other types of tables should get here, since         * only these types can contain AML and thus are the only types         * that can create namespace objects.         */        if (ACPI_COMPARE_NAME (                AcpiGbl_RootTableList.Tables[i].Signature.Ascii,                ACPI_SIG_DSDT))        {            Status = AE_TYPE;            break;        }        (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);        Status = AcpiTbUnloadTable (i);        (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);        break;    }    (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);    return_ACPI_STATUS (Status);}
开发者ID:malattia,项目名称:acpica-tools,代码行数:72,


示例20: AdCreateTableHeader

static voidAdCreateTableHeader (    char                    *Filename,    ACPI_TABLE_HEADER       *Table){    UINT8                   Checksum;    /* Reset globals for External statements */    AcpiGbl_NumExternalMethods = 0;    AcpiGbl_ResolvedExternalMethods = 0;    /*     * Print file header and dump original table header     */    AdDisassemblerHeader (Filename, ACPI_IS_AML_TABLE);    AcpiOsPrintf (" * Original Table Header:/n");    AcpiOsPrintf (" *     Signature        /"%4.4s/"/n",    Table->Signature);    AcpiOsPrintf (" *     Length           0x%8.8X (%u)/n", Table->Length, Table->Length);    /* Print and validate the revision */    AcpiOsPrintf (" *     Revision         0x%2.2X",      Table->Revision);    switch (Table->Revision)    {    case 0:        AcpiOsPrintf (" **** Invalid Revision");        break;    case 1:        /* Revision of DSDT controls the ACPI integer width */        if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_DSDT))        {            AcpiOsPrintf (" **** 32-bit table (V1), no 64-bit math support");        }        break;    default:        break;    }    /* Print and validate the table checksum */    AcpiOsPrintf ("/n *     Checksum         0x%2.2X",        Table->Checksum);    Checksum = AcpiTbChecksum (ACPI_CAST_PTR (UINT8, Table), Table->Length);    if (Checksum)    {        AcpiOsPrintf (" **** Incorrect checksum, should be 0x%2.2X",            (UINT8) (Table->Checksum - Checksum));    }    AcpiOsPrintf ("/n");    AcpiOsPrintf (" *     OEM ID           /"%.6s/"/n",     Table->OemId);    AcpiOsPrintf (" *     OEM Table ID     /"%.8s/"/n",     Table->OemTableId);    AcpiOsPrintf (" *     OEM Revision     0x%8.8X (%u)/n", Table->OemRevision, Table->OemRevision);    AcpiOsPrintf (" *     Compiler ID      /"%.4s/"/n",     Table->AslCompilerId);    AcpiOsPrintf (" *     Compiler Version 0x%8.8X (%u)/n", Table->AslCompilerRevision, Table->AslCompilerRevision);    AcpiOsPrintf (" *//n");    /*     * Print comments that come before this definition block.     */    if (Gbl_CaptureComments)    {        ASL_CV_PRINT_ONE_COMMENT(AcpiGbl_ParseOpRoot,AML_COMMENT_STANDARD, NULL, 0);    }    /*     * Open the ASL definition block.     *     * Note: the AMLFilename string is left zero-length in order to just let     * the compiler create it when the disassembled file is compiled. This     * makes it easier to rename the disassembled ASL file if needed.     */    AcpiOsPrintf (        "DefinitionBlock (/"/", /"%4.4s/", %hu, /"%.6s/", /"%.8s/", 0x%8.8X)/n",        Table->Signature, Table->Revision,        Table->OemId, Table->OemTableId, Table->OemRevision);}
开发者ID:2trill2spill,项目名称:freebsd,代码行数:87,


示例21: 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:wan721,项目名称:DragonFlyBSD,代码行数:101,


示例22: AcpiDsLoad1BeginOp

//.........这里部分代码省略.........            if (WalkState->NamespaceOverride)            {                Flags |= ACPI_NS_OVERRIDE_IF_FOUND;                ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[%s] Override allowed/n",                        AcpiUtGetTypeName (ObjectType)));            }            else            {                Flags |= ACPI_NS_ERROR_IF_FOUND;                ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[%s] Cannot already exist/n",                        AcpiUtGetTypeName (ObjectType)));            }        }        else        {            ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,                "[%s] Both Find or Create allowed/n",                    AcpiUtGetTypeName (ObjectType)));        }        /*         * Enter the named type into the internal namespace. We enter the name         * as we go downward in the parse tree. Any necessary subobjects that         * involve arguments to the opcode must be created as we go back up the         * parse tree later.         */        Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType,                        ACPI_IMODE_LOAD_PASS1, Flags, WalkState, &Node);        if (ACPI_FAILURE (Status))        {            if (Status == AE_ALREADY_EXISTS)            {                /* The name already exists in this scope */                if (Node->Flags & ANOBJ_IS_EXTERNAL)                {                    /*                     * Allow one create on an object or segment that was                     * previously declared External                     */                    Node->Flags &= ~ANOBJ_IS_EXTERNAL;                    Node->Type = (UINT8) ObjectType;                    /* Just retyped a node, probably will need to open a scope */                    if (AcpiNsOpensScope (ObjectType))                    {                        Status = AcpiDsScopeStackPush (Node, ObjectType, WalkState);                        if (ACPI_FAILURE (Status))                        {                            return_ACPI_STATUS (Status);                        }                    }                    Status = AE_OK;                }            }            if (ACPI_FAILURE (Status))            {                ACPI_ERROR_NAMESPACE (Path, Status);                return_ACPI_STATUS (Status);            }        }        break;    }    /* Common exit */    if (!Op)    {        /* Create a new op */        Op = AcpiPsAllocOp (WalkState->Opcode, WalkState->Aml);        if (!Op)        {            return_ACPI_STATUS (AE_NO_MEMORY);        }    }    /* Initialize the op */#if (defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY))    Op->Named.Path = ACPI_CAST_PTR (UINT8, Path);#endif    if (Node)    {        /*         * Put the Node in the "op" object that the parser uses, so we         * can get it again quickly when this scope is closed         */        Op->Common.Node = Node;        Op->Named.Name = Node->Name.Integer;    }    AcpiPsAppendArg (AcpiPsGetParentScope (&WalkState->ParserState), Op);    *OutOp = Op;    return_ACPI_STATUS (Status);}
开发者ID:ModeenF,项目名称:haiku,代码行数:101,


示例23: AcpiNsRepair_FDE

static ACPI_STATUSAcpiNsRepair_FDE (    ACPI_EVALUATE_INFO      *Info,    ACPI_OPERAND_OBJECT     **ReturnObjectPtr){    ACPI_OPERAND_OBJECT     *ReturnObject = *ReturnObjectPtr;    ACPI_OPERAND_OBJECT     *BufferObject;    UINT8                   *ByteBuffer;    UINT32                  *DwordBuffer;    UINT32                  i;    ACPI_FUNCTION_NAME (NsRepair_FDE);    switch (ReturnObject->Common.Type)    {    case ACPI_TYPE_BUFFER:        /* This is the expected type. Length should be (at least) 5 DWORDs */        if (ReturnObject->Buffer.Length >= ACPI_FDE_DWORD_BUFFER_SIZE)        {            return (AE_OK);        }        /* We can only repair if we have exactly 5 BYTEs */        if (ReturnObject->Buffer.Length != ACPI_FDE_BYTE_BUFFER_SIZE)        {            ACPI_WARN_PREDEFINED ((AE_INFO,                Info->FullPathname, Info->NodeFlags,                "Incorrect return buffer length %u, expected %u",                ReturnObject->Buffer.Length, ACPI_FDE_DWORD_BUFFER_SIZE));            return (AE_AML_OPERAND_TYPE);        }        /* Create the new (larger) buffer object */        BufferObject = AcpiUtCreateBufferObject (            ACPI_FDE_DWORD_BUFFER_SIZE);        if (!BufferObject)        {            return (AE_NO_MEMORY);        }        /* Expand each byte to a DWORD */        ByteBuffer = ReturnObject->Buffer.Pointer;        DwordBuffer = ACPI_CAST_PTR (UINT32,            BufferObject->Buffer.Pointer);        for (i = 0; i < ACPI_FDE_FIELD_COUNT; i++)        {            *DwordBuffer = (UINT32) *ByteBuffer;            DwordBuffer++;            ByteBuffer++;        }        ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR,            "%s Expanded Byte Buffer to expected DWord Buffer/n",            Info->FullPathname));        break;    default:        return (AE_AML_OPERAND_TYPE);    }    /* Delete the original return object, return the new buffer object */    AcpiUtRemoveReference (ReturnObject);    *ReturnObjectPtr = BufferObject;    Info->ReturnFlags |= ACPI_OBJECT_REPAIRED;    return (AE_OK);}
开发者ID:ChaiSoft,项目名称:ChaiOS,代码行数:78,


示例24: AcpiUtCopyIelementToEelement

static ACPI_STATUSAcpiUtCopyIelementToEelement (    UINT8                   ObjectType,    ACPI_OPERAND_OBJECT     *SourceObject,    ACPI_GENERIC_STATE      *State,    void                    *Context){    ACPI_STATUS             Status = AE_OK;    ACPI_PKG_INFO           *Info = (ACPI_PKG_INFO *) Context;    ACPI_SIZE               ObjectSpace;    UINT32                  ThisIndex;    ACPI_OBJECT             *TargetObject;    ACPI_FUNCTION_ENTRY ();    ThisIndex    = State->Pkg.Index;    TargetObject = (ACPI_OBJECT *)        &((ACPI_OBJECT *)(State->Pkg.DestObject))->Package.Elements[ThisIndex];    switch (ObjectType)    {    case ACPI_COPY_TYPE_SIMPLE:        /*         * This is a simple or null object         */        Status = AcpiUtCopyIsimpleToEsimple (SourceObject,                        TargetObject, Info->FreeSpace, &ObjectSpace);        if (ACPI_FAILURE (Status))        {            return (Status);        }        break;    case ACPI_COPY_TYPE_PACKAGE:        /*         * Build the package object         */        TargetObject->Type              = ACPI_TYPE_PACKAGE;        TargetObject->Package.Count     = SourceObject->Package.Count;        TargetObject->Package.Elements  =            ACPI_CAST_PTR (ACPI_OBJECT, Info->FreeSpace);        /*         * Pass the new package object back to the package walk routine         */        State->Pkg.ThisTargetObj = TargetObject;        /*         * Save space for the array of objects (Package elements)         * update the buffer length counter         */        ObjectSpace = ACPI_ROUND_UP_TO_NATIVE_WORD (                            (ACPI_SIZE) TargetObject->Package.Count *                            sizeof (ACPI_OBJECT));        break;    default:        return (AE_BAD_PARAMETER);    }    Info->FreeSpace   += ObjectSpace;    Info->Length      += ObjectSpace;    return (Status);}
开发者ID:andreiw,项目名称:polaris,代码行数:70,


示例25: AcpiNsEvaluate

ACPI_STATUSAcpiNsEvaluate (    ACPI_EVALUATE_INFO      *Info){    ACPI_STATUS             Status;    ACPI_FUNCTION_TRACE (NsEvaluate);    if (!Info)    {        return_ACPI_STATUS (AE_BAD_PARAMETER);    }    if (!Info->Node)    {        /*         * Get the actual namespace node for the target object if we         * need to. Handles these cases:         *         * 1) Null node, valid pathname from root (absolute path)         * 2) Node and valid pathname (path relative to Node)         * 3) Node, Null pathname         */        Status = AcpiNsGetNode (Info->PrefixNode, Info->RelativePathname,            ACPI_NS_NO_UPSEARCH, &Info->Node);        if (ACPI_FAILURE (Status))        {            return_ACPI_STATUS (Status);        }    }    /*     * For a method alias, we must grab the actual method node so that     * proper scoping context will be established before execution.     */    if (AcpiNsGetType (Info->Node) == ACPI_TYPE_LOCAL_METHOD_ALIAS)    {        Info->Node = ACPI_CAST_PTR (            ACPI_NAMESPACE_NODE, Info->Node->Object);    }    /* Complete the info block initialization */    Info->ReturnObject = NULL;    Info->NodeFlags = Info->Node->Flags;    Info->ObjDesc = AcpiNsGetAttachedObject (Info->Node);    ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "%s [%p] Value %p/n",        Info->RelativePathname, Info->Node,        AcpiNsGetAttachedObject (Info->Node)));    /* Get info if we have a predefined name (_HID, etc.) */    Info->Predefined = AcpiUtMatchPredefinedMethod (Info->Node->Name.Ascii);    /* Get the full pathname to the object, for use in warning messages */    Info->FullPathname = AcpiNsGetNormalizedPathname (Info->Node, TRUE);    if (!Info->FullPathname)    {        return_ACPI_STATUS (AE_NO_MEMORY);    }    /* Count the number of arguments being passed in */    Info->ParamCount = 0;    if (Info->Parameters)    {        while (Info->Parameters[Info->ParamCount])        {            Info->ParamCount++;        }        /* Warn on impossible argument count */        if (Info->ParamCount > ACPI_METHOD_NUM_ARGS)        {            ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, ACPI_WARN_ALWAYS,                "Excess arguments (%u) - using only %u",                Info->ParamCount, ACPI_METHOD_NUM_ARGS));            Info->ParamCount = ACPI_METHOD_NUM_ARGS;        }    }    /*     * For predefined names: Check that the declared argument count     * matches the ACPI spec -- otherwise this is a BIOS error.     */    AcpiNsCheckAcpiCompliance (Info->FullPathname, Info->Node,        Info->Predefined);    /*     * For all names: Check that the incoming argument count for     * this method/object matches the actual ASL/AML definition.     */    AcpiNsCheckArgumentCount (Info->FullPathname, Info->Node,        Info->ParamCount, Info->Predefined);//.........这里部分代码省略.........
开发者ID:ycui1984,项目名称:netbsd-src,代码行数:101,


示例26: AcpiPsLinkModuleCode

static voidAcpiPsLinkModuleCode (    ACPI_PARSE_OBJECT       *ParentOp,    UINT8                   *AmlStart,    UINT32                  AmlLength,    ACPI_OWNER_ID           OwnerId){    ACPI_OPERAND_OBJECT     *Prev;    ACPI_OPERAND_OBJECT     *Next;    ACPI_OPERAND_OBJECT     *MethodObj;    ACPI_NAMESPACE_NODE     *ParentNode;    /* Get the tail of the list */    Prev = Next = AcpiGbl_ModuleCodeList;    while (Next)    {        Prev = Next;        Next = Next->Method.Mutex;    }    /*     * Insert the module level code into the list. Merge it if it is     * adjacent to the previous element.     */    if (!Prev ||       ((Prev->Method.AmlStart + Prev->Method.AmlLength) != AmlStart))    {        /* Create, initialize, and link a new temporary method object */        MethodObj = AcpiUtCreateInternalObject (ACPI_TYPE_METHOD);        if (!MethodObj)        {            return;        }        if (ParentOp->Common.Node)        {            ParentNode = ParentOp->Common.Node;        }        else        {            ParentNode = AcpiGbl_RootNode;        }        MethodObj->Method.AmlStart = AmlStart;        MethodObj->Method.AmlLength = AmlLength;        MethodObj->Method.OwnerId = OwnerId;        MethodObj->Method.InfoFlags |= ACPI_METHOD_MODULE_LEVEL;        /*         * Save the parent node in NextObject. This is cheating, but we         * don't want to expand the method object.         */        MethodObj->Method.NextObject =            ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, ParentNode);        if (!Prev)        {            AcpiGbl_ModuleCodeList = MethodObj;        }        else        {            Prev->Method.Mutex = MethodObj;        }    }    else    {        Prev->Method.AmlLength += AmlLength;    }}
开发者ID:vkhromov,项目名称:freebsd,代码行数:72,


示例27: AcpiExLoadOp

ACPI_STATUSAcpiExLoadOp (    ACPI_OPERAND_OBJECT     *ObjDesc,    ACPI_OPERAND_OBJECT     *Target,    ACPI_WALK_STATE         *WalkState){    ACPI_OPERAND_OBJECT     *DdbHandle;    ACPI_TABLE_HEADER       *Table;    ACPI_TABLE_DESC         TableDesc;    UINT32                  TableIndex;    ACPI_STATUS             Status;    UINT32                  Length;    ACPI_FUNCTION_TRACE (ExLoadOp);    ACPI_MEMSET (&TableDesc, 0, sizeof (ACPI_TABLE_DESC));    /* Source Object can be either an OpRegion or a Buffer/Field */    switch (ObjDesc->Common.Type)    {    case ACPI_TYPE_REGION:        ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,            "Load table from Region %p/n", ObjDesc));        /* Region must be SystemMemory (from ACPI spec) */        if (ObjDesc->Region.SpaceId != ACPI_ADR_SPACE_SYSTEM_MEMORY)        {            return_ACPI_STATUS (AE_AML_OPERAND_TYPE);        }        /*         * If the Region Address and Length have not been previously evaluated,         * evaluate them now and save the results.         */        if (!(ObjDesc->Common.Flags & AOPOBJ_DATA_VALID))        {            Status = AcpiDsGetRegionArguments (ObjDesc);            if (ACPI_FAILURE (Status))            {                return_ACPI_STATUS (Status);            }        }        /* Get the table header first so we can get the table length */        Table = ACPI_ALLOCATE (sizeof (ACPI_TABLE_HEADER));        if (!Table)        {            return_ACPI_STATUS (AE_NO_MEMORY);        }        Status = AcpiExRegionRead (ObjDesc, sizeof (ACPI_TABLE_HEADER),                    ACPI_CAST_PTR (UINT8, Table));        Length = Table->Length;        ACPI_FREE (Table);        if (ACPI_FAILURE (Status))        {            return_ACPI_STATUS (Status);        }        /* Must have at least an ACPI table header */        if (Length < sizeof (ACPI_TABLE_HEADER))        {            return_ACPI_STATUS (AE_INVALID_TABLE_LENGTH);        }        /*         * The original implementation simply mapped the table, with no copy.         * However, the memory region is not guaranteed to remain stable and         * we must copy the table to a local buffer. For example, the memory         * region is corrupted after suspend on some machines. Dynamically         * loaded tables are usually small, so this overhead is minimal.         *         * The latest implementation (5/2009) does not use a mapping at all.         * We use the low-level operation region interface to read the table         * instead of the obvious optimization of using a direct mapping.         * This maintains a consistent use of operation regions across the         * entire subsystem. This is important if additional processing must         * be performed in the (possibly user-installed) operation region         * handler. For example, AcpiExec and ASLTS depend on this.         */        /* Allocate a buffer for the table */        TableDesc.Pointer = ACPI_ALLOCATE (Length);        if (!TableDesc.Pointer)        {            return_ACPI_STATUS (AE_NO_MEMORY);        }        /* Read the entire table */        Status = AcpiExRegionRead (ObjDesc, Length,//.........这里部分代码省略.........
开发者ID:AhmadTux,项目名称:DragonFlyBSD,代码行数:101,


示例28: NsDoOneNamespaceObject

static ACPI_STATUSNsDoOneNamespaceObject (    ACPI_HANDLE             ObjHandle,    UINT32                  Level,    void                    *Context,    void                    **ReturnValue){    ACPI_NAMESPACE_NODE     *Node = (ACPI_NAMESPACE_NODE *) ObjHandle;    ACPI_OPERAND_OBJECT     *ObjDesc;    ACPI_PARSE_OBJECT       *Op;    Gbl_NumNamespaceObjects++;    FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "%5u  [%u]  %*s %4.4s - %s",        Gbl_NumNamespaceObjects, Level, (Level * 3), " ",        &Node->Name,        AcpiUtGetTypeName (Node->Type));    Op = Node->Op;    ObjDesc = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Node->Object);    if (!Op)    {        FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "/n");        return (AE_OK);    }    if ((ObjDesc) &&        (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_OPERAND))    {        switch (Node->Type)        {        case ACPI_TYPE_INTEGER:            FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT,                "       [Initial Value   0x%8.8X%8.8X]",                ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));            break;        case ACPI_TYPE_STRING:            FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT,                "        [Initial Value   /"%s/"]",                ObjDesc->String.Pointer);            break;        default:            /* Nothing to do for other types */            break;        }    }    else    {        switch (Node->Type)        {        case ACPI_TYPE_INTEGER:            if (Op->Asl.ParseOpcode == PARSEOP_NAME)            {                Op = Op->Asl.Child;            }            if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG)  ||                (Op->Asl.ParseOpcode == PARSEOP_NAMESTRING))            {                Op = Op->Asl.Next;            }            FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT,                "       [Initial Value   0x%8.8X%8.8X]",                ACPI_FORMAT_UINT64 (Op->Asl.Value.Integer));            break;        case ACPI_TYPE_STRING:            if (Op->Asl.ParseOpcode == PARSEOP_NAME)            {                Op = Op->Asl.Child;            }            if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG)  ||                (Op->Asl.ParseOpcode == PARSEOP_NAMESTRING))            {                Op = Op->Asl.Next;            }            FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT,                "        [Initial Value   /"%s/"]",                Op->Asl.Value.String);            break;        case ACPI_TYPE_LOCAL_REGION_FIELD:            if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG)  ||                (Op->Asl.ParseOpcode == PARSEOP_NAMESTRING))            {                Op = Op->Asl.Child;            }//.........这里部分代码省略.........
开发者ID:libkeiser,项目名称:illumos-nexenta,代码行数:101,



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


C++ ACPI_COMPANION函数代码示例
C++ ACPI_CAST_INDIRECT_PTR函数代码示例
51自学网自学EXCEL、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。
京ICP备13026421号-1