这篇教程C++ AcpiNsLookup函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中AcpiNsLookup函数的典型用法代码示例。如果您正苦于以下问题:C++ AcpiNsLookup函数的具体用法?C++ AcpiNsLookup怎么用?C++ AcpiNsLookup使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了AcpiNsLookup函数的25个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: LdNamespace1Beginstatic ACPI_STATUSLdNamespace1Begin ( ACPI_PARSE_OBJECT *Op, UINT32 Level, void *Context){ ACPI_WALK_STATE *WalkState = (ACPI_WALK_STATE *) Context; ACPI_NAMESPACE_NODE *Node; ACPI_PARSE_OBJECT *MethodOp; ACPI_STATUS Status; ACPI_OBJECT_TYPE ObjectType; ACPI_OBJECT_TYPE ActualObjectType = ACPI_TYPE_ANY; char *Path; UINT32 Flags = ACPI_NS_NO_UPSEARCH; ACPI_PARSE_OBJECT *Arg; UINT32 i; BOOLEAN ForceNewScope = FALSE; ACPI_FUNCTION_NAME (LdNamespace1Begin); ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op %p [%s]/n", Op, Op->Asl.ParseOpName)); /* * We are only interested in opcodes that have an associated name * (or multiple names) */ switch (Op->Asl.AmlOpcode) { case AML_BANK_FIELD_OP: case AML_INDEX_FIELD_OP: case AML_FIELD_OP: Status = LdLoadFieldElements (Op, WalkState); return (Status); case AML_INT_CONNECTION_OP: if (Op->Asl.Child->Asl.AmlOpcode != AML_INT_NAMEPATH_OP) { break; } Arg = Op->Asl.Child; Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Asl.ExternalName, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, WalkState, &Node); if (ACPI_FAILURE (Status)) { break; } if (Node->Type == ACPI_TYPE_BUFFER) { Arg->Asl.Node = Node; Arg = Node->Op->Asl.Child; /* Get namepath */ Arg = Arg->Asl.Next; /* Get actual buffer */ Arg = Arg->Asl.Child; /* Buffer length */ Arg = Arg->Asl.Next; /* RAW_DATA buffer */ } break; default: /* All other opcodes go below */ break; } /* Check if this object has already been installed in the namespace */ if (Op->Asl.Node) { return (AE_OK); } Path = Op->Asl.Namepath; if (!Path) { return (AE_OK); } /* Map the raw opcode into an internal object type */ switch (Op->Asl.ParseOpcode) { case PARSEOP_NAME: Arg = Op->Asl.Child; /* Get the NameSeg/NameString node */ Arg = Arg->Asl.Next; /* First peer is the object to be associated with the name */ /* * If this name refers to a ResourceTemplate, we will need to open * a new scope so that the resource subfield names can be entered into * the namespace underneath this name */ if (Op->Asl.CompileFlags & NODE_IS_RESOURCE_DESC) {//.........这里部分代码省略.........
开发者ID:2asoft,项目名称:freebsd,代码行数:101,
示例2: LdNamespace2Beginstatic ACPI_STATUSLdNamespace2Begin ( ACPI_PARSE_OBJECT *Op, UINT32 Level, void *Context){ ACPI_WALK_STATE *WalkState = (ACPI_WALK_STATE *) Context; ACPI_STATUS Status; ACPI_NAMESPACE_NODE *Node; ACPI_OBJECT_TYPE ObjectType; BOOLEAN ForceNewScope = FALSE; ACPI_PARSE_OBJECT *Arg; char *Path; ACPI_NAMESPACE_NODE *TargetNode; ACPI_FUNCTION_NAME (LdNamespace2Begin); ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op %p [%s]/n", Op, Op->Asl.ParseOpName)); /* Ignore Ops with no namespace node */ Node = Op->Asl.Node; if (!Node) { return (AE_OK); } /* Get the type to determine if we should push the scope */ if ((Op->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG) && (Op->Asl.CompileFlags == NODE_IS_RESOURCE_DESC)) { ObjectType = ACPI_TYPE_LOCAL_RESOURCE; } else { ObjectType = AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode); } /* Push scope for Resource Templates */ if (Op->Asl.ParseOpcode == PARSEOP_NAME) { if (Op->Asl.CompileFlags & NODE_IS_RESOURCE_DESC) { ForceNewScope = TRUE; } } /* Push the scope stack */ if (ForceNewScope || AcpiNsOpensScope (ObjectType)) { Status = AcpiDsScopeStackPush (Node, ObjectType, WalkState); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } } if (Op->Asl.ParseOpcode == PARSEOP_ALIAS) { /* Complete the alias node by getting and saving the target node */ /* First child is the alias target */ Arg = Op->Asl.Child; /* Get the target pathname */ Path = Arg->Asl.Namepath; if (!Path) { Status = UtInternalizeName (Arg->Asl.ExternalName, &Path); if (ACPI_FAILURE (Status)) { return (Status); } } /* Get the NS node associated with the target. It must exist. */ Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, WalkState, &TargetNode); if (ACPI_FAILURE (Status)) { if (Status == AE_NOT_FOUND) { AslError (ASL_ERROR, ASL_MSG_NOT_FOUND, Op, Op->Asl.ExternalName); /* * The name was not found, go ahead and create it. * This prevents more errors later. */ Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ACPI_TYPE_ANY,//.........这里部分代码省略.........
开发者ID:2asoft,项目名称:freebsd,代码行数:101,
示例3: AcpiDsBuildInternalObjectACPI_STATUSAcpiDsBuildInternalObject ( ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op, ACPI_OPERAND_OBJECT **ObjDescPtr){ ACPI_OPERAND_OBJECT *ObjDesc; ACPI_STATUS Status; ACPI_FUNCTION_TRACE (DsBuildInternalObject); *ObjDescPtr = NULL; if (Op->Common.AmlOpcode == AML_INT_NAMEPATH_OP) { /* * This is a named object reference. If this name was * previously looked up in the namespace, it was stored in * this op. Otherwise, go ahead and look it up now */ if (!Op->Common.Node) { /* Check if we are resolving a named reference within a package */ if ((Op->Common.Parent->Common.AmlOpcode == AML_PACKAGE_OP) || (Op->Common.Parent->Common.AmlOpcode == AML_VARIABLE_PACKAGE_OP)) { /* * We won't resolve package elements here, we will do this * after all ACPI tables are loaded into the namespace. This * behavior supports both forward references to named objects * and external references to objects in other tables. */ goto CreateNewObject; } else { Status = AcpiNsLookup (WalkState->ScopeInfo, Op->Common.Value.String, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, NULL, ACPI_CAST_INDIRECT_PTR ( ACPI_NAMESPACE_NODE, &(Op->Common.Node))); if (ACPI_FAILURE (Status)) { ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo, Op->Common.Value.String, Status); return_ACPI_STATUS (Status); } } } }CreateNewObject: /* Create and init a new internal ACPI object */ ObjDesc = AcpiUtCreateInternalObject ( (AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode))->ObjectType); if (!ObjDesc) { return_ACPI_STATUS (AE_NO_MEMORY); } Status = AcpiDsInitObjectFromOp ( WalkState, Op, Op->Common.AmlOpcode, &ObjDesc); if (ACPI_FAILURE (Status)) { AcpiUtRemoveReference (ObjDesc); return_ACPI_STATUS (Status); } /* * Handling for unresolved package reference elements. * These are elements that are namepaths. */ if ((Op->Common.Parent->Common.AmlOpcode == AML_PACKAGE_OP) || (Op->Common.Parent->Common.AmlOpcode == AML_VARIABLE_PACKAGE_OP)) { ObjDesc->Reference.Resolved = TRUE; if ((Op->Common.AmlOpcode == AML_INT_NAMEPATH_OP) && !ObjDesc->Reference.Node) { /* * Name was unresolved above. * Get the prefix node for later lookup */ ObjDesc->Reference.Node = WalkState->ScopeInfo->Scope.Node; ObjDesc->Reference.Aml = Op->Common.Aml; ObjDesc->Reference.Resolved = FALSE; } } *ObjDescPtr = ObjDesc; return_ACPI_STATUS (Status);}
开发者ID:2trill2spill,项目名称:freebsd,代码行数:98,
示例4: AcpiNsEvaluateRelativeACPI_STATUSAcpiNsEvaluateRelative ( ACPI_NAMESPACE_NODE *Handle, char *Pathname, ACPI_OPERAND_OBJECT **Params, ACPI_OPERAND_OBJECT **ReturnObject){ ACPI_NAMESPACE_NODE *PrefixNode; ACPI_STATUS Status; ACPI_NAMESPACE_NODE *Node = NULL; char *InternalPath = NULL; ACPI_GENERIC_STATE ScopeInfo; ACPI_FUNCTION_TRACE ("NsEvaluateRelative"); /* * Must have a valid object handle */ if (!Handle) { return_ACPI_STATUS (AE_BAD_PARAMETER); } /* Build an internal name string for the method */ Status = AcpiNsInternalizeName (Pathname, &InternalPath); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } /* Get the prefix handle and Node */ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } PrefixNode = AcpiNsMapHandleToNode (Handle); if (!PrefixNode) { (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); Status = AE_BAD_PARAMETER; goto Cleanup; } /* Lookup the name in the namespace */ ScopeInfo.Scope.Node = PrefixNode; Status = AcpiNsLookup (&ScopeInfo, InternalPath, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, NULL, &Node); (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); if (ACPI_FAILURE (Status)) { ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Object [%s] not found [%s]/n", Pathname, AcpiFormatException (Status))); goto Cleanup; } /* * Now that we have a handle to the object, we can attempt * to evaluate it. */ ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "%s [%p] Value %p/n", Pathname, Node, AcpiNsGetAttachedObject (Node))); Status = AcpiNsEvaluateByHandle (Node, Params, ReturnObject); ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "*** Completed eval of object %s ***/n", Pathname));Cleanup: ACPI_MEM_FREE (InternalPath); return_ACPI_STATUS (Status);}
开发者ID:UnitedMarsupials,项目名称:kame,代码行数:82,
示例5: AcpiNsGetNodeUnlockedACPI_STATUSAcpiNsGetNodeUnlocked ( ACPI_NAMESPACE_NODE *PrefixNode, const char *Pathname, UINT32 Flags, ACPI_NAMESPACE_NODE **ReturnNode){ ACPI_GENERIC_STATE ScopeInfo; ACPI_STATUS Status; char *InternalPath; ACPI_FUNCTION_TRACE_PTR (NsGetNodeUnlocked, ACPI_CAST_PTR (char, Pathname)); /* Simplest case is a null pathname */ if (!Pathname) { *ReturnNode = PrefixNode; if (!PrefixNode) { *ReturnNode = AcpiGbl_RootNode; } return_ACPI_STATUS (AE_OK); } /* Quick check for a reference to the root */ if (ACPI_IS_ROOT_PREFIX (Pathname[0]) && (!Pathname[1])) { *ReturnNode = AcpiGbl_RootNode; return_ACPI_STATUS (AE_OK); } /* Convert path to internal representation */ Status = AcpiNsInternalizeName (Pathname, &InternalPath); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } /* Setup lookup scope (search starting point) */ ScopeInfo.Scope.Node = PrefixNode; /* Lookup the name in the namespace */ Status = AcpiNsLookup (&ScopeInfo, InternalPath, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, (Flags | ACPI_NS_DONT_OPEN_SCOPE), NULL, ReturnNode); if (ACPI_FAILURE (Status)) { ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%s, %s/n", Pathname, AcpiFormatException (Status))); } ACPI_FREE (InternalPath); return_ACPI_STATUS (Status);}
开发者ID:ariscop,项目名称:reactos,代码行数:62,
示例6: AcpiDsLoad1BeginOpACPI_STATUSAcpiDsLoad1BeginOp ( ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT **OutOp){ ACPI_PARSE_OBJECT *Op; ACPI_NAMESPACE_NODE *Node; ACPI_STATUS Status; ACPI_OBJECT_TYPE ObjectType; char *Path; UINT32 Flags; ACPI_FUNCTION_TRACE (DsLoad1BeginOp); Op = WalkState->Op; ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p/n", Op, WalkState)); /* We are only interested in opcodes that have an associated name */ if (Op) { if (!(WalkState->OpInfo->Flags & AML_NAMED)) { *OutOp = Op; return_ACPI_STATUS (AE_OK); } /* Check if this object has already been installed in the namespace */ if (Op->Common.Node) { *OutOp = Op; return_ACPI_STATUS (AE_OK); } } Path = AcpiPsGetNextNamestring (&WalkState->ParserState); /* Map the raw opcode into an internal object type */ ObjectType = WalkState->OpInfo->ObjectType; ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "State=%p Op=%p [%s]/n", WalkState, Op, AcpiUtGetTypeName (ObjectType))); switch (WalkState->Opcode) { case AML_SCOPE_OP: /* * The target name of the Scope() operator must exist at this point so * that we can actually open the scope to enter new names underneath it. * Allow search-to-root for single namesegs. */ Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType, ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, WalkState, &(Node));#ifdef ACPI_ASL_COMPILER if (Status == AE_NOT_FOUND) { /* * Table disassembly: * Target of Scope() not found. Generate an External for it, and * insert the name into the namespace. */ AcpiDmAddOpToExternalList (Op, Path, ACPI_TYPE_DEVICE, 0, 0); Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType, ACPI_IMODE_LOAD_PASS1, ACPI_NS_SEARCH_PARENT, WalkState, &Node); }#endif if (ACPI_FAILURE (Status)) { ACPI_ERROR_NAMESPACE (Path, Status); return_ACPI_STATUS (Status); } /* * Check to make sure that the target is * one of the opcodes that actually opens a scope */ switch (Node->Type) { case ACPI_TYPE_ANY: case ACPI_TYPE_LOCAL_SCOPE: /* Scope */ case ACPI_TYPE_DEVICE: case ACPI_TYPE_POWER: case ACPI_TYPE_PROCESSOR: case ACPI_TYPE_THERMAL: /* These are acceptable types */ break; case ACPI_TYPE_INTEGER: case ACPI_TYPE_STRING: case ACPI_TYPE_BUFFER: /* * These types we will allow, but we will change the type. * This enables some existing code of the form: *//.........这里部分代码省略.........
开发者ID:wan721,项目名称:DragonFlyBSD,代码行数:101,
示例7: AcpiDsCreateOperandACPI_STATUSAcpiDsCreateOperand ( ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Arg, UINT32 ArgIndex){ ACPI_STATUS Status = AE_OK; char *NameString; UINT32 NameLength; ACPI_OPERAND_OBJECT *ObjDesc; ACPI_PARSE_OBJECT *ParentOp; UINT16 Opcode; ACPI_INTERPRETER_MODE InterpreterMode; const ACPI_OPCODE_INFO *OpInfo; ACPI_FUNCTION_TRACE_PTR (DsCreateOperand, Arg); /* A valid name must be looked up in the namespace */ if ((Arg->Common.AmlOpcode == AML_INT_NAMEPATH_OP) && (Arg->Common.Value.String) && !(Arg->Common.Flags & ACPI_PARSEOP_IN_STACK)) { ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Getting a name: Arg=%p/n", Arg)); /* Get the entire name string from the AML stream */ Status = AcpiExGetNameString (ACPI_TYPE_ANY, Arg->Common.Value.Buffer, &NameString, &NameLength); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } /* All prefixes have been handled, and the name is in NameString */ /* * Special handling for BufferField declarations. This is a deferred * opcode that unfortunately defines the field name as the last * parameter instead of the first. We get here when we are performing * the deferred execution, so the actual name of the field is already * in the namespace. We don't want to attempt to look it up again * because we may be executing in a different scope than where the * actual opcode exists. */ if ((WalkState->DeferredNode) && (WalkState->DeferredNode->Type == ACPI_TYPE_BUFFER_FIELD) && (ArgIndex == (UINT32) ((WalkState->Opcode == AML_CREATE_FIELD_OP) ? 3 : 2))) { ObjDesc = ACPI_CAST_PTR ( ACPI_OPERAND_OBJECT, WalkState->DeferredNode); Status = AE_OK; } else /* All other opcodes */ { /* * Differentiate between a namespace "create" operation * versus a "lookup" operation (IMODE_LOAD_PASS2 vs. * IMODE_EXECUTE) in order to support the creation of * namespace objects during the execution of control methods. */ ParentOp = Arg->Common.Parent; OpInfo = AcpiPsGetOpcodeInfo (ParentOp->Common.AmlOpcode); if ((OpInfo->Flags & AML_NSNODE) && (ParentOp->Common.AmlOpcode != AML_INT_METHODCALL_OP) && (ParentOp->Common.AmlOpcode != AML_REGION_OP) && (ParentOp->Common.AmlOpcode != AML_INT_NAMEPATH_OP)) { /* Enter name into namespace if not found */ InterpreterMode = ACPI_IMODE_LOAD_PASS2; } else { /* Return a failure if name not found */ InterpreterMode = ACPI_IMODE_EXECUTE; } Status = AcpiNsLookup (WalkState->ScopeInfo, NameString, ACPI_TYPE_ANY, InterpreterMode, ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, WalkState, ACPI_CAST_INDIRECT_PTR (ACPI_NAMESPACE_NODE, &ObjDesc)); /* * The only case where we pass through (ignore) a NOT_FOUND * error is for the CondRefOf opcode. */ if (Status == AE_NOT_FOUND) { if (ParentOp->Common.AmlOpcode == AML_COND_REF_OF_OP) { /* * For the Conditional Reference op, it's OK if * the name is not found; We just need a way to * indicate this to the interpreter, set the * object to the root//.........这里部分代码省略.........
开发者ID:oza,项目名称:FreeBSD-7.3-dyntick,代码行数:101,
示例8: OptOptimizeNameDeclarationstatic ACPI_STATUSOptOptimizeNameDeclaration ( ACPI_PARSE_OBJECT *Op, ACPI_WALK_STATE *WalkState, ACPI_NAMESPACE_NODE *CurrentNode, ACPI_NAMESPACE_NODE *TargetNode, char *AmlNameString, char **NewPath){ ACPI_STATUS Status; char *NewPathExternal; ACPI_NAMESPACE_NODE *Node; ACPI_FUNCTION_TRACE (OptOptimizeNameDeclaration); if (((CurrentNode == AcpiGbl_RootNode) || (Op->Common.Parent->Asl.ParseOpcode == PARSEOP_DEFINITION_BLOCK)) && (ACPI_IS_ROOT_PREFIX (AmlNameString[0]))) { /* * The current scope is the root, and the namepath has a root prefix * that is therefore extraneous. Remove it. */ *NewPath = &AmlNameString[1]; /* Debug output */ Status = AcpiNsExternalizeName (ACPI_UINT32_MAX, *NewPath, NULL, &NewPathExternal); if (ACPI_FAILURE (Status)) { AslCoreSubsystemError (Op, Status, "Externalizing NamePath", ASL_NO_ABORT); return (Status); } /* * Check to make sure that the optimization finds the node we are * looking for. This is simply a sanity check on the new * path that has been created. * * We know that we are at the root, so NULL is used for the scope. */ Status = AcpiNsLookup (NULL, *NewPath, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, ACPI_NS_DONT_OPEN_SCOPE, WalkState, &(Node)); if (ACPI_SUCCESS (Status)) { /* Found the namepath, but make sure the node is correct */ if (Node == TargetNode) { /* The lookup matched the node, accept this optimization */ AslError (ASL_OPTIMIZATION, ASL_MSG_NAME_OPTIMIZATION, Op, NewPathExternal); ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, "AT ROOT: %-24s", NewPathExternal)); } else { /* Node is not correct, do not use this optimization */ Status = AE_NOT_FOUND; ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " ***** WRONG NODE")); AslError (ASL_WARNING, ASL_MSG_COMPILER_INTERNAL, Op, "Not using optimized name - found wrong node"); } } else { /* The lookup failed, we obviously cannot use this optimization */ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " ***** NOT FOUND")); AslError (ASL_WARNING, ASL_MSG_COMPILER_INTERNAL, Op, "Not using optimized name - did not find node"); } ACPI_FREE (NewPathExternal); return (Status); } /* Could not optimize */ return (AE_NOT_FOUND);}
开发者ID:cailianchun,项目名称:acpica,代码行数:91,
示例9: AcpiDmLoadDescendingOpstatic ACPI_STATUSAcpiDmLoadDescendingOp ( ACPI_PARSE_OBJECT *Op, UINT32 Level, void *Context){ ACPI_OP_WALK_INFO *Info = Context; const ACPI_OPCODE_INFO *OpInfo; ACPI_WALK_STATE *WalkState; ACPI_OBJECT_TYPE ObjectType; ACPI_STATUS Status; char *Path = NULL; ACPI_PARSE_OBJECT *NextOp; ACPI_NAMESPACE_NODE *Node; char FieldPath[5]; BOOLEAN PreDefined = FALSE; UINT8 PreDefineIndex = 0; WalkState = Info->WalkState; OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); ObjectType = OpInfo->ObjectType; ObjectType = AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode); /* Only interested in operators that create new names */ if (!(OpInfo->Flags & AML_NAMED) && !(OpInfo->Flags & AML_CREATE)) { goto Exit; } /* Get the NamePath from the appropriate place */ if (OpInfo->Flags & AML_NAMED) { /* For all named operators, get the new name */ Path = (char *) Op->Named.Path; if (!Path && Op->Common.AmlOpcode == AML_INT_NAMEDFIELD_OP) { *ACPI_CAST_PTR (UINT32, &FieldPath[0]) = Op->Named.Name; FieldPath[4] = 0; Path = FieldPath; } } else if (OpInfo->Flags & AML_CREATE) { /* New name is the last child */ NextOp = Op->Common.Value.Arg; while (NextOp->Common.Next) { NextOp = NextOp->Common.Next; } Path = NextOp->Common.Value.String; } if (!Path) { goto Exit; } /* Insert the name into the namespace */ Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType, ACPI_IMODE_LOAD_PASS2, ACPI_NS_DONT_OPEN_SCOPE, WalkState, &Node); Op->Common.Node = Node; if (ACPI_SUCCESS (Status)) { /* Check if it's a predefined node */ while (AcpiGbl_PreDefinedNames[PreDefineIndex].Name) { if (!ACPI_STRNCMP (Node->Name.Ascii, AcpiGbl_PreDefinedNames[PreDefineIndex].Name, 4)) { PreDefined = TRUE; break; } PreDefineIndex++; } /* * Set node owner id if it satisfies all the following conditions: * 1) Not a predefined node, _SB_ etc * 2) Not the root node * 3) Not a node created by Scope */ if (!PreDefined && Node != AcpiGbl_RootNode && Op->Common.AmlOpcode != AML_SCOPE_OP) { Node->OwnerId = WalkState->OwnerId;//.........这里部分代码省略.........
开发者ID:DangerDexter,项目名称:FreeBSD-8.0-dyntick,代码行数:101,
示例10: AcpiDmXrefDescendingOpstatic ACPI_STATUSAcpiDmXrefDescendingOp ( ACPI_PARSE_OBJECT *Op, UINT32 Level, void *Context){ ACPI_OP_WALK_INFO *Info = Context; const ACPI_OPCODE_INFO *OpInfo; ACPI_WALK_STATE *WalkState; ACPI_OBJECT_TYPE ObjectType; ACPI_OBJECT_TYPE ObjectType2; ACPI_STATUS Status; char *Path = NULL; ACPI_PARSE_OBJECT *NextOp; ACPI_NAMESPACE_NODE *Node; ACPI_OPERAND_OBJECT *Object; WalkState = Info->WalkState; OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); ObjectType = OpInfo->ObjectType; ObjectType = AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode); if ((!(OpInfo->Flags & AML_NAMED)) && (!(OpInfo->Flags & AML_CREATE)) && (Op->Common.AmlOpcode != AML_INT_NAMEPATH_OP)) { goto Exit; } /* Get the NamePath from the appropriate place */ if (OpInfo->Flags & AML_NAMED) { if ((Op->Common.AmlOpcode == AML_ALIAS_OP) || (Op->Common.AmlOpcode == AML_SCOPE_OP)) { /* * Only these two operators refer to an existing name, * first argument */ Path = (char *) Op->Named.Path; } } else if (OpInfo->Flags & AML_CREATE) { /* Referenced Buffer Name is the first child */ NextOp = Op->Common.Value.Arg; if (NextOp->Common.AmlOpcode == AML_INT_NAMEPATH_OP) { Path = NextOp->Common.Value.String; } } else { Path = Op->Common.Value.String; } if (!Path) { goto Exit; } /* * Lookup the name in the namespace. Name must exist at this point, or it * is an invalid reference. * * The namespace is also used as a lookup table for references to resource * descriptors and the fields within them. */ Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, WalkState, &Node); if (ACPI_FAILURE (Status)) { if (Status == AE_NOT_FOUND) { AcpiDmAddToExternalList (Path, (UINT8) ObjectType, 0); /* * We could install this into the namespace, but we catch duplicate * externals when they are added to the list. */#if 0 Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ACPI_TYPE_ANY, ACPI_IMODE_LOAD_PASS1, ACPI_NS_DONT_OPEN_SCOPE, WalkState, &Node);#endif } } /* * Found the node in external table, add it to external list * Node->OwnerId == 0 indicates built-in ACPI Names, _OS_ etc */ else if (Node->OwnerId && WalkState->OwnerId != Node->OwnerId) { ObjectType2 = ObjectType;//.........这里部分代码省略.........
开发者ID:DangerDexter,项目名称:FreeBSD-8.0-dyntick,代码行数:101,
示例11: AcpiNsConvertToReferenceACPI_STATUSAcpiNsConvertToReference ( ACPI_NAMESPACE_NODE *Scope, ACPI_OPERAND_OBJECT *OriginalObject, ACPI_OPERAND_OBJECT **ReturnObject){ ACPI_OPERAND_OBJECT *NewObject = NULL; ACPI_STATUS Status; ACPI_NAMESPACE_NODE *Node; ACPI_GENERIC_STATE ScopeInfo; char *Name; ACPI_FUNCTION_NAME (NsConvertToReference); /* Convert path into internal presentation */ Status = AcpiNsInternalizeName (OriginalObject->String.Pointer, &Name); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } /* Find the namespace node */ ScopeInfo.Scope.Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Scope); Status = AcpiNsLookup (&ScopeInfo, Name, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, NULL, &Node); if (ACPI_FAILURE (Status)) { /* Check if we are resolving a named reference within a package */ ACPI_ERROR_NAMESPACE (&ScopeInfo, OriginalObject->String.Pointer, Status); goto ErrorExit; } /* Create and init a new internal ACPI object */ NewObject = AcpiUtCreateInternalObject (ACPI_TYPE_LOCAL_REFERENCE); if (!NewObject) { Status = AE_NO_MEMORY; goto ErrorExit; } NewObject->Reference.Node = Node; NewObject->Reference.Object = Node->Object; NewObject->Reference.Class = ACPI_REFCLASS_NAME; /* * Increase reference of the object if needed (the object is likely a * null for device nodes). */ AcpiUtAddReference (Node->Object);ErrorExit: ACPI_FREE (Name); *ReturnObject = NewObject; return (AE_OK);}
开发者ID:9elements,项目名称:fwts,代码行数:62,
示例12: AcpiPsGetNextNamepathvoidAcpiPsGetNextNamepath ( ACPI_PARSE_STATE *ParserState, ACPI_PARSE_OBJECT *Arg, UINT32 *ArgCount, BOOLEAN MethodCall){ NATIVE_CHAR *Path; ACPI_PARSE_OBJECT *NameOp; ACPI_STATUS Status; ACPI_NAMESPACE_NODE *MethodNode = NULL; ACPI_NAMESPACE_NODE *Node; ACPI_GENERIC_STATE ScopeInfo; FUNCTION_TRACE ("PsGetNextNamepath"); Path = AcpiPsGetNextNamestring (ParserState); if (!Path || !MethodCall) { /* Null name case, create a null namepath object */ AcpiPsInitOp (Arg, AML_INT_NAMEPATH_OP); Arg->Value.Name = Path; return_VOID; } if (MethodCall) { /* * Lookup the name in the internal namespace */ ScopeInfo.Scope.Node = NULL; Node = ParserState->StartNode; if (Node) { ScopeInfo.Scope.Node = Node; } /* * Lookup object. We don't want to add anything new to the namespace * here, however. So we use MODE_EXECUTE. Allow searching of the * parent tree, but don't open a new scope -- we just want to lookup the * object (MUST BE mode EXECUTE to perform upsearch) */ Status = AcpiNsLookup (&ScopeInfo, Path, ACPI_TYPE_ANY, IMODE_EXECUTE, NS_SEARCH_PARENT | NS_DONT_OPEN_SCOPE, NULL, &Node); if (ACPI_SUCCESS (Status)) { if (Node->Type == ACPI_TYPE_METHOD) { MethodNode = Node; ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "method - %p Path=%p/n", MethodNode, Path)); NameOp = AcpiPsAllocOp (AML_INT_NAMEPATH_OP); if (NameOp) { /* Change arg into a METHOD CALL and attach name to it */ AcpiPsInitOp (Arg, AML_INT_METHODCALL_OP); NameOp->Value.Name = Path; /* Point METHODCALL/NAME to the METHOD Node */ NameOp->Node = MethodNode; AcpiPsAppendArg (Arg, NameOp); if (!(ACPI_OPERAND_OBJECT *) MethodNode->Object) { return_VOID; } *ArgCount = ((ACPI_OPERAND_OBJECT *) MethodNode->Object)->Method.ParamCount; } return_VOID; } /* * Else this is normal named object reference. * Just init the NAMEPATH object with the pathname. * (See code below) */ } } /* * Either we didn't find the object in the namespace, or the object is * something other than a control method. Just initialize the Op with the * pathname. */ AcpiPsInitOp (Arg, AML_INT_NAMEPATH_OP); Arg->Value.Name = Path;//.........这里部分代码省略.........
开发者ID:MarginC,项目名称:kame,代码行数:101,
示例13: AcpiNsEvaluateByNameACPI_STATUSAcpiNsEvaluateByName ( char *Pathname, ACPI_OPERAND_OBJECT **Params, ACPI_OPERAND_OBJECT **ReturnObject){ ACPI_STATUS Status; ACPI_NAMESPACE_NODE *Node = NULL; char *InternalPath = NULL; ACPI_FUNCTION_TRACE ("NsEvaluateByName"); /* Build an internal name string for the method */ Status = AcpiNsInternalizeName (Pathname, &InternalPath); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } /* Lookup the name in the namespace */ Status = AcpiNsLookup (NULL, InternalPath, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, NULL, &Node); (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); if (ACPI_FAILURE (Status)) { ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Object at [%s] was not found, status=%.4X/n", Pathname, Status)); goto Cleanup; } /* * Now that we have a handle to the object, we can attempt * to evaluate it. */ ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "%s [%p] Value %p/n", Pathname, Node, AcpiNsGetAttachedObject (Node))); Status = AcpiNsEvaluateByHandle (Node, Params, ReturnObject); ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "*** Completed eval of object %s ***/n", Pathname));Cleanup: /* Cleanup */ if (InternalPath) { ACPI_MEM_FREE (InternalPath); } return_ACPI_STATUS (Status);}
开发者ID:UnitedMarsupials,项目名称:kame,代码行数:67,
示例14: OptSearchToRootstatic ACPI_STATUSOptSearchToRoot ( ACPI_PARSE_OBJECT *Op, ACPI_WALK_STATE *WalkState, ACPI_NAMESPACE_NODE *CurrentNode, ACPI_NAMESPACE_NODE *TargetNode, ACPI_BUFFER *TargetPath, char **NewPath){ ACPI_NAMESPACE_NODE *Node; ACPI_GENERIC_STATE ScopeInfo; ACPI_STATUS Status; char *Path; ACPI_FUNCTION_NAME (OptSearchToRoot); /* * Check if search-to-root can be utilized. Use the last NameSeg of * the NamePath and 1) See if can be found and 2) If found, make * sure that it is the same node that we want. If there is another * name in the search path before the one we want, the nodes will * not match, and we cannot use this optimization. */ Path = &(((char *) TargetPath->Pointer)[ TargetPath->Length - ACPI_NAME_SIZE]), ScopeInfo.Scope.Node = CurrentNode; /* Lookup the NameSeg using SEARCH_PARENT (search-to-root) */ Status = AcpiNsLookup (&ScopeInfo, Path, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, WalkState, &(Node)); if (ACPI_FAILURE (Status)) { return (Status); } /* * We found the name, but we must check to make sure that the node * matches. Otherwise, there is another identical name in the search * path that precludes the use of this optimization. */ if (Node != TargetNode) { /* * This means that another object with the same name was found first, * and we cannot use this optimization. */ return (AE_NOT_FOUND); } /* Found the node, we can use this optimization */ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, "NAMESEG: %-24s", Path)); /* We must allocate a new string for the name (TargetPath gets deleted) */ *NewPath = UtStringCacheCalloc (ACPI_NAME_SIZE + 1); strcpy (*NewPath, Path); if (strncmp (*NewPath, "_T_", 3)) { AslError (ASL_OPTIMIZATION, ASL_MSG_SINGLE_NAME_OPTIMIZATION, Op, *NewPath); } return (AE_OK);}
开发者ID:cailianchun,项目名称:acpica,代码行数:71,
示例15: AcpiNsRootInitializeACPI_STATUSAcpiNsRootInitialize ( void){ ACPI_STATUS Status; const ACPI_PREDEFINED_NAMES *InitVal = NULL; ACPI_NAMESPACE_NODE *NewNode; ACPI_OPERAND_OBJECT *ObjDesc; ACPI_STRING Val = NULL; ACPI_FUNCTION_TRACE (NsRootInitialize); Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } /* * The global root ptr is initially NULL, so a non-NULL value indicates * that AcpiNsRootInitialize() has already been called; just return. */ if (AcpiGbl_RootNode) { Status = AE_OK; goto UnlockAndExit; } /* * Tell the rest of the subsystem that the root is initialized * (This is OK because the namespace is locked) */ AcpiGbl_RootNode = &AcpiGbl_RootNodeStruct; /* Enter the pre-defined names in the name table */ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Entering predefined entries into namespace/n")); for (InitVal = AcpiGbl_PreDefinedNames; InitVal->Name; InitVal++) { /* _OSI is optional for now, will be permanent later */ if (!ACPI_STRCMP (InitVal->Name, "_OSI") && !AcpiGbl_CreateOsiMethod) { continue; } Status = AcpiNsLookup (NULL, __UNCONST(InitVal->Name), InitVal->Type, ACPI_IMODE_LOAD_PASS2, ACPI_NS_NO_UPSEARCH, NULL, &NewNode); if (ACPI_FAILURE (Status) || (!NewNode)) /* Must be on same line for code converter */ { ACPI_EXCEPTION ((AE_INFO, Status, "Could not create predefined name %s", InitVal->Name)); } /* * Name entered successfully. If entry in PreDefinedNames[] specifies * an initial value, create the initial value. */ if (InitVal->Val) { Status = AcpiOsPredefinedOverride (InitVal, &Val); if (ACPI_FAILURE (Status)) { ACPI_ERROR ((AE_INFO, "Could not override predefined %s", InitVal->Name)); } if (!Val) { Val = __UNCONST(InitVal->Val); } /* * Entry requests an initial value, allocate a * descriptor for it. */ ObjDesc = AcpiUtCreateInternalObject (InitVal->Type); if (!ObjDesc) { Status = AE_NO_MEMORY; goto UnlockAndExit; } /* * Convert value string from table entry to * internal representation. Only types actually * used for initial values are implemented here. */ switch (InitVal->Type) { case ACPI_TYPE_METHOD: ObjDesc->Method.ParamCount = (UINT8) ACPI_TO_INTEGER (Val);//.........这里部分代码省略.........
开发者ID:RyanLucchese,项目名称:rumpkernel-netbsd-src,代码行数:101,
示例16: OptBuildShortestPath//.........这里部分代码省略......... * target string */ Index = (NumCommonSegments * ACPI_PATH_SEGMENT_LENGTH) + 1; /* Special handling for exact subpath in a name declaration */ if (IsDeclaration && SubPath && (CurrentPath->Length > TargetPath->Length)) { /* * The current path is longer than the target, and the target is a * subpath of the current path. We must include one more NameSeg of * the target path */ Index -= ACPI_PATH_SEGMENT_LENGTH; /* Special handling for Scope() operator */ if (Op->Asl.AmlOpcode == AML_SCOPE_OP) { NewPathExternal[i] = AML_PARENT_PREFIX; i++; ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, "(EXTRA ^)")); } } /* Make sure we haven't gone off the end of the target path */ if (Index > TargetPath->Length) { Index = TargetPath->Length; } strcpy (&NewPathExternal[i], &((char *) TargetPath->Pointer)[Index]); ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " %-24s", NewPathExternal)); /* * Internalize the new target string and check it against the original * string to make sure that this is in fact an optimization. If the * original string is already optimal, there is no point in continuing. */ Status = AcpiNsInternalizeName (NewPathExternal, &NewPath); if (ACPI_FAILURE (Status)) { AslCoreSubsystemError (Op, Status, "Internalizing new NamePath", ASL_NO_ABORT); ACPI_FREE (NewPathExternal); return (Status); } if (strlen (NewPath) >= AmlNameStringLength) { ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " NOT SHORTER (New %u old %u)", (UINT32) strlen (NewPath), (UINT32) AmlNameStringLength)); ACPI_FREE (NewPathExternal); return (AE_NOT_FOUND); } /* * Check to make sure that the optimization finds the node we are * looking for. This is simply a sanity check on the new * path that has been created. */ Status = AcpiNsLookup (&ScopeInfo, NewPath, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, ACPI_NS_DONT_OPEN_SCOPE, WalkState, &(Node)); if (ACPI_SUCCESS (Status)) { /* Found the namepath, but make sure the node is correct */ if (Node == TargetNode) { /* The lookup matched the node, accept this optimization */ AslError (ASL_OPTIMIZATION, ASL_MSG_NAME_OPTIMIZATION, Op, NewPathExternal); *ReturnNewPath = NewPath; } else { /* Node is not correct, do not use this optimization */ Status = AE_NOT_FOUND; ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " ***** WRONG NODE")); AslError (ASL_WARNING, ASL_MSG_COMPILER_INTERNAL, Op, "Not using optimized name - found wrong node"); } } else { /* The lookup failed, we obviously cannot use this optimization */ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " ***** NOT FOUND")); AslError (ASL_WARNING, ASL_MSG_COMPILER_INTERNAL, Op, "Not using optimized name - did not find node"); } ACPI_FREE (NewPathExternal); return (Status);}
开发者ID:cailianchun,项目名称:acpica,代码行数:101,
示例17: AcpiNsGetNodeACPI_STATUSAcpiNsGetNode ( ACPI_NAMESPACE_NODE *PrefixNode, const char *Pathname, UINT32 Flags, ACPI_NAMESPACE_NODE **ReturnNode){ ACPI_GENERIC_STATE ScopeInfo; ACPI_STATUS Status; char *InternalPath; ACPI_FUNCTION_TRACE_PTR (NsGetNode, ACPI_CAST_PTR (char, Pathname)); if (!Pathname) { *ReturnNode = PrefixNode; if (!PrefixNode) { *ReturnNode = AcpiGbl_RootNode; } return_ACPI_STATUS (AE_OK); } /* Convert path to internal representation */ Status = AcpiNsInternalizeName (Pathname, &InternalPath); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } /* Must lock namespace during lookup */ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); if (ACPI_FAILURE (Status)) { goto Cleanup; } /* Setup lookup scope (search starting point) */ ScopeInfo.Scope.Node = PrefixNode; /* Lookup the name in the namespace */ Status = AcpiNsLookup (&ScopeInfo, InternalPath, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, (Flags | ACPI_NS_DONT_OPEN_SCOPE), NULL, ReturnNode); if (ACPI_FAILURE (Status)) { ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%s, %s/n", Pathname, AcpiFormatException (Status))); } (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);Cleanup: ACPI_FREE (InternalPath); return_ACPI_STATUS (Status);}
开发者ID:DangerDexter,项目名称:FreeBSD-8.0-dyntick,代码行数:62,
示例18: AcpiPsDisplayObjectPathnameACPI_STATUSAcpiPsDisplayObjectPathname ( ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op){ ACPI_STATUS Status; ACPI_NAMESPACE_NODE *Node; ACPI_BUFFER Buffer; UINT32 DebugLevel; /* Save current debug level so we don't get extraneous debug output */ DebugLevel = AcpiDbgLevel; AcpiDbgLevel = 0; /* Just get the Node out of the Op object */ Node = Op->Common.Node; if (!Node) { /* Node not defined in this scope, look it up */ Status = AcpiNsLookup (WalkState->ScopeInfo, Op->Common.Value.String, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, WalkState, &(Node)); if (ACPI_FAILURE (Status)) { /* * We can't get the pathname since the object * is not in the namespace. This can happen during single * stepping where a dynamic named object is *about* to be created. */ AcpiOsPrintf (" [Path not found]"); goto Exit; } /* Save it for next time. */ Op->Common.Node = Node; } /* Convert NamedDesc/handle to a full pathname */ Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER; Status = AcpiNsHandleToPathname (Node, &Buffer); if (ACPI_FAILURE (Status)) { AcpiOsPrintf ("****Could not get pathname****)"); goto Exit; } AcpiOsPrintf (" (Path %s)", (char *) Buffer.Pointer); ACPI_FREE (Buffer.Pointer);Exit: /* Restore the debug level */ AcpiDbgLevel = DebugLevel; return (Status);}
开发者ID:coyizumi,项目名称:cs111,代码行数:63,
示例19: AcpiDsBuildInternalObjectstatic ACPI_STATUSAcpiDsBuildInternalObject ( ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op, ACPI_OPERAND_OBJECT **ObjDescPtr){ ACPI_OPERAND_OBJECT *ObjDesc; ACPI_STATUS Status; ACPI_FUNCTION_TRACE (DsBuildInternalObject); *ObjDescPtr = NULL; if (Op->Common.AmlOpcode == AML_INT_NAMEPATH_OP) { /* * This is a named object reference. If this name was * previously looked up in the namespace, it was stored in this op. * Otherwise, go ahead and look it up now */ if (!Op->Common.Node) { Status = AcpiNsLookup (WalkState->ScopeInfo, Op->Common.Value.String, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, NULL, ACPI_CAST_INDIRECT_PTR (ACPI_NAMESPACE_NODE, &(Op->Common.Node))); if (ACPI_FAILURE (Status)) { /* Check if we are resolving a named reference within a package */ if ((Status == AE_NOT_FOUND) && (AcpiGbl_EnableInterpreterSlack) && ((Op->Common.Parent->Common.AmlOpcode == AML_PACKAGE_OP) || (Op->Common.Parent->Common.AmlOpcode == AML_VAR_PACKAGE_OP))) { /* * We didn't find the target and we are populating elements * of a package - ignore if slack enabled. Some ASL code * contains dangling invalid references in packages and * expects that no exception will be issued. Leave the * element as a null element. It cannot be used, but it * can be overwritten by subsequent ASL code - this is * typically the case. */ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Ignoring unresolved reference in package [%4.4s]/n", WalkState->ScopeInfo->Scope.Node->Name.Ascii)); return_ACPI_STATUS (AE_OK); } else { ACPI_ERROR_NAMESPACE (Op->Common.Value.String, Status); } return_ACPI_STATUS (Status); } } } /* Create and init a new internal ACPI object */ ObjDesc = AcpiUtCreateInternalObject ( (AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode))->ObjectType); if (!ObjDesc) { return_ACPI_STATUS (AE_NO_MEMORY); } Status = AcpiDsInitObjectFromOp (WalkState, Op, Op->Common.AmlOpcode, &ObjDesc); if (ACPI_FAILURE (Status)) { AcpiUtRemoveReference (ObjDesc); return_ACPI_STATUS (Status); } *ObjDescPtr = ObjDesc; return_ACPI_STATUS (AE_OK);}
开发者ID:andreiw,项目名称:polaris,代码行数:82,
示例20: XfNamespaceLocateBegin//.........这里部分代码省略......... Path = Op->Asl.Child->Asl.Next->Asl.Value.String; } } else if (OpInfo->Flags & AML_CREATE) { /* Name must appear as the last parameter */ NextOp = Op->Asl.Child; while (!(NextOp->Asl.CompileFlags & OP_IS_NAME_DECLARATION)) { NextOp = NextOp->Asl.Next; } Path = NextOp->Asl.Value.String; } else { Path = Op->Asl.Value.String; } ObjectType = AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode); ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Type=%s/n", AcpiUtGetTypeName (ObjectType))); /* * Lookup the name in the namespace. Name must exist at this point, or it * is an invalid reference. * * The namespace is also used as a lookup table for references to resource * descriptors and the fields within them. */ AslGbl_NsLookupCount++; Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType, ACPI_IMODE_EXECUTE, Flags, WalkState, &Node); if (ACPI_FAILURE (Status)) { if (Status == AE_NOT_FOUND) { /* * We didn't find the name reference by path -- we can qualify this * a little better before we print an error message */ if (strlen (Path) == ACPI_NAME_SIZE) { /* A simple, one-segment ACPI name */ if (XfObjectExists (Path)) { /* * There exists such a name, but we couldn't get to it * from this scope */ AslError (ASL_ERROR, ASL_MSG_NOT_REACHABLE, Op, Op->Asl.ExternalName); } else { /* The name doesn't exist, period */ AslError (ASL_ERROR, ASL_MSG_NOT_EXIST, Op, Op->Asl.ExternalName); } } else {
开发者ID:kusumi,项目名称:DragonFlyBSD,代码行数:67,
示例21: LdLoadFieldElementsstatic ACPI_STATUSLdLoadFieldElements ( ACPI_PARSE_OBJECT *Op, ACPI_WALK_STATE *WalkState){ ACPI_PARSE_OBJECT *Child = NULL; ACPI_NAMESPACE_NODE *Node; ACPI_STATUS Status; /* Get the first named field element */ switch (Op->Asl.AmlOpcode) { case AML_BANK_FIELD_OP: Child = UtGetArg (Op, 6); break; case AML_INDEX_FIELD_OP: Child = UtGetArg (Op, 5); break; case AML_FIELD_OP: Child = UtGetArg (Op, 4); break; default: /* No other opcodes should arrive here */ return (AE_BAD_PARAMETER); } /* Enter all elements into the namespace */ while (Child) { switch (Child->Asl.AmlOpcode) { case AML_INT_RESERVEDFIELD_OP: case AML_INT_ACCESSFIELD_OP: case AML_INT_CONNECTION_OP: break; default: Status = AcpiNsLookup (WalkState->ScopeInfo, Child->Asl.Value.String, ACPI_TYPE_LOCAL_REGION_FIELD, ACPI_IMODE_LOAD_PASS1, ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | ACPI_NS_ERROR_IF_FOUND, NULL, &Node); if (ACPI_FAILURE (Status)) { if (Status != AE_ALREADY_EXISTS) { AslError (ASL_ERROR, ASL_MSG_CORE_EXCEPTION, Child, Child->Asl.Value.String); return (Status); } /* * The name already exists in this scope * But continue processing the elements */ AslError (ASL_ERROR, ASL_MSG_NAME_EXISTS, Child, Child->Asl.Value.String); } else { Child->Asl.Node = Node; Node->Op = Child; } break; } Child = Child->Asl.Next; } return (AE_OK);}
开发者ID:2asoft,项目名称:freebsd,代码行数:84,
示例22: AcpiDmCheckResourceReferencevoidAcpiDmCheckResourceReference ( ACPI_PARSE_OBJECT *Op, ACPI_WALK_STATE *WalkState){ ACPI_STATUS Status; ACPI_PARSE_OBJECT *BufferNameOp; ACPI_PARSE_OBJECT *IndexOp; ACPI_NAMESPACE_NODE *BufferNode; ACPI_NAMESPACE_NODE *ResourceNode; const ACPI_OPCODE_INFO *OpInfo; UINT32 BitIndex; /* We are only interested in the CreateXxxxField opcodes */ OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); if (OpInfo->Type != AML_TYPE_CREATE_FIELD) { return; } /* Get the buffer term operand */ BufferNameOp = AcpiPsGetDepthNext (NULL, Op); /* Must be a named buffer, not an arg or local or method call */ if (BufferNameOp->Common.AmlOpcode != AML_INT_NAMEPATH_OP) { return; } /* Get the Index term, must be an integer constant to convert */ IndexOp = BufferNameOp->Common.Next; /* Major cheat: The Node field is also used for the Tag ptr. Clear it now */ IndexOp->Common.Node = NULL; OpInfo = AcpiPsGetOpcodeInfo (IndexOp->Common.AmlOpcode); if (OpInfo->ObjectType != ACPI_TYPE_INTEGER) { return; } /* Get the bit offset of the descriptor within the buffer */ if ((Op->Common.AmlOpcode == AML_CREATE_BIT_FIELD_OP) || (Op->Common.AmlOpcode == AML_CREATE_FIELD_OP)) { /* Index operand is a bit offset */ BitIndex = (UINT32) IndexOp->Common.Value.Integer; } else { /* Index operand is a byte offset, convert to bits */ BitIndex = (UINT32) ACPI_MUL_8 (IndexOp->Common.Value.Integer); } /* Lookup the buffer in the namespace */ Status = AcpiNsLookup (WalkState->ScopeInfo, BufferNameOp->Common.Value.String, ACPI_TYPE_BUFFER, ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, WalkState, &BufferNode); if (ACPI_FAILURE (Status)) { return; } /* Validate object type, we must have a buffer */ if (BufferNode->Type != ACPI_TYPE_BUFFER) { return; } /* Find the resource descriptor node corresponding to the index */ ResourceNode = AcpiDmGetResourceNode (BufferNode, BitIndex); if (!ResourceNode) { return; } /* Translate the Index to a resource tag pathname */ AcpiGetTagPathname (IndexOp, BufferNode, ResourceNode, BitIndex);}
开发者ID:Raphine,项目名称:Raph_Kernel,代码行数:93,
示例23: LdLoadResourceElementsstatic ACPI_STATUSLdLoadResourceElements ( ACPI_PARSE_OBJECT *Op, ACPI_WALK_STATE *WalkState){ ACPI_PARSE_OBJECT *InitializerOp = NULL; ACPI_NAMESPACE_NODE *Node; ACPI_STATUS Status; /* * Enter the resource name into the namespace. Name must not already exist. * This opens a scope, so later field names are guaranteed to be new/unique. */ Status = AcpiNsLookup (WalkState->ScopeInfo, Op->Asl.Namepath, ACPI_TYPE_LOCAL_RESOURCE, ACPI_IMODE_LOAD_PASS1, ACPI_NS_NO_UPSEARCH | ACPI_NS_ERROR_IF_FOUND, WalkState, &Node); if (ACPI_FAILURE (Status)) { if (Status == AE_ALREADY_EXISTS) { /* Actual node causing the error was saved in ParentMethod */ AslError (ASL_ERROR, ASL_MSG_NAME_EXISTS, (ACPI_PARSE_OBJECT *) Op->Asl.ParentMethod, Op->Asl.Namepath); return (AE_OK); } return (Status); } Node->Value = (UINT32) Op->Asl.Value.Integer; Node->Op = Op; Op->Asl.Node = Node; /* * Now enter the predefined fields, for easy lookup when referenced * by the source ASL */ InitializerOp = ASL_GET_CHILD_NODE (Op); while (InitializerOp) { if (InitializerOp->Asl.ExternalName) { Status = AcpiNsLookup (WalkState->ScopeInfo, InitializerOp->Asl.ExternalName, ACPI_TYPE_LOCAL_RESOURCE_FIELD, ACPI_IMODE_LOAD_PASS1, ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE, NULL, &Node); if (ACPI_FAILURE (Status)) { return (Status); } /* * Store the field offset and length in the namespace node * so it can be used when the field is referenced */ Node->Value = InitializerOp->Asl.Value.Tag.BitOffset; Node->Length = InitializerOp->Asl.Value.Tag.BitLength; InitializerOp->Asl.Node = Node; Node->Op = InitializerOp; } InitializerOp = ASL_GET_PEER_NODE (InitializerOp); } return (AE_OK);}
开发者ID:2asoft,项目名称:freebsd,代码行数:70,
示例24: AcpiDsBuildInternalObjectstatic ACPI_STATUSAcpiDsBuildInternalObject ( ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op, ACPI_OPERAND_OBJECT **ObjDescPtr){ ACPI_OPERAND_OBJECT *ObjDesc; ACPI_STATUS Status; ACPI_OBJECT_TYPE Type; ACPI_FUNCTION_TRACE (DsBuildInternalObject); *ObjDescPtr = NULL; if (Op->Common.AmlOpcode == AML_INT_NAMEPATH_OP) { /* * This is a named object reference. If this name was * previously looked up in the namespace, it was stored in this op. * Otherwise, go ahead and look it up now */ if (!Op->Common.Node) { Status = AcpiNsLookup (WalkState->ScopeInfo, Op->Common.Value.String, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, NULL, ACPI_CAST_INDIRECT_PTR (ACPI_NAMESPACE_NODE, &(Op->Common.Node))); if (ACPI_FAILURE (Status)) { /* Check if we are resolving a named reference within a package */ if ((Status == AE_NOT_FOUND) && (AcpiGbl_EnableInterpreterSlack) && ((Op->Common.Parent->Common.AmlOpcode == AML_PACKAGE_OP) || (Op->Common.Parent->Common.AmlOpcode == AML_VAR_PACKAGE_OP))) { /* * We didn't find the target and we are populating elements * of a package - ignore if slack enabled. Some ASL code * contains dangling invalid references in packages and * expects that no exception will be issued. Leave the * element as a null element. It cannot be used, but it * can be overwritten by subsequent ASL code - this is * typically the case. */ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Ignoring unresolved reference in package [%4.4s]/n", WalkState->ScopeInfo->Scope.Node->Name.Ascii)); return_ACPI_STATUS (AE_OK); } else { ACPI_ERROR_NAMESPACE (Op->Common.Value.String, Status); } return_ACPI_STATUS (Status); } } /* Special object resolution for elements of a package */ if ((Op->Common.Parent->Common.AmlOpcode == AML_PACKAGE_OP) || (Op->Common.Parent->Common.AmlOpcode == AML_VAR_PACKAGE_OP)) { /* * Attempt to resolve the node to a value before we insert it into * the package. If this is a reference to a common data type, * resolve it immediately. According to the ACPI spec, package * elements can only be "data objects" or method references. * Attempt to resolve to an Integer, Buffer, String or Package. * If cannot, return the named reference (for things like Devices, * Methods, etc.) Buffer Fields and Fields will resolve to simple * objects (int/buf/str/pkg). * * NOTE: References to things like Devices, Methods, Mutexes, etc. * will remain as named references. This behavior is not described * in the ACPI spec, but it appears to be an oversight. */ ObjDesc = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Op->Common.Node); Status = AcpiExResolveNodeToValue ( ACPI_CAST_INDIRECT_PTR (ACPI_NAMESPACE_NODE, &ObjDesc), WalkState); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } /* * Special handling for Alias objects. We need to setup the type * and the Op->Common.Node to point to the Alias target. Note, * Alias has at most one level of indirection internally. */ Type = Op->Common.Node->Type; if (Type == ACPI_TYPE_LOCAL_ALIAS) { Type = ObjDesc->Common.Type;//.........这里部分代码省略.........
开发者ID:ornarium,项目名称:freebsd,代码行数:101,
示例25: LkNamespaceLocateBegin//.........这里部分代码省略......... */ Path = Op->Asl.Child->Asl.Next->Asl.Value.String; } } else if (OpInfo->Flags & AML_CREATE) { /* Name must appear as the last parameter */ NextOp = Op->Asl.Child; while (!(NextOp->Asl.CompileFlags & NODE_IS_NAME_DECLARATION)) { NextOp = NextOp->Asl.Next; } Path = NextOp->Asl.Value.String; } else { Path = Op->Asl.Value.String; } ObjectType = AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode); ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Type=%s/n", AcpiUtGetTypeName (ObjectType))); /* * Lookup the name in the namespace. Name must exist at this point, or it * is an invalid reference. * * The namespace is also used as a lookup table for references to resource * descriptors and the fields within them. */ Gbl_NsLookupCount++; Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType, ACPI_IMODE_EXECUTE, Flags, WalkState, &(Node)); if (ACPI_FAILURE (Status)) { if (Status == AE_NOT_FOUND) { /* * We didn't find the name reference by path -- we can qualify this * a little better before we print an error message */ if (strlen (Path) == ACPI_NAME_SIZE) { /* A simple, one-segment ACPI name */ if (LkObjectExists (Path)) { /* * There exists such a name, but we couldn't get to it * from this scope */ AslError (ASL_ERROR, ASL_MSG_NOT_REACHABLE, Op, Op->Asl.ExternalName); } else { /* The name doesn't exist, period */ if ((Op->Asl.Parent) && (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_CONDREFOF)) { /* Ignore not found if parent is CondRefOf */ return (AE_OK);
开发者ID:samueldotj,项目名称:AceOS,代码行数:67,
注:本文中的AcpiNsLookup函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ AcpiNsOpensScope函数代码示例 C++ AcpiNsHandleToPathname函数代码示例 |