summaryrefslogtreecommitdiffstats
path: root/sys/cam/scsi
Commit message (Collapse)AuthorAgeFilesLines
* Use macros for accessing the head of the heap so that codegibbs1999-04-191-2/+2
| | | | is isolated from implementation details of the heap.
* Make WangTek 51000 a fixed block device.mjacob1999-04-181-1/+5
| | | | | PR: kern/11194 Obtained from:naddy@mips.rhein-neckar.de
* Remove camq_regen(). We already perform modular comparisonsgibbs1999-04-071-12/+4
| | | | | for generation counts, so no further steps to deal with generation count wrap are required.
* Implement the control device for the "targ" target mode processor targetgibbs1999-03-052-81/+256
| | | | | | | | | | | emulator so that instances can be dynamically added and removed from the system. Properly reference count peripheral instances so they are cleaned up when destroyed by the control device. Set a timeout for test unit ready commands. Before it was uninitialized and could cause us to drop off the bus when no real timeout had occurred.
* Silence errors.gibbs1999-03-051-4/+11
| | | | | Reduce the number of accept target I/O entries we allow to better exercise the resource shortage handling code in controller drivers.
* Silence complaints about synchronize cache requests that fail with illegalgibbs1999-03-051-5/+33
| | | | request.
* +Match against T4000* for HP QIC quirks (not T4000S* where it doesn't thenmjacob1999-03-011-14/+28
| | | | | | | | | | catch a T4000s) + Set *some* kind of error at EOM if we're in fixed mode and have pending errs. Do not clear the ERR_PENDING bit if more buffers are queued. + Release the start_ccb in this case also, else we hang forever on rewinding. + Any kind of error for load to BOT in samount should then cause an attempt to use REWIND to come back to BOT. Do the initial load command quietly. + In samount, if we succeed, set the relative position markers.
* Completely set information in the transaction description before performinggibbs1999-02-111-4/+4
| | | | a selwakeup for it. Cosmetic.
* Add a prioritization field to the devstat_add_entry() call so thatken1999-02-106-15/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | peripheral drivers can determine where in the devstat(9) list they are inserted. This requires recompilation of libdevstat, systat, vmstat, rpc.rstatd, and any ports that depend on the devstat code, since the size of the devstat structure has changed. The devstat version number has been incremented as well to reflect the change. This sorts devices in the devstat list in "more interesting" to "less interesting" order. So, for instance, da devices are now more important than floppy drives, and so will appear before floppy drives in the default output from systat, iostat, vmstat, etc. The order of devices is, for now, kept in a central table in devicestat.h. If individual drivers were able to make a meaningful decision on what priority they should be at attach time, we could consider splitting the priority information out into the various drivers. For now, though, they have no way of knowing that, so it's easier to put them in an easy to find table. Also, move the checkversion() call in vmstat(8) to a more logical place. Thanks to Bruce and David O'Brien for suggestions, for reviewing this, and for putting up with the long time it has taken me to commit it. Bruce did object somewhat to the central priority table (he would rather the priorities be distributed in each driver), so his objection is duly noted here. Reviewed by: bde, obrien
* quiet the alpha compilermjacob1999-02-051-3/+3
|
* Extend unit numbers to a full 10 bits (split into sectionsmjacob1999-02-051-72/+323
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | of the minor). Establish and use a control mode open. Control mode opens may open the device without locking, but are prohibited from all but some ioctls. MTIOCGET always works. MTIOCERRSTAT works, but the clearing of latched error status is contingent upon whether another application has the device open, in which case an interruptible perip acquire is done. MTSETBSIZ, MTSETDNSTY and MTCOMP also require a periph aquire. Relative fileno and blkno are tracked. Note that just about any error will make these undefined, and if you space to EOD or use hardware block positioning, these are also lost until the next UNLOAD or REWIND. Driver state is also tracked and recorded in the unit softc to be passed back in mt_dsreg for a MTIOCGET call. Thanks to Dan Strick for suggesting this. Reintroduce 2 filemarks at EOD for all but QIC devices. I really think it's wrong, but there is a lot of 3rd party software that depends upon this (not the least of which is tcopy). Introduce a SA_QUIRK_1FM to ensure that some devices can be marked as only being able to do 1 FM at EOD. At samount time force a load to BOT if we aren't mounted. If the LOAD command fails, use the REWIND command (e.g., for the IBM 3590 which for some gawdawful reason doesn't support the LOAD (to BOT) command). Also at samount time, if you don't know fixed or variable, try to *set* to one of the known fixed (or variable, for special case) density codes. We only have to do this once per boot, so it's not that painful. This is another way to try and figure out the wierd QIC devices without having to quirk everything in the universe. A substantial amount of cleanup as to what operations can and what operations cannot be retried. Don't retry space operations if they fail- it'll just lead to lossage. Not yet done is invalidating mounts correctly after errors. ENOTIME.
* add QIC 525,320,1320,3080 codesmjacob1999-02-051-1/+4
|
* Sascha Blank <blank@uni-trier.de> convinced me I was anmjacob1999-01-161-20/+22
| | | | | | | | | | idiot about testing SA_QUIRK_2FM in samount. Fixed. Removed the NORRLS quirk (to save quirk space) and left the behaviour of being quiet about failed reserve/release (failed due Illegal Request) the same. Added a SF_QUIET_IR for prevent/allow for the same purposes.
* More bandaids. One important one from Sascha Blankmjacob1999-01-161-164/+92
| | | | | | | | | | | | | (<blank@fox.uni-trier.de>) about quirks being set as arithmetic values, not as bitfields. Add HP, Kennedy and M4 1/2" reel quirk entries. Do a lot of gratuitous source changing. Audit all functions that build ccbs for the tape driver and decide whether each one can be retried or not. Still to do is some more state management post errors.
* The target mode 'Black Hole' device. This peripheral driver provides inquirygibbs1999-01-141-0/+715
| | | | | | | | data and sense information for target mode devices for which no other peripheral driver is attached. This simplifies the task of dealing with luns that are not otherwise enabled for target mode if the controller does not have firmware that automatically deals with this case (e.g. the aic7xxx driver).
* Properly handle transfers that only consume partial buffers.gibbs1999-01-141-6/+10
|
* Make dsopen() and dsioctl() use cdstrategy1 instead of cdstrategy.eivind1999-01-121-3/+3
| | | | | This silence the warnings and makes it more obvious where the bugs have to be fixed.
* Clean up and fix quirk table (was missing necessary wildcards) and add a couplemjacob1999-01-121-34/+61
| | | | | | | | | | | | | | | | | | | | | from the old driver. Change format of quirk table to have a preferred block size for devices that need to be QUIRK_FIXED- this is loaded into the last_media_blocksize tag at saregister time and will be used in the first samount case. Change sasetparams to take a sense_flags argument so that probe time testing can be quieter (e.g. with SF_NO_PRINT). Fix a couple of silly bugs in the fixed/variable determination in samount- one was where there was a check against 'guessing' AND the density code being default density- *SMACK* - you're only guessing if you find the media code to be *other* than default density. Second bug was a test against current blocksize being zero- should be a test against whether current blocksize is not equal to the last blocksize if you had wanted to be fixed (suppose you came up in fixed, but not the preferred size?). And if you don't know what the fixed size should be, select 512 as the starting point, not BLKDEV_IOSIZE (reality wins). Finally, in doing the test set to variable mode, make sasetparams non-chatty.
* Make HP T4000S quirk to FIXED modemjacob1999-01-111-1/+5
|
* Add 'static' to the declaration, too.eivind1999-01-111-2/+2
|
* Like the problems just fixed in scsi_da.c, make suremjacob1999-01-071-6/+17
| | | | | | | to release the probe ccb before taking down the periph. Also, don't do cdscheduling if you're not going to attach the device after all. Reviewed by: ken@freebsd.org
* A better fix to avoid race conditions between failed probesmjacob1999-01-071-6/+15
| | | | | and peripheral removal. Obtained from:gibbs@freebsd.org
* Add a quirk that disables SYNCHRONIZE CACHEmjacob1999-01-051-1/+10
| | | | | PR: 8882 Obtained from: Hellmuth Michaelis hm@kts.org
* Temporary workaround (bandaid) for case where you have READmjacob1999-01-031-3/+5
| | | | | | | | CAPACITY fail for a non-removable media device. There's a race condition where the device entry is removed and then xpt_release_ccb is called which attempts to give back the ccb to a device that's now gone. In this bandaid release the ccb early and then remember to not call xpt_release_ccb later.
* Force ARCHIVE Vipers to be FIXEDmjacob1998-12-281-1/+5
|
* you can retry SYNC CACHE on UA errorsmjacob1998-12-231-2/+3
|
* Staticize.eivind1998-12-222-11/+11
| | | | Reviewed by: gibbs
* Add a quirk NORRLS (no reserve/release) which can (andmjacob1998-12-221-39/+84
| | | | | | | | | | | | | | | | | | | | | will) get set for the devices that don't actually support reserve/release (so we don't keep trying it). Add softc storage and manage storing last I/O and CTL commands that had errors (for correlative purposes). In saclose clear the 'MOUNTED' bit if we either rewind or unload (yes, this shouldn't be necessary since the next open should catch whether a tape change occurred, but I'm having some questions about that actually working so this is safer for the moment). Oh, forgot to mention in previous commit messages that some of the failures particularly at close time cause the tape to be ejected (for the sake of safety)- all this prior to redoing the state machine (which is in progress) which will try and handle this better. Complete the addition of the setmark support (from Martin.Birgmeier@aon.at).
* 1) Fix some serious bugs (1 botch on my part which caused a filemark to bemjacob1998-12-191-40/+89
| | | | | | | | | | written even it the tape was opened readonly- 2 botches in deferred error handling for FIXED LENGTH mode which caused panic && hand resp.). Fixed a memory leak in sa_mount. 2) Fixed an annoying bug when turning of compression to actually reflect this for future status calls. 3) Implement the MTIOCERRSTAT call where latched control and I/O residuals and sense data are returned to the application asking for them.
* Add in block position/block locate functions.mjacob1998-12-181-21/+141
|
* Add structures and function definitions pertinent for hardware locate support.mjacob1998-12-181-1/+51
|
* Correct the definition of the changer device capabilities page. Thegibbs1998-12-171-1/+1
| | | | previous definition confused some reserved bytes for exchange capabilities.
* Add some tape specific density codes- only enough of them here to recognizemjacob1998-12-171-1/+17
| | | | | some specific older units so we can choose 2FM@EOD or FIXED blocksize quirks.
* Several changes having to do blocksize- mostly to force variable as the default.mjacob1998-12-171-51/+268
| | | | | | | | | | Attempt to determine (at mount time if not done so already) via density code whether a device should default to fixed mode or not. Attempts to set to variable that fail will cause fixed to be selected. Similarly, the '2 filemarks at EOM' quirk is now determined (or attempted to be determined) via density code. Some as yet not entirely tested code for coping with 2FM@EOD position is now also in place.
* Correctly track allocated accept target I/O ccbs so that they can begibbs1998-12-171-15/+17
| | | | | | | aborted prior to disabling our lun. This requires a second set of links since we use the ones in the ccb_hdr during normal operations. Nuke some unused variables.
* Enable/Disable our lun on open/close. Track resources kept at the controllergibbs1998-12-151-95/+190
| | | | | | level so they can be reclaimed before attempting to disable our lun. Correctly free descriptors. Add periph locking and spl protection around open and close.
* Return ENODEV instead of EINVAL when a particular exchange or movegibbs1998-12-121-3/+3
| | | | operation exceeds the capabilities of the changer device.
* Some fixes to handle fixed mode and variable mode more sensibly- and alsomjacob1998-12-111-46/+167
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | incorporate some notion of which revision the device is. If it's < SCSI2, for example, READ BLOCK LIMITS is not a MANDATORY command. At any rate, the initial state is to try and read block limits to get a notion of the smallest and largest record size as well as the granularity. However, this doesn't mean that the device should actually *in* fixed block mode should the max && min be equal... *That* choice is (for now) determined by whether the device comes up with a blocksize of nonzero. If so, then it's a fixed block preferred device, otherwise not (this will change again soon). When actually doing I/O, and you're in fixed length mode, the block count is *not* the byte count divided by the minimum block size- it's the byte count divided by the current blocksize (or use shift/mask shortcuts if that worked out...). Then when you *change* the blocksize via an ioctl, make sure this actually propagates to the stored notion of blocksize (and update the shift/mask shortcuts). Misc Other: When doing a mode select, only use the SCSI_SAME_DENSITY (0x7f) code if the device is >= SCSI2- otherwise just use the saved density code. Recover from the ripple of ILLEGAL REQUEST not being 'retried' in that RESERVE/RELEASE is not a mandatory command for < SCSI2 (so ignore it if it fails).
* Convert dadump to use reasonable data types so that some casting is unecessary.gibbs1998-12-111-17/+17
|
* Do not attempt to retry commands that fail with ILLEGAL REQUEST status.gibbs1998-12-111-3/+3
|
* Convert debugging printfs to the CAM_DEBUG macro.gibbs1998-12-101-40/+50
| | | | | | Allow sync transfers if the controller supports it. Wide will follow as soon as I get the kinks worked out of wide target transfers in the aic7xxx driver (currently the only target mode driver in the tree).
* print the appropriate SCSI revision (with CCS as a proper name for the ↵mjacob1998-12-061-4/+8
| | | | announce message
* Add in named SID field revision names (including CCS).mjacob1998-12-051-1/+8
| | | | | Add in named defines for DEFAULT and NOCHANGE densities (for sequential access devices).
* Examine all occurrences of sprintf(), strcat(), and str[n]cpy()archie1998-12-044-21/+15
| | | | | | | | | | | | | | for possible buffer overflow problems. Replaced most sprintf()'s with snprintf(); for others cases, added terminating NUL bytes where appropriate, replaced constants like "16" with sizeof(), etc. These changes include several bug fixes, but most changes are for maintainability's sake. Any instance where it wasn't "immediately obvious" that a buffer overflow could not occur was made safer. Reviewed by: Bruce Evans <bde@zeta.org.au> Reviewed by: Matthew Dillon <dillon@apollo.backplane.com> Reviewed by: Mike Spengler <mks@networkcs.com>
* "Fix" a problem with the Quantum Viking. It appears that this drive doesken1998-12-021-4/+28
| | | | | | | | | | | | | not like the 6-byte read and write commands! It returns illegal request, with the field pointer pointing to byte 9 of a 6 byte CDB. In any case, the work around is to put in a quirk mechanism that makes sure that we don't send 6-byte reads or writes to this device. It's rather sad that this is necessary. You'd think that they would be able to get something that basic to work right in their firmware... Reviewed by: gibbs Reported by: Adam McDougall <bsdx@spawnet.com>
* ...nor does this old TDC3620 like to be asked for compression.joerg1998-11-261-1/+5
| | | | But well, now it's running again!
* Fix a few problems that Bruce noticed about a month ago, and fix oup oneken1998-11-225-19/+46
| | | | | | | | | | | | other problem. - Hold onto splsoftcam() in the peripheral driver open routines until we have locked the periph. This eliminates a race condition. - Disallow opening the pass driver when securelevel > 1. - If a user tries to open the pass driver with O_NONBLOCK set, return EINVAL instead of ENODEV. (noticed by gibbs)
* Fix a problem with the way we handled device invalidation when attachingken1998-10-227-323/+411
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | to a device failed. In theory, the same steps that happen when we get an AC_LOST_DEVICE async notification should have been taken when a driver fails to attach. In practice, that wasn't the case. This only affected the da, cd and ch drivers, but the fix affects all peripheral drivers. There were several possible problems: - In the da driver, we didn't remove the peripheral's softc from the da driver's linked list of softcs. Once the peripheral and softc got removed, we'd get a kernel panic the next time the timeout routine called dasendorderedtag(). - In the da, cd and possibly ch drivers, we didn't remove the peripheral's devstat structure from the devstat queue. Once the peripheral and softc were removed, this could cause a panic if anyone tried to access device statistics. (one component of the linked list wouldn't exist anymore) - In the cd driver, we didn't take the peripheral off the changer run queue if it was scheduled to run. In practice, it's highly unlikely, and maybe impossible that the peripheral would have been on the changer run queue at that stage of the probe process. The fix is: - Add a new peripheral callback function (the "oninvalidate" function) that is called the first time cam_periph_invalidate() is called for a peripheral. - Create new foooninvalidate() routines for each peripheral driver. This routine is always called at splsoftcam(), and contains all the stuff that used to be in the AC_LOST_DEVICE case of the async callback handler. - Move the devstat cleanup call to the destructor/cleanup routines, since some of the drivers do I/O in their close routines. - Make sure that when we're flushing the buffer queue, we traverse it at splbio(). - Add a check for the invalid flag in the pt driver's open routine. Reviewed by: gibbs
* Fix several potential buffer overrun conditions. These changes have beenken1998-10-152-25/+112
| | | | | | | | tested both in the kernel and in userland. Also, fix a couple of printf warnings that show up when CAMDEBUG is defined. Reviewed by: imp Partially submitted by: imp
* Clean up some unused variables.ken1998-10-155-16/+6
| | | | | Reviewed by: ken Submitted by: phk
OpenPOWER on IntegriCloud