aboutsummaryrefslogtreecommitdiff
path: root/sbin/camcontrol
Commit message (Collapse)AuthorAgeFilesLines
* camcontrol(8): Fix some warnings spotted by mandocGordon Bergling2020-11-201-9/+0
| | | | | | | - skipping paragraph macro: Pp before Bl Notes: svn path=/head/; revision=367889
* Add help messages for camcontrol(8) MMCCAM functionalityIlya Bakulin2020-10-301-0/+20
| | | | | | | | | | | | This adds the help messages for camcontrol(8) in-binary help. Man page will follow in the separate change. Reviewed by: bz Approved by: imp (mentor) Differential Revision: https://reviews.freebsd.org/D25963 Notes: svn path=/head/; revision=367180
* camcontrol(8): Bugfixes for some issues reported by mandocGordon Bergling2020-10-031-6/+8
| | | | | | | | | - new sentence, new line MFC after: 1 week Notes: svn path=/head/; revision=366406
* Make it possible to get/set MMC frequency from camcontrolIlya Bakulin2020-07-241-6/+77
| | | | | | | | | | | | | Enhance camcontrol(8) so that it's possible to manually set frequency for SD/MMC cards. While here, display more information about the current controller, such as supported operating modes and VCCQ voltages, as well as current VCCQ voltage. Reviewed by: manu Approved by: imp (mentor) Differential Revision: https://reviews.freebsd.org/D25795 Notes: svn path=/head/; revision=363497
* Declare packed struct ata_params as 2-byte-alignedRyan Libby2019-12-211-1/+1
| | | | | | | | | | | | | This avoids gcc9 warning about unaligned access to the structure when casting to uint16_t pointer type. Submitted by: imp Reviewed by: imp Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D22888 Notes: svn path=/head/; revision=355972
* Properly detect ATA sanitize errors.Alexander Motin2019-12-151-3/+19
| | | | | | | | | | It seems I read specifications not careful enough. There are devices not setting successful completion bit, causing previous code report false error. MFC after: 1 week Notes: svn path=/head/; revision=355788
* Fix off-by-one error in HPA/AMA maximum reporting.Alexander Motin2019-11-221-1/+1
| | | | | | | | | | | Before my refactoring the code reported value as maximum number of sectors, adding one to the maximum sector number returned by respective command. While this difference is somewhat confusing, restore previous behavior. MFC after: 3 days Notes: svn path=/head/; revision=354999
* Remove Tagged Command Queuing feature reporting.Alexander Motin2019-09-121-10/+0
| | | | | | | | | | I never saw those devices myself, FreeBSD never supported them, and it is officially obsolete since ACS-2 specification. MFC after: 3 days Notes: svn path=/head/; revision=352258
* Report Trusted Computing feature set support.Alexander Motin2019-09-121-0/+3
| | | | | | | | | It practically means the device is SED. MFC after: 3 days Notes: svn path=/head/; revision=352257
* Remove struct ata_res_pass16, unneeded after r352082.Alexander Motin2019-09-101-16/+0
| | | | | | | MFC after: 4 days Notes: svn path=/head/; revision=352200
* Initialize page/subpage in case of `modepage -d`.Alexander Motin2019-09-091-6/+7
| | | | | | | | | | | | Previously without -m parameter it worked mostly by concodence. While there, make page/subpage values validation more strict. MFC after: 5 days Sponsored by: iXsystems, Inc. Notes: svn path=/head/; revision=352111
* Add one more error message to r352082.Alexander Motin2019-09-091-1/+2
| | | | | | | | MFC after: 5 days Sponsored by: iXsystems, Inc. Notes: svn path=/head/; revision=352103
* Fix number of problems found while testing on SAT devices.Alexander Motin2019-09-091-313/+267
| | | | | | | | | | | | | | | | | | | | | - Remove incomplete and dangerous ata_res decoding from ata_do_cmd(). Instead switch all functions that need the result to use get_ata_status(), doing the same, but more careful, also reducing code duplication. - Made get_ata_status() to also decode fixed format sense. In many cases it is still not enough to make it useful, since it can only report results of 28-bit command, but it is slightly better then nothing. - Organize error reporting in ata_do_cmd(), so that if caller specified AP_FLAG_CHK_COND, it is responsible for command errors (non-ioctl ones). - Make HPA/AMA errors not fatal for `identify` subcommand. - Fix reprobe() not being called on HPA/AMA when in quiet mode. - Remove not very useful messages from `format` and `sanitize` commands with -y flag. Once they started, they often can't be stopped any way. MFC after: 5 days Sponsored by: iXsystems, Inc. Notes: svn path=/head/; revision=352082
* Unify cam_send_ccb() error reporting.Alexander Motin2019-09-073-126/+17
| | | | | | | | | | | | Error there mean that command was not even executed, and all information we have about it is errno, and cam_error_print() call is not very useful. Plus it is most likely a programmatic error, that shoud not happen. MFC after: 1 week Sponsored by: iXsystems, Inc. Notes: svn path=/head/; revision=352018
* Supply SAT layer with valid transfer sizes.Alexander Motin2019-09-072-171/+135
| | | | | | | | | | | | | | | | | | | | This is a rework of r344701, that noticed that number of bytes passes to 8 bit sector count field gets truncated. First decision was to not pass anything, since ATA specs define the field as N/A. But it appeared to be a problem for some SAT devices, that require information about data transfer to operate properly. Some additional investigation shown that it is quite a common practice to set unused fields of ATA commands (fortunately ATA specs formally allow it) to supply the information to SAT layer. I have found SAS-SATA interposer that does not allow pass-through without it. As side effect, reduce code duplication by removing ata_do_28bit_cmd() function, replacing it with more universal ata_do_cmd(). MFC after: 1 week Sponsored by: iXsystems, Inc. Notes: svn path=/head/; revision=352011
* Make GCC happy about math in r350676.Alexander Motin2019-08-071-4/+1
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=350677
* Make `camcontrol modepage` support block descriptors.Alexander Motin2019-08-074-43/+273
| | | | | | | | | | | | | | | | | | | | It allows to read and write block descriptors alike to mode page parameters. It allows to change block size or short-stroke HDDs or overprovision SSDs. Depenting on -P parameter the change can be either persistent or till reset. In case of block size change device may need reformat after the setting. In case of SSD overprovisioning format or sanitize may be needed to really free the flash. During implementation appeared that csio_encode_visit() can not handle integers of more then 4 bytes, that makes 8-byte LBA handling awkward. I had to split it into two 4-byte halves now. MFC after: 1 week Relnotes: yes Sponsored by: iXsystems, Inc. Notes: svn path=/head/; revision=350676
* Make `camcontrol modepage` to use 10 byte commands.Alexander Motin2019-07-304-120/+184
| | | | | | | | | | | | | | While old devices may not support 10 byte MODE SENSE/MODE SELECT commands, new ones may not be able to report all mode pages with 6 byte commands. This patch makes camcontrol by default start with 10 byte commands and fall back to 6 byte on ILLEGAL REQUEST error, or 6 byte can be forced. MFC after: 2 weeks Sponsored by: iXsystems, Inc. Notes: svn path=/head/; revision=350457
* Use present now scsi_mode_sense_subpage().Alexander Motin2019-07-291-9/+2
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=350424
* Decode some more IDENTIFY DEVICE bits.Alexander Motin2019-07-281-15/+31
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=350393
* Make `camcontrol sanitize` support also ATA devices.Alexander Motin2019-07-252-181/+331
| | | | | | | | | | | | | 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 `camcontrol hpa` and `camcontrol ama` trigger reprobe.Alexander Motin2019-07-231-4/+8
| | | | | | | | | | This makes OS automatically see the disk's new disk size. MFC after: 2 weeks Sponsored by: iXsystems, Inc. Notes: svn path=/head/; revision=350257
* Unify BTL parsing for `camcontrol debug` and `reset`.Alexander Motin2019-07-222-172/+132
| | | | | | | | | | | | This makes `camcontrol debug` also allow peripheral device specification. While there, make BTL parser more strict and switch from strtok() to strsep(). MFC after: 2 weeks Notes: svn path=/head/; revision=350214
* Properly report ACS revisions alike to kernel.Alexander Motin2019-07-191-1/+14
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=350150
* Add Accessible Max Address Configuration support to camcontrol.Alexander Motin2019-07-192-10/+311
| | | | | | | | | | | | | | | | 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
* Use a different approach to range check.Warner Losh2019-07-151-1/+1
| | | | | | | | | | gcc hates dt < CC_DT_NONE since it can never be true when dt is an unsigned type. Since that's a compiler choice and may be affected by weird stuff, instead use (unsigned)dt > CC_DT_UNKNOWN to test for bounds error since that will work regardless of the signedness of dt. Notes: svn path=/head/; revision=350020
* Implement a devtype command.Warner Losh2019-07-152-16/+88
| | | | | | | | | | | | | | | List the device's protocol. The returned value is one of the following: ata direct attach ATA or SATA device satl a SATA device attached via SAS scsi A parallel SCSI or SAS nvme A direct attached NVMe device mmcsd A MMC or SD attached device Reviewed by: scottl@, rpokala@ Differential Revision: https://reviews.freebsd.org/D20950 Notes: svn path=/head/; revision=350018
* Use the more proper term of SATL instead of ATA_BEHIND_SCSI.Warner Losh2019-07-155-8/+8
| | | | | | | | | | | Most people know SAS attached SATA devices by the name SAT or SATL (with the latter being a little more common). Change the device type ATA_BEHIND_SCSI to SATL since it's more specific and meaningful. Suggested by: scottl@ Notes: svn path=/head/; revision=350008
* Add device type NVME and device type MMCSD to get_device_typeWarner Losh2019-07-132-0/+10
| | | | | | | | For completeness, add nvme and mmc/sd devices to the list of device types we know. Notes: svn path=/head/; revision=349964
* Retire support for -DMINIMALISTICWarner Losh2019-07-122-48/+0
| | | | | | | | | | | We've not used this in years since we retired sysinstall, and it hasn't compiled in at least a year. A full camcontrol is only 180k, so making it smaller is not as important as it once was. OK'd by: ken@, scottl@ Notes: svn path=/head/; revision=349936
* Replay r349341 by imp accidentally reverted by r349352Warner Losh2019-06-251-21/+3
| | | | | | | Use ata_param_fixup instead of a custom copy here Notes: svn path=/head/; revision=349359
* Remove NAND and NANDFS supportWarner Losh2019-06-251-3/+21
| | | | | | | | | | | | | | | | | | | | | 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
* Use ata_param_fixup instead of a custom copy hereWarner Losh2019-06-241-21/+3
| | | | Notes: svn path=/head/; revision=349341
* Increase the timeout for READ NATIVE MAXWarner Losh2019-06-131-1/+1
| | | | | | | | READ NATIVE MAX can take longer than a second if the queued NCQ I/Os take longer than a second to drain. Notes: svn path=/head/; revision=349010
* Add ATA power mode support to camcontrolSteven Hartland2019-04-232-4/+80
| | | | | | | | | | | | Add the ability to report ATA device power mode with the cmmand 'powermode' to compliment the existing ability to set it using idle, standby and sleep commands. MFC after: 2 weeks Sponsored by: Multiplay Notes: svn path=/head/; revision=346594
* Add new fields to mmc_data in preparation to SDIO CMD53 block mode supportIlya Bakulin2019-04-101-0/+1
| | | | | | | | | | | | | | | | SDIO command CMD53 (IO_RW_EXTENDED) allows data transfers using blocks of 1-2048 bytes, with a maximum of 511 blocks per request. Extend mmc_data structure to properly describe such requests, and initialize the new fields in kernel and userland consumers. No actual driver changes happen yet, these will follow in the separate changes. Reviewed by: bz Approved by: imp (mentor) Differential Revision: https://reviews.freebsd.org/D19779 Notes: svn path=/head/; revision=346097
* Make WD and WDC aliases for HGST.Warner Losh2019-03-211-0/+4
| | | | | | | | | | | | | | | | HGST was bought by WDC. Over the years, it has sold different drives branded as HGST, WD or WDC. All of them need the HGST workaround of sending 4k-sized packets (or multiples of 4k). And the ones that don't really need this aren't broken by this change. Submitter is the vendor who has tested these changes on a number of drives. I've simplified it slightly, since we don't need additional vendors for this at this time. Submitted by: JacobBurley via github on behalf of WDC Pull Request: https://github.com/freebsd/freebsd/pull/391 Notes: svn path=/head/; revision=345363
* camcontrol.8: Bump date after r345051Mateusz Piotrowski2019-03-121-1/+1
| | | | | | | | | | Reviewed by: bcr Approved by: bcr (doc) Approved by: krion (mentor, implicit), mat (mentor, implicit) Differential Revision: https://reviews.freebsd.org/D19555 Notes: svn path=/head/; revision=345060
* Add -l to camcontrol readcap.Warner Losh2019-03-122-3/+17
| | | | | | | | | | | | | | | | | | | The -l flag sends only the READ CAPACITY (16) sevice action. Normally we send the READ CAPACITY (10) command, and only send RC16 when the capacity is larger than 2TB (since that's the max RC10 can report). However, some badly programmed drives report different numbers for RC10 and RC16. This can be hard to diagnose, but generally there's a "Logical block address out of range" error when RC16 reports a larger number than RC10 and the RC10 number is the correct one. By comparing the output of readcap with and without the -l argmuent, one can determine if there's a mismatch and if the DA_Q_NO_RC16 quirk is needed. Reviewed by: ken@ Differential Revision: https://reviews.freebsd.org/D19536 Notes: svn path=/head/; revision=345051
* Fix incorrect / unused sector_count for identify requestsSteven Hartland2019-03-011-3/+2
| | | | | | | | | | | | | Fix incorrect / unused sector_count for identify requests from camcontrol. Submitted by: Alexey Dokuchaev Reported by: Alexey Dokuchaev MFC after: 1 week Sponsored by: Multiplay Differential Revision: https://reviews.freebsd.org/D19408 Notes: svn path=/head/; revision=344701
* NVME support is only for x86 and powerpc64.Warner Losh2018-06-142-1/+19
| | | | | | | | | | | | | | | | Implement MK_NVME now that the expression for where NVMe is complicated. Default it to "yes" for x86 and powerpc64 and no everywhere else. Use it in camcontrol to define WITH_NVME for those platforms where we support nvme. This should fix the newly introduced nvme files to camcontrol which were building everywhere. Pointy Hat To: imp Sponsored by: Netflix Notes: svn path=/head/; revision=335101
* Make camcontrol identify work with nda devicesWarner Losh2018-06-132-14/+58
| | | | | | | | | | | | | | | Both ATA and NVME have an identify command. They are completely different, but to the user they are the same. Leverage nvmecontrol's print_controller code to provide that functionality to camcontrol identify. Query the path to see what kind of protocol it supports, and send the most appropriate command down. Refactor nvme_print_dev a little to make it easy to get the nvme cdata. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D15371 Notes: svn path=/head/; revision=335092
* nda protocol rate reportingWarner Losh2018-05-091-0/+15
| | | | | | | | | | | | Report the NVMe spec, number of lanes (and max) as well as the PCIe generation we're negotiated at (and max) for the camcontrol rate command. Reviewed by: scottl (the output, not the code) Sponsored by: Netflix Notes: svn path=/head/; revision=333424
* Strip trailing whitespace.Edward Tomasz Napierala2018-04-101-22/+22
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=332351
* Revert ABI breakage to CAM that came in with MMC/SD support in r320844.Scott Long2018-01-191-3/+39
| | | | | | | | | | | | Make it possible to retrieve mmc parameters via the XPT_GET_ADVINFO call instead. Convert camcontrol to the new scheme. Reviewed by: imp. kibab Sponsored by: Netflix Differential Revision: D13868 Notes: svn path=/head/; revision=328165
* Refactor code related to 'camcontrol devlist'Scott Long2018-01-101-49/+90
| | | | | | | Obtained from: Netflix Notes: svn path=/head/; revision=327762
* Implement the ability to query NVME for its controller data so that it willScott Long2018-01-101-0/+59
| | | | | | | | | be shown when issueing the 'camcontrol devlist' command. Obtained from: Netflix Notes: svn path=/head/; revision=327761
* various: general adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-276-2/+14
| | | | | | | | | | | | | | | | | 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. No functional change intended. Notes: svn path=/head/; revision=326276
* Print ZAC device type in "camcontrol identify" outputAlan Somers2017-11-201-0/+12
| | | | | | | | | | | | | | | ZAC (Zoned-device ATA Command set) is the standard for addressing SMR (shingled magnetic recording) devices over SATA. Drives indicate their support for ZAC in their IDENTIFY block. Print whether and how a drive supports ZAC in the output of "camcontrol identify". Reviewed by: ken, imp MFC after: 3 weeks Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D13171 Notes: svn path=/head/; revision=326032
* DIRDEPS_BUILD: Update dependencies.Bryan Drewery2017-10-311-1/+0
| | | | | | | Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=325188