Lines Matching +full:control +full:- +full:parent

3  * Module Name: psparse - Parser top level AML parse routines
11 * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp.
28 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
104 * re-exports any such software from a foreign destination, Licensee shall
105 * ensure that the distribution and export/re-export of the software is in
108 * any of its subsidiaries will export/re-export any technical data, process,
130 * 3. Neither the names of the above-listed copyright holders nor the names
177 * PARAMETERS: Opcode - An AML opcode
190 /* Extended (2-byte) opcode if > 255 */ in AcpiPsGetOpcodeSize()
207 * PARAMETERS: ParserState - A parser state object
223 Aml = ParserState->Aml; in AcpiPsPeekOpcode()
242 * PARAMETERS: WalkState - Current State
243 * Op - Op to complete
277 if (((WalkState->ParseFlags & ACPI_PARSE_TREE_MASK) != ACPI_PARSE_DELETE_TREE) || in AcpiPsCompleteThisOp()
278 (WalkState->OpInfo->Class == AML_CLASS_ARGUMENT)) in AcpiPsCompleteThisOp()
285 if (Op->Common.Parent) in AcpiPsCompleteThisOp()
287 Prev = Op->Common.Parent->Common.Value.Arg; in AcpiPsCompleteThisOp()
299 ParentInfo = AcpiPsGetOpcodeInfo (Op->Common.Parent->Common.AmlOpcode); in AcpiPsCompleteThisOp()
301 switch (ParentInfo->Class) in AcpiPsCompleteThisOp()
313 AML_INT_RETURN_VALUE_OP, Op->Common.Aml); in AcpiPsCompleteThisOp()
325 if ((Op->Common.Parent->Common.AmlOpcode == AML_REGION_OP) || in AcpiPsCompleteThisOp()
326 (Op->Common.Parent->Common.AmlOpcode == AML_DATA_REGION_OP) || in AcpiPsCompleteThisOp()
327 (Op->Common.Parent->Common.AmlOpcode == AML_BUFFER_OP) || in AcpiPsCompleteThisOp()
328 (Op->Common.Parent->Common.AmlOpcode == AML_PACKAGE_OP) || in AcpiPsCompleteThisOp()
329 (Op->Common.Parent->Common.AmlOpcode == AML_BANK_FIELD_OP) || in AcpiPsCompleteThisOp()
330 (Op->Common.Parent->Common.AmlOpcode == AML_VARIABLE_PACKAGE_OP)) in AcpiPsCompleteThisOp()
333 AML_INT_RETURN_VALUE_OP, Op->Common.Aml); in AcpiPsCompleteThisOp()
339 else if ((Op->Common.Parent->Common.AmlOpcode == AML_NAME_OP) && in AcpiPsCompleteThisOp()
340 (WalkState->PassNumber <= ACPI_IMODE_LOAD_PASS2)) in AcpiPsCompleteThisOp()
342 if ((Op->Common.AmlOpcode == AML_BUFFER_OP) || in AcpiPsCompleteThisOp()
343 (Op->Common.AmlOpcode == AML_PACKAGE_OP) || in AcpiPsCompleteThisOp()
344 (Op->Common.AmlOpcode == AML_VARIABLE_PACKAGE_OP)) in AcpiPsCompleteThisOp()
346 ReplacementOp = AcpiPsAllocOp (Op->Common.AmlOpcode, in AcpiPsCompleteThisOp()
347 Op->Common.Aml); in AcpiPsCompleteThisOp()
354 ReplacementOp->Named.Data = Op->Named.Data; in AcpiPsCompleteThisOp()
355 ReplacementOp->Named.Length = Op->Named.Length; in AcpiPsCompleteThisOp()
364 AML_INT_RETURN_VALUE_OP, Op->Common.Aml); in AcpiPsCompleteThisOp()
371 /* We must unlink this op from the parent tree */ in AcpiPsCompleteThisOp()
379 ReplacementOp->Common.Parent = Op->Common.Parent; in AcpiPsCompleteThisOp()
380 ReplacementOp->Common.Value.Arg = NULL; in AcpiPsCompleteThisOp()
381 ReplacementOp->Common.Node = Op->Common.Node; in AcpiPsCompleteThisOp()
382 Op->Common.Parent->Common.Value.Arg = ReplacementOp; in AcpiPsCompleteThisOp()
383 ReplacementOp->Common.Next = Op->Common.Next; in AcpiPsCompleteThisOp()
387 Op->Common.Parent->Common.Value.Arg = Op->Common.Next; in AcpiPsCompleteThisOp()
391 /* Search the parent list */ in AcpiPsCompleteThisOp()
395 /* Traverse all siblings in the parent's argument list */ in AcpiPsCompleteThisOp()
397 Next = Prev->Common.Next; in AcpiPsCompleteThisOp()
402 ReplacementOp->Common.Parent = Op->Common.Parent; in AcpiPsCompleteThisOp()
403 ReplacementOp->Common.Value.Arg = NULL; in AcpiPsCompleteThisOp()
404 ReplacementOp->Common.Node = Op->Common.Node; in AcpiPsCompleteThisOp()
405 Prev->Common.Next = ReplacementOp; in AcpiPsCompleteThisOp()
406 ReplacementOp->Common.Next = Op->Common.Next; in AcpiPsCompleteThisOp()
411 Prev->Common.Next = Op->Common.Next; in AcpiPsCompleteThisOp()
433 * PARAMETERS: WalkState - Current state
434 * Op - Current parse op
435 * CallbackStatus - Status from previous operation
450 ACPI_PARSE_STATE *ParserState = &WalkState->ParserState; in AcpiPsNextParseState()
461 * A control method was terminated via a RETURN statement. in AcpiPsNextParseState()
464 ParserState->Aml = ParserState->AmlEnd; in AcpiPsNextParseState()
470 ParserState->Aml = WalkState->AmlLastWhile; in AcpiPsNextParseState()
471 WalkState->ControlState->Common.Value = FALSE; in AcpiPsNextParseState()
477 ParserState->Aml = WalkState->AmlLastWhile; in AcpiPsNextParseState()
483 ParserState->Aml = WalkState->AmlLastWhile; in AcpiPsNextParseState()
489 ParserState->Aml = ParserState->Scope->ParseScope.PkgEnd; in AcpiPsNextParseState()
499 ParserState->Aml = AcpiPsGetNextPackageEnd (ParserState); in AcpiPsNextParseState()
507 * package; We simply close out the parent (finishing the walk of in AcpiPsNextParseState()
508 * this branch of the tree) and continue execution at the parent in AcpiPsNextParseState()
511 ParserState->Aml = ParserState->Scope->ParseScope.PkgEnd; in AcpiPsNextParseState()
515 WalkState->ControlState->Common.Value = FALSE; in AcpiPsNextParseState()
521 /* A method call (invocation) -- transfer control */ in AcpiPsNextParseState()
524 WalkState->PrevOp = Op; in AcpiPsNextParseState()
525 WalkState->MethodCallOp = Op; in AcpiPsNextParseState()
526 WalkState->MethodCallNode = (Op->Common.Value.Arg)->Common.Node; in AcpiPsNextParseState()
530 WalkState->ReturnUsed = AcpiDsIsResultUsed (Op, WalkState); in AcpiPsNextParseState()
551 * PARAMETERS: WalkState - Current state
574 WalkState, WalkState->ParserState.Aml, in AcpiPsParseAml()
575 WalkState->ParserState.AmlSize)); in AcpiPsParseAml()
577 if (!WalkState->ParserState.Aml) in AcpiPsParseAml()
587 if (WalkState->MethodDesc) in AcpiPsParseAml()
589 /* Executing a control method - additional cleanup */ in AcpiPsParseAml()
591 AcpiDsTerminateControlMethod (WalkState->MethodDesc, WalkState); in AcpiPsParseAml()
598 WalkState->Thread = Thread; in AcpiPsParseAml()
604 if (WalkState->MethodDesc) in AcpiPsParseAml()
606 WalkState->Thread->CurrentSyncLevel = in AcpiPsParseAml()
607 WalkState->MethodDesc->Method.SyncLevel; in AcpiPsParseAml()
614 * executing control method. in AcpiPsParseAml()
620 * handles nested control method invocations without recursion. in AcpiPsParseAml()
640 if (WalkState->MethodPathname && WalkState->MethodIsNested) in AcpiPsParseAml()
644 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EVALUATION, "%-26s: %*s%s\n", in AcpiPsParseAml()
646 (WalkState->MethodNestingDepth + 1) * 3, " ", in AcpiPsParseAml()
647 &WalkState->MethodPathname[1])); in AcpiPsParseAml()
649 ACPI_FREE (WalkState->MethodPathname); in AcpiPsParseAml()
650 WalkState->MethodIsNested = FALSE; in AcpiPsParseAml()
656 * Transfer control to the called control method in AcpiPsParseAml()
666 * a new walk state was created -- get it in AcpiPsParseAml()
675 else if ((Status != AE_OK) && (WalkState->MethodDesc)) in AcpiPsParseAml()
683 WalkState->MethodNode, "Aborting method"); in AcpiPsParseAml()
689 WalkState->MethodNode, NULL, Status); in AcpiPsParseAml()
693 /* Check for possible multi-thread reentrancy problem */ in AcpiPsParseAml()
696 (!(WalkState->MethodDesc->Method.InfoFlags & in AcpiPsParseAml()
705 WalkState->MethodDesc->Method.InfoFlags |= in AcpiPsParseAml()
710 /* We are done with this walk, move on to the parent if any */ in AcpiPsParseAml()
719 * If we just returned from the execution of a control method or if we in AcpiPsParseAml()
723 if (((WalkState->ParseFlags & ACPI_PARSE_MODE_MASK) == in AcpiPsParseAml()
725 !(WalkState->ParseFlags & ACPI_PARSE_MODULE_LEVEL)) || in AcpiPsParseAml()
728 AcpiDsTerminateControlMethod (WalkState->MethodDesc, WalkState); in AcpiPsParseAml()
731 /* Delete this walk state and all linked control states */ in AcpiPsParseAml()
733 AcpiPsCleanupScope (&WalkState->ParserState); in AcpiPsParseAml()
738 WalkState->ReturnDesc, WalkState->ImplicitReturnObj, WalkState)); in AcpiPsParseAml()
749 * If the method return value is not used by the parent, in AcpiPsParseAml()
752 if (!PreviousWalkState->ReturnDesc) in AcpiPsParseAml()
759 !PreviousWalkState->ImplicitReturnObj) in AcpiPsParseAml()
761 PreviousWalkState->ImplicitReturnObj = in AcpiPsParseAml()
763 if (!PreviousWalkState->ImplicitReturnObj) in AcpiPsParseAml()
769 /* Restart the calling control method */ in AcpiPsParseAml()
772 PreviousWalkState->ImplicitReturnObj); in AcpiPsParseAml()
783 PreviousWalkState->ReturnDesc); in AcpiPsParseAml()
787 WalkState->WalkType |= ACPI_WALK_METHOD_RESTART; in AcpiPsParseAml()
794 AcpiUtRemoveReference (PreviousWalkState->ReturnDesc); in AcpiPsParseAml()
800 * Just completed a 1st-level method, save the final internal return in AcpiPsParseAml()
803 else if (PreviousWalkState->CallerReturnDesc) in AcpiPsParseAml()
805 if (PreviousWalkState->ImplicitReturnObj) in AcpiPsParseAml()
807 *(PreviousWalkState->CallerReturnDesc) = in AcpiPsParseAml()
808 PreviousWalkState->ImplicitReturnObj; in AcpiPsParseAml()
814 *(PreviousWalkState->CallerReturnDesc) = in AcpiPsParseAml()
815 PreviousWalkState->ReturnDesc; in AcpiPsParseAml()
820 if (PreviousWalkState->ReturnDesc) in AcpiPsParseAml()
824 AcpiUtRemoveReference (PreviousWalkState->ReturnDesc); in AcpiPsParseAml()
826 if (PreviousWalkState->ImplicitReturnObj) in AcpiPsParseAml()
830 AcpiUtRemoveReference (PreviousWalkState->ImplicitReturnObj); in AcpiPsParseAml()