summaryrefslogtreecommitdiff
path: root/sys/dev/ata/wd.c
AgeCommit message (Collapse)Author
2010-07-23Manuel Bouyer rescinded clauses 3 and 4 of his license text.Jonathan Gray
2010-07-22Give the drive a little bit more time to complete the STANDBY IMMED command.Mark Kettenis
The ATA spec seems to suggest it may take up to 30s. This seems a little bit long. To quote Theo: "by that time some drives have probably parked their own heads in boredom". But it shouldn't hurt unless your drive is seriously broken. Makes some laptops suspend much better. ok deraadt@
2010-07-22First part of better pciide resume. Wake the channel by performing twoMike Larkin
resets separated by a small delay (a delay intended to offend jsg who will definitely want to fix it by checking for RDY instead) Tested on a variety of amd and i386 hardware by myself and deraadt@ ok deraadt
2010-06-28Move disk_attach() to the end of the attach functions, at which point theJoel Sing
disk is now ready to handle I/O. ok krw@ dlg@
2010-06-07partial backout of 1.81 as invoking standby in shutdownJonathan Gray
breaks at least socppc and armish
2010-05-26Reintroduce bufqs. A few changes since it was backed out after some goodThordur I. Bjornsson
comments from dlg@. No need for a separate bufq.h, keep all of in buf.h; As requested by kittens and deraadt. Only sd(4) and wd(4) for now. The rest of the drivers will be converted soon, also other goodies like heuristics for sd(4) for selecting the bufq type and the death of disksort() are forthcoming. Tested on: i386, amd64, sparc64, macppc, loongson and alpha by myself and phessler. OK art@, beck@, kettenis@, oga@
2010-05-24Flush cache before suspend.Mark Kettenis
ok krw@, marco@
2010-05-23Place drive in standby mode before shutdown. Avoids the loud click heard onMark Kettenis
many laptops when powering them down. ok jsg@, oga@, krw@
2010-05-18dont let sys/ioctl.h imply that you get the ioctls in dkio.h. thisDavid Gwynne
gets rid of #include <sys/dkio.h> in sys/ioctl.h and adds #include <sys/dkio.h> to the places that actually want and use the disk ioctls. this became an issue when krw@'s X build failed when he was testing a change to dkio.h. tested by krw@ help from and ok miod@
2010-04-23Recycle unused disklabel fields in order to create a disklabel uniqueJoel Sing
identifier, allowing the disk to be identified without relying on the device name. ok deraadt@ krw@ beck@ marco@ todd@
2010-04-11Send "STANDBY IMMEDIATE" command to ATA disks upon suspend. For this to work,Mark Kettenis
pciide(4) needs to formward DVACT_SUSPEND and DVACT_RESUME events to its children, so do that. Gets rid of the nasty "click" sound from the disk on many laptops. ok marco@, jsg@
2009-10-13Get rid of devact enum, substitute it with an int and coresponding defines.Paul Irofti
This is needed for the addition of further suspend/resume actions. Okay deraadt@, marco@.
2009-08-13Replace the error strings that were being passed around with much simplerTheo de Raadt
errnos. Note that the error strings are being ignored, since we long ago decided to not spam the console, and there is no other nice way to use the errors (without changing the ioctls to pass it back) The errno is now useful, since we can pass b_error from failing IO up, and the drive can decide how to use that ok miod
2009-06-17Revert bufq's. this is inline with the major midlayer reverts thatThordur I. Bjornsson
have been going on. this appears to bring us back to stable state. lots of testing by oga and ariane and my self.
2009-06-03add a flexible buffer queue (bufq) api, based on the never usedThordur I. Bjornsson
one by tedu@. It doesn't do anything smart yet, it just uses plain old disksort. we also keep the old method of queueing bufs since some miods have crazy MD drivers that need some love. ok beck@, art@ tested by many on many archs.
2008-11-08remove dead stores and newly created unused variables.Charles Longeau
Found by LLVM/Clang Static Analyzer. ok krw@
2008-09-10Convert timeout_add() calls using multiples of hz to timeout_add_sec()Bret Lambert
Really just the low-hanging fruit of (hopefully) forthcoming timeout conversions. ok art@, krw@
2008-06-27More removal of clauses 3 and 4 from NetBSD licenses.Ray Lai
OK deraadt@ and millert@
2008-06-15Don't bypass partition bounds check for RAW_PART. We now guarantee thatKenneth R Westerback
RAW_PART will always be 0 -> disksize, so the bounds check will always pass for i/o's to valid addresses. Now the i/o will be properly truncated if it goes past the end of the device. This prevents various adverse impacts of issuing i/o's for data past the end of the device. Repeatedly requested by todd@. ok weingart@ deraadt@
2008-02-07enable DMA for 1-sector devices (i.e. most flash devices).Stuart Henderson
from NetBSD ok krw thib henning, tested by many
2007-12-05Switch set features commands to use wdc_exec_command() to allowJonathan Gray
them to be properly polled. Fixes previously problematic machines of form and ckuethe. ok marco@
2007-11-26Enable read ahead and write cache enable if supported byJonathan Gray
the disk rather than depending on the disk to have it on. A bunch of people have suggested this should go in.
2007-06-20b_cylinder does not need to be set on the callpath down into drivers.Theo de Raadt
cpu_disklabel can go away, since nothing anymore needs to use it; ok miod
2007-06-18avoid modification race in DIOCRLDINFO; ok krw miodTheo de Raadt
2007-06-08all drivers should spoof version 1 labelsTheo de Raadt
2007-06-07strncpy -> strlcpy, plus a little spacing line up.Ray Lai
OK deraadt.
2007-06-06now that all partition size/offsets are potentially 64-bit, change theTheo de Raadt
type of all variables to daddr64_t. this includes the APIs for XXsize() and XXdump(), all range checks inside bio drivers, internal variables for disklabel handling, and even uvm's swap offsets. re-read numerous times by otto, miod, krw, thib to look for errors
2007-06-05use six new macros to access & store the 48-bit disklabel fields relatedTheo de Raadt
to size. tested on almost all machines, double checked by miod and krw next comes the type handling surrounding these values
2007-06-01Don't initialize d_partitions[RAW_DISK] just before callingKenneth R Westerback
readdisklabel(), since all readdisklabel()'s do that already. ok deraadt@
2007-05-31Kill old, no longer necessary kludge to try fooling readdisklabel()Kenneth R Westerback
into using DOS geometry by calling it twice. And don't ignore the drive state if readdisklabel() returns a non-NULL value. ok weingart@ grange@
2007-04-28Fix comments above DISKMINOR uses. DISKMINOR provides minor not majorKenneth R Westerback
number (wd.c), and the uses are to find the minimum minor to be detached.
2007-04-27Nuke WDUNIT/WDPART/etc. defines and just use standard DISKUNIT/DISKPART/etc.Kenneth R Westerback
ones. No change to wd.o. ok deraadt@ marco@
2007-04-26Eliminate CPU_BIOS from userland and wd(4) by always using the BIOSKenneth R Westerback
geometry in the disklabel when there is a BIOS geometry to provide. This removes the option to set a disklabel to 'BIOS' geometry via the 'g b' command in the editor. Makes reported geometry more consistant and moves MD code to MD land where it should be. Doc help from jmc@, Feedback from millert@, marco@, weingart@, kettenis@. ok deraadt@
2007-03-27OK, I understand why jsg wanted the disk_unbusy() in wdretry(), and heTheo de Raadt
was right. There is another path that ends up avoiding the disk_unbusy call I inserted.... tested by robert too
2007-03-25wdc retries (including after suspends) caused a disk to remain busy whenTheo de Raadt
it should not; ok dlg problem spotted using zaurus soft-drive-led diff which is pending i think i convinced jsg now that this fix is better than putting it in wdrestart
2007-02-15Don't print the error strings returned by readdisklabel(). If youKenneth R Westerback
need the debug info uncomment the printf's you need. Crude but effective way to suppress 'no disklabel' errors that pop up at the most innconvenient times to frighten users. More elegant method, DPRINTF-like constructs or something, later. "Yay!" marco@ ok deraadt@
2007-02-06De-register. No object code change.Kenneth R Westerback
From Bret Lambert.
2006-10-17For non-CPU_BIOS architectures calculate the number of cylinders onKenneth R Westerback
a disk rather than accepting the cylinder count provided by the disk or controller. This cylinder count will be '16383' for any disk >8.4G according to the ATA spec. CPU_BIOS on i386/amd64 has magic to deal with this, but other archs do not need to be restricted by the needs of PC BIOS. Fixes the default MBR OpenBSD partition size and disklabel on non-CPU_BIOS archtitectures. No change to behaviour on i386/amd64 machines. Noted by Stuart Henderson on his Thecus. Testing by various, including 'old i386 machines' nick@ ok tom@ pedro@ weingart@ deraadt@
2006-10-04Zap bad144 bad sector info in disklabels. Sparsely used if at all forKenneth R Westerback
a few obsolete and easily replaced disk models. And didn't work anyway according to Bob, who has tried. ok beck@
2006-08-21Delete #ifdef/#ifndef __OpenBSD__ chunks, leaving just the code weKenneth R Westerback
use. Easier to read and eliminates a potentially confusing unused call to wdgetdisklabel(). No change to object files. ok brad@ dlg@ grange@ deraadt@ marco@
2006-08-12Setting d_secsize to DEV_BSIZE (or 1 << DEV_BSHIFT, or 512) and thenKenneth R Westerback
setting RAW_PART's p_size to d_secperunit * (d_secsize / DEV_BSIZE) is a waste of a few ops. And p_size should be in sectors anyway. Just set RAW_PART's p_size to d_secperunit to make usage consistant across the tree. Should be a no-op.
2006-03-05Remove more NRND NetBSDisms.Kenneth R Westerback
ok marco@
2006-01-21Invoke disk_detach() and related cleanup work in detach(), rather thanMiod Vallat
zeroref() - just to be on the safe side, should we mess up our ref count.
2005-11-09Don't fall back to fake geometry if ata_get_params() fails.Uwe Stuehler
"looks sane" grange@; tested by niall@ krw@ jmc@ jolan@
2005-09-01On zaurus, don't fall back to fake geometry if ata_get_params() fails,Uwe Stuehler
which can happen if the integrated microdrive's DRQ is not clear. This fixes the drive geometry in the default disklabel. Help from weingart@ and grange@; "mention `grange and i will fix this better after 3.8 or we will be flailed'" deraadt@
2005-08-27Use the ATA security FREEZE LOCK command on disks beforeJonathan Gray
they are presented to the rest of the system to stop a password being set that could deny access to the disk. ok grange@ deraadt@
2005-05-15Use FLUSHCACHE EXT instead of FLUSHCACHE for LBA48 operations.Alexander Yurchenko
First noticed by christos@netbsd (iirc) a long time ago. Tested by canacar@ and krw@.
2004-07-06Replace magic number with a more descriptive #define. This magic number wasAaron Campbell
particularly vile because it looks like a typo (i.e., looks like one "f" is missing), but it's really not. I happened to notice this myself, but the fix is inspired by NetBSD in the interest of keeping the code similar. deraadt@ ok
2004-03-03remove bufq support until i figure out just what's going wrong. ok deraadt@Ted Unangst
2004-02-15new arg to disk_unbusy, to record separate read/write statistics.Ted Unangst
looked at by various, testing henning@ mcbride@ dan weeks mostly from netbsd via Pedro Martelletto <pbastos@rdc.puc-rio.br>