summaryrefslogtreecommitdiff
path: root/sys/scsi
AgeCommit message (Collapse)Author
2007-02-12Don't need a 'return' just before exiting a function.Kenneth R Westerback
2007-02-03Make comment match code. ok pedroAlexander Bluhm
2007-01-20Add media_fileno, media_blkno into st_softc and report their valuesKenneth R Westerback
back via MTIOCGET ioctl, rather than always reporting -1 (unknown). Simple 'Set to 0 on rewind, increment on file marks and positioning, and set back to -1 on any ambiguity' logic. No functional impact on current operation. Should allow things like Bacula to work much faster by keeping track of the current media position. Adapted from FreeBSD code. ok beck@
2007-01-16Report SDEV_UMASS devices as non-'SCSI', i.e. 'ATAPI', devices whenKenneth R Westerback
asked via SCIOCIDENTIFY. More closely emulates the Linux SCIOCIDENTIFY/SG_EMULATED_HOST combination used by cdparanoia (and god knows what other ports). Nothing in the tree itself uses SCIOCIDENTIFY. Fixes cdparanoia's handling of USB CD drives that can't handle the MODE SENSE command. cdparanoia sends 'ATAPI' devices only MODE SENSE BIG (0x5a) commands. Finding actual SCSI devices that might have trouble with MODE SENSE BIG (i.e. very old devices) behind USB is deemed highly unlikely. Problem reported, debugged and fix tested by bernd@. ok marco@ millert@ miod@
2007-01-05As first brought to my attention by Russel Sutherland, our deletion ofKenneth R Westerback
the mt_fileno and mt_blkno fields from the mtget struct was too hasty. Subsequent discussions with Kern Sibbold of the Bacula project revealed these are widely used by tape backup software on many unicies. The de facto standard is to return -1 if you can't determine the value. So add them back and always return -1 as their value. Should allow Bacula and similar software to at least compile while we investigate providing meaningful values. ok beck@
2006-12-29Avoid void * arithmetic, okay deraadt@, suggestions from millert@Pedro Martelletto
2006-12-23adapt to new two-level sensor api; Constantine A. MureninTheo de Raadt
2006-12-23Add the ability to issue GPCMD_REPORT_KEY and GPCMD_SEND_KEY scsiKenneth R Westerback
commands via the DVD_LU_SEND_RPC_STATE and DVD_HOST_SEND_RPC_STATE ioctls respectively. Thus allowing any region protected DVDs mistakenly delivered by Santa to the wrong region to be viewed on recalcitrant DVD drives (with the aid of an appropriate utility like regionset). No change to any current functions. Found in my hackers@ folder from August. From netbsd -> Kurt Miller -> jmc@.
2006-12-21Fix some comment typos. 'immediatly' -> 'immediately', 'tranfer' ->Kenneth R Westerback
'transfer', 'tranfered' -> 'transferred'.
2006-12-12Give the SCSI layer the ability to requeue i/o's rejected by a driverKenneth R Westerback
using the new NO_CCB result. Currently a no-op since no driver produces that result. ok dlg@ marco@ deraadt@
2006-11-28give scsi controllers a real attach args to fill in when attaching scsibus.David Gwynne
ok miod@ marco@ deraadt@
2006-11-28rename scsibus_attach_args to scsi_attach_args. this can help avoidDavid Gwynne
confusing when trying to attach scsibus to a hba, since it is really meant for attaching scsi devices to scsibus. ok deraadt@ marco@
2006-11-28remove a comment that was describing a behaviour that was changed over nineDavid Gwynne
years ago.
2006-11-27more magic removalBob Beck
ok miod@, deraadt@
2006-11-27get rid of the rest of the asc/ascq magic codes in scsiBob Beck
ok marco@, deraadt@
2006-11-27add bio code to do hotplug of devices on the scsibus.David Gwynne
thumbs up deraadt@
2006-11-27rework asc/ascq handling to get rid of "magic" 0x values in the code, changesBob Beck
asc/ascq handling to deal with the pair together rather than seperately, since modern scsi has long since polluted the "categories" of asc enough that you pretty much need to always look as ascq. ok krw@ deraadt@, dlg@
2006-11-27hook scsibus up to bio.David Gwynne
ok deraadt@ krw@ an earlier diff was ok marco@ too
2006-11-27if there are no luns on a target, then say there were no devices,David Gwynne
otherwise return any error we find during detach of the luns.
2006-11-26no argument names in prototypes plsDavid Gwynne
2006-11-26provide scsi_detach_bus, _target, and _lun to wrap up config_detach forDavid Gwynne
scsi devices. the midlayer keeps some state for each device that is attached which needs to be cleaned up on detach, hence this wrapper.
2006-11-04kthread_create returns an int, not a pointer. compare the return value toDavid Gwynne
0, not NULL.
2006-10-21rework the bus scanning code by splitting it out into separate functionsDavid Gwynne
for walking the bus and targets, and probing the luns. this removes the need to use magic numbers to wildcard each of these, which in turn makes the code a lot easier to read. as a bonus we get some more space to work in (80 chars isnt that much somtimes). note that this code wont probe high luns if lun 0 doesnt exist. ok krw@
2006-10-08Something more closely resembling english in this comment.Bob Beck
2006-10-07make cd-roms retry forever while the device indicates that it isBob Beck
"becoming ready" - this is done in the exact same way that it was done for tape in st.c. This commit adds a cd specific interpret_sense routine to cd.c that will catch the becoming ready case and handle it. This also removes the need to use crazy timeouts to catch this case. ok krw@
2006-10-02get rid of a boolean typedef. this is c, we have ints, deal with it.David Gwynne
ok marco@ krw@
2006-10-01whitespace tweaksDavid Gwynne
2006-10-01Free sensors on detach.Alexander Yurchenko
ok dlg@
2006-09-26Zap D_REMOVABLE flag from disklabel. If you didn't already know thatKenneth R Westerback
floppies and cd's were removable, displaying that fact in disklabel output was unlikely to help. And the display in disklabel was the only use of D_REMOVABLE in the tree. ok marco@
2006-09-22implement a kernel thread that can be used by the midlayer or scsi driversDavid Gwynne
when they need a process context to do something. the most obvious task that springs to mind is attaches and detaches of devices on scsibus. ok krw@ marco@ deraadt@
2006-09-21when we probe and find devices on the scsibus, we allocate a scsi_linkDavid Gwynne
struct for it and keep it in the midlayer. however, this struct was never free'd on detach. since we only do hotplugging of controllers (and the scsibus and devices get hotplugged as a matter of course), we now walk the list of scsi_link structs and free them on detach of scsibus. ok marco@
2006-08-04Add ENOMEDIUM and EMEDIUMTYPE to report medium errors to userland programsBob Beck
when using removable media devices, along with changes to scsi_base to detect such cases in tapes other devices. This makes tar, dd, and friends report a semi useful error message instead of nonsense when there is nothing in the device. Includes libc minor bump, and will require the corresponding sets change. ok krw@ deraadt@
2006-07-29Zap a couple of unused defines - SID_ANSI_SCSI2 and SID_ANSI_SCSI3.Kenneth R Westerback
2006-07-29The version field of scsi_inquiry_data is not a simple numeric valueKenneth R Westerback
that specifies the version of SCSI being supported. Even the ANSI part that we use is complex. 4 means 2, 5 means 3 and 6 means 4. Translate and use the value correctly. Fixes SCSI5 and SCSI6 in dmesg. And properly protects SCSI2 devices from getting SCSI3 commands. "seems like an elegant solution to me" millert@ ok dlg@ marco@
2006-07-23Use REPORT LUNS to get the list of LUNs to probe. If such a list isKenneth R Westerback
obtained probe the LUNs given without checking for duplicate INQUIRY data. For non-USB, non-ATAPI, devices claiming to be SCSI-3 compliant. And the target must have something attached at LUN 0. If REPORT LUNS can't be used or isn't supported, the old scan process is used. Fixes Fibre Channel and SCSI enclosure devices that provide identical INQUIRY data for all LUNs and were thus being misprobed as having only LUN 0. Tested by Bob Kitella, dlg@, beck@. Suggestions from deraadt@. ok dlg@ beck@
2006-07-23remove some scsi ioctls, most importantly the ones that can reprobe theDavid Gwynne
bus. supporting these complicates the midlayer unnecessarily. ok krw@
2006-07-22If the LUN is > 7, don't try to stuff it into the three bits availableKenneth R Westerback
in the CDB for pre-IDENTIFY device LUNs.
2006-07-22Allocate enough, and only enough, scsi_link pointers for the number ofKenneth R Westerback
LUNs the driver says targets could have. Don't unconditionally allocate 8. USB and ATAPI devices have fewer. Fibre Channel devices can have more.
2006-07-22Nuke SCSIFORCELUN* and friends. These were introduced as a safetyKenneth R Westerback
valve in case our duplicate LUN checks had to be circumvented. Since no one has found a need for them, and they were just one more place trying to shift a bit 255 places to the left could be induced, remove them. "i don't think any options like that are worthwhile" deraadt@
2006-07-19Add cd_powerhook(). Use it to lock CD drives having open partitionsKenneth R Westerback
when PWR_RESUME occurs. The drives may have forgotten they were locked. Noted and original diff by Alexey Vatchenko. "I agree with the intent." miod@ "Looks acceptable." deraadt@
2006-07-16take a 1k array off the stack by using malloc to get it. found by miod.David Gwynne
2006-07-15catch "Media Removal Prevented" for devices that are capable of telling usBob Beck
when we're not allowed to yank things out of them. Instead of returning a generic EIO and having the kernel printf a scsi sense to the console, we now return EBUSY to userland and avoid the dmesg spewing. ok krw@
2006-07-14Don't keep a special copy of the INQUIRY data for LUN 0 anymore. ThereKenneth R Westerback
is now a copy in the scsi_link structure so just use that one. 'looks reasonable' beck@ ok dlg@
2006-07-13Eliminate scsi_link field 'scsi_version' and just use the INQUIRY dataKenneth R Westerback
stored in scsi_link. That's where the value came from anyway. Move 'luns' field to where 'scsi_version' used to be to preserve alignment. ok dlg@
2006-07-11the scsi_link structure contained a copy of the inquiry flags and the wholeDavid Gwynne
inquiry. this removes the flags member and makes all its users refer to the whole inquiry now. ok miod@ krw@
2006-07-11get rid of useless printfs that just clutter dmesg.David Gwynne
ok deraadt@
2006-07-11scsi_get_xs raises splbio, but didnt lower it on error. tsk tsk.David Gwynne
ok krw@
2006-07-11knf and ansi. no binary change.David Gwynne
2006-07-11remove an if 0 chunk thats been with us forever, but never used and neverDavid Gwynne
will be.
2006-07-11a few formatting tweaks. this was mostly knf/ansi already. no binary changeDavid Gwynne