FreeBSD/sys/contrib/dev/acpica/compiler/aslprepkg.c
/*******************************************************************************
 *
 * FUNCTION:    ApCustomPackage
 *
 * PARAMETERS:  ParentOp            - Parse op for the package
 *              Predefined          - Pointer to package-specific info for
 *                                    the method
 *
 * RETURN:      None
 *
 * DESCRIPTION: Validate packages that don't fit into the standard model and
 *              require custom code.
 *
 * NOTE: Currently used for the _BIX method only. When needed for two or more
 * methods, probably a detect/dispatch mechanism will be required.
 *
 ******************************************************************************/
ApCustomPackage
PARAMETERS:  ParentOp            - Parse op for the package
Predefined          - Pointer to package-specific info for
the method

None

Validate packages that don't fit into the standard model and
require custom code.

Currently used for the _BIX method only. When needed for two or more
methods, probably a detect/dispatch mechanism will be required.
ApCustomPackage PARAMETERS : ParentOp - Parse op for the package Predefined - Pointer to package - specific info for the method None Validate packages that don ' t fit into the standard model and require custom code . Currently used for the _BIX method only . When needed for two or more methods probably a detect / dispatch mechanism will be required .
static void
ApCustomPackage (
    ACPI_PARSE_OBJECT           *ParentOp,
    const ACPI_PREDEFINED_INFO  *Predefined)
{
    ACPI_PARSE_OBJECT           *Op;
    UINT32                      Count;
    UINT32                      ExpectedCount;
    UINT32                      Version;
    Op = ParentOp->Asl.Child;
    Count = (UINT32) Op->Asl.Value.Integer;
    Op = Op->Asl.Next;
    Version = (UINT32) Op->Asl.Value.Integer;
    if (Op->Asl.ParseOpcode != PARSEOP_INTEGER)
    {
        AslError (ASL_ERROR, ASL_MSG_RESERVED_OPERAND_TYPE, Op, MsgBuffer);
        return;
    }
    ExpectedCount = 21;         
    if (Version == 0)
    {
        ExpectedCount = 20;     
    }
    if (Count < ExpectedCount)
    {
        ApPackageTooSmall (Predefined->Info.Name, ParentOp,
            Count, ExpectedCount);
        return;
    }
    else if (Count > ExpectedCount)
    {
        ApPackageTooLarge (Predefined->Info.Name, ParentOp,
            Count, ExpectedCount);
    }
    Op = ApCheckPackageElements (Predefined->Info.Name, Op,
        ACPI_RTYPE_INTEGER, 16,
        ACPI_RTYPE_STRING, 4);
    if (Version > 0)
    {
        ApCheckPackageElements (Predefined->Info.Name, Op,
            ACPI_RTYPE_INTEGER, 1, 0, 0);
    }
}
static void ApCustomPackage ( ACPI_PARSE_OBJECT * ParentOp , const ACPI_PREDEFINED_INFO * Predefined ) { ACPI_PARSE_OBJECT * Op ; UINT32 Count ; UINT32 ExpectedCount ; UINT32 Version ; Op = ParentOp -> Asl . Child ; Count = ( UINT32 ) Op -> Asl . Value . Integer ; Op = Op -> Asl . Next ; Version = ( UINT32 ) Op -> Asl . Value . Integer ; if ( Op -> Asl . ParseOpcode != PARSEOP_INTEGER ) { AslError ( ASL_ERROR , ASL_MSG_RESERVED_OPERAND_TYPE , Op , MsgBuffer ) ; return ; } ExpectedCount = 21 ; if ( Version == 0 ) { ExpectedCount = 20 ; } if ( Count < ExpectedCount ) { ApPackageTooSmall ( Predefined -> Info . Name , ParentOp , Count , ExpectedCount ) ; return ; } else if ( Count > ExpectedCount ) { ApPackageTooLarge ( Predefined -> Info . Name , ParentOp , Count , ExpectedCount ) ; } Op = ApCheckPackageElements ( Predefined -> Info . Name , Op , ACPI_RTYPE_INTEGER , 16 , ACPI_RTYPE_STRING , 4 ) ; if ( Version > 0 ) { ApCheckPackageElements ( Predefined -> Info . Name , Op , ACPI_RTYPE_INTEGER , 1 , 0 , 0 ) ; } }
FUNCTION:    ApCustomPackage
 PARAMETERS:  ParentOp            - Parse op for the package
              Predefined          - Pointer to package-specific info for
                                    the method
FUNCTION : ApCustomPackage PARAMETERS : ParentOp - Parse op for the package Predefined - Pointer to package - specific info for the method
/* First child is the package length */ /* Get the version number, must be Integer */ /* Validate count (# of elements) */ /* Version 1 */ /* Version 0 */ /* Validate all elements of the package */ /* Version 1 has a single trailing integer */