FreeBSD/sys/contrib/dev/acpica/compiler/aslpredef.c
/*******************************************************************************
 *
 * FUNCTION:    ApCheckForPredefinedObject
 *
 * PARAMETERS:  Op              - A parse node
 *              Name            - The ACPI name to be checked
 *
 * RETURN:      None
 *
 * DESCRIPTION: Check for a predefined name for a static object (created via
 *              the ASL Name operator). If it is a predefined ACPI name, ensure
 *              that the name does not require any arguments (which would
 *              require a control method implemenation of the name), and that
 *              the type of the object is one of the expected types for the
 *              predefined name.
 *
 ******************************************************************************/
ApCheckForPredefinedObject
PARAMETERS:  Op              - A parse node
Name            - The ACPI name to be checked

None

Check for a predefined name for a static object (created via
the ASL Name operator). If it is a predefined ACPI name, ensure
that the name does not require any arguments (which would
require a control method implemenation of the name), and that
the type of the object is one of the expected types for the
predefined name.
ApCheckForPredefinedObject PARAMETERS : Op - A parse node Name - The ACPI name to be checked None Check for a predefined name for a static object ( created via the ASL Name operator ) . If it is a predefined ACPI name ensure that the name does not require any arguments ( which would require a control method implemenation of the name ) and that the type of the object is one of the expected types for the predefined name .
void
ApCheckForPredefinedObject (
    ACPI_PARSE_OBJECT       *Op,
    char                    *Name)
{
    UINT32                      Index;
    ACPI_PARSE_OBJECT           *ObjectOp;
    const ACPI_PREDEFINED_INFO  *ThisName;
    Index = ApCheckForPredefinedName (Op, Name);
    switch (Index)
    {
    case ACPI_NOT_RESERVED_NAME:        
    case ACPI_PREDEFINED_NAME:          
    case ACPI_COMPILER_RESERVED_NAME:   
        return;
    case ACPI_EVENT_RESERVED_NAME:      
        AslError (ASL_ERROR, ASL_MSG_RESERVED_METHOD, Op,
            "with zero arguments");
        return;
    default:
        break;
    }
    ThisName = &AcpiGbl_PredefinedMethods[Index];
    if (METHOD_GET_ARG_COUNT (ThisName->Info.ArgumentList) > 0)
    {
        AslError (ASL_ERROR, ASL_MSG_RESERVED_METHOD, Op,
            "with arguments");
        return;
    }
    if (!ThisName->Info.ExpectedBtypes)
    {
        AslError (ASL_ERROR, ASL_MSG_RESERVED_METHOD, Op,
            "with zero arguments");
        return;
    }
    ObjectOp = Op->Asl.Child->Asl.Next;
    ApCheckObjectType (ThisName->Info.Name, Op->Asl.Child->Asl.Next,
        ThisName->Info.ExpectedBtypes, ACPI_NOT_PACKAGE_ELEMENT);
    if (ObjectOp->Asl.ParseOpcode == PARSEOP_PACKAGE)
    {
        ApCheckPackage (ObjectOp, ThisName);
    }
}
void ApCheckForPredefinedObject ( ACPI_PARSE_OBJECT * Op , char * Name ) { UINT32 Index ; ACPI_PARSE_OBJECT * ObjectOp ; const ACPI_PREDEFINED_INFO * ThisName ; Index = ApCheckForPredefinedName ( Op , Name ) ; switch ( Index ) { case ACPI_NOT_RESERVED_NAME : case ACPI_PREDEFINED_NAME : case ACPI_COMPILER_RESERVED_NAME : return ; case ACPI_EVENT_RESERVED_NAME : AslError ( ASL_ERROR , ASL_MSG_RESERVED_METHOD , Op , " " ) ; return ; default : break ; } ThisName = & AcpiGbl_PredefinedMethods [ Index ] ; if ( METHOD_GET_ARG_COUNT ( ThisName -> Info . ArgumentList ) > 0 ) { AslError ( ASL_ERROR , ASL_MSG_RESERVED_METHOD , Op , " " ) ; return ; } if ( ! ThisName -> Info . ExpectedBtypes ) { AslError ( ASL_ERROR , ASL_MSG_RESERVED_METHOD , Op , " " ) ; return ; } ObjectOp = Op -> Asl . Child -> Asl . Next ; ApCheckObjectType ( ThisName -> Info . Name , Op -> Asl . Child -> Asl . Next , ThisName -> Info . ExpectedBtypes , ACPI_NOT_PACKAGE_ELEMENT ) ; if ( ObjectOp -> Asl . ParseOpcode == PARSEOP_PACKAGE ) { ApCheckPackage ( ObjectOp , ThisName ) ; } }
FUNCTION:    ApCheckForPredefinedObject
 PARAMETERS:  Op              - A parse node
              Name            - The ACPI name to be checked
FUNCTION : ApCheckForPredefinedObject PARAMETERS : Op - A parse node Name - The ACPI name to be checked
/*
     * Check for a real predefined name -- not a resource descriptor name
     * or a predefined scope name
     */ /* No underscore or _Txx or _xxx name not matched */ /* Resource Name or reserved scope name */ /* A _Txx that was not emitted by compiler */ /* Nothing to do */ /* _Lxx/_Exx/_Wxx/_Qxx methods */ /*
         * These names must be control methods, by definition in ACPI spec.
         * Also because they are defined to return no value. None of them
         * require any arguments.
         */ /* A standard predefined ACPI name */ /*
     * If this predefined name requires input arguments, then
     * it must be implemented as a control method
     */ /*
     * If no return value is expected from this predefined name, then
     * it follows that it must be implemented as a control method
     * (with zero args, because the args > 0 case was handled above)
     * Examples are: _DIS, _INI, _IRC, _OFF, _ON, _PSx
     */ /* Typecheck the actual object, it is the next argument */ /* For packages, check the individual package elements */