summaryrefslogtreecommitdiffstats
path: root/sys/cam/scsi/scsi_cd.c
Commit message (Collapse)AuthorAgeFilesLines
* Fix a few problems that Bruce noticed about a month ago, and fix oup oneken1998-11-221-3/+9
| | | | | | | | | | | | 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-221-66/+80
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Clean up some unused variables.ken1998-10-151-5/+1
| | | | | Reviewed by: ken Submitted by: phk
* 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
* Some fixes for the CD and DA drivers from bde. (and some of my own asken1998-10-071-136/+97
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)
* 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.
* Some fixes to the CD driver that may fix PR kern/7996. The data directionken1998-09-201-29/+43
| | | | | | | | | | | | 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-201-1/+7
| | | | | | | 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.
* SCSI Peripheral drivers for CAM:gibbs1998-09-151-0/+3016
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
OpenPOWER on IntegriCloud