summaryrefslogtreecommitdiff
path: root/sys/scsi/scsiconf.c
AgeCommit message (Collapse)Author
2011-09-22Fix order of arguments passed to malloc(9) - type first then flags.Joel Sing
2011-09-02generate a devid from vpd page 80 if vpd page 83 doesnt exist or work.David Gwynne
ok krw@
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-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-07-03Remove config_activate() and DVACT_ACTIVATE. PCMCIA's the only thingMatthew Dempsky
that's ever used it, and it's long since been changed to use DVACT_{QUIESCE,SUSPEND,RESUME} instead. ok deraadt@, dlg@; miod@ also agreed with this idea when I brought it up a few weeks ago
2011-06-21scsi_link's scsibus field is redundant with bus->sc_dev.dv_unit, soMatthew Dempsky
remove two of the remaining three uses of it. (softraid(4) still uses it at the moment, so the field and its assignment in scsibusattach() stay for now...) ok krw@; feedback and "tenteiramen rejid"(!?) miod@
2011-05-04When printing scsi device ids, skip leading blanks and collapse multipleStuart Henderson
whitespace into one. Written after Mitja showed a particularly unwieldy attach line: sd0 at scsibus0 targ 2 lun 0: <ATA, HTS721010G9SA00, MCZI> SCSI3 0/direct fixed t10.ATA_____HTS721010G9SA00_______________________________blahblahblah ok/incorporating a suggestion from matthew@, krw@ likes it, dlg@ doesn't feel strongly either way.
2011-04-29zero out a scsi_links node_wwn and port_wwn fields after initialising itDavid Gwynne
by copying the adapters scsi_link. this way devices wont inherit the adapters addresses on fc fabrics.
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-06unconditionally print scsi device ids instead of just when mpath isDavid Gwynne
enabled so people can get used to it. ok deraadt@
2011-04-05do inquiries against dmaable memory while probing devices.David Gwynne
found by marco@ ok and tweaks deraadt@ krw@
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@
2011-03-31- use nitems(); no binary change.Jasper Lievisse Adriaanse
ok krw@
2011-03-17use dma_alloc/dma_free instead of malloc to allocate buffers which needTheo de Raadt
to be in the right address space. help from matthew and krw
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-08activate hooks should return a value.David Gwynne
all from deraadt@ tested by me with hotplugged disks on mpi(4)
2010-09-02the page_length field in the vpd page header is 2 bytes, not 1.David Gwynne
ok krw@ marco@ matthew@
2010-08-31Add DVACT_QUIECE support. This is called before splhigh() and beforeTheo de Raadt
DVACT_SUSPEND, therefore DVACT_QUIECE can do standard sleeping operations to get ready. Discussed quite a while back with kettenis and jakemsr, oga suddenly needed it as well and wrote half of it, so it was time to finish it. proofread by miod.
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-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-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-30for scsibus, silence the activate function when unknown events are given.Theo de Raadt
they are supposed to do, or be silent. ok mlarkin
2010-06-30Flush cache before suspend.Mark Kettenis
ok krw@, marco@
2010-04-23Merge the only relevant (for now) parts of simplelock.h into lock.hTheo de Raadt
since it is time to start transitioning away from the no-op behaviour. ok oga kettenis
2010-04-17use the iopools mutex to protect the semaphore wrapping the openingsDavid Gwynne
runqueue. less is more sometimes.
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-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-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-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-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-10dont compare devids when we dont have a devid to compare with.David Gwynne
DEVID_CMP now evaluates to false if the devids are NULL. some stupid devices dont understand luns, so we have code that detects when the device at lun 0 also appears at luns 1, 2, 3, and so on. this check is short circuited if the devices report different devids. no devids isnt the same as different devids though. found by okan@ on ciss (which currently ignores luns). tested by krw@ marco@ johan@ okan@ 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-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-10-13Get rid of devact enum, substitute it with an int and coresponding defines.Paul Irofti
This is needed for the addition of further suspend/resume actions. Okay deraadt@, marco@.
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-10if mpath steals a link, print out where the link was stolen so dmesg stillDavid Gwynne
shows the physical topology of your system.
2009-08-10pull the printing out of scsibusprint so it can be used against scsi_linkDavid Gwynne
structures by things other than autoconf.
2009-08-09add mpath(4), a driver that steals paths to scsi devices if itDavid Gwynne
thinks they could be available via multiple paths. those stolen devices are then made available via mpath(4). this is the minimum amount of code to implement the stealing. it is generally broken and very brittle, so it is currently disabled. it is going in so i can work on it in the tree.
2009-08-08if the adapters wwn fields are set, print them out when attaching scsibus.David Gwynne
we need this to get some clue as to which ports are which on an fc fabric. requested by and ok deraadt@
2009-02-16Extend the scsi_adapter minphys() callback to take a struct scsi_link *Miod Vallat
as additional argument. This will allow intermediate layers between scsi devices such as sd and scsi host adapters to take appropriate action if necessary.
2009-02-16Don't try to SCSIDEBUG targets or luns >31 since we only have 32 bits toKenneth R Westerback
use to identify devices of interest. ok deraadt@
2009-02-16on some buses (eg sas and fc fabrics) the initiator id doesnt meanDavid Gwynne
anything. we represent that in the midlayre by moving the initiator id out of the buswidth. let's not print it in that case. ok deraadt@ kettenis@ krw@ marco@
2008-07-22implement the fetching of a scsi devices "devid". recent hardware providesDavid Gwynne
a vpd page that uniquely identifies a device no matter what bus topology or addressing was used to find it. we have a workaround for old school scsi devices that do not differentiate between luns. if the inq data for high luns is the same as the inq data for lun 0, we assume it is one of these buggy devices. the problem with this is that things like SANs present multiple volumes as luns and they all have the same inq data. if you wanted to present more than one volume to openbsd you would only ever see the first one. devices give us a mechanism to differentiate between luns, so now i do get all my volumes attached in openbsde. review and feedback by krw@ marco@ testing by todd@
2008-07-22tweak comment to reflect the new reality after my last change.David Gwynne
2008-07-21when probing a device the midlayer queries its inquiry data andDavid Gwynne
keeps it on the stack till we attach a driver to it. then it copies the inquiry data int the scsi_link struct. this diff uses the scsi_link struct instead of the stack for that data, which makes the inq data for users of the scsi_link struct available much earlier during device probe. review and feedback from both krw@ and marco@