From owner-acpi-jp@jp.freebsd.org  Wed Mar 21 08:49:21 2001
Received: (from daemon@localhost)
	by castle.jp.freebsd.org (8.9.3+3.2W/8.7.3) id IAA19155;
	Wed, 21 Mar 2001 08:49:21 +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 IAA19148;
	Wed, 21 Mar 2001 08:49:19 +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 f2KNmPG10044;
	Tue, 20 Mar 2001 15:48:25 -0800 (PST)
	(envelope-from jhb@FreeBSD.org)
Message-ID: <XFMail.010320154820.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: <20010320223051F.iwasaki@jp.FreeBSD.org>
Date: Tue, 20 Mar 2001 15:48:20 -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 1107
Subject: [acpi-jp 1107] 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 20-Mar-01 Mitsuru IWASAKI wrote:
> Hi, I've found new Intel ACPICA acpica-unix-20010313.tar.gz and
> made patches for FreeBSD.

[ snip ]

> Index: dev/acpica/Osd/OsdSchedule.c
> ===================================================================
> RCS file: /home/ncvs/src/sys/dev/acpica/Osd/OsdSchedule.c,v
> retrieving revision 1.7
> diff -u -r1.7 OsdSchedule.c
> --- dev/acpica/Osd/OsdSchedule.c      2001/02/12 00:20:04     1.7
> +++ dev/acpica/Osd/OsdSchedule.c      2001/03/20 12:52:11
> @@ -35,10 +35,11 @@
>  
>  #include <sys/kernel.h>
>  #include <sys/malloc.h>
> +#include <sys/proc.h>
>  #include <sys/taskqueue.h>
>  #include <machine/clock.h>
>  
> -#define _COMPONENT   OS_DEPENDENT
> +#define _COMPONENT   ACPI_OS_SERVICES
>  MODULE_NAME("SCHEDULE")
>  
>  /*
> @@ -58,6 +59,18 @@
>      OSD_EXECUTION_CALLBACK   at_function;
>      void                     *at_context;
>  };
> +
> +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.
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:

UINT32
AcpiOsGetThreadId(void)
{

        FUNCTION_TRACE(__func__);

        KASSERT(curproc != NULL, (__func__ ": curproc is NULL!"));
        return (curproc->p_pid);
}

Note that __func__ is C99, but __FUNCTION__ is not.  Even though __FILE__ and
__LINE__ are in ISO C.  C standards people can be dumb sometimes.

-- 

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/
