[ken@FreeBSD.org: svn commit: r226067 - in stable/9: sbin/camcontrol share/examples/scsi_target share/misc sys/cam sys/cam/scsi sys/dev/ciss sys/dev/firewire sys/dev/iir sys/dev/iscsi/initiator sys/dev/isp sys/dev/m...]

Kenneth D. Merry ken at freebsd.org
Thu Oct 6 20:38:06 UTC 2011


I have merged the CAM descriptor sense and sense residual changes into the
stable/9 tree, so they'll be in 9.0.

For the most part there is nothing you'll need to do about this.  If you
have any installed ports or packages that use the CAM CCB API (e.g.
cdrecord or other programs that use SCSI passthrough), they'll need to be
recompiled.

Let me know if you see any strange behavior with respect to SCSI errors.  I
have not audited every controller driver for proper sense residual handling,
so it is possible that some drivers are broken in some way.

Thanks,

Ken

----- Forwarded message from "Kenneth D. Merry" <ken at FreeBSD.org> -----

From: "Kenneth D. Merry" <ken at FreeBSD.org>
Date: Thu, 6 Oct 2011 19:15:51 +0000 (UTC)
To: src-committers at FreeBSD.org, svn-src-all at FreeBSD.org,
        svn-src-stable at FreeBSD.org, svn-src-stable-9 at FreeBSD.org
Subject: svn commit: r226067 - in stable/9: sbin/camcontrol share/examples/scsi_target share/misc sys/cam sys/cam/scsi sys/dev/ciss sys/dev/firewire sys/dev/iir sys/dev/iscsi/initiator sys/dev/isp sys/dev/m...

Author: ken
Date: Thu Oct  6 19:15:51 2011
New Revision: 226067
URL: http://svn.freebsd.org/changeset/base/226067

Log:
  MFC r225950:
  
  Add descriptor sense support to CAM, and honor sense residuals properly in
  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.
  
  Approved by:	re (kib)
  Sponsored by:	Spectra Logic Corporation

Modified:
  stable/9/sbin/camcontrol/camcontrol.c
  stable/9/share/examples/scsi_target/scsi_cmds.c
  stable/9/share/examples/scsi_target/scsi_target.c
  stable/9/share/misc/scsi_modes
  stable/9/sys/cam/cam_ccb.h
  stable/9/sys/cam/cam_periph.c
  stable/9/sys/cam/scsi/scsi_all.c
  stable/9/sys/cam/scsi/scsi_all.h
  stable/9/sys/cam/scsi/scsi_cd.c
  stable/9/sys/cam/scsi/scsi_da.c
  stable/9/sys/cam/scsi/scsi_low.c
  stable/9/sys/cam/scsi/scsi_sa.c
  stable/9/sys/cam/scsi/scsi_targ_bh.c
  stable/9/sys/dev/ciss/ciss.c
  stable/9/sys/dev/firewire/sbp.c
  stable/9/sys/dev/firewire/sbp_targ.c
  stable/9/sys/dev/iir/iir.c
  stable/9/sys/dev/iscsi/initiator/iscsi_subr.c
  stable/9/sys/dev/isp/isp_freebsd.h
  stable/9/sys/dev/mly/mly.c
  stable/9/sys/dev/mps/mps_sas.c
  stable/9/sys/dev/mpt/mpt_cam.c
  stable/9/sys/dev/usb/storage/umass.c
  stable/9/sys/powerpc/ps3/ps3cdrom.c
Directory Properties:
  stable/9/sbin/camcontrol/   (props changed)
  stable/9/share/examples/   (props changed)
  stable/9/share/misc/   (props changed)
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)
----- End forwarded message -----

-- 
Kenneth Merry
ken at FreeBSD.ORG


More information about the freebsd-stable mailing list