FreeBSD/sys/contrib/dev/acpica/components/namespace/nsprepkg.c
/*******************************************************************************
 *
 * FUNCTION:    AcpiNsCustomPackage
 *
 * PARAMETERS:  Info                - Method execution information block
 *              Elements            - Pointer to the package elements array
 *              Count               - Element count for the package
 *
 * RETURN:      Status
 *
 * DESCRIPTION: Check a returned package object for the correct count and
 *              correct type of all sub-objects.
 *
 * NOTE: Currently used for the _BIX method only. When needed for two or more
 * methods, probably a detect/dispatch mechanism will be required.
 *
 ******************************************************************************/
AcpiNsCustomPackage
PARAMETERS:  Info                - Method execution information block
Elements            - Pointer to the package elements array
Count               - Element count for the package

Status

Check a returned package object for the correct count and
correct type of all sub-objects.

Currently used for the _BIX method only. When needed for two or more
methods, probably a detect/dispatch mechanism will be required.
AcpiNsCustomPackage PARAMETERS : Info - Method execution information block Elements - Pointer to the package elements array Count - Element count for the package Status Check a returned package object for the correct count and correct type of all sub - objects . Currently used for the _BIX method only . When needed for two or more methods probably a detect / dispatch mechanism will be required .
static ACPI_STATUS
AcpiNsCustomPackage (
    ACPI_EVALUATE_INFO          *Info,
    ACPI_OPERAND_OBJECT         **Elements,
    UINT32                      Count)
{
    UINT32                      ExpectedCount;
    UINT32                      Version;
    ACPI_STATUS                 Status = AE_OK;
    ACPI_FUNCTION_NAME (NsCustomPackage);
    if ((*Elements)->Common.Type != ACPI_TYPE_INTEGER)
    {
        ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags,
            "Return Package has invalid object type for version number"));
        return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
    }
    Version = (UINT32) (*Elements)->Integer.Value;
    ExpectedCount = 21;         
    if (Version == 0)
    {
        ExpectedCount = 20;     
    }
    if (Count < ExpectedCount)
    {
        ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags,
            "Return Package is too small - found %u elements, expected %u",
            Count, ExpectedCount));
        return_ACPI_STATUS (AE_AML_OPERAND_VALUE);
    }
    else if (Count > ExpectedCount)
    {
        ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR,
            "%s: Return Package is larger than needed - "
            "found %u, expected %u\n",
            Info->FullPathname, Count, ExpectedCount));
    }
    Status = AcpiNsCheckPackageElements (Info, Elements,
        ACPI_RTYPE_INTEGER, 16,
        ACPI_RTYPE_STRING, 4, 0);
    if (ACPI_FAILURE (Status))
    {
        return_ACPI_STATUS (Status);
    }
    if (Version > 0)
    {
        Status = AcpiNsCheckPackageElements (Info, Elements + 20,
            ACPI_RTYPE_INTEGER, 1, 0, 0, 20);
    }
    return_ACPI_STATUS (Status);
}
static ACPI_STATUS AcpiNsCustomPackage ( ACPI_EVALUATE_INFO * Info , ACPI_OPERAND_OBJECT * * Elements , UINT32 Count ) { UINT32 ExpectedCount ; UINT32 Version ; ACPI_STATUS Status = AE_OK ; ACPI_FUNCTION_NAME ( NsCustomPackage ) ; if ( ( * Elements ) -> Common . Type != ACPI_TYPE_INTEGER ) { ACPI_WARN_PREDEFINED ( ( AE_INFO , Info -> FullPathname , Info -> NodeFlags , " " ) ) ; return_ACPI_STATUS ( AE_AML_OPERAND_TYPE ) ; } Version = ( UINT32 ) ( * Elements ) -> Integer . Value ; ExpectedCount = 21 ; if ( Version == 0 ) { ExpectedCount = 20 ; } if ( Count < ExpectedCount ) { ACPI_WARN_PREDEFINED ( ( AE_INFO , Info -> FullPathname , Info -> NodeFlags , " " , Count , ExpectedCount ) ) ; return_ACPI_STATUS ( AE_AML_OPERAND_VALUE ) ; } else if ( Count > ExpectedCount ) { ACPI_DEBUG_PRINT ( ( ACPI_DB_REPAIR , " " " \n " , Info -> FullPathname , Count , ExpectedCount ) ) ; } Status = AcpiNsCheckPackageElements ( Info , Elements , ACPI_RTYPE_INTEGER , 16 , ACPI_RTYPE_STRING , 4 , 0 ) ; if ( ACPI_FAILURE ( Status ) ) { return_ACPI_STATUS ( Status ) ; } if ( Version > 0 ) { Status = AcpiNsCheckPackageElements ( Info , Elements + 20 , ACPI_RTYPE_INTEGER , 1 , 0 , 0 , 20 ) ; } return_ACPI_STATUS ( Status ) ; }
FUNCTION:    AcpiNsCustomPackage
 PARAMETERS:  Info                - Method execution information block
              Elements            - Pointer to the package elements array
              Count               - Element count for the package
FUNCTION : AcpiNsCustomPackage PARAMETERS : Info - Method execution information block Elements - Pointer to the package elements array Count - Element count for the package
/* Get version number, must be Integer */ /* Version 1 */ /* Version 0 */ /* Validate all elements of the returned package */ /* Version 1 has a single trailing integer */