summaryrefslogtreecommitdiffstats
path: root/sys/cam
Commit message (Collapse)AuthorAgeFilesLines
* Generalize the quirk entry that disables multi-lun probing for Sony CDROMken1998-11-041-4/+3
| | | | | | | drives. It seems that quite a few (possibly all?) of their drives respond to inquiries on multiple luns. Hopefully we can detect problems like this in the probe phase at some point. For now, this is a pretty functional solution.
* Fix a problem with the way we handled device invalidation when attachingken1998-10-2210-335/+438
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Add a mechanism to send a non-tagged transaction even if a device isgibbs1998-10-151-1/+7
| | | | | | | | currently operating in a tagged mode. The SIM driver should determine if a device is in tag mode by looking at the CAM_TAG_ACTION_VALID flag in the ccb header. If the flag is set, the tag_action field is either a SCSI II tag message (simple, ordered, head) or CAM_TAG_ACTION_NONE to specify that no tagging should be performed.
* Fix several potential buffer overrun conditions. These changes have beenken1998-10-153-29/+116
| | | | | | | | 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-157-30/+8
| | | | | Reviewed by: ken Submitted by: phk
* Narrow the quirk entry for the Seagate Elite 9 a bit to just cover drivesken1998-10-141-2/+2
| | | | | with 71* firmware revisions. Scott Mace <smace@intt.ORG> reports that drives with 00* firmware revisions do tagged queueing just fine.
* Disable tagged queueing for the Seagate Elite 9GB drives. They tend to getken1998-10-141-1/+10
| | | | | | | | | hung up when you send tags to them too quickly. (CAM is able to recover from the problem, but this just avoids it altogether.) Reviewed by: gibbs Reported by: Bret Ford <bford@uop.cs.uop.edu> and: Martin Renters <martin@tdc.on.ca>
* Disable cache syncs for a broken NEC drive.ken1998-10-131-1/+9
| | | | | Reviewed by: gibbs Submitted by: Blaz Zupan <blaz@gold.amis.net>
* Fix a bug in the error recovery code. It was possible to have more thanken1998-10-132-2/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | one error recovery action oustanding for a given peripheral. This is bad for several reasons. The first problem is that the error recovery actions would likely be to fix the same problem. (e.g., we queue 5 CCBs to a disk, and the first one comes back with 0x04,0x02. We start error recovery, and the second one comes back with the same status. Then the third one comes back, and so on. Each one causes the drive to get nailed with a start unit, when we really only need one.) The other problem is that we only have space to store one CCB while we're doing error recovery. The subsequent error recovery actions that got started were over-writing the CCBs from previous error recovery actions, but we still tried to call the done routine N times for N error recovery actions. Each call to dadone() was done with the same CCB, though. So on the second one, we got a "biodone: buffer not busy" panic, since the buffer in question had already been through biodone(). In any case, this fixes things so that any any given time, there's only one error recovery action outstanding for any given peripheral driver. Reviewed by: gibbs Reported by: Philippe Regnauld <regnauld@deepo.prosa.dk> [ Philippe wins the "bug finder of the week" award ]
* Fix a bug in the scan lun code that showed up when we did the followingken1998-10-131-2/+3
| | | | | | | | | | | | | sequence of things: - spin up a disk - send an async event to refresh the inquiry data - run through xpt_scan_lun() to re-probe the device - eventually finish the probe, but panic in xpt_done() because the periph pointer wasn't set. Reviewed by: gibbs Reported by: Philippe Regnauld <regnauld@deepo.prosa.dk>
* Fixed two potentially serious classes of bugs:dg1998-10-131-2/+2
| | | | | | | | | | | | | | | | 1) The vnode pager wasn't properly tracking the file size due to "size" being page rounded in some cases and not in others. This sometimes resulted in corrupted files. First noticed by Terry Lambert. Fixed by changing the "size" pager_alloc parameter to be a 64bit byte value (as opposed to a 32bit page index) and changing the pagers and their callers to deal with this properly. 2) Fixed a bogus type cast in round_page() and trunc_page() that caused some 64bit offsets and sizes to be scrambled. Removing the cast required adding casts at a few dozen callers. There may be problems with other bogus casts in close-by macros. A quick check seemed to indicate that those were okay, however.
* Add a "dummy light" (actually two dummy lights) to catch people who don'tken1998-10-121-1/+18
| | | | | | | | | have the passthrough device configured in their kernel. This will hopefully reduce the number of people complaining that they can't get {camcontrol, xmcd, tosha, cdrecord, etc.} to work. Reviewed by: gibbs
* Add quirk entries to disable the synchronize cache command for Micropolisken1998-10-121-10/+28
| | | | | | | | | | | | | | | | 2217's (reported by Matthew Jacob in NetBSD PR kern/6027) and Fujitsu M2954's (reported by Tom Jackson). Some of the Fujitsus at least hang when they get a cache sync command. (Others just return illegal request.) Also, make error printing in dashutdown() a little more selective. Don't print any error when the sense key is illegal request. Drives that don't support the synchronize cache command usually return illegal request. Also, make sure the scsi status is check condition before going into scsi_sense_print(). Reviewed by: gibbs
* Bring over a quirk entry from the old SCSI code for a Chinon CDROM driveken1998-10-121-1/+5
| | | | | | that returns track numbers in BCD. Reviewed by: gibbs
* If the bus delay is >= 2 seconds, notify the user that we are waitinggibbs1998-10-101-2/+7
| | | | | for devices to settle. This will hopefully allay any 'first installation' fears that the machine has hung.
* Add the quirk entry framework to handle disabling the synchronize cacheken1998-10-081-25/+168
| | | | | | | | | | | | | | | | | | | | command on drives that don't like it. Right now, there's just a bogus quirk entry in the table that doesn't do anything, but that should be changed once we get actual inquiry data for drives that don't like the synchronize cache command. Also, add a shutdown hook that runs through all direct access peripherals and runs a synchronize cache on them if they're still open, and if synchronize cache isn't disabled via a quirk entry. Add a synchronize cache call at the end of dadump() (again, conditionalized on the quirk entry), so we can insure that the disk cache contents get flushed to physical media after a dump. Check the new quirk entry in daclose() to decide whether or not to synchronize the cache for a disk at final close. Reviewed by: gibbs
* Add a quirk entry for the CFP2107, another drive with brokengibbs1998-10-071-2/+9
| | | | | | | | | | | | tagged queuing support. Ensure that we report that a device supports tagged queuing even if the system is waiting a "command count delay" before starting to use them. If a user disables disconnects on a device ensure that tagged queuing is also turned off. We did the right thing during initial configuration, but could be confused by manual changes.
* Up the read capacity timeout from 20 seconds to 60 seconds to keep myimp1998-10-071-2/+2
| | | | | | | | JAZ drive happy. This shouldn't impact fast drives, and will keep cam from failing on very slow ones (that are spinning up, say). 20 seconds was almost long enough, but not in all cases. Suggested by: gibbs
* Some fixes for the CD and DA drivers from bde. (and some of my own asken1998-10-072-199/+147
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | well) Among them: [ cd driver ] 1. Old labeling code was still there. 2. Error handling for dsopen() was broken (no test for the `error' returned by dsopen(); bogus test of an `error' that is known to be 0). 3. cdopen() closed the physical device after certain errors although there may still be open partitions on it. 4. cdclose() closed the physical device although there may still be open partitions on it. 5. Some printf format fixes was incomplete or missing. 6. cdioctl() truncated unit numbers mod 256. 7. cdioctl() was missing locking. [ da driver ] 1. daclose() closed the physical device although there may still be open partitions on it. This was fixed many years ago in sd.c rev.1.57. 2. A minor optimization (the dk_slices != NULL test) in sdopen() became uglier in daopen(). It is not worth doing. da only regressed compared with od and my version of sd, since I never committed the change to sd. daopen() should probably do less if some partition is already open. This is not addressed by the diffs. [ ... ] 5. "opt_hw_wdog.h" was not included, so the HW_WDOG code was unreachable. - Added a getdev CCB call in the cdopen() and daopen() calls so that the vendor name and device name are available for the disklabel. (suggested by bde) - Removed vestigal devfs support in both drivers, since we can't properly work with devfs yet. (ask bde for details on this) - Cleaned up the probe code in both drivers in the failure cases. There were a number of things wrong here. The peripheral driver instances weren't getting properly cleaned up. Sometimes the wrong probe message would get printed out (with the failure message appended), so it wasn't very clear that we failed to attach. SCSI sense information was printed, even when the error in question wasn't a SCSI error. I put similar fixes into the changer driver in revision 1.2 of scsi_ch.c. Reviewed by: gibbs Submitted by: bde (partially)
* Disable multi-lun probing and serial number inquiries for the Exabyte 8200.ken1998-10-061-1/+12
|
* Fix a printf format warning that shows up when CAMDEBUG is defined.ken1998-10-021-2/+2
|
* Add a new CAM debugging mode, CAM_DEBUG_CDB. This causes the kernel token1998-10-023-4/+19
| | | | | | | | | | | | | print out a one line description/dump of every SCSI CDB sent to a particular debugging target or targets. This is a good bit more useful than the other debugging modes, I think. Change some things in LINT to note the availability of this new option. Fix an erroneous argument to scsi_cdb_string() in scsi_all.c Reviewed by: gibbs
* Modify the changer driver so it can handle (hopefully!) changers that needken1998-10-022-70/+218
| | | | | | | | | | | | | | | | | | | | | | | | | block descriptors enabled on mode sense commands. Basically, we try sending a mode sense with block descriptors disabled (the previous default), and if it fails, we try sending the mode sense with block descriptors enabled. If that works, we note that in a runtime quirk entry, so we don't bother disabling block descriptors again for the device. This problem was first reported by Chris Jones <cjones@honors.montana.edu> on one of the NetBSD lists, but I'd imagine that some FreeBSD users would have run into it eventually as well, since our changer driver is derived form the NetBSD changer driver. Also, change some of the probe logic so that we do the right thing in the case of a failure to attach. Fix a memory leak in chgetparams(). Add a couple of inline helper functions to scsi_all.h to correctly return the start of a mode page. NetBSD PR: kern/6214 Reviewed by: gibbs
* Patches from DES to create three new kernel config options to controlken1998-10-021-7/+16
| | | | | | | | | | | | timeouts in the SA driver (timeouts for space, rewind and erase). Folks can lengthen the timeouts if their hardware is especially slow, or shorten them if they want to be notified of errors a little sooner. Also, get rid of two OD driver options. The od driver has been made obsolete by the da driver. Reviewed by: ken, gibbs Submitted by: Dag-Erling Coidan Smørgrav <des@FreeBSD.ORG>
* In the bootverbose case, print out error messages for all errors that willken1998-09-292-8/+18
| | | | | | not be retried again, even if the SF_NO_PRINT flag is set. Reviewed by: gibbs
* Fixed printf format errors. u_long is not necessarily suitable for castingbde1998-09-291-5/+7
| | | | pointers to, and %d is not suitable for printing uint32_t's.
* Correct problems with xpt_set_transfer_settings and async transfergibbs1998-09-251-56/+68
| | | | negotiation changes with wildcarded paths.
* Fix a few problems with the tag delay code:gibbs1998-09-241-47/+68
| | | | | | | | - Tagged devices were limited to one transaction (oops) - We revert to untagged with a tag delay if the user changed the transfer negotiation values (via perhaps camcontrol some day). - xpt_async did not use the expanded path in some cases which could cause a panic.
* Treat not ready errors (asc 0x04) as non-fatal errors for attach. Weken1998-09-231-5/+10
| | | | | | already allowed medium not present type errors (0x3a), but some Philips and HP WORM drives return 0x04,0x00 when you issue a read capacity without media in the drive.
* Allow 5 untagged commands to go to a device before enabling tags aftergibbs1998-09-231-30/+90
| | | | | | | | | | | | | | | | | enabling transfer negotiations, a BDR, or a bus reset to allow the controller driver to negotiate without tagged messages getting in the way. Some devices are confused by attempts to negotiate and tag at the same time. Some controllers (e.g. BT MultiMaster with certain firmware revs) will never negotiate if you don't give them an untagged "window" to perform negotiation in. Bump the maximum tag count to 255. The system reclaims unused tag space as the tag count is dropped anyway, so we might as well try the max. We should probably use a larger type than u_int8_t to hold our tag value as SCSI over certain mediums allows for higher values. Reviewed by: Kenneth Merry <ken@FreeBSD.org>
* Add several quirks:ken1998-09-221-1/+43
| | | | | | | | | | | | | | | Western Digital Enterprise drives have sorry performance (1.5MB/sec versus 8MB/sec) when doing tagged queueing. Disable tagged queueing for them. Submitted by: Andrew Gallatin <gallatin@cs.duke.edu> Some Sony CDROM drives don't like it when we probe more than one LUN. Verified by: Jean-Marc Zucconi <jmz@FreeBSD.ORG> Some Sony CD-R's don't like multi-LUN probing either. Submitted by: Parag Patel <parag@cgt.com>
* cam.c:gibbs1998-09-222-12/+13
| | | | | | | | | | | | | Clear up trailing NULs in cam_strvis. cam_xpt.c: Nuke an experimental quirk entry for the Toshiba 3401. The real problem with this device turned out to be a bug in the aic7xxx driver that was fixed months ago. Add a quirk entry to inhibit multiple lun scanning and serial number probing of DPT RAID volumes. My DPT controller hangs up solid when I do either of these things to a RAID 1 volume.
* Some fixes to the CD driver that may fix PR kern/7996. The data directionken1998-09-202-121/+134
| | | | | | | | | | | | flags on some of the operations in the driver weren't quite right. Also, clean up scsi_cd.h, change u_char to u_int8_t. I'm surprised this problem didn't show up sooner. (the code has been in there almost a year and a half) PR: 7996 Reviewed by: ken Submitted (mostly) by: gibbs
* Don't invalidate devices due to unexpected unit attention errors. Ingibbs1998-09-202-2/+14
| | | | | | | a perfect world, we'd notice the UA and do some device validation to ensure that the device hasn't changed. We may get this before the year ends, but not before 3.0R. This change gives the adminstrator ample ammunition to take off a foot or two, but hey this *is* UN*X.
* cam_xpt.c:gibbs1998-09-202-9/+25
| | | | | | | | | | | | | | | | | | Add quirk entry for a Samsung drive that doesn't like experiencing the queue full condition. Bump the timeouts for all probe activities to 60s. We don't know what the seletion timeout (or equivelent on other mediums) is for controllers, which can make the transactions at the tail end of a parallel probe take a while to complete. The DPT seems to be a card that takes a long time to see a selection timeout. cam_periph.c: Don't call a device "gone" after a single selection timeout. We need to come up with a better policy. Until that time, you'll have to manually re-scan a bus via camcontrol for the system to decide that a device is really gone. This should give devices experiencing temporary insanity to escape death.
* Only deregister out configuration hook manually if there are no SCSIgibbs1998-09-201-5/+6
| | | | busses to configure.
* Don't leave the device queue in a frozen state if the Synchronize Cachegibbs1998-09-191-1/+8
| | | | command on close fails.
* Fix error recovery in scsi_interpret_sense(). It turns out that ERESTARTken1998-09-191-15/+27
| | | | | | | | | | | wasn't getting sent back for most errors, even if there were retries left on the command. I'm not sure how I ever let this slip by before... In any case, we now send back ERESTART if there are retries left for the command, and send back the default error code when there are no retries left. Reviewed by: gibbs
* Fix the CAM code so that people can compile kernels with the CD driver butken1998-09-184-222/+209
| | | | | | | | | | | | | | | | | without the DA driver. The problem was that the CD driver depended on scsi_read_write() and scsi_start_stop(), which were defined in scsi_da.c. I moved both functions, and their associated data structures and defines from scsi_da.* to scsi_all.*. This is technically the "wrong" thing to do since those commands are really only for direct-access type devices, not for all SCSI devices. I think, though, that the advantage (allowing people to compile kernels without the disk driver) outweighs any architectural purity arguments. PR: kern/7969 Reviewed by: gibbs
* Change the Atlas II quirk entries so they work with differential Atlasken1998-09-181-3/+8
| | | | | | II's. Also, add a quirk entry for the 2 gig Atlas II. Partially Submitted by: Ted Buswell <tbuswell@mediaone.net>
* Fix a formatting error.ken1998-09-171-19/+31
| | | | | | | | | | | | | Fix a problem reported by bde: setting SCSI_DELAY to 0 doesn't work. Now, when the user sets SCSI_DELAY to 0, we re-set it to the minimum allowable bus settle delay (100ms). Fix a potential panic in xptfinishconfigfunc() if the CCB passed in is NULL. Reported by, I think, Nicolas Souchu. Fix a memory leak in the same function (we created a path, but didn't free it) by allocating the getdev CCB and path on the stack. Reviewed by: gibbs
* Some Alpha patches for CAM from Doug Rabson.ken1998-09-162-3/+5
| | | | | Reviewed by: gibbs Submitted by: dfr
* Properly allocate our, per lun, probe peripheral softc fromgibbs1998-09-161-2/+2
| | | | | | the TEMP malloc pool. Noticed by: Don Lewis <Don.Lewis@tsc.tdk.com>
* Check to make sure that this device is opened read-write, not just readken1998-09-162-2/+14
| | | | | | | only. Previously, if the device was chmoded 644, someone could open it with the O_RDONLY flag and issue any ioctl to the device. Reviewed by: imp, gibbs
* Correct printf format bugs.gibbs1998-09-152-8/+9
|
* SCSI Peripheral drivers for CAM:gibbs1998-09-1517-0/+16497
| | | | | | | | | | | | da - Direct Access Devices (disks, optical devices, SS disks) cd - CDROM (or devices that can act like them, WORM, CD-RW, etc) ch - Medium Changer devices. sa - Sequential Access Devices (tape drives) pass - Application pass-thru driver targ - Target Mode "Processor Target" Emulator pt - Processor Target Devices (scanners, cpus, etc.) Submitted by: The CAM Team
* CAM Transport Layer (XPT).gibbs1998-09-1517-0/+9682
Submitted by: The CAM Team
OpenPOWER on IntegriCloud