FreeBSD/sys/contrib/dev/acpica/compiler/aslbtypes.c
/*******************************************************************************
 *
 * FUNCTION:    AnGetBtype
 *
 * PARAMETERS:  Op                  - Parse node whose type will be returned.
 *
 * RETURN:      The Btype associated with the Op.
 *
 * DESCRIPTION: Get the (bitfield) ACPI type associated with the parse node.
 *              Handles the case where the node is a name or method call and
 *              the actual type must be obtained from the namespace node.
 *
 ******************************************************************************/
AnGetBtype
PARAMETERS:  Op                  - Parse node whose type will be returned.

The Btype associated with the Op.

Get the (bitfield) ACPI type associated with the parse node.
Handles the case where the node is a name or method call and
the actual type must be obtained from the namespace node.
AnGetBtype PARAMETERS : Op - Parse node whose type will be returned . The Btype associated with the Op . Get the ( bitfield ) ACPI type associated with the parse node . Handles the case where the node is a name or method call and the actual type must be obtained from the namespace node .
UINT32
AnGetBtype (
    ACPI_PARSE_OBJECT       *Op)
{
    ACPI_NAMESPACE_NODE     *Node;
    ACPI_PARSE_OBJECT       *ReferencedNode;
    UINT32                  ThisNodeBtype = 0;
    if (!Op)
    {
        AcpiOsPrintf ("Null Op in AnGetBtype\n");
        return (ACPI_UINT32_MAX);
    }
    if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG)     ||
        (Op->Asl.ParseOpcode == PARSEOP_NAMESTRING)  ||
        (Op->Asl.ParseOpcode == PARSEOP_METHODCALL))
    {
        Node = Op->Asl.Node;
        if (!Node)
        {
            if ((Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_CREATEWORDFIELD) ||
                (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_CREATEDWORDFIELD) ||
                (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_CREATEQWORDFIELD) ||
                (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_CREATEBYTEFIELD) ||
                (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_CREATEBITFIELD) ||
                (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_CREATEFIELD)    ||
                (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_CONDREFOF))
            {
                return (ACPI_UINT32_MAX - 1);
            }
            DbgPrint (ASL_DEBUG_OUTPUT,
                "No attached Nsnode: [%s] at line %u name [%s], "
                "ignoring typecheck. Parent [%s]\n",
                Op->Asl.ParseOpName, Op->Asl.LineNumber,
                Op->Asl.ExternalName, Op->Asl.Parent->Asl.ParseOpName);
            return (ACPI_UINT32_MAX - 1);
        }
        ThisNodeBtype = AnMapEtypeToBtype (Node->Type);
        if (!ThisNodeBtype)
        {
            AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, Op,
                "could not map type");
        }
        if (Op->Asl.ParseOpcode == PARSEOP_METHODCALL)
        {
            ReferencedNode = Node->Op;
            if (!ReferencedNode)
            {
                if (AnIsInternalMethod (Op))
                {
                    return (AnGetInternalMethodReturnType (Op));
                }
                AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, Op,
                    "null Op pointer");
                return (ACPI_UINT32_MAX);
            }
            if (ReferencedNode->Asl.CompileFlags & NODE_METHOD_TYPED)
            {
                ThisNodeBtype = ReferencedNode->Asl.AcpiBtype;
            }
            else
            {
                return (ACPI_UINT32_MAX -1);
            }
        }
    }
    else
    {
        ThisNodeBtype = Op->Asl.AcpiBtype;
    }
    return (ThisNodeBtype);
}
UINT32 AnGetBtype ( ACPI_PARSE_OBJECT * Op ) { ACPI_NAMESPACE_NODE * Node ; ACPI_PARSE_OBJECT * ReferencedNode ; UINT32 ThisNodeBtype = 0 ; if ( ! Op ) { AcpiOsPrintf ( " \n " ) ; return ( ACPI_UINT32_MAX ) ; } if ( ( Op -> Asl . ParseOpcode == PARSEOP_NAMESEG ) || ( Op -> Asl . ParseOpcode == PARSEOP_NAMESTRING ) || ( Op -> Asl . ParseOpcode == PARSEOP_METHODCALL ) ) { Node = Op -> Asl . Node ; if ( ! Node ) { if ( ( Op -> Asl . Parent -> Asl . ParseOpcode == PARSEOP_CREATEWORDFIELD ) || ( Op -> Asl . Parent -> Asl . ParseOpcode == PARSEOP_CREATEDWORDFIELD ) || ( Op -> Asl . Parent -> Asl . ParseOpcode == PARSEOP_CREATEQWORDFIELD ) || ( Op -> Asl . Parent -> Asl . ParseOpcode == PARSEOP_CREATEBYTEFIELD ) || ( Op -> Asl . Parent -> Asl . ParseOpcode == PARSEOP_CREATEBITFIELD ) || ( Op -> Asl . Parent -> Asl . ParseOpcode == PARSEOP_CREATEFIELD ) || ( Op -> Asl . Parent -> Asl . ParseOpcode == PARSEOP_CONDREFOF ) ) { return ( ACPI_UINT32_MAX - 1 ) ; } DbgPrint ( ASL_DEBUG_OUTPUT , " " " \n " , Op -> Asl . ParseOpName , Op -> Asl . LineNumber , Op -> Asl . ExternalName , Op -> Asl . Parent -> Asl . ParseOpName ) ; return ( ACPI_UINT32_MAX - 1 ) ; } ThisNodeBtype = AnMapEtypeToBtype ( Node -> Type ) ; if ( ! ThisNodeBtype ) { AslError ( ASL_ERROR , ASL_MSG_COMPILER_INTERNAL , Op , " " ) ; } if ( Op -> Asl . ParseOpcode == PARSEOP_METHODCALL ) { ReferencedNode = Node -> Op ; if ( ! ReferencedNode ) { if ( AnIsInternalMethod ( Op ) ) { return ( AnGetInternalMethodReturnType ( Op ) ) ; } AslError ( ASL_ERROR , ASL_MSG_COMPILER_INTERNAL , Op , " " ) ; return ( ACPI_UINT32_MAX ) ; } if ( ReferencedNode -> Asl . CompileFlags & NODE_METHOD_TYPED ) { ThisNodeBtype = ReferencedNode -> Asl . AcpiBtype ; } else { return ( ACPI_UINT32_MAX - 1 ) ; } } } else { ThisNodeBtype = Op -> Asl . AcpiBtype ; } return ( ThisNodeBtype ) ; }
FUNCTION:    AnGetBtype
 PARAMETERS:  Op                  - Parse node whose type will be returned.
FUNCTION : AnGetBtype PARAMETERS : Op - Parse node whose type will be returned .
/* These are not expected to have a node at this time */ /* Check for an internal method */