FreeBSD/sys/contrib/dev/acpica/components/namespace/nsarguments.c
/*******************************************************************************
 *
 * FUNCTION:    AcpiNsCheckArgumentCount
 *
 * PARAMETERS:  Pathname        - Full pathname to the node (for error msgs)
 *              Node            - Namespace node for the method/object
 *              UserParamCount  - Number of args passed in by the caller
 *              Predefined      - Pointer to entry in predefined name table
 *
 * RETURN:      None
 *
 * DESCRIPTION: Check that incoming argument count matches the declared
 *              parameter count (in the ASL/AML) for an object.
 *
 ******************************************************************************/
AcpiNsCheckArgumentCount
PARAMETERS:  Pathname        - Full pathname to the node (for error msgs)
Node            - Namespace node for the method/object
UserParamCount  - Number of args passed in by the caller
Predefined      - Pointer to entry in predefined name table

None

Check that incoming argument count matches the declared
parameter count (in the ASL/AML) for an object.
AcpiNsCheckArgumentCount PARAMETERS : Pathname - Full pathname to the node ( for error msgs ) Node - Namespace node for the method / object UserParamCount - Number of args passed in by the caller Predefined - Pointer to entry in predefined name table None Check that incoming argument count matches the declared parameter count ( in the ASL / AML ) for an object .
void
AcpiNsCheckArgumentCount (
    char                        *Pathname,
    ACPI_NAMESPACE_NODE         *Node,
    UINT32                      UserParamCount,
    const ACPI_PREDEFINED_INFO  *Predefined)
{
    UINT32                      AmlParamCount;
    UINT32                      RequiredParamCount;
    if (!Predefined)
    {
        if (Node->Type != ACPI_TYPE_METHOD)
        {
            if (UserParamCount)
            {
                ACPI_INFO_PREDEFINED ((AE_INFO, Pathname, ACPI_WARN_ALWAYS,
                    "%u arguments were passed to a non-method ACPI object (%s)",
                    UserParamCount, AcpiUtGetTypeName (Node->Type)));
            }
            return;
        }
        AmlParamCount = Node->Object->Method.ParamCount;
        if (UserParamCount < AmlParamCount)
        {
            ACPI_WARN_PREDEFINED ((AE_INFO, Pathname, ACPI_WARN_ALWAYS,
                "Insufficient arguments - "
                "Caller passed %u, method requires %u",
                UserParamCount, AmlParamCount));
        }
        else if (UserParamCount > AmlParamCount)
        {
            ACPI_INFO_PREDEFINED ((AE_INFO, Pathname, ACPI_WARN_ALWAYS,
                "Excess arguments - "
                "Caller passed %u, method requires %u",
                UserParamCount, AmlParamCount));
        }
        return;
    }
    RequiredParamCount =
        METHOD_GET_ARG_COUNT (Predefined->Info.ArgumentList);
    if (UserParamCount < RequiredParamCount)
    {
        ACPI_WARN_PREDEFINED ((AE_INFO, Pathname, ACPI_WARN_ALWAYS,
            "Insufficient arguments - "
            "Caller passed %u, ACPI requires %u",
            UserParamCount, RequiredParamCount));
    }
    else if ((UserParamCount > RequiredParamCount) &&
        !(Predefined->Info.ArgumentList & ARG_COUNT_IS_MINIMUM))
    {
        ACPI_INFO_PREDEFINED ((AE_INFO, Pathname, ACPI_WARN_ALWAYS,
            "Excess arguments - "
            "Caller passed %u, ACPI requires %u",
            UserParamCount, RequiredParamCount));
    }
}
void AcpiNsCheckArgumentCount ( char * Pathname , ACPI_NAMESPACE_NODE * Node , UINT32 UserParamCount , const ACPI_PREDEFINED_INFO * Predefined ) { UINT32 AmlParamCount ; UINT32 RequiredParamCount ; if ( ! Predefined ) { if ( Node -> Type != ACPI_TYPE_METHOD ) { if ( UserParamCount ) { ACPI_INFO_PREDEFINED ( ( AE_INFO , Pathname , ACPI_WARN_ALWAYS , " " , UserParamCount , AcpiUtGetTypeName ( Node -> Type ) ) ) ; } return ; } AmlParamCount = Node -> Object -> Method . ParamCount ; if ( UserParamCount < AmlParamCount ) { ACPI_WARN_PREDEFINED ( ( AE_INFO , Pathname , ACPI_WARN_ALWAYS , " " " " , UserParamCount , AmlParamCount ) ) ; } else if ( UserParamCount > AmlParamCount ) { ACPI_INFO_PREDEFINED ( ( AE_INFO , Pathname , ACPI_WARN_ALWAYS , " " " " , UserParamCount , AmlParamCount ) ) ; } return ; } RequiredParamCount = METHOD_GET_ARG_COUNT ( Predefined -> Info . ArgumentList ) ; if ( UserParamCount < RequiredParamCount ) { ACPI_WARN_PREDEFINED ( ( AE_INFO , Pathname , ACPI_WARN_ALWAYS , " " " " , UserParamCount , RequiredParamCount ) ) ; } else if ( ( UserParamCount > RequiredParamCount ) && ! ( Predefined -> Info . ArgumentList & ARG_COUNT_IS_MINIMUM ) ) { ACPI_INFO_PREDEFINED ( ( AE_INFO , Pathname , ACPI_WARN_ALWAYS , " " " " , UserParamCount , RequiredParamCount ) ) ; } }
FUNCTION:    AcpiNsCheckArgumentCount
 PARAMETERS:  Pathname        - Full pathname to the node (for error msgs)
              Node            - Namespace node for the method/object
              UserParamCount  - Number of args passed in by the caller
              Predefined      - Pointer to entry in predefined name table
FUNCTION : AcpiNsCheckArgumentCount PARAMETERS : Pathname - Full pathname to the node ( for error msgs ) Node - Namespace node for the method / object UserParamCount - Number of args passed in by the caller Predefined - Pointer to entry in predefined name table
/*
         * Not a predefined name. Check the incoming user argument count
         * against the count that is specified in the method/object.
         */ /*
         * This is a control method. Check the parameter count.
         * We can only check the incoming argument count against the
         * argument count declared for the method in the ASL/AML.
         *
         * Emit a message if too few or too many arguments have been passed
         * by the caller.
         *
         * Note: Too many arguments will not cause the method to
         * fail. However, the method will fail if there are too few
         * arguments and the method attempts to use one of the missing ones.
         */ /*
     * This is a predefined name. Validate the user-supplied parameter
     * count against the ACPI specification. We don't validate against
     * the method itself because what is important here is that the
     * caller is in conformance with the spec. (The arg count for the
     * method was checked against the ACPI spec earlier.)
     *
     * Some methods are allowed to have a "minimum" number of args (_SCP)
     * because their definition in ACPI has changed over time.
     */