summaryrefslogtreecommitdiffstats
path: root/sys/dev/ic/siop.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* sizes for free(); ok semariederaadt2015-09-091-10/+6
|
* Remove some includes include-what-you-use claims don'tjsg2015-03-141-2/+1
| | | | | | | have any direct symbols used. Tested for indirect use by compiling amd64/i386/sparc64 kernels. ok tedu@ deraadt@
* Use <sys/endian.h> instead of <machine/endian.h>guenther2014-12-191-2/+2
| | | | ok dlg@ mpi@ bcook@ millert@ miod@
* Some reallocarray() use; review Jean-Philippe Ouellet, patrick keshishianderaadt2014-07-131-2/+2
| | | | ok tedu
* add a size argument to free. will be used soon, but for now default to 0.tedu2014-07-121-10/+10
| | | | after discussions with beck deraadt kettenis.
* Fix edge cases of uninitialized variables. In my tree for too long, I evenmiod2013-05-271-2/+5
| | | | got ok's for azalia but I don't remember from whom.
* a bit more ansi; ok teduderaadt2011-06-231-2/+2
|
* pull the dmamam wrapper in from all my other drivers and use it to replacedlg2011-04-051-44/+92
| | | | | | | | the siop command buffers and add dmaable buffers for sense data. matthew@ found that siop used to try to dma to the xs->sense bufer, which is not guaranteed to be dma safe. tested by matthew@ kettenis@
* Manuel Bouyer rescinded clauses 3 and 4 of his license text.jsg2010-07-231-6/+1
|
* siop sets XS_NO_CCB when it fails to allocate device state when commandsdlg2010-07-061-54/+61
| | | | | | | | | | | | | | | are first sent to target/lun, as opposed to failing to allocate a ccb (which ive already fixed). this moves the allocation and freeing of this device state in siop into the scsi_probe and scsi_free handlers. if siop cant allocate memory for a device when the midlayer is about to probe it, we dont send commands to it. if the midlayer fails to find a device at that target/lun, it asks siop to free it. simplifies the io path and avoids work during interrupts. ok deraadt@ reads good to both marco@ and krw@
* timeout_add -> timeout_add_msecblambert2010-07-021-7/+3
| | | | ok dlg@
* Remove all adapter-specific 'struct scsi_device's. They are never used. Firstkrw2010-06-281-9/+1
| | | | | | | | step in elminating 'struct scsi_device' entirely. Spotted and initial diff from matthew@. ok matthew@ dlg@ deraadt@ marco@ miod@
* Always initialize the ccb provided by the scsi layer into the properkrw2010-06-031-1/+7
| | | | | | | | | | state when starting an i/o. Necessary as the scsi layer may now re-submit a completed xs/ccb to the adapter in some error situations. Fixes panics seen by various people, reproduced and fix tested by sobrado@. ok dlg@
* modify siop to provide an iopool as a way for the midlayer to managedlg2010-04-061-20/+43
| | | | | | | access to its free ccbs. ok krw@ beck@ marco@ tested by beck@
* Change the scsi_cmd function member of scsi_adapter from int tokrw2010-03-231-10/+19
| | | | | | | | | | | | | 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@
* Set ITSDONE in scsi_done() and zap trivial instances of setting itkrw2010-01-101-2/+1
| | | | | | in the drivers just before calling scsi_done(). ok dlg@ beck@
* Don't try to be clever and mix tag queueing mechanisms. Few if anykrw2009-11-261-8/+2
| | | | | | | disks actually do queueing correctly. Keep it SIMPLE. Fixes naddy@'s magic DNES disks on siop even if dlg@'s new midlayer is active. ok marco@, tested by naddy@.
* Bring last drivers fully into the NO_CCB world by replacingkrw2009-11-221-5/+5
| | | | | | | | | | | TRY_AGAIN_LATER uses with equivalent NO_CCB. Eliminates confusion between the two as was always intended. buf I/O's that can't be started get pushed back onto the front of the queue and retried. Others get sent back to originator as failures. No more epi-cycle looping inside the SCSI midlayer hoping the problem goes away. Various testers, no objection from miod@ as vs(4) was tested by nick@.
* Put ccb back on free list if we bail out because we can't map thekrw2009-01-181-1/+3
| | | | data buffer.
* Don't lose ccb's if there are problems allocating the structures neededkrw2009-01-181-16/+18
| | | | to issue a command.
* Return NO_CCB instead of TRY_AGAIN_LATER when ccb's run out.krw2008-11-241-2/+2
| | | | "I'm all for it." marco@ "Yeah" deraadt@
* Fix redundant device name and/or target printing after callingmiod2008-08-311-3/+3
| | | | sc_print_addr(); ok krw@
* The obvious bzero/memset -> M_ZERO changes.krw2007-09-071-12/+7
|
* Add support for the (non-pci) NCR 53c720/770 in big-endian mode.kettenis2007-08-051-70/+85
| | | | ok martin@, krw@, deraadt@
* turn off SIOP_STATS; ok krwderaadt2007-05-081-2/+2
|
* 'immediatly' -> 'immediately' in comments.krw2006-12-211-2/+2
|
* give scsi controllers a real attach args to fill in when attaching scsibus.dlg2006-11-281-2/+7
| | | | ok miod@ marco@ deraadt@
* - fix and prettify SIOP_DEBUGmartin2006-05-221-6/+11
| | | | | | - print device name on request sense failure ok krw@
* The first thing done when XXX_scsi_cmd() returns TRY_AGAIN_LATER iskrw2005-12-031-6/+1
| | | | | | | | to set xs->error to XS_BUSY. So it is pointless and misleading to set xs->error to XS_TIMEOUT, XS_DRIVER_STUFFUP or XS_BUSY just before returning TRY_AGAIN_LATER. No functional change.
* Un-revert backout to 20051009 and add patches from Martin Bouyer tokrw2005-11-201-37/+86
| | | | | | | | | close NetBSD PR#31990. Fixes interaction with some problematic drives found by miod@, martin@, otto@. Tested martin@ otto@ miod@ ok miod@ mickey@
* revert to 20051009 for now, need to investigate strange behaviour withmartin2005-11-031-58/+35
| | | | | | some controllers discussed with otto@ and henning@, first noted by miod@
* Add handling for IGNORE WIDE RESIDUE messages. Actually calculatekrw2005-10-101-35/+58
| | | | | | | | | resid instead of assuming it is always 0. From bouyer via NetBSD. Note we are now sync'd with the latest (1.78 siop.c, 1.37 siop_common.c) NetBSD code. Tested by various people over the last year+. Didn't solve any of their problems but didn't cause any regression either.
* 'dma' -> 'DMA' (wiz via NetBSD), save a test after TAILQ_FOREACH() bykrw2005-10-081-19/+17
| | | | | initializing siop_cmd to NULL first (matt via NetBSD), remove trailing whitespace (perry vis NetBSD).
* use TAILQ_FOREACHmartin2005-03-121-3/+2
| | | | ok krw@
* De-inline siop. Shrinks almost 1K on i386.krw2004-10-131-8/+22
| | | | ok deraadt@, marco@, weingart@, millert@.
* Save a couple of hundred bytes (on i386) by putting the definition ofkrw2004-07-311-1/+5
| | | | | siop_dump_script inside #ifdef DUMP_SCRIPT/#endif, just like its single invocation already is.
* Do not negotiate or use non-async transfer rates until probing (i.e.krw2004-07-301-3/+6
| | | | | | | SCSI_POLL'ing) is complete. Similar to what is done on mpt, ahc, ahd, etc. This fixes problems during probe on hppa. Problems found & ok mickey@.
* Rework SCSI_POLL/INQUIRY logic to make it more readable, not least bykrw2004-04-251-44/+48
| | | | | | fitting all the lines into 80 columns. Prodded by deraadt@. Tested & ok marco@.
* Fix cut/paste typo in error message.krw2004-04-181-2/+2
|
* Restore siop's (and possibly others) ability to negotiate tags/wide/sync bykrw2004-04-181-2/+10
| | | | | | | | | | 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@.
* typos from Tom Cosgrove;jmc2003-10-211-6/+6
| | | | | | | | Tom: I did not commit a couple of your changes. i did not include some punctuation fixes (full stops, etc.) mnemorable -> mnemonic: i decided memorable was probably better instrunctions -> instruction: i kept the plural
* go back to non-raw busdma load as some archs still do not have load_rawmickey2003-10-091-3/+3
|
* e own SIOP_DEBUG define instea of the system-wide one;mickey2003-09-291-24/+18
| | | | | | | | | bzero() the sgl before fillig it up; avoid reading registers extra times where we have a copy in the vars; on scsi_cmd timeout call siop_handle_reset() directly instead of relying on the RST interrupt which does not happen always it semms; use bus_dmamap_load_raw(). krw@ ok
* Don't dma map the xs->cmd. Copy it to a safe buffer that is alreadykrw2003-07-011-48/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | mapped and sync'ed appropriately, and is guaranteed to be in one memory page. Eliminate now unused dmamap_cmd and rs_cmd fields. Fix another error message (adding active command to reset list) so that it includes the adapter name. Add missing letoh32() calls to debug code. The evils of directly mapping *xs->cmd were pointed out by Mickey during osiop development. In particular, *xs->cmd may start on one memory page and run into the next. Since the dma logic in most cards/drivers (including siop) only allocates one address/size pair to map *xs->cmd, parts of a command could be lost or corrupted. The large number of 6 byte dma mappings noted long ago by someone (Henric?). This change reduces the dma mapping activity per i/o by 1/3 to 1/2 and may give a performance boost of some kind. Successfully tested on i386, sparc64 (ultra30 - thanks Jolan, blade100), macppc and alpha. Unfortunately these changes don't fix the Blade1000 siop problems. **NOTE** If scsi_generic is ever upped to 16 bytes the offsets in siop.ss must be updated!
* Fix a bug which would promote a target from TARST_PROBING tokrw2003-06-281-29/+30
| | | | | | | | | | | TARST_ASYNC if a bus reset occurred while in TARST_PROBING. Improve DMA IRQ error message to always display the adapter name. Correct an indent botch. All of which doesn't help the Blade1000 boot, though it is now both less noisy and more informative.
* Fix erroneous handling of i/o's during a reset.krw2003-06-091-24/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | a) Set xs->status rather than cmd_tables->status because there will be no interrupt processing to move it from cmd_tables->status to xs->status. b) Set cmd_c.status to correct value (CMDST_SENSE_DONE) when an active sense command is reset. c) Don't put a reset command from the ready queue into the free_list twice, once in siop_scsicmd_end() and once manually. Condition a) meant that the scsi layer was seeing successfully completed i/o's (xs->error == XS_NOERROR) when they were in fact reset and should have had xs->error == XS_TIMEOUT or xs->error == XS_RESET. This meant lost data on output, and random or zero'ed data on input. Condition b) meant that the wrong bus_dmamap_sync() was called, though the actual action was apparently identical. Condition c) meant that the free_list could become corrupt. The problem was discovered by pb@ on a heavily loaded server that experienced timeouts. This fix was tested by pb@ and henric@ to prove it did not affect normal processing. If nothing else it will provide better error messages if the problem is ever encountered again. Probably a good candidate for -stable if pb@ can successfully reproduce his timeout problems and not have his server crash.
* bzero() siop_target structure after malloc().krw2003-01-211-1/+2
| | | | | | | In combination with previous openings fix makes Niklas happy. Probably fixes some negotiation bugs too. Another good candidate for -stable.
* Fix complete botch in handling of 'openings'.krw2002-12-231-2/+2
| | | | | | | | | | | | | | | | | | | | | | | Assign a fixed value (SIOP_NTAGS) to the openings field in the adapter's template sc_link, rather than incrementing the value as cbd's are allocated. The template value is the one copied into each device's sc_link structure as it is created. Incrementing the value meant that each new device got a larger value for openings. The total number of openings claimed by devices on a bus soon exceeded the number of cbd's available. e.g. after 5 devices there would be 132 allocated cbd's, but the total number of openings claimed by devices would be 300. A heavy i/o load on an adapter with multiple devices could have caused the upper scsi layer to try to queue more i/o's than the driver had cbd's to store them in. Such i/o's would fail with EIO if they were started with SCSI_NOSLEEP (e.g. sdstart()) or were not queued within the specified retry limit. I/o's for devices 'later' on the bus would be more likely to trigger this behaviour, due to their inflated openings values. This is good candidate for -stable.
* From NetBSD (bouyer@):krw2002-11-161-3/+6
| | | | | | | | | In siop_reset(), reset sc_ntargets to 0. The number of targets will be computed again in siop_add_reselsw(). In siop_reset(), reset the tag reseloff to 0, in addition to the lun reseloff. If siop_add_dev() fails this time we would use the old reseloff, clobbering memory now used for something else.
* Resync siop with NetBSD. Make strong effort to minimizekrw2002-09-161-643/+716
| | | | | | | | | | | | | | | | | | | | | | | | | differences, undoing whitespace, spelling, etc. changes and adopting the NetBSD code instead of equivalent home grown code for PPR negotiation, etc. siop.c 1.21 -> 1.64 siop_common.c 1.12 -> 1.30 siopreg.h 1.7 -> 1.13 siopvar.h 1.13 -> 1.18 siopvar_common.h 1.10 -> 1.21 ncr53cxxx.c 1.5 -> 1.10 siop.ss 1.12 -> 1.17 siop_pci.c 1.8 -> 1.11 siop_pci_common.c 1.6 -> 1.17 siop_pci_common.h 1.2 -> 1.4 Many fixes, add 1010-66 support, restructure things to prepare for addition of esiop, osiop and oosiop drivers. tested on various archs by art@, millert@, wilfried@, jason@, Dan Weeks. ok deraadt@.