summaryrefslogtreecommitdiff
path: root/sys/dev/ata/atascsi.c
AgeCommit message (Collapse)Author
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-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-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-05i forgot to set the sector_count when translating WRITE SAME 16David Gwynne
into DSM/TRIM commands. found by tedu
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-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-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-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-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-11-20clean up cases of ;;Theo de Raadt
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
2010-09-20Use SSD_ERRCODE_CURRENT instead of magic 0x70.Kenneth R Westerback
ok dlg@ matthew@
2010-09-20define and use macros for looking at ncq bits.David Gwynne
requested by and ok krw@
2010-09-19move the ncq depth calculation into atascsi_probe where it belongs. byDavid Gwynne
default we now only give devices 1 openings unless both the adapter and device support ncq and a queue depth greater than one. tested by josh elsasser, who always seems to get hurt when i change the openings handling in atascsi. ok krw@
2010-09-19check the cdb length on the scsi commands we emulate in atascsi as a way toDavid Gwynne
check that the midlayer is doing the right thing. ok krw@
2010-09-02the page_length field in the vpd page header is 2 bytes, not 1.David Gwynne
ok krw@ marco@ matthew@
2010-07-27Add scsi_cmd_rw_decode() for decoding any SCSI READ or WRITE command,Matthew Dempsky
and update atascsi(4) to make use of it. (Other HBAs will be updated post-release.) Should allow for use of SATA drives with >2^32 LBAs. ok deraadt@, dlg@, krw@
2010-07-20Do not put a data buffer on the stack. It will be dma'd to. UseTheo de Raadt
malloc() for now, but mark it is dma reachable, and we will pick it up on the sweep in a while ok matthew
2010-07-03Implement translation of the SCSI START STOP UNIT command.Mark Kettenis
ok dlg@, marco@
2010-06-28Remove all adapter-specific 'struct scsi_device's. They are never used. FirstKenneth R Westerback
step in elminating 'struct scsi_device' entirely. Spotted and initial diff from matthew@. ok matthew@ dlg@ deraadt@ marco@ miod@
2010-06-19Remove more splbio/splx pairs from around scsi_done() calls.Kenneth R Westerback
From Matthew Dempsky.
2010-05-26the addr field in read cap 16 is 8 bytes, not 4. pity, i had really bigDavid Gwynne
disks for a few minutes there.
2010-05-05map the ATA data set management stuff (ie, trim) to the SCSI thinDavid Gwynne
provisioning bits in read cap 16
2010-04-29Revert r1.80, leaving iopools in place. Fixes PR#6365. Why WD3200KS-00PKenneth R Westerback
disks on ATI SBx00 care is mysterious but let's keep them working. Fix tested by Josh Elsasser, submitter of PR#6365. Thanks! ok dlg@
2010-04-23the SAT spec from t10.org defines messages for tunnelling ATA commands overDavid Gwynne
SCSI when you're talking to a scsi to ata translation layer (satl). this implements the ata command ioctl handler in scsi_ioctl.c that wraps the ata command requests up in these scsi commands and then issues them against the hardware. this cuts atascsi over to interpreting these scsi commands rather than the ioctls directly. this should allow mpi users (with a relatively recent firmware) to use atactl against their SATA disks. i cant test cos my mpi(4) parts are too old to either support these scsi commands or too old to take recent firmwares. ok marco@ @krw tested by krw@ and me on ahci/atascsi
2010-04-22cut atascsi over to providing and using iopools. this gets rid of NO_CCBDavid Gwynne
and makes the ioctl path more reliable on busy disks by allowing it to sleep in the runqueue for an io to use. mk@ did the original diff and figured most of the problems out. ok mk@
2010-04-19move the stupid throwing away of ata_xfers out the run of the first scsiDavid Gwynne
inquiry against the device up to when the port is probed. this has been bugging me for ages.
2010-04-05fill in the the lowest aligned logical block address field. itDavid Gwynne
indicates the LBA of the first logical block that is located at the beginning of a physical block implemented as best as i can by my understanding of the spec. not tested yet.
2010-04-05populate the logical per physical exponent of the read cap 16 reply byDavid Gwynne
factoring the processing that the limits vpd page does out. this will be easier when i get hold of a disk that does provide values in these ata identify fields.
2010-04-05add support for READ_CAPACITY_16.David Gwynne
2010-04-05add support for ata disks with block sizes other than 512 bytes. i haventDavid Gwynne
ever seen one, but the spec describes how to do it.
2010-04-03byteswap the cmdset word properly so we enable the right features onDavid Gwynne
bigendian archs.
2010-04-03remove some debug outputDavid Gwynne
2010-04-03add support for emulating the disk characteristics and disk limits vpdDavid Gwynne
pages. this if the first step in figuring out if disks use a different physical block size compared to the logical block size they present to the operating system.
2010-03-23Change the scsi_cmd function member of scsi_adapter from int toKenneth R Westerback
void. Use XS_NO_CCB error in the scsi command (xs) to report the NO_CCB condition. Eliminates all SUCCESSFULLY_QUEUED and COMPLETE confusion and untangles the midlayer from the adapter a bit more. Eyes and some fixes by miod@ There may be some compile issues on little used (i.e. I don't have any) drivers but the change is mechanical and thus easy to remedy. ok dlg@
2010-01-09Zap all setting of ITSDONE in drivers that don't look at it. NobodyKenneth R Westerback
else cares so it's just noise. Drivers that actually look at ITSDONE are unchanged. ok marco@ (for his files) dlg@ beck@
2009-12-08the ata identify structure is stupid. its full of buffers you haveDavid Gwynne
to swap to use. this diff doesnt swap fields the identify structure when its fetched, but adds a function that swaps them and copies them into a destination buffer. there is no functional change to the existing users of these fields, specifically the scsi inquiry faker and the device serial vpd page. this does fix the devid vpd page though. if a disk has a wwn we now present it correctly.
2009-12-08krw and marco found another problem with my atascsi chanages.David Gwynne
turns out you cant send atapi devices the ata IDENTIFY command, they dont grok it. you have to send a PACKET IDENTIFY instead, which is exactly the same but with a different command id. this diff changes it so we send a PACKET IDENTIFY to atapi devices. my diff "broke" this because it actually checks to see if the IDENTIFY succeeded rather than just completed. the previous code was wrong with regard to atapi devices. it is just lucky we dont use the IDENTIFY output for atapi devs. my apologies to marco@ and krw@
2009-12-07oops, wrong version of previous diff.David Gwynne
we have to exec a command (with ata_exec) before we check if its done with ata_polled. of course an unstarted command will not be done. found by and debugged with krw@ ok krw@
2009-12-07get rid of the return codes from command submission, ata_cmd handlersDavid Gwynne
now return void. all state about a command is now represented within the ata_xfer structure, and all layers using it (both hba and atascsi) now check only ata_xfer. this relies on my scsi midlayer changes. it was written just before the second last backout of the midlayer.