From owner-freebsd-acpi@FreeBSD.ORG Mon Feb 13 18:52:21 2006 Return-Path: X-Original-To: freebsd-acpi@FreeBSD.org Delivered-To: freebsd-acpi@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id EC97E16A424 for ; Mon, 13 Feb 2006 18:52:20 +0000 (GMT) (envelope-from dthiele@gmx.net) Received: from mail.gmx.net (mail.gmx.net [213.165.64.21]) by mx1.FreeBSD.org (Postfix) with SMTP id 4ADCF43D86 for ; Mon, 13 Feb 2006 18:52:10 +0000 (GMT) (envelope-from dthiele@gmx.net) Received: (qmail invoked by alias); 13 Feb 2006 18:52:06 -0000 Received: from p54860059.dip0.t-ipconnect.de (EHLO [192.168.1.33]) [84.134.0.89] by mail.gmx.net (mp017) with SMTP; 13 Feb 2006 19:52:06 +0100 X-Authenticated: #19302822 Message-ID: <43F0D578.3040302@gmx.net> Date: Mon, 13 Feb 2006 19:52:40 +0100 From: Daniel Thiele User-Agent: Thunderbird 1.5 (X11/20060204) MIME-Version: 1.0 To: Daniel Thiele References: <43BA5E03.4080306@gmx.net> <43BA7167.2060500@inbox.ru> <43BA88F8.8040506@gmx.net> In-Reply-To: <43BA88F8.8040506@gmx.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 Cc: freebsd-acpi@FreeBSD.org Subject: Re: ACPI S3 and S5 Problem with HDD on ThinkPad R40 X-BeenThere: freebsd-acpi@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: ACPI and power management development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Feb 2006 18:52:21 -0000 Daniel Thiele wrote: > Rechistov Grigory wrote: >> I've heard about some commands (atacontrol ?) which allow to spin down >> hard drive, so maybe we should just put them in shutdown script? >> > > You can use ataidle (sysutils/ataidle) to put a HDD into idle or standby > mode, but putting that command into /etc/rc.shutdown will AFAIK not work > since /etc/rc.shutdown is called before the kernel syncs the disks at > the end of its shutdown process. So if you put them into standby mode > before they will spin up again for this final syncing. > > I do not know if it is possible and/or reasonable to do all the things > that ataidle does to put a HDD into standby mode somewhere after the > disks are synced in the shutdown and suspend actions the kernel does. Hi, I have a solution for the problem or at least for the S5 power off problem to be precise. I simply looked at the ataidle source code and added the standby part from ataidle to the ata driver's shutdown function. To do this just change ad_shutdown() in /usr/src/sys/dev/ata/ata-disk.c from this: static void ad_shutdown(device_t dev) { struct ata_device *atadev = device_get_softc(dev); if (atadev->param.support.command2 & ATA_SUPPORT_FLUSHCACHE) ata_controlcmd(dev, ATA_FLUSHCACHE, 0, 0, 0); } to this: static void ad_shutdown(device_t dev) { struct ata_device *atadev = device_get_softc(dev); if (atadev->param.support.command2 & ATA_SUPPORT_FLUSHCACHE) ata_controlcmd(dev, ATA_FLUSHCACHE, 0, 0, 0); if (atadev->param.support.command2 & ATA_SUPPORT_STANDBY) ata_controlcmd(dev, ATA_STANDBY_IMMEDIATE, 0, 0, 0); } The two extra lines should put the HDD in the "immediate standby" mode (if this mode is supported) which cause the drive to spin down before it's power is turned off during the shutdown procedure done when entering the S5 state. I hope this is the correct way to overcome this problem. At least it seems to run flawlessly since the past 5 weeks on both FreeBSD 6.0-STABLE and FreeBSD 6.1-PRERELEASE. Best regards Daniel Thiele