summaryrefslogtreecommitdiffstats
path: root/sbin/camcontrol
Commit message (Collapse)AuthorAgeFilesLines
* MFC r268240 (by ken):mav2014-07-155-9/+1351
| | | | | | | Add persistent reservation support to camcontrol(8). camcontrol(8) now supports a new 'persist' subcommand that allows users to issue SCSI PERSISTENT RESERVE IN / OUT commands.
* MFC r264863smh2014-05-081-0/+26
| | | | | | Add information about supported NCQ functionality to camcontrol identify. Sponsored by: Multiplay
* MFC r260509:mav2014-05-081-22/+30
| | | | | | | | Replace several instances of -1 with appropriate CAM_*_WILDCARD and types. It was equal before r259397, but for good or bad, not any more for LUNs. This change fixes at least CAM debugging.
* MFC r260059, r260087:scottl2014-01-022-8/+31
| | | | | | | Add the '-b' flag to 'camcontrol devlist'. This prints only the existing buses and their parent sims, useful for creating a sim->bus->device map. Obtained from: Netflix
* MFC r257345,257382,257388:nwhitehorn2013-12-101-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | Implement extended LUN support. If PIM_EXTLUNS is set by a SIM, encode the upper 32-bits of the LUN, if possible, into the target_lun field as passed directly from the REPORT LUNs response. This allows extended LUN support to work for all LUNs with zeros in the lower 32-bits, which covers most addressing modes without breaking KBI. Behavior for drivers not setting PIM_EXTLUNS is unchanged. No user-facing interfaces are modified. Extended LUNs are stored with swizzled 16-bit word order so that, for devices implementing LUN addressing (like SCSI-2), the numerical representation of the LUN is identical with and without PIM_EXTLUNS. Thus setting PIM_EXTLUNS keeps most behavior, and user-facing LUN IDs, unchanged. This follows the strategy used in Solaris. A macro (CAM_EXTLUN_BYTE_SWIZZLE) is provided to transform a lun_id_t into a uint64_t ordered for the wire. This is the second part of work for full 64-bit extended LUN support and is designed to a bridge for stable/10 to the final 64-bit LUN code. The third and final part will involve widening lun_id_t to 64 bits and will not be MFCed. This third part will break the KBI but will keep the KPI unchanged so that all drivers that will care about this can be updated now and not require code changes between HEAD and stable/10. Reviewed by: scottl
* MFC r256317:mav2013-10-111-2/+2
| | | | | | | Fix mode page length calculation to remove last garbage line from the `camcontrol mode daX -l` output. Approved by: re (gjb)
* Fix an inverted check for the master user in "camcontrol security -U".markj2013-10-081-1/+1
| | | | | | | PR: bin/182703 Submitted by: Scott Burns <scott@bqinternet.com> Approved by: re (gjb) MFC after: 3 days
* Fix resource leaksemaste2013-10-071-0/+2
| | | | | Found by: Coverity Scan, CID 1016673, 1007118 Approved by: re
* - Begin sentence on a new line.joel2013-09-071-14/+25
| | | | - Minor language fixes.
* Bump .Dd after r255307 and r255310bryanv2013-09-061-1/+1
| | | | Requested by: joel
* Add firmware downloading support for Samsung drivesbryanv2013-09-062-0/+4
| | | | Tested on Samsung SM1625 SSDs.
* Add camcontrol support for the SCSI sanitize commandbryanv2013-09-062-1/+544
| | | | | Reviewed by: ken, mjacob (eariler version) Sponsored by: Netapp
* Add missing newlines to Fibre Channel attributes output.mav2013-08-271-3/+3
|
* Improve firmware download status check. Previous check was insufficient formav2013-06-141-5/+3
| | | | | ATA since it ignored transport errors like command timeouts, while for SCSI it was just wrong.
* Fix build after r251654.mav2013-06-121-4/+4
|
* Use CAM_DIR_NONE for requests without data.mav2013-06-121-4/+4
| | | | | | Wrong values there confuse some drivers. MFC after: 1 week
* sbin/camcontrol/camcontrol.casomers2013-05-151-2/+6
| | | | | | | | | | | | If an expander returns 0x00 (no device attached) in the ATTACHED DEVICE field of the SMP DISCOVER response, ignore the value of ATTACHED SAS ADDRESS, because it is invalid. Some expanders zero out the address when the attached device is removed, but others do not. Section 9.4.3.10 of the SAS Protocol Layer 2 revision 04b does not require them to do so. Approved by: ken (mentor) MFC after: 3 weeks
* mdoc: remove superfluous paragraph macro.joel2013-04-251-2/+0
|
* Adds Host Protected Area (HPA) support for ATA disks to camcontrolsmh2013-04-252-2/+785
| | | | | | Reviewed by: mav Approved by: pjd (mentor) MFC after: 2 weeks
* Remove contractions.joel2013-04-111-1/+1
|
* Prevent the creation of an unused variable.ed2013-04-081-1/+1
| | | | | | | We're only interested in the enumeration fields; we don't want to create a variable to store them. MFC after: 1 week
* mdoc: new sentence should be on a new line. Also remove EOL whitespace whilejoel2013-04-061-3/+4
| | | | here.
* mdoc: remove superfluous paragraph macro.joel2013-04-051-3/+0
|
* Adds security options to camcontrol this includes the ability to secure erasesmh2013-04-042-61/+1110
| | | | | | | | | | disks such as SSD's Adds the ability to run ATA commands via the SCSI ATA Pass-Through(16) comand Reviewed by: mav Approved by: pjd (mentor) MFC after: 2 weeks
* More -Wmissing-variable-declarations fixes.ed2012-10-194-14/+15
| | | | | | | | | | | | | | | | In addition to adding `static' where possible: - bin/date: Move `retval' into extern.h to make it visible to date.c. - bin/ed: Move globally used variables into ed.h. - sbin/camcontrol: Move `verbose' into camcontrol.h and fix shadow warnings. - usr.bin/calendar: Remove unneeded variables. - usr.bin/chat: Make `line' local instead of global. - usr.bin/elfdump: Comment out unneeded function. - usr.bin/rlogin: Use _Noreturn instead of __dead2. - usr.bin/tset: Pull `Ospeed' into extern.h. - usr.sbin/mfiutil: Put global variables in mfiutil.h. - usr.sbin/pkg: Remove unused `os_corres'. - usr.sbin/quotaon, usr.sbin/repquota: Remove unused `qfname'.
* Check the return value of sbuf_finish().jh2012-08-231-2/+8
|
* Avoid segfault in the 'smpphylist' subcommand.pluknet2012-08-201-1/+1
| | | | | | | | | Initialize devlist.dev_queue tail queue early enough before its any potential traversal in freebusdevlist() when in smpphylist error path. Reported by: Pavel Polyakov <bsd kobyla org> (on irc) Reviewed by: ken MFC after: 5 days
* In sbin/camcontrol/camcontrol.c, function smpcmd(), initialize thedim2012-08-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 'error' variable to zero, to avoid returning garbage in several cases. This fixes the following clang 3.2 warnings: sbin/camcontrol/camcontrol.c:4634:8: warning: variable 'error' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized] if (amt_written == -1) { ^~~~~~~~~~~~~~~~~ sbin/camcontrol/camcontrol.c:4656:10: note: uninitialized use occurs here return (error); ^~~~~ sbin/camcontrol/camcontrol.c:4619:7: warning: variable 'error' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized] if (fd_response == 0) { ^~~~~~~~~~~~~~~~ sbin/camcontrol/camcontrol.c:4656:10: note: uninitialized use occurs here return (error); ^~~~~ sbin/camcontrol/camcontrol.c:4617:6: warning: variable 'error' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized] if (((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sbin/camcontrol/camcontrol.c:4656:10: note: uninitialized use occurs here return (error); ^~~~~ MFC after: 1 week
* Change 'camcontrol defects' to first probe a drive to find out how muchken2012-06-222-7/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | defect information it has before grabbing the full defect list. This works around a bug with some Hitachi drives that generate data overrun errors when they are asked for more defect data than they have. The change is done in a spec-compliant way, so it should have no negative impact on drives that don't have this issue. This is based on work originally done at Sandvine. scsi_da.h: Add a define for the maximum amount of data that can be contained in a defect list. camcontrol.c: Update the readdefects() function to issue an initial command to determine the length of the defect list, and then use that length in the request for the full defect list. camcontrol.8: Add a note that some drives will report 0 defects available if you don't request either the PLIST or GLIST. Submitted by: Mark Johnston <markjdb@gmail.com> (original version) MFC after: 3 days
* Add progress.c and progress.h, missed in the previous commit to camcontrol.scottl2012-06-202-0/+246
| | | | | Submitted by: Garrett Cooper Obtained from: Netflix, Inc.
* Update the 'fwdownload' command to also flash disks connected over anscottl2012-06-204-66/+167
| | | | | | | | | | ATA/SATA transport. The detection logic is automatic, so it should Just Work. While here, also improve the progress meter that is displayed during firmware download. Submitted by: Alistair Crooks Obtained from: Netflix, Inc. MFC after: 3 days
* Minor spelling fixes.joel2012-06-051-2/+2
|
* Add -p argument for `camcontrol debug` to allow enabling CAM_DEBUG_PROBEmav2012-06-042-3/+11
| | | | added at r208911.
* Rewrite enabling NCQ for SATA devices in a way more alike to SCSI TCQ.mav2012-06-021-43/+93
| | | | | | | This allows to control it with `camcontrol negotiate adaX -T (en|dis)able` on the fly, same as for SCSI devices. Sponsored by: iXsystems, Inc.
* Add missing flag enable when certain arguments are parsedeadler2012-05-301-0/+1
| | | | | | | PR: bin/163053 Submitted by: Peter <pmc@citylink.dinoex.sub.org> Approved by: cperciva MFC after: 1 week
* MFprojects/zfsd:mav2012-05-241-1/+20
| | | | | | | | - Add low-level support for SATA Enclosure Management Bridge (SEMB) devices -- SATA equivalents of the SCSI SES/SAF-TE devices. - Add some utility functions for SCSI SAF-TE devices access. Sponsored by: iXsystems, Inc.
* Remove trailing whitespace per mdoc lint warningeadler2012-03-291-2/+2
| | | | | | | Disussed with: gavin No objection from: doc Approved by: joel MFC after: 3 days
* Remove superfluous paragraph macro.joel2012-03-251-1/+0
|
* Fix build when RELEASE_CRUNCH is defined.nyan2012-01-291-2/+2
|
* Add CAM infrastructure to allow reporting when a drive's long read capacityken2012-01-261-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | data changes. cam_ccb.h: Add a new advanced information type, CDAI_TYPE_RCAPLONG, for long read capacity data. cam_xpt_internal.h: Add a read capacity data pointer and length to struct cam_ed. cam_xpt.c: Free the read capacity buffer when a device goes away. While we're here, make sure we don't leak memory for other malloced fields in struct cam_ed. scsi_all.c: Update the scsi_read_capacity_16() to take a uint8_t * and a length instead of just a pointer to the parameter data structure. This will hopefully make this function somewhat immune to future changes in the parameter data. scsi_all.h: Add some extra bit definitions to struct scsi_read_capacity_data_long, and bump up the structure size to the full size specified by SBC-3. Change the prototype for scsi_read_capacity_16(). scsi_da.c: Register changes in read capacity data with the transport layer. This allows the transport layer to send out an async notification to interested parties. Update the dasetgeom() API. Use scsi_extract_sense_len() instead of scsi_extract_sense(). scsi_xpt.c: Add support for the new CDAI_TYPE_RCAPLONG advanced information type. Make sure we set the physpath pointer to NULL after freeing it. This allows blindly freeing it in the struct cam_ed destructor. sys/param.h: Bump __FreeBSD_version from 1000005 to 1000006 to make it easier for third party drivers to determine that the read capacity data async notification is available. camcontrol.c, mptutil/mpt_cam.c: Update these for the new scsi_read_capacity_16() argument structure. Sponsored by: Spectra Logic
* Fix warning when compiling with gcc46:eadler2012-01-102-6/+1
| | | | | | | | | error: variable 'freq' set but not used error: variable 'mode_pars' set but not used Reviewed by: mav Approved by: dim MFC after: 3 days
* Spelling fixes for sbin/uqs2012-01-071-1/+1
|
* In sbin/camcontrol/camcontrol.c, fix a few warnings about format stringsdim2011-12-161-7/+7
| | | | | | not being literals. MFC after: 1 week
* Add missing static keywords to global variables in camcontrol.ed2011-12-112-13/+13
| | | | | While there, make the vendor list const and add appropriate keywords to functions that use this list.
* Restore comment with credit to Marc Frajola.emaste2011-12-021-0/+9
| | | | | fwdownload.c is derived from Andre Albsmeier's fwdownload.c, which was written from scratch but was inspired by Marc's original idea and code.
* Fix build.delphij2011-11-251-1/+1
|
* Add firmware update support for SCSI devices.emaste2011-11-256-29/+488
| | | | | | | | | | | | | | | | | Firmware can be reprogrammed on devices from Hitachi, HP, IBM, Plextor, Quantum, and Seagate. At least one device from each manufacturer has been tested with some version of this code, and it has been used to update thousands of drives so far. The man page suggests having a backup of the drive's data, and the operation must be confirmed, either interactively or on the command line. (This is the same as the confirmation on the format command.) This work is largely derived from fwprog.c by Andre Albsmeier. Submitted by: Nima Misaghian Sponsored by: Sandvine Incorporated MFC after: 3 months
* Add missing static keywords for global variables to tools in sbin/.ed2011-11-041-4/+4
| | | | | | These tools declare global variables without using the static keyword, even though their use is limited to a single C-file, or without placing an extern declaration of them in the proper header file.
* Add descriptor sense support to CAM, and honor sense residuals properly inken2011-10-031-8/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | CAM. Desriptor sense is a new sense data format that originated in SPC-3. Among other things, it allows for an 8-byte info field, which is necessary to pass back block numbers larger than 4 bytes. This change adds a number of new functions to scsi_all.c (and therefore libcam) that abstract out most access to sense data. This includes a bump of CAM_VERSION, because the CCB ABI has changed. Userland programs that use the CAM pass(4) driver will need to be recompiled. camcontrol.c: Change uses of scsi_extract_sense() to use scsi_extract_sense_len(). Use scsi_get_sks() instead of accessing sense key specific data directly. scsi_modes: Update the control mode page to the latest version (SPC-4). scsi_cmds.c, scsi_target.c: Change references to struct scsi_sense_data to struct scsi_sense_data_fixed. This should be changed to allow the user to specify fixed or descriptor sense, and then use scsi_set_sense_data() to build the sense data. ps3cdrom.c: Use scsi_set_sense_data() instead of setting sense data manually. cam_periph.c: Use scsi_extract_sense_len() instead of using scsi_extract_sense() or accessing sense data directly. cam_ccb.h: Bump the CAM_VERSION from 0x15 to 0x16. The change of struct scsi_sense_data from 32 to 252 bytes changes the size of struct ccb_scsiio, but not the size of union ccb. So the version must be bumped to prevent structure mis-matches. scsi_all.h: Lots of updated SCSI sense data and other structures. Add function prototypes for the new sense data functions. Take out the inline implementation of scsi_extract_sense(). It is now too large to put in a header file. Add macros to calculate whether fields are present and filled in fixed and descriptor sense data scsi_all.c: In scsi_op_desc(), allow the user to pass in NULL inquiry data, and we'll assume a direct access device in that case. Changed the SCSI RESERVED sense key name and description to COMPLETED, as it is now defined in the spec. Change the error recovery action for a number of read errors to prevent lots of retries when the drive has said that the block isn't accessible. This speeds up reconstruction of the block by any RAID software running on top of the drive (e.g. ZFS). In scsi_sense_desc(), allow for invalid sense key numbers. This allows calling this routine without checking the input values first. Change scsi_error_action() to use scsi_extract_sense_len(), and handle things when invalid asc/ascq values are encountered. Add a new routine, scsi_desc_iterate(), that will call the supplied function for every descriptor in descriptor format sense data. Add scsi_set_sense_data(), and scsi_set_sense_data_va(), which build descriptor and fixed format sense data. They currently default to fixed format sense data. Add a number of scsi_get_*() functions, which get different types of sense data fields from either fixed or descriptor format sense data, if the data is present. Add a number of scsi_*_sbuf() functions, which print formatted versions of various sense data fields. These functions work for either fixed or descriptor sense. Add a number of scsi_sense_*_sbuf() functions, which have a standard calling interface and print the indicated field. These functions take descriptors only. Add scsi_sense_desc_sbuf(), which will print a formatted version of the given sense descriptor. Pull out a majority of the scsi_sense_sbuf() function and put it into scsi_sense_only_sbuf(). This allows callers that don't use struct ccb_scsiio to easily utilize the printing routines. Revamp that function to handle descriptor sense and use the new sense fetching and printing routines. Move scsi_extract_sense() into scsi_all.c, and implement it in terms of the new function, scsi_extract_sense_len(). The _len() version takes a length (which should be the sense length - residual) and can indicate which fields are present and valid in the sense data. Add a couple of new scsi_get_*() routines to get the sense key, asc, and ascq only. mly.c: Rename struct scsi_sense_data to struct scsi_sense_data_fixed. sbp_targ.c: Use the new sense fetching routines to get sense data instead of accessing it directly. sbp.c: Change the firewire/SCSI sense data transformation code to use struct scsi_sense_data_fixed instead of struct scsi_sense_data. This should be changed later to use scsi_set_sense_data(). ciss.c: Calculate the sense residual properly. Use scsi_get_sense_key() to fetch the sense key. mps_sas.c, mpt_cam.c: Set the sense residual properly. iir.c: Use scsi_set_sense_data() instead of building sense data by hand. iscsi_subr.c: Use scsi_extract_sense_len() instead of grabbing sense data directly. umass.c: Use scsi_set_sense_data() to build sense data. Grab the sense key using scsi_get_sense_key(). Calculate the sense residual properly. isp_freebsd.h: Use scsi_get_*() routines to grab asc, ascq, and sense key values. Calculate and set the sense residual. MFC after: 3 days Sponsored by: Spectra Logic Corporation
* Fix WWN printing in `camcontrol identify` output.mav2011-08-191-1/+1
| | | | | Approved by: re (kib) MFC after: 1 week
OpenPOWER on IntegriCloud