FreeBSD/sys/contrib/dev/acpica/components/namespace/nsarguments.c
/*******************************************************************************
 *
 * FUNCTION:    AcpiNsCheckAcpiCompliance
 *
 * PARAMETERS:  Pathname        - Full pathname to the node (for error msgs)
 *              Node            - Namespace node for the method/object
 *              Predefined      - Pointer to entry in predefined name table
 *
 * RETURN:      None
 *
 * DESCRIPTION: Check that the declared parameter count (in ASL/AML) for a
 *              predefined name is what is expected (matches what is defined in
 *              the ACPI specification for this predefined name.)
 *
 ******************************************************************************/
AcpiNsCheckAcpiCompliance
PARAMETERS:  Pathname        - Full pathname to the node (for error msgs)
Node            - Namespace node for the method/object
Predefined      - Pointer to entry in predefined name table

None

Check that the declared parameter count (in ASL/AML) for a
predefined name is what is expected (matches what is defined in
the ACPI specification for this predefined name.)
AcpiNsCheckAcpiCompliance PARAMETERS : Pathname - Full pathname to the node ( for error msgs ) Node - Namespace node for the method / object Predefined - Pointer to entry in predefined name table None Check that the declared parameter count ( in ASL / AML ) for a predefined name is what is expected ( matches what is defined in the ACPI specification for this predefined name . )
void
AcpiNsCheckAcpiCompliance (
    char                        *Pathname,
    ACPI_NAMESPACE_NODE         *Node,
    const ACPI_PREDEFINED_INFO  *Predefined)
{
    UINT32                      AmlParamCount;
    UINT32                      RequiredParamCount;
    if (!Predefined)
    {
        return;
    }
    RequiredParamCount =
        METHOD_GET_ARG_COUNT (Predefined->Info.ArgumentList);
    if (Node->Type != ACPI_TYPE_METHOD)
    {
        if (RequiredParamCount > 0)
        {
            ACPI_BIOS_ERROR_PREDEFINED ((AE_INFO, Pathname, ACPI_WARN_ALWAYS,
                "Object (%s) must be a control method with %u arguments",
                AcpiUtGetTypeName (Node->Type), RequiredParamCount));
        }
        else if (!RequiredParamCount && !Predefined->Info.ExpectedBtypes)
        {
            ACPI_BIOS_ERROR_PREDEFINED ((AE_INFO, Pathname, ACPI_WARN_ALWAYS,
                "Object (%s) must be a control method "
                "with no arguments and no return value",
                AcpiUtGetTypeName (Node->Type)));
        }
        return;
    }
    AmlParamCount = Node->Object->Method.ParamCount;
    if (AmlParamCount < RequiredParamCount)
    {
        ACPI_BIOS_ERROR_PREDEFINED ((AE_INFO, Pathname, ACPI_WARN_ALWAYS,
            "Insufficient arguments - "
            "ASL declared %u, ACPI requires %u",
            AmlParamCount, RequiredParamCount));
    }
    else if ((AmlParamCount > RequiredParamCount) &&
        !(Predefined->Info.ArgumentList & ARG_COUNT_IS_MINIMUM))
    {
        ACPI_BIOS_ERROR_PREDEFINED ((AE_INFO, Pathname, ACPI_WARN_ALWAYS,
            "Excess arguments - "
            "ASL declared %u, ACPI requires %u",
            AmlParamCount, RequiredParamCount));
    }
}
void AcpiNsCheckAcpiCompliance ( char * Pathname , ACPI_NAMESPACE_NODE * Node , const ACPI_PREDEFINED_INFO * Predefined ) { UINT32 AmlParamCount ; UINT32 RequiredParamCount ; if ( ! Predefined ) { return ; } RequiredParamCount = METHOD_GET_ARG_COUNT ( Predefined -> Info . ArgumentList ) ; if ( Node -> Type != ACPI_TYPE_METHOD ) { if ( RequiredParamCount > 0 ) { ACPI_BIOS_ERROR_PREDEFINED ( ( AE_INFO , Pathname , ACPI_WARN_ALWAYS , " " , AcpiUtGetTypeName ( Node -> Type ) , RequiredParamCount ) ) ; } else if ( ! RequiredParamCount && ! Predefined -> Info . ExpectedBtypes ) { ACPI_BIOS_ERROR_PREDEFINED ( ( AE_INFO , Pathname , ACPI_WARN_ALWAYS , " " " " , AcpiUtGetTypeName ( Node -> Type ) ) ) ; } return ; } AmlParamCount = Node -> Object -> Method . ParamCount ; if ( AmlParamCount < RequiredParamCount ) { ACPI_BIOS_ERROR_PREDEFINED ( ( AE_INFO , Pathname , ACPI_WARN_ALWAYS , " " " " , AmlParamCount , RequiredParamCount ) ) ; } else if ( ( AmlParamCount > RequiredParamCount ) && ! ( Predefined -> Info . ArgumentList & ARG_COUNT_IS_MINIMUM ) ) { ACPI_BIOS_ERROR_PREDEFINED ( ( AE_INFO , Pathname , ACPI_WARN_ALWAYS , " " " " , AmlParamCount , RequiredParamCount ) ) ; } }
FUNCTION:    AcpiNsCheckAcpiCompliance
 PARAMETERS:  Pathname        - Full pathname to the node (for error msgs)
              Node            - Namespace node for the method/object
              Predefined      - Pointer to entry in predefined name table
FUNCTION : AcpiNsCheckAcpiCompliance PARAMETERS : Pathname - Full pathname to the node ( for error msgs ) Node - Namespace node for the method / object Predefined - Pointer to entry in predefined name table
/* Get the ACPI-required arg count from the predefined info table */ /*
     * If this object is not a control method, we can check if the ACPI
     * spec requires that it be a method.
     */ /* Object requires args, must be implemented as a method */ /* Object requires no args and no return value, must be a method */ /*
     * This is a control method.
     * Check that the ASL/AML-defined parameter count for this method
     * matches the ACPI-required parameter count
     *
     * Some methods are allowed to have a "minimum" number of args (_SCP)
     * because their definition in ACPI has changed over time.
     *
     * Note: These are BIOS errors in the declaration of the object
     */