diff options
Diffstat (limited to 'source/components/namespace/nseval.c')
-rw-r--r-- | source/components/namespace/nseval.c | 66 |
1 files changed, 16 insertions, 50 deletions
diff --git a/source/components/namespace/nseval.c b/source/components/namespace/nseval.c index 0509c80e7a0c7..a4819947dae40 100644 --- a/source/components/namespace/nseval.c +++ b/source/components/namespace/nseval.c @@ -418,7 +418,7 @@ AcpiNsExecModuleCodeList ( * * DESCRIPTION: Execute a control method containing a block of module-level * executable AML code. The control method is temporarily - * installed to the root node, then evaluated. + * installed to a local copy of the root node, then evaluated. * ******************************************************************************/ @@ -427,10 +427,9 @@ AcpiNsExecModuleCode ( ACPI_OPERAND_OBJECT *MethodObj, ACPI_EVALUATE_INFO *Info) { - ACPI_OPERAND_OBJECT *ParentObj; - ACPI_NAMESPACE_NODE *ParentNode; - ACPI_OBJECT_TYPE Type; ACPI_STATUS Status; + ACPI_NAMESPACE_NODE *TempNode; + ACPI_NAMESPACE_NODE *ParentNode; ACPI_FUNCTION_TRACE (NsExecModuleCode); @@ -442,21 +441,18 @@ AcpiNsExecModuleCode ( */ ParentNode = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, MethodObj->Method.NextObject); - Type = AcpiNsGetType (ParentNode); - /* - * Get the region handler and save it in the method object. We may need - * this if an operation region declaration causes a _REG method to be run. - * - * We can't do this in AcpiPsLinkModuleCode because - * AcpiGbl_RootNode->Object is NULL at PASS1. - */ - if ((Type == ACPI_TYPE_DEVICE) && ParentNode->Object) + /* Take a copy of the parent node to act as parent of this method */ + + TempNode = ACPI_ALLOCATE (sizeof (ACPI_NAMESPACE_NODE)); + if (!TempNode) { - MethodObj->Method.Dispatch.Handler = - ParentNode->Object->Device.Handler; + return_VOID; } + memcpy (TempNode, ParentNode, sizeof (ACPI_NAMESPACE_NODE)); + TempNode->Object = NULL; /* Clear the subobject */ + /* Must clear NextObject (AcpiNsAttachObject needs the field) */ MethodObj->Method.NextObject = NULL; @@ -464,26 +460,14 @@ AcpiNsExecModuleCode ( /* Initialize the evaluation information block */ memset (Info, 0, sizeof (ACPI_EVALUATE_INFO)); - Info->PrefixNode = ParentNode; - - /* - * Get the currently attached parent object. Add a reference, because the - * ref count will be decreased when the method object is installed to - * the parent node. - */ - ParentObj = AcpiNsGetAttachedObject (ParentNode); - if (ParentObj) - { - AcpiUtAddReference (ParentObj); - } + Info->PrefixNode = TempNode; /* Install the method (module-level code) in the parent node */ - Status = AcpiNsAttachObject (ParentNode, MethodObj, - ACPI_TYPE_METHOD); + Status = AcpiNsAttachObject (TempNode, MethodObj, ACPI_TYPE_METHOD); if (ACPI_FAILURE (Status)) { - goto Exit; + goto Cleanup; } /* Execute the parent node as a control method */ @@ -501,25 +485,7 @@ AcpiNsExecModuleCode ( AcpiUtRemoveReference (Info->ReturnObject); } - /* Detach the temporary method object */ - - AcpiNsDetachObject (ParentNode); - - /* Restore the original parent object */ - - if (ParentObj) - { - Status = AcpiNsAttachObject (ParentNode, ParentObj, Type); - } - else - { - ParentNode->Type = (UINT8) Type; - } - -Exit: - if (ParentObj) - { - AcpiUtRemoveReference (ParentObj); - } +Cleanup: + ACPI_FREE (TempNode); return_VOID; } |