Commit Graph

190 Commits

Author SHA1 Message Date
Simon J. Gerraty
3caf0790a8 Merge head@256284 2013-10-13 02:35:19 +00:00
Mark Johnston
e590690fad Fix an inverted check for the master user in "camcontrol security -U".
PR:		bin/182703
Submitted by:	Scott Burns <scott@bqinternet.com>
Approved by:	re (gjb)
MFC after:	3 days
2013-10-08 04:16:22 +00:00
Ed Maste
9d85dfae1e Fix resource leaks
Found by:	Coverity Scan, CID 1016673, 1007118
Approved by:	re
2013-10-07 16:45:16 +00:00
Simon J. Gerraty
d466a5b069 Merge head 2013-09-11 18:16:18 +00:00
Joel Dahl
5bb17266af - Begin sentence on a new line.
- Minor language fixes.
2013-09-07 05:44:53 +00:00
Bryan Venteicher
79c37de672 Bump .Dd after r255307 and r255310
Requested by:	joel
2013-09-06 21:26:36 +00:00
Bryan Venteicher
2872a0d81c Add firmware downloading support for Samsung drives
Tested on Samsung SM1625 SSDs.
2013-09-06 16:34:09 +00:00
Bryan Venteicher
ffead710d5 Add camcontrol support for the SCSI sanitize command
Reviewed by:	ken, mjacob (eariler version)
Sponsored by:	Netapp
2013-09-06 15:19:57 +00:00
Simon J. Gerraty
d1d0158641 Merge from head 2013-09-05 20:18:59 +00:00
Alexander Motin
27dfa8eb60 Add missing newlines to Fibre Channel attributes output. 2013-08-27 06:50:46 +00:00
Alexander Motin
126690fec1 Improve firmware download status check. Previous check was insufficient for
ATA since it ignored transport errors like command timeouts, while for SCSI
it was just wrong.
2013-06-14 08:26:58 +00:00
Alexander Motin
2c3ba49168 Fix build after r251654. 2013-06-12 19:21:23 +00:00
Alexander Motin
3c2305c3a5 Use CAM_DIR_NONE for requests without data.
Wrong values there confuse some drivers.

MFC after:	1 week
2013-06-12 16:13:05 +00:00
Alan Somers
8a20d4d1f4 sbin/camcontrol/camcontrol.c
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
2013-05-15 17:26:50 +00:00
Joel Dahl
452025cfc6 mdoc: remove superfluous paragraph macro. 2013-04-25 20:23:22 +00:00
Steven Hartland
9e68761ce0 Adds Host Protected Area (HPA) support for ATA disks to camcontrol
Reviewed by:	mav
Approved by:	pjd (mentor)
MFC after:	2 weeks
2013-04-25 14:11:38 +00:00
Simon J. Gerraty
69e6d7b75e sync from head 2013-04-12 20:48:55 +00:00
Joel Dahl
b1edef175b Remove contractions. 2013-04-11 18:46:41 +00:00
Ed Schouten
dc5929d40a Prevent the creation of an unused variable.
We're only interested in the enumeration fields; we don't want to create
a variable to store them.

MFC after:	1 week
2013-04-08 08:03:42 +00:00
Joel Dahl
e36a4a7ea0 mdoc: new sentence should be on a new line. Also remove EOL whitespace while
here.
2013-04-06 19:40:04 +00:00
Joel Dahl
791a7de998 mdoc: remove superfluous paragraph macro. 2013-04-05 11:42:28 +00:00
Steven Hartland
1146874aec Adds security options to camcontrol this includes the ability to secure erase
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
2013-04-04 23:19:51 +00:00
Simon J. Gerraty
7cf3a1c6b2 Updated dependencies 2013-03-11 17:21:52 +00:00
Simon J. Gerraty
f5f7c05209 Updated dependencies 2013-02-16 01:23:54 +00:00
Simon J. Gerraty
23090366f7 Sync from head 2012-11-04 02:52:03 +00:00
Ed Schouten
bf70becee6 More -Wmissing-variable-declarations fixes.
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'.
2012-10-19 14:49:42 +00:00
Jaakko Heinonen
5fcb06f86e Check the return value of sbuf_finish(). 2012-08-23 16:25:36 +00:00
Marcel Moolenaar
7750ad47a9 Sync FreeBSD's bmake branch with Juniper's internal bmake branch.
Requested by: Simon Gerraty <sjg@juniper.net>
2012-08-22 19:25:57 +00:00
Sergey Kandaurov
affe7c8f84 Avoid segfault in the 'smpphylist' subcommand.
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
2012-08-20 20:40:14 +00:00
Dimitry Andric
db58456d4c In sbin/camcontrol/camcontrol.c, function smpcmd(), initialize the
'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
2012-08-05 12:16:11 +00:00
Kenneth D. Merry
7027b9cda4 Change 'camcontrol defects' to first probe a drive to find out how much
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
2012-06-22 18:57:06 +00:00
Scott Long
cfc0a49549 Add progress.c and progress.h, missed in the previous commit to camcontrol.
Submitted by:   Garrett Cooper
Obtained from:  Netflix, Inc.
2012-06-20 04:11:34 +00:00
Scott Long
3ff78f8218 Update the 'fwdownload' command to also flash disks connected over an
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
2012-06-20 00:17:29 +00:00
Joel Dahl
19769ec2c7 Minor spelling fixes. 2012-06-05 18:07:20 +00:00
Alexander Motin
fbfb753fad Add -p argument for camcontrol debug to allow enabling CAM_DEBUG_PROBE
added at r208911.
2012-06-04 10:42:09 +00:00
Alexander Motin
b9c473b2ed Rewrite enabling NCQ for SATA devices in a way more alike to SCSI TCQ.
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.
2012-06-02 08:29:07 +00:00
Eitan Adler
5e4cc10b6d Add missing flag enable when certain arguments are parsed
PR:		bin/163053
Submitted by:	Peter <pmc@citylink.dinoex.sub.org>
Approved by:	cperciva
MFC after:	1 week
2012-05-30 03:54:10 +00:00
Alexander Motin
3089bb2e84 MFprojects/zfsd:
- 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.
2012-05-24 11:07:39 +00:00
Eitan Adler
50d675f7a9 Remove trailing whitespace per mdoc lint warning
Disussed with:	gavin
No objection from:	doc
Approved by:	joel
MFC after:	3 days
2012-03-29 05:02:12 +00:00
Joel Dahl
091eeb4841 Remove superfluous paragraph macro. 2012-03-25 09:21:09 +00:00
Yoshihiro Takahashi
506bccaff6 Fix build when RELEASE_CRUNCH is defined. 2012-01-29 09:12:34 +00:00
Kenneth D. Merry
e6bd5983ca Add CAM infrastructure to allow reporting when a drive's long read capacity
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
2012-01-26 18:09:28 +00:00
Eitan Adler
b8e4b9659f Fix warning when compiling with gcc46:
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
2012-01-10 02:59:58 +00:00
Ulrich Spörlein
4b85a12f71 Spelling fixes for sbin/ 2012-01-07 16:09:33 +00:00
Dimitry Andric
8fec2463ca In sbin/camcontrol/camcontrol.c, fix a few warnings about format strings
not being literals.

MFC after:	1 week
2011-12-16 22:35:19 +00:00
Ed Schouten
5111cde131 Add missing static keywords to global variables in camcontrol.
While there, make the vendor list const and add appropriate keywords to
functions that use this list.
2011-12-11 11:38:50 +00:00
Ed Maste
2c418c0083 Restore comment with credit to Marc Frajola.
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.
2011-12-02 15:47:05 +00:00
Xin LI
53f48302de Fix build. 2011-11-25 07:11:02 +00:00
Ed Maste
1f4782a4c1 Add firmware update support for SCSI devices.
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
2011-11-25 04:03:37 +00:00
Ed Schouten
1efe3c6b58 Add missing static keywords for global variables to tools in sbin/.
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.
2011-11-04 13:36:02 +00:00