summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNate Lawson <njl@FreeBSD.org>2003-05-27 19:19:05 +0000
committerNate Lawson <njl@FreeBSD.org>2003-05-27 19:19:05 +0000
commit006b3ddb51d96b01985505c8cac9c3cfec5cc5f4 (patch)
tree7deb30919c86a6d11cd457ece9062a5cebc5812e
parent0f78c17f6f087ccc6ce4cd9f0e8f293f5e1bf30d (diff)
downloadsrc-test2-006b3ddb51d96b01985505c8cac9c3cfec5cc5f4.tar.gz
src-test2-006b3ddb51d96b01985505c8cac9c3cfec5cc5f4.zip
Fix false AE_NOT_FOUND messages, reported in NetBSD port-i386/20897.
NetBSD dsmethod.c rev 1.7 Fix parent-child loop problem Fix a reference count problem that may cause unexpected memory free Intel 20030512 ACPICA drop (nsalloc.c) Approved by: re (jhb) Obtained from: NetBSD, Intel Reported by: mbr, kochi AT netbsd.org
Notes
Notes: svn path=/vendor-sys/acpica/dist/; revision=115351
-rw-r--r--sys/contrib/dev/acpica/dsmethod.c2
-rw-r--r--sys/contrib/dev/acpica/nsalloc.c46
2 files changed, 44 insertions, 4 deletions
diff --git a/sys/contrib/dev/acpica/dsmethod.c b/sys/contrib/dev/acpica/dsmethod.c
index 3916387377a9..d0431217b491 100644
--- a/sys/contrib/dev/acpica/dsmethod.c
+++ b/sys/contrib/dev/acpica/dsmethod.c
@@ -378,6 +378,8 @@ AcpiDsCallControlMethod (
return_ACPI_STATUS (AE_NULL_OBJECT);
}
+ ObjDesc->Method.OwningId = AcpiUtAllocateOwnerId (ACPI_OWNER_TYPE_METHOD);
+
/* Init for new method, wait on concurrency semaphore */
Status = AcpiDsBeginMethodExecution (MethodNode, ObjDesc,
diff --git a/sys/contrib/dev/acpica/nsalloc.c b/sys/contrib/dev/acpica/nsalloc.c
index 74220f355925..e221973dc25c 100644
--- a/sys/contrib/dev/acpica/nsalloc.c
+++ b/sys/contrib/dev/acpica/nsalloc.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: nsalloc - Namespace allocation and deletion utilities
- * $Revision: 79 $
+ * $Revision: 82 $
*
******************************************************************************/
@@ -192,6 +192,8 @@ AcpiNsDeleteNode (
PrevNode = NULL;
NextNode = ParentNode->Child;
+ /* Find the node that is the previous peer in the parent's child list */
+
while (NextNode != Node)
{
PrevNode = NextNode;
@@ -200,6 +202,8 @@ AcpiNsDeleteNode (
if (PrevNode)
{
+ /* Node is not first child, unlink it */
+
PrevNode->Peer = NextNode->Peer;
if (NextNode->Flags & ANOBJ_END_OF_PEER_LIST)
{
@@ -208,7 +212,19 @@ AcpiNsDeleteNode (
}
else
{
- ParentNode->Child = NextNode->Peer;
+ /* Node is first child (has no previous peer) */
+
+ if (NextNode->Flags & ANOBJ_END_OF_PEER_LIST)
+ {
+ /* No peers at all */
+
+ ParentNode->Child = NULL;
+ }
+ else
+ { /* Link peer list to parent */
+
+ ParentNode->Child = NextNode->Peer;
+ }
}
@@ -305,7 +321,7 @@ AcpiNsInstallNode (
ACPI_NAMESPACE_NODE *Node, /* New Child*/
ACPI_OBJECT_TYPE Type)
{
- UINT16 OwnerId = TABLE_ID_DSDT;
+ UINT16 OwnerId = 0;
ACPI_NAMESPACE_NODE *ChildNode;
#ifdef ACPI_ALPHABETIC_NAMESPACE
@@ -448,6 +464,7 @@ AcpiNsDeleteChildren (
{
ACPI_NAMESPACE_NODE *ChildNode;
ACPI_NAMESPACE_NODE *NextNode;
+ ACPI_NAMESPACE_NODE *Node;
UINT8 Flags;
@@ -496,6 +513,27 @@ AcpiNsDeleteChildren (
* Detach an object if there is one, then free the child node
*/
AcpiNsDetachObject (ChildNode);
+
+ /*
+ * Decrement the reference count(s) of all parents up to
+ * the root! (counts were incremented when the node was created)
+ */
+ Node = ChildNode;
+ while ((Node = AcpiNsGetParentNode (Node)) != NULL)
+ {
+ Node->ReferenceCount--;
+ }
+
+ /* There should be only one reference remaining on this node */
+
+ if (ChildNode->ReferenceCount != 1)
+ {
+ ACPI_REPORT_WARNING (("Existing references (%d) on node being deleted (%p)\n",
+ ChildNode->ReferenceCount, ChildNode));
+ }
+
+ /* Now we can delete the node */
+
ACPI_MEM_FREE (ChildNode);
/* And move on to the next child in the list */
@@ -614,7 +652,7 @@ AcpiNsDeleteNamespaceSubtree (
*
******************************************************************************/
-static void
+void
AcpiNsRemoveReference (
ACPI_NAMESPACE_NODE *Node)
{