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

📄 asltree.c

📁 acpi tools for linux include acpiexec and acpixtract
💻 C
📖 第 1 页 / 共 3 页
字号:
{    DbgPrint (ASL_PARSE_OUTPUT,        "\nSetNodeFlags: Op %p, %8.8X %s\n\n", Op, Flags,        TrGetNodeFlagName (Flags));    if (!Op)    {        return NULL;    }    Op->Asl.CompileFlags |= Flags;    return Op;}/******************************************************************************* * * FUNCTION:    TrSetEndLineNumber * * PARAMETERS:  Op                - An existing parse node * * RETURN:      None. * * DESCRIPTION: Set the ending line numbers (file line and logical line) of a *              parse node to the current line numbers. * ******************************************************************************/voidTrSetEndLineNumber (    ACPI_PARSE_OBJECT       *Op){    /* If the end line # is already set, just return */    if (Op->Asl.EndLine)    {        return;    }    Op->Asl.EndLine        = Gbl_CurrentLineNumber;    Op->Asl.EndLogicalLine = Gbl_LogicalLineNumber;}/******************************************************************************* * * FUNCTION:    TrCreateLeafNode * * PARAMETERS:  ParseOpcode         - New opcode to be assigned to the node * * RETURN:      Pointer to the new node.  Aborts on allocation failure * * DESCRIPTION: Create a simple leaf node (no children or peers, and no value *              assigned to the node) * ******************************************************************************/ACPI_PARSE_OBJECT *TrCreateLeafNode (    UINT32                  ParseOpcode){    ACPI_PARSE_OBJECT       *Op;    Op = TrAllocateNode (ParseOpcode);    DbgPrint (ASL_PARSE_OUTPUT,        "\nCreateLeafNode  Ln/Col %d/%d NewNode %p  Op %s\n\n",        Op->Asl.LineNumber, Op->Asl.Column, Op, UtGetOpName(ParseOpcode));    return Op;}/******************************************************************************* * * FUNCTION:    TrCreateValuedLeafNode * * PARAMETERS:  ParseOpcode         - New opcode to be assigned to the node *              Value               - Value to be assigned to the node * * RETURN:      Pointer to the new node.  Aborts on allocation failure * * DESCRIPTION: Create a leaf node (no children or peers) with a value *              assigned to it * ******************************************************************************/ACPI_PARSE_OBJECT *TrCreateValuedLeafNode (    UINT32                  ParseOpcode,    ACPI_INTEGER            Value){    ACPI_PARSE_OBJECT       *Op;    Op = TrAllocateNode (ParseOpcode);    DbgPrint (ASL_PARSE_OUTPUT,        "\nCreateValuedLeafNode  Ln/Col %d/%d NewNode %p  Op %s  Value %8.8X%8.8X  ",        Op->Asl.LineNumber, Op->Asl.Column, Op, UtGetOpName(ParseOpcode),        ACPI_FORMAT_UINT64 (Value));    Op->Asl.Value.Integer = Value;    switch (ParseOpcode)    {    case PARSEOP_STRING_LITERAL:        DbgPrint (ASL_PARSE_OUTPUT, "STRING->%s", Value);        break;    case PARSEOP_NAMESEG:        DbgPrint (ASL_PARSE_OUTPUT, "NAMESEG->%s", Value);        break;    case PARSEOP_NAMESTRING:        DbgPrint (ASL_PARSE_OUTPUT, "NAMESTRING->%s", Value);        break;    case PARSEOP_EISAID:        DbgPrint (ASL_PARSE_OUTPUT, "EISAID->%s", Value);        break;    case PARSEOP_METHOD:        DbgPrint (ASL_PARSE_OUTPUT, "METHOD");        break;    case PARSEOP_INTEGER:        DbgPrint (ASL_PARSE_OUTPUT, "INTEGER");        break;    default:        break;    }    DbgPrint (ASL_PARSE_OUTPUT, "\n\n");    return Op;}/******************************************************************************* * * FUNCTION:    TrCreateNode * * PARAMETERS:  ParseOpcode         - Opcode to be assigned to the node *              NumChildren         - Number of children to follow *              ...                 - A list of child nodes to link to the new *                                    node.  NumChildren long. * * RETURN:      Pointer to the new node.  Aborts on allocation failure * * DESCRIPTION: Create a new parse node and link together a list of child *              nodes underneath the new node. * ******************************************************************************/ACPI_PARSE_OBJECT *TrCreateNode (    UINT32                  ParseOpcode,    UINT32                  NumChildren,    ...){    ACPI_PARSE_OBJECT       *Op;    ACPI_PARSE_OBJECT       *Child;    ACPI_PARSE_OBJECT       *PrevChild;    va_list                 ap;    UINT32                  i;    BOOLEAN                 FirstChild;    va_start (ap, NumChildren);    /* Allocate one new node */    Op = TrAllocateNode (ParseOpcode);    DbgPrint (ASL_PARSE_OUTPUT,        "\nCreateNode  Ln/Col %d/%d NewParent %p Child %d Op %s  ",        Op->Asl.LineNumber, Op->Asl.Column, Op, NumChildren, UtGetOpName(ParseOpcode));    /* Some extra debug output based on the parse opcode */    switch (ParseOpcode)    {    case PARSEOP_DEFINITIONBLOCK:        RootNode = Op;        DbgPrint (ASL_PARSE_OUTPUT, "DEFINITION_BLOCK (Tree Completed)->");        break;    case PARSEOP_OPERATIONREGION:        DbgPrint (ASL_PARSE_OUTPUT, "OPREGION->");        break;    case PARSEOP_OR:        DbgPrint (ASL_PARSE_OUTPUT, "OR->");        break;    default:        /* Nothing to do for other opcodes */        break;    }    /* Link the new node to its children */    PrevChild = NULL;    FirstChild = TRUE;    for (i = 0; i < NumChildren; i++)    {        /* Get the next child */        Child = va_arg (ap, ACPI_PARSE_OBJECT *);        DbgPrint (ASL_PARSE_OUTPUT, "%p, ", Child);        /*         * If child is NULL, this means that an optional argument         * was omitted.  We must create a placeholder with a special         * opcode (DEFAULT_ARG) so that the code generator will know         * that it must emit the correct default for this argument         */        if (!Child)        {            Child = TrAllocateNode (PARSEOP_DEFAULT_ARG);        }        /* Link first child to parent */        if (FirstChild)        {            FirstChild = FALSE;            Op->Asl.Child = Child;        }        /* Point all children to parent */        Child->Asl.Parent = Op;        /* Link children in a peer list */        if (PrevChild)        {            PrevChild->Asl.Next = Child;        };        /*         * This child might be a list, point all nodes in the list         * to the same parent         */        while (Child->Asl.Next)        {            Child = Child->Asl.Next;            Child->Asl.Parent = Op;        }        PrevChild = Child;    }    va_end(ap);    DbgPrint (ASL_PARSE_OUTPUT, "\n\n");    return Op;}/******************************************************************************* * * FUNCTION:    TrLinkChildren * * PARAMETERS:  Op                - An existing parse node *              NumChildren         - Number of children to follow *              ...                 - A list of child nodes to link to the new *                                    node.  NumChildren long. * * RETURN:      The updated (linked) node * * DESCRIPTION: Link a group of nodes to an existing parse node * ******************************************************************************/ACPI_PARSE_OBJECT *TrLinkChildren (    ACPI_PARSE_OBJECT       *Op,    UINT32                  NumChildren,    ...){    ACPI_PARSE_OBJECT       *Child;    ACPI_PARSE_OBJECT       *PrevChild;    va_list                 ap;    UINT32                  i;    BOOLEAN                 FirstChild;    va_start (ap, NumChildren);    TrSetEndLineNumber (Op);    DbgPrint (ASL_PARSE_OUTPUT,        "\nLinkChildren  Line [%d to %d] NewParent %p Child %d Op %s  ",        Op->Asl.LineNumber, Op->Asl.EndLine,        Op, NumChildren, UtGetOpName(Op->Asl.ParseOpcode));    switch (Op->Asl.ParseOpcode)    {    case PARSEOP_DEFINITIONBLOCK:        RootNode = Op;        DbgPrint (ASL_PARSE_OUTPUT, "DEFINITION_BLOCK (Tree Completed)->");        break;    case PARSEOP_OPERATIONREGION:        DbgPrint (ASL_PARSE_OUTPUT, "OPREGION->");        break;    case PARSEOP_OR:        DbgPrint (ASL_PARSE_OUTPUT, "OR->");        break;    default:        /* Nothing to do for other opcodes */        break;    }    /* Link the new node to it's children */    PrevChild = NULL;    FirstChild = TRUE;    for (i = 0; i < NumChildren; i++)    {        Child = va_arg (ap, ACPI_PARSE_OBJECT *);        if ((Child == PrevChild) && (Child != NULL))        {            AslError (ASL_WARNING, ASL_MSG_COMPILER_INTERNAL, Child,                "Child node list invalid");            return Op;        }        DbgPrint (ASL_PARSE_OUTPUT, "%p, ", Child);        /*         * If child is NULL, this means that an optional argument         * was omitted.  We must create a placeholder with a special         * opcode (DEFAULT_ARG) so that the code generator will know         * that it must emit the correct default for this argument         */        if (!Child)        {            Child = TrAllocateNode (PARSEOP_DEFAULT_ARG);        }        /* Link first child to parent */        if (FirstChild)        {            FirstChild = FALSE;            Op->Asl.Child = Child;        }        /* Point all children to parent */        Child->Asl.Parent = Op;        /* Link children in a peer list */        if (PrevChild)        {            PrevChild->Asl.Next = Child;        };        /*         * This child might be a list, point all nodes in the list         * to the same parent         */        while (Child->Asl.Next)        {            Child = Child->Asl.Next;            Child->Asl.Parent = Op;        }        PrevChild = Child;    }    va_end(ap);    DbgPrint (ASL_PARSE_OUTPUT, "\n\n");    return Op;}/******************************************************************************* * * FUNCTION:    TrLinkPeerNode * * PARAMETERS:  Op1           - First peer *              Op2           - Second peer * * RETURN:      Op1 or the non-null node. * * DESCRIPTION: Link two nodes as peers.  Handles cases where one peer is null. * ******************************************************************************/

⌨️ 快捷键说明

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