ACPI_STATUS AcpiPsFindObject ( UINT16 Opcode, ACPI_PARSE_OBJECT *Op, ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT **OutOp) { NATIVE_CHAR *Path; const ACPI_OPCODE_INFO *OpInfo; /* We are only interested in opcodes that have an associated name */ OpInfo = AcpiPsGetOpcodeInfo (Opcode); if (!(OpInfo->Flags & AML_NAMED)) { *OutOp = Op; return (AE_OK); } /* Find the name in the parse tree */ Path = AcpiPsGetNextNamestring (WalkState->ParserState); *OutOp = AcpiPsFind (AcpiPsGetParentScope (WalkState->ParserState), Path, Opcode, 1); if (!(*OutOp)) { return (AE_NOT_FOUND); } return (AE_OK); }
void AcpiDmValidateName ( char *Name, ACPI_PARSE_OBJECT *Op) { if ((!Name) || (!Op->Common.Parent)) { return; } if (!Op->Common.Node) { AcpiOsPrintf ( " /**** Name not found or not accessible from this scope ****/ "); } ACPI_PARSE_OBJECT *TargetOp; if ((!Name) || (!Op->Common.Parent)) { return; } TargetOp = AcpiPsFind (Op, Name, 0, 0); if (!TargetOp) { /* * Didn't find the name in the parse tree. This may be * a problem, or it may simply be one of the predefined names * (such as _OS_). Rather than worry about looking up all * the predefined names, just display the name as given */ AcpiOsPrintf ( " /**** Name not found or not accessible from this scope ****/ "); } }
void AcpiPsGetNextNamepath ( ACPI_PARSE_STATE *ParserState, ACPI_PARSE_OBJECT *Arg, UINT32 *ArgCount, BOOLEAN MethodCall) { NATIVE_CHAR *Path; ACPI_PARSE_OBJECT *NameOp; ACPI_PARSE_OBJECT *Op; ACPI_PARSE_OBJECT *Count; 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 (AcpiGbl_ParsedNamespaceRoot) { /* * Lookup the name in the parsed namespace */ Op = NULL; if (MethodCall) { Op = AcpiPsFind (AcpiPsGetParentScope (ParserState), Path, AML_METHOD_OP, 0); } if (Op) { if (Op->Opcode == AML_METHOD_OP) { /* * The name refers to a control method, so this namepath is a * method invocation. We need to 1) Get the number of arguments * associated with this method, and 2) Change the NAMEPATH * object into a METHODCALL object. */ Count = AcpiPsGetArg (Op, 0); if (Count && Count->Opcode == AML_BYTE_OP) { NameOp = AcpiPsAllocOp (AML_INT_NAMEPATH_OP); if (NameOp) { /* Change arg into a METHOD CALL and attach the name */ AcpiPsInitOp (Arg, AML_INT_METHODCALL_OP); NameOp->Value.Name = Path; /* Point METHODCALL/NAME to the METHOD Node */ NameOp->Node = (ACPI_NAMESPACE_NODE *) Op; AcpiPsAppendArg (Arg, NameOp); *ArgCount = (UINT32) Count->Value.Integer & METHOD_FLAGS_ARG_COUNT; } } 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; return_VOID; }