From owner-acpi-jp@jp.freebsd.org  Thu Oct  4 13:40:10 2001
Received: (from daemon@localhost)
	by castle.jp.freebsd.org (8.9.3+3.2W/8.7.3) id NAA82152;
	Thu, 4 Oct 2001 13:40:10 +0900 (JST)
	(envelope-from owner-acpi-jp@jp.FreeBSD.org)
Received: from tasogare.imasy.or.jp (root@tasogare.imasy.or.jp [202.227.24.5])
	by castle.jp.freebsd.org (8.9.3+3.2W/8.7.3) with ESMTP id NAA82147
	for <acpi-jp@jp.freebsd.org>; Thu, 4 Oct 2001 13:40:09 +0900 (JST)
	(envelope-from iwasaki@jp.FreeBSD.org)
Received: from localhost (iwasaki.imasy.or.jp [202.227.24.92])
	by tasogare.imasy.or.jp (8.11.6+3.4W/8.11.6/tasogare) with ESMTP/inet id f944e8m18006
	for <acpi-jp@jp.freebsd.org>; Thu, 4 Oct 2001 13:40:08 +0900 (JST)
	(envelope-from iwasaki@jp.FreeBSD.org)
Date: Thu, 04 Oct 2001 13:40:06 +0900 (JST)
Message-Id: <20011004.134006.71083187.iwasaki@jp.FreeBSD.org>
To: acpi-jp@jp.freebsd.org
From: Mitsuru IWASAKI <iwasaki@jp.freebsd.org>
In-Reply-To: <200110040241.f942fZI06164@mass.dis.org>
References: <msmith@freebsd.org>
	<200110040241.f942fZI06164@mass.dis.org>
X-Mailer: Mew version 2.0 on Emacs 20.7 / Mule 4.0 (HANANOEN)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Reply-To: acpi-jp@jp.freebsd.org
Precedence: list
X-Distribute: distribute version 2.1 (Alpha) patchlevel 24e+010328
X-Sequence: acpi-jp 1332
Subject: [acpi-jp 1332] Re: acpica-unix-20010920 and porting to NetBSD 
Errors-To: owner-acpi-jp@jp.freebsd.org
Sender: owner-acpi-jp@jp.freebsd.org
X-Originator: iwasaki@jp.freebsd.org

Hi, mike.

> > > I've noticed that new ACPI CA snapshot, acpica-unix-20010929, have
> > > been released at:
> > > http://developer.intel.com/technology/iapc/acpi/downloads/acpica-unix-20010920.tar.gz
> > 
> > I'm having a very bad time making this code drop work.  It's pointed
> > out a bug in the acpi_pcib code (which should use acpi_DeviceIsPresent),
> > but worse than that, it doesn't seem to evaluate _CRS methods like the
> > old code did (I keep getting AE_TYPE).  Aside from that, the changes in
> > psparse.c mean that our old diff for the 'effective return value' doesn't
> > apply anymore. 8(
> 
> Actually, these problems are one and the same; the _CRS methods for
> the PCI Interrupt Link devices in the Tecra 8100 depend on implicit return
> working.
> 
> I tried to adapt the old patch to work with the new code, but I must have
> missed something, because it's not working. 8(
> 
> Andy & co. at Intel - could you please consider, again, supporting the 
> "implicit return" feature, even if you just make it a build-time option?
> 
> Too many systems out there depend on it for correct functioning. 8(

OK, I've just made the revised patch against psparse.c.  Could you try it?

Thanks

--- psparse.c-	Thu Oct  4 11:58:13 2001
+++ psparse.c	Thu Oct  4 13:31:26 2001
@@ -1164,6 +1164,9 @@
     ACPI_WALK_LIST          WalkList;
     ACPI_WALK_LIST          *PrevWalkList = AcpiGbl_CurrentWalkList;
     ACPI_WALK_STATE         *PreviousWalkState;
+    ACPI_OPERAND_OBJECT     **CallerReturnDesc = WalkState->CallerReturnDesc;
+    ACPI_OPERAND_OBJECT     *EffectiveReturnDesc = NULL;
+
 
 
     FUNCTION_TRACE ("PsParseAml");
@@ -1232,6 +1235,15 @@
 
         WalkState = AcpiDsPopWalkState (&WalkList);
 
+        /* Save the last effective return value */
+
+        if (CallerReturnDesc && WalkState->ReturnDesc)
+        {
+            AcpiUtRemoveReference (EffectiveReturnDesc);
+            EffectiveReturnDesc = WalkState->ReturnDesc;
+            AcpiUtAddReference (EffectiveReturnDesc);
+        }
+
         /* Reset the current scope to the beginning of scope stack */
 
         AcpiDsScopeStackClear (WalkState);
@@ -1278,6 +1290,17 @@
          */
         else if (PreviousWalkState->CallerReturnDesc)
         {
+            /*
+             * Some AML code expects return value w/o ReturnOp.
+             * Return the saved effective return value instead.
+             */
+
+            if (PreviousWalkState->ReturnDesc == NULL && EffectiveReturnDesc != NULL)
+            {
+                PreviousWalkState->ReturnDesc = EffectiveReturnDesc;
+                AcpiUtAddReference (PreviousWalkState->ReturnDesc);
+            }
+
             *(PreviousWalkState->CallerReturnDesc) = PreviousWalkState->ReturnDesc; /* NULL if no return value */
         }
 
@@ -1294,6 +1317,7 @@
 
     /* Normal exit */
 
+    AcpiUtRemoveReference (EffectiveReturnDesc);
     AcpiExReleaseAllMutexes ((ACPI_OPERAND_OBJECT *) &WalkList.AcquiredMutexList);
     AcpiGbl_CurrentWalkList = PrevWalkList;
     return_ACPI_STATUS (Status);
