FreeBSD/sys/contrib/dev/acpica/components/debugger/dbutils.c
/*******************************************************************************
 *
 * FUNCTION:    AcpiDbSecondPassParse
 *
 * PARAMETERS:  Root            - Root of the parse tree
 *
 * RETURN:      Status
 *
 * DESCRIPTION: Second pass parse of the ACPI tables. We need to wait until
 *              second pass to parse the control methods
 *
 ******************************************************************************/
AcpiDbSecondPassParse
PARAMETERS:  Root            - Root of the parse tree

Status

Second pass parse of the ACPI tables. We need to wait until
second pass to parse the control methods
AcpiDbSecondPassParse PARAMETERS : Root - Root of the parse tree Status Second pass parse of the ACPI tables . We need to wait until second pass to parse the control methods
ACPI_STATUS
AcpiDbSecondPassParse (
    ACPI_PARSE_OBJECT       *Root)
{
    ACPI_PARSE_OBJECT       *Op = Root;
    ACPI_PARSE_OBJECT       *Method;
    ACPI_PARSE_OBJECT       *SearchOp;
    ACPI_PARSE_OBJECT       *StartOp;
    ACPI_STATUS             Status = AE_OK;
    UINT32                  BaseAmlOffset;
    ACPI_WALK_STATE         *WalkState;
    ACPI_FUNCTION_ENTRY ();
    AcpiOsPrintf ("Pass two parse ....\n");
    while (Op)
    {
        if (Op->Common.AmlOpcode == AML_METHOD_OP)
        {
            Method = Op;
            WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL);
            if (!WalkState)
            {
                return (AE_NO_MEMORY);
            }
            WalkState->ParserState.Aml          =
            WalkState->ParserState.AmlStart     = Method->Named.Data;
            WalkState->ParserState.AmlEnd       =
            WalkState->ParserState.PkgEnd       = Method->Named.Data +
                                                  Method->Named.Length;
            WalkState->ParserState.StartScope   = Op;
            WalkState->DescendingCallback       = AcpiDsLoad1BeginOp;
            WalkState->AscendingCallback        = AcpiDsLoad1EndOp;
            Status = AcpiPsParseAml (WalkState);
            BaseAmlOffset = (Method->Common.Value.Arg)->Common.AmlOffset + 1;
            StartOp = (Method->Common.Value.Arg)->Common.Next;
            SearchOp = StartOp;
            while (SearchOp)
            {
                SearchOp->Common.AmlOffset += BaseAmlOffset;
                SearchOp = AcpiPsGetDepthNext (StartOp, SearchOp);
            }
        }
        if (Op->Common.AmlOpcode == AML_REGION_OP)
        {
        }
        if (ACPI_FAILURE (Status))
        {
            break;
        }
        Op = AcpiPsGetDepthNext (Root, Op);
    }
    return (Status);
}
ACPI_STATUS AcpiDbSecondPassParse ( ACPI_PARSE_OBJECT * Root ) { ACPI_PARSE_OBJECT * Op = Root ; ACPI_PARSE_OBJECT * Method ; ACPI_PARSE_OBJECT * SearchOp ; ACPI_PARSE_OBJECT * StartOp ; ACPI_STATUS Status = AE_OK ; UINT32 BaseAmlOffset ; ACPI_WALK_STATE * WalkState ; ACPI_FUNCTION_ENTRY ( ) ; AcpiOsPrintf ( " \n " ) ; while ( Op ) { if ( Op -> Common . AmlOpcode == AML_METHOD_OP ) { Method = Op ; WalkState = AcpiDsCreateWalkState ( 0 , NULL , NULL , NULL ) ; if ( ! WalkState ) { return ( AE_NO_MEMORY ) ; } WalkState -> ParserState . Aml = WalkState -> ParserState . AmlStart = Method -> Named . Data ; WalkState -> ParserState . AmlEnd = WalkState -> ParserState . PkgEnd = Method -> Named . Data + Method -> Named . Length ; WalkState -> ParserState . StartScope = Op ; WalkState -> DescendingCallback = AcpiDsLoad1BeginOp ; WalkState -> AscendingCallback = AcpiDsLoad1EndOp ; Status = AcpiPsParseAml ( WalkState ) ; BaseAmlOffset = ( Method -> Common . Value . Arg ) -> Common . AmlOffset + 1 ; StartOp = ( Method -> Common . Value . Arg ) -> Common . Next ; SearchOp = StartOp ; while ( SearchOp ) { SearchOp -> Common . AmlOffset += BaseAmlOffset ; SearchOp = AcpiPsGetDepthNext ( StartOp , SearchOp ) ; } } if ( Op -> Common . AmlOpcode == AML_REGION_OP ) { } if ( ACPI_FAILURE ( Status ) ) { break ; } Op = AcpiPsGetDepthNext ( Root , Op ) ; } return ( Status ) ; }
FUNCTION:    AcpiDbSecondPassParse
 PARAMETERS:  Root            - Root of the parse tree
FUNCTION : AcpiDbSecondPassParse PARAMETERS : Root - Root of the parse tree
/* Create a new walk state for the parse */ /* Init the Walk State */ /* Perform the AML parse */ /* TBD: [Investigate] this isn't quite the right thing to do! */ /*
             *
             * Method = (ACPI_DEFERRED_OP *) Op;
             * Status = AcpiPsParseAml (Op, Method->Body, Method->BodyLength);
             */