summaryrefslogtreecommitdiffstats
path: root/sbin/camcontrol
Commit message (Collapse)AuthorAgeFilesLines
* Add support for reading MAM attributes to camcontrol(8) and libcam(3).ken2015-06-095-2/+684
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MAM is Medium Auxiliary Memory and is most commonly found as flash chips on tapes. This includes support for reading attributes and decoding most known attributes, but does not yet include support for writing attributes or reporting attributes in XML format. libsbuf/Makefile: Add subr_prf.c for the new sbuf_hexdump() function. This function is essentially the same function. libsbuf/Symbol.map: Add a new shared library minor version, and include the sbuf_hexdump() function. libsbuf/Version.def: Add version 1.4 of the libsbuf library. libutil/hexdump.3: Document sbuf_hexdump() alongside hexdump(3), since it is essentially the same function. camcontrol/Makefile: Add attrib.c. camcontrol/attrib.c: Implementation of READ ATTRIBUTE support for camcontrol(8). camcontrol/camcontrol.8: Document the new 'camcontrol attrib' subcommand. camcontrol/camcontrol.c: Add the new 'camcontrol attrib' subcommand. camcontrol/camcontrol.h: Add a function prototype for scsiattrib(). share/man/man9/sbuf.9: Document the existence of sbuf_hexdump() and point users to the hexdump(3) man page for more details. sys/cam/scsi/scsi_all.c: Add a table of known attributes, text descriptions and handler functions. Add a new scsi_attrib_sbuf() function along with a number of other related functions that help decode attributes. scsi_attrib_ascii_sbuf() decodes ASCII format attributes. scsi_attrib_int_sbuf() decodes binary format attributes, and will pass them off to scsi_attrib_hexdump_sbuf() if they're bigger than 8 bytes. scsi_attrib_vendser_sbuf() decodes the vendor and drive serial number attribute. scsi_attrib_volcoh_sbuf() decodes the Volume Coherency Information attribute that LTFS writes out. sys/cam/scsi/scsi_all.h: Add a number of attribute-related structure definitions and other defines. Add function prototypes for all of the functions added in scsi_all.c. sys/kern/subr_prf.c: Add a new function, sbuf_hexdump(). This is the same as the existing hexdump(9) function, except that it puts the result in an sbuf. This also changes subr_prf.c so that it can be compiled in userland for includsion in libsbuf. We should work to change this so that the kernel hexdump implementation is a wrapper around sbuf_hexdump() with a statically allocated sbuf with a drain. That will require a drain function that goes to the kernel printf() buffer that can take a non-NUL terminated string as input. That is because an sbuf isn't NUL-terminated until it is finished, and we don't want to finish it while we're still using it. We should also work to consolidate the userland hexdump and kernel hexdump implemenatations, which are currently separate. This would also mean making applications that currently link in libutil link in libsbuf. sys/sys/sbuf.h: Add the prototype for sbuf_hexdump(), and add another copy of the hexdump flag values if they aren't already defined. Ideally the flags should be defined in one place but the implemenation makes it difficult to do properly. (See above.) Sponsored by: Spectra Logic Corporation MFC after: 1 week
* Remove unused variables reported by clang.araujo2015-06-022-5/+2
| | | | | Differential Revision: D2688 Reviewed by: rodrigc, mav
* Remove End Of Line whitespacesbapt2015-04-261-3/+3
|
* Fix minor mdoc issues.joel2015-04-241-1/+0
|
* Add camcontrol subcommands to control APM and AAM levels.mav2015-03-192-3/+99
| | | | | MFC after: 1 week Sponsored by: iXsystems, Inc.
* Make ATA power management commands to work on SCSI HBAs via PASS THROUGH.mav2015-03-171-32/+14
| | | | | MFC after: 2 weeks Sponsored by: iXsystems, Inc.
* Make sure that the flags for the XPT_DEV_ADVINFO CCB are initializedken2015-02-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | properly. If there is garbage in the flags field, it can sometimes include a set CDAI_FLAG_STORE flag, which may cause either an error or perhaps result in overwriting the field that was intended to be read. sys/cam/cam_ccb.h: Add a new flag to the XPT_DEV_ADVINFO CCB, CDAI_FLAG_NONE, that callers can use to set the flags field when no store is desired. sys/cam/scsi/scsi_enc_ses.c: In ses_setphyspath_callback(), explicitly set the XPT_DEV_ADVINFO flags to CDAI_FLAG_NONE when fetching the physical path information. Instead of ORing in the CDAI_FLAG_STORE flag when storing the physical path, set the flags field to CDAI_FLAG_STORE. sys/cam/scsi/scsi_sa.c: Set the XPT_DEV_ADVINFO flags field to CDAI_FLAG_NONE when fetching extended inquiry information. sys/cam/scsi/scsi_da.c: When storing extended READ CAPACITY information, set the XPT_DEV_ADVINFO flags field to CDAI_FLAG_STORE instead of ORing it into a field that isn't initialized. sys/dev/mpr/mpr_sas.c, sys/dev/mps/mps_sas.c: When fetching extended READ CAPACITY information, set the XPT_DEV_ADVINFO flags field to CDAI_FLAG_NONE instead of setting it to 0. sbin/camcontrol/camcontrol.c: When fetching a device ID, set the XPT_DEV_ADVINFO flags field to CDAI_FLAG_NONE instead of 0. sys/sys/param.h: Bump __FreeBSD_version to 1100061 for the new XPT_DEV_ADVINFO CCB flag, CDAI_FLAG_NONE. Sponsored by: Spectra Logic MFC after: 1 week
* Improve camcontrol(8) handling of drive defect data.ken2015-01-082-184/+453
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This includes a new summary mode (-s) for camcontrol defects that quickly tells the user the most important thing: how many defects are in the requested list. The actual location of the defects is less important. Modern drives frequently have more than the 8191 defects that can be reported by the READ DEFECT DATA (10) command. If they don't have that many grown defects, they certainly have more than 8191 defects in the primary (i.e. factory) defect list. The READ DEFECT DATA (12) command allows for longer parameter lists, as well as indexing into the list of defects, and so allows reporting many more defects. This has been tested with HGST drives and Seagate drives, but does not fully work with Seagate drives. Once I have a Seagate spec I may be able to determine whether it is possible to make it work with Seagate drives. scsi_da.h: Add a definition for the new long block defect format. Add bit and mask definitions for the new extended physical sector and bytes from index defect formats. Add a prototype for the new scsi_read_defects() CDB building function. scsi_da.c: Add a new scsi_read_defects() CDB building function. camcontrol(8) was previously composing CDBs manually. This is long overdue. camcontrol.c: Revamp the camcontrol defects subcommand. We now go through multiple stages in trying to get defect data off the drive while avoiding various drive firmware quirks. We start off by requesting the defect header with the 10 byte command. If we're in summary mode (-s) and the drive reports fewer defects than can be represented in the 10 byte header, we're done. Otherwise, we know that we need to issue the 12 byte command if the drive reports the maximum number of defects. If we're in summary mode, we're done if we get a good response back when asking for the 12 byte header. If the user has asked for the full list, then we use the address descriptor index field in the 12 byte CDB to step through the list in 64K chunks. 64K is small enough to work with most any ancient or modern SCSI controller. Add support for printing the new long block defect format, as well as the extended physical sector and bytes from index formats. I don't have any drives that support the new formats. Add a hexadecimal output format that can be turned on with -X. Add a quiet mode (-q) that can be turned on with the summary mode (-s) to just print out a number. Revamp the error detection and recovery code for the defects command to work with HGST drives. Call the new scsi_read_defects() CDB building function instead of rolling the CDB ourselves. Pay attention to the residual from the defect list request when printing it out, so we don't run off the end of the list. Use the new scsi_nv library routines to convert from strings to numbers and back. camcontrol.8: Document the new defect formats (longblock, extbfi, extphys) and command line options (-q, -s, -S and -X) for the defects subcommand. Explain a little more about what drives generally do and don't support. Sponsored by: Spectra Logic MFC after: 1 week
* mdoc: paragraph improvements.joel2015-01-041-3/+2
|
* mdoc: remove EOL whitespace.joel2014-12-291-7/+7
|
* Convert sbin/ to LIBADDbapt2014-11-251-2/+1
| | | | Reduce overlinking
* Attempt to report a better error if sanitize is not supportedbryanv2014-11-091-8/+24
| | | | MFC after: 1 month
* Update CAM CCB accounting for the new status quo.mav2014-09-141-2/+2
| | | | | | | | | | | | devq_openings counter lost its meaning after allocation queues has gone. held counter is still meaningful, but problematic to update due to separate locking of CCB allocation and queuing. To fix that replace devq_openings counter with allocated counter. held is now calculated on request as difference between number of allocated, queued and active CCBs. MFC after: 1 month
* Fix character case in examples for "camcontrol security" - should begavin2014-08-311-3/+3
| | | | | | | | "-U user" not "-u user". PR: 193179 Submitted by: milios ccsys com MFC after: 3 days
* Add persistent reservation support to camcontrol(8).ken2014-07-035-9/+1351
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | camcontrol(8) now supports a new 'persist' subcommand that allows users to issue SCSI PERSISTENT RESERVE IN / OUT commands. sbin/camcontrol/Makefile: Add persist.c. sbin/camcontrol/persist.c: New persistent reservation support for camcontrol(8). We have support for all known operation modes for PERSISTENT RESERVE IN and PERSISTENT RESERVE OUT. exceptions noted above. sbin/camcontrol/camcontrol.8: Document the new 'persist' subcommand. In the section on the Transport ID (-I) option, explain what Transport IDs for each protocol should look like. At some point some of this information could probably get moved off in a separate man page, either on Transport IDs alone or a man page documenting the Transport ID parsing code. Add a number of examples of persistent reservation commands. Persistent Reservations are complex enough that the average user probably won't be able to get the commands exactly right by just reading the man page. These examples show a few basic and advanced examples of how to use persistent reservations. sbin/camcontrol/camcontrol.h: Move the definition for camcontrol_optret here, so we can use it for the persistent reservation code. Add a definition for the new scsipersist() function. sbin/camcontrol/camcontrol.c: Add 'persist' to the list of subcommands. Document 'persist' in the help text. sys/cam/scsi/scsi_all.c: Add the scsi_persistent_reserve_in() and scsi_persistent_reserve_out() CCB building functions. Add a new function, scsi_transportid_sbuf(). This takes a SCSI Transport ID (documented in SPC-4), and prints it to an sbuf(9). There are some transports (like ATA, USB, and SSA) for which there is no transport defined. We need to come up with a reasonable thing to do if we're presented with a Transport ID that claims to be for one of those protocols. Add new routines scsi_get_nv() and scsi_nv_to_str(). These functions do a table lookup to go between a string and an integer. There are lots of table lookups needed in the persistent reservation code in camcontrol(8). Add a new function, scsi_parse_transportid(), along with leaf node functions to parse: FC, 1394 and SAS (scsi_parse_transportid_64bit()) iSCSI (scsi_parse_transportid_iscsi()) SPI (scsi_parse_transportid_spi()) RDMA (scsi_parse_transportid_rdma()) PCIe (scsi_parse_transportid_sop()) Transport IDs. Given a string with the general form proto,id these functions create a SCSI Transport ID structure. sys/cam/scsi/scsi_all.h: Update the various persistent reservation data structures to SPC4r36l, but also rename some fields that were previously obsolete with the proper names from older SCSI specs. This allows using older, obsolete persistent reservation types when desired. Add function prototypes for the new persistent reservation CCB building functions. Add a data strucure for the READ FULL STATUS service action of the PERSISTENT RESERVE IN command. Add Transport ID structures for all protocols described in SPC-4. Add a new series of SCSI_PROTO_XXX definitions, and redefine other defines in terms of these new definitions. Add a prototype for scsi_transportid_sbuf(). Change a couple of "obsolete" persistent reservation data structure fields into something more meaningful, based on what the field was called when it was defined in the spec. (e.g. SPC, SPC-2, etc.) Create a new define, SPRI_MAX_LEN, for the maximum allocation length allowed for the PERSISTENT RESERVE IN command. Add data structures and enumerations for the new name/value translation functions. Add data structures for SCSI over PCIe Routing IDs. Bring the PERSISTENT RESERVE OUT Register and Move parameter list structure (struct scsi_per_res_out_parms) up to date with SPC-4. Add a data structure for the transport IDs that can optionally be appended to the basic PERSISTENT RESERVE OUT parameter list. Move SCSI protocol macro definitions out of the VPD page 0x83 definition and combine them with the more up to date protocol definitions higher in the file. Add function prototypes for scsi_nv_to_str(), scsi_get_nv(), scsi_parse_transportid_64bit(), scsi_parse_transportid_spi(), scsi_parse_transportid_rdma(), scsi_parse_transportid_iscsi(), scsi_parse_transportid_sop(), and scsi_parse_transportid(). Sponsored by: Spectra Logic Corporation MFC after: 1 week
* use .Mt to mark up email addresses consistently (part1)bapt2014-06-201-1/+1
| | | | | PR: 191174 Submitted by: Franco Fichtner <franco@lastsummer.de>
* Add information about supported NCQ functionality to camcontrol identify.smh2014-04-241-0/+26
| | | | MFC after: 2 weeks
* Replace several instances of -1 with appropriate CAM_*_WILDCARD and types.mav2014-01-101-22/+30
| | | | | | It was equal before r259397, but for good or bad, not any more for LUNs. This change fixes at least CAM debugging.
* getopt returns an int, not a char, so use the correct data type forscottl2013-12-301-1/+1
| | | | | | the return value. Fixes powerpc tinderbox. MFC after: 2 days
* Add the '-b' flag to 'camcontrol devlist'. This prints only the existingscottl2013-12-292-8/+31
| | | | | | | buses and their parent sims, useful for creating a sim->bus->device map. Obtained from: Netflix MFC after: 3 days
* printf() specifier updates to CAM to handle either 32-bit or 64-bit lun_id_t.nwhitehorn2013-10-301-2/+2
| | | | MFC after: 2 weeks
* Fix mode page length calculation to remove last garbage line from themav2013-10-111-2/+2
| | | | | | | | `camcontrol mode daX -l` output. PR Approved by: re (gjb) MFC after: 2 weeks
* 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.
OpenPOWER on IntegriCloud