summaryrefslogtreecommitdiff
path: root/sys/scsi/scsiconf.c
AgeCommit message (Collapse)Author
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-27add bio code to do hotplug of devices on the scsibus.David Gwynne
thumbs up deraadt@
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-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-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-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-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-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-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-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-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-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-11Zap trailing whitespace.Kenneth R Westerback
2006-01-21Invoke disk_detach() and related cleanup work in detach(), rather thanMiod Vallat
zeroref() - just to be on the safe side, should we mess up our ref count.
2006-01-18Don't index before the start of the sc_link array if scsi_probe_bus()Kenneth R Westerback
is called with a target of -1 and a valid lun. Spotted by Miod. ok miod@
2005-11-13Use SCSI_DELAY only once. Document it. Default to no delay.Kenneth R Westerback
Fixes two second system 'freeze' when umass device plugged in. Speeds up boot by not waiting for a minimum of 2 seconds at each scsi bus. ok jmc@ pedro@ deraadt@
2005-10-10Make some panic messages more useful.Kenneth R Westerback
2005-06-03Cache a copy of the INQUIRY data obtained during device attachment inKenneth R Westerback
the scsi_link structure. This is a more general solution than the current inconsistant copying of fields into _softc structures. The redundant fields in _softc's will be cleaned up later. The device field will be used immediately to finish up the new mode sense code. ok marco@
2005-05-07Eliminate 'mode sense (n) returned nonsense' and 'could not mode senseKenneth R Westerback
(4/5)' messages in favour of a single SC_DEBUG() message about the mode sense error. Less useless verbiage. As this eliminates the only SDEV_NOMODESENSE use in scsi/*, eliminate all quirks table entries that used only SDEV_NOMODESENSE. Iomega Zip tested by miod@ to ensure this did not break something. Finally, only fake a geometry if scsi_size() can determine a disk size to fake from.
2005-04-28Some really braindead usb devices such as x-in-1 card reader/writersKenneth R Westerback
try to help equally braindead os's by presenting any inserted media as LUN 0 until another LUN is used in a command. Trick them by issuing a gratuitous/harmless INQUIRY to LUN 1 after issuing the LUN 0 INQUIRY but before any other command. Only umass scsi devices with >1 lun are affected. Fixes dlg's reader/writer for one. Lots of diagnosis and testing by dlg@, ok dlg@, ok marco@.
2005-04-27Add SDEV_UMASS flag, analogous to SDEV_ATAPI, and use it to force aKenneth R Westerback
full LUN scan on UMASS SCSI targets. UMASS provides reliable max lun information so we shouldn't waste time. Fixes many x-in-1 card reader/writers that report identical INQUIRY information for every slot they provide. Lots of diagnosis and testing by dlg@, ok dlg@, 'I can live with this' marco@.
2004-07-31Remove scsi_change_def() and related command structure. Its only useKenneth R Westerback
in the tree is #ifdef'd out and is fundamentally wrong anyway - it tries to force *all* devices to SCSI-2. Also recent SCSI specs seem to have marked the command as obsolete. Bonus - eliminates another undocumented option (SCSI_2_DEF). Found in a list of unused kernel functions posted to tech-kern@netbsd by Krister Walfridsson in 2002. ok marco@ tdeval@
2004-05-09Remove some #ifndef __OpenBSD__/#endif sections that were intended toKenneth R Westerback
make sync'ing with NetBSD easier. NetBSD has moved on, most of these sections have not. ok marco@ deraadt@ grange@ csapuntz@
2004-05-07Set value for rslt before trying to display it. 'Bad LUN ...' messsageKenneth R Westerback
will now display correct error value. Spotted in SCSIDEBUG output from Adrian Close's bizarre USB device. ok millert@ deraadt@ marco@.
2004-05-07Remove mvme88k workaround for ssh(4) bugs.Miod Vallat
2004-04-18Restore siop's (and possibly others) ability to negotiate tags/wide/sync byKenneth R Westerback
reverting to a single (short) INQUIRY command during probe. Compensate in siop by trying PPR on all targets on SCSI-3 buses and falling back to WDTR/SDTR if PPR rejected. Problem found by mickey@. Tested on a wide variety of devices by Marco. ok marco@ deraadt@.
2004-03-10Simplify new LUN scanning logic, add diagnostic messages for allKenneth R Westerback
instances of bad LUNs and add SCSIFORCELUN_BUSES and SCSIFORCELUN_TARGETS options. ok miod@ deraadt@. Tested in the Marco Peereboom torture chamber.
2004-02-21Eliminate the quirks SDEV_NOSTARTUNIT, UMASS_QUIRK_NO_START_STOP, andKenneth R Westerback
UMASS_QUIRK_FORCE_SHORT_INQUIRY. Fixes a bunch of USB devices. Based on work by Mycroft in NetBSD. ok tdeval@ deraadt@.
2004-02-07If scsi_probe_bus() is called with a particular lun, ensure that lun 0Kenneth R Westerback
information is available to make the new lun validation logic work. i.e. don't find phantom luns just because the user asks about them. Also ensure the lun value given does not exceed the maximum valid lun for a bus, rather than assuming the maximum valid lun is 7. ok tdeval@ deraadt@.
2004-01-30Backout until we have a better implementation...Thierry Deval
2004-01-29"And you definitely don't want to use p_priority. Use PRIBIO"Thierry Deval
From art@
2004-01-29Avoid an annoying freeze during attach of live "scsibus" devices.Thierry Deval
looks ok deraadt@, mickey@, krw@ and art@(but I hate it)
2004-01-25Allow restriction of SCSIDEBUG output to particular scsi buses inKenneth R Westerback
addition to device targets and luns. ok deraadt@.
2004-01-24ugly #ifdef to be deleted laterTheo de Raadt
must still do TUR on mvme68k & mvme88k ssh(4) driver ok miod krw
2004-01-23Don't probe impossible luns. If lun 0 is non-existant, or if the device showsKenneth R Westerback
it doesn't grok luns then stop probing. Speeds up the probe of an empty scsi bus by approx. 30 seconds. From Marco Peereboom. Tested by Marco Peereboom, millert@, miod@, Diana Eichart, and a host of anonymous snapshot users. ok deraadt@.
2004-01-17Use SC_DEBUG() to display debug messages. Makes SCSIDEBUG output better.Kenneth R Westerback
ok tdeval@.
2004-01-14Nuke SDEV_NOLUNS, SDEV_FORCELUNS, and PQUIRK_FORCELUNS quirks. AlsoKenneth R Westerback
moreluns field in scsi_link structure. Instead, treat an INQUIRY result that duplicates the INQUIRY result of LUN 0 as proof the LUN does not exist. Compensate for lack of SDEV_NOLUNS where necessary by setting sc_link->luns to 1, which has the same effect. From Marco Peereboom. Don't issue Test Unit Ready command before INQUIRY command - not necessary and potentially harmful to devices with ADEV_NOTUR quirk since quirks have not been set yet. From mycroft@NetBSD ok deraadt@, mvme* changes by miod@.
2004-01-07Some code cleanup and fixes inspired by NetBSD changes from mycroft@Kenneth R Westerback
and pointed out by Nate@. Fixes some <, , > displays for devices that were not filling the INQUIRY data in correctly. Silences INQUIRY commands that fail during probe. Treats SID_QUAL_LU_OFFLINE results the same as SID_QUAL_BAD_LU. Eliminate special treatment for DEC TK30 and DEC TK50 devices. ok tdeval@.
2003-10-27atlas does indeed support tagging and only the siop was brokenMichael Shalayeff
2003-09-30quantum atlas iv 9 wls lies about tagsMichael Shalayeff