FreeBSD/sys/contrib/dev/acpica/components/dispatcher/dsfield.c
/*******************************************************************************
 *
 * FUNCTION:    AcpiDsInitFieldObjects
 *
 * PARAMETERS:  Op              - Op containing the Field definition and args
 *  `           WalkState       - Current method state
 *
 * RETURN:      Status
 *
 * DESCRIPTION: For each "Field Unit" name in the argument list that is
 *              part of the field declaration, enter the name into the
 *              namespace.
 *
 ******************************************************************************/
AcpiDsInitFieldObjects
PARAMETERS:  Op              - Op containing the Field definition and args
`           WalkState       - Current method state

Status

For each "Field Unit" name in the argument list that is
part of the field declaration, enter the name into the
namespace.
AcpiDsInitFieldObjects PARAMETERS : Op - Op containing the Field definition and args ` WalkState - Current method state Status For each " Field Unit " name in the argument list that is part of the field declaration enter the name into the namespace .
ACPI_STATUS
AcpiDsInitFieldObjects (
    ACPI_PARSE_OBJECT       *Op,
    ACPI_WALK_STATE         *WalkState)
{
    ACPI_STATUS             Status;
    ACPI_PARSE_OBJECT       *Arg = NULL;
    ACPI_NAMESPACE_NODE     *Node;
    UINT8                   Type = 0;
    UINT32                  Flags;
    ACPI_FUNCTION_TRACE_PTR (DsInitFieldObjects, Op);
    if (!(WalkState->ParseFlags & ACPI_PARSE_EXECUTE))
    {
        if (WalkState->ParseFlags & ACPI_PARSE_DEFERRED_OP)
        {
            return_ACPI_STATUS (AE_OK);
        }
        return_ACPI_STATUS (AE_AML_INTERNAL);
    }
    switch (WalkState->Opcode)
    {
    case AML_FIELD_OP:
        Arg = AcpiPsGetArg (Op, 2);
        Type = ACPI_TYPE_LOCAL_REGION_FIELD;
        break;
    case AML_BANK_FIELD_OP:
        Arg = AcpiPsGetArg (Op, 4);
        Type = ACPI_TYPE_LOCAL_BANK_FIELD;
        break;
    case AML_INDEX_FIELD_OP:
        Arg = AcpiPsGetArg (Op, 3);
        Type = ACPI_TYPE_LOCAL_INDEX_FIELD;
        break;
    default:
        return_ACPI_STATUS (AE_BAD_PARAMETER);
    }
    Flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE |
        ACPI_NS_ERROR_IF_FOUND;
    if (WalkState->MethodNode &&
        !(WalkState->ParseFlags & ACPI_PARSE_MODULE_LEVEL))
    {
        Flags |= ACPI_NS_TEMPORARY;
    }
    while (Arg)
    {
        if (Arg->Common.AmlOpcode == AML_INT_NAMEDFIELD_OP)
        {
            Status = AcpiNsLookup (WalkState->ScopeInfo,
                (char *) &Arg->Named.Name, Type, ACPI_IMODE_LOAD_PASS1,
                Flags, WalkState, &Node);
            if (ACPI_FAILURE (Status))
            {
                ACPI_ERROR_NAMESPACE ((char *) &Arg->Named.Name, Status);
                if (Status != AE_ALREADY_EXISTS)
                {
                    return_ACPI_STATUS (Status);
                }
                Status = AE_OK;
            }
            Arg->Common.Node = Node;
        }
        Arg = Arg->Common.Next;
    }
    return_ACPI_STATUS (AE_OK);
}
ACPI_STATUS AcpiDsInitFieldObjects ( ACPI_PARSE_OBJECT * Op , ACPI_WALK_STATE * WalkState ) { ACPI_STATUS Status ; ACPI_PARSE_OBJECT * Arg = NULL ; ACPI_NAMESPACE_NODE * Node ; UINT8 Type = 0 ; UINT32 Flags ; ACPI_FUNCTION_TRACE_PTR ( DsInitFieldObjects , Op ) ; if ( ! ( WalkState -> ParseFlags & ACPI_PARSE_EXECUTE ) ) { if ( WalkState -> ParseFlags & ACPI_PARSE_DEFERRED_OP ) { return_ACPI_STATUS ( AE_OK ) ; } return_ACPI_STATUS ( AE_AML_INTERNAL ) ; } switch ( WalkState -> Opcode ) { case AML_FIELD_OP : Arg = AcpiPsGetArg ( Op , 2 ) ; Type = ACPI_TYPE_LOCAL_REGION_FIELD ; break ; case AML_BANK_FIELD_OP : Arg = AcpiPsGetArg ( Op , 4 ) ; Type = ACPI_TYPE_LOCAL_BANK_FIELD ; break ; case AML_INDEX_FIELD_OP : Arg = AcpiPsGetArg ( Op , 3 ) ; Type = ACPI_TYPE_LOCAL_INDEX_FIELD ; break ; default : return_ACPI_STATUS ( AE_BAD_PARAMETER ) ; } Flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | ACPI_NS_ERROR_IF_FOUND ; if ( WalkState -> MethodNode && ! ( WalkState -> ParseFlags & ACPI_PARSE_MODULE_LEVEL ) ) { Flags |= ACPI_NS_TEMPORARY ; } while ( Arg ) { if ( Arg -> Common . AmlOpcode == AML_INT_NAMEDFIELD_OP ) { Status = AcpiNsLookup ( WalkState -> ScopeInfo , ( char * ) & Arg -> Named . Name , Type , ACPI_IMODE_LOAD_PASS1 , Flags , WalkState , & Node ) ; if ( ACPI_FAILURE ( Status ) ) { ACPI_ERROR_NAMESPACE ( ( char * ) & Arg -> Named . Name , Status ) ; if ( Status != AE_ALREADY_EXISTS ) { return_ACPI_STATUS ( Status ) ; } Status = AE_OK ; } Arg -> Common . Node = Node ; } Arg = Arg -> Common . Next ; } return_ACPI_STATUS ( AE_OK ) ; }
FUNCTION:    AcpiDsInitFieldObjects
 PARAMETERS:  Op              - Op containing the Field definition and args
  `           WalkState       - Current method state
FUNCTION : AcpiDsInitFieldObjects PARAMETERS : Op - Op containing the Field definition and args ` WalkState - Current method state
/* Execute flag should always be set when this function is entered */ /* BankField Op is deferred, just return OK */ /*
     * Get the FieldList argument for this opcode. This is the start of the
     * list of field elements.
     */ /* Creating new namespace node(s), should not already exist */ /*
     * Mark node(s) temporary if we are executing a normal control
     * method. (Don't mark if this is a module-level code method)
     */ /*
     * Walk the list of entries in the FieldList
     * Note: FieldList can be of zero length. In this case, Arg will be NULL.
     */ /*
         * Ignore OFFSET/ACCESSAS/CONNECTION terms here; we are only interested
         * in the field names in order to enter them into the namespace.
         */ /* Name already exists, just ignore this error */ /* Get the next field element in the list */