FreeBSD/sys/contrib/dev/acpica/components/disassembler/dmresrc.c
/*******************************************************************************
 *
 * 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.
 *
 ******************************************************************************/
AcpiDmResourceTemplate
PARAMETERS:  Info            - Curent parse tree walk info
ByteData        - Pointer to the byte list data
ByteCount       - Length of the byte list

None

Dump the contents of a Resource Template containing a set of
Resource Descriptors.
AcpiDmResourceTemplate PARAMETERS : Info - Curent parse tree walk info ByteData - Pointer to the byte list data ByteCount - Length of the byte list None Dump the contents of a Resource Template containing a set of Resource Descriptors .
void
AcpiDmResourceTemplate (
    ACPI_OP_WALK_INFO       *Info,
    ACPI_PARSE_OBJECT       *Op,
    UINT8                   *ByteData,
    UINT32                  ByteCount)
{
    ACPI_STATUS             Status;
    UINT32                  CurrentByteOffset;
    UINT8                   ResourceType;
    UINT32                  ResourceLength;
    void                    *Aml;
    UINT32                  Level;
    BOOLEAN                 DependentFns = FALSE;
    UINT8                   ResourceIndex;
    ACPI_NAMESPACE_NODE     *Node;
    if (Op->Asl.AmlOpcode != AML_FIELD_OP)
    {
        Info->MappingOp = Op;
    }
    Level = Info->Level;
    ResourceName = ACPI_DEFAULT_RESNAME;
    Node = Op->Common.Node;
    if (Node)
    {
        Node = Node->Child;
    }
    for (CurrentByteOffset = 0; CurrentByteOffset < ByteCount;)
    {
        Aml = &ByteData[CurrentByteOffset];
        ResourceType = AcpiUtGetResourceType (Aml);
        ResourceLength = AcpiUtGetResourceLength (Aml);
        Status = AcpiUtValidateResource (NULL, Aml, &ResourceIndex);
        if (ACPI_FAILURE (Status))
        {
            AcpiOsPrintf (
                "/*** Could not validate Resource, type (%X) %s***/\n",
                ResourceType, AcpiFormatException (Status));
            return;
        }
        CurrentByteOffset += AcpiUtGetDescriptorLength (Aml);
        switch (ResourceType)
        {
        case ACPI_RESOURCE_NAME_START_DEPENDENT:
            if (DependentFns)
            {
                Level--;
                AcpiDmIndent (Level);
                AcpiOsPrintf ("}\n");
            }
            break;
        case ACPI_RESOURCE_NAME_END_DEPENDENT:
            Level--;
            DependentFns = FALSE;
            break;
        case ACPI_RESOURCE_NAME_END_TAG:
            if (DependentFns)
            {
                Level--;
                DependentFns = FALSE;
                AcpiDmEndDependentDescriptor (Info, Aml, ResourceLength, Level);
                AcpiDmIndent (Level);
                AcpiOsPrintf (
                    "/*** Disassembler: inserted "
                    "missing EndDependentFn () ***/\n");
            }
            return;
        default:
            break;
        }
        if (Node)
        {
            ResourceName = Node->Name.Integer;
            Node = Node->Peer;
        }
        AcpiGbl_DmResourceDispatch [ResourceIndex] (
            Info, Aml, ResourceLength, Level);
        if (ResourceType == ACPI_RESOURCE_NAME_START_DEPENDENT)
        {
            DependentFns = TRUE;
            Level++;
        }
    }
}
void AcpiDmResourceTemplate ( ACPI_OP_WALK_INFO * Info , ACPI_PARSE_OBJECT * Op , UINT8 * ByteData , UINT32 ByteCount ) { ACPI_STATUS Status ; UINT32 CurrentByteOffset ; UINT8 ResourceType ; UINT32 ResourceLength ; void * Aml ; UINT32 Level ; BOOLEAN DependentFns = FALSE ; UINT8 ResourceIndex ; ACPI_NAMESPACE_NODE * Node ; if ( Op -> Asl . AmlOpcode != AML_FIELD_OP ) { Info -> MappingOp = Op ; } Level = Info -> Level ; ResourceName = ACPI_DEFAULT_RESNAME ; Node = Op -> Common . Node ; if ( Node ) { Node = Node -> Child ; } for ( CurrentByteOffset = 0 ; CurrentByteOffset < ByteCount ; ) { Aml = & ByteData [ CurrentByteOffset ] ; ResourceType = AcpiUtGetResourceType ( Aml ) ; ResourceLength = AcpiUtGetResourceLength ( Aml ) ; Status = AcpiUtValidateResource ( NULL , Aml , & ResourceIndex ) ; if ( ACPI_FAILURE ( Status ) ) { AcpiOsPrintf ( " \n " , ResourceType , AcpiFormatException ( Status ) ) ; return ; } CurrentByteOffset += AcpiUtGetDescriptorLength ( Aml ) ; switch ( ResourceType ) { case ACPI_RESOURCE_NAME_START_DEPENDENT : if ( DependentFns ) { Level -- ; AcpiDmIndent ( Level ) ; AcpiOsPrintf ( " \n " ) ; } break ; case ACPI_RESOURCE_NAME_END_DEPENDENT : Level -- ; DependentFns = FALSE ; break ; case ACPI_RESOURCE_NAME_END_TAG : if ( DependentFns ) { Level -- ; DependentFns = FALSE ; AcpiDmEndDependentDescriptor ( Info , Aml , ResourceLength , Level ) ; AcpiDmIndent ( Level ) ; AcpiOsPrintf ( " " " \n " ) ; } return ; default : break ; } if ( Node ) { ResourceName = Node -> Name . Integer ; Node = Node -> Peer ; } AcpiGbl_DmResourceDispatch [ ResourceIndex ] ( Info , Aml , ResourceLength , Level ) ; if ( ResourceType == ACPI_RESOURCE_NAME_START_DEPENDENT ) { DependentFns = TRUE ; Level ++ ; } } }
FUNCTION:    AcpiDmResourceTemplate
 PARAMETERS:  Info            - Curent parse tree walk info
              ByteData        - Pointer to the byte list data
              ByteCount       - Length of the byte list
FUNCTION : AcpiDmResourceTemplate PARAMETERS : Info - Curent parse tree walk info ByteData - Pointer to the byte list data ByteCount - Length of the byte list
/* Get the descriptor type and length */ /* Validate the Resource Type and Resource Length */ /* Point to next descriptor */ /* Descriptor pre-processing */ /* Finish a previous StartDependentFns */ /* Normal exit, the resource list is finished */ /*
                 * Close an open StartDependentDescriptor. This indicates a
                 * missing EndDependentDescriptor.
                 */ /* Go ahead and insert EndDependentFn() */ /* Disassemble the resource structure */ /* Descriptor post-processing */