summaryrefslogtreecommitdiff
path: root/sys/dev/ata
AgeCommit message (Collapse)Author
2012-10-08Revamp the sequences for suspend/hibernate -> resume so that the codeTheo de Raadt
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
2012-02-24Correct the spelling of "transferred" and "transferring"Philip Guenthe
from Tobias Ulmer (tobiasu at tmux.org); ok jmc@, krw@
2011-11-15on failure, the hibernate io function should return an errno type variable,Theo de Raadt
instead of 1.
2011-11-14Use a fixed io_page for all hibernate I/O, which is needed forMike Larkin
ahci_hibernate_io, a skeleton of which is also provided in this diff. This code is from deraadt@. Tested on a few wd machines to ensure it works there as well.
2011-11-13Add some #defines for the various hibernate I/O modes, some of theMike Larkin
groundwork for *_hibernate_io functions other than wd_hibernate_io These changes were sent to me by deraadt@
2011-09-22KNF of mlarkin's code, requested by him. Some improvements to the interfaceTheo de Raadt
for talking to the disk driver snuck in. ok mlarkin
2011-08-03Alexander Polakov found a use of an uninitialized pointer in the scsiDavid Gwynne
unmap handling.
2011-07-17Backout a bunch of my SCSI commits from c2k11. At least one of theseMatthew Dempsky
is causing problems when trying to boot sparc64 from an isp(4). Verified to fix the sparc64/isp(4) regression by krw@; ok deraadt@
2011-07-15Cope with the start-dma-before-init errata and some other register setupTheo de Raadt
errata for the Serverworks SATA chipset found on the macppc xserve G5. ok jmc
2011-07-09translate the scsi UNMAP command into an equiv TRIM, and advertise UNMAPDavid Gwynne
support via the thin provisioning page. this emul is a bit unreliable since atascsi needs to allocate memory for the TRIM command to use, but we figure that the world wont end if we lose a TRIM unlink real io. ok matthew@
2011-07-09Fix fallout from my previous SCSI refactoring diff (movingMatthew Dempsky
adapter_buswidth to sc_targets): gdt(4) and atascsi(4) still used it in other ways. Apply appropriate fixes; tested on ahci(4). ok krw@
2011-07-08First batch of converting SCSI HBAs from setting saa_targets andMatthew Dempsky
saa_luns instead of adapter_buswidth and luns in the prototype link. ok dlg@, miod@
2011-07-08fill in the ata vpd page as best we can. i dont know how to fill in theDavid Gwynne
device signature so i left it blank, and the identify is the cached copy in the port structure. i filled the SAT vendor stuff in as "OpenBSD", "atascsi", osrelease.
2011-07-08provide the thin provisining vpd page if the disk does trim. only claimDavid Gwynne
to do WRITE SAME 16 for now (which is all we do).
2011-07-08macros for TRIMDavid Gwynne
2011-07-08some trim cleanups and additions.David Gwynne
use less magic numbers when check the block limits for trim. fill in the block limits vpd page with some conservative numbers about how much unmap we can do at a time (~32MB over 64 descriptors).
2011-07-06Eliminate redundant buf validation checks in xxstrategy() methods nowMatthew Dempsky
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@
2011-07-05i forgot to set the sector_count when translating WRITE SAME 16David Gwynne
into DSM/TRIM commands. found by tedu
2011-06-30Refactor some common open/close/detach disk driver code intoMatthew Dempsky
subr_disk.c. For now just the MI disk drivers. ok deraadt@, krw@; jsing@ liked the approach too
2011-06-22Print correct function name in debug statements. ata_get_params, notKenneth R Westerback
ata_get_parms or wdc_ata_get_parms.
2011-06-21Laurence Tratt reported that his "Intel 6 Series AHCI" ahci(4) noMatthew Dempsky
longer detects his OCZ Vertex 3 after atascsi.c r1.104. For some reason, the first IDENTIFY command issued silently fails without any notification. In lieu of a better fix, workaround this for now by allowing IDENTIFY to be reissued a second time for non-PMP disks. Discussed with jmatthew@ and dlg@; ok dlg@
2011-06-20Call bufq_drain() in wddetach() instead of reimplementing the sameMatthew Dempsky
logic.
2011-06-19Use disk_lock_nointr() in the xxclose() routines so that they cannotTheo de Raadt
be interrupted. ok matthew
2011-06-19Use disk_lock/disk_unlock directly and in the same way in these drivers,Theo de Raadt
rather than using various wrappings. Convert vnd to using the sc_dk rwlock instead of using one of its own. ok matthew
2011-06-06Delete the long dead LOCKED and WANTED flags from cd(4), sd(4), andMatthew Dempsky
wd(4). They haven't been used for 10+ years, since the drivers were switched to use disk_lock() and disk_unlock() instead. No binary change.
2011-06-05Drop kernel support for the useless DIOCWLABEL ioctl and prune a lotMatthew Dempsky
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.
2011-06-03Get rid of the wlabel argument to bounds_check_with_label(). It'sMatthew Dempsky
never done anything in OpenBSD and just clutters disk drivers with silly flag handling. More cleanup to follow. ok deraadt@, millert@; no objections krw@
2011-06-02Small refactoring of atascsi and fix non-data ATA commands to not setMatthew Dempsky
ATA_F_PIO or ATA_F_READ. ok dlg@
2011-05-31Change a few of the more common disk drivers (sd, cd, wd, rd, and vnd)Matthew Dempsky
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@
2011-05-24Move wdc_cd from ata/ata_wdc.c to ic/wdc.c so that you can compile aMatthew Dempsky
kernel without the former. Also, eliminate two dead stores in wdcattach(). ok dlg@
2011-05-08Move ata_put_xfer() from ata_xfer to atascsi_methods. It's just sillyMatthew Dempsky
to have a non-changing function pointer be part of an object rather than it's virtual method table. ok dlg@; tested on ahci(4) by Mattieu Baptiste, jasper@, and Jason Crawford; no sili(4) testers, but identical changes to ahci(4)
2011-05-05Go back to only attempting one IDENTIFY command against directlyMatthew Dempsky
attached devices as in the pre-port-multiplier code. (Devices attached via port multipliers still get multiple attempts though.) Also don't bother sleeping after the last iteration if all attempts failed. Discussed with dlg@ and Jonathan Matthew; ok dlg@
2011-04-27Fix a few off-by-1 errors in atascsi.Matthew Dempsky
ok dlg@
2011-04-18keep an eye out for wdc registers returning 0xff. if they return 0xff,Theo de Raadt
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
2011-04-15Change wdc_reset_channel() to take a `no wait' argument. Pass in turn thisMiod Vallat
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@
2011-04-08one dma_free() was mistakenly left as free()Theo de Raadt
2011-04-05wd_hibernate_io() is a standalone disk io writer which tries to notTheo de Raadt
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
2011-04-03pirofti made me look at wd(4) code, which made me sad.David Gwynne
increase the timeout on io from 10s to 45s. ata says we should wait 30, but i am cynical. this gives loongson disks enough time to wake up on resume.
2011-04-03Safer, big mem friendly, allocation of ATAPARAMS buf that is theKenneth R Westerback
target of DMA. ok deraadt@ dlg@
2011-04-02Safer, big mem friendly, allocation of identify buf that is theKenneth R Westerback
target of DMA. ok dlg@ deraadt@ thib@
2011-02-03Initialize stack memory before use. Found with clang.Matthew Dempsky
ok dlg@
2011-01-26Add port multiplier support, has been in snaps for a while with no reportedDale Rahn
issues. No actual OKs, but general acknowledgement and 'get it in' from several.
2011-01-13Add new file for upcoming change. ok dlg@ deraadt@Dale Rahn
2011-01-12Reset the state member of the ata_xfer to ATA_S_SETUP before reusing itMark Kettenis
to issue another command, since sili(4) actually checks. Fix a small inaccuracy in a comment while I'm there. ok dlg@
2010-12-31Reintroduce the code that puts the drive into standby in shutdown, butMark Kettenis
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@
2010-12-30The NVIDIA MCP89 SATA controller found on the 2010 Apple 13" MacBook ProMark Kettenis
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@
2010-11-20clean up cases of ;;Theo de Raadt
2010-11-06If the dma_init callback function returns with EINVAL, fall back to PIO.Mark Kettenis
This will be used to work around bugs in certain pciide(4) controllers. From NetBSD. ok jsg@, krw@, deraadt@
2010-10-12Force openings to 1 for devices that can't do tagged i/o, i.e. moreKenneth R Westerback
than 1 i/o active at once. This reduces the chances that concurrent i/o's for such devices will confuse the device or the adapter code. It also eliminates a reason for adapter code to maintain its own queues. Tweak all drivers that fake INQUIRY results to set the SID_CmdQue flag, thus continuing to claim to be able to do tagged i/o. Positive feedback from matthew@ and marco@ for an earlier version. ok dlg@
2010-09-23translate WRITE SAME 16 into DSM TRIM.David Gwynne