FreeBSD/sys/contrib/dev/acpica/compiler/asllength.c
/*******************************************************************************
 *
 * FUNCTION:    LnPackageLengthWalk
 *
 * PARAMETERS:  ASL_WALK_CALLBACK
 *
 * RETURN:      Status
 *
 * DESCRIPTION: Walk callback to calculate the total AML length.
 *              1) Calculate the AML lengths (opcode, package length, etc.) for
 *                 THIS node.
 *              2) Bubbble up all of these lengths to the parent node by summing
 *                 them all into the parent subtree length.
 *
 * Note:  The SubtreeLength represents the total AML length of all child nodes
 *        in all subtrees under a given node. Therefore, once this walk is
 *        complete, the Root Node subtree length is the AML length of the entire
 *        tree (and thus, the entire ACPI table)
 *
 ******************************************************************************/


Status

Walk callback to calculate the total AML length.
1) Calculate the AML lengths (opcode, package length, etc.) for
THIS node.
2) Bubbble up all of these lengths to the parent node by summing
them all into the parent subtree length.

The SubtreeLength represents the total AML length of all child nodes
in all subtrees under a given node. Therefore, once this walk is
complete, the Root Node subtree length is the AML length of the entire
tree (and thus, the entire ACPI table)
Status Walk callback to calculate the total AML length . 1 ) Calculate the AML lengths ( opcode package length etc . ) for THIS node . 2 ) Bubbble up all of these lengths to the parent node by summing them all into the parent subtree length . The SubtreeLength represents the total AML length of all child nodes in all subtrees under a given node . Therefore once this walk is complete the Root Node subtree length is the AML length of the entire tree ( and thus the entire ACPI table )
ACPI_STATUS
LnPackageLengthWalk (
    ACPI_PARSE_OBJECT       *Op,
    UINT32                  Level,
    void                    *Context)
{
    CgGenerateAmlLengths (Op);
    if ((Op->Asl.Parent) &&
        (Op->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG))
    {
        Op->Asl.Parent->Asl.AmlSubtreeLength += (
            Op->Asl.AmlLength +
            Op->Asl.AmlOpcodeLength +
            Op->Asl.AmlPkgLenBytes +
            Op->Asl.AmlSubtreeLength);
    }
    return (AE_OK);
}
ACPI_STATUS LnPackageLengthWalk ( ACPI_PARSE_OBJECT * Op , UINT32 Level , void * Context ) { CgGenerateAmlLengths ( Op ) ; if ( ( Op -> Asl . Parent ) && ( Op -> Asl . ParseOpcode != PARSEOP_DEFAULT_ARG ) ) { Op -> Asl . Parent -> Asl . AmlSubtreeLength += ( Op -> Asl . AmlLength + Op -> Asl . AmlOpcodeLength + Op -> Asl . AmlPkgLenBytes + Op -> Asl . AmlSubtreeLength ) ; } return ( AE_OK ) ; }
FUNCTION:    LnPackageLengthWalk
 PARAMETERS:  ASL_WALK_CALLBACK
FUNCTION : LnPackageLengthWalk PARAMETERS : ASL_WALK_CALLBACK
/* Generate the AML lengths for this node */ /* Bubble up all lengths (this node and all below it) to the parent */