freebsd-skq/sys
Kenneth D. Merry 1cc052e80f 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.

MFC after:	3 days
Sponsored by:	Spectra Logic Corporation
2011-10-03 20:32:55 +00:00
..
amd64 Do not allow the kernel to access usermode pages without installed 2011-10-03 17:01:31 +00:00
arm Remove pointless semicolons after label 2011-09-30 04:55:23 +00:00
boot zfstest: rename to zfsboottest and move to tools 2011-09-16 08:22:48 +00:00
bsm
cam Add descriptor sense support to CAM, and honor sense residuals properly in 2011-10-03 20:32:55 +00:00
cddl In order to maximize the re-usability of kernel code in user space this 2011-09-16 13:58:51 +00:00
compat Auto-generated code from sys_ prefixing makesyscalls.sh change 2011-09-16 14:04:14 +00:00
conf Shift head from 9.0-CURRENT to 10.0-CURRENT in preparation for releasing 2011-09-26 02:27:04 +00:00
contrib Use the correct byte order for the ip_divert(4) mbuf tag port meta 2011-08-25 09:38:33 +00:00
crypto
ddb Follow up to r225203 refining break-to-debugger run-time configuration 2011-08-27 14:24:27 +00:00
dev Add descriptor sense support to CAM, and honor sense residuals properly in 2011-10-03 20:32:55 +00:00
fs In order to maximize the re-usability of kernel code in user space this 2011-09-16 13:58:51 +00:00
gdb
geom
gnu Second-to-last commit implementing Capsicum capabilities in the FreeBSD 2011-08-11 12:30:23 +00:00
i386 Do not allow the kernel to access usermode pages without installed 2011-10-03 17:01:31 +00:00
ia64 Remove locking of the vm page queues from several pmaps, which only 2011-09-28 15:01:20 +00:00
isa
kern Move some code inside the racct_proc_fork(); it spares a few lock operations 2011-10-03 17:40:55 +00:00
kgssapi In order to maximize the re-usability of kernel code in user space this 2011-09-16 13:58:51 +00:00
libkern
mips Disable using wait in cpu_idle() until a better solution to timer and 2011-10-01 05:56:25 +00:00
modules Unbreak no-ip and no-inet6 module builds with ipfw. For now continue to 2011-09-27 13:27:17 +00:00
net Pass the fibnum where we need filtering of the message on the 2011-09-28 13:48:36 +00:00
net80211 Fix a panic in the wifi stack when a software beacon miss occurs in the wrong state. 2011-10-02 02:42:31 +00:00
netatalk
netgraph Add IPv6 support to the ng_ipfw(4) [1]. Also add ifdefs to be able 2011-09-15 12:28:17 +00:00
netinet A system may have multiple physical interfaces, all of which are on the 2011-10-03 19:51:18 +00:00
netinet6 Fix an obvious bug from r186196 shadowing a variable, not correctly 2011-09-30 18:20:16 +00:00
netipsec
netipx
netnatm
netncp
netsmb
nfs In order to maximize the re-usability of kernel code in user space this 2011-09-16 13:58:51 +00:00
nfsclient Merge 220876, 220877, and 221537 from the new NFS client to the old: 2011-08-09 15:29:58 +00:00
nfsserver Fix the NFS servers so that they can do a Lookup of "..", 2011-09-03 00:28:53 +00:00
nlm In order to maximize the re-usability of kernel code in user space this 2011-09-16 13:58:51 +00:00
ofed Add the fo_chown and fo_chmod methods to struct fileops and use them 2011-08-16 20:07:47 +00:00
opencrypto Add the fo_chown and fo_chmod methods to struct fileops and use them 2011-08-16 20:07:47 +00:00
pc98 In order to maximize the re-usability of kernel code in user space this 2011-09-16 13:58:51 +00:00
pci
powerpc Add descriptor sense support to CAM, and honor sense residuals properly in 2011-10-03 20:32:55 +00:00
rpc Make sure RPC calls over UDP return RPC_INTR status is the process has 2011-08-28 18:09:17 +00:00
security In order to maximize the re-usability of kernel code in user space this 2011-09-16 13:58:51 +00:00
sparc64 Actually enable NEW_PCIB by default, missed in r225931. 2011-10-02 23:31:14 +00:00
sys Fix another bug introduced in r225641, which caused rctl to access certain 2011-10-03 16:23:20 +00:00
teken
tools
ufs This update eliminates a lock-order reversal warning discovered 2011-09-27 17:41:48 +00:00
vm Style nit. 2011-09-29 00:44:34 +00:00
x86 Fix a deficiency in the selinfo interface: 2011-08-25 15:51:54 +00:00
xdr
xen Properly handle suspend/resume events in the Xen device 2011-09-20 23:44:34 +00:00
Makefile