summaryrefslogtreecommitdiffstats
path: root/sys/contrib/dev/acpica/dsmthdat.c
diff options
context:
space:
mode:
authornjl <njl@FreeBSD.org>2003-11-21 21:24:31 +0000
committernjl <njl@FreeBSD.org>2003-11-21 21:24:31 +0000
commit6b1df71547f8017dee64ce8046c34d75b9d2fed0 (patch)
treefc0a1b6055549cd259c3bfae5b2021f648326ebc /sys/contrib/dev/acpica/dsmthdat.c
parent0cd7ce3cbb9d9c5964d9dd61d9f8ab005cb896e3 (diff)
downloadFreeBSD-src-6b1df71547f8017dee64ce8046c34d75b9d2fed0.zip
FreeBSD-src-6b1df71547f8017dee64ce8046c34d75b9d2fed0.tar.gz
Update code for checking the reference count and performing the final
delete of objects. Also revert our temporary workaround in dsmthdat.c that always copied objects. This is the correct fix for errors evaluating _BST (and GBST) on IBM Thinkpads where an argument (Arg3) was returned to the caller and the object was freed while still in use. This will be in a future ACPI-CA dist. Thanks to: kochi@netbsd.org, shaohua.li@intel.com
Diffstat (limited to 'sys/contrib/dev/acpica/dsmthdat.c')
-rw-r--r--sys/contrib/dev/acpica/dsmthdat.c30
1 files changed, 7 insertions, 23 deletions
diff --git a/sys/contrib/dev/acpica/dsmthdat.c b/sys/contrib/dev/acpica/dsmthdat.c
index ed3d14e..3515957 100644
--- a/sys/contrib/dev/acpica/dsmthdat.c
+++ b/sys/contrib/dev/acpica/dsmthdat.c
@@ -392,7 +392,6 @@ AcpiDsMethodDataSetValue (
{
ACPI_STATUS Status;
ACPI_NAMESPACE_NODE *Node;
- ACPI_OPERAND_OBJECT *NewDesc = Object;
ACPI_FUNCTION_TRACE ("DsMethodDataSetValue");
@@ -411,32 +410,17 @@ AcpiDsMethodDataSetValue (
return_ACPI_STATUS (Status);
}
- /*
- * If the object has just been created and is not attached to anything,
- * (the reference count is 1), then we can just store it directly into
- * the arg/local. Otherwise, we must copy it.
+ /*
+ * Increment ref count so object can't be deleted while installed.
+ * NOTE: We do not copy the object in order to preserve the call by
+ * reference semantics of ACPI Control Method invocation.
+ * (See ACPI Specification 2.0C)
*/
- if (Object->Common.ReferenceCount > 1)
- {
- Status = AcpiUtCopyIobjectToIobject (Object, &NewDesc, WalkState);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Object Copied %p, new %p\n",
- Object, NewDesc));
- }
- else
- {
- /* Increment ref count so object can't be deleted while installed */
-
- AcpiUtAddReference (NewDesc);
- }
+ AcpiUtAddReference (Object);
/* Install the object */
- Node->Object = NewDesc;
+ Node->Object = Object;
return_ACPI_STATUS (Status);
}
OpenPOWER on IntegriCloud