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