FreeBSD/sys/contrib/dev/acpica/compiler/aslmapoutput.c
/*******************************************************************************
 *
 * FUNCTION:    MpNamespaceXrefBegin
 *
 * PARAMETERS:  WALK_PARSE_TREE callback
 *
 * RETURN:      Status
 *
 * DESCRIPTION: Walk parse tree callback used to cross-reference GPIO pins.
 *
 ******************************************************************************/


Status

Walk parse tree callback used to cross-reference GPIO pins.
Status Walk parse tree callback used to cross - reference GPIO pins .
static ACPI_STATUS
MpNamespaceXrefBegin (
    ACPI_PARSE_OBJECT       *Op,
    UINT32                  Level,
    void                    *Context)
{
    ACPI_GPIO_INFO          *Info = ACPI_CAST_PTR (ACPI_GPIO_INFO, Context);
    const ACPI_OPCODE_INFO  *OpInfo;
    char                    *DevicePathname;
    ACPI_PARSE_OBJECT       *ParentOp;
    char                    *HidString;
    ACPI_FUNCTION_TRACE_PTR (MpNamespaceXrefBegin, Op);
    if (Op->Asl.CompileFlags & NODE_IS_NAME_DECLARATION)
    {
        return (AE_OK);
    }
    OpInfo = AcpiPsGetOpcodeInfo (Op->Asl.AmlOpcode);
    if ((OpInfo->Flags & AML_NAMED) ||
        (OpInfo->Flags & AML_CREATE))
    {
        return (AE_OK);
    }
    if ((Op->Asl.ParseOpcode != PARSEOP_NAMESTRING) &&
        (Op->Asl.ParseOpcode != PARSEOP_NAMESEG)    &&
        (Op->Asl.ParseOpcode != PARSEOP_METHODCALL))
    {
        return (AE_OK);
    }
    if (!Op->Asl.Node)
    {
        return (AE_OK);
    }
    ParentOp = Op->Asl.Parent;
    if (ParentOp->Asl.ParseOpcode == PARSEOP_FIELD)
    {
        return (AE_OK);
    }
    if (Op->Asl.Node == Info->TargetNode)
    {
        while (ParentOp && (!ParentOp->Asl.Node))
        {
            ParentOp = ParentOp->Asl.Parent;
        }
        if (ParentOp)
        {
            DevicePathname = AcpiNsGetExternalPathname (
                ParentOp->Asl.Node);
            if (!Info->References)
            {
                FlPrintFile (ASL_FILE_MAP_OUTPUT, "  // References:");
            }
            HidString = MpGetHidViaNamestring (DevicePathname);
            FlPrintFile (ASL_FILE_MAP_OUTPUT, " %s [%s]",
                DevicePathname, HidString);
            Info->References++;
            ACPI_FREE (DevicePathname);
        }
    }
    return (AE_OK);
}
static ACPI_STATUS MpNamespaceXrefBegin ( ACPI_PARSE_OBJECT * Op , UINT32 Level , void * Context ) { ACPI_GPIO_INFO * Info = ACPI_CAST_PTR ( ACPI_GPIO_INFO , Context ) ; const ACPI_OPCODE_INFO * OpInfo ; char * DevicePathname ; ACPI_PARSE_OBJECT * ParentOp ; char * HidString ; ACPI_FUNCTION_TRACE_PTR ( MpNamespaceXrefBegin , Op ) ; if ( Op -> Asl . CompileFlags & NODE_IS_NAME_DECLARATION ) { return ( AE_OK ) ; } OpInfo = AcpiPsGetOpcodeInfo ( Op -> Asl . AmlOpcode ) ; if ( ( OpInfo -> Flags & AML_NAMED ) || ( OpInfo -> Flags & AML_CREATE ) ) { return ( AE_OK ) ; } if ( ( Op -> Asl . ParseOpcode != PARSEOP_NAMESTRING ) && ( Op -> Asl . ParseOpcode != PARSEOP_NAMESEG ) && ( Op -> Asl . ParseOpcode != PARSEOP_METHODCALL ) ) { return ( AE_OK ) ; } if ( ! Op -> Asl . Node ) { return ( AE_OK ) ; } ParentOp = Op -> Asl . Parent ; if ( ParentOp -> Asl . ParseOpcode == PARSEOP_FIELD ) { return ( AE_OK ) ; } if ( Op -> Asl . Node == Info -> TargetNode ) { while ( ParentOp && ( ! ParentOp -> Asl . Node ) ) { ParentOp = ParentOp -> Asl . Parent ; } if ( ParentOp ) { DevicePathname = AcpiNsGetExternalPathname ( ParentOp -> Asl . Node ) ; if ( ! Info -> References ) { FlPrintFile ( ASL_FILE_MAP_OUTPUT , " " ) ; } HidString = MpGetHidViaNamestring ( DevicePathname ) ; FlPrintFile ( ASL_FILE_MAP_OUTPUT , " " , DevicePathname , HidString ) ; Info -> References ++ ; ACPI_FREE ( DevicePathname ) ; } } return ( AE_OK ) ; }
FUNCTION:    MpNamespaceXrefBegin
 PARAMETERS:  WALK_PARSE_TREE callback
FUNCTION : MpNamespaceXrefBegin PARAMETERS : WALK_PARSE_TREE callback
/*
     * If this node is the actual declaration of a name
     * [such as the XXXX name in "Method (XXXX)"],
     * we are not interested in it here. We only care about names that
     * are references to other objects within the namespace and the
     * parent objects of name declarations
     */ /* We are only interested in opcodes that have an associated name */