summaryrefslogtreecommitdiffstats
path: root/sys/dev/ata/wd.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* we've been using LBA48 for < 137GB drives for 17 years, so perhapstedu2020-01-231-2/+1
| | | | we can remove the XXX now.
* Use timeout_add_msec(9)kn2019-07-071-3/+4
| | | | | | | RECOVERYTIME is twice per second, so sleep for 500 milliseconds and reflect the unit to be clear. OK patrick
* Don't pull in <sys/file.h> just to get fcntl.hguenther2017-12-301-2/+2
| | | | ok deraadt@ krw@
* Repair flushcache/standby operations to not convert AT_WAIT operationsderaadt2017-12-141-12/+4
| | | | | to AT_POLL, which some chip driver underneath cannot handle. tested by bluhm also
* remove defines for ioctls the kernel doesn't recognisejsg2017-10-241-28/+1
| | | | ok mpi@
* Add an ioctl to tell storage devices to flush their internal cachessf2017-05-291-10/+26
| | | | | | | Currently implemented for wd and sd. Initially ported from netbsd by pedro@ ok deraadt@
* Also pass the blk offset to disk_unbusy(), so that it can pass it toderaadt2017-05-041-3/+3
| | | | | | the random subsystem as entropy. This value is pretty much unknown, and anyways our entropy input ring does not saturate from knowns. ok mikeb djm
* Set segflg member of uio struct with symbolic enum valuestefan2016-01-201-2/+2
| | | | | | | | instead of using magic numbers. No binary change. Diff from Martin Natano. ok deraadt@
* trivial size to free()deraadt2015-08-261-2/+2
|
* The 80's called and want their interface back. Remove last fragments ofkrw2015-08-171-3/+3
| | | | | | | | | ST-506 support. Remove redundant 'precomp' variables/fields and rename remaining few to 'features' to be consistant with the rest of the code. Consensus that no ST-506 disks (requiring ISA cards, <120MB, usually rife with bad sectors that can't be worked around) are still running OpenBSD.
* remove uneeded proc.h includesjsg2014-09-141-2/+2
| | | | ok mpi@ kspillner@
* add a size argument to free. will be used soon, but for now default to 0.tedu2014-07-121-2/+2
| | | | after discussions with beck deraadt kettenis.
* remove most of the boolean_t infection outside uvm/ddb/pmap; ok jsgderaadt2014-07-101-3/+1
|
* Use DL_SECTOBLK() instead of handrolling same calculation to getkrw2013-10-141-3/+4
| | | | wdsize() return value.
* XXsize() returns daddr_t, so calculate the return value in a daddr_tkrw2013-10-141-2/+2
| | | | | | variable and not (usually) an int. ok miod@
* Try harder to ensure wddump() doesn't decrement the countkrw2013-09-271-6/+7
| | | | | of sectors to write by one value and increment the address the next i/o will start at by a different amount.
* Make it clearer that sc_wdc_bio.blkno is actuall a disk hardwarekrw2013-09-151-8/+9
| | | | | | | | address by using the DL_BLKTOSEC() and DL_SECTOBLK() defines rather than handrolling the equivalent. Fixes current addition of a 512-byte block value (b_blkno) to a disk hardware address (DL_GETPOFFSET()). Tested on real wd(4) hardware by guenther@.
* final removal of daddr64_t. daddr_t has been 64 bit for a long enoughderaadt2013-06-111-4/+4
| | | | | test period; i think 3 years ago the last bugs fell out. ok otto beck others
* Revamp the sequences for suspend/hibernate -> resume so that the codederaadt2012-10-081-21/+5
| | | | | | | | | | paths are reflexive. It is now possible to fail part-way through a suspend sequence, and recover along the resume code path. Split DVACT_SUSPEND by adding a new DVACT_POWERDOWN method is used after hibernate (and suspend too) to finish the job. Some drivers must be converted at the same time to use this instead of shutdown hooks (the others will follow at a later time) ok kettenis mlarkin
* Eliminate redundant buf validation checks in xxstrategy() methods nowmatthew2011-07-061-20/+12
| | | | | | | | | | | | that they're implemented consistently in bounds_check_with_label(). Also, per krw's request, change bounds_check_with_label() to return 0 if the checks succeed, and change the drivers to test == -1 instead of <= 0. (Man page update to follow; intentionally omitting arch/vax/mba/hp.c from this commit because it doesn't even build currently and miod@ promises to kill it soon.) ok krw@
* Refactor some common open/close/detach disk driver code intomatthew2011-06-301-39/+4
| | | | | | subr_disk.c. For now just the MI disk drivers. ok deraadt@, krw@; jsing@ liked the approach too
* Call bufq_drain() in wddetach() instead of reimplementing the samematthew2011-06-201-11/+3
| | | | logic.
* Use disk_lock_nointr() in the xxclose() routines so that they cannotderaadt2011-06-191-6/+4
| | | | | be interrupted. ok matthew
* Use disk_lock/disk_unlock directly and in the same way in these drivers,deraadt2011-06-191-10/+8
| | | | | | rather than using various wrappings. Convert vnd to using the sc_dk rwlock instead of using one of its own. ok matthew
* Drop kernel support for the useless DIOCWLABEL ioctl and prune a lotmatthew2011-06-051-15/+1
| | | | | | | | | of silly flag twiddling code in various disk drivers. ok deraadt@, miod@ N.B., users will need a -current disklabel(8) to be able to write new disklabels to disk now.
* Get rid of the wlabel argument to bounds_check_with_label(). It'smatthew2011-06-031-3/+2
| | | | | | | | | never done anything in OpenBSD and just clutters disk drivers with silly flag handling. More cleanup to follow. ok deraadt@, millert@; no objections krw@
* Change a few of the more common disk drivers (sd, cd, wd, rd, and vnd)matthew2011-05-311-2/+2
| | | | | | | | | | | | | | | | | | | to return EBUSY if the user tries to modify an open partition's offset or size. Only sadness can result if a user tries this, and rejecting it prevents a race between sdstart() and sdstrategy(). Curiously, there was already code in the kernel and in disklabel(8) to detect/handle this, but it was effectively disabled because the disk drivers always used something like "/* sc->sc_dk.dk_openmask */ 0", and this commented out code has existed since even r1.1 in NetBSD. I had no problems building a release and messing around with disklabel(8) for a bit with this diff. Canarying the more common MI disk drivers until we gain confidence that there aren't any regressions, then we can switch the remaining drivers. "I am surprised you got me convinced that this stuff is safe" deraadt@ ok krw@
* keep an eye out for wdc registers returning 0xff. if they return 0xff,deraadt2011-04-181-1/+12
| | | | | | | | this probably means the controller is dead -- as in, a hot plug eject event. in that case, mark the driver dead and try harder to return -1 in the interrupt handler. tested by many ok dlg, miod did not object
* Change wdc_reset_channel() to take a `no wait' argument. Pass in turn thismiod2011-04-151-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | argument to wdcreset(), to have it skip waiting until active channels see their BUSY bit clear in the status register. Use this feature in the resume path, during the first reset operation. The first reset is supposed to only wake up the controller, and the disks don't come back until the second reset is issued, therefore waiting for them to report themselves as ready after the first reset, but before the second, is moot - and as a matter of fact some controllers, such as the AMD 754 and clones/offspring (e.g. Geode) keep the BUSY bit asserted after the first reset. Last, but not least, make sure wd@ata invokes wd_get_params() again before returning from the resume code, as we will still be using polled transfers for a short while. This causes the Lemote Yeelong to resume within less than one second, instead of the lousy 30 seconds wait between the two resets; and the wd_get_params() voodoo prevents it from getting spurious ide interrupts afterwards. wd_get_params() magic from dlg; rest of the work by yours truly after enough prodding by dlg@ and pirofti@, among others. ok deraadt@ dlg@
* wd_hibernate_io() is a standalone disk io writer which tries to notderaadt2011-04-051-35/+1
| | | | | | damage kernel memory very much while doing the job. It is not very pretty yet, but improving it will need some MI work. ok mlarkin jsg dlg
* Reintroduce the code that puts the drive into standby in shutdown, butkettenis2010-12-311-1/+4
| | | | | | only do this if we're going to power down the machine. "My god, it is a 3 line diff. Commit it before it gets bigger!" deraadt@
* The NVIDIA MCP89 SATA controller found on the 2010 Apple 13" MacBook Prokettenis2010-12-301-2/+2
| | | | | | | | can't address block 0xffffffff in LBA mode, at least in combination with the Hitachi HTS545032B9SA02 and HTS545050B9SA02 drives that Apple ships. So use LBA48 mode from that block onwards. ok marco@, deraadt@, miod@
* All users of physio(9) now pass NULL as the buf pointer argument, somatthew2010-09-221-5/+4
| | | | | | | no point in keeping it around. "i like this" thib@ (a while back); ok krw@ and oga@; reminder to update the man page and tweaks jmc@
* DVACT_ACTIVATE and DVACT_DEACTIVATE do nothing here; removederaadt2010-09-201-8/+1
| | | | the false comments.
* Introduce a disk_lookup() function which calls device_lookup(), beforejsing2010-09-081-2/+2
| | | | | | | | | | | | | verifying that the resulting device is present on the disklist. This avoids a race whereby the disk driver can be accessed as soon as the softc has been allocated, but before the disk has completed initialisation and has called disk_attach() (up until this point dk_label is still a null pointer). Cut cd(4), sd(4) and wd(4) across to disk_lookup(). All callers of disk_attach() need to be tested and cut over in due course. ok deraadt@ krw@
* Store a struct device pointer within struct disk and populate this whenjsing2010-09-081-2/+2
| | | | | | | disk_attach() is called by the device driver. We will be building on this shortly. ok deraadt@ krw@
* make struct bufq a member of the softc for devices that use it,dlg2010-09-011-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | rather than it being a pointer to something that needs to be allocated at attach. since all these devices need a bufq to operate, it makes sense to have it allocated as part of the softc and get bufq_init to just initialise all its fields. it also gets rid of the possibility that you wont be able to allocate the bufq struct during attach, which is something you dont want to happen. secondly, it consistently implements a split between wrapper functions and the per discipline implementation of the bufq handlers. it consistently does the locking in the wrappers rather than doing half in the wrappers and the other half in the implementations. it also consistently handles the outstanding bufq bq pointer in the wrappers. this hides most of the implementation inside kern_bufq.c. the only stuff left in buf.h is for the bits each implementation needs to put inside struct buf. tested by thib@ krw@ and me ok thib@ matthew@ no objection from krw@
* sort DVACT_ actions in order of usederaadt2010-08-311-7/+6
|
* Garbage collect struct dkdriver.matthew2010-08-281-4/+1
| | | | ok miod@; "please go ahead" jsing@
* Manuel Bouyer rescinded clauses 3 and 4 of his license text.jsg2010-07-231-6/+1
|
* Give the drive a little bit more time to complete the STANDBY IMMED command.kettenis2010-07-221-2/+2
| | | | | | | | | 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@
* First part of better pciide resume. Wake the channel by performing twomlarkin2010-07-221-1/+13
| | | | | | | | | 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
* Move disk_attach() to the end of the attach functions, at which point thejsing2010-06-281-4/+6
| | | | | | disk is now ready to handle I/O. ok krw@ dlg@
* partial backout of 1.81 as invoking standby in shutdownjsg2010-06-071-2/+1
| | | | breaks at least socppc and armish
* Reintroduce bufqs. A few changes since it was backed out after some goodthib2010-05-261-11/+11
| | | | | | | | | | | | | | | | 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@
* Flush cache before suspend.kettenis2010-05-241-1/+2
| | | | ok krw@, marco@
* Place drive in standby mode before shutdown. Avoids the loud click heard onkettenis2010-05-231-11/+39
| | | | | | many laptops when powering them down. ok jsg@, oga@, krw@
* dont let sys/ioctl.h imply that you get the ioctls in dkio.h. thisdlg2010-05-181-1/+2
| | | | | | | | | | | 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@
* Recycle unused disklabel fields in order to create a disklabel uniquejsing2010-04-231-3/+1
| | | | | | | identifier, allowing the disk to be identified without relying on the device name. ok deraadt@ krw@ beck@ marco@ todd@
* Send "STANDBY IMMEDIATE" command to ATA disks upon suspend. For this to work,kettenis2010-04-111-1/+14
| | | | | | | | | 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@