summaryrefslogtreecommitdiffstats
path: root/sys/cam/scsi
Commit message (Collapse)AuthorAgeFilesLines
* Acquire periph reference when handling d_getattr() method call.mav2013-06-121-0/+3
| | | | | | | | While GEOM in general has provider opened while sending BIO_GETATTR, GEOM DISK does not really need to open disk to read medium-unrelated attributes for own use. Proposed by: ken
* Simplify the checking of flags for cam_periph_mapmem(). This gets rid ofscottl2013-06-073-66/+29
| | | | | | | | a lot of code redundancy and grossness at very minor expense. Reviewed by: smh Obtained from: Netflix MFC after: 3 days
* Added missing SCSI quirks from r241784smh2013-05-281-0/+145
| | | | | | | | | | | | | | | | | Re-ordered SSD quirks alphabetically so they are easier to maintain. Removed my email and PR reference from comments on each quirk. Added quirks for more SSDs: * Crucial M4 * Corsair Force GT * Intel 520 Series * Kingston E100 Series * Samsung 830 Series Reviewed by: pjd (mentor) Approved by: pjd (mentor) MFC after: 1 week
* Enforce validation on the selected delete method via sysctl.smh2013-05-241-1/+2
| | | | | | | | | This prevents users from selecting a delete method which may cause corruption e.g. MPS WS16 on pre P14 firmware. Reviewed by: pjd (mentor) Approved by: pjd (mentor) MFC after: 2 days
* Added output of device QUIRKS for CAM and AHCI devices during boot.smh2013-05-184-2/+39
| | | | | | Reviewed by: mav Approved by: pjd (mentor) MFC after: 2 weeks
* Suppress error printing for "PREVENT ALLOW MEDIUM REMOVAL" on da open.mav2013-05-121-1/+1
| | | | | Change at r250208 exposed more errors here, hidden before. The same flag is used in cd driver.
* Fxi a bunch of typos.eadler2013-05-102-4/+4
| | | | | PR: misc/174625 Submitted by: Jeremy Chadwick <jdc@koitsu.org>
* Tune support for removable media in da driver:mav2013-05-031-17/+13
| | | | | | | | - remove DA_FLAG_SAW_MEDIA flag, almost opposite to DA_FLAG_PACK_INVALID, using the last instead. - allow opening device with no media present, reporting zero media size and non-zero sector size, as geom/notes suggests. That allow to read device attributes and potentially do other things, not related to media.
* Enable CAM SCSI to choice ATA TRIM during autodetection and correct methodsmh2013-05-021-3/+3
| | | | | | | | names after increasing the priority of ATA TRIM. Reviewed by: mav Approved by: pjd (mentor) MFC after: 1 week
* Use the existence of ATA Information VPD to determine if we should attemptsmh2013-05-022-19/+73
| | | | | | | | | | | | | | | | | to query ATA functionality via ATA Pass-Through (16) as this page is defined as "must" for SATL devices, hence indicating that the device is at least likely to support Pass-Through (16). This eliminates errors produced by CTL when ATA Pass-Through (16) fails. Switch ATA probe daerror call to SF_NO_PRINT to avoid errors printing out for devices which return invalid errors. Output details about supported and choosen delete method when verbose booted. Reviewed by: mav Approved by: pjd (mentor) MFC after: 1 week
* Fix probe in progress check in dareprobesmh2013-05-021-1/+1
| | | | | | Reviewed by: mav Approved by: pjd (mentor) MFC after: 1 week
* Update probe flow so that devices with lbp can also disable disksort.smh2013-05-021-31/+34
| | | | | | | | | | | | | | | | Ensure that delete_available is reset so re-probes after a media change, to one with different delete characteristics, will result in the correct methods being flagged as available. Make all ccb state changes use a consistent flow: * free() * xpt_release_ccb() * softc->state = <new state> * xpt_schedule() Reviewed by: mav Approved by: pjd (mentor) MFC after: 1 week
* Correct comment typo'ssmh2013-04-281-2/+6
| | | | | | | | Add missing comment Reviewed by: pjd (mentor) Approved by: pjd (mentor) MFC after: 2 weeks
* Add some cam_freeze_devq()'s missed at r249466.mav2013-04-281-0/+3
| | | | | | This makes number of freezes match the number of releases. Reported by: dim
* MFprojects/camlock r249542:mav2013-04-271-14/+3
| | | | | | | Remove ADA_FLAG_PACK_INVALID flag. Since ATA disks have no concept of media change it only duplicates CAM_PERIPH_INVALID flag, so we can use last one. Slightly cleanup DA_FLAG_PACK_INVALID use.
* Added automatic detection of non-rotating media which disables thesmh2013-04-262-7/+106
| | | | | | | | | use of BIO queue sorting, hence optimising performance for devices such as SSD's Reviewed by: scottl Approved by: pjd (mentor) MFC after: 2 weeks
* Teach GEOM and CAM about the difference between the max "size" of r/w and deletesmh2013-04-261-1/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | requests. sys/geom/geom_disk.h: - Added d_delmaxsize which represents the maximum size of individual device delete requests in bytes. This can be used by devices to inform geom of their size limitations regarding delete operations which are generally different from the read / write limits as data is not usually transferred from the host to physical device. sys/geom/geom_disk.c: - Use new d_delmaxsize to calculate the size of chunks passed through to the underlying strategy during deletes instead of using read / write optimised values. This defaults to d_maxsize if unset (0). - Moved d_maxsize default up so it can be used to default d_delmaxsize sys/cam/ata/ata_da.c: - Added d_delmaxsize calculations for TRIM and CFA sys/cam/scsi/scsi_da.c: - Added re-calculation of d_delmaxsize whenever delete_method is set. - Added kern.cam.da.X.delete_max sysctl which allows the max size for delete requests to be limited. This is useful in preventing timeouts on devices who's delete methods are slow. It should be noted that this limit is reset then the device delete method is changed and that it can only be lowered not increased from the device max. Reviewed by: mav Approved by: pjd (mentor)
* Added available delete methods discovery during device probe, including thesmh2013-04-261-76/+566
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | maximum sizes for said methods, which are used when processing BIO_DELETE requests. This includes updating UNMAP support discovery to be based on SBC-3 T10/1799-D Revision 31 specification. Added ATA TRIM support to cam scsi devices via ATA Pass-Through(16) sys/cam/scsi/scsi_da.c: - Added ATA Data Set Management TRIM support via ATA Pass-Through(16) as a delete_method - Added four new probe states used to identity available methods and their limits for the processing of BIO_DELETE commands via both UNMAP and the new ATA TRIM commands. - Renamed Probe states to better indicate their use - Added delete method descriptions used when informing user of issues. - Added automatic calculation of the optimum delete mode based on which method presents the largest maximum request size as this is most likely to result in the best performance. - Added WRITE SAME max block limits - Updated UNMAP range generation to mirror that used by ATA TRIM, this optimises the generation of ranges and fixes a potential overflow issue in the count when combining multiple BIO_DELETE requests - Added output of warnings about short deletes. This should only ever be triggered on devices that fail to correctly advertise their supported delete modes / max sizes. - Fixed WS16 requests being incorrectly limited to 65535 in length. Reviewed by: mav Approved by: pjd (mentor) MFC after: 2 weeks
* Refactored scsi_xpt use of device_has_vpd to generic scsi_vpd_supported_pagesmh2013-04-263-21/+36
| | | | | | | | | | | so its available for use in generic scsi code. This is a pre-requirement for using VPD queries to determine available SCSI delete methods within scsi_da. Reviewed by: mav Approved by: pjd (mentor) MFC after: 2 weeks
* Added the ability to send ATA identify and Data Set Management (DSM) TRIMsmh2013-04-262-0/+118
| | | | | | | | | | | | | | | | | | | | | | | | commands to an ATA device attached via a SCSI control. sys/cam/scsi/scsi_all.c: - Added scsi_ata_identify, scsi_ata_trim Which use ATA Pass-Through to send commands to the attached disk. sys/cam/scsi/scsi_all.h: - Added defines for all missing ATA Pass-Through commands values. - Added scsi_ata_identify, scsi_ata_trim methods used in ATA TRIM support. - Added scsi_vpd_logical_block_prov structure used when querying for the supported sizes UNMAP commands. - Added scsi_vpd_block_limits structure used when querying for the supported sizes of the UNMAP command. Reviewed by: mav Approved by: pjd (mentor) MFC after: 2 weeks
* Removed unneeded tests in dadeletemethodset changing it to return voidsmh2013-04-261-7/+4
| | | | | | Reviewed by: mav Approved by: pjd (mentor) MFC after: 2 weeks
* Fix compilation.ken2013-04-201-8/+4
| | | | Pointy hat to: ken
* Update chio(1) and ch(4) to support reporting element designators.ken2013-04-192-58/+242
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows mapping a tape drive in a changer (as reported by 'chio status') to a sa(4) driver instance by comparing the serial numbers. The designators can be ASCII (which is printed out directly), binary (which is printed in hex format) or UTF-8, which is printed in either native UTF-8 format if the terminal can support it, or in %XX notation for non-ASCII characters. Thanks to Hiroki Sato <hrs@> for the explaining UTF-8 printing and example UTF-8 printing code. chio.h: Modify the changer_element_status structure to add new fields and definitions from the SMC3r16 spec. Rename the original CHIOGSTATUS ioctl to OCHIOGTATUS and define a new CHIOGSTATUS ioctl. Clean up some tab/space issues. chio.c: For the 'status' subcommand, print the designator field if it is supplied by a device. scsi_ch.h: Add new flags for DVCID and CURDATA to the READ ELEMENT STATUS command structure. Add a read_element_status_device_id structure for the data fields in the new standard. Add new unions, dt_or_obsolete and voltage_devid, to hold and address data from either SCSI-2 or newer devices. scsi_ch.c: Implement support for fetching device IDs with READ ELEMENT STATUS data. Add new arguments to scsi_read_element_status() to allow the user to request the DVCID and CURDATA bits. This isn't compiled into libcam (it's only an internal kernel interface), so we don't need any special handling for the API change. If the user issues the new CHIOGSTATUS ioctl, copy all of the available element status data out. If he issues the OCHIOGSTATUS ioctl, we don't copy the new fields in the structure. Fix a bug in chopen() that would result in the peripheral never getting unheld if chgetparams() failed. Sponsored by: Spectra Logic Submitted by: Po-Li Soong MFC After: 1 week
* - Correct mispellings of the word occurrencegabor2013-04-172-2/+2
| | | | Submitted by: Christoph Mallon <christoph.mallon@gmx.de> (via private mail)
* MFprojects/camlock r248982:mav2013-04-141-4/+4
| | | | | | | | Stop abusing xpt_periph in random plases that really have no periph related to CCB, for example, bus scanning. NULL value is fine in such cases and it is correctly logged in debug messages as "noperiph". If at some point we need some real XPT periphs (alike to pmpX now), quite likely they will be per-bus, and not a single global instance as xpt_periph now.
* MFprojects/camlock r248890, r248897, r248898, r248900, r248903, r248905,mav2013-04-143-33/+34
| | | | | | | | | | | | | | | | | | r248917, r248918, r248978, r249001, r249014, r249030: Remove multilevel freezing mechanism, implemented to handle specifics of the ATA/SATA error recovery, when post-reset recovery commands should be allocated when queues are already full of payload requests. Instead of removing frozen CCBs with specified range of priorities from the queue to provide free openings, use simple hack, allowing explicit CCBs over- allocation for requests with priority higher (numerically lower) then CAM_PRIORITY_OOB threshold. Simplify CCB allocation logic by removing SIM-level allocation queue. After that SIM-level queue manages only CCBs execution, while allocation logic is localized within each single device. Suggested by: gibbs
* Do not sent 120 TEST UNIT READY requests on generic NOT READY statuses.mav2013-04-111-5/+2
| | | | | | | | | | Some failing disks tend to return vendor-specific ASC/ASCQ codes with NOT READY sense key. It caused extremely long recovery attempts, repeating these 120 TURs (it takes at least 1 minute) for every I/O request. Instead of that use default error handling, doing just few retries. Reviewed by: ken, gibbs MFC after: 1 month
* MFprojects/camlock:mav2013-04-041-11/+0
| | | | | | | | | | | | | | | | r249017: Some cosmetic things: - Unify device to target insertion inside xpt_alloc_device() instead of duplicating it three times. - Remove extra checks for empty lists of devices and targets on release since zero refcount check also implies it. - Reformat code to reduce indentation. r249103: - Add lock assertions to every point where reference counters are modified. - When reference counters are reaching zero, add assertions that there are no children items left. - Add a bit more locking to the xptpdperiphtraverse().
* MFprojects/camlock r248931:mav2013-04-043-7/+7
| | | | | | Replace some direct mutex operations with wrappers. MFC after: 2 weeks
* MFprojects/camlock r248930:mav2013-04-042-32/+0
| | | | | | Remove extra NULL checks. d_drv1 can never be NULL during periph life cycle. MFC after: 2 weeks
* Add xpt_release_ccb()'s missed at r248872. That made `shutdown -p` stuckmav2013-04-031-0/+1
| | | | on controller with small number of queue slots and several disks connected.
* Added ATA Pass-Through support to CAMsmh2013-04-022-1/+76
| | | | | | | | | | | | | | | | | sys/cam/scsi/scsi_all.c: - Added scsi_ata_pass_16 method Which use ATA Pass-Through to send commands to the attached disk. sys/cam/scsi/scsi_all.h: - Added defines for all missing ATA Pass-Through commands values. - Added scsi_ata_pass_16 method. - Fixed a comment typo while I'm here Reviewed by: mav Approved by: pjd (mentor) MFC after: 2 weeks
* Adds the ability to enable / disable sorting of BIO requests queued withinsmh2013-03-291-5/+24
| | | | | | | | | | | | | | | | | | | | | | | CAM. This can significantly improve performance particularly for SSDs which don't suffer from seek latencies. The sysctl / tunable kern.cam.sort_io_queues provides the systems default setting where:- 0 = queued BIOs are NOT sorted 1 = queued BIOs are sorted (default) Each device gets its own sysctl kern.cam.<type>.<id>.sort_io_queue Valid values are:- -1 = use system default (default) 0 = queued BIOs are NOT sorted 1 = queued BIOs are sorted Note: Additional patch will look to add automatic use of none sorted queues for none rotating media e.g. SSD's Reviewed by: scottl Approved by: pjd (mentor) MFC after: 2 weeks
* Make pre-shutdown flush and spindown routines to not use xpt_polled_action(),mav2013-03-291-13/+6
| | | | | | but execute the commands in regular way. There is no any reason to cook CPU while the system is still fully operational. After this change polling in CAM is used only for kernel dumping.
* Implement CAM_PERIPH_FOREACH() macro, safely iterating over the list ofmav2013-03-291-1/+1
| | | | | | | | driver's periphs, acquiring and releaseing periph references while doing it. Use it to iterate over the lists of ada and da periphs when flushing caches and putting devices to sleep on shutdown and suspend. Previous code could panic in theory if some device disappear in the middle of the process.
* Support unmapped i/o for the md(4).kib2013-03-194-10/+26
| | | | | | | | | | The vnode-backed md(4) has to map the unmapped bio because VOP_READ() and VOP_WRITE() interfaces do not allow to pass unmapped requests to the filesystem. Vnode-backed md(4) uses pbufs instead of relying on the bio_transient_map, to avoid usual md deadlock. Sponsored by: The FreeBSD Foundation Tested by: pho, scottl
* Add DA_Q_NO_PREVENT quirk for Kingston DataTraveler G3 1.00 USB flash.mav2013-02-221-0/+4
| | | | | | PREVENT ALLOW MEDIUM REMOVAL commands return errors on these devices without returning sense data. In some cases unrelated following commands start to return errors too, that makes device to be dropped by CAM.
* Reform the busdma API so that new types may be added without modifyingkib2013-02-122-2/+5
| | | | | | | | | | | | | | | | | | | | | every architecture's busdma_machdep.c. It is done by unifying the bus_dmamap_load_buffer() routines so that they may be called from MI code. The MD busdma is then given a chance to do any final processing in the complete() callback. The cam changes unify the bus_dmamap_load* handling in cam drivers. The arm and mips implementations are updated to track virtual addresses for sync(). Previously this was done in a type specific way. Now it is done in a generic way by recording the list of virtuals in the map. Submitted by: jeff (sponsored by EMC/Isilon) Reviewed by: kan (previous version), scottl, mjacob (isp(4), no objections for target mode changes) Discussed with: ian (arm changes) Tested by: marius (sparc64), mips (jmallet), isci(4) on x86 (jharris), amd64 (Fabian Keil <freebsd-listen@fabiankeil.de>)
* Format CDB output as 2 digit hex correcting the lengthsmh2013-01-311-1/+1
| | | | | Approved by: pjd (mentor) MFC after: 1 week
* Sanitize the element descriptor string before using it as a device name.jh2013-01-241-2/+10
| | | | | Reported and tested by: Vitalij Satanivskij Reviewed by: gibbs, mav
* Do not pretend to have autosense data when no such data is available.kan2013-01-191-10/+9
| | | | | | | | Make umass return an error code if SCSI sense retrieval request has failed. Make sure scsi_error_action honors SF_NO_RETRY and SF_NO_RECOVERY in all cases, even if it cannot parse sense bytes. Reviewed by: hselasky (umass), scottl (cam)
* - Add missig xpt_schedule() call for cases when requested immediate CCBmav2013-01-111-5/+8
| | | | | | | priority is lower then payload/TUR one. - Reduce TUR priority and avoid sending them if there are any other outstanding commands, alike to DA driver.
* Do not schedule periph for payload/TUR requests if reprobe is in progressmav2013-01-111-10/+15
| | | | | | | | | | to avoid sending extra READ CAPACITY requests by dastart(). Schedule periph again on reprobe completion, or otherwise it may stuck indefinitely long. This should fix USB explore thread hanging on device unplug, waiting for periph destruction. Reported by: hselasky
* Changed scsi_da device requests to use the sysctl tunable value for retry_countsmh2013-01-101-3/+3
| | | | | | | | | and da_default_timeout where their current hardcoded values matched the current default value for said tunables. PR: kern/169976 Reviewed by: pjd (mentor) Approved by: mav
* Updates delete_method sysctl changes to always maintain disk d_flagssmh2013-01-101-12/+32
| | | | | | | | | | | | | | DISKFLAG_CANDELETE. While this change makes this layer consistent other layers such as UFS and ZFS BIO_DELETE support may not notice any change made manually via these device sysctls until the device is reopened via a mount. Also corrected var order in dadeletemethodsysctl PR: kern/169801 Reviewed by: pjd (mentor) Approved by: mav MFC after: 2 weeks
* Removes essentially unused variables from scsi_da probe setupssmh2013-01-101-6/+2
| | | | | | | PR: kern/169835 Reviewed by: pjd (mentor) Approved by: mav MFC after: 2 weeks
* Make SES driver to not fall out on some errors in Additional Status page.mav2012-12-201-3/+2
| | | | | | | This allows CAM devices still get their physical paths even if status of later elements it corrupted. Sponsored by: iXsystems, Inc.
* Fix bug in r242720, that caused additional status page to not be used ifmav2012-12-191-5/+2
| | | | descriptor page is supported.
* Fix a device departure bug for the the pass(4), enc(4), sg(4) and ch(4)ken2012-12-085-15/+305
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | drivers. The bug occurrs when a userland process has the driver instance open and the underlying device goes away. We get the devfs callback that the device node has been destroyed, but not all of the closes necessary to fully decrement the reference count on the CAM peripheral. The reason is that once devfs calls back and says the device has been destroyed, it is moved off to deadfs, and devfs guarantees that there will be no more open or close calls. So the solution is to keep track of how many outstanding open calls there are on the device, and just release that many references when we get the callback from devfs. scsi_pass.c, scsi_enc.c, scsi_enc_internal.h: Add an open count to the softc in these drivers. Increment it on open and decrement it on close. When we get a devfs callback to say that the device node has gone away, decrement the peripheral reference count by the number of still outstanding opens. Make sure we don't access the peripheral with cam_periph_unlock() after what might be the final call to cam_periph_release_locked(). The peripheral might have been freed, and we will be dereferencing freed memory. scsi_ch.c, scsi_sg.c: For the ch(4) and sg(4) drivers, add the same changes described above, and in addition, fix another bug that was previously fixed in the pass(4) and enc(4) drivers. These drivers were calling destroy_dev() from their cleanup routine, but that could cause a deadlock because the cleanup routine could be indirectly called from the driver's close routine. This would cause a deadlock, because the device node is being held open by the active close call, and can't be destroyed. Sponsored by: Spectra Logic Corporation MFC after: 1 week
* Use information about suported diagnostic pages to avoid reading optionalmav2012-11-071-2/+7
| | | | | | | Element Descriptor page if it is not supported. This removes one error message from verbose logs during boot on systems with some enclosures. Sponsored by: iXsystems, Inc.
OpenPOWER on IntegriCloud