From owner-acpi-jp@jp.freebsd.org  Thu Mar 22 04:25:28 2001
Received: (from daemon@localhost)
	by castle.jp.freebsd.org (8.9.3+3.2W/8.7.3) id EAA02081;
	Thu, 22 Mar 2001 04:25:28 +0900 (JST)
	(envelope-from owner-acpi-jp@jp.FreeBSD.org)
Received: from meow.osd.bsdi.com (meow.osd.bsdi.com [204.216.28.88])
	by castle.jp.freebsd.org (8.9.3+3.2W/8.7.3) with ESMTP id EAA02075;
	Thu, 22 Mar 2001 04:25:24 +0900 (JST)
	(envelope-from jhb@FreeBSD.org)
Received: from laptop.baldwin.cx (john@jhb-laptop.osd.bsdi.com [204.216.28.241])
	by meow.osd.bsdi.com (8.11.2/8.11.2) with ESMTP id f2LJOgG40372;
	Wed, 21 Mar 2001 11:24:43 -0800 (PST)
	(envelope-from jhb@FreeBSD.org)
Message-ID: <XFMail.010321112415.jhb@FreeBSD.org>
X-Mailer: XFMail 1.4.0 on FreeBSD
X-Priority: 3 (Normal)
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 8bit
MIME-Version: 1.0
In-Reply-To: <20010321132325E.iwasaki@jp.FreeBSD.org>
Date: Wed, 21 Mar 2001 11:24:15 -0800 (PST)
From: John Baldwin <jhb@FreeBSD.org>
To: Mitsuru IWASAKI <iwasaki@jp.FreeBSD.org>
Cc: acpi-jp@jp.FreeBSD.org
Reply-To: acpi-jp@jp.freebsd.org
Precedence: list
X-Distribute: distribute version 2.1 (Alpha) patchlevel 24e+000315
X-Sequence: acpi-jp 1111
Subject: [acpi-jp 1111] Re: acpica-unix-20010313.tar.gz
Errors-To: owner-acpi-jp@jp.freebsd.org
Sender: owner-acpi-jp@jp.freebsd.org
X-Originator: jhb@FreeBSD.org


On 21-Mar-01 Mitsuru IWASAKI wrote:
> Hi, John.
> 
>> > +UINT32
>> > +AcpiOsGetThreadId(void)
>> > +{
>> > +    FUNCTION_TRACE(__FUNCTION__);
>> > +
>> > +    if (curproc) {
>> > +     return((curproc->p_pid) ? curproc->p_pid : 1);
>> > +    }
>> > +
>> > +    return(1);
>> > +}
>> 
>> curproc should never be NULL.  I would rather you use a KASSERT() to panic
>> if
>> it is.  We set curproc in the MD startup code before any MI code is called
>> now.
> 
> OK.
> 
>> Even if it were NULL, then the proper value to return would be 0, not 1, as
>> the
>> pid of proc0 is 0.  This should probably look something like this:
> 
> No, we can't return 0 here otherwise acpi_pcib0 and some other devices
> won't be probed.  In newer AcpiCmAcquireMutex(), you would see the
> following.

Grrrrr, then the ACPI code should use a OS dependent constant not 0 for
unowned.  UNIX has used 0 as a valid process identifier for quite some time.
*sigh*

Well, why not recturn curproc->p_pid + 1?  That way each process still has a
unique thread id.  Then again, I'm not sure swapper (pid 0) will be doing
anything with ACPI after booting, and I'm not sure init will ever do anything
with ACPI either.

-- 

John Baldwin <jhb@FreeBSD.org> -- http://www.FreeBSD.org/~jhb/
PGP Key: http://www.baldwin.cx/~john/pgpkey.asc
"Power Users Use the Power to Serve!"  -  http://www.FreeBSD.org/
