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

📄 dmresrc.c

📁 acpi tools for linux include acpiexec and acpixtract
💻 C
📖 第 1 页 / 共 2 页
字号:
 * * FUNCTION:    AcpiDmBitList * * PARAMETERS:  Mask            - 16-bit value corresponding to 16 interrupt *                                or DMA values * * RETURN:      None * * DESCRIPTION: Dump a bit mask as a list of individual interrupt/DMA levels. * ******************************************************************************/voidAcpiDmBitList (    UINT16                  Mask){    UINT32                  i;    BOOLEAN                 Previous = FALSE;    /* Open the initializer list */    AcpiOsPrintf ("{");    /* Examine each bit */    for (i = 0; i < 16; i++)    {        /* Only interested in bits that are set to 1 */        if (Mask & 1)        {            if (Previous)            {                AcpiOsPrintf (",");            }            Previous = TRUE;            AcpiOsPrintf ("%d", i);        }        Mask >>= 1;    }    /* Close list */    AcpiOsPrintf ("}\n");}/******************************************************************************* * * FUNCTION:    AcpiDmResourceTemplate * * PARAMETERS:  Info            - Curent parse tree walk info *              ByteData        - Pointer to the byte list data *              ByteCount       - Length of the byte list * * RETURN:      None * * DESCRIPTION: Dump the contents of a Resource Template containing a set of *              Resource Descriptors. * ******************************************************************************/voidAcpiDmResourceTemplate (    ACPI_OP_WALK_INFO       *Info,    ACPI_PARSE_OBJECT       *Op,    UINT8                   *ByteData,    UINT32                  ByteCount){    ACPI_STATUS             Status;    ACPI_NATIVE_UINT        CurrentByteOffset;    UINT8                   ResourceType;    UINT32                  ResourceLength;    void                    *Aml;    UINT32                  Level;    BOOLEAN                 DependentFns = FALSE;    UINT8                   ResourceIndex;    ACPI_NAMESPACE_NODE     *Node;    Level = Info->Level;    ResourceName = ACPI_DEFAULT_RESNAME;    Node = Op->Common.Node;    if (Node)    {        Node = Node->Child;    }    for (CurrentByteOffset = 0; CurrentByteOffset < ByteCount; )    {        Aml = &ByteData[CurrentByteOffset];        /* Get the descriptor type and length */        ResourceType = AcpiUtGetResourceType (Aml);        ResourceLength = AcpiUtGetResourceLength (Aml);        /* Validate the Resource Type and Resource Length */        Status = AcpiUtValidateResource (Aml, &ResourceIndex);        if (ACPI_FAILURE (Status))        {            AcpiOsPrintf ("/*** Could not validate Resource, type (%X) %s***/\n",                ResourceType, AcpiFormatException (Status));            return;        }        /* Point to next descriptor */        CurrentByteOffset += AcpiUtGetDescriptorLength (Aml);        /* Descriptor pre-processing */        switch (ResourceType)        {        case ACPI_RESOURCE_NAME_START_DEPENDENT:            /* Finish a previous StartDependentFns */            if (DependentFns)            {                Level--;                AcpiDmIndent (Level);                AcpiOsPrintf ("}\n");            }            break;        case ACPI_RESOURCE_NAME_END_DEPENDENT:            Level--;            DependentFns = FALSE;            break;        case ACPI_RESOURCE_NAME_END_TAG:            /* Normal exit, the resource list is finished */            if (DependentFns)            {                /*                 * Close an open StartDependentDescriptor. This indicates a                 * missing EndDependentDescriptor.                 */                Level--;                DependentFns = FALSE;                /* Go ahead and insert EndDependentFn() */                AcpiDmEndDependentDescriptor (Aml, ResourceLength, Level);                AcpiDmIndent (Level);                AcpiOsPrintf (                    "/*** Disassembler: inserted missing EndDependentFn () ***/\n");            }            return;        default:            break;        }        /* Disassemble the resource structure */        if (Node)        {            ResourceName = Node->Name.Integer;            Node = Node->Peer;        }        AcpiGbl_DumpResourceDispatch [ResourceIndex] (            Aml, ResourceLength, Level);        /* Descriptor post-processing */        if (ResourceType == ACPI_RESOURCE_NAME_START_DEPENDENT)        {            DependentFns = TRUE;            Level++;        }    }}/******************************************************************************* * * FUNCTION:    AcpiDmIsResourceTemplate * * PARAMETERS:  Op          - Buffer Op to be examined * * RETURN:      Status. AE_OK if valid template * * DESCRIPTION: Walk a byte list to determine if it consists of a valid set *              of resource descriptors.  Nothing is output. * ******************************************************************************/ACPI_STATUSAcpiDmIsResourceTemplate (    ACPI_PARSE_OBJECT       *Op){    ACPI_STATUS             Status;    ACPI_PARSE_OBJECT       *NextOp;    UINT8                   *Aml;    UINT8                   *EndAml;    ACPI_SIZE               Length;    /* This op must be a buffer */    if (Op->Common.AmlOpcode != AML_BUFFER_OP)    {        return (AE_TYPE);    }    /* Get the ByteData list and length */    NextOp = Op->Common.Value.Arg;    NextOp = NextOp->Common.Next;    if (!NextOp)    {        return (AE_TYPE);    }    Aml = NextOp->Named.Data;    Length = (ACPI_SIZE) NextOp->Common.Value.Integer;    /* Walk the byte list, abort on any invalid descriptor type or length */    Status = AcpiUtWalkAmlResources (Aml, Length, NULL, &EndAml);    if (ACPI_FAILURE (Status))    {        return (AE_TYPE);    }    /*     * For the resource template to be valid, one EndTag must appear     * at the very end of the ByteList, not before. (For proper disassembly     * of a ResourceTemplate, the buffer must not have any extra data after     * the EndTag.)     */    if ((Aml + Length - sizeof (AML_RESOURCE_END_TAG)) != EndAml)    {        return (AE_AML_NO_RESOURCE_END_TAG);    }    /*     * All resource descriptors are valid, therefore this list appears     * to be a valid resource template     */    return (AE_OK);}#endif

⌨️ 快捷键说明

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