diff options
author | gibbs <gibbs@FreeBSD.org> | 1999-05-22 22:00:24 +0000 |
---|---|---|
committer | gibbs <gibbs@FreeBSD.org> | 1999-05-22 22:00:24 +0000 |
commit | be248a4a6493da664f9e14253f2ccf7992ffbc5f (patch) | |
tree | e4105b2075b31704f7f5f5138df451433d8029bf /sys/cam | |
parent | 95dc85b099eb4f732b322f090ce0abad1280fbfd (diff) | |
download | FreeBSD-src-be248a4a6493da664f9e14253f2ccf7992ffbc5f.zip FreeBSD-src-be248a4a6493da664f9e14253f2ccf7992ffbc5f.tar.gz |
Add a default async handler funstion to cam_periph.c to remove duplicated
code in all initiator type peripheral drivers.
scsi_target.c:
Release ATIO structures that wind up in the 'unkown command queue'
for consumption by our userland counterpart, back to the controller
when the exception for that command is cleared.
Diffstat (limited to 'sys/cam')
-rw-r--r-- | sys/cam/scsi/scsi_all.h | 29 | ||||
-rw-r--r-- | sys/cam/scsi/scsi_cd.c | 11 | ||||
-rw-r--r-- | sys/cam/scsi/scsi_ch.c | 11 | ||||
-rw-r--r-- | sys/cam/scsi/scsi_da.c | 11 | ||||
-rw-r--r-- | sys/cam/scsi/scsi_pass.c | 11 | ||||
-rw-r--r-- | sys/cam/scsi/scsi_pt.c | 13 | ||||
-rw-r--r-- | sys/cam/scsi/scsi_sa.c | 11 | ||||
-rw-r--r-- | sys/cam/scsi/scsi_target.c | 4 |
8 files changed, 46 insertions, 55 deletions
diff --git a/sys/cam/scsi/scsi_all.h b/sys/cam/scsi/scsi_all.h index bedd144..9ced6c3 100644 --- a/sys/cam/scsi/scsi_all.h +++ b/sys/cam/scsi/scsi_all.h @@ -14,7 +14,7 @@ * * Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992 * - * $Id: scsi_all.h,v 1.6 1998/12/05 22:10:14 mjacob Exp $ + * $Id: scsi_all.h,v 1.7 1999/05/09 01:25:22 ken Exp $ */ /* @@ -26,6 +26,33 @@ #include <sys/cdefs.h> +#ifdef KERNEL +#include "opt_scsi.h" +/* + * This is the number of seconds we wait for devices to settle after a SCSI + * bus reset. + */ +#ifndef SCSI_DELAY +#define SCSI_DELAY 2000 +#endif +/* + * If someone sets this to 0, we assume that they want the minimum + * allowable bus settle delay. All devices need _some_ sort of bus settle + * delay, so we'll set it to a minimum value of 100ms. + */ +#if (SCSI_DELAY == 0) +#undef SCSI_DELAY +#define SCSI_DELAY 100 +#endif + +/* + * Make sure the user isn't using seconds instead of milliseconds. + */ +#if (SCSI_DELAY < 100) +#error "SCSI_DELAY is in milliseconds, not seconds! Please use a larger value" +#endif +#endif /* KERNEL */ + /* * SCSI command format */ diff --git a/sys/cam/scsi/scsi_cd.c b/sys/cam/scsi/scsi_cd.c index 8779545..d7d96cc 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.19 1999/05/07 07:02:57 phk Exp $ + * $Id: scsi_cd.c,v 1.20 1999/05/09 01:25:24 ken Exp $ */ /* * Portions of this driver taken from the original FreeBSD cd driver. @@ -531,9 +531,6 @@ cdasync(void *callback_arg, u_int32_t code, break; } - case AC_LOST_DEVICE: - cam_periph_invalidate(periph); - break; case AC_SENT_BDR: case AC_BUS_RESET: { @@ -552,12 +549,10 @@ cdasync(void *callback_arg, u_int32_t code, ccbh != NULL; ccbh = LIST_NEXT(ccbh, periph_links.le)) ccbh->ccb_state |= CD_CCB_RETRY_UA; splx(s); - break; + /* FALLTHROUGH */ } - case AC_TRANSFER_NEG: - case AC_SCSI_AEN: - case AC_UNSOL_RESEL: default: + cam_periph_async(periph, code, path, arg); break; } } diff --git a/sys/cam/scsi/scsi_ch.c b/sys/cam/scsi/scsi_ch.c index 418426f..3e5ec38 100644 --- a/sys/cam/scsi/scsi_ch.c +++ b/sys/cam/scsi/scsi_ch.c @@ -24,7 +24,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: scsi_ch.c,v 1.10 1999/02/10 00:03:15 ken Exp $ + * $Id: scsi_ch.c,v 1.11 1999/05/09 01:25:26 ken Exp $ */ /* * Derived from the NetBSD SCSI changer driver. @@ -362,15 +362,8 @@ chasync(void *callback_arg, u_int32_t code, struct cam_path *path, void *arg) break; } - case AC_LOST_DEVICE: - cam_periph_invalidate(periph); - break; - case AC_TRANSFER_NEG: - case AC_SENT_BDR: - case AC_SCSI_AEN: - case AC_UNSOL_RESEL: - case AC_BUS_RESET: default: + cam_periph_async(periph, code, path, arg); break; } } diff --git a/sys/cam/scsi/scsi_da.c b/sys/cam/scsi/scsi_da.c index 980911e..4a5e000 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.23 1999/05/07 07:02:59 phk Exp $ + * $Id: scsi_da.c,v 1.24 1999/05/09 01:25:28 ken Exp $ */ #include "opt_hw_wdog.h" @@ -936,9 +936,6 @@ daasync(void *callback_arg, u_int32_t code, "due to status 0x%x\n", status); break; } - case AC_LOST_DEVICE: - cam_periph_invalidate(periph); - break; case AC_SENT_BDR: case AC_BUS_RESET: { @@ -957,12 +954,10 @@ daasync(void *callback_arg, u_int32_t code, ccbh != NULL; ccbh = LIST_NEXT(ccbh, periph_links.le)) ccbh->ccb_state |= DA_CCB_RETRY_UA; splx(s); - break; + /* FALLTHROUGH*/ } - case AC_TRANSFER_NEG: - case AC_SCSI_AEN: - case AC_UNSOL_RESEL: default: + cam_periph_async(periph, code, path, arg); break; } } diff --git a/sys/cam/scsi/scsi_pass.c b/sys/cam/scsi/scsi_pass.c index 897a49f..37cdd55 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.8 1999/05/07 07:03:00 phk Exp $ + * $Id: scsi_pass.c,v 1.9 1999/05/09 01:25:30 ken Exp $ */ #include <sys/param.h> @@ -296,15 +296,8 @@ passasync(void *callback_arg, u_int32_t code, break; } - case AC_LOST_DEVICE: - cam_periph_invalidate(periph); - break; - case AC_TRANSFER_NEG: - case AC_SENT_BDR: - case AC_SCSI_AEN: - case AC_UNSOL_RESEL: - case AC_BUS_RESET: default: + cam_periph_async(periph, code, path, arg); break; } } diff --git a/sys/cam/scsi/scsi_pt.c b/sys/cam/scsi/scsi_pt.c index 7762b64..f6bba3b 100644 --- a/sys/cam/scsi/scsi_pt.c +++ b/sys/cam/scsi/scsi_pt.c @@ -25,7 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: scsi_pt.c,v 1.6 1999/05/07 07:03:01 phk Exp $ + * $Id: scsi_pt.c,v 1.7 1999/05/09 01:25:32 ken Exp $ */ #include <sys/param.h> @@ -479,11 +479,6 @@ ptasync(void *callback_arg, u_int32_t code, struct cam_path *path, void *arg) "due to status 0x%x\n", status); break; } - case AC_LOST_DEVICE: - { - cam_periph_invalidate(periph); - break; - } case AC_SENT_BDR: case AC_BUS_RESET: { @@ -502,12 +497,10 @@ ptasync(void *callback_arg, u_int32_t code, struct cam_path *path, void *arg) ccbh != NULL; ccbh = LIST_NEXT(ccbh, periph_links.le)) ccbh->ccb_state |= PT_CCB_RETRY_UA; splx(s); - break; + /* FALLTHROUGH */ } - case AC_TRANSFER_NEG: - case AC_SCSI_AEN: - case AC_UNSOL_RESEL: default: + cam_periph_async(periph, code, path, arg); break; } } diff --git a/sys/cam/scsi/scsi_sa.c b/sys/cam/scsi/scsi_sa.c index 8771857..76e960c 100644 --- a/sys/cam/scsi/scsi_sa.c +++ b/sys/cam/scsi/scsi_sa.c @@ -1,5 +1,5 @@ /* - * $Id: scsi_sa.c,v 1.23 1999/05/09 01:25:34 ken Exp $ + * $Id: scsi_sa.c,v 1.24 1999/05/11 04:01:35 mjacob Exp $ * * Implementation of SCSI Sequential Access Peripheral driver for CAM. * @@ -1247,15 +1247,8 @@ saasync(void *callback_arg, u_int32_t code, "due to status 0x%x\n", status); break; } - case AC_LOST_DEVICE: - cam_periph_invalidate(periph); - break; - case AC_TRANSFER_NEG: - case AC_SENT_BDR: - case AC_SCSI_AEN: - case AC_UNSOL_RESEL: - case AC_BUS_RESET: default: + cam_periph_async(periph, code, path, arg); break; } } diff --git a/sys/cam/scsi/scsi_target.c b/sys/cam/scsi/scsi_target.c index a75b001..191a991 100644 --- a/sys/cam/scsi/scsi_target.c +++ b/sys/cam/scsi/scsi_target.c @@ -25,7 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: scsi_target.c,v 1.10 1999/05/04 19:24:21 gibbs Exp $ + * $Id: scsi_target.c,v 1.11 1999/05/07 07:03:03 phk Exp $ */ #include <stddef.h> /* For offsetof */ @@ -778,6 +778,8 @@ targioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p) if (ccbh != NULL) { TAILQ_REMOVE(&softc->unknown_atio_queue, ccbh, periph_links.tqe); + /* Requeue the ATIO back to the controller */ + xpt_action((union ccb *)ccbh); ccbh = TAILQ_FIRST(&softc->unknown_atio_queue); } if (ccbh != NULL) |