summaryrefslogtreecommitdiff
path: root/sys/scsi/scsiconf.h
AgeCommit message (Collapse)Author
2011-07-17Backout a bunch of my SCSI commits from c2k11. At least one of theseMatthew Dempsky
is causing problems when trying to boot sparc64 from an isp(4). Verified to fix the sparc64/isp(4) regression by krw@; ok deraadt@
2011-07-09Add SCSI_NO_ADAPTER_TARGET as a value for adapters to setMatthew Dempsky
adapter_target to if their adapter isn't addressable on the bus. ok dlg@, krw@
2011-07-06Add {sc,saa}_{targets,luns} to scsibus_softc and scsibus_attach_args.Matthew Dempsky
These will be used to replace scsi_link's adapter_buswidth and luns fields, but for now we stay compatible with existing SCSI adapter driver conventions while I update them to set the scsibus_attach_args fields directly. ok dlg@
2011-07-05Garbage collect SDEV_S_WAITING and scsi_link->scsibus now that nothingMatthew Dempsky
needs either of them. ok krw@
2011-06-15factor the common bits out of code that builds scsi inquiry commands intoDavid Gwynne
scsi_init_inquiry(). cut the compiled INQUIRY code over to it. ok and tweaks from krw@ ok matthew@
2011-04-06add a new "serial" devid type for scsi devices. add code to usb that fakesDavid Gwynne
it up by using the usb devices iSerial thing. ok deraadt@
2011-04-05move forward with scsi multipathing.David Gwynne
the big change is how paths between mpath capable devices and the kernel are managed. originally the midlayer would steal the links to the devices and hide them behind mpath. all the changes an adapter made to a link (eg activate or detach), the midlayer had to test if it was an mpath link and then call special mpath code to handle it. the original code also assumed that all paths behaved the same, but the reality is that different devices have different command sets and behaviours. figuring out which behaviour to pick and prioritising them is basically the same job autoconf does with match and attach. rather than special casing mpath in the midlayer and reimplimenting autoconf, this turns paths into actual device drivers with match and attach routines. after they figure out if the path is active, they then give it to mpath(4) to use as a backend. i have written drivers for symmetric access devices (sym(4)) where all paths to the same logical unit are as good as each other, lsi/engenio arrays (rdac(4), and emc arrays (emc(4)). the rdac and emc drivers only detect active paths at attach time, the do not cope if the controller changes state unless you unplug the path and plug it in again to retest the active state. they also do not have support for directing array failover. operating and hoplugging has been tested with mpii(4), fc and sas mpi(4), and iscsi via vscsi (claudio did this too). ok krw@ deraadt@
2010-12-24Have sd(4) devices check for and respect read-only information theKenneth R Westerback
way st(4) does. Have both decline to open read-only devices for anything but read-only access. Suggestion to fail opens rather than individual i/o's from deraadt@. Problem USB device found and donated by chefren, who also tested diffs. Thanks! ok dlg@ marco@
2010-10-12Force openings to 1 for devices that can't do tagged i/o, i.e. moreKenneth R Westerback
than 1 i/o active at once. This reduces the chances that concurrent i/o's for such devices will confuse the device or the adapter code. It also eliminates a reason for adapter code to maintain its own queues. Tweak all drivers that fake INQUIRY results to set the SID_CmdQue flag, thus continuing to claim to be able to do tagged i/o. Positive feedback from matthew@ and marco@ for an earlier version. ok dlg@
2010-09-20bring back scsi_base.c r1.195 and scsiconf.h r1.138 now thatDavid Gwynne
src/sys/dev/ata/atascsi.c r1.92 solves the problem that my scsi_link change tickled. tested by josh elsasser who reported the problem in pr6470 deraadt@ is letting it in again so it can get widespread testing
2010-09-17revert scsi_base.c r1.195 and scsiconf.h r1.138 as it screws up with someDavid Gwynne
disks in atascsi. as reported in pr6470
2010-09-14the openings member of scsi_link is the maximum number of commands that aDavid Gwynne
scsi device can have in flight. instead of counting users of openings on the bus by taking away from the openings value, count the number of pending commands on the bus in a new pending variable. this lets us know how many outstanding commands there are. we can then use that to make sure that all commands a device has generated get completed before detaching the device. this helps avoid resource leaks and use after frees. tested by me on pci ehci/umass, fc mpi, and sas mpi. tested by jakemsr on cardbus ohci umass. it found issues in sas mpi which were fixed as a result of this diff. ok krw@
2010-09-08activate hooks should return a value.David Gwynne
all from deraadt@ tested by me with hotplugged disks on mpi(4)
2010-08-25add scsi_iopool_destroy and scsi_link_shutdown. when a link orDavid Gwynne
device are going away, this will walk the pool and link queues and wake up processes that are sleeping while waiting for an io or xs. they will return NULL to the scsi_{xs,io}_get callers, which should then check if they device is still alive. all other handlers that are registered on the queues should be removed by their owners before the destroy/shutdown funcs are called. lots of help and discussion with matthew@ ok matthew@
2010-07-27Add scsi_cmd_rw_decode() for decoding any SCSI READ or WRITE command,Matthew Dempsky
and update atascsi(4) to make use of it. (Other HBAs will be updated post-release.) Should allow for use of SATA drives with >2^32 LBAs. ok deraadt@, dlg@, krw@
2010-07-27the queue entry and state variables in the xsh and ioh structs are partDavid Gwynne
of a separate struct which the ioh struct includes for no good reason anymore. just put the vars directly in the ioh. this removes this useless abstraction. ok krw@ matthew@
2010-07-24Get rid of scsi_deinit(), and change scsi_init() back to a one-timeMatthew Dempsky
initialization strategy, rather than pretending to do user reference counting. Previously, we would re-initialize the SCSI pool(9)s, which had the fun consequence of causing sysctl(kern.pool.npools) to infinite loop at IPL_VM. ok krw@
2010-07-22Eliminate scsi_scsi_cmd() now that ss(4) is gone and with it theKenneth R Westerback
last bastardized sync and buf call through scsi_scsi_cmd(). Flatten code to call scsi_xs_sync() directly for all commands. Airplane typos shaken out by various. ok dlg@ matthew@ deraadt@
2010-07-13Correct comment. scsi_sense_data is now 18 bytes, not 32.Kenneth R Westerback
2010-07-01Die struct scsi_device! Die! Instead, save a pointer to the routineKenneth R Westerback
to interpret sense errors. This is initialized to the basic interpretation routine, and specific scsi drivers (sd/st/cd) can replace this with their own. While here kill EJUSTRETURN dance and make more specialized interpretation routines directly call the basic routine if desired. Fixes by matthew@ to my first diff. Most original work by dlg@. ok matthew@ marco@ dlg@
2010-07-01Change scsibus(4)'s scsi_link array to an SLIST to save memory onMatthew Dempsky
sparsely populated buses. ok dlg@, krw@
2010-06-27"Believe it or not," nothing uses scsi_xfer's req_sense_length fieldMatthew Dempsky
in any meaningful way, so just get rid of it. ok krw@, dlg@
2010-06-15dont pass the dev_t from the scsi device drivers into the midlayer forDavid Gwynne
ioctl requests, and dont pass the proc pointers around for any ioctl requests in scsi land at all. neither were used, so trim the fat. ok krw@ marco@
2010-06-14remove the scsi_buf_* functions as these have beenThordur I. Bjornsson
replaced by BUFQ's. OK krw@, dlg@
2010-05-24removed prototypes for functions that were removed.David Gwynne
patch from matthew dempsky
2010-04-17use the iopools mutex to protect the semaphore wrapping the openingsDavid Gwynne
runqueue. less is more sometimes.
2010-04-16whitespace fixDavid Gwynne
2010-04-16fix an fatal flaw with iopools.David Gwynne
an xshandler gets put on a series of lists as it allocates different resources, and uses the same tailq entry on each of these lists as its only supposed to be on one of them at a time. however, it was possible for the xshandler to be added to both at the same time, therefore corrupting the lists and leading to a panic. this diff moves from using separate flags for each queue an xshandler could be on to having a single state variable that shows which one it is on (or not on). this prevents an xshandler on the io runqueue from being added to the openings runqueue, which in turn prevents the list corruption. some operations have been reordered to avoid races and complexity in this little state machine.
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-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-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-14Tweak names a bit. show_mem -> scsi_show_mem, show_scsi_xs ->Kenneth R Westerback
scsi_xs_show. No functional change.
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-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-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.
2009-12-01properly handle all xs states that can be returned by an adapter in sd.David Gwynne
requested by krw@ after spending a week munging through my code.
2009-12-01put the midlayer changes back in.David Gwynne
the two issues affecting it last time are gone. the first, mishandling of TRY_AGAIN_LATER is not relevant now that krw got rid of TRY_AGAIN_LATER. the second, the misbehaving IBM disk was found to be a problem with siop using ordered tags on most ops combined with the speed of the new code. putting this in so we can move forward. ok krw@ "commit please" marco@
2009-11-22Remove only use in the tree of ESCAPE_NOT_SUPPORTED. Which, ironically,Kenneth R Westerback
wasn't supported. Nuke #define of ESCAPE_NOT_SUPPORTED at the same time. ok miod@
2009-11-22Nuke TRY_AGAIN_LATER now that no driver returns it.Kenneth R Westerback
ok marco@
2009-11-12revert midlayer back to it was before i put my big rewrite in. this isDavid Gwynne
causing a weird problems on an alpha and also appears responsible for isp(4) weirdness i havent had a chance to examine yet. sigh, this makes me sad.
2009-11-10fix the NO_CCB handling i broke when working on simplifying the midlayer.David Gwynne
marco@ discovered my rewrite retried commands rejected by an adapter from a timeout, which was trivially starved by normal io going to disks. this diff allows an xs to be marked as XS_NO_CCB, which will cause it to be returned to the device driver to be retried as part of the normal io queue. tested by krw@ marco@ johan@ ok krw@ marco@
2009-11-10backout the backout marco did of my code because of the NO_CCB breakage.David Gwynne
the fix for the NO_CCB breakage will follow shortly. tested by krw@ marco@ johan@ ok krw@ marco@
2009-11-05The big diff dlg committed to the midlayer breaks NO_CCB andMarco Peereboom
TRY_AGAIN_LATER. NO_CCB is a timer based mechanism that can trivially be made to fail by running IO to two or more disks simultaneously. The TRY_AGAIN_LATER thing is more subtle because it now is a permanent failure instead of transient however this is much harder to hit because something must have gone wrong before it hits. ok deraadt krw miod
2009-10-23if you're attempting to detach multiple devices (eg, many targets,David Gwynne
many luns, or the entire bus), dont report ENXIO as an error to the caller. this broke autoconf when it tried to forcefully remove a bus such as umass and it thought there was a failure. this introduces a way for scsi hbas to call activate/deactivate on a device based on its target/lun address via a call to scsi_activate(). they can then schedule the actual detach/attach in a thread later via scsi_req_probe/detach. the mpi changes tweak the sas event handling code to use these apis to properly handle attaches and detaches of disks. event handling is still disabled till i can make it less chatty. umass breakage reported by form@
2009-10-22devices below the scsibus should all be detached via scsi_detach_lun.David Gwynne
scsibusdetach wasnt doign it properly, so we would be leaking on detach in some cases. now, with the introduction of mpath, the scsi_link structures can represent a path to a mpath node as well as normal devices. this intercepts the device activate entrypoints and sends them to mpath if it it in use rather than assuming a device is always there. the scsibusdetach change ensures that detach always ends up handling the mpath node case too. hotplug bus functionality (eg, usb) tested by form@
2009-10-20"active" is an unused member of the scsi_link structure. i couldnt find anyDavid Gwynne
uses of it in our tree. ok krw@ deraadt@
2009-10-14rework how devids are handled in the midlayer and mpath.David Gwynne
previously a devid was a structure containing its type, length, and a pointer to the actual devid value. this has been changed so a devid is a header followed immediately by the memory making up the id value. this allows the header and its value to be allocated together. devids are now reference counted, so multiple things (eg, the mpath node handlers and the various scsi_link structures) can share the same allocation safely. this also frees devids when scsi_links go away, which was previously not done. if mpath is enabled, then print the devids out as part of the devices attach line.
2009-09-14rework the scsi midlayer to start addressing some problems i haveDavid Gwynne
with it which became extremely annoying with what mpath wants to do. the major change is a new interface for submitting scsi commands. previously the only way for drivers like sd, cd, st, etc to push commands onto the hardware was via scsi_scsi_cmd(). the problem with scsi_scsi_cmd is that it doesnt tell the caller if the command failed, was queued, or completed unless you shoved a buf down with it. this is important for mpath which wants to know what the physical path to the device did so it can report it back to the midlayer which called it. this provides a new api which lets drivers like cd/sd/st/mpath etc allocate an xs, fill it in, and provide a completion routine which the midlayer will call with the state of the command when it is finished with it. the caller is then responsible for freeing the xs. from the hba side of thing, the return code from the scsi_cmd entrypoint is largely ignored now, and it is now always the responsibility of the hba driver to call scsi_done when it has completed the io, rather than returning COMPLETE and expecting the midlayer to do it for you. i have emulated scsi_scsi_cmd on top of this new api so existing users of it will continue to work. sd(4) has been reworked to use the new api directly to both demonstrate its use and test that the new api actually does work. this diff was mostly written in a day at f2k9. thanks to miod for poking through hba drivers to help mitigate against fallout from the change to the COMPLETE semantic. this has been reviewed by krw who didnt spot anything wrong. thanks to dave del debbio for testing. ok deraadt@
2009-08-13provide an api for an interrupt (or something like it) to notify theDavid Gwynne
midlayer that a scsi device has appeared or dissapeared. the midlayer will queue an event and run it in the system workq (which has process context) to handle the attach or detach.