From owner-acpi-jp@jp.freebsd.org  Wed Aug  8 19:08:39 2001
Received: (from daemon@localhost)
	by castle.jp.freebsd.org (8.9.3+3.2W/8.7.3) id TAA48540;
	Wed, 8 Aug 2001 19:08:39 +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 TAA48535
	for <acpi-jp@jp.freebsd.org>; Wed, 8 Aug 2001 19:08:38 +0900 (JST)
	(envelope-from msmith@mass.dis.org)
Received: from mass.dis.org (localhost [127.0.0.1])
	by mass.dis.org (8.11.4/8.11.3) with ESMTP id f78ABeZ02383
	for <acpi-jp@jp.freebsd.org>; Wed, 8 Aug 2001 03:11:40 -0700 (PDT)
	(envelope-from msmith@mass.dis.org)
Message-Id: <200108081011.f78ABeZ02383@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 "Wed, 08 Aug 2001 01:19:12 +0900."
             <20010808011912H.iwasaki@jp.FreeBSD.org> 
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Date: Wed, 08 Aug 2001 03:11:39 -0700
From: Mike Smith <msmith@freebsd.org>
Reply-To: acpi-jp@jp.freebsd.org
Precedence: list
X-Distribute: distribute version 2.1 (Alpha) patchlevel 24e+010328
X-Sequence: acpi-jp 1218
Subject: [acpi-jp 1218] Re: ACPICA 20010717: S1 causes power-off 
Errors-To: owner-acpi-jp@jp.freebsd.org
Sender: owner-acpi-jp@jp.freebsd.org
X-Originator: msmith@freebsd.org

> # Cc trimed
> 
> sorry for my late reply...

Never a problem. 8)

> > working on my test system (does anyone have fans that the thermal code is 
> > switching correctly?), so not quite yet. 8)
> 
> One of my laptops needs this patch.

This is no good; my logic is wrong.  It is OK to not have _PR3/_PS3 if we 
have _PR0 - we can turn off the resources listed in _PR0 to go to D3.

I think something like:

     if ((reslist_handle == NULL) && (method_handle == NULL)) {
         if (state == ACPI_STATE_D0) {
             pc->ac_state = ACPI_STATE_D0;
             return_ACPI_STATUS(AE_OK);
         }
     if ((state != ACPI_STATE_D3) ||
         (TAILQ_FIRST(&pc->ac_references) != NULL)) {
         DEBUG_PRINT(TRACE_OBJECTS, ("attempt to set unsupported state D%d\n", 
                                     state));
         return_ACPI_STATUS(AE_BAD_PARAMETER);
     }

This still isn't perfect, as it will fail if the device is already off.
Better code would check for _PR0 rather than looking at the head of the
references list.  If you could, I'd prefer you to commit something that 
did that...

Regards,
Mike


> Index: acpi_powerres.c
> ===================================================================
> RCS file: /home/ncvs/src/sys/dev/acpica/acpi_powerres.c,v
> retrieving revision 1.5
> diff -u -r1.5 acpi_powerres.c
> --- acpi_powerres.c	2001/07/21 10:24:32	1.5
> +++ acpi_powerres.c	2001/08/07 16:15:41
> @@ -366,7 +366,6 @@
>  	}
>  	DEBUG_PRINT(TRACE_OBJECTS, ("attempt to set unsupported state D%d\n", 
>  				    state));
> -	return_ACPI_STATUS(AE_BAD_PARAMETER);
>      }
>  
>      /*
> 
> 
> Its fan device don't have _PR3 and _PS3 so the fan is on all the time.
> 
>     PowerResource(QFAN, 0, 0) {
> 	...
>     }
>     Device(FAN_) {
>         Name(_HID, 0x0b0cd041)
>         Name(_UID, 0x1)
>         Name(_PR0, Package(0x1) {
>             QFAN,
>         })
>     }
> 
> I'll commit this weekend if no objections.
> 
> Thanks

-- 
... 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


