diff options
author | ken <ken@FreeBSD.org> | 1999-05-06 20:16:39 +0000 |
---|---|---|
committer | ken <ken@FreeBSD.org> | 1999-05-06 20:16:39 +0000 |
commit | 2bb789d7a3f2adcda33230cdaeda95918cf54a8d (patch) | |
tree | 73c8cd7f798e8bccec0dbcf97e5d0e4447a4ec4e /sys/cam/scsi | |
parent | f57a01ebfcda8effff50ce6f1c90b572e76d8cd2 (diff) | |
download | FreeBSD-src-2bb789d7a3f2adcda33230cdaeda95918cf54a8d.zip FreeBSD-src-2bb789d7a3f2adcda33230cdaeda95918cf54a8d.tar.gz |
Add a number of interrelated CAM feature enhancements and bug fixes.
NOTE: These changes will require recompilation of any userland
applications, like cdrecord, xmcd, etc., that use the CAM passthrough
interface. A make world is recommended.
camcontrol.[c8]:
- We now support two new commands, "tags" and "negotiate".
- The tags commands allows users to view the number of tagged
openings for a device as well as a number of other related
parameters, and it allows users to set tagged openings for
a device.
- The negotiate command allows users to enable and disable
disconnection and tagged queueing, set sync rates, offsets
and bus width. Note that not all of those features are
available for all controllers. Only the adv, ahc, and ncr
drivers fully support all of the features at this point.
Some cards do not allow the setting of sync rates, offsets and
the like, and some of the drivers don't have any facilities to
do so. Some drivers, like the adw driver, only support enabling
or disabling sync negotiation, but do not support setting sync
rates.
- new description in the camcontrol man page of how to format a disk
- cleanup of the camcontrol inquiry command
- add support in the 'devlist' command for skipping unconfigured devices if
-v was not specified on the command line.
- make use of the new base_transfer_speed in the path inquiry CCB.
- fix CCB bzero cases
cam_xpt.c, cam_sim.[ch], cam_ccb.h:
- new flags on many CCB function codes to designate whether they're
non-immediate, use a user-supplied CCB, and can only be passed from
userland programs via the xpt device. Use these flags in the transport
layer and pass driver to categorize CCBs.
- new flag in the transport layer device matching code for device nodes
that indicates whether a device is unconfigured
- bump the CAM version from 0x10 to 0x11
- Change the CAM ioctls to use the version as their group code, so we can
force users to recompile code even when the CCB size doesn't change.
- add + fill in a new value in the path inquiry CCB, base_transfer_speed.
Remove a corresponding field from the cam_sim structure, and add code to
every SIM to set this field to the proper value.
- Fix the set transfer settings code in the transport layer.
scsi_cd.c:
- make some variables volatile instead of just casting them in various
places
- fix a race condition in the changer code
- attach unless we get a "logical unit not supported" error. This should
fix all of the cases where people have devices that return weird errors
when they don't have media in the drive.
scsi_da.c:
- attach unless we get a "logical unit not supported" error
scsi_pass.c:
- for immediate CCBs, just malloc a CCB to send the user request in. This
gets rid of the 'held' count problem in camcontrol tags.
scsi_pass.h:
- change the CAM ioctls to use the CAM version as their group code.
adv driver:
- Allow changing the sync rate and offset separately.
adw driver
- Allow changing the sync rate and offset separately.
aha driver:
- Don't return CAM_REQ_CMP for SET_TRAN_SETTINGS CCBs.
ahc driver:
- Allow setting offset and sync rate separately
bt driver:
- Don't return CAM_REQ_CMP for SET_TRAN_SETTINGS CCBs.
NCR driver:
- Fix the ultra/ultra 2 negotiation bug
- allow setting both the sync rate and offset separately
Other HBA drivers:
- Put code in to set the base_transfer_speed field for
XPT_GET_TRAN_SETTINGS CCBs.
Reviewed by: gibbs, mjacob (isp), imp (aha)
Diffstat (limited to 'sys/cam/scsi')
-rw-r--r-- | sys/cam/scsi/scsi_cd.c | 35 | ||||
-rw-r--r-- | sys/cam/scsi/scsi_da.c | 13 | ||||
-rw-r--r-- | sys/cam/scsi/scsi_pass.c | 48 | ||||
-rw-r--r-- | sys/cam/scsi/scsi_pass.h | 8 |
4 files changed, 70 insertions, 34 deletions
diff --git a/sys/cam/scsi/scsi_cd.c b/sys/cam/scsi/scsi_cd.c index 787abc7..dc23ab3 100644 --- a/sys/cam/scsi/scsi_cd.c +++ b/sys/cam/scsi/scsi_cd.c @@ -24,7 +24,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: scsi_cd.c,v 1.16 1999/04/07 22:57:54 gibbs Exp $ + * $Id: scsi_cd.c,v 1.17 1999/04/19 21:26:17 gibbs Exp $ */ /* * Portions of this driver taken from the original FreeBSD cd driver. @@ -126,7 +126,7 @@ typedef enum { struct cd_softc { cam_pinfo pinfo; cd_state state; - cd_flags flags; + volatile cd_flags flags; struct buf_queue_head buf_queue; LIST_HEAD(, ccb_hdr) pending_ccbs; struct cd_params params; @@ -301,7 +301,7 @@ struct cdchanger { struct cd_softc *cur_device; struct callout_handle short_handle; struct callout_handle long_handle; - cd_changer_flags flags; + volatile cd_changer_flags flags; STAILQ_ENTRY(cdchanger) changer_links; STAILQ_HEAD(chdevlist, cd_softc) chluns; }; @@ -1103,7 +1103,8 @@ cdschedule(struct cam_periph *periph, int priority) * bootstrap things. */ if (((softc->changer->flags & CHANGER_TIMEOUT_SCHED)==0) - &&((softc->changer->flags & CHANGER_NEED_TIMEOUT)==0)){ + && ((softc->changer->flags & CHANGER_NEED_TIMEOUT)==0) + && ((softc->changer->flags & CHANGER_SHORT_TMOUT_SCHED)==0)){ softc->changer->flags |= CHANGER_MANUAL_CALL; cdrunchangerqueue(softc->changer); } @@ -1341,7 +1342,7 @@ cdgetccb(struct cam_periph *periph, u_int32_t priority) * This should work the first time this device is woken up, * but just in case it doesn't, we use a while loop. */ - while ((((volatile cd_flags)softc->flags) & CD_FLAG_ACTIVE)==0){ + while ((softc->flags & CD_FLAG_ACTIVE) == 0) { /* * If this changer isn't already queued, queue it up. */ @@ -1352,10 +1353,10 @@ cdgetccb(struct cam_periph *periph, u_int32_t priority) camq_insert(&softc->changer->devq, (cam_pinfo *)softc); } - if (((((volatile cd_changer_flags)softc->changer->flags) - & CHANGER_TIMEOUT_SCHED)==0) - &&((((volatile cd_changer_flags)softc->changer->flags) - & CHANGER_NEED_TIMEOUT)==0)){ + if (((softc->changer->flags & CHANGER_TIMEOUT_SCHED)==0) + && ((softc->changer->flags & CHANGER_NEED_TIMEOUT)==0) + && ((softc->changer->flags + & CHANGER_SHORT_TMOUT_SCHED)==0)) { softc->changer->flags |= CHANGER_MANUAL_CALL; cdrunchangerqueue(softc->changer); } else @@ -1739,18 +1740,12 @@ cddone(struct cam_periph *periph, union ccb *done_ccb) &asc, &ascq); } /* - * With CDROM devices, we expect 0x3a - * (Medium not present) errors, since not - * everyone leaves a CD in the drive. Some - * broken Philips and HP WORM drives return - * 0x04,0x00 (logical unit not ready, cause - * not reportable), so we accept any "not - * ready" type errors as well. If the error - * is anything else, though, we shouldn't - * attach. + * Attach to anything that claims to be a + * CDROM or WORM device, as long as it + * doesn't return a "Logical unit not + * supported" (0x25) error. */ - if ((have_sense) - && ((asc == 0x3a) || (asc == 0x04)) + if ((have_sense) && (asc != 0x25) && (error_code == SSD_CURRENT_ERROR)) snprintf(announce_buf, sizeof(announce_buf), diff --git a/sys/cam/scsi/scsi_da.c b/sys/cam/scsi/scsi_da.c index 388939d..b603b17 100644 --- a/sys/cam/scsi/scsi_da.c +++ b/sys/cam/scsi/scsi_da.c @@ -25,7 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: scsi_da.c,v 1.20 1999/02/10 00:03:15 ken Exp $ + * $Id: scsi_da.c,v 1.21 1999/03/05 23:20:20 gibbs Exp $ */ #include "opt_hw_wdog.h" @@ -1381,13 +1381,12 @@ dadone(struct cam_periph *periph, union ccb *done_ccb) &asc, &ascq); } /* - * With removable media devices, we expect - * 0x3a (Medium not present) errors, since not - * everyone leaves a disk in the drive. If - * the error is anything else, though, we - * shouldn't attach. + * Attach to anything that claims to be a + * direct access or optical disk device, + * as long as it doesn't return a "Logical + * unit not supported" (0x25) error. */ - if ((have_sense) && (asc == 0x3a) + if ((have_sense) && (asc != 0x25) && (error_code == SSD_CURRENT_ERROR)) snprintf(announce_buf, sizeof(announce_buf), diff --git a/sys/cam/scsi/scsi_pass.c b/sys/cam/scsi/scsi_pass.c index 927b1b8..2f5d973 100644 --- a/sys/cam/scsi/scsi_pass.c +++ b/sys/cam/scsi/scsi_pass.c @@ -24,7 +24,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: scsi_pass.c,v 1.5 1998/11/22 23:44:47 ken Exp $ + * $Id: scsi_pass.c,v 1.6 1999/02/10 00:03:15 ken Exp $ */ #include <sys/param.h> @@ -703,13 +703,55 @@ passioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p) { union ccb *inccb; union ccb *ccb; + int ccb_malloced; inccb = (union ccb *)addr; - ccb = cam_periph_getccb(periph, inccb->ccb_h.pinfo.priority); + + /* + * Some CCB types, like scan bus and scan lun can only go + * through the transport layer device. + */ + if (inccb->ccb_h.func_code & XPT_FC_XPT_ONLY) { + xpt_print_path(periph->path); + printf("CCB function code %#x is restricted to the " + "XPT device\n", inccb->ccb_h.func_code); + error = ENODEV; + break; + } + + /* + * Non-immediate CCBs need a CCB from the per-device pool + * of CCBs, which is scheduled by the transport layer. + * Immediate CCBs and user-supplied CCBs should just be + * malloced. + */ + if ((inccb->ccb_h.func_code & XPT_FC_QUEUED) + && ((inccb->ccb_h.func_code & XPT_FC_USER_CCB) == 0)) { + ccb = cam_periph_getccb(periph, + inccb->ccb_h.pinfo.priority); + ccb_malloced = 0; + } else { + ccb = xpt_alloc_ccb(); + + if (ccb != NULL) + xpt_setup_ccb(&ccb->ccb_h, periph->path, + inccb->ccb_h.pinfo.priority); + ccb_malloced = 1; + } + + if (ccb == NULL) { + xpt_print_path(periph->path); + printf("unable to allocate CCB\n"); + error = ENOMEM; + break; + } error = passsendccb(periph, ccb, inccb); - xpt_release_ccb(ccb); + if (ccb_malloced) + xpt_free_ccb(ccb); + else + xpt_release_ccb(ccb); break; } diff --git a/sys/cam/scsi/scsi_pass.h b/sys/cam/scsi/scsi_pass.h index 501598b..12ad2e2 100644 --- a/sys/cam/scsi/scsi_pass.h +++ b/sys/cam/scsi/scsi_pass.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997 Kenneth D. Merry. + * Copyright (c) 1997, 1999 Kenneth D. Merry. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -22,7 +22,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id$ + * $Id: scsi_pass.h,v 1.1 1998/09/15 06:36:34 gibbs Exp $ */ #ifndef _SCSI_PASS_H @@ -32,7 +32,7 @@ #include <cam/cam_ccb.h> -#define CAMIOCOMMAND _IOWR('Q', 2, union ccb) -#define CAMGETPASSTHRU _IOWR('Q', 3, union ccb) +#define CAMIOCOMMAND _IOWR(CAM_VERSION, 2, union ccb) +#define CAMGETPASSTHRU _IOWR(CAM_VERSION, 3, union ccb) #endif |