deps/acpica/source/components/disassembler/dmresrc.c
/*******************************************************************************
 *
 * FUNCTION:    AcpiDmIsResourceTemplate
 *
 * PARAMETERS:  WalkState           - Current walk info
 *              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.
 *
 ******************************************************************************/
AcpiDmIsResourceTemplate
PARAMETERS:  WalkState           - Current walk info
Op                  - Buffer Op to be examined

Status. AE_OK if valid template

Walk a byte list to determine if it consists of a valid set
of resource descriptors. Nothing is output.
AcpiDmIsResourceTemplate PARAMETERS : WalkState - Current walk info Op - Buffer Op to be examined Status . AE_OK if valid template Walk a byte list to determine if it consists of a valid set of resource descriptors . Nothing is output .
ACPI_STATUS
AcpiDmIsResourceTemplate (
    ACPI_WALK_STATE         *WalkState,
    ACPI_PARSE_OBJECT       *Op)
{
    ACPI_STATUS             Status;
    ACPI_PARSE_OBJECT       *NextOp;
    UINT8                   *Aml;
    UINT8                   *EndAml;
    ACPI_SIZE               Length;
    if (Op->Common.AmlOpcode != AML_BUFFER_OP)
    {
        return (AE_TYPE);
    }
    NextOp = Op->Common.Value.Arg;
    if (!NextOp)
    {
        AcpiOsPrintf ("NULL byte list in buffer\n");
        return (AE_TYPE);
    }
    NextOp = NextOp->Common.Next;
    if (!NextOp)
    {
        return (AE_TYPE);
    }
    Aml = NextOp->Named.Data;
    Length = (ACPI_SIZE) NextOp->Common.Value.Integer;
    Status = AcpiUtWalkAmlResources (WalkState, Aml, Length,
        NULL, ACPI_CAST_INDIRECT_PTR (void, &EndAml));
    if (ACPI_FAILURE (Status))
    {
        return (AE_TYPE);
    }
    if ((Aml + Length - sizeof (AML_RESOURCE_END_TAG)) != EndAml)
    {
        return (AE_AML_NO_RESOURCE_END_TAG);
    }
    return (AE_OK);
}
ACPI_STATUS AcpiDmIsResourceTemplate ( ACPI_WALK_STATE * WalkState , ACPI_PARSE_OBJECT * Op ) { ACPI_STATUS Status ; ACPI_PARSE_OBJECT * NextOp ; UINT8 * Aml ; UINT8 * EndAml ; ACPI_SIZE Length ; if ( Op -> Common . AmlOpcode != AML_BUFFER_OP ) { return ( AE_TYPE ) ; } NextOp = Op -> Common . Value . Arg ; if ( ! NextOp ) { AcpiOsPrintf ( " \n " ) ; return ( AE_TYPE ) ; } NextOp = NextOp -> Common . Next ; if ( ! NextOp ) { return ( AE_TYPE ) ; } Aml = NextOp -> Named . Data ; Length = ( ACPI_SIZE ) NextOp -> Common . Value . Integer ; Status = AcpiUtWalkAmlResources ( WalkState , Aml , Length , NULL , ACPI_CAST_INDIRECT_PTR ( void , & EndAml ) ) ; if ( ACPI_FAILURE ( Status ) ) { return ( AE_TYPE ) ; } if ( ( Aml + Length - sizeof ( AML_RESOURCE_END_TAG ) ) != EndAml ) { return ( AE_AML_NO_RESOURCE_END_TAG ) ; } return ( AE_OK ) ; }
FUNCTION:    AcpiDmIsResourceTemplate
 PARAMETERS:  WalkState           - Current walk info
              Op                  - Buffer Op to be examined
FUNCTION : AcpiDmIsResourceTemplate PARAMETERS : WalkState - Current walk info Op - Buffer Op to be examined
/* This op must be a buffer */ /* Get the ByteData list and length */ /* Walk the byte list, abort on any invalid descriptor type or length */ /*
     * 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.)
     */ /*
     * All resource descriptors are valid, therefore this list appears
     * to be a valid resource template
     */