Subject: Re: NOTE: ACPI update
To: None <abuse@spamalicious.com>
From: Takayoshi Kochi <kochi@netbsd.org>
List: current-users
Date: 11/03/2003 18:54:02
----Next_Part(Mon_Nov__3_18:54:02_2003_023)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Hi,

> Even if you were already successfully running ACPI, please retest with the new 
> version and confirm whether or not it works.

When I try envstat -r some times, the kernel will start spiting
these messages and _BST can never be retrieved.

|utdelete-0478 [13] UtUpdateRefCount      : **** Warning **** Large Reference Count (CACA) in object 0xc0e6bd28
|
|utdelete-0478 [13] UtUpdateRefCount      : **** Warning **** Large Reference Count (CACB) in object 0xc0e6bd28
|
|utdelete-0478 [09] UtUpdateRefCount      : **** Warning **** Large Reference Count (CACC) in object 0xc0e6bd28
|utobject-0558 [04] UtGetSimpleObjectSize : Unsupported type=CA in object 0xc0e6bd28
|utdelete-0478 [03] UtUpdateRefCount      : **** Warning **** Large Reference Count (CACA) in object 0xc0e6bd28
|
|bat: failed to evaluate _BST: 0x8

This is a known problem since ACPI CA 20030619 and it prevented
me from updating the ACPI CA tree in NetBSD.
Clearly the memory was broken by someone.

I haven't had time to investigate this but Nate Lawson (working
for FreeBSD) is at least aware of this and maybe someone
at Intel is also aware.

I'll check the status of this and back to you later.

BTW, this problem can be worked around by attached patch
(just reverting the change at 20030619).

---
Takayoshi Kochi

----Next_Part(Mon_Nov__3_18:54:02_2003_023)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="dsmthdat.c.patch"

--- dsmthdat.c.orig	2003-11-03 18:38:54.000000000 +0900
+++ dsmthdat.c	2003-11-03 15:34:28.000000000 +0900
@@ -392,6 +392,7 @@
 {
     ACPI_STATUS             Status;
     ACPI_NAMESPACE_NODE     *Node;
+    ACPI_OPERAND_OBJECT     *NewDesc = Object;
 
 
     ACPI_FUNCTION_TRACE ("DsMethodDataSetValue");
@@ -411,16 +412,31 @@
     }
 
     /*
-     * 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 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.
      */
-    AcpiUtAddReference (Object);
+    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);
+    }
 
     /* Install the object */
 
-    Node->Object = Object;
+    Node->Object = NewDesc;
     return_ACPI_STATUS (Status);
 }
 

----Next_Part(Mon_Nov__3_18:54:02_2003_023)----