summaryrefslogtreecommitdiffstats
path: root/sys/scsi/scsiconf.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* factor out the code that figures out whether you're probing or detachingdlg2014-04-221-24/+35
| | | | | | | a whole bus, a target, or a specific lun on a target from the bioctl and scsi_req paths. i want to reuse this factored code for something claudio wants.
* if a device doesnt have device ids or serial numbers, try using node_wwn todlg2014-01-311-2/+23
| | | | generate a devid. if its an fc device this is good enough.
* Add a DVACT_WAKEUP op to the *_activate() API. This is called after thederaadt2013-12-061-9/+4
| | | | | | | | kernel resumes normal (non-cold, able to run processes, etc) operation. Previously we were relying on specific DVACT_RESUME op's in drivers creating callback/threads themselves, but that has become too common, indicating the need for a built-in mechanism. ok dlg kettenis, tested by a sufficient amount of people
* #if SCSIDEBUG -> #ifdef SCSIDEBUGjsg2012-10-161-2/+2
| | | | matches the rest of the scsi code.
* Revamp the sequences for suspend/hibernate -> resume so that the codederaadt2012-10-081-1/+2
| | | | | | | | | | paths are reflexive. It is now possible to fail part-way through a suspend sequence, and recover along the resume code path. Split DVACT_SUSPEND by adding a new DVACT_POWERDOWN method is used after hibernate (and suspend too) to finish the job. Some drivers must be converted at the same time to use this instead of shutdown hooks (the others will follow at a later time) ok kettenis mlarkin
* Fix order of arguments passed to malloc(9) - type first then flags.jsing2011-09-221-2/+2
|
* generate a devid from vpd page 80 if vpd page 83 doesnt exist or work.dlg2011-09-021-3/+52
| | | | ok krw@
* Backout a bunch of my SCSI commits from c2k11. At least one of thesematthew2011-07-171-21/+20
| | | | | | is causing problems when trying to boot sparc64 from an isp(4). Verified to fix the sparc64/isp(4) regression by krw@; ok deraadt@
* Add {sc,saa}_{targets,luns} to scsibus_softc and scsibus_attach_args.matthew2011-07-061-19/+21
| | | | | | | | | 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@
* Garbage collect SDEV_S_WAITING and scsi_link->scsibus now that nothingmatthew2011-07-051-2/+1
| | | | | | needs either of them. ok krw@
* Remove config_activate() and DVACT_ACTIVATE. PCMCIA's the only thingmatthew2011-07-031-5/+1
| | | | | | | | 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
* scsi_link's scsibus field is redundant with bus->sc_dev.dv_unit, somatthew2011-06-211-7/+8
| | | | | | | | 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@
* When printing scsi device ids, skip leading blanks and collapse multiplesthen2011-05-041-4/+7
| | | | | | | | | | 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.
* zero out a scsi_links node_wwn and port_wwn fields after initialising itdlg2011-04-291-1/+2
| | | | | by copying the adapters scsi_link. this way devices wont inherit the adapters addresses on fc fabrics.
* add a new "serial" devid type for scsi devices. add code to usb that fakesdlg2011-04-061-1/+4
| | | | | | it up by using the usb devices iSerial thing. ok deraadt@
* unconditionally print scsi device ids instead of just when mpath isdlg2011-04-061-3/+1
| | | | | | enabled so people can get used to it. ok deraadt@
* do inquiries against dmaable memory while probing devices.dlg2011-04-051-6/+17
| | | | | found by marco@ ok and tweaks deraadt@ krw@
* move forward with scsi multipathing.dlg2011-04-051-31/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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@
* - use nitems(); no binary change.jasper2011-03-311-2/+2
| | | | ok krw@
* use dma_alloc/dma_free instead of malloc to allocate buffers which needderaadt2011-03-171-23/+33
| | | | | to be in the right address space. help from matthew and krw
* Force openings to 1 for devices that can't do tagged i/o, i.e. morekrw2010-10-121-1/+7
| | | | | | | | | | | | | | 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@
* activate hooks should return a value.dlg2010-09-081-22/+30
| | | | | all from deraadt@ tested by me with hotplugged disks on mpi(4)
* the page_length field in the vpd page header is 2 bytes, not 1.dlg2010-09-021-3/+5
| | | | ok krw@ marco@ matthew@
* Add DVACT_QUIECE support. This is called before splhigh() and beforederaadt2010-08-311-6/+6
| | | | | | | | 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.
* add scsi_iopool_destroy and scsi_link_shutdown. when a link ordlg2010-08-251-7/+12
| | | | | | | | | | | | 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@
* Get rid of scsi_deinit(), and change scsi_init() back to a one-timematthew2010-07-241-4/+1
| | | | | | | | | 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@
* Die struct scsi_device! Die! Instead, save a pointer to the routinekrw2010-07-011-9/+2
| | | | | | | | | | | | 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@
* Change scsibus(4)'s scsi_link array to an SLIST to save memory onmatthew2010-07-011-42/+45
| | | | | | sparsely populated buses. ok dlg@, krw@
* for scsibus, silence the activate function when unknown events are given.deraadt2010-06-301-4/+1
| | | | | they are supposed to do, or be silent. ok mlarkin
* Flush cache before suspend.kettenis2010-06-301-1/+5
| | | | ok krw@, marco@
* Merge the only relevant (for now) parts of simplelock.h into lock.hderaadt2010-04-231-3/+2
| | | | | since it is time to start transitioning away from the no-op behaviour. ok oga kettenis
* use the iopools mutex to protect the semaphore wrapping the openingsdlg2010-04-171-2/+1
| | | | runqueue. less is more sometimes.
* implement a new mechanism for allocating resources on the bus.dlg2010-04-061-4/+29
| | | | | | | | | | | | | | | | | | | | | | | | | 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@
* If you want to use atomic ops, you need to #include the proper files insteadmiod2010-01-011-1/+3
| | | | of relying upon other headers bringing it in for you.
* split the flags used in a scsi_link structure to represent its state atdlg2010-01-011-1/+3
| | | | | | 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.
* put the midlayer changes back in.dlg2009-12-011-33/+196
| | | | | | | | | | | 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@
* revert midlayer back to it was before i put my big rewrite in. this isdlg2009-11-121-196/+33
| | | | | | | 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.
* dont compare devids when we dont have a devid to compare with.dlg2009-11-101-2/+3
| | | | | | | | | | | | | 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@
* backout the backout marco did of my code because of the NO_CCB breakage.dlg2009-11-101-33/+195
| | | | | | | the fix for the NO_CCB breakage will follow shortly. tested by krw@ marco@ johan@ ok krw@ marco@
* The big diff dlg committed to the midlayer breaks NO_CCB andmarco2009-11-051-195/+33
| | | | | | | | | | 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
* if you're attempting to detach multiple devices (eg, many targets,dlg2009-10-231-48/+73
| | | | | | | | | | | | | | | | | 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@
* devices below the scsibus should all be detached via scsi_detach_lun.dlg2009-10-221-21/+69
| | | | | | | | | | | | | | 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@
* rework how devids are handled in the midlayer and mpath.dlg2009-10-141-18/+106
| | | | | | | | | | | | | | | | 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.
* Get rid of devact enum, substitute it with an int and coresponding defines.pirofti2009-10-131-3/+3
| | | | | | This is needed for the addition of further suspend/resume actions. Okay deraadt@, marco@.
* rework the scsi midlayer to start addressing some problems i havedlg2009-09-141-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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@
* if mpath steals a link, print out where the link was stolen so dmesg stilldlg2009-08-101-1/+5
| | | | shows the physical topology of your system.
* pull the printing out of scsibusprint so it can be used against scsi_linkdlg2009-08-101-30/+32
| | | | structures by things other than autoconf.
* add mpath(4), a driver that steals paths to scsi devices if itdlg2009-08-091-2/+17
| | | | | | | | | | 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.
* if the adapters wwn fields are set, print them out when attaching scsibus.dlg2009-08-081-1/+6
| | | | | | we need this to get some clue as to which ports are which on an fc fabric. requested by and ok deraadt@
* Extend the scsi_adapter minphys() callback to take a struct scsi_link *miod2009-02-161-1/+12
| | | | | | as additional argument. This will allow intermediate layers between scsi devices such as sd and scsi host adapters to take appropriate action if necessary.