If flag 0x4000 (Sleephack) is defined, assume that the disk is sleeping

if all registers are 0xff.

This allows me to run with flags 0xc0ff on my IBM-DMCA-21440 disk, which
gives 5MB/sec sequential read :-)

If you have a laptop, try adding flag 0x4000 to your disk, and tell me if
it makes any difference for you.
This commit is contained in:
Poul-Henning Kamp 1997-04-03 09:43:50 +00:00
parent 9751c10998
commit 8520e7cbc1

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)wd.c 7.2 (Berkeley) 5/9/91
* $Id: wd.c,v 1.126 1997/03/11 23:17:04 se Exp $
* $Id: wd.c,v 1.127 1997/03/24 11:24:12 bde Exp $
*/
/* TODO:
@ -1392,9 +1392,41 @@ wdcommand(struct disk *du, u_int cylinder, u_int head, u_int sector,
u_int wdc;
wdc = du->dk_port;
if (du->cfg_flags & WDOPT_SLEEPHACK)
if(inb(wdc + wd_status) == WDCS_BUSY)
if (du->cfg_flags & WDOPT_SLEEPHACK) {
/* OK, so the APM bios has put the disk into SLEEP mode,
* how can we tell ? Uhm, we can't. There is no
* standardized way of finding out, and the only way to
* wake it up is to reset it. Bummer.
*
* All the many and varied versions of the IDE/ATA standard
* explicitly tells us not to look at these registers if
* the disk is in SLEEP mode. Well, too bad really, we
* have to find out if it's in sleep mode before we can
* avoid reading the registers.
*
* I have reason to belive that most disks will return
* either 0xff or 0x00 in all but the status register
* when in SLEEP mode, but I have yet to see one return
* 0x00, so we don't check for that yet.
*
* The check for WDCS_BUSY is for the case where the
* bios spins up the disk for us, but doesn't initialize
* it correctly /phk
*/
if(inb(wdc + wd_precomp) + inb(wdc + wd_cyl_lo) +
inb(wdc + wd_cyl_hi) + inb(wdc + wd_sdh) +
inb(wdc + wd_sector) + inb(wdc + wd_seccnt) == 6 * 0xff) {
if (bootverbose)
printf("wd(%d,%d): disk aSLEEP\n",
du->dk_ctrlr, du->dk_unit);
wdunwedge(du);
} else if(inb(wdc + wd_status) == WDCS_BUSY) {
if (bootverbose)
printf("wd(%d,%d): disk is BUSY\n",
du->dk_ctrlr, du->dk_unit);
wdunwedge(du);
}
}
if (wdwait(du, 0, TIMEOUT) < 0)
return (1);