summaryrefslogtreecommitdiff
path: root/sys/scsi
AgeCommit message (Collapse)Author
2010-04-12i snuck fine grained locking into the midlayer as part of all theDavid Gwynne
other stuff ive been doing in here. everything that needs protection inside the midlayer and the scsi device drivers (sd, cd, etc) uses mutexes now. this pushes splbio out of the midlayer. splbio is only taken before biodone is called now. ok beck@ marco@ krw@ deraadt@. theyre all terrified, but they all say if we're going to do then now is the right stage of the dev cycle.
2010-04-06cut sd over to using the new shiny scsi_xsh api. instead of pushing io ontoDavid Gwynne
the disk as soon as it gets any from the block layer, this now registers a callback for when a resource becomes available on the bus. ok krw@ beck@ marco@ tested by many including krw@ beck@ mk@ okan@ todd@
2010-04-06implement a new mechanism for allocating resources on the bus.David Gwynne
instead of optimistically trying to use a resource by executing an xs and then failing when there's no room for it, this puts things that want to use the hardware on a runqueue. as resources become available on the bus then consumers on the runqueue are popped off and guaranteed access to the resource. the resources are generally "ccbs" in adapter drivers, so this abstracts a way for the midlayer to get access to them into something called iopools. it also provides a callback api for consumers of resources to use: the scsi_ioh api for things that want direct access to the ccbs, and the scsi_xsh api for things that want to issue a scsi_xfer on the bus. these apis have been modelled on the timeout api. scsi_xs_get and therefore scsi_scs_cmd have been cut over to using these apis internally, so if they are allowed to sleep then can wait on the runqueue for a resource to become available and therefore guarantee that when executed on an adapter providing an iopool that they will succeed. ok krw@ beck@ marco@ tested by many including krw@ beck@ mk@ okan@ todd@
2010-04-03add support for emulating the disk characteristics and disk limits vpdDavid Gwynne
pages. this if the first step in figuring out if disks use a different physical block size compared to the logical block size they present to the operating system.
2010-03-23Change the scsi_cmd function member of scsi_adapter from int toKenneth R Westerback
void. Use XS_NO_CCB error in the scsi command (xs) to report the NO_CCB condition. Eliminates all SUCCESSFULLY_QUEUED and COMPLETE confusion and untangles the midlayer from the adapter a bit more. Eyes and some fixes by miod@ There may be some compile issues on little used (i.e. I don't have any) drivers but the change is mechanical and thus easy to remedy. ok dlg@
2010-02-28If no TOC header is read, report EIO. Even if the command finishedKenneth R Westerback
ok. Stops cdio(1) from printing bogus TOC info. ok marco@ beck@
2010-02-27Don't print sense info for ioctl's. Let the userland program decideKenneth R Westerback
what to tell the user. Silences cdio and cdrecord while probing media. ok dlg@ marco@ deraadt@
2010-01-15Oops. Respect the various IGNORE flags when not in SCSIDEBUG mode.Kenneth R Westerback
Should quieten booting again. And thus ends n2k10.
2010-01-15Abstract and merge the manual buf queue manipulating functions intoKenneth R Westerback
one place for easier debugging and maintenance. No intended functional changes. ok dlg@
2010-01-15Restore XS_BUSY delay behaviour for buf i/o. Same as for sync path.Kenneth R Westerback
ok dlg@
2010-01-14Print sense data during SCSIDEBUG again. Always print the decodedKenneth R Westerback
data when SCSIDEBUG is set, irrespective of SCSI_SILENT. Tweak output a bit. Noticed in output generated by todd@.
2010-01-14Tweak names a bit. show_mem -> scsi_show_mem, show_scsi_xs ->Kenneth R Westerback
scsi_xs_show. No functional change.
2010-01-13Get new xs's with PR_ZERO to ensure all shiny new fields getKenneth R Westerback
initialized. Bring back panics on non-NULL done and cookie fields, but put inside DIAGNOSTIC. ok dlg@
2010-01-13Cookie or done is set on entry to scsi_xs_sync(). Take panic() outKenneth R Westerback
until we figure out why.
2010-01-13when checking an xs for errors, first check if the device the xs is forDavid Gwynne
is dying. if so, return ENXIO. this should make detach of devices during scsi attaches less dangerous. idea (and the first version of this diff) ok deraadt@ ok krw@
2010-01-13scsi_xs_sync uses the xs cookie and done pointers, so users of scsi_xs_syncDavid Gwynne
cannot. panic if theyre set before scsi_xs_sync is called. question raised by and ok krw@
2010-01-13Oops. Restore decrement of xs->retries I optimized away. Not everythingKenneth R Westerback
is dlg@'s fault. ok dlg@
2010-01-13Fix SCSIDEBUG compiles.Kenneth R Westerback
Pointed out and original diff by jcs@.
2010-01-13typo in panic messagejoshua stein
2010-01-12bring sd.c r1.180 over to the other drivers now using the antisemaphore,David Gwynne
ie, dont clear the WAITING flag when restarting the xxstart loops.
2010-01-12dont let the antisemaphore clear the WAITING flag so NO_CCB doesnt causeDavid Gwynne
us to loop forever. follow sdstart through to to an adapters scsi_cmd handler and assume that handler returns NO_CCB to enjoy the bug in full. ok kettenis@ krw@ beck@
2010-01-11dlg@ lost the SCSI_IGNORE_ILLEGAL_REQUEST flag on all SYNCHRONIZE_CACHEKenneth R Westerback
commands. Noticed & fix tested by halex@. ok dlg@
2010-01-11Bring mutex protections to ststart, cdstart and ssstart, as alreadyKenneth R Westerback
done in sd. Make names consistant across all three. ok dlg@ tested (cd) & ok beck@
2010-01-11Be as careful with sd/cd buf queue manipulations as was found necessary forKenneth R Westerback
st's queue manipulations. i.e. ensure b_actb is correctly updated as the queue becomes empty or has an i/o requeued on it. Tested on claudio@'s backup crashing box. ok dlg@ beck@
2010-01-11Add mutex around work consuming loop in sdstart - this ensures that onlyBob Beck
one thread will be grabbing xs's at a time and dequeuing work, but avoids a race between notification there is work to do and exiting the loop releasing the xs's. Fixes problem noticed by claudio where usb disks would hang with the new minty dlg midlayer. ok krw@, dlg@, tested by claudio@
2010-01-10Restore delay on XS_BUSY result, just in case it is needed somewhere. PolishKenneth R Westerback
logic to eliminate FALLTHROUGH craziness. ok marco@ dlg@
2010-01-10Set ITSDONE in scsi_done() and zap trivial instances of setting itKenneth R Westerback
in the drivers just before calling scsi_done(). ok dlg@ beck@
2010-01-09panic with a nice message if scsi_xs_sync_done gets called twiceDavid Gwynne
rather than generating a fluffy printf.
2010-01-09dont try to prevent multiple concurrent runs of a devices start routineDavid Gwynne
by setting flags around the loop. there is a race which can prevent necessary work being completed by any of the currently running instances of xxstart. the caveat with the removal of this code is because multiple xxstarts can be running at the same time they can cause io reordering, but that is less of a problem than no io. found by and fix tested by claudio@ debugged with krw@ claudio@ beck@ deraadt@
2010-01-09always try to restart io on a device when an opening is made available fromDavid Gwynne
scsi_xs_put.
2010-01-07warn if scsi_done has been called twice on an xs in the scsi_xs_sync pathDavid Gwynne
rather than panic. ok krw@
2010-01-05only call disk_unbusy when we're finished with the io (or we're requeuingDavid Gwynne
it when we hit NO_CCB). retried io would call unbusy twice before this change. noticed by deraadt@
2010-01-04nothing in the midlayer cares about ITSDONE anymore. if a command is done,David Gwynne
the adapter will call scsi_done on it.
2010-01-04introduce scsi_xs_sync. this will synchronously execute a scsi_xferDavid Gwynne
and do the appropriate sleeps, retries, error processing, and finally returns an errno style value to the caller. this cuts scsi_scsi_cmd, the ioctl code, sd_flush, and scsi_inquiry over to scsi_xs_sync. ok krw@
2010-01-03disk cache mode pageDavid Gwynne
2010-01-03scsi_done sets ITSDONE, we dont have to do it.David Gwynne
2010-01-02move the buf handling from using scsi_scsi_cmd over to scsi_xs_exec. iDavid Gwynne
think this is the last chunk of code using a buf pointer in the scsi_xfer now. this has not been tested due to a lack of hardware anywhere. if there are problems please report them as soon as possible. ok krw@ miod@
2010-01-01If you want to use atomic ops, you need to #include the proper files insteadMiod Vallat
of relying upon other headers bringing it in for you.
2010-01-01deck chair shufflingDavid Gwynne
2010-01-01split the flags used in a scsi_link structure to represent its state atDavid Gwynne
runtime out into a separate state variable. only operate on the state bits with atomic ops. introduce the DYING state so things that sleep can figure out if they should keep going or not.
2009-12-26move st over to the new midlayer.David Gwynne
much testing and debugging from krw@ his diff was a nice christmas present
2009-12-16nothing needs to see cd_softc except the driver, so move it into cd.cDavid Gwynne
ok marco@ guenther@
2009-12-13remove #ifdef CDDA bits cos nothing in cd.c uses it and nothing i can findDavid Gwynne
defines it.
2009-12-13prefix all softc members with sc_, not just most of them.David Gwynne
2009-12-13use sc consistently as the name of the pointer to the softc variable, notDavid Gwynne
cd.
2009-12-12move cd(4) from using scsi_scsi_cmd over to scsi_xs_exec for doing io.David Gwynne
this brings it in line with the new midlayer changes. mostly borrowed from sd(4) changes. tested by krw@ and me ok krw@
2009-12-09Nuke stray comment referencing deceased TRY_AGAIN_LATER that dlg@Kenneth R Westerback
snuck back in. Noticed by kettenis@.
2009-12-07Re-enable SCSIDEBUG display of commands and data. Original diffKenneth R Westerback
from dlg@, tweaking by me to make it compile. ok dlg@
2009-12-06Nuke SCSI_URGENT after removing its only use, in ncr53c9x.c. That useKenneth R Westerback
was to try to play dangerous games with tagged queuing. ok marco@
2009-12-06SCSI_USER is deprecated. the ioctl handlers arent special with regard toDavid Gwynne
the midlayer.