aboutsummaryrefslogtreecommitdiff
path: root/sys/cam/ata
Commit message (Collapse)AuthorAgeFilesLines
* Make `camcontrol sanitize` support also ATA devices.Alexander Motin2019-07-251-1/+10
| | | | | | | | | | | | | ATA sanitize is functionally identical to SCSI, just uses different initiation commands and status reporting mechanism. While there, make kernel better handle sanitize commands and statuses. MFC after: 2 weeks Sponsored by: iXsystems, Inc. Notes: svn path=/head/; revision=350331
* Make CAM ATA stack handle disk resizes.Alexander Motin2019-07-232-96/+112
| | | | | | | | | | | | | | | | | While for ATA disks resize is even more rare situation than for SCSI, it may happen in case of HPA or AMA being used. Make ATA XPT report minor IDENTIFY DATA change to upper layers with AC_GETDEV_CHANGED, and ada(4) periph driver handle that event, recalculating all the disk properties and signalling resize to GEOM. Since ATA has no mechanism of UNIT ATTENTIONs, like SCSI, it has no way to detect that something has changed. That is why this functionality depends on explicit reprobe via XPT_REPROBE_LUN call. MFC after: 2 weeks Relnotes: yes Sponsored by: iXsystems, Inc. Notes: svn path=/head/; revision=350233
* ata_xpt: Use the correct union member when accessing valid.Brooks Davis2019-07-221-1/+1
| | | | | | | | | | | | | | | | In principle this should not matter as it's a union and they point to the same memory location but based on the code above we should be accessing .sata and not .ata. Submitted by: arichardson Reviewed by: scottl, imp Obtained from: CheriBSD MFC after: 1 week Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D21002 Notes: svn path=/head/; revision=350228
* Add Accessible Max Address Configuration support to camcontrol.Alexander Motin2019-07-191-1/+7
| | | | | | | | | | | | | | | | AMA replaced HPA in ACS-3 specification. It allows to limit size of the disk alike to HPA, but declares inaccessible data as indeterminate. One of its practical use cases is to under-provision SATA SSDs for better reliability and performance. While there, fix HPA Security detection/reporting. MFC after: 2 weeks Relnotes: yes Sponsored by: iXsystems, Inc. Notes: svn path=/head/; revision=350149
* Replay r349340 by imp accidentally reverted by r349352Warner Losh2019-06-253-19/+27
| | | | | | | | | | | Create ata_param_fixup Create a common fixup routine to do the canonical fixup of the ata_param fixup. Call it from both the ATA and the ATA over SCSI paths. Notes: svn path=/head/; revision=349358
* Replay r349339 by imp accidentally reverted by r349352Warner Losh2019-06-251-11/+14
| | | | | | | | | | Go ahead and completely fix the ata_params before calling the veto function. This breaks nothing that uses it in the tree since ata_params is ignored in storvsc_ada_probe_veto which is the only in-tree consumer. Notes: svn path=/head/; revision=349357
* Remove NAND and NANDFS supportWarner Losh2019-06-253-30/+19
| | | | | | | | | | | | | | | | | | | | | NANDFS has been broken for years. Remove it. The NAND drivers that remain are for ancient parts that are no longer relevant. They are polled, have terrible performance and just for ancient arm hardware. NAND parts have evolved significantly from this early work and little to none of it would be relevant should someone need to update to support raw nand. This code has been off by default for years and has violated the vnode protocol leading to panics since it was committed. Numerous posts to arch@ and other locations have found no actual users for this software. Relnotes: Yes No Objection From: arch@ Differential Revision: https://reviews.freebsd.org/D20745 Notes: svn path=/head/; revision=349352
* Create ata_param_fixupWarner Losh2019-06-243-19/+27
| | | | | | | | | Create a common fixup routine to do the canonical fixup of the ata_param fixup. Call it from both the ATA and the ATA over SCSI paths. Notes: svn path=/head/; revision=349340
* Go ahead and completely fix the ata_params before calling the vetoWarner Losh2019-06-241-11/+14
| | | | | | | | | function. This breaks nothing that uses it in the tree since ata_params is ignored in storvsc_ada_probe_veto which is the only in-tree consumer. Notes: svn path=/head/; revision=349339
* Decode some more ATA commands found in ACS-4.Alexander Motin2019-05-051-3/+21
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=347160
* List few more ATA commands.Alexander Motin2019-04-031-3/+11
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=345849
* Add quirk for Sansisk X400 drivesWarner Losh2019-02-051-2/+11
| | | | | | | | | | | | | | | | Certain versions of Sandisk x400 firmware can hang under extremely heavly load of large I/Os for prolonged periods of time. Newer / current versions work fine, and should be used where possible. Where not possible, this quirk ensures that I/O requests are limited to 128k to avoids the bug, even under extreme load. Since MAXPHYS is 128k, only users with custom kernels are at risk on the older firmware. Once all known users of the older firmware have upgraded, this quirk will be removed. Sponsored by: Netflix, Inc. Notes: svn path=/head/; revision=343814
* [ata] Add workaround for KingDian S200 SSD crash on receiving TRIM commandOleksandr Tymoshenko2019-01-181-2/+16
| | | | | | | | | | | | - Add ADA_Q_NO_TRIM quirk to be used with the device that falsely advertise TRIM support - Add ADA_Q_NO_TRIM entry for KingDian S200 SSD PR: 222802 Submitted by: Bertrand Petit <bsdpr@phoe.frmug.org> MFC after: 1 week Notes: svn path=/head/; revision=343129
* Remove trailing white space in advance of other changes.Warner Losh2018-11-141-15/+12
| | | | Notes: svn path=/head/; revision=340448
* Add statistics for TRIM comandsWarner Losh2018-10-261-1/+21
| | | | | | | | | | Add a counter for the LBAs, Ranges and hardware commands so that we can provide additional color to the statistics we provide to vendors. Sponsored by: Netflix, Inc Notes: svn path=/head/; revision=339777
* Walk back r337554 while discussion continuesConrad Meyer2018-08-101-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | The idea was to get the uncontroversial mechanical change out of the way, then get the meatier functional changes reviewed subsequently. I had not realized that the immediately adjacent issue was addressed in a different direction in r334506 (see Warner's guidance in D15592). Discussion continues, trying to determine if there is a secondary issue still[1] and how best to fix it. With 12-related activities coming up, while that is ongoing, just take this back for now. [1]: Shutdown-time eventhandler events fire normally during panic's reboot path. Driver callbacks that attempt to issue and wait on interrupt- completed IO may never complete, hanging the system. This is particularly obnoxious in the shutdown/panic path, as the debugger cannot be entered anymore and the hang prevents reboot restoring availability. (There's nothing CAM-specific about this problem -- any shutdown event-triggered driver could do something like this during panic. But most NICs, etc. don't try to send spin-down commands at shutdown. ;-)) Discussed with: imp, markj Notes: svn path=/head/; revision=337583
* cam(4): Add an xpt-neutral flag indicating a valid panic CCBConrad Meyer2018-08-091-0/+3
| | | | | | | | | | | | | | | No functional change. Note that this change is careful to set the CCB header xflags after foo_fill_bar() routines, which generally zero existing flags. An earlier version of this patch mistakenly set the flag before the fill routines. Submitted by: Scott Ferris <sferris AT isilon.com>, jhibbits@ Reviewed by: bdrewery@, markj@, and non-committer FreeBSD contributor Anton Rang Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=337554
* remove unneeded inclusion of sys/interrupt.h from several filesAndriy Gapon2018-07-041-1/+0
| | | | | | | | | | | It's likely that the header was needed in the past for swi(9). But now that code does not use swi(9) or any other interfaces defined in sys/interrupt.h. MFC after: 1 week Notes: svn path=/head/; revision=335934
* Hold the reference count until the CCB is releasedWarner Losh2018-05-151-2/+4
| | | | | | | | | | | | | | | When a disk disappears and the periph is invalidated, any I/Os that are pending with the controller can cause a crash when they complete. Move to holding the softc reference count taken in dastart() until the I/O is complete rather than only until xpt_action() returns. (This approach was suggested by Ken Merry.) This extends the method used in da to ada, nda, and mda. Sponsored by: Netflix Submitted by: Chuck Silvers Notes: svn path=/head/; revision=333651
* cam_periph_runccb() changed several years ago to overwrite the ccb callbackScott Long2018-05-011-5/+5
| | | | | | | | | | | pointer. It's now unhelpful and misleading for callers to continue to set it, so bring all callers into conformance. There's no real functional change, but it makes reading the code a lot less confusing. Sponsored by: Netflix Notes: svn path=/head/; revision=333152
* Create a sysctl kern.cam.{,a,n}da.X.invalidateWarner Losh2018-03-141-3/+7
| | | | | | | | | | | | | | | | | | | kern.cam.{,a,n}da.X.invalidate=1 forces *daX to detach by calling cam_periph_invalidate on the underlying periph. This is for testing purposes only. Include only with options CAM_TEST_FAILURE and rename the former [AN]DA_TEST_FAILURE, and fix nda to compile with it set. We're using it at work to harden geom and the buffer cache to be resilient in the face of drive failure. Today, it far too often results in a panic. While much work was done on SIM initiated removal for the USB thumnb drive removal work, little has been done for periph initiated removal. This simulates what *daerror() does for some errors nicely: we get the same panics with it that we do with failing drives. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D14581 Notes: svn path=/head/; revision=330935
* Backout r329818, r329816 and r329815.Warner Losh2018-02-221-1/+1
| | | | | | | | These aren't the commits I thought I was testing prior to commit. Revert until I can sort out what happened and fix it. Notes: svn path=/head/; revision=329819
* Introduce capacity flags for periphsWarner Losh2018-02-221-1/+1
| | | | | | | | | | | | | | | | | | | Introduce flags word to describe the capacities of the peripheral. First bit will describe if the periph driver allows multiple outstanding TRIMS to be active in a device. Modify the I/O scheduler so that the nda driver can queue trims for a while after the first one arrives. We'll queue until we see a I/O scheduler tick, then we'll schedule as many TRIMs as allowed by other factors (currently this is slocts in the NVMe controller). This mariginally helps the read latency issues we see with reads, but sets the stage for the nda driver to do TRIM collapsing like the da and ada drivers do today. Sponsored by: Netflix Notes: svn path=/head/; revision=329815
* Return a C errno for cam_periph_acquire().Scott Long2018-02-063-11/+9
| | | | | | | | | | | | | | There's no compelling reason to return a cam_status type for this function and doing so only creates confusion with normal C coding practices. It's technically an API change, but the periph API isn't widely used. No efffective change to operation. Reviewed by: imp, mav, ken Sponsored by: Netflix Differential Revision: D14063 Notes: svn path=/head/; revision=328918
* Don't hold the periph lock when calling into cam_periph_runccb()Scott Long2018-01-091-6/+1
| | | | | | | | | | | | | | from the ada and da dump routines. This avoids difficult locking problems from needing to be handled. While it might seem like this would leave the periphs unprotected during dump, they were aleady at risk of unexpected removal due to the dump functions not keeping refcount state across the many calls that come in during a dump. This is an exercise for future work. Obtained from: Netflix Notes: svn path=/head/; revision=327710
* cam/da: QUIRK: Add 4K quirks for WD Red and Black MHDDsEitan Adler2018-01-051-1/+6
| | | | | | | | | PR: 188685 Submitted by: Jeremy Chadwick <jdc@koitsu.org> Reported by: Martin Birgmeier <d8zNeCFG@aon.at> Notes: svn path=/head/; revision=327577
* Do pass removing some write-only variables from the kernel.Alexander Kabaev2017-12-251-4/+1
| | | | | | | | | | | | This reduces noise when kernel is compiled by newer GCC versions, such as one used by external toolchain ports. Reviewed by: kib, andrew(sys/arm and sys/arm64), emaste(partial), erj(partial) Reviewed by: jhb (sys/dev/pci/* sys/kern/vfs_aio.c and sys/kern/kern_synch.c) Differential Revision: https://reviews.freebsd.org/D10385 Notes: svn path=/head/; revision=327173
* Reduce size of several on-stack string buffers.Alexander Motin2017-12-132-2/+2
| | | | | | | | Submitted by: Dmitry Luhtionov <dmitryluhtionov@gmail.com> MFC after: 2 weeks Notes: svn path=/head/; revision=326835
* Use ataio ccb instead of general ccb to avoid excessice stack usage.Warner Losh2017-12-131-14/+14
| | | | Notes: svn path=/head/; revision=326819
* Define xpt_path_inq.Warner Losh2017-12-062-25/+7
| | | | | | | | | | | This provides a nice wrarpper around the XPT_PATH_INQ ccb creation and calling. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D13387 Notes: svn path=/head/; revision=326645
* Now that cam_periph_runccb() can be called from situations where theWarner Losh2017-12-061-40/+7
| | | | | | | | | | | kernel scheduler is stopped, replace the by hand calling of xpt_polled_action() with it. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D13388 Notes: svn path=/head/; revision=326644
* cam: fix sign-extension error in adagetparamsAlan Somers2017-12-061-1/+2
| | | | | | | | | | | | | | | | adagetparams contains a sign-extension error that will cause the sector count to be incorrectly calculated for ATA disks of >=1TiB that still use CHS addressing. Disks using LBA48 addressing are unaffected. Reported by: Coverity CID: 1007296 Reviewed by: ken MFC after: 3 weeks Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D13198 Notes: svn path=/head/; revision=326624
* Remove unused 4th argument to match the standard error routines.Warner Losh2017-12-063-4/+4
| | | | | | | | Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D13386 Notes: svn path=/head/; revision=326606
* sys/cam: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-275-0/+10
| | | | | | | | | | | | | | | Mainly focus on files that use BSD 2-Clause license, however the tool I was using misidentified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Notes: svn path=/head/; revision=326265
* Quirk Seagate ST8000AS0003-2HHAlan Somers2017-11-201-1/+1
| | | | | | | | | | | Like its predecessor ST8000AS0002, this is a drive-managed SMR drive, but doesn't declare that in its ATA identify data. MFC after: 3 weeks Sponsored by: Spectra Logic Corp Notes: svn path=/head/; revision=326040
* Add some 4k quirks for Samsung pm863a SSDsBaptiste Daroussin2017-11-161-0/+8
| | | | | | | | | | Submitted by: Nikita Kozlov <nikita.kozlov at blade-group.com> MFC after: 3 days Sponsored by: blade Differential Revision: https://reviews.freebsd.org/D13093 Notes: svn path=/head/; revision=325888
* Send IDLE IMMEDIATE for warm boot.Warner Losh2017-10-301-6/+18
| | | | | | | | | | | | | | | | We must send either an IDLE IMMEDIATE or a STANDBY IMMEDIATE to drives on warm boot so their SMART and other volatile data is persisted. However, for a warm boot we don't want to send STANDBY IMMEDIATE to some spinning drives because they will spin down. If there's a lot of these drives on the system, that can cause a thundering herd problem at startup time (that in extreme cases causes timeout in device discovery). Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D12811 Notes: svn path=/head/; revision=325117
* We should be call adaerror() instead of cam_periph_error() always.Warner Losh2017-10-261-4/+4
| | | | | | | Sponsored by: Netflix Notes: svn path=/head/; revision=325027
* Always send STANDBY IMMEDIATE when shutting downWarner Losh2017-10-261-10/+44
| | | | | | | | | | | | | | | To save SMART data and for a drive to understand that it's been nicely shutdown, we need to send a STANDBY IMMEDIATE. Modify adaspindown to use a local CCB on the stack. When we're panicing, used xpt_polled_action rather than cam_periph_runccb so that we can SEND IMMEDIATE after we've shutdown the scheduler. Sponsored by: Netflix Reviewed by: scottl@, gallatin@ Differential Revision: https://reviews.freebsd.org/D12799 Notes: svn path=/head/; revision=325026
* Handle RB_POWERCYCLE in ada driverWarner Losh2017-10-251-1/+1
| | | | | | | | | | Allow the disks to be spun down when doing a POWERCYCLE as well as POWEROFF. Sponsored by: Netflix Notes: svn path=/head/; revision=324989
* Zero out the ccb's alloated on the stack for the dump routines to moreWarner Losh2017-10-151-0/+1
| | | | | | | | | closely match a ccb returned from xpt_get_ccb(). Sponsored by: Netflix Notes: svn path=/head/; revision=324645
* Add comment about where we need to place this routine, and why.Warner Losh2017-08-281-0/+6
| | | | | | | Sponsored by: Netflix Notes: svn path=/head/; revision=322977
* adaasync(): Set ADA_STATE_WCACHE based on ADA_FLAG_CAN_WCACHEAlexander Motin2017-07-271-1/+1
| | | | | | | | | | | | | | | | The attached patch lets adaasync() set ADA_STATE_WCACHE based on ADA_FLAG_CAN_WCACHE instead of ADA_FLAG_CAN_RAHEAD. This fixes a regression introduced in r300207 which changed the flag names. PR: 220948 Submitted by: Fabian Keil <fk@fabiankeil.de> Obtained from: ElectroBSD MFC after: 1 week Notes: svn path=/head/; revision=321606
* Add 4k and NCQ_TRIM_BROKEN quirks for Samsung 845 SSDs.Sean Bruno2017-07-131-0/+8
| | | | | | | | Submitted by: hannula@gmail.com Differential Revision: https://reviews.freebsd.org/D7967 Notes: svn path=/head/; revision=320953
* Add 4K quirks for Samsung 750 EVO SSDSean Bruno2017-07-131-0/+8
| | | | | | | | | Submitted by: lev Reviewed by: mav Differential Revision: https://reviews.freebsd.org/D9478 Notes: svn path=/head/; revision=320948
* Include opt files in the kernel with "" instead of <>.Warner Losh2017-07-101-1/+1
| | | | Notes: svn path=/head/; revision=320860
* Allow PROBE_SPINUP to fail in CAM ATA transportAndriy Gapon2017-05-261-0/+10
| | | | | | | | | | | | | | | | | | | | | The motivation for this is two-fold. 1. Some old WD SATA disks may appear as if they need to be spun up when they are already spinning. Those disks would respond with an error to the spin-up request. 2. Even if we really fail to spin up the disk, we still can try to proceed to the subsequent phases. If we fail later on, then no difference. Otherwise we get a chance to communicate with the disk which is better than completely ignoring it, because a user can try to recover the disk. Reviewed by: mav MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D10896 Notes: svn path=/head/; revision=318962
* Add infrastructure to the ATA and SCSI transports that supportsScott Long2017-04-194-38/+232
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | using a driver-supplied sbuf for printing device discovery announcements. This helps ensure that messages to the console will be properly serialized (through sbuf_putbuf) and not be truncated and interleaved with other messages. The infrastructure mirrors the existing xpt_announce_periph() entry point and is opt-in for now. No content or formatting changes are visible to the operator other than the new coherency. While here, eliminate the stack usage of the temporary announcement buffer in some of the drivers. It's moved to the softc for now, but future work will eliminate it entirely by making the code flow more linear. Future work will also address locking so that the sbufs can be dynamically sized. The scsi_da, scs_cd, scsi_ses, and ata_da drivers are converted at this point, other drivers can be converted at a later date. A tunable+sysctl, kern.cam.announce_nosbuf, exists for testing purposes but will be removed later. TODO: Eliminate all of the code duplication and temporary buffers. The old printf-based methods will be retired, and xpt_announce_periph() will just be a wrapper that uses a dynamically sized sbuf. This requires that the register and deregister paths be made malloc-safe, which they aren't currently. Sponsored by: Netflix Notes: svn path=/head/; revision=317143
* In r289137 the legacy_aliases compatibility shims for ata were removed,Michael Gmelin2017-03-281-4/+0
| | | | | | | | | | also remove a leftover define used for implementing them. Reviewed by: mav Differential Revision: https://reviews.freebsd.org/D6726 Notes: svn path=/head/; revision=316117
* Add 4k quirk for Micron 5100 and Intel S3610 SSDsSean Bruno2017-01-171-0/+16
| | | | | | | | | | Submitted by: Jason Wolfe <j@nitrology.com> MFH: 1 week Sponsored by: Limelight Networks Differential Revision: https://reviews.freebsd.org/D9209 Notes: svn path=/head/; revision=312344