From owner-acpi-jp@jp.freebsd.org  Thu Feb  1 05:07:41 2001
Received: (from daemon@localhost)
	by castle.jp.freebsd.org (8.9.3+3.2W/8.7.3) id FAA01128;
	Thu, 1 Feb 2001 05:07:41 +0900 (JST)
	(envelope-from owner-acpi-jp@jp.FreeBSD.org)
Received: from mass.dis.org (mass.dis.org [216.240.45.41])
	by castle.jp.freebsd.org (8.9.3+3.2W/8.7.3) with ESMTP id FAA01121
	for <acpi-jp@jp.freebsd.org>; Thu, 1 Feb 2001 05:07:35 +0900 (JST)
	(envelope-from msmith@mass.dis.org)
Received: from mass.dis.org (localhost [127.0.0.1])
	by mass.dis.org (8.11.1/8.11.1) with ESMTP id f0VK85W00704
	for <acpi-jp@jp.freebsd.org>; Wed, 31 Jan 2001 12:08:05 -0800 (PST)
	(envelope-from msmith@mass.dis.org)
Message-Id: <200101312008.f0VK85W00704@mass.dis.org>
X-Mailer: exmh version 2.1.1 10/15/1999
To: acpi-jp@jp.freebsd.org
In-reply-to: Your message of "Thu, 01 Feb 2001 04:57:17 +0900."
             <200101311957.EAA26246@shidahara1.planet.sci.kobe-u.ac.jp> 
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Date: Wed, 31 Jan 2001 12:08:05 -0800
From: Mike Smith <msmith@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 1044
Subject: [acpi-jp 1044] Re: How acpi_parse_resources work? 
Errors-To: owner-acpi-jp@jp.freebsd.org
Sender: owner-acpi-jp@jp.freebsd.org
X-Originator: msmith@freebsd.org

> In acpi_parse_resources()@acpi_resource.c ,there is following line.
> 
>     if (((status = acpi_GetIntoBuffer(handle, AcpiGetPossibleResources, &buf)) != AE_OK) &&
>         ((status = acpi_GetIntoBuffer(handle, AcpiGetCurrentResources, &buf)) != AE_OK)) {
>         device_printf(dev, "can't fetch ACPI resources - %s\n", acpi_strerror(status));
>         return_ACPI_STATUS(status);
>     }
> 
> Is it okey to use same buffer to get Possible and Current resource?

This code will only fetch one set of resources; you may be confused by 
the rules relating to the use of &&.  (This one got me some years back.)

	if (!a && !b)
		return;

is equivalent to

	if (!a)
		if (!b)
			return;

so in the code above, if AcpiGetPossibleResources succeeds, we'll never 
call AcpiGetCurrentResources.

It's probably an error to do things like this though; we should probably 
call AcpiGetCurrentResources first, and only if the device is 
unconfigured actually attempt to configure it at all.

Regards,
Mike

-- 
... every activity meets with opposition, everyone who acts has his
rivals and unfortunately opponents also.  But not because people want
to be opponents, rather because the tasks and relationships force
people to take different points of view.  [Dr. Fritz Todt]
           V I C T O R Y   N O T   V E N G E A N C E


