summaryrefslogtreecommitdiff
path: root/sys/scsi
AgeCommit message (Collapse)Author
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
2006-07-11knf and ansi. no binary changeDavid Gwynne
2006-07-11ansi and knf. no binary change.David Gwynne
2006-07-06add a flag to sc_link to be used by a hba to mark the target as virtual.David Gwynne
grudging ok from deraadt@ so i can move forward. this should be revisited one day though.
2006-06-20pack wwn fields into struct better; ok marco krwTheo de Raadt
2006-06-15 Quell dmesg spewage from ch(4) - this diff moves much of theBob Beck
diagnostic type printf spew that is useful into #ifdef CHANGER_DEBUG, removes some that is pretty much useless, and changes one instance of using kernel printf to indicate the truncation of a result due to the provided buffer being too small into a return of EINVAL back to the caller. tested by me and mbalmer@ ok krw@ mbalmer@
2006-06-11Don't spew sense informaton from the test unit ready command issued byKenneth R Westerback
stopen(). This change was misplaced in the st roto-tilling at c2k6. Noticed by deraadt@.
2006-06-02add structs and macros for a few MMC commandsMichael Coulter
ok krw@
2006-06-01We do not create st devices with different density modes. i.e. with deviceKenneth R Westerback
minor numbers having bits 2 or 3 set. Eliminate the quirks, etc. used to store info on these non-existant modes. Also eliminate a couple of 'unimplemented' fields in the ioctl request structure. ok beck@ deraadt@
2006-05-31add a place to store the PortWWN and NodeWWN for fibre channel stuffs.Jason Wright
2006-05-31fix treeTheo de Raadt
2006-05-31 Add support for primary and alternate volume tags to ch(4) - borrowedBob Beck
and adapted from FreeBSD. This adds the ability for status requests to ask for the volume tags (usually bar codes, on changers with a bar code reader) on media inthe library. ok deraadt@, krw@
2006-05-28Miscellaneous fixes.Kenneth R Westerback
1) Check the return value from st_mount_tape(). 2) Always call st_unmount() if the media goes missing. 3) Use the special handling for 'Unit in the process of becoming ready' for the TEST UNIT READY command in stopen(). 4) Don't unmount a tape during stopen() just because it doesn't have the current default density. Eliminate now unused last_dsty member of st_softc. tested & ok beck@
2006-05-28This commit changes the interpret_sense routine for st to catch theBob Beck
"Unit Becoming Ready" case, and just like ch, allow the driver to continue waiting, as long as the unit continues to promise us that the unit is becoming ready. This avoids the case of slow tape drives taking forever to bring media online requiring a huge retry count being set for all commands, and like ch, will wait indefinately only in this case. All other cases are handled as before. ok krw@
2006-05-28In the absence of a coherent concept of 'RAW' tape devices, pass allKenneth R Westerback
unhandled ioctl requests to scsi_do_ioctl() like ch.c does. Previously only the mythical 'control devices' with certain minor numbers would pass the requests along. ok beck@
2006-05-28Whack a 'control device' leftover. Actually save the new density, etc.Kenneth R Westerback
that was just accepted by the device, no matter what the minor is. ok beck@
2006-05-28We don't have 'control devices' for st. Nor are we likely to get anyKenneth R Westerback
in the foreseeable future. Eliminate half-baked, semi-operational code that tried to handle such devices. People who had stumbled across the previous control-like behaviour of erstX devices should not be relying on these semantics. Suggested by deraadt@. ok beck@
2006-05-28ST_NEW_MOUNT was set/reset in a number of places but only examined insideKenneth R Westerback
a #if notyet/#endif block. It's been 'notyet' since 1995. Eliminate it. 'flense!' beck@
2006-05-28Fix open(2) semantics for ch(4) to not be completely on fresh minty crack:Bob Beck
1) Don't use SCSI_IGNORE_NOT_READY when doing test_unit ready to wait for the device to come up. 2) use SCSI_IGNORE_ILLEGAL_REQUEST when doing test_unit_ready to wait for the device to come up (just as is done in st(4)) 3) add a ch_interpret_sense routing to perform special handling of the case where the unit is in the process of becoming ready. Hope springs eternal, that if the device tells us it is trying to become ready, then we should wait for it to do so, however long it takes (and on tape library scans this can take a while - i.e. a few minutes for large libraries). The custom handler ensures that the retry count is not decremented in this case and this case only. ok krw@
2006-05-28Add PCATCH to tsleep flags when a scsi command is waiting for an openingBob Beck
or is waiting to be retried, abort it when a signal interrupts the tsleep(). This fixes what was commited in version 1.92 to work properly. ok krw@
2006-05-28Use TEST_READY_RETRIES_TAPE instead of TEST_READY_RETRIES_DEFAULT,Kenneth R Westerback
thus allowing tape drives more time to become ready. ok beck@
2006-05-28Use bit 23 of the device minor to indicate a control mode device. AKenneth R Westerback
control mode device can be opened but does not permit any i/o. Currently no such devices are created by MAKEDEV. However the previous code used bits 0 and 1 of the minor being set to indicate a control device. This conflicted with other uses of device minors to indicate things like rewind and eject. This behaviour would result in an open of a newly loaded tape drive failing until the tape was successfully mounted as a side effect of another command like 'mt status'. ok beck@
2006-05-28Always allow ioctl's to work, even if there is no media loaded.Kenneth R Westerback
Analogous to what sd does for the raw partition. Eliminates useless error messages and premature command completion. e.g. 'mt status' will wait for media to to finish loading. ok beck@
2006-05-28Don't print tape media information during probe. This is transitoryKenneth R Westerback
information that doesn't have anything to do with the device. We don't say 'cd drive empty or not ready." ok beck@
2006-05-21replace lockmgr with rwlock.David Gwynne
2006-05-18paramter -> parameterMiod Vallat
2006-05-18Test the state of a disk *after* spinning it up and not before. ThisKenneth R Westerback
prevents the issuing of sizing inquiries to non-existant or non-responsive devices like empty slots on a USB card reader. Also try to avoid *extremely* unlikely loop of scsi_start() commands, by not using sd_interpret_sense() until after the disk is spinning. ok dlg@
2006-05-13And the fallout from Manuel Pata's USB reader rumbles on ...Kenneth R Westerback
Fix the display of the device info for umass devices at lun 0 by passing the correct inquiry data to config_attach. i.e. not the inquiry data for lun 1, which we gratuitously probe to prevent USB card readers from 'helpfully' lying about who is where, but the inquiry data for lun 0 we have saved in sc_link->inqdata.
2006-05-13When SCSIDEBUG'ing, display the return value of scsi_interpret_sense()Kenneth R Westerback
in hex. This makes it consistant with the display of the same value in other messages.
2006-05-11Zap trailing whitespace.Kenneth R Westerback
2006-05-09make sensor names look more normal; ok dlgTheo de Raadt
2006-05-07If a device says a MODE SENSE command worked fine, do *not* try a MODEKenneth R Westerback
SENSE BIG command even if no page data was returned. Just accept the fact that the device does not have any such page data. This is more in line with the spec, and unbreaks devices (like the Neodio 8-in-1 USB Card Reader donated by Manuel Pata) which freak out when getting a MODE SENSE BIG. Should not break any 'working' device. ok pedro@ dlg@ marco@ 'Looks correct.' miod@
2006-05-07Zap a bunch of trailing whitespace.Kenneth R Westerback