summaryrefslogtreecommitdiffstats
path: root/sys/i386
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>1997-04-03 09:43:50 +0000
committerphk <phk@FreeBSD.org>1997-04-03 09:43:50 +0000
commit73040a3470a6acc697f9dfe677374937f2a2ce92 (patch)
treec7682faf1a7fb633a32a7044a8c5a4f39c790e3d /sys/i386
parent1c6d34721a59e8d32758de9f806006a27c0cba1a (diff)
downloadFreeBSD-src-73040a3470a6acc697f9dfe677374937f2a2ce92.zip
FreeBSD-src-73040a3470a6acc697f9dfe677374937f2a2ce92.tar.gz
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.
Diffstat (limited to 'sys/i386')
-rw-r--r--sys/i386/isa/wd.c38
1 files changed, 35 insertions, 3 deletions
diff --git a/sys/i386/isa/wd.c b/sys/i386/isa/wd.c
index 3ce9fb5..401a35f 100644
--- a/sys/i386/isa/wd.c
+++ b/sys/i386/isa/wd.c
@@ -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);
OpenPOWER on IntegriCloud