Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 22 Apr 1995 12:55:20 -0700 (PDT)
From:      Poul-Henning Kamp <phk@ref.tfs.com>
To:        hackers@FreeBSD.org
Subject:   wd0, an enlightning tale...
Message-ID:  <199504221955.MAA24000@ref.tfs.com>

next in thread | raw e-mail | index | archive | help
This is a story from which wisdom may be gained.

I have a Gateway-2000 Handbook 486.  I have had it for a year actually,
and no problems.  All the power-save/resume features worked like a charm.
I got these "extra interrupt" messages when the disk went to sleep, but
I could live with those, after all, it worked.

But the 130Mb disk was a bit confined for my taste, so I finally bought
a 720Mb disk for it.

Now, I knew from other users of this machine, and from my own BIOS
disassembly that it didn't like big disks, but I figured "Hey, FreeBSD 
can cope with a stupid bios" and went ahead.  The drive says 1400/16/63,
but the bios says 1023/15/63, but I don't care, because FreeBSD listens
to the drive...

Well there's this snag:

When the BIOS puts the disk to sleep I get the "extra interrupt", fine,
but when I try to access the disk next time, the BIOS intercepts the
outb(), starts the disk and initializes the geometry before my outb()
goes ahead.  That means that the first read after the disk comes alive
is botched, because it is being read with a different geometry.

Can you spell "panic" ?

Now, time for the ATA-spec.  Hmmm, sleep mode... ah! here:

	"For devices that implement the Power Management features, the 
	contents of the Status register and all other Command Block 
	registers are not valid while a device is in the Sleep mode."

So how can you tell if a disk is sleeping ?   

Answer: You can't !

So presently I have a couple of hacks working:  

	"If the disk is busy when entering "wdcommand" then reinitialize 
	it, because it is probably comming out of sleep mode with the 
	wrong geometry."

and

	"If we get an extra interrupt and the status reg is 0x7f, the disk
	probably was put to sleep behind our back"

	
Now, if you enable other modes on your drive you need something similar,
because the drive is likely to loose those settings (caches, multi-block
&c &c) when it is sleeping, and we have presently no reliable way to
tell that the drive has slept :-(

foo...

Anybody else seen problems like this ?

I'll probably make a gross #ifdef'ed hack later today...

-- 
Poul-Henning Kamp <phk@login.dknet.dk> -- TRW Financial Systems, Inc.
'All relevant people are pertinent' && 'All rude people are impertinent'
=> 'no rude people are relevant'



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199504221955.MAA24000>