From owner-acpi-jp@jp.FreeBSD.org Sun Jul 20 12:02:45 2003
Received: (from daemon@localhost)
	by castle.jp.FreeBSD.org (8.11.6p2+3.4W/8.11.3) id h6K32j684194;
	Sun, 20 Jul 2003 12:02:45 +0900 (JST)
	(envelope-from owner-acpi-jp@jp.FreeBSD.org)
Received: from sana.init-main.com (104.194.138.210.bn.2iij.net [210.138.194.104])
	by castle.jp.FreeBSD.org (8.11.6p2+3.4W/8.11.3) with ESMTP/inet id h6K32iT84189
	for <acpi-jp@jp.freebsd.org>; Sun, 20 Jul 2003 12:02:44 +0900 (JST)
	(envelope-from takawata@init-main.com)
Received: from init-main.com (localhost [127.0.0.1])
	by sana.init-main.com (8.12.9/8.12.9) with ESMTP id h6K2wRNl090072;
	Sun, 20 Jul 2003 11:58:28 +0900 (JST)
	(envelope-from takawata@init-main.com)
Message-Id: <200307200258.h6K2wRNl090072@sana.init-main.com>
To: Nate Lawson <njl@freebsd.org>
Cc: acpi-jp@jp.FreeBSD.org
In-reply-to: Your message of "Sat, 19 Jul 2003 17:48:38 MST."
             <200307200048.h6K0mcqj071205@repoman.freebsd.org>
From: Takanori Watanabe <takawata@init-main.com>
Reply-To: acpi-jp@jp.FreeBSD.org
Precedence: list
Date: Sun, 20 Jul 2003 11:58:27 +0900
X-Sequence: acpi-jp 2474
Subject: [acpi-jp 2474] Re: cvs commit: src/sys/dev/acpica acpi.c acpi_ec.c acpivar.h
Sender: owner-acpi-jp@jp.FreeBSD.org
X-Originator: takawata@init-main.com
X-Distribute: distribute version 2.1 (Alpha) patchlevel 24e+030702

In message <200307200048.h6K0mcqj071205@repoman.freebsd.org>, Nate Lawson wrote:
>njl         2003/07/19 17:48:38 PDT
>
>  FreeBSD src repository
>
>  Modified files:
>    sys/dev/acpica       acpi.c acpi_ec.c acpivar.h 
>  Log:
>  Add ECDT (ACPI 2.0) support.  This allows the EC to be enabled before the
>  namespace has been evaluated.  Machines with ACPI 2.0 expect this behavior
>  and have AML which calls EC functions early in the boot process.  If the
>  ECDT is not available, fall back to original probe behavior.


 static int
 acpi_ec_probe(device_t dev)
 {
-    int ret = ENXIO;
+    ACPI_HANDLE h;
+    ACPI_STATUS status;
+    device_t	peer;
+    char	desc[64];
+    int		magic, uid, glk, gpebit, ret = ENXIO;
+
+    /* Check that this is an EC device and it's not disabled. */
+    if (acpi_get_type(dev) != ACPI_TYPE_DEVICE || acpi_disabled("ec") ||
+	!acpi_MatchHid(dev, "PNP0C09")) {
+	return (ENXIO);
+    }
 
-    if (acpi_get_type(dev) == ACPI_TYPE_DEVICE && !acpi_disabled("ec") &&
-	acpi_MatchHid(dev, "PNP0C09")) {
+    /*
+     * If probed via ECDT, set description and continue.  Otherwise,
+     * we can access the namespace and make sure this is not a
+     * duplicate probe.
+     */
+    magic = acpi_get_magic(dev);
+    if ((magic & DEV_ECDT_FLAG) != 0) {
+	snprintf(desc, sizeof(desc), "embedded controller: ECDT, GPE %#x, GLK",
+		 DEV_GET_GPEBIT(magic));
+	device_set_desc_copy(dev, desc);
+	ret = 0;
+    } else {
+	h = acpi_get_handle(dev);

Calling  acpi_MatchHid() in ECDT probe may cause problem 
because this call AcpiGetObject which implies _HID and _STA
evaluation. This problem is also contained in my patch
you based on.

