From owner-freebsd-mobile@FreeBSD.ORG Sat Apr 12 16:11:45 2003 Return-Path: Delivered-To: freebsd-mobile@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1DEFF37B401 for ; Sat, 12 Apr 2003 16:11:45 -0700 (PDT) Received: from pimout1-ext.prodigy.net (pimout1-ext.prodigy.net [207.115.63.77]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4B28843FBF for ; Sat, 12 Apr 2003 16:11:44 -0700 (PDT) (envelope-from metrol@metrol.net) Received: from metlap (adsl-67-121-60-9.dsl.anhm01.pacbell.net [67.121.60.9]) h3CNBgYD283466; Sat, 12 Apr 2003 19:11:42 -0400 From: Michael Collette To: "Cliff L. Biffle" Date: Sat, 12 Apr 2003 16:11:27 -0700 User-Agent: KMail/1.5.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200304121611.27924.metrol@metrol.net> cc: FreeBSD Mailing Lists Subject: Re: [PATCH] ATA disk spin-down for -current X-BeenThere: freebsd-mobile@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Mobile computing with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Apr 2003 23:11:45 -0000 I was thinking my suspend mode problems on my Thinkpad T23 were behind me here on FreeBSD 4.8. Been going weeks without having a glitch, then just last night... Put my lappy into suspend mode. Unplugged my cabling to take it into the other room to read some PDF's I had just downloaded. Opened the lid, and it glitched on me. I should note that I was going from being plugged in to operating on battery. I never do see anything in any of the logs. When it glitches I see my KDE desktop for about 30 seconds totally frozen. Then this thing just does a hard reboot on its own. Tons of fsck fun on the following boot. Unfortunately this is extremely difficult to reproduce. I don't know what kind of impact your patch will have on 5-CURRENT, but it would appear that under 4-STABLE there is still a problem here. Later on, Cliff L. Biffle wrote: > Allo all. I've ported the 4.x patch that enabled ATA disk spin-down to > the > 5.x kernel. (It looks like it'd also work on recent 4.x.) Since I got > the original patch out of this list's archives, I thought I'd send it > back. > > Basically this just updates the ata_command calls to the new LBA format > rather than the older C/H/S. > > I'm relatively unfamiliar with the ATA subsystem, and I -think- putting > the > suspend call after ATA_UNLOCK_CH is correct. If anyone knows better, let > me know. > > Anyway, I've been using this on my laptop with great success. Suspend > time is set (in seconds) in hw.ata.suspend; this must be done at boot in > loader.conf, as it's read-only at runtime. > > Comments? Corrections? > > -Cliff L. Biffle > > --- src/sys/dev/ata/ata-disk.c.orig Fri Apr 11 12:50:37 2003 > +++ src/sys/dev/ata/ata-disk.c Fri Apr 11 13:05:54 2003 > @@ -70,9 +70,11 @@ > static int ata_dma = 1; > static int ata_wc = 1; > static int ata_tags = 0; > +static int ata_suspend = 0; > TUNABLE_INT("hw.ata.ata_dma", &ata_dma); > TUNABLE_INT("hw.ata.wc", &ata_wc); > TUNABLE_INT("hw.ata.tags", &ata_tags); > +TUNABLE_INT("hw.ata.suspend", &ata_suspend); > static MALLOC_DEFINE(M_AD, "AD driver", "ATA disk driver"); > > /* sysctl vars */ > @@ -83,6 +85,8 @@ > "ATA disk write caching"); > SYSCTL_INT(_hw_ata, OID_AUTO, tags, CTLFLAG_RD, &ata_tags, 0, > "ATA disk tagged queuing support"); > +SYSCTL_INT(_hw_ata, OID_AUTO, suspend, CTLFLAG_RD, &ata_suspend, 0, > + "ATA disk suspend timer"); > > void > ad_attach(struct ata_device *atadev) > @@ -185,6 +189,12 @@ > #endif > ATA_UNLOCK_CH(atadev->channel); > > + if(ata_suspend > 0) { > + /* attempt suspend mode. The drive uses increments of ten seconds */ > + if(ata_command(atadev, 0xe2, 0, ata_suspend/10, 0, ATA_WAIT_INTR)) > + ata_prtdev(atadev, "suspend mode failed."); > + } > + > adp->disk.d_open = adopen; > adp->disk.d_close = adclose; > adp->disk.d_strategy = adstrategy; > @@ -856,6 +866,11 @@ > ata_command(atadev, ATA_C_SET_MULTI, 0, > adp->transfersize / DEV_BSIZE, 0, ATA_WAIT_READY); > atadev->setmode(atadev, adp->device->mode); > + if(ata_suspend > 0) { > + /* attempt suspend mode. The drive uses increments of ten seconds */ > + if(ata_command(atadev, 0xe2, 0, ata_suspend/10, 0, ATA_WAIT_READY)) > + ata_prtdev(atadev, "suspend mode failed."); > + } > } > > void > > _______________________________________________ > freebsd-mobile@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-mobile > To unsubscribe, send any mail to "freebsd-mobile-unsubscribe@freebsd.org" -- "Outside of a dog, a book is man's best friend. Inside of a dog, it's too dark to read." - Groucho Marx