diff options
Diffstat (limited to 'sys')
59 files changed, 658 insertions, 613 deletions
diff --git a/sys/arch/hp300/dev/mb89352.c b/sys/arch/hp300/dev/mb89352.c index b0f4af988cb..fcdd214e10a 100644 --- a/sys/arch/hp300/dev/mb89352.c +++ b/sys/arch/hp300/dev/mb89352.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mb89352.c,v 1.21 2010/01/13 06:09:44 krw Exp $ */ +/* $OpenBSD: mb89352.c,v 1.22 2010/03/23 01:57:19 krw Exp $ */ /* $NetBSD: mb89352.c,v 1.5 2000/03/23 07:01:31 thorpej Exp $ */ /* NecBSD: mb89352.c,v 1.4 1998/03/14 07:31:20 kmatsuda Exp */ @@ -137,7 +137,7 @@ int spc_debug = 0x00; /* SPC_SHOWSTART|SPC_SHOWMISC|SPC_SHOWTRACE; */ void spc_done (struct spc_softc *, struct spc_acb *); void spc_dequeue (struct spc_softc *, struct spc_acb *); -int spc_scsi_cmd (struct scsi_xfer *); +void spc_scsi_cmd (struct scsi_xfer *); int spc_poll (struct spc_softc *, struct scsi_xfer *, int); void spc_sched_msgout(struct spc_softc *, u_char); void spc_setsync(struct spc_softc *, struct spc_tinfo *); @@ -398,7 +398,7 @@ spc_get_acb(struct spc_softc *sc, int flags) * This function is called by the higher level SCSI-driver to queue/run * SCSI-commands. */ -int +void spc_scsi_cmd(struct scsi_xfer *xs) { struct scsi_link *sc_link = xs->sc_link; @@ -412,7 +412,11 @@ spc_scsi_cmd(struct scsi_xfer *xs) flags = xs->flags; if ((acb = spc_get_acb(sc, flags)) == NULL) { - return (NO_CCB); + xs->error = XS_NO_CCB; + s= splbio(); + scsi_done(xs); + splx(s); + return; } /* Initialize acb */ @@ -442,13 +446,12 @@ spc_scsi_cmd(struct scsi_xfer *xs) spc_sched(sc); /* * After successful sending, check if we should return just now. - * If so, return SUCCESSFULLY_QUEUED. */ splx(s); if ((flags & SCSI_POLL) == 0) - return SUCCESSFULLY_QUEUED; + return; /* Not allowed to use interrupts, use polling instead */ s = splbio(); @@ -458,7 +461,6 @@ spc_scsi_cmd(struct scsi_xfer *xs) spc_timeout(acb); } splx(s); - return COMPLETE; } /* diff --git a/sys/arch/luna88k/dev/mb89352.c b/sys/arch/luna88k/dev/mb89352.c index 1ea542c8b82..42b18f50ccd 100644 --- a/sys/arch/luna88k/dev/mb89352.c +++ b/sys/arch/luna88k/dev/mb89352.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mb89352.c,v 1.11 2010/01/13 06:09:44 krw Exp $ */ +/* $OpenBSD: mb89352.c,v 1.12 2010/03/23 01:57:19 krw Exp $ */ /* $NetBSD: mb89352.c,v 1.5 2000/03/23 07:01:31 thorpej Exp $ */ /* NecBSD: mb89352.c,v 1.4 1998/03/14 07:31:20 kmatsuda Exp */ @@ -150,7 +150,7 @@ int spc_debug = 0x00; /* SPC_SHOWSTART|SPC_SHOWMISC|SPC_SHOWTRACE; */ void spc_done (struct spc_softc *, struct spc_acb *); void spc_dequeue (struct spc_softc *, struct spc_acb *); -int spc_scsi_cmd (struct scsi_xfer *); +void spc_scsi_cmd (struct scsi_xfer *); int spc_poll (struct spc_softc *, struct scsi_xfer *, int); integrate void spc_sched_msgout(struct spc_softc *, u_char); integrate void spc_setsync(struct spc_softc *, struct spc_tinfo *); @@ -427,7 +427,7 @@ spc_get_acb(sc, flags) * This function is called by the higher level SCSI-driver to queue/run * SCSI-commands. */ -int +void spc_scsi_cmd(xs) struct scsi_xfer *xs; { @@ -442,7 +442,11 @@ spc_scsi_cmd(xs) flags = xs->flags; if ((acb = spc_get_acb(sc, flags)) == NULL) { - return (NO_CCB); + xs->error = XS_NO_CCB; + s = splbio(); + scsi_done(xs); + splx(s); + return; } /* Initialize acb */ @@ -472,13 +476,12 @@ spc_scsi_cmd(xs) spc_sched(sc); /* * After successful sending, check if we should return just now. - * If so, return SUCCESSFULLY_QUEUED. */ splx(s); if ((flags & SCSI_POLL) == 0) - return SUCCESSFULLY_QUEUED; + return; /* Not allowed to use interrupts, use polling instead */ s = splbio(); @@ -488,7 +491,6 @@ spc_scsi_cmd(xs) spc_timeout(acb); } splx(s); - return COMPLETE; } /* diff --git a/sys/arch/luna88k/dev/mb89352var.h b/sys/arch/luna88k/dev/mb89352var.h index e77f0649a05..e94a5011d75 100644 --- a/sys/arch/luna88k/dev/mb89352var.h +++ b/sys/arch/luna88k/dev/mb89352var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mb89352var.h,v 1.1 2004/04/21 15:23:55 aoyama Exp $ */ +/* $OpenBSD: mb89352var.h,v 1.2 2010/03/23 01:57:19 krw Exp $ */ /* $NetBSD: mb89352var.h,v 1.6 2003/08/02 12:48:09 tsutsui Exp $ */ /* NecBSD: mb89352var.h,v 1.4 1998/03/14 07:31:22 kmatsuda Exp */ @@ -209,6 +209,6 @@ int spc_intr(void *); int spc_find(bus_space_tag_t, bus_space_handle_t, int); void spc_init(struct spc_softc *); void spc_sched(struct spc_softc *); -int spc_scsi_cmd(struct scsi_xfer *); +void spc_scsi_cmd(struct scsi_xfer *); void spc_minphys(struct buf *); #endif /* _MB89352VAR_H_ */ diff --git a/sys/arch/mac68k/dev/ncr5380.c b/sys/arch/mac68k/dev/ncr5380.c index 9324557d98b..201cab11ff6 100644 --- a/sys/arch/mac68k/dev/ncr5380.c +++ b/sys/arch/mac68k/dev/ncr5380.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ncr5380.c,v 1.37 2010/01/13 06:09:44 krw Exp $ */ +/* $OpenBSD: ncr5380.c,v 1.38 2010/03/23 01:57:19 krw Exp $ */ /* $NetBSD: ncr5380.c,v 1.38 1996/12/19 21:48:18 scottr Exp $ */ /* @@ -74,7 +74,7 @@ static volatile int main_running = 0; static u_char busy; static void ncr5380_minphys(struct buf *bp, struct scsi_link *sl); -static int mac68k_ncr5380_scsi_cmd(struct scsi_xfer *xs); +static void mac68k_ncr5380_scsi_cmd(struct scsi_xfer *xs); static void ncr5380_show_scsi_cmd(struct scsi_xfer *xs); struct scsi_adapter ncr5380_switch = { @@ -287,7 +287,7 @@ void *auxp; /* * Carry out a request from the high level driver. */ -static int +static void mac68k_ncr5380_scsi_cmd(struct scsi_xfer *xs) { int sps; @@ -300,7 +300,7 @@ mac68k_ncr5380_scsi_cmd(struct scsi_xfer *xs) if (flags & SCSI_RESET) { scsi_reset_verbose(xs->sc_link->adapter_softc, "Got reset-command"); - return (COMPLETE); + return; } /* @@ -308,8 +308,10 @@ mac68k_ncr5380_scsi_cmd(struct scsi_xfer *xs) */ sps = splbio(); if ((reqp = free_head) == 0) { + xs->error = XS_NO_CCB; + scsi_done(xs); splx(sps); - return (NO_CCB); + return; } free_head = reqp->next; reqp->next = NULL; @@ -380,10 +382,6 @@ mac68k_ncr5380_scsi_cmd(struct scsi_xfer *xs) #endif run_main(xs->sc_link->adapter_softc); - - if (xs->flags & (SCSI_POLL|ITSDONE)) - return (COMPLETE); /* We're booting or run_main has completed */ - return (SUCCESSFULLY_QUEUED); } static void diff --git a/sys/arch/macppc/dev/mesh.c b/sys/arch/macppc/dev/mesh.c index 57ef3f965de..d3e8b2308dd 100644 --- a/sys/arch/macppc/dev/mesh.c +++ b/sys/arch/macppc/dev/mesh.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mesh.c,v 1.24 2010/01/13 06:09:44 krw Exp $ */ +/* $OpenBSD: mesh.c,v 1.25 2010/03/23 01:57:19 krw Exp $ */ /* $NetBSD: mesh.c,v 1.1 1999/02/19 13:06:03 tsubai Exp $ */ /*- @@ -236,7 +236,7 @@ int mesh_stp(struct mesh_softc *, int); void mesh_setsync(struct mesh_softc *, struct mesh_tinfo *); struct mesh_scb *mesh_get_scb(struct mesh_softc *); void mesh_free_scb(struct mesh_softc *, struct mesh_scb *); -int mesh_scsi_cmd(struct scsi_xfer *); +void mesh_scsi_cmd(struct scsi_xfer *); void mesh_sched(struct mesh_softc *); int mesh_poll(struct scsi_xfer *); void mesh_done(struct mesh_softc *, struct mesh_scb *); @@ -1030,7 +1030,7 @@ mesh_free_scb(struct mesh_softc *sc, struct mesh_scb *scb) TAILQ_INSERT_TAIL(&sc->free_scb, scb, chain); } -int +void mesh_scsi_cmd(struct scsi_xfer *xs) { struct scsi_link *sc_link = xs->sc_link;; @@ -1042,9 +1042,13 @@ mesh_scsi_cmd(struct scsi_xfer *xs) flags = xs->flags; s = splbio(); scb = mesh_get_scb(sc); + if (scb == NULL) { + xs->error = XS_NO_CCB; + scsi_done(xs); + splx(s); + return; + } splx(s); - if (scb == NULL) - return (NO_CCB); DPRINTF("cmdlen: %d\n", xs->cmdlen); scb->xs = xs; scb->flags = 0; @@ -1075,10 +1079,7 @@ mesh_scsi_cmd(struct scsi_xfer *xs) sc->sc_dev.dv_xname); } - return COMPLETE; } - - return SUCCESSFULLY_QUEUED; } void diff --git a/sys/arch/mvme68k/dev/sbic.c b/sys/arch/mvme68k/dev/sbic.c index a51033aff25..e15b2e1349b 100644 --- a/sys/arch/mvme68k/dev/sbic.c +++ b/sys/arch/mvme68k/dev/sbic.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sbic.c,v 1.24 2010/01/09 23:15:06 krw Exp $ */ +/* $OpenBSD: sbic.c,v 1.25 2010/03/23 01:57:19 krw Exp $ */ /* $NetBSD: sbic.c,v 1.2 1996/04/23 16:32:54 chuck Exp $ */ /* @@ -367,7 +367,11 @@ sbic_scsicmd(xs) Debugger(); #endif #endif - return (NO_CCB); + xs->error = XS_NO_CCB; + s = splbio(); + scsi_done(xs); + splx(s); + return; } if ( flags & SCSI_DATA_IN ) @@ -419,7 +423,7 @@ sbic_scsicmd(xs) splx(s); - return(COMPLETE); + return; } s = splbio(); @@ -432,8 +436,6 @@ sbic_scsicmd(xs) sbic_sched(dev); splx(s); - - return(SUCCESSFULLY_QUEUED); } /* diff --git a/sys/arch/mvme68k/dev/vs.c b/sys/arch/mvme68k/dev/vs.c index 5c77815059d..7f16bf3e2b8 100644 --- a/sys/arch/mvme68k/dev/vs.c +++ b/sys/arch/mvme68k/dev/vs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vs.c,v 1.30 2010/01/09 23:15:06 krw Exp $ */ +/* $OpenBSD: vs.c,v 1.31 2010/03/23 01:57:19 krw Exp $ */ /* * Copyright (c) 2004, 2009, Miodrag Vallat. @@ -64,7 +64,7 @@ int vsmatch(struct device *, void *, void *); void vsattach(struct device *, struct device *, void *); void vs_minphys(struct buf *, struct scsi_link *); -int vs_scsicmd(struct scsi_xfer *); +void vs_scsicmd(struct scsi_xfer *); struct scsi_adapter vs_scsiswitch = { vs_scsicmd, @@ -104,7 +104,7 @@ int vs_load_command(struct vs_softc *, struct vs_cb *, bus_addr_t, bus_addr_t, struct scsi_link *, int, struct scsi_generic *, int, uint8_t *, int); int vs_nintr(void *); -int vs_poll(struct vs_softc *, struct vs_cb *); +void vs_poll(struct vs_softc *, struct vs_cb *); void vs_print_addr(struct vs_softc *, struct scsi_xfer *); struct vs_cb *vs_find_queue(struct scsi_link *, struct vs_softc *); void vs_reset(struct vs_softc *, int); @@ -327,7 +327,7 @@ do_vspoll(struct vs_softc *sc, struct scsi_xfer *xs, int canreset) return 0; } -int +void vs_poll(struct vs_softc *sc, struct vs_cb *cb) { struct scsi_xfer *xs; @@ -355,7 +355,6 @@ vs_poll(struct vs_softc *sc, struct vs_cb *cb) CRB_CLR_DONE; vs_clear_return_info(sc); - return (COMPLETE); } void @@ -418,7 +417,7 @@ vs_scsidone(struct vs_softc *sc, struct vs_cb *cb) scsi_done(xs); } -int +void vs_scsicmd(struct scsi_xfer *xs) { struct scsi_link *slp = xs->sc_link; @@ -447,7 +446,11 @@ vs_scsicmd(struct scsi_xfer *xs) if (cb->cb_xs != NULL) { printf("%s: master command not idle\n", sc->sc_dev.dv_xname); - return (NO_CCB); + xs->error = XS_NO_CCB; + s = splbio(); + scsi_done(xs); + splx(s); + return; } #endif s = splbio(); @@ -460,7 +463,10 @@ vs_scsicmd(struct scsi_xfer *xs) printf("%s: queue for target %d is busy\n", sc->sc_dev.dv_xname, slp->target); #endif - return (NO_CCB); + xs->error = XS_NO_CCB; + s = splbio(); + scsi_done(xs); + splx(s); } if (vs_getcqe(sc, &cqep, &iopb)) { /* XXX shouldn't happen since our queue is ready */ @@ -468,7 +474,10 @@ vs_scsicmd(struct scsi_xfer *xs) #ifdef VS_DEBUG printf("%s: no free CQEs\n", sc->sc_dev.dv_xname); #endif - return (NO_CCB); + xs->error = XS_NO_CCB; + s = splbio(); + scsi_done(xs); + splx(s); } } @@ -484,7 +493,7 @@ vs_scsicmd(struct scsi_xfer *xs) xs->error = XS_DRIVER_STUFFUP; scsi_done(xs); splx(s); - return (COMPLETE); + return; } vs_write(1, cqep + CQE_WORK_QUEUE, cb->cb_q); @@ -501,10 +510,8 @@ vs_scsicmd(struct scsi_xfer *xs) if (flags & SCSI_POLL) { /* poll for the command to complete */ - return vs_poll(sc, cb); + vs_poll(sc, cb); } - - return (SUCCESSFULLY_QUEUED); } int diff --git a/sys/arch/mvme68k/dev/vsbic.c b/sys/arch/mvme68k/dev/vsbic.c index 1841138c7f6..8d10bec56a1 100644 --- a/sys/arch/mvme68k/dev/vsbic.c +++ b/sys/arch/mvme68k/dev/vsbic.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vsbic.c,v 1.4 2010/01/10 00:10:23 krw Exp $ */ +/* $OpenBSD: vsbic.c,v 1.5 2010/03/23 01:57:19 krw Exp $ */ /* * Copyright (c) 2008, 2009 Miodrag Vallat. @@ -411,7 +411,7 @@ void vsbic_queue_cmd(struct vsbic_softc *, struct bpp_chan *, int vsbic_request_sense(struct vsbic_softc *, struct vsbic_ccb *); void vsbic_reset_command(struct vsbic_softc *, struct vsbic_cmd *, struct scsi_link *); -int vsbic_scsicmd(struct scsi_xfer *); +void vsbic_scsicmd(struct scsi_xfer *); int vsbic_scsireset(struct vsbic_softc *, struct scsi_xfer *); void vsbic_timeout(void *); void vsbic_wrapup(struct vsbic_softc *, struct vsbic_ccb *); @@ -1128,7 +1128,7 @@ vsbic_reset_command(struct vsbic_softc *sc, struct vsbic_cmd *cmd, /* * Try and send a command to the board. */ -int +void vsbic_scsicmd(struct scsi_xfer *xs) { struct scsi_link *sl = xs->sc_link; @@ -1152,7 +1152,7 @@ vsbic_scsicmd(struct scsi_xfer *xs) xs->error = XS_DRIVER_STUFFUP; scsi_done(xs); splx(s); - return COMPLETE; + return; } #endif @@ -1176,7 +1176,7 @@ vsbic_scsicmd(struct scsi_xfer *xs) xs->error = XS_SENSE; scsi_done(xs); splx(s); - return COMPLETE; + return; } /* @@ -1188,8 +1188,10 @@ vsbic_scsicmd(struct scsi_xfer *xs) #ifdef VSBIC_DEBUG printf("%s: no free CCB\n", DEVNAME(sc)); #endif + xs->error = XS_NO_CCB; + scsi_done(xs); splx(s); - return NO_CCB; + return; } env = bpp_get_envelope(bsc); @@ -1198,8 +1200,10 @@ vsbic_scsicmd(struct scsi_xfer *xs) printf("%s: no free envelope\n", DEVNAME(sc)); #endif vsbic_free_ccb(sc, ccb); + xs->error = XS_NO_CCB; + scsi_done(xs); splx(s); - return NO_CCB; + return; } cmd = vsbic_get_cmd(sc); if (cmd == NULL) { @@ -1208,8 +1212,10 @@ vsbic_scsicmd(struct scsi_xfer *xs) #endif bpp_put_envelope(bsc, env); vsbic_free_ccb(sc, ccb); + xs->error = XS_NO_CCB; + scsi_done(xs); splx(s); - return NO_CCB; + return; } ccb->ccb_xs = xs; @@ -1231,7 +1237,7 @@ vsbic_scsicmd(struct scsi_xfer *xs) xs->error = XS_DRIVER_STUFFUP; scsi_done(xs); splx(s); - return (COMPLETE); + return; } /* @@ -1248,11 +1254,9 @@ vsbic_scsicmd(struct scsi_xfer *xs) if (ISSET(xs->flags, SCSI_POLL)) { splx(s); vsbic_poll(sc, ccb); - return (COMPLETE); } else { timeout_add_msec(&xs->stimeout, xs->timeout); splx(s); - return (SUCCESSFULLY_QUEUED); } } diff --git a/sys/arch/mvme88k/dev/vs.c b/sys/arch/mvme88k/dev/vs.c index 38a51672b93..d2d0f12dfb5 100644 --- a/sys/arch/mvme88k/dev/vs.c +++ b/sys/arch/mvme88k/dev/vs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vs.c,v 1.78 2010/01/09 23:15:06 krw Exp $ */ +/* $OpenBSD: vs.c,v 1.79 2010/03/23 01:57:19 krw Exp $ */ /* * Copyright (c) 2004, 2009, Miodrag Vallat. @@ -65,7 +65,7 @@ int vsmatch(struct device *, void *, void *); void vsattach(struct device *, struct device *, void *); void vs_minphys(struct buf *, struct scsi_link *); -int vs_scsicmd(struct scsi_xfer *); +void vs_scsicmd(struct scsi_xfer *); struct scsi_adapter vs_scsiswitch = { vs_scsicmd, @@ -105,7 +105,7 @@ int vs_load_command(struct vs_softc *, struct vs_cb *, bus_addr_t, bus_addr_t, struct scsi_link *, int, struct scsi_generic *, int, uint8_t *, int); int vs_nintr(void *); -int vs_poll(struct vs_softc *, struct vs_cb *); +void vs_poll(struct vs_softc *, struct vs_cb *); void vs_print_addr(struct vs_softc *, struct scsi_xfer *); struct vs_cb *vs_find_queue(struct scsi_link *, struct vs_softc *); void vs_reset(struct vs_softc *, int); @@ -312,7 +312,7 @@ do_vspoll(struct vs_softc *sc, struct scsi_xfer *xs, int canreset) return 0; } -int +void vs_poll(struct vs_softc *sc, struct vs_cb *cb) { struct scsi_xfer *xs; @@ -340,7 +340,6 @@ vs_poll(struct vs_softc *sc, struct vs_cb *cb) CRB_CLR_DONE; vs_clear_return_info(sc); - return (COMPLETE); } void @@ -403,7 +402,7 @@ vs_scsidone(struct vs_softc *sc, struct vs_cb *cb) scsi_done(xs); } -int +void vs_scsicmd(struct scsi_xfer *xs) { struct scsi_link *slp = xs->sc_link; @@ -432,7 +431,11 @@ vs_scsicmd(struct scsi_xfer *xs) if (cb->cb_xs != NULL) { printf("%s: master command not idle\n", sc->sc_dev.dv_xname); - return (NO_CCB); + xs->error = XS_NO_CCB; + s = splbio(); + scsi_done(xs); + splx(s); + return; } #endif s = splbio(); @@ -445,7 +448,11 @@ vs_scsicmd(struct scsi_xfer *xs) printf("%s: queue for target %d is busy\n", sc->sc_dev.dv_xname, slp->target); #endif - return (NO_CCB); + xs->error = XS_NO_CCB; + s = splbio(); + scsi_done(xs); + splx(s); + return; } if (vs_getcqe(sc, &cqep, &iopb)) { /* XXX shouldn't happen since our queue is ready */ @@ -453,7 +460,11 @@ vs_scsicmd(struct scsi_xfer *xs) #ifdef VS_DEBUG printf("%s: no free CQEs\n", sc->sc_dev.dv_xname); #endif - return (NO_CCB); + xs->error = XS_NO_CCB; + s = splbio(); + scsi_done(xs); + splx(s); + return; } } @@ -469,7 +480,7 @@ vs_scsicmd(struct scsi_xfer *xs) xs->error = XS_DRIVER_STUFFUP; scsi_done(xs); splx(s); - return (COMPLETE); + return; } vs_write(1, cqep + CQE_WORK_QUEUE, cb->cb_q); @@ -486,10 +497,8 @@ vs_scsicmd(struct scsi_xfer *xs) if (flags & SCSI_POLL) { /* poll for the command to complete */ - return vs_poll(sc, cb); + vs_poll(sc, cb); } - - return (SUCCESSFULLY_QUEUED); } int diff --git a/sys/arch/mvme88k/dev/vsbic.c b/sys/arch/mvme88k/dev/vsbic.c index 48d879f4ff2..e65246e4f85 100644 --- a/sys/arch/mvme88k/dev/vsbic.c +++ b/sys/arch/mvme88k/dev/vsbic.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vsbic.c,v 1.5 2010/01/10 00:10:23 krw Exp $ */ +/* $OpenBSD: vsbic.c,v 1.6 2010/03/23 01:57:19 krw Exp $ */ /* * Copyright (c) 2008, 2009 Miodrag Vallat. @@ -411,7 +411,7 @@ void vsbic_queue_cmd(struct vsbic_softc *, struct bpp_chan *, int vsbic_request_sense(struct vsbic_softc *, struct vsbic_ccb *); void vsbic_reset_command(struct vsbic_softc *, struct vsbic_cmd *, struct scsi_link *); -int vsbic_scsicmd(struct scsi_xfer *); +void vsbic_scsicmd(struct scsi_xfer *); int vsbic_scsireset(struct vsbic_softc *, struct scsi_xfer *); void vsbic_timeout(void *); void vsbic_wrapup(struct vsbic_softc *, struct vsbic_ccb *); @@ -1128,7 +1128,7 @@ vsbic_reset_command(struct vsbic_softc *sc, struct vsbic_cmd *cmd, /* * Try and send a command to the board. */ -int +void vsbic_scsicmd(struct scsi_xfer *xs) { struct scsi_link *sl = xs->sc_link; @@ -1152,7 +1152,7 @@ vsbic_scsicmd(struct scsi_xfer *xs) xs->error = XS_DRIVER_STUFFUP; scsi_done(xs); splx(s); - return COMPLETE; + return; } #endif @@ -1176,7 +1176,7 @@ vsbic_scsicmd(struct scsi_xfer *xs) xs->error = XS_SENSE; scsi_done(xs); splx(s); - return COMPLETE; + return; } /* @@ -1188,8 +1188,9 @@ vsbic_scsicmd(struct scsi_xfer *xs) #ifdef VSBIC_DEBUG printf("%s: no free CCB\n", DEVNAME(sc)); #endif + xs->error = XS_NO_CCB; + scsi_done(xs); splx(s); - return NO_CCB; } env = bpp_get_envelope(bsc); @@ -1198,8 +1199,10 @@ vsbic_scsicmd(struct scsi_xfer *xs) printf("%s: no free envelope\n", DEVNAME(sc)); #endif vsbic_free_ccb(sc, ccb); + xs->error = XS_NO_CCB; + scsi_done(xs); splx(s); - return NO_CCB; + return; } cmd = vsbic_get_cmd(sc); if (cmd == NULL) { @@ -1208,8 +1211,10 @@ vsbic_scsicmd(struct scsi_xfer *xs) #endif bpp_put_envelope(bsc, env); vsbic_free_ccb(sc, ccb); + xs->error = XS_NO_CCB; + scsi_done(xs); splx(s); - return NO_CCB; + return; } ccb->ccb_xs = xs; @@ -1231,7 +1236,7 @@ vsbic_scsicmd(struct scsi_xfer *xs) xs->error = XS_DRIVER_STUFFUP; scsi_done(xs); splx(s); - return (COMPLETE); + return; } /* @@ -1248,11 +1253,9 @@ vsbic_scsicmd(struct scsi_xfer *xs) if (ISSET(xs->flags, SCSI_POLL)) { splx(s); vsbic_poll(sc, ccb); - return (COMPLETE); } else { timeout_add_msec(&xs->stimeout, xs->timeout); splx(s); - return (SUCCESSFULLY_QUEUED); } } diff --git a/sys/arch/sparc64/dev/vdsk.c b/sys/arch/sparc64/dev/vdsk.c index 9d4a48a6344..5a9def7238f 100644 --- a/sys/arch/sparc64/dev/vdsk.c +++ b/sys/arch/sparc64/dev/vdsk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vdsk.c,v 1.17 2010/01/09 23:15:06 krw Exp $ */ +/* $OpenBSD: vdsk.c,v 1.18 2010/03/23 01:57:19 krw Exp $ */ /* * Copyright (c) 2009 Mark Kettenis * @@ -200,7 +200,7 @@ void vdsk_send_attr_info(struct vdsk_softc *); void vdsk_send_dring_reg(struct vdsk_softc *); void vdsk_send_rdx(struct vdsk_softc *); -int vdsk_scsi_cmd(struct scsi_xfer *); +void vdsk_scsi_cmd(struct scsi_xfer *); int vdsk_dev_probe(struct scsi_link *); void vdsk_dev_free(struct scsi_link *); int vdsk_ioctl(struct scsi_link *, u_long, caddr_t, int, struct proc *); @@ -914,7 +914,7 @@ vdsk_dring_free(bus_dma_tag_t t, struct vdsk_dring *vd) free(vd, M_DEVBUF); } -int +void vdsk_scsi_cmd(struct scsi_xfer *xs) { struct scsi_rw *rw; @@ -978,8 +978,10 @@ vdsk_scsi_cmd(struct scsi_xfer *xs) s = splbio(); if (sc->sc_vio_state != VIO_ESTABLISHED || sc->sc_tx_cnt >= sc->sc_vd->vd_nentries) { + xs->error = XS_NO_CCB; + scsi_done(xs); splx(s); - return (NO_CCB); + return; } desc = sc->sc_tx_prod; @@ -1038,7 +1040,7 @@ vdsk_scsi_cmd(struct scsi_xfer *xs) if (!ISSET(xs->flags, SCSI_POLL)) { splx(s); - return (SUCCESSFULLY_QUEUED); + return; } timeout = 1000; @@ -1050,8 +1052,6 @@ vdsk_scsi_cmd(struct scsi_xfer *xs) delay(1000); } while(--timeout > 0); splx(s); - - return (COMPLETE); } } diff --git a/sys/arch/vax/dec/sii.c b/sys/arch/vax/dec/sii.c index b48348bf190..15b0e8e0886 100644 --- a/sys/arch/vax/dec/sii.c +++ b/sys/arch/vax/dec/sii.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sii.c,v 1.7 2010/01/10 00:40:25 krw Exp $ */ +/* $OpenBSD: sii.c,v 1.8 2010/03/23 01:57:19 krw Exp $ */ /* $NetBSD: sii.c,v 1.42 2000/06/02 20:20:29 mhitch Exp $ */ /* * Copyright (c) 2008 Miodrag Vallat. @@ -156,7 +156,7 @@ int sii_GetByte(SIIRegs *regs, int phase, int ack); void sii_DoSync(struct sii_softc *, State *); void sii_StartDMA(SIIRegs *regs, int phase, u_int dmaAddr, int size); u_int sii_msgout(SIIRegs *, u_int, u_int8_t); -int sii_scsi_cmd(struct scsi_xfer *); +void sii_scsi_cmd(struct scsi_xfer *); void sii_schedule(struct sii_softc *); #ifdef DEBUG void sii_DumpLog(void); @@ -225,7 +225,7 @@ sii_attach(sc) * connect/disconnect during an operation. */ -int +void sii_scsi_cmd(xs) struct scsi_xfer *xs; { @@ -236,11 +236,13 @@ sii_scsi_cmd(xs) s = splbio(); if (sc->sc_xs[target] != NULL) { - splx(s); #ifdef DEBUG printf("[busy at start]\n"); #endif - return (NO_CCB); + xs->error = XS_NO_CCB; + scsi_done(xs); + splx(s); + return; } /* * Build a ScsiCmd for this command and start it. @@ -250,9 +252,9 @@ sii_scsi_cmd(xs) splx(s); if ((xs->flags & ITSDONE) != 0) - return (COMPLETE); + return; if ((xs->flags & SCSI_POLL) == 0) - return (SUCCESSFULLY_QUEUED); + return; count = xs->timeout; while (count) { s = splbio(); @@ -265,12 +267,12 @@ sii_scsi_cmd(xs) --count; } if ((xs->flags & ITSDONE) != 0) - return (COMPLETE); + return; xs->error = XS_TIMEOUT; s = splbio(); scsi_done(xs); splx(s); - return (COMPLETE); + return; } /* diff --git a/sys/dev/ata/atascsi.c b/sys/dev/ata/atascsi.c index b94ec4a14df..9f27e878a0e 100644 --- a/sys/dev/ata/atascsi.c +++ b/sys/dev/ata/atascsi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: atascsi.c,v 1.71 2010/01/09 23:15:06 krw Exp $ */ +/* $OpenBSD: atascsi.c,v 1.72 2010/03/23 01:57:19 krw Exp $ */ /* * Copyright (c) 2007 David Gwynne <dlg@openbsd.org> @@ -47,7 +47,7 @@ struct atascsi { int as_capability; }; -int atascsi_cmd(struct scsi_xfer *); +void atascsi_cmd(struct scsi_xfer *); int atascsi_ioctl(struct scsi_link *, u_long, caddr_t, int, struct proc *); int atascsi_probe(struct scsi_link *); @@ -300,7 +300,7 @@ atascsi_free(struct scsi_link *link) as->as_methods->free(as->as_cookie, port); } -int +void atascsi_cmd(struct scsi_xfer *xs) { struct scsi_link *link = xs->sc_link; @@ -309,7 +309,7 @@ atascsi_cmd(struct scsi_xfer *xs) if (ap == NULL) { atascsi_done(xs, XS_DRIVER_STUFFUP); - return (COMPLETE); + return; } switch (ap->ap_type) { @@ -325,8 +325,6 @@ atascsi_cmd(struct scsi_xfer *xs) atascsi_done(xs, XS_DRIVER_STUFFUP); break; } - - return (COMPLETE); } void diff --git a/sys/dev/atapiscsi/atapiscsi.c b/sys/dev/atapiscsi/atapiscsi.c index c4e79eda6ab..0e5111d7ba6 100644 --- a/sys/dev/atapiscsi/atapiscsi.c +++ b/sys/dev/atapiscsi/atapiscsi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: atapiscsi.c,v 1.87 2010/01/11 00:00:53 krw Exp $ */ +/* $OpenBSD: atapiscsi.c,v 1.88 2010/03/23 01:57:19 krw Exp $ */ /* * This code is derived from code with the copyright below. @@ -167,7 +167,7 @@ struct atapiscsi_softc { void wdc_atapi_minphys(struct buf *bp, struct scsi_link *sl); int wdc_atapi_ioctl(struct scsi_link *, u_long, caddr_t, int, struct proc *); -int wdc_atapi_send_cmd(struct scsi_xfer *sc_xfer); +void wdc_atapi_send_cmd(struct scsi_xfer *sc_xfer); static struct scsi_adapter atapiscsi_switch = { @@ -319,7 +319,7 @@ atapiscsi_detach(dev, flags) return (config_detach_children(dev, flags)); } -int +void wdc_atapi_send_cmd(sc_xfer) struct scsi_xfer *sc_xfer; { @@ -338,13 +338,17 @@ wdc_atapi_send_cmd(sc_xfer) s = splbio(); scsi_done(sc_xfer); splx(s); - return (COMPLETE); + return; } xfer = wdc_get_xfer(sc_xfer->flags & SCSI_NOSLEEP ? WDC_NOSLEEP : WDC_CANSLEEP); if (xfer == NULL) { - return (NO_CCB); + sc_xfer->error = XS_NO_CCB; + s = splbio(); + scsi_done(sc_xfer); + splx(s); + return; } if (sc_xfer->flags & SCSI_POLL) xfer->c_flags |= C_POLL; @@ -426,11 +430,6 @@ wdc_atapi_send_cmd(sc_xfer) wdc_exec_xfer(chp, xfer); splx(s); - - if (xfer->c_flags & C_POLL) - return (COMPLETE); - else - return (SUCCESSFULLY_QUEUED); } void diff --git a/sys/dev/eisa/aha1742.c b/sys/dev/eisa/aha1742.c index 47da762f604..2f161b18179 100644 --- a/sys/dev/eisa/aha1742.c +++ b/sys/dev/eisa/aha1742.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aha1742.c,v 1.37 2010/01/10 00:40:25 krw Exp $ */ +/* $OpenBSD: aha1742.c,v 1.38 2010/03/23 01:57:19 krw Exp $ */ /* $NetBSD: aha1742.c,v 1.61 1996/05/12 23:40:01 mycroft Exp $ */ /* @@ -286,7 +286,7 @@ struct ahb_ecb *ahb_ecb_phys_kv(struct ahb_softc *, physaddr); int ahb_find(bus_space_tag_t, bus_space_handle_t, struct ahb_softc *); void ahb_init(struct ahb_softc *); void ahbminphys(struct buf *, struct scsi_link *); -int ahb_scsi_cmd(struct scsi_xfer *); +void ahb_scsi_cmd(struct scsi_xfer *); void ahb_timeout(void *); void ahb_print_ecb(struct ahb_ecb *); void ahb_print_active_ecb(struct ahb_softc *); @@ -931,7 +931,7 @@ ahbminphys(struct buf *bp, struct scsi_link *sl) * start a scsi operation given the command and the data address. Also needs * the unit, target and lu. */ -int +void ahb_scsi_cmd(xs) struct scsi_xfer *xs; { @@ -952,7 +952,11 @@ ahb_scsi_cmd(xs) */ flags = xs->flags; if ((ecb = ahb_get_ecb(sc, flags)) == NULL) { - return (NO_CCB); + xs->error = XS_NO_CCB; + s = splbio(); + scsi_done(xs); + splx(s); + return; } ecb->xs = xs; timeout_set(&ecb->xs->stimeout, ahb_timeout, ecb); @@ -965,8 +969,13 @@ ahb_scsi_cmd(xs) */ if (flags & SCSI_RESET) { ecb->flags |= ECB_IMMED; - if (sc->immed_ecb) - return NO_CCB; + if (sc->immed_ecb) { + xs->error = XS_NO_CCB; + s = splbio(); + scsi_done(xs); + splx(s); + return; + } sc->immed_ecb = ecb; s = splbio(); @@ -976,7 +985,7 @@ ahb_scsi_cmd(xs) if ((flags & SCSI_POLL) == 0) { splx(s); timeout_add_msec(&ecb->xs->stimeout, xs->timeout); - return SUCCESSFULLY_QUEUED; + return; } splx(s); @@ -986,7 +995,7 @@ ahb_scsi_cmd(xs) */ if (ahb_poll(sc, xs, xs->timeout)) ahb_timeout(ecb); - return COMPLETE; + return; } /* @@ -1071,7 +1080,7 @@ ahb_scsi_cmd(xs) s = splbio(); scsi_done(xs); splx(s); - return COMPLETE; + return; } } else { /* No data xfer, use non S/G values */ ecb->data_addr = (physaddr)0; @@ -1095,7 +1104,7 @@ ahb_scsi_cmd(xs) if ((flags & SCSI_POLL) == 0) { splx(s); timeout_add_msec(&ecb->xs->stimeout, xs->timeout); - return SUCCESSFULLY_QUEUED; + return; } splx(s); @@ -1108,7 +1117,6 @@ ahb_scsi_cmd(xs) if (ahb_poll(sc, xs, 2000)) ahb_timeout(ecb); } - return COMPLETE; } void diff --git a/sys/dev/i2o/ioprbs.c b/sys/dev/i2o/ioprbs.c index 38fca418deb..e2e3d5ca007 100644 --- a/sys/dev/i2o/ioprbs.c +++ b/sys/dev/i2o/ioprbs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ioprbs.c,v 1.19 2010/01/09 23:15:06 krw Exp $ */ +/* $OpenBSD: ioprbs.c,v 1.20 2010/03/23 01:57:19 krw Exp $ */ /* * Copyright (c) 2001 Niklas Hallqvist @@ -105,7 +105,7 @@ void ioprbs_internal_cache_cmd(struct scsi_xfer *); void ioprbs_intr(struct device *, struct iop_msg *, void *); void ioprbs_intr_event(struct device *, struct iop_msg *, void *); int ioprbs_match(struct device *, void *, void *); -int ioprbs_scsi_cmd(struct scsi_xfer *); +void ioprbs_scsi_cmd(struct scsi_xfer *); int ioprbs_start(struct ioprbs_ccb *); void ioprbs_start_ccbs(struct ioprbs_softc *); void ioprbs_timeout(void *); @@ -397,7 +397,7 @@ ioprbs_unconfig(struct ioprbs_softc *sc, int evreg) iop_initiator_unregister(iop, &sc->sc_ii); } -int +void ioprbs_scsi_cmd(xs) struct scsi_xfer *xs; { @@ -408,7 +408,6 @@ ioprbs_scsi_cmd(xs) struct scsi_rw *rw; struct scsi_rw_big *rwb; int s; - int retval = SUCCESSFULLY_QUEUED; s = splbio(); @@ -498,8 +497,10 @@ ioprbs_scsi_cmd(xs) * We are out of commands, try again in a little while. */ if (ccb == NULL) { + xs->error = XS_NO_CCB; + scsi_done(xs); splx(s); - return (NO_CCB); + return; } ccb->ic_blockno = blockno; @@ -516,7 +517,10 @@ ioprbs_scsi_cmd(xs) splx(s); printf("%s: command timed out\n", sc->sc_dv.dv_xname); - return (NO_CCB); + xs->error = XS_NO_CCB; + scsi_done(xs); + splx(s); + return; } scsi_done(xs); #endif @@ -528,13 +532,11 @@ ioprbs_scsi_cmd(xs) * Don't process the queue if we are polling. */ if (xs->flags & SCSI_POLL) { - retval = COMPLETE; break; } } splx(s); - return (retval); } void diff --git a/sys/dev/i2o/iopsp.c b/sys/dev/i2o/iopsp.c index 3cfb91b3a3b..18388d9ce77 100644 --- a/sys/dev/i2o/iopsp.c +++ b/sys/dev/i2o/iopsp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: iopsp.c,v 1.15 2009/04/02 18:44:49 oga Exp $ */ +/* $OpenBSD: iopsp.c,v 1.16 2010/03/23 01:57:19 krw Exp $ */ /* $NetBSD$ */ /*- @@ -71,7 +71,7 @@ struct cfattach iopsp_ca = { sizeof(struct iopsp_softc), iopsp_match, iopsp_attach }; -int iopsp_scsi_cmd(struct scsi_xfer *); +void iopsp_scsi_cmd(struct scsi_xfer *); void iopspminphys(struct buf *bp, struct scsi_link *sl); struct scsi_adapter iopsp_switch = { @@ -404,7 +404,7 @@ iopspminphys(struct buf *bp, struct scsi_link *sl) /* * Start a SCSI command. */ -int +void iopsp_scsi_cmd(xs) struct scsi_xfer *xs; { @@ -422,7 +422,7 @@ iopsp_scsi_cmd(xs) s = splbio(); scsi_done(xs); splx(s); - return (COMPLETE); + return; } SC_DEBUG(xs->sc_link, SDEV_DB2, ("iopsp_scsi_cmd: run_xfer\n")); @@ -442,7 +442,7 @@ iopsp_scsi_cmd(xs) s = splbio(); scsi_done(xs); splx(s); - return (COMPLETE); + return; } #if defined(I2ODEBUG) || defined(SCSIDEBUG) @@ -489,7 +489,7 @@ iopsp_scsi_cmd(xs) s = splbio(); scsi_done(xs); splx(s); - return (COMPLETE); + return; } if ((xs->flags & SCSI_DATA_IN) == 0) mf->flags |= I2O_SCB_FLAG_XFER_TO_DEVICE; @@ -512,10 +512,7 @@ iopsp_scsi_cmd(xs) s = splbio(); scsi_done(xs); splx(s); - return (COMPLETE); } - - return (xs->flags & SCSI_POLL? COMPLETE : SUCCESSFULLY_QUEUED); } #ifdef notyet diff --git a/sys/dev/ic/aac.c b/sys/dev/ic/aac.c index 3e6ff08d841..e127d0dda66 100644 --- a/sys/dev/ic/aac.c +++ b/sys/dev/ic/aac.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aac.c,v 1.42 2010/01/09 23:15:06 krw Exp $ */ +/* $OpenBSD: aac.c,v 1.43 2010/03/23 01:57:19 krw Exp $ */ /*- * Copyright (c) 2000 Michael Smith @@ -114,7 +114,7 @@ void aac_unmap_command(struct aac_command *); #if 0 int aac_raw_scsi_cmd(struct scsi_xfer *); #endif -int aac_scsi_cmd(struct scsi_xfer *); +void aac_scsi_cmd(struct scsi_xfer *); void aac_startio(struct aac_softc *); void aac_startup(struct aac_softc *); void aac_add_container(struct aac_softc *, struct aac_mntinforesp *, int); @@ -2524,11 +2524,10 @@ aac_raw_scsi_cmd(struct scsi_xfer *xs) s = splbio(); scsi_done(xs); splx(s); - return (COMPLETE); } #endif -int +void aac_scsi_cmd(struct scsi_xfer *xs) { struct scsi_link *link = xs->sc_link; @@ -2538,7 +2537,6 @@ aac_scsi_cmd(struct scsi_xfer *xs) u_int32_t blockno, blockcnt; struct scsi_rw *rw; struct scsi_rw_big *rwb; - int retval = SUCCESSFULLY_QUEUED; int s = splbio(); xs->error = XS_NOERROR; @@ -2552,7 +2550,7 @@ aac_scsi_cmd(struct scsi_xfer *xs) xs->error = XS_DRIVER_STUFFUP; scsi_done(xs); splx(s); - return (COMPLETE); + return; } AAC_DPRINTF(AAC_D_CMD, ("%s: aac_scsi_cmd: ", sc->aac_dev.dv_xname)); @@ -2640,8 +2638,10 @@ aac_scsi_cmd(struct scsi_xfer *xs) * We are out of commands, try again * in a little while. */ + xs->error = XS_NO_CCB; + scsi_done(xs); splx(s); - return (NO_CCB); + return; } /* fill out the command */ @@ -2664,24 +2664,19 @@ aac_scsi_cmd(struct scsi_xfer *xs) { printf("%s: command timed out\n", sc->aac_dev.dv_xname); + xs->error = XS_NO_CCB; + scsi_done(xs); splx(s); - return (NO_CCB); + return; } scsi_done(xs); } } ready: - /* - * Don't process the queue if we are polling. - */ - if (xs->flags & SCSI_POLL) - retval = COMPLETE; - splx(s); AAC_DPRINTF(AAC_D_CMD, ("%s: scsi_cmd complete\n", sc->aac_dev.dv_xname)); - return (retval); } /* diff --git a/sys/dev/ic/adv.c b/sys/dev/ic/adv.c index ecf6fc28d37..bfd1cf8faf1 100644 --- a/sys/dev/ic/adv.c +++ b/sys/dev/ic/adv.c @@ -1,4 +1,4 @@ -/* $OpenBSD: adv.c,v 1.27 2010/01/10 00:10:23 krw Exp $ */ +/* $OpenBSD: adv.c,v 1.28 2010/03/23 01:57:19 krw Exp $ */ /* $NetBSD: adv.c,v 1.6 1998/10/28 20:39:45 dante Exp $ */ /* @@ -68,7 +68,7 @@ static void adv_start_ccbs(ASC_SOFTC *); static u_int8_t *adv_alloc_overrunbuf(char *dvname, bus_dma_tag_t); -static int adv_scsi_cmd(struct scsi_xfer *); +static void adv_scsi_cmd(struct scsi_xfer *); static void advminphys(struct buf *, struct scsi_link *); static void adv_narrow_isr_callback(ASC_SOFTC *, ASC_QDONE_INFO *); @@ -571,7 +571,7 @@ advminphys(struct buf *bp, struct scsi_link *sl) * start a scsi operation given the command and the data address. Also needs * the unit, target and lu. */ -static int +static void adv_scsi_cmd(xs) struct scsi_xfer *xs; { @@ -591,8 +591,10 @@ adv_scsi_cmd(xs) flags = xs->flags; if ((ccb = adv_get_ccb(sc, flags)) == NULL) { + xs->error = XS_NO_CCB; + scsi_done(xs); splx(s); - return (NO_CCB); + return; } splx(s); /* done playing with the queue */ @@ -656,7 +658,7 @@ adv_scsi_cmd(xs) s = splbio(); scsi_done(xs); splx(s); - return (COMPLETE); + return; } bus_dmamap_sync(dmat, ccb->dmamap_xfer, 0, ccb->dmamap_xfer->dm_mapsize, @@ -699,7 +701,7 @@ adv_scsi_cmd(xs) * Usually return SUCCESSFULLY QUEUED */ if ((flags & SCSI_POLL) == 0) - return (SUCCESSFULLY_QUEUED); + return; /* * If we can't use interrupts, poll on completion @@ -709,8 +711,6 @@ adv_scsi_cmd(xs) if (adv_poll(sc, xs, ccb->timeout)) adv_timeout(ccb); } - - return (COMPLETE); } diff --git a/sys/dev/ic/adw.c b/sys/dev/ic/adw.c index 32fd96acf19..87ebcb64b1a 100644 --- a/sys/dev/ic/adw.c +++ b/sys/dev/ic/adw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: adw.c,v 1.41 2010/01/10 00:10:23 krw Exp $ */ +/* $OpenBSD: adw.c,v 1.42 2010/03/23 01:57:19 krw Exp $ */ /* $NetBSD: adw.c,v 1.23 2000/05/27 18:24:50 dante Exp $ */ /* @@ -66,7 +66,7 @@ int adw_init_ccb(ADW_SOFTC *, ADW_CCB *); ADW_CCB *adw_get_ccb(ADW_SOFTC *, int); int adw_queue_ccb(ADW_SOFTC *, ADW_CCB *, int); -int adw_scsi_cmd(struct scsi_xfer *); +void adw_scsi_cmd(struct scsi_xfer *); int adw_build_req(struct scsi_xfer *, ADW_CCB *, int); void adw_build_sglist(ADW_CCB *, ADW_SCSI_REQ_Q *, ADW_SG_BLOCK *); void adw_minphys(struct buf *, struct scsi_link *); @@ -590,7 +590,7 @@ adw_minphys(struct buf *bp, struct scsi_link *sl) * start a scsi operation given the command and the data address. * Also needs the unit, target and lu. */ -int +void adw_scsi_cmd(xs) struct scsi_xfer *xs; { @@ -612,8 +612,10 @@ adw_scsi_cmd(xs) if (nowait) flags |= SCSI_NOSLEEP; if ((ccb = adw_get_ccb(sc, flags)) == NULL) { + xs->error = XS_NO_CCB; + scsi_done(xs); splx(s); - return (NO_CCB); + return; } splx(s); /* done playing with the queue */ @@ -635,14 +637,14 @@ retryagain: s = splbio(); scsi_done(xs); splx(s); - return (COMPLETE); + return; } /* * Usually return SUCCESSFULLY QUEUED */ if ((xs->flags & SCSI_POLL) == 0) - return (SUCCESSFULLY_QUEUED); + return; /* * If we can't use interrupts, poll on completion @@ -658,7 +660,6 @@ retryagain: scsi_done(xs); splx(s); } - return (COMPLETE); } diff --git a/sys/dev/ic/aic6360.c b/sys/dev/ic/aic6360.c index 8fb801d08eb..ff852019840 100644 --- a/sys/dev/ic/aic6360.c +++ b/sys/dev/ic/aic6360.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aic6360.c,v 1.21 2010/01/13 06:09:44 krw Exp $ */ +/* $OpenBSD: aic6360.c,v 1.22 2010/03/23 01:57:19 krw Exp $ */ /* $NetBSD: aic6360.c,v 1.52 1996/12/10 21:27:51 thorpej Exp $ */ #ifdef DDB @@ -158,7 +158,7 @@ void aic_minphys(struct buf *, struct scsi_link *); void aic_init(struct aic_softc *); void aic_done(struct aic_softc *, struct aic_acb *); void aic_dequeue(struct aic_softc *, struct aic_acb *); -int aic_scsi_cmd(struct scsi_xfer *); +void aic_scsi_cmd(struct scsi_xfer *); int aic_poll(struct aic_softc *, struct scsi_xfer *, int); integrate void aic_sched_msgout(struct aic_softc *, u_char); integrate void aic_setsync(struct aic_softc *, struct aic_tinfo *); @@ -504,7 +504,7 @@ aic_get_acb(struct aic_softc *sc, int flags) * This function is called by the higher level SCSI-driver to queue/run * SCSI-commands. */ -int +void aic_scsi_cmd(struct scsi_xfer *xs) { struct scsi_link *sc_link = xs->sc_link; @@ -518,7 +518,11 @@ aic_scsi_cmd(struct scsi_xfer *xs) flags = xs->flags; if ((acb = aic_get_acb(sc, flags)) == NULL) { - return (NO_CCB); + xs->error = XS_NO_CCB; + s = splbio(); + scsi_done(xs); + splx(s); + return; } /* Initialize acb */ @@ -547,7 +551,7 @@ aic_scsi_cmd(struct scsi_xfer *xs) splx(s); if ((flags & SCSI_POLL) == 0) - return SUCCESSFULLY_QUEUED; + return; /* Not allowed to use interrupts, use polling instead */ if (aic_poll(sc, xs, acb->timeout)) { @@ -555,7 +559,6 @@ aic_scsi_cmd(struct scsi_xfer *xs) if (aic_poll(sc, xs, acb->timeout)) aic_timeout(acb); } - return COMPLETE; } #ifdef notyet diff --git a/sys/dev/ic/aic79xx_openbsd.c b/sys/dev/ic/aic79xx_openbsd.c index fb8521e03bf..5ed0e0f8a26 100644 --- a/sys/dev/ic/aic79xx_openbsd.c +++ b/sys/dev/ic/aic79xx_openbsd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aic79xx_openbsd.c,v 1.35 2010/01/20 08:40:41 krw Exp $ */ +/* $OpenBSD: aic79xx_openbsd.c,v 1.36 2010/03/23 01:57:19 krw Exp $ */ /* * Copyright (c) 2004 Milos Urbanek, Kenneth R. Westerback & Marco Peereboom @@ -74,10 +74,10 @@ __FBSDID("$FreeBSD: src/sys/dev/aic7xxx/aic79xx_osm.c,v 1.16 2003/12/17 00:02:09 #endif /* XXX milos add ahd_ioctl */ -int ahd_action(struct scsi_xfer *); -int ahd_execute_scb(void *, bus_dma_segment_t *, int); +void ahd_action(struct scsi_xfer *); +void ahd_execute_scb(void *, bus_dma_segment_t *, int); int ahd_poll(struct ahd_softc *, int); -int ahd_setup_data(struct ahd_softc *, struct scsi_xfer *, +void ahd_setup_data(struct ahd_softc *, struct scsi_xfer *, struct scb *); void ahd_adapter_req_set_xfer_mode(struct ahd_softc *, struct scb *); @@ -290,7 +290,7 @@ ahd_minphys(struct buf *bp, struct scsi_link *sl) minphys(bp); } -int32_t +void ahd_action(struct scsi_xfer *xs) { struct ahd_softc *ahd; @@ -315,7 +315,7 @@ ahd_action(struct scsi_xfer *xs) xs->error = XS_DRIVER_STUFFUP; scsi_done(xs); ahd_unlock(ahd, &s); - return (COMPLETE); + return; } /* * get an scb to use. @@ -332,8 +332,10 @@ ahd_action(struct scsi_xfer *xs) if ((scb = ahd_get_scb(ahd, col_idx)) == NULL) { ahd->flags |= AHD_RESOURCE_SHORTAGE; + xs->error = XS_NO_CCB; + scsi_done(xs); ahd_unlock(ahd, &s); - return (NO_CCB); + return; } ahd_unlock(ahd, &s); @@ -355,14 +357,14 @@ ahd_action(struct scsi_xfer *xs) scb->flags |= SCB_DEVICE_RESET; hscb->control |= MK_MESSAGE; hscb->task_management = SIU_TASKMGMT_LUN_RESET; - return (ahd_execute_scb(scb, NULL, 0)); + ahd_execute_scb(scb, NULL, 0); } else { hscb->task_management = 0; - return (ahd_setup_data(ahd, xs, scb)); + ahd_setup_data(ahd, xs, scb); } } -int +void ahd_execute_scb(void *arg, bus_dma_segment_t *dm_segs, int nsegments) { struct scb *scb; @@ -417,7 +419,7 @@ ahd_execute_scb(void *arg, bus_dma_segment_t *dm_segs, int nsegments) scb->dmamap); ahd_free_scb(ahd, scb); ahd_unlock(ahd, &s); - return (COMPLETE); + return; } tinfo = ahd_fetch_transinfo(ahd, SCSIID_CHANNEL(ahd, scb->hscb->scsiid), @@ -481,7 +483,7 @@ ahd_execute_scb(void *arg, bus_dma_segment_t *dm_segs, int nsegments) } ahd_unlock(ahd, &s); - return (SUCCESSFULLY_QUEUED); + return; } /* @@ -499,7 +501,6 @@ ahd_execute_scb(void *arg, bus_dma_segment_t *dm_segs, int nsegments) } while (!(xs->flags & ITSDONE)); ahd_unlock(ahd, &s); - return (COMPLETE); } int @@ -520,7 +521,7 @@ ahd_poll(struct ahd_softc *ahd, int wait) return (0); } -int +void ahd_setup_data(struct ahd_softc *ahd, struct scsi_xfer *xs, struct scb *scb) { @@ -538,7 +539,7 @@ ahd_setup_data(struct ahd_softc *ahd, struct scsi_xfer *xs, xs->error = XS_DRIVER_STUFFUP; scsi_done(xs); ahd_unlock(ahd, &s); - return (COMPLETE); + return; } memcpy(hscb->shared_data.idata.cdb, xs->cmd, hscb->cdb_len); @@ -562,14 +563,15 @@ ahd_setup_data(struct ahd_softc *ahd, struct scsi_xfer *xs, #endif ahd_lock(ahd, &s); ahd_free_scb(ahd, scb); + xs->error = XS_NO_CCB; + scsi_done(xs); ahd_unlock(ahd, &s); - return (NO_CCB); /* XXX fvdl */ + return; } - error = ahd_execute_scb(scb, scb->dmamap->dm_segs, + ahd_execute_scb(scb, scb->dmamap->dm_segs, scb->dmamap->dm_nsegs); - return error; } else { - return ahd_execute_scb(scb, NULL, 0); + ahd_execute_scb(scb, NULL, 0); } } diff --git a/sys/dev/ic/aic7xxx_openbsd.c b/sys/dev/ic/aic7xxx_openbsd.c index bbf8894e1de..3ea4c633553 100644 --- a/sys/dev/ic/aic7xxx_openbsd.c +++ b/sys/dev/ic/aic7xxx_openbsd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aic7xxx_openbsd.c,v 1.45 2010/01/20 08:40:41 krw Exp $ */ +/* $OpenBSD: aic7xxx_openbsd.c,v 1.46 2010/03/23 01:57:19 krw Exp $ */ /* $NetBSD: aic7xxx_osm.c,v 1.14 2003/11/02 11:07:44 wiz Exp $ */ /* @@ -48,10 +48,10 @@ #endif -int ahc_action(struct scsi_xfer *); -int ahc_execute_scb(void *, bus_dma_segment_t *, int); +void ahc_action(struct scsi_xfer *); +void ahc_execute_scb(void *, bus_dma_segment_t *, int); int ahc_poll(struct ahc_softc *, int); -int ahc_setup_data(struct ahc_softc *, struct scsi_xfer *, struct scb *); +void ahc_setup_data(struct ahc_softc *, struct scsi_xfer *, struct scb *); void ahc_minphys(struct buf *, struct scsi_link *); void ahc_adapter_req_set_xfer_mode(struct ahc_softc *, struct scb *); @@ -290,7 +290,7 @@ ahc_minphys(struct buf *bp, struct scsi_link *sl) minphys(bp); } -int32_t +void ahc_action(struct scsi_xfer *xs) { struct ahc_softc *ahc; @@ -311,8 +311,10 @@ ahc_action(struct scsi_xfer *xs) */ s = splbio(); if ((scb = ahc_get_scb(ahc)) == NULL) { + xs->error = XS_NO_CCB; + scsi_done(xs); splx(s); - return (NO_CCB); + return; } splx(s); @@ -332,13 +334,14 @@ ahc_action(struct scsi_xfer *xs) hscb->cdb_len = 0; scb->flags |= SCB_DEVICE_RESET; hscb->control |= MK_MESSAGE; - return (ahc_execute_scb(scb, NULL, 0)); + ahc_execute_scb(scb, NULL, 0); + return; } - return (ahc_setup_data(ahc, xs, scb)); + ahc_setup_data(ahc, xs, scb); } -int +void ahc_execute_scb(void *arg, bus_dma_segment_t *dm_segs, int nsegments) { struct scb *scb; @@ -422,7 +425,7 @@ ahc_execute_scb(void *arg, bus_dma_segment_t *dm_segs, int nsegments) ahc_free_scb(ahc, scb); splx(s); - return (COMPLETE); + return; } tinfo = ahc_fetch_transinfo(ahc, SCSIID_CHANNEL(ahc, scb->hscb->scsiid), @@ -481,7 +484,7 @@ ahc_execute_scb(void *arg, bus_dma_segment_t *dm_segs, int nsegments) goto poll; else { splx(s); - return (SUCCESSFULLY_QUEUED); + return; } } } @@ -511,7 +514,7 @@ ahc_execute_scb(void *arg, bus_dma_segment_t *dm_segs, int nsegments) ahc->inited_target[xs->sc_link->target] = 1; } splx(s); - return (SUCCESSFULLY_QUEUED); + return; } /* @@ -530,7 +533,6 @@ poll: } while (!(xs->flags & ITSDONE)); splx(s); - return (COMPLETE); } int @@ -551,7 +553,7 @@ ahc_poll(struct ahc_softc *ahc, int wait) return (0); } -int +void ahc_setup_data(struct ahc_softc *ahc, struct scsi_xfer *xs, struct scb *scb) { @@ -569,7 +571,7 @@ ahc_setup_data(struct ahc_softc *ahc, struct scsi_xfer *xs, xs->error = XS_DRIVER_STUFFUP; scsi_done(xs); splx(s); - return (COMPLETE); + return; } if (hscb->cdb_len > 12) { @@ -596,15 +598,15 @@ ahc_setup_data(struct ahc_softc *ahc, struct scsi_xfer *xs, #endif s = splbio(); ahc_free_scb(ahc, scb); + xs->error = XS_NO_CCB; + scsi_done(xs); splx(s); - return (NO_CCB); /* XXX fvdl */ + return; } - error = ahc_execute_scb(scb, - scb->dmamap->dm_segs, - scb->dmamap->dm_nsegs); - return error; + ahc_execute_scb(scb, scb->dmamap->dm_segs, + scb->dmamap->dm_nsegs); } else { - return ahc_execute_scb(scb, NULL, 0); + ahc_execute_scb(scb, NULL, 0); } } diff --git a/sys/dev/ic/ami.c b/sys/dev/ic/ami.c index 5c0d7d85bed..9b5534702a8 100644 --- a/sys/dev/ic/ami.c +++ b/sys/dev/ic/ami.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ami.c,v 1.199 2010/01/09 23:15:06 krw Exp $ */ +/* $OpenBSD: ami.c,v 1.200 2010/03/23 01:57:19 krw Exp $ */ /* * Copyright (c) 2001 Michael Shalayeff @@ -92,7 +92,7 @@ struct cfdriver ami_cd = { NULL, "ami", DV_DULL }; -int ami_scsi_cmd(struct scsi_xfer *); +void ami_scsi_cmd(struct scsi_xfer *); int ami_scsi_ioctl(struct scsi_link *, u_long, caddr_t, int, struct proc *); void amiminphys(struct buf *bp, struct scsi_link *sl); @@ -104,7 +104,7 @@ struct scsi_device ami_dev = { NULL, NULL, NULL, NULL }; -int ami_scsi_raw_cmd(struct scsi_xfer *); +void ami_scsi_raw_cmd(struct scsi_xfer *); struct scsi_adapter ami_raw_switch = { ami_scsi_raw_cmd, amiminphys, 0, 0, @@ -135,7 +135,7 @@ int ami_done(struct ami_softc *, int, int); void ami_runqueue_tick(void *); void ami_runqueue(struct ami_softc *); -int ami_start_xs(struct ami_softc *sc, struct ami_ccb *, +void ami_start_xs(struct ami_softc *sc, struct ami_ccb *, struct scsi_xfer *); void ami_done_xs(struct ami_softc *, struct ami_ccb *); void ami_done_pt(struct ami_softc *, struct ami_ccb *); @@ -967,21 +967,19 @@ ami_schwartz_poll(struct ami_softc *sc, struct ami_iocmd *mbox) return (rv); } -int +void ami_start_xs(struct ami_softc *sc, struct ami_ccb *ccb, struct scsi_xfer *xs) { timeout_set(&xs->stimeout, ami_stimeout, ccb); if (xs->flags & SCSI_POLL) { ami_complete(sc, ccb, xs->timeout); - return (COMPLETE); + return; } /* XXX way wrong, this timeout needs to be set later */ timeout_add_sec(&xs->stimeout, 61); ami_start(sc, ccb); - - return (SUCCESSFULLY_QUEUED); } void @@ -1318,7 +1316,7 @@ ami_copy_internal_data(struct scsi_xfer *xs, void *v, size_t size) } } -int +void ami_scsi_raw_cmd(struct scsi_xfer *xs) { struct scsi_link *link = xs->sc_link; @@ -1345,7 +1343,7 @@ ami_scsi_raw_cmd(struct scsi_xfer *xs) s = splbio(); scsi_done(xs); splx(s); - return (COMPLETE); + return; } xs->error = XS_NOERROR; @@ -1354,7 +1352,11 @@ ami_scsi_raw_cmd(struct scsi_xfer *xs) ccb = ami_get_ccb(sc); splx(s); if (ccb == NULL) { - return (NO_CCB); + xs->error = XS_NO_CCB; + s = splbio(); + scsi_done(xs); + splx(s); + return; } memset(ccb->ccb_pt, 0, sizeof(struct ami_passthrough)); @@ -1381,10 +1383,10 @@ ami_scsi_raw_cmd(struct scsi_xfer *xs) ami_put_ccb(ccb); scsi_done(xs); splx(s); - return (COMPLETE); + return; } - return (ami_start_xs(sc, ccb, xs)); + ami_start_xs(sc, ccb, xs); } int @@ -1435,7 +1437,7 @@ ami_load_ptmem(struct ami_softc *sc, struct ami_ccb *ccb, void *data, return (0); } -int +void ami_scsi_cmd(struct scsi_xfer *xs) { struct scsi_link *link = xs->sc_link; @@ -1465,7 +1467,7 @@ ami_scsi_cmd(struct scsi_xfer *xs) s = splbio(); scsi_done(xs); splx(s); - return (COMPLETE); + return; } error = 0; @@ -1484,7 +1486,11 @@ ami_scsi_cmd(struct scsi_xfer *xs) ccb = ami_get_ccb(sc); splx(s); if (ccb == NULL) { - return (NO_CCB); + xs->error = XS_NO_CCB; + s = splbio(); + scsi_done(xs); + splx(s); + return; } ccb->ccb_xs = xs; @@ -1513,7 +1519,7 @@ ami_scsi_cmd(struct scsi_xfer *xs) s = splbio(); scsi_done(xs); splx(s); - return (COMPLETE); + return; case REQUEST_SENSE: AMI_DPRINTF(AMI_D_CMD, ("REQUEST SENSE tgt %d ", target)); @@ -1529,7 +1535,7 @@ ami_scsi_cmd(struct scsi_xfer *xs) s = splbio(); scsi_done(xs); splx(s); - return (COMPLETE); + return; case INQUIRY: AMI_DPRINTF(AMI_D_CMD, ("INQUIRY tgt %d ", target)); @@ -1549,7 +1555,7 @@ ami_scsi_cmd(struct scsi_xfer *xs) s = splbio(); scsi_done(xs); splx(s); - return (COMPLETE); + return; case READ_CAPACITY: AMI_DPRINTF(AMI_D_CMD, ("READ CAPACITY tgt %d ", target)); @@ -1562,7 +1568,7 @@ ami_scsi_cmd(struct scsi_xfer *xs) s = splbio(); scsi_done(xs); splx(s); - return (COMPLETE); + return; default: AMI_DPRINTF(AMI_D_CMD, ("unsupported scsi command %#x tgt %d ", @@ -1572,7 +1578,7 @@ ami_scsi_cmd(struct scsi_xfer *xs) s = splbio(); scsi_done(xs); splx(s); - return (COMPLETE); + return; } /* A read or write operation. */ @@ -1594,14 +1600,18 @@ ami_scsi_cmd(struct scsi_xfer *xs) s = splbio(); scsi_done(xs); splx(s); - return (COMPLETE); + return; } s = splbio(); ccb = ami_get_ccb(sc); splx(s); if (ccb == NULL) { - return (NO_CCB); + xs->error = XS_NO_CCB; + s = splbio(); + scsi_done(xs); + splx(s); + return; } ccb->ccb_xs = xs; @@ -1627,7 +1637,7 @@ ami_scsi_cmd(struct scsi_xfer *xs) ami_put_ccb(ccb); scsi_done(xs); splx(s); - return (COMPLETE); + return; } sgd = ccb->ccb_dmamap->dm_segs; @@ -1654,7 +1664,7 @@ ami_scsi_cmd(struct scsi_xfer *xs) ccb->ccb_dmamap->dm_mapsize, (xs->flags & SCSI_DATA_IN) ? BUS_DMASYNC_PREREAD : BUS_DMASYNC_PREWRITE); - return (ami_start_xs(sc, ccb, xs)); + ami_start_xs(sc, ccb, xs); } int diff --git a/sys/dev/ic/bha.c b/sys/dev/ic/bha.c index 890ea167a37..4ef56533f94 100644 --- a/sys/dev/ic/bha.c +++ b/sys/dev/ic/bha.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bha.c,v 1.20 2010/01/10 00:10:23 krw Exp $ */ +/* $OpenBSD: bha.c,v 1.21 2010/03/23 01:57:19 krw Exp $ */ /* $NetBSD: bha.c,v 1.27 1998/11/19 21:53:00 thorpej Exp $ */ #undef BHADEBUG @@ -93,7 +93,7 @@ void bha_start_ccbs(struct bha_softc *); void bha_done(struct bha_softc *, struct bha_ccb *); int bha_init(struct bha_softc *); void bhaminphys(struct buf *, struct scsi_link *); -int bha_scsi_cmd(struct scsi_xfer *); +void bha_scsi_cmd(struct scsi_xfer *); int bha_poll(struct bha_softc *, struct scsi_xfer *, int); void bha_timeout(void *arg); int bha_create_ccbs(struct bha_softc *, struct bha_ccb *, int); @@ -1269,7 +1269,7 @@ bhaminphys(struct buf *bp, struct scsi_link *sl) * start a scsi operation given the command and the data address. Also needs * the unit, target and lu. */ -int +void bha_scsi_cmd(xs) struct scsi_xfer *xs; { @@ -1290,8 +1290,10 @@ bha_scsi_cmd(xs) */ flags = xs->flags; if ((ccb = bha_get_ccb(sc, flags)) == NULL) { + xs->error = XS_NO_CCB; + scsi_done(xs); splx(s); - return (NO_CCB); + return; } splx(s); /* done playing with the queue */ @@ -1390,7 +1392,7 @@ bha_scsi_cmd(xs) */ SC_DEBUG(sc_link, SDEV_DB3, ("cmd_sent\n")); if ((flags & SCSI_POLL) == 0) - return (SUCCESSFULLY_QUEUED); + return; /* * If we can't use interrupts, poll on completion @@ -1400,7 +1402,7 @@ bha_scsi_cmd(xs) if (bha_poll(sc, xs, ccb->timeout)) bha_timeout(ccb); } - return (COMPLETE); + return; bad: xs->error = XS_DRIVER_STUFFUP; @@ -1408,7 +1410,6 @@ bad: s = splbio(); scsi_done(xs); splx(s); - return (COMPLETE); } /* diff --git a/sys/dev/ic/cac.c b/sys/dev/ic/cac.c index 6cc4c4f1e4d..2b459ac66f4 100644 --- a/sys/dev/ic/cac.c +++ b/sys/dev/ic/cac.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cac.c,v 1.34 2010/01/09 23:15:06 krw Exp $ */ +/* $OpenBSD: cac.c,v 1.35 2010/03/23 01:57:19 krw Exp $ */ /* $NetBSD: cac.c,v 1.15 2000/11/08 19:20:35 ad Exp $ */ /* @@ -96,7 +96,7 @@ struct cfdriver cac_cd = { NULL, "cac", DV_DULL }; -int cac_scsi_cmd(struct scsi_xfer *); +void cac_scsi_cmd(struct scsi_xfer *); void cacminphys(struct buf *bp, struct scsi_link *sl); struct scsi_adapter cac_switch = { @@ -406,7 +406,7 @@ cac_cmd(struct cac_softc *sc, int command, void *data, int datasize, /* Synchronous commands musn't wait. */ if ((*sc->sc_cl->cl_fifo_full)(sc)) { cac_ccb_free(sc, ccb); - rv = ENOMEM; /* Causes NO_CCB, i/o is retried. */ + rv = ENOMEM; /* Causes XS_NO_CCB, i/o is retried. */ } else { ccb->ccb_flags |= CAC_CCB_ACTIVE; (*sc->sc_cl->cl_submit)(sc, ccb); @@ -579,7 +579,7 @@ cac_copy_internal_data(xs, v, size) } } -int +void cac_scsi_cmd(xs) struct scsi_xfer *xs; { @@ -601,7 +601,7 @@ cac_scsi_cmd(xs) s = splbio(); scsi_done(xs); splx(s); - return (COMPLETE); + return; } s = splbio(); @@ -717,21 +717,20 @@ cac_scsi_cmd(xs) target, blockno, flags, xs))) { if (error == ENOMEM || error == EBUSY) { + xs->error = XS_NO_CCB; + scsi_done(xs); splx(s); - return (NO_CCB); + return; } else { xs->error = XS_DRIVER_STUFFUP; scsi_done(xs); - break; + splx(s); + return; } } splx(s); - - if (poll) - return (COMPLETE); - else - return (SUCCESSFULLY_QUEUED); + return; default: SC_DEBUG(link, SDEV_DB1, ("unsupported scsi command %#x " @@ -741,8 +740,6 @@ cac_scsi_cmd(xs) scsi_done(xs); splx(s); - - return (COMPLETE); } /* diff --git a/sys/dev/ic/ciss.c b/sys/dev/ic/ciss.c index c9c8053b58c..54d3cc8b1b4 100644 --- a/sys/dev/ic/ciss.c +++ b/sys/dev/ic/ciss.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ciss.c,v 1.40 2010/01/09 23:15:06 krw Exp $ */ +/* $OpenBSD: ciss.c,v 1.41 2010/03/23 01:57:19 krw Exp $ */ /* * Copyright (c) 2005,2006 Michael Shalayeff @@ -69,7 +69,7 @@ struct cfdriver ciss_cd = { NULL, "ciss", DV_DULL }; -int ciss_scsi_cmd(struct scsi_xfer *xs); +void ciss_scsi_cmd(struct scsi_xfer *xs); int ciss_scsi_ioctl(struct scsi_link *link, u_long cmd, caddr_t addr, int flag, struct proc *p); void cissminphys(struct buf *bp, struct scsi_link *sl); @@ -82,7 +82,7 @@ struct scsi_device ciss_dev = { NULL, NULL, NULL, NULL }; -int ciss_scsi_raw_cmd(struct scsi_xfer *xs); +void ciss_scsi_raw_cmd(struct scsi_xfer *xs); struct scsi_adapter ciss_raw_switch = { ciss_scsi_raw_cmd, cissminphys, NULL, NULL, @@ -135,6 +135,11 @@ ciss_put_ccb(struct ciss_ccb *ccb) { struct ciss_softc *sc = ccb->ccb_sc; + if (ccb->ccb_xs) { + CISS_DPRINTF(CISS_D_CMD, ("scsi_done(%p) ", ccb->ccb_xs)); + scsi_done(ccb->ccb_xs); + } + ccb->ccb_state = CISS_CCB_FREE; ccb->ccb_xs = NULL; ccb->ccb_data = NULL; @@ -504,10 +509,8 @@ ciss_cmd(struct ciss_ccb *ccb, int flags, int wait) printf("more than %d dma segs\n", sc->maxsg); else printf("error %d loading dma map\n", error); - if (ccb->ccb_xs) { + if (ccb->ccb_xs) ccb->ccb_xs->error = XS_DRIVER_STUFFUP; - scsi_done(ccb->ccb_xs); - } ciss_put_ccb(ccb); return (error); } @@ -681,13 +684,11 @@ ciss_done(struct ciss_ccb *ccb) bus_dmamap_unload(sc->dmat, ccb->ccb_dmamap); } + if (xs) + xs->resid = 0; + ciss_put_ccb(ccb); - if (xs) { - xs->resid = 0; - CISS_DPRINTF(CISS_D_CMD, ("scsi_done(%p) ", xs)); - scsi_done(xs); - } CISS_UNLOCK(sc, lock); return error; @@ -865,7 +866,7 @@ ciss_sync(struct ciss_softc *sc) return rv; } -int +void ciss_scsi_raw_cmd(struct scsi_xfer *xs) /* TODO */ { struct scsi_link *link = xs->sc_link; @@ -887,7 +888,7 @@ ciss_scsi_raw_cmd(struct scsi_xfer *xs) /* TODO */ xs->error = XS_SENSE; scsi_done(xs); CISS_UNLOCK(sc, lock); - return (COMPLETE); + return; } xs->error = XS_NOERROR; @@ -899,7 +900,7 @@ ciss_scsi_raw_cmd(struct scsi_xfer *xs) /* TODO */ xs->error = XS_NO_CCB; scsi_done(xs); CISS_UNLOCK(sc, lock); - return (COMPLETE); + return; } cmd = &ccb->ccb_cmd; @@ -920,10 +921,9 @@ ciss_scsi_raw_cmd(struct scsi_xfer *xs) /* TODO */ ciss_cmd(ccb, BUS_DMA_WAITOK, xs->flags & (SCSI_POLL|SCSI_NOSLEEP)); CISS_UNLOCK(sc, lock); - return (COMPLETE); } -int +void ciss_scsi_cmd(struct scsi_xfer *xs) { struct scsi_link *link = xs->sc_link; @@ -945,7 +945,7 @@ ciss_scsi_cmd(struct scsi_xfer *xs) xs->error = XS_SENSE; scsi_done(xs); CISS_UNLOCK(sc, lock); - return (COMPLETE); + return; } xs->error = XS_NOERROR; @@ -957,7 +957,7 @@ ciss_scsi_cmd(struct scsi_xfer *xs) xs->error = XS_NO_CCB; scsi_done(xs); CISS_UNLOCK(sc, lock); - return (COMPLETE); + return; } cmd = &ccb->ccb_cmd; @@ -979,7 +979,6 @@ ciss_scsi_cmd(struct scsi_xfer *xs) ciss_cmd(ccb, BUS_DMA_WAITOK, xs->flags & (SCSI_POLL|SCSI_NOSLEEP)); CISS_UNLOCK(sc, lock); - return (COMPLETE); } int @@ -1303,7 +1302,6 @@ ciss_ldid(struct ciss_softc *sc, int target, struct ciss_ldid *id) ccb->ccb_len = sizeof(*id); ccb->ccb_data = id; - ccb->ccb_xs = NULL; cmd = &ccb->ccb_cmd; cmd->tgt = htole32(CISS_CMD_MODE_PERIPH); cmd->tgt2 = 0; @@ -1332,7 +1330,6 @@ ciss_ldstat(struct ciss_softc *sc, int target, struct ciss_ldstat *stat) ccb->ccb_len = sizeof(*stat); ccb->ccb_data = stat; - ccb->ccb_xs = NULL; cmd = &ccb->ccb_cmd; cmd->tgt = htole32(CISS_CMD_MODE_PERIPH); cmd->tgt2 = 0; @@ -1361,7 +1358,6 @@ ciss_pdid(struct ciss_softc *sc, u_int8_t drv, struct ciss_pdid *id, int wait) ccb->ccb_len = sizeof(*id); ccb->ccb_data = id; - ccb->ccb_xs = NULL; cmd = &ccb->ccb_cmd; cmd->tgt = htole32(CISS_CMD_MODE_PERIPH); cmd->tgt2 = 0; @@ -1440,7 +1436,6 @@ ciss_blink(struct ciss_softc *sc, int ld, int pd, int stat, ccb->ccb_len = sizeof(*blink); ccb->ccb_data = blink; - ccb->ccb_xs = NULL; cmd = &ccb->ccb_cmd; cmd->tgt = htole32(CISS_CMD_MODE_PERIPH); cmd->tgt2 = 0; diff --git a/sys/dev/ic/dpt.c b/sys/dev/ic/dpt.c index 46bae9d9016..65c2a521576 100644 --- a/sys/dev/ic/dpt.c +++ b/sys/dev/ic/dpt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dpt.c,v 1.23 2010/01/09 23:15:06 krw Exp $ */ +/* $OpenBSD: dpt.c,v 1.24 2010/03/23 01:57:19 krw Exp $ */ /* $NetBSD: dpt.c,v 1.12 1999/10/23 16:26:33 ad Exp $ */ /*- @@ -904,7 +904,7 @@ dpt_scsi_cmd(xs) xs->error = XS_DRIVER_STUFFUP; scsi_done(xs); splx(s); - return (COMPLETE); + return; } /* XXX we can't reset devices just yet */ @@ -917,7 +917,7 @@ dpt_scsi_cmd(xs) xs->error = XS_DRIVER_STUFFUP; scsi_done(xs); splx(s); - return (COMPLETE); + return; } /* Get a CCB */ @@ -927,8 +927,10 @@ dpt_scsi_cmd(xs) #ifdef __OpenBSD__ if ((ccb = dpt_alloc_ccb(sc, xs->flags)) == NULL) { #endif /* __OpenBSD__ */ + xs->error = XS_NO_CCB; + scsi_done(xs); splx(s); - return (NO_CCB); + return; } splx(s); @@ -1005,7 +1007,7 @@ dpt_scsi_cmd(xs) s = splbio(); scsi_done(xs); splx(s); - return (COMPLETE); + return; } bus_dmamap_sync(dmat, xfer, 0, xfer->dm_mapsize, @@ -1058,11 +1060,15 @@ dpt_scsi_cmd(xs) if (dpt_cmd(sc, &ccb->ccb_eata_cp, ccb->ccb_ccbpa, CP_DMA_CMD, 0)) { printf("%s: dpt_cmd failed\n", sc->sc_dv.dv_xname); dpt_free_ccb(sc, ccb); - return (NO_CCB); + xs->error = XS_NO_CCB; + s = splbio(); + scsi_done(xs); + splx(s); + return; } if ((xs->flags & SCSI_POLL) == 0) - return (SUCCESSFULLY_QUEUED); + return; /* Don't wait longer than this single command wants to wait */ if (dpt_poll(sc, ccb)) { @@ -1075,8 +1081,6 @@ dpt_scsi_cmd(xs) s = splbio(); dpt_done_ccb(sc, ccb); splx(s); - - return (COMPLETE); } /* diff --git a/sys/dev/ic/dptvar.h b/sys/dev/ic/dptvar.h index a9c1d4a76ef..ee59c092385 100644 --- a/sys/dev/ic/dptvar.h +++ b/sys/dev/ic/dptvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: dptvar.h,v 1.4 2009/02/16 21:19:06 miod Exp $ */ +/* $OpenBSD: dptvar.h,v 1.5 2010/03/23 01:57:19 krw Exp $ */ /* $NetBSD: dptvar.h,v 1.5 1999/10/23 16:26:32 ad Exp $ */ /* @@ -101,7 +101,7 @@ void dpt_minphys(struct buf *, struct scsi_link *); int dpt_scsi_cmd(struct scsipi_xfer *); #endif /* __NetBSD__ */ #ifdef __OpenBSD__ -int dpt_scsi_cmd(struct scsi_xfer *); +void dpt_scsi_cmd(struct scsi_xfer *); #endif /* __OpenBSD__ */ int dpt_wait(struct dpt_softc *, u_int8_t, u_int8_t, int); int dpt_poll(struct dpt_softc *, struct dpt_ccb *); diff --git a/sys/dev/ic/gdt_common.c b/sys/dev/ic/gdt_common.c index 514dad0fa00..8f2853d3f7b 100644 --- a/sys/dev/ic/gdt_common.c +++ b/sys/dev/ic/gdt_common.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gdt_common.c,v 1.47 2010/01/09 23:15:06 krw Exp $ */ +/* $OpenBSD: gdt_common.c,v 1.48 2010/03/23 01:57:19 krw Exp $ */ /* * Copyright (c) 1999, 2000, 2003 Niklas Hallqvist. All rights reserved. @@ -82,8 +82,8 @@ int gdt_ioctl_disk(struct gdt_softc *, struct bioc_disk *); int gdt_ioctl_alarm(struct gdt_softc *, struct bioc_alarm *); int gdt_ioctl_setstate(struct gdt_softc *, struct bioc_setstate *); #endif /* NBIO > 0 */ -int gdt_raw_scsi_cmd(struct scsi_xfer *); -int gdt_scsi_cmd(struct scsi_xfer *); +void gdt_raw_scsi_cmd(struct scsi_xfer *); +void gdt_scsi_cmd(struct scsi_xfer *); void gdt_start_ccbs(struct gdt_softc *); int gdt_sync_event(struct gdt_softc *, int, u_int8_t, struct scsi_xfer *); @@ -577,7 +577,7 @@ gdt_dequeue(struct gdt_softc *sc) * Start a SCSI operation on a cache device. * XXX Polled operation is not yet complete. What kind of locking do we need? */ -int +void gdt_scsi_cmd(struct scsi_xfer *xs) { struct scsi_link *link = xs->sc_link; @@ -591,7 +591,7 @@ gdt_scsi_cmd(struct scsi_xfer *xs) struct scsi_rw *rw; struct scsi_rw_big *rwb; bus_dmamap_t xfer; - int error, retval = SUCCESSFULLY_QUEUED; + int error; int s; GDT_DPRINTF(GDT_D_CMD, ("gdt_scsi_cmd ")); @@ -609,7 +609,7 @@ gdt_scsi_cmd(struct scsi_xfer *xs) xs->error = XS_DRIVER_STUFFUP; scsi_done(xs); splx(s); - return (COMPLETE); + return; } /* Don't double enqueue if we came from gdt_chain. */ @@ -708,8 +708,10 @@ gdt_scsi_cmd(struct scsi_xfer *xs) * We are out of commands, try again in a little while. */ if (ccb == NULL) { + xs->error = XS_NO_CCB; + scsi_done(xs); splx(s); - return (NO_CCB); + return; } ccb->gc_blockno = blockno; @@ -753,11 +755,13 @@ gdt_scsi_cmd(struct scsi_xfer *xs) /* XXX what if enqueue did not start a transfer? */ if (gdt_polling || (xs->flags & SCSI_POLL)) { if (!gdt_wait(sc, ccb, ccb->gc_timeout)) { - splx(s); printf("%s: command %d timed out\n", DEVNAME(sc), ccb->gc_cmd_index); - return (NO_CCB); + xs->error = XS_NO_CCB; + scsi_done(xs); + splx(s); + return; } scsi_done(xs); } @@ -768,13 +772,11 @@ gdt_scsi_cmd(struct scsi_xfer *xs) * Don't process the queue if we are polling. */ if (xs->flags & SCSI_POLL) { - retval = COMPLETE; break; } } splx(s); - return (retval); } /* XXX Currently only for cacheservice, returns 0 if busy */ @@ -990,7 +992,7 @@ gdt_internal_cache_cmd(struct scsi_xfer *xs) } /* Start a raw SCSI operation */ -int +void gdt_raw_scsi_cmd(struct scsi_xfer *xs) { struct scsi_link *link = xs->sc_link; @@ -1010,7 +1012,7 @@ gdt_raw_scsi_cmd(struct scsi_xfer *xs) s = splbio(); scsi_done(xs); splx(s); - return (COMPLETE); + return; } if ((ccb = gdt_get_ccb(sc, xs->flags)) == NULL) { @@ -1019,7 +1021,7 @@ gdt_raw_scsi_cmd(struct scsi_xfer *xs) s = splbio(); scsi_done(xs); splx(s); - return (COMPLETE); + return; } xs->error = XS_DRIVER_STUFFUP; @@ -1028,8 +1030,6 @@ gdt_raw_scsi_cmd(struct scsi_xfer *xs) gdt_free_ccb(sc, ccb); splx(s); - - return (COMPLETE); } void diff --git a/sys/dev/ic/iha.c b/sys/dev/ic/iha.c index 9225efcee77..51064bed6f2 100644 --- a/sys/dev/ic/iha.c +++ b/sys/dev/ic/iha.c @@ -1,4 +1,4 @@ -/* $OpenBSD: iha.c,v 1.35 2010/01/10 00:10:23 krw Exp $ */ +/* $OpenBSD: iha.c,v 1.36 2010/03/23 01:57:19 krw Exp $ */ /*------------------------------------------------------------------------- * * Device driver for the INI-9XXXU/UW or INIC-940/950 PCI SCSI Controller. @@ -259,7 +259,7 @@ iha_setup_sg_list(sc, pScb) * from the generic SCSI driver via the field * sc_adapter.scsi_cmd of iha_softc. */ -int +void iha_scsi_cmd(xs) struct scsi_xfer *xs; { @@ -273,14 +273,16 @@ iha_scsi_cmd(xs) s = splbio(); scsi_done(xs); splx(s); - return (COMPLETE); + return; } pScb = iha_pop_free_scb(sc); if (pScb == NULL) { - /* XXX - different xs->error/return if - * SCSI_POLL/_NOSLEEP? */ - return (NO_CCB); + xs->error = XS_NO_CCB; + s = splbio(); + scsi_done(xs); + splx(s); + return; } pScb->SCB_Target = sc_link->target; @@ -321,7 +323,7 @@ iha_scsi_cmd(xs) s = splbio(); scsi_done(xs); splx(s); - return (COMPLETE); + return; } bus_dmamap_sync(sc->sc_dmat, pScb->SCB_DataDma, 0, pScb->SCB_BufChars, @@ -335,7 +337,7 @@ iha_scsi_cmd(xs) s = splbio(); scsi_done(xs); splx(s); - return (COMPLETE); + return; } } @@ -350,11 +352,6 @@ iha_scsi_cmd(xs) timeout_add_msec(&xs->stimeout, xs->timeout); iha_exec_scb(sc, pScb); - - if (xs->flags & (SCSI_POLL | ITSDONE)) - return (COMPLETE); - else - return (SUCCESSFULLY_QUEUED); } /* diff --git a/sys/dev/ic/iha.h b/sys/dev/ic/iha.h index 80a2034815d..6804224d8d8 100644 --- a/sys/dev/ic/iha.h +++ b/sys/dev/ic/iha.h @@ -1,4 +1,4 @@ -/* $OpenBSD: iha.h,v 1.16 2009/02/16 21:19:06 miod Exp $ */ +/* $OpenBSD: iha.h,v 1.17 2010/03/23 01:57:19 krw Exp $ */ /*------------------------------------------------------------------------- * * Device driver for the INI-9XXXU/UW or INIC-940/950 PCI SCSI Controller. @@ -422,7 +422,7 @@ struct iha_nvram { /* Functions used by higher SCSI layers, the kernel, or iha.c and iha_pci.c */ -int iha_scsi_cmd(struct scsi_xfer *); +void iha_scsi_cmd(struct scsi_xfer *); int iha_intr(void *); void iha_minphys(struct buf *, struct scsi_link *); int iha_init_tulip(struct iha_softc *); diff --git a/sys/dev/ic/isp_openbsd.c b/sys/dev/ic/isp_openbsd.c index e1b222e867b..8062cc9e968 100644 --- a/sys/dev/ic/isp_openbsd.c +++ b/sys/dev/ic/isp_openbsd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: isp_openbsd.c,v 1.41 2010/01/04 02:23:10 krw Exp $ */ +/* $OpenBSD: isp_openbsd.c,v 1.42 2010/03/23 01:57:19 krw Exp $ */ /* * Platform (OpenBSD) dependent common attachment code for QLogic adapters. * @@ -61,12 +61,12 @@ #define _XT(xs) ((((xs)->timeout/1000) * hz) + (3 * hz)) static void ispminphys(struct buf *, struct scsi_link *); -static int32_t ispcmd_slow(XS_T *); -static int32_t ispcmd(XS_T *); +static void ispcmd_slow(XS_T *); +static void ispcmd(XS_T *); struct scsi_device isp_dev = { NULL, NULL, NULL, NULL }; -int isp_polled_cmd (struct ispsoftc *, XS_T *); +void isp_polled_cmd (struct ispsoftc *, XS_T *); void isp_wdog (void *); void isp_make_here(ispsoftc_t *, int); void isp_make_gone(ispsoftc_t *, int); @@ -197,7 +197,7 @@ ispminphys(struct buf *bp, struct scsi_link *sl) minphys(bp); } -int32_t +void ispcmd_slow(XS_T *xs) { sdparam *sdp; @@ -287,13 +287,12 @@ isp_add2_blocked_queue(struct ispsoftc *isp, XS_T *xs) xs->free_list.le_next = NULL; } -int32_t +void ispcmd(XS_T *xs) { struct ispsoftc *isp; int result; - /* * Make sure that there's *some* kind of sane setting. */ @@ -307,7 +306,7 @@ ispcmd(XS_T *xs) xs->error = XS_SELTIMEOUT; scsi_done(xs); ISP_UNLOCK(isp); - return (COMPLETE); + return; } if (isp->isp_state < ISP_RUNSTATE) { @@ -318,7 +317,7 @@ ispcmd(XS_T *xs) XS_SETERR(xs, HBA_BOTCH); scsi_done(xs); ISP_UNLOCK(isp); - return (COMPLETE); + return; } isp->isp_state = ISP_RUNSTATE; ISP_ENABLE_INTS(isp); @@ -329,8 +328,10 @@ ispcmd(XS_T *xs) */ if (isp->isp_osinfo.blocked) { if (xs->flags & SCSI_POLL) { + xs->error = XS_NO_CCB; + scsi_done(xs); ISP_UNLOCK(isp); - return (NO_CCB); + return; } if (isp->isp_osinfo.blocked == 2) { isp_restart(isp); @@ -339,24 +340,23 @@ ispcmd(XS_T *xs) isp_add2_blocked_queue(isp, xs); ISP_UNLOCK(isp); isp_prt(isp, ISP_LOGDEBUG0, "added to blocked queue"); - return (SUCCESSFULLY_QUEUED); + return; } } if (xs->flags & SCSI_POLL) { volatile u_int8_t ombi = isp->isp_osinfo.no_mbox_ints; isp->isp_osinfo.no_mbox_ints = 1; - result = isp_polled_cmd(isp, xs); + isp_polled_cmd(isp, xs); isp->isp_osinfo.no_mbox_ints = ombi; ISP_UNLOCK(isp); - return (result); + return; } result = isp_start(xs); switch (result) { case CMD_QUEUED: - result = SUCCESSFULLY_QUEUED; if (xs->timeout) { timeout_add(&xs->stimeout, _XT(xs)); XS_CMD_S_TIMER(xs); @@ -371,10 +371,8 @@ ispcmd(XS_T *xs) isp->isp_osinfo.blocked |= 2; isp_prt(isp, ISP_LOGDEBUG0, "blocking queue"); isp_add2_blocked_queue(isp, xs); - result = SUCCESSFULLY_QUEUED; break; case CMD_RQLATER: - result = SUCCESSFULLY_QUEUED; /* Lie */ isp_prt(isp, ISP_LOGDEBUG1, "retrying later for %d.%d", XS_TGT(xs), XS_LUN(xs)); timeout_set(&xs->stimeout, isp_requeue, xs); @@ -382,14 +380,12 @@ ispcmd(XS_T *xs) XS_CMD_S_TIMER(xs); break; case CMD_COMPLETE: - result = COMPLETE; break; } ISP_UNLOCK(isp); - return (result); } -int +void isp_polled_cmd(struct ispsoftc *isp, XS_T *xs) { int result; @@ -399,22 +395,16 @@ isp_polled_cmd(struct ispsoftc *isp, XS_T *xs) switch (result) { case CMD_QUEUED: - result = SUCCESSFULLY_QUEUED; - break; + return; case CMD_RQLATER: case CMD_EAGAIN: - result = NO_CCB; - break; + xs->error = XS_NO_CCB; + /* FALLTHROUGH */ case CMD_COMPLETE: scsi_done(xs); - result = COMPLETE; break; } - if (result != SUCCESSFULLY_QUEUED) { - return (result); - } - /* * If we can't use interrupts, poll on completion. */ @@ -446,8 +436,6 @@ isp_polled_cmd(struct ispsoftc *isp, XS_T *xs) XS_SETERR(xs, HBA_BOTCH); } } - - return (COMPLETE); } void diff --git a/sys/dev/ic/mfi.c b/sys/dev/ic/mfi.c index 37357603a19..3697effd41b 100644 --- a/sys/dev/ic/mfi.c +++ b/sys/dev/ic/mfi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mfi.c,v 1.99 2010/01/09 23:15:06 krw Exp $ */ +/* $OpenBSD: mfi.c,v 1.100 2010/03/23 01:57:19 krw Exp $ */ /* * Copyright (c) 2006 Marco Peereboom <marco@peereboom.us> * @@ -55,7 +55,7 @@ struct cfdriver mfi_cd = { NULL, "mfi", DV_DULL }; -int mfi_scsi_cmd(struct scsi_xfer *); +void mfi_scsi_cmd(struct scsi_xfer *); int mfi_scsi_ioctl(struct scsi_link *, u_long, caddr_t, int, struct proc *); void mfiminphys(struct buf *bp, struct scsi_link *sl); @@ -974,7 +974,7 @@ mfi_scsi_ld(struct mfi_ccb *ccb, struct scsi_xfer *xs) return (0); } -int +void mfi_scsi_cmd(struct scsi_xfer *xs) { struct scsi_link *link = xs->sc_link; @@ -1002,7 +1002,11 @@ mfi_scsi_cmd(struct scsi_xfer *xs) if ((ccb = mfi_get_ccb(sc)) == NULL) { DNPRINTF(MFI_D_CMD, "%s: mfi_scsi_cmd no ccb\n", DEVNAME(sc)); - return (NO_CCB); + xs->error = XS_NO_CCB; + s = splbio(); + scsi_done(xs); + splx(s); + return; } xs->error = XS_NOERROR; @@ -1088,7 +1092,7 @@ mfi_scsi_cmd(struct scsi_xfer *xs) s = splbio(); scsi_done(xs); splx(s); - return (COMPLETE); + return; } mfi_post(sc, ccb); @@ -1096,7 +1100,7 @@ mfi_scsi_cmd(struct scsi_xfer *xs) DNPRINTF(MFI_D_DMA, "%s: mfi_scsi_cmd queued %d\n", DEVNAME(sc), ccb->ccb_dmamap->dm_nsegs); - return (SUCCESSFULLY_QUEUED); + return; stuffup: xs->error = XS_DRIVER_STUFFUP; @@ -1104,7 +1108,6 @@ complete: s = splbio(); scsi_done(xs); splx(s); - return (COMPLETE); } int diff --git a/sys/dev/ic/mpi.c b/sys/dev/ic/mpi.c index 4fe99841887..ffe1f265731 100644 --- a/sys/dev/ic/mpi.c +++ b/sys/dev/ic/mpi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mpi.c,v 1.134 2010/01/11 03:51:57 dlg Exp $ */ +/* $OpenBSD: mpi.c,v 1.135 2010/03/23 01:57:19 krw Exp $ */ /* * Copyright (c) 2005, 2006, 2009 David Gwynne <dlg@openbsd.org> @@ -62,7 +62,7 @@ struct cfdriver mpi_cd = { DV_DULL }; -int mpi_scsi_cmd(struct scsi_xfer *); +void mpi_scsi_cmd(struct scsi_xfer *); void mpi_scsi_cmd_done(struct mpi_ccb *); void mpi_minphys(struct buf *bp, struct scsi_link *sl); int mpi_scsi_probe(struct scsi_link *); @@ -1188,7 +1188,7 @@ mpi_wait_done(struct mpi_ccb *ccb) mtx_leave(cookie); } -int +void mpi_scsi_cmd(struct scsi_xfer *xs) { struct scsi_link *link = xs->sc_link; @@ -1211,12 +1211,17 @@ mpi_scsi_cmd(struct scsi_xfer *xs) s = splbio(); scsi_done(xs); splx(s); - return (COMPLETE); + return; } ccb = mpi_get_ccb(sc); - if (ccb == NULL) - return (NO_CCB); + if (ccb == NULL) { + xs->error = XS_NO_CCB; + s = splbio(); + scsi_done(xs); + splx(s); + return; + } DNPRINTF(MPI_D_CMD, "%s: ccb_id: %d xs->flags: 0x%x\n", DEVNAME(sc), ccb->ccb_id, xs->flags); @@ -1273,7 +1278,7 @@ mpi_scsi_cmd(struct scsi_xfer *xs) s = splbio(); scsi_done(xs); splx(s); - return (COMPLETE); + return; } timeout_set(&xs->stimeout, mpi_timeout_xs, ccb); @@ -1285,11 +1290,10 @@ mpi_scsi_cmd(struct scsi_xfer *xs) scsi_done(xs); splx(s); } - return (COMPLETE); + return; } mpi_start(sc, ccb); - return (SUCCESSFULLY_QUEUED); } void diff --git a/sys/dev/ic/ncr5380sbc.c b/sys/dev/ic/ncr5380sbc.c index d19cd3d670e..78cdee445fc 100644 --- a/sys/dev/ic/ncr5380sbc.c +++ b/sys/dev/ic/ncr5380sbc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ncr5380sbc.c,v 1.23 2010/01/09 23:15:06 krw Exp $ */ +/* $OpenBSD: ncr5380sbc.c,v 1.24 2010/03/23 01:57:19 krw Exp $ */ /* $NetBSD: ncr5380sbc.c,v 1.13 1996/10/13 01:37:25 christos Exp $ */ /* @@ -599,7 +599,7 @@ ncr5380_scsi_cmd(xs) { struct ncr5380_softc *sc; struct sci_req *sr; - int s, rv, i, flags; + int s, , flags; sc = xs->sc_link->adapter_softc; flags = xs->flags; @@ -631,8 +631,9 @@ ncr5380_scsi_cmd(xs) if (sc->sc_ring[i].sr_xs == NULL) goto new; - rv = NO_CCB; - NCR_TRACE("scsi_cmd: no openings, rv=%d\n", rv); + xs->error = XS_NO_CCB; + scsi_done(xs); + NCR_TRACE("scsi_cmd: no openings\n", 0); goto out; new: @@ -647,7 +648,6 @@ new: sr->sr_flags = (flags & SCSI_POLL) ? SR_IMMED : 0; sr->sr_status = -1; /* no value */ sc->sc_ncmds++; - rv = SUCCESSFULLY_QUEUED; NCR_TRACE("scsi_cmd: new sr=0x%x\n", (long)sr); @@ -673,12 +673,10 @@ new: if (sc->sc_state != NCR_IDLE) panic("ncr5380_scsi_cmd: poll didn't finish"); #endif - rv = COMPLETE; } out: splx(s); - return (rv); } diff --git a/sys/dev/ic/ncr53c9x.c b/sys/dev/ic/ncr53c9x.c index 7b021185e66..7be39a3b6c6 100644 --- a/sys/dev/ic/ncr53c9x.c +++ b/sys/dev/ic/ncr53c9x.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ncr53c9x.c,v 1.44 2010/01/13 06:09:44 krw Exp $ */ +/* $OpenBSD: ncr53c9x.c,v 1.45 2010/03/23 01:57:19 krw Exp $ */ /* $NetBSD: ncr53c9x.c,v 1.56 2000/11/30 14:41:46 thorpej Exp $ */ /* @@ -789,7 +789,7 @@ ncr53c9x_get_ecb(sc, flags) * This function is called by the higher level SCSI-driver to queue/run * SCSI-commands. */ -int +void ncr53c9x_scsi_cmd(xs) struct scsi_xfer *xs; { @@ -811,7 +811,11 @@ ncr53c9x_scsi_cmd(xs) if (li == NULL) { /* Initialize LUN info and add to list. */ if ((li = malloc(sizeof(*li), M_DEVBUF, M_NOWAIT)) == NULL) { - return (NO_CCB); + xs->error = XS_NO_CCB; + s = splbio(); + scsi_done(xs); + splx(s); + return; } bzero(li, sizeof(*li)); li->last_used = time_second; @@ -823,8 +827,13 @@ ncr53c9x_scsi_cmd(xs) splx(s); } - if ((ecb = ncr53c9x_get_ecb(sc, flags)) == NULL) - return (NO_CCB); + if ((ecb = ncr53c9x_get_ecb(sc, flags)) == NULL) { + xs->error = XS_NO_CCB; + s = splbio(); + scsi_done(xs); + splx(s); + return; + } /* Initialize ecb */ ecb->xs = xs; @@ -852,7 +861,7 @@ ncr53c9x_scsi_cmd(xs) splx(s); if ((flags & SCSI_POLL) == 0) - return (SUCCESSFULLY_QUEUED); + return; /* Not allowed to use interrupts, use polling instead */ if (ncr53c9x_poll(sc, xs, ecb->timeout)) { @@ -860,7 +869,6 @@ ncr53c9x_scsi_cmd(xs) if (ncr53c9x_poll(sc, xs, ecb->timeout)) ncr53c9x_timeout(ecb); } - return (COMPLETE); } /* diff --git a/sys/dev/ic/ncr53c9xvar.h b/sys/dev/ic/ncr53c9xvar.h index 1305433246e..00761c471a5 100644 --- a/sys/dev/ic/ncr53c9xvar.h +++ b/sys/dev/ic/ncr53c9xvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ncr53c9xvar.h,v 1.18 2008/06/26 05:42:15 ray Exp $ */ +/* $OpenBSD: ncr53c9xvar.h,v 1.19 2010/03/23 01:57:19 krw Exp $ */ /* $NetBSD: ncr53c9xvar.h,v 1.13 1998/05/26 23:17:34 thorpej Exp $ */ /*- @@ -426,7 +426,7 @@ struct ncr53c9x_softc { void ncr53c9x_attach(struct ncr53c9x_softc *, struct scsi_adapter *, struct scsi_device *); -int ncr53c9x_scsi_cmd(struct scsi_xfer *); +void ncr53c9x_scsi_cmd(struct scsi_xfer *); void ncr53c9x_reset(struct ncr53c9x_softc *); int ncr53c9x_intr(void *); void ncr53c9x_init(struct ncr53c9x_softc *, int); diff --git a/sys/dev/ic/oosiop.c b/sys/dev/ic/oosiop.c index 304b2140756..e417c83541c 100644 --- a/sys/dev/ic/oosiop.c +++ b/sys/dev/ic/oosiop.c @@ -1,4 +1,4 @@ -/* $OpenBSD: oosiop.c,v 1.13 2010/01/10 00:10:23 krw Exp $ */ +/* $OpenBSD: oosiop.c,v 1.14 2010/03/23 01:57:19 krw Exp $ */ /* $NetBSD: oosiop.c,v 1.4 2003/10/29 17:45:55 tsutsui Exp $ */ /* @@ -79,7 +79,7 @@ void oosiop_phasemismatch(struct oosiop_softc *); void oosiop_setup_syncxfer(struct oosiop_softc *); void oosiop_set_syncparam(struct oosiop_softc *, int, int, int); void oosiop_minphys(struct buf *, struct scsi_link *); -int oosiop_scsicmd(struct scsi_xfer *); +void oosiop_scsicmd(struct scsi_xfer *); void oosiop_done(struct oosiop_softc *, struct oosiop_cb *); void oosiop_timeout(void *); void oosiop_reset(struct oosiop_softc *); @@ -712,7 +712,7 @@ oosiop_minphys(struct buf *bp, struct scsi_link *sl) minphys(bp); } -int +void oosiop_scsicmd(struct scsi_xfer *xs) { struct oosiop_softc *sc; @@ -748,7 +748,7 @@ oosiop_scsicmd(struct scsi_xfer *xs) scsi_done(xs); TAILQ_INSERT_TAIL(&sc->sc_free_cb, cb, chain); splx(s); - return (COMPLETE); + return; } bus_dmamap_sync(sc->sc_dmat, cb->cmddma, 0, xs->cmdlen, BUS_DMASYNC_PREWRITE); @@ -771,7 +771,7 @@ oosiop_scsicmd(struct scsi_xfer *xs) scsi_done(xs); TAILQ_INSERT_TAIL(&sc->sc_free_cb, cb, chain); splx(s); - return (COMPLETE); + return; } bus_dmamap_sync(sc->sc_dmat, cb->datadma, 0, xs->datalen, @@ -806,11 +806,6 @@ oosiop_scsicmd(struct scsi_xfer *xs) } if (dopoll) oosiop_poll(sc, cb); - - if (xs->flags & (SCSI_POLL | ITSDONE)) - return (COMPLETE); - else - return (SUCCESSFULLY_QUEUED); } void diff --git a/sys/dev/ic/osiop.c b/sys/dev/ic/osiop.c index 35aded288b6..579f5f09e57 100644 --- a/sys/dev/ic/osiop.c +++ b/sys/dev/ic/osiop.c @@ -1,4 +1,4 @@ -/* $OpenBSD: osiop.c,v 1.40 2010/01/10 00:10:23 krw Exp $ */ +/* $OpenBSD: osiop.c,v 1.41 2010/03/23 01:57:19 krw Exp $ */ /* $NetBSD: osiop.c,v 1.9 2002/04/05 18:27:54 bouyer Exp $ */ /* @@ -91,7 +91,7 @@ void osiop_attach(struct osiop_softc *); void osiop_minphys(struct buf *, struct scsi_link *); -int osiop_scsicmd(struct scsi_xfer *xs); +void osiop_scsicmd(struct scsi_xfer *xs); void osiop_poll(struct osiop_softc *, struct osiop_acb *); void osiop_sched(struct osiop_softc *); void osiop_scsidone(struct osiop_acb *, int); @@ -366,7 +366,7 @@ osiop_minphys(struct buf *bp, struct scsi_link *sl) * used by specific osiop controller * */ -int +void osiop_scsicmd(xs) struct scsi_xfer *xs; { @@ -396,7 +396,11 @@ osiop_scsicmd(xs) panic("osiop_scsipi_request"); #endif splx(s); - return (NO_CCB); + xs->error = XS_NO_CCB; + s = splbio(); + scsi_done(xs); + splx(s); + return; } acb->flags = 0; @@ -425,7 +429,7 @@ osiop_scsicmd(xs) scsi_done(xs); TAILQ_INSERT_TAIL(&sc->free_list, acb, chain); splx(s); - return (COMPLETE); + return; } bus_dmamap_sync(sc->sc_dmat, acb->datadma, 0, acb->datalen, (acb->xsflags & SCSI_DATA_IN) ? @@ -454,11 +458,6 @@ osiop_scsicmd(xs) if (dopoll) osiop_poll(sc, acb); - - if (xs->flags & (SCSI_POLL | ITSDONE)) - return (COMPLETE); - else - return (SUCCESSFULLY_QUEUED); } void diff --git a/sys/dev/ic/siop.c b/sys/dev/ic/siop.c index 7a7207752af..be27fc5352a 100644 --- a/sys/dev/ic/siop.c +++ b/sys/dev/ic/siop.c @@ -1,4 +1,4 @@ -/* $OpenBSD: siop.c,v 1.56 2010/01/10 00:10:23 krw Exp $ */ +/* $OpenBSD: siop.c,v 1.57 2010/03/23 01:57:19 krw Exp $ */ /* $NetBSD: siop.c,v 1.79 2005/11/18 23:10:32 bouyer Exp $ */ /* @@ -89,7 +89,7 @@ int siop_handle_qtag_reject(struct siop_cmd *); void siop_scsicmd_end(struct siop_cmd *); void siop_start(struct siop_softc *); void siop_timeout(void *); -int siop_scsicmd(struct scsi_xfer *); +void siop_scsicmd(struct scsi_xfer *); #ifdef DUMP_SCRIPT void siop_dump_script(struct siop_softc *); #endif @@ -1356,7 +1356,7 @@ siop_handle_reset(sc) } } -int +void siop_scsicmd(xs) struct scsi_xfer *xs; { @@ -1384,8 +1384,10 @@ siop_scsicmd(xs) printf("%s: can't malloc memory for " "target %d\n", sc->sc_c.sc_dev.dv_xname, target); + xs->error = XS_NO_CCB; + scsi_done(xs); splx(s); - return(NO_CCB); + return; } siop_target = (struct siop_target*)sc->sc_c.targets[target]; @@ -1401,8 +1403,10 @@ siop_scsicmd(xs) if (siop_target->lunsw == NULL) { printf("%s: can't alloc lunsw for target %d\n", sc->sc_c.sc_dev.dv_xname, target); + xs->error = XS_NO_CCB; + scsi_done(xs); splx(s); - return(NO_CCB); + return; } for (i=0; i < 8; i++) siop_target->siop_lun[i] = NULL; @@ -1416,16 +1420,20 @@ siop_scsicmd(xs) printf("%s: can't alloc siop_lun for " "target %d lun %d\n", sc->sc_c.sc_dev.dv_xname, target, lun); + xs->error = XS_NO_CCB; + scsi_done(xs); splx(s); - return(NO_CCB); + return; } } /* Looks like we could issue a command, if a ccb is available. */ siop_cmd = TAILQ_FIRST(&sc->free_list); if (siop_cmd == NULL) { + xs->error = XS_NO_CCB; + scsi_done(xs); splx(s); - return(NO_CCB); + return; } TAILQ_REMOVE(&sc->free_list, siop_cmd, next); #ifdef DIAGNOSTIC @@ -1459,8 +1467,10 @@ siop_scsicmd(xs) sc->sc_c.sc_dev.dv_xname, error); siop_cmd->cmd_c.status = CMDST_FREE; TAILQ_INSERT_TAIL(&sc->free_list, siop_cmd, next); + xs->error = XS_NO_CCB; + scsi_done(xs); splx(s); - return(NO_CCB); + return; } bus_dmamap_sync(sc->sc_c.sc_dmat, siop_cmd->cmd_c.dmamap_data, 0, @@ -1484,7 +1494,7 @@ siop_scsicmd(xs) siop_start(sc); if ((xs->flags & SCSI_POLL) == 0) { splx(s); - return (SUCCESSFULLY_QUEUED); + return; } /* Poll for command completion. */ @@ -1531,7 +1541,6 @@ siop_scsicmd(xs) } splx(s); - return (COMPLETE); } void diff --git a/sys/dev/ic/trm.c b/sys/dev/ic/trm.c index 6a8324b738b..a4a62db4d05 100644 --- a/sys/dev/ic/trm.c +++ b/sys/dev/ic/trm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trm.c,v 1.17 2010/02/27 00:39:40 krw Exp $ +/* $OpenBSD: trm.c,v 1.18 2010/03/23 01:57:19 krw Exp $ * ------------------------------------------------------------ * O.S : OpenBSD * File Name : trm.c @@ -76,7 +76,7 @@ u_int8_t trm_get_data(bus_space_tag_t, bus_space_handle_t, u_int8_t); void trm_wait_30us(bus_space_tag_t, bus_space_handle_t); -int trm_scsi_cmd(struct scsi_xfer *); +void trm_scsi_cmd(struct scsi_xfer *); struct trm_scsi_req_q *trm_GetFreeSRB(struct trm_softc *); @@ -326,7 +326,7 @@ trm_StartWaitingSRB(struct trm_softc *sc) * Call By : GENERIC SCSI driver * ------------------------------------------------------------ */ -int +void trm_scsi_cmd(struct scsi_xfer *xs) { struct trm_scsi_req_q *pSRB; @@ -357,7 +357,7 @@ trm_scsi_cmd(struct scsi_xfer *xs) intflag = splbio(); scsi_done(xs); splx(intflag); - return COMPLETE; + return; } if (lun >= TRM_MAX_LUNS) { printf("%s: lun=%d >= %d\n", @@ -366,7 +366,7 @@ trm_scsi_cmd(struct scsi_xfer *xs) intflag = splbio(); scsi_done(xs); splx(intflag); - return COMPLETE; + return; } pDCB = sc->pDCB[target][lun]; @@ -376,7 +376,7 @@ trm_scsi_cmd(struct scsi_xfer *xs) intflag = splbio(); scsi_done(xs); splx(intflag); - return COMPLETE; + return; } xferflags = xs->flags; @@ -389,7 +389,7 @@ trm_scsi_cmd(struct scsi_xfer *xs) intflag = splbio(); scsi_done(xs); splx(intflag); - return COMPLETE; + return; } xs->error = XS_NOERROR; @@ -401,8 +401,10 @@ trm_scsi_cmd(struct scsi_xfer *xs) pSRB = trm_GetFreeSRB(sc); if (pSRB == NULL) { + xs->error = XS_NO_CCB; + scsi_done(xs); splx(intflag); - return (NO_CCB); + return; } /* @@ -432,7 +434,7 @@ trm_scsi_cmd(struct scsi_xfer *xs) TAILQ_INSERT_HEAD(&sc->freeSRB, pSRB, link); scsi_done(xs); splx(intflag); - return COMPLETE; + return; } bus_dmamap_sync(sc->sc_dmatag, pSRB->dmamapxfer, @@ -465,7 +467,7 @@ trm_scsi_cmd(struct scsi_xfer *xs) if ((xferflags & SCSI_POLL) == 0) { timeout_add_msec(&xs->stimeout, xs->timeout); splx(intflag); - return SUCCESSFULLY_QUEUED; + return; } while ((--xs->timeout > 0) && ((xs->flags & ITSDONE) == 0)) { @@ -477,7 +479,6 @@ trm_scsi_cmd(struct scsi_xfer *xs) trm_timeout(pSRB); splx(intflag); - return COMPLETE; } /* diff --git a/sys/dev/ic/twe.c b/sys/dev/ic/twe.c index 1c633747cd6..dd0d0c6d21d 100644 --- a/sys/dev/ic/twe.c +++ b/sys/dev/ic/twe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: twe.c,v 1.33 2010/01/09 23:15:06 krw Exp $ */ +/* $OpenBSD: twe.c,v 1.34 2010/03/23 01:57:20 krw Exp $ */ /* * Copyright (c) 2000-2002 Michael Shalayeff. All rights reserved. @@ -64,7 +64,7 @@ struct cfdriver twe_cd = { NULL, "twe", DV_DULL }; -int twe_scsi_cmd(struct scsi_xfer *); +void twe_scsi_cmd(struct scsi_xfer *); struct scsi_adapter twe_switch = { twe_scsi_cmd, tweminphys, 0, 0, @@ -770,7 +770,7 @@ twe_copy_internal_data(xs, v, size) } } -int +void twe_scsi_cmd(xs) struct scsi_xfer *xs; { @@ -795,7 +795,7 @@ twe_scsi_cmd(xs) lock = TWE_LOCK(sc); scsi_done(xs); TWE_UNLOCK(sc, lock); - return (COMPLETE); + return; } TWE_DPRINTF(TWE_D_CMD, ("twe_scsi_cmd ")); @@ -854,7 +854,7 @@ twe_scsi_cmd(xs) lock = TWE_LOCK(sc); scsi_done(xs); TWE_UNLOCK(sc, lock); - return (COMPLETE); + return; case READ_COMMAND: case READ_BIG: @@ -888,7 +888,7 @@ twe_scsi_cmd(xs) xs->error = XS_DRIVER_STUFFUP; scsi_done(xs); TWE_UNLOCK(sc, lock); - return (COMPLETE); + return; } } @@ -900,8 +900,12 @@ twe_scsi_cmd(xs) default: op = TWE_CMD_NOP; break; } - if ((ccb = twe_get_ccb(sc)) == NULL) - return (NO_CCB); + if ((ccb = twe_get_ccb(sc)) == NULL) { + xs->error = XS_NO_CCB; + scsi_done(xs); + TWE_UNLOCK(sc, lock); + return; + } ccb->ccb_xs = xs; ccb->ccb_data = xs->data; @@ -923,16 +927,10 @@ twe_scsi_cmd(xs) TWE_DPRINTF(TWE_D_CMD, ("failed %p ", xs)); xs->error = XS_DRIVER_STUFFUP; scsi_done(xs); - TWE_UNLOCK(sc, lock); - return (COMPLETE); } TWE_UNLOCK(sc, lock); - - if (wait & SCSI_POLL) - return (COMPLETE); - else - return (SUCCESSFULLY_QUEUED); + return; default: TWE_DPRINTF(TWE_D_CMD, ("unsupported scsi command %#x tgt %d ", @@ -943,8 +941,6 @@ twe_scsi_cmd(xs) lock = TWE_LOCK(sc); scsi_done(xs); TWE_UNLOCK(sc, lock); - - return (COMPLETE); } int diff --git a/sys/dev/ic/uha.c b/sys/dev/ic/uha.c index 90351ac3218..e789b25428a 100644 --- a/sys/dev/ic/uha.c +++ b/sys/dev/ic/uha.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uha.c,v 1.15 2010/01/09 23:15:06 krw Exp $ */ +/* $OpenBSD: uha.c,v 1.16 2010/03/23 01:57:20 krw Exp $ */ /* $NetBSD: uha.c,v 1.3 1996/10/13 01:37:29 christos Exp $ */ #undef UHADEBUG @@ -87,7 +87,7 @@ void uha_free_mscp(struct uha_softc *, struct uha_mscp *); integrate void uha_init_mscp(struct uha_softc *, struct uha_mscp *); struct uha_mscp *uha_get_mscp(struct uha_softc *, int); void uhaminphys(struct buf *, struct scsi_link *); -int uha_scsi_cmd(struct scsi_xfer *); +void uha_scsi_cmd(struct scsi_xfer *); struct scsi_adapter uha_switch = { uha_scsi_cmd, @@ -344,7 +344,7 @@ uhaminphys(struct buf *bp, struct scsi_link *sl) * start a scsi operation given the command and the data address. Also * needs the unit, target and lu. */ -int +void uha_scsi_cmd(xs) struct scsi_xfer *xs; { @@ -365,7 +365,11 @@ uha_scsi_cmd(xs) */ flags = xs->flags; if ((mscp = uha_get_mscp(sc, flags)) == NULL) { - return (NO_CCB); + xs->error = XS_NO_CCB; + s = splbio(); + scsi_done(xs); + splx(s); + return; } mscp->xs = xs; mscp->timeout = xs->timeout; @@ -477,7 +481,7 @@ uha_scsi_cmd(xs) * Usually return SUCCESSFULLY QUEUED */ if ((flags & SCSI_POLL) == 0) - return (SUCCESSFULLY_QUEUED); + return; /* * If we can't use interrupts, poll on completion @@ -487,7 +491,7 @@ uha_scsi_cmd(xs) if ((sc->poll)(sc, xs, mscp->timeout)) uha_timeout(mscp); } - return (COMPLETE); + return; bad: xs->error = XS_DRIVER_STUFFUP; @@ -495,7 +499,7 @@ bad: scsi_done(xs); splx(s); uha_free_mscp(sc, mscp); - return (COMPLETE); + return; } void diff --git a/sys/dev/isa/aha.c b/sys/dev/isa/aha.c index 3b4104596ed..fefa0dee62e 100644 --- a/sys/dev/isa/aha.c +++ b/sys/dev/isa/aha.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aha.c,v 1.66 2010/01/10 00:40:25 krw Exp $ */ +/* $OpenBSD: aha.c,v 1.67 2010/03/23 01:57:20 krw Exp $ */ /* $NetBSD: aha.c,v 1.11 1996/05/12 23:51:23 mycroft Exp $ */ #undef AHADIAG @@ -151,7 +151,7 @@ int aha_find(struct isa_attach_args *, struct aha_softc *, int); void aha_init(struct aha_softc *); void aha_inquire_setup_information(struct aha_softc *); void ahaminphys(struct buf *, struct scsi_link *); -int aha_scsi_cmd(struct scsi_xfer *); +void aha_scsi_cmd(struct scsi_xfer *); int aha_poll(struct aha_softc *, struct scsi_xfer *, int); void aha_timeout(void *arg); @@ -1238,7 +1238,7 @@ ahaminphys(struct buf *bp, struct scsi_link *sl) * start a scsi operation given the command and the data address. Also needs * the unit, target and lu. */ -int +void aha_scsi_cmd(xs) struct scsi_xfer *xs; { @@ -1257,7 +1257,11 @@ aha_scsi_cmd(xs) */ flags = xs->flags; if ((ccb = aha_get_ccb(sc, flags)) == NULL) { - return (NO_CCB); + xs->error = XS_NO_CCB; + s = splbio(); + scsi_done(xs); + splx(s); + return; } ccb->xs = xs; ccb->timeout = xs->timeout; @@ -1286,7 +1290,11 @@ aha_scsi_cmd(xs) if (bus_dmamap_load(sc->sc_dmat, ccb->dmam, xs->data, xs->datalen, NULL, BUS_DMA_NOWAIT) != 0) { aha_free_ccb(sc, ccb); - return (NO_CCB); + xs->error = XS_NO_CCB; + s = splbio(); + scsi_done(xs); + splx(s); + return; } for (seg = 0; seg < ccb->dmam->dm_nsegs; seg++) { ltophys(ccb->dmam->dm_segs[seg].ds_addr, @@ -1347,12 +1355,12 @@ aha_scsi_cmd(xs) aha_free_ccb(sc, ccb); scsi_done(xs); splx(s); - return (COMPLETE); + return; } splx(s); if ((flags & SCSI_POLL) == 0) - return (SUCCESSFULLY_QUEUED); + return; /* * If we can't use interrupts, poll on completion @@ -1362,7 +1370,6 @@ aha_scsi_cmd(xs) if (aha_poll(sc, xs, ccb->timeout)) aha_timeout(ccb); } - return (COMPLETE); } /* diff --git a/sys/dev/isa/seagate.c b/sys/dev/isa/seagate.c index 574689cb667..1c6222c7348 100644 --- a/sys/dev/isa/seagate.c +++ b/sys/dev/isa/seagate.c @@ -1,4 +1,4 @@ -/* $OpenBSD: seagate.c,v 1.32 2010/01/10 00:40:25 krw Exp $ */ +/* $OpenBSD: seagate.c,v 1.33 2010/03/23 01:57:20 krw Exp $ */ /* * ST01/02, Future Domain TMC-885, TMC-950 SCSI driver @@ -274,7 +274,7 @@ static const char *bases[] = { struct sea_scb *sea_get_scb(struct sea_softc *, int); int seaintr(void *); -int sea_scsi_cmd(struct scsi_xfer *); +void sea_scsi_cmd(struct scsi_xfer *); int sea_poll(struct sea_softc *, struct scsi_xfer *, int); int sea_select(struct sea_softc *sea, struct sea_scb *scb); int sea_transfer_pio(struct sea_softc *sea, u_char *phase, @@ -532,7 +532,7 @@ sea_init(struct sea_softc *sea) * start a scsi operation given the command and the data address. Also needs * the unit, target and lu. */ -int +void sea_scsi_cmd(struct scsi_xfer *xs) { struct scsi_link *sc_link = xs->sc_link; @@ -545,7 +545,11 @@ sea_scsi_cmd(struct scsi_xfer *xs) flags = xs->flags; if ((scb = sea_get_scb(sea, flags)) == NULL) { - return (NO_CCB); + xs->error = XS_NO_CCB; + s = splbio(); + scsi_done(xs); + splx(s); + return; } scb->flags = SCB_ACTIVE; scb->xs = xs; @@ -561,7 +565,7 @@ sea_scsi_cmd(struct scsi_xfer *xs) s = splbio(); scsi_done(xs); splx(s); - return COMPLETE; + return; } /* @@ -584,7 +588,7 @@ sea_scsi_cmd(struct scsi_xfer *xs) if ((flags & SCSI_POLL) == 0) { timeout_add_msec(&scb->xs->stimeout, xs->timeout); splx(s); - return SUCCESSFULLY_QUEUED; + return; } splx(s); @@ -597,7 +601,6 @@ sea_scsi_cmd(struct scsi_xfer *xs) if (sea_poll(sea, xs, 2000)) sea_timeout(scb); } - return COMPLETE; } /* diff --git a/sys/dev/isa/wds.c b/sys/dev/isa/wds.c index 07e67d7a5d3..1d2b0415909 100644 --- a/sys/dev/isa/wds.c +++ b/sys/dev/isa/wds.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wds.c,v 1.32 2010/01/10 00:10:23 krw Exp $ */ +/* $OpenBSD: wds.c,v 1.33 2010/03/23 01:57:20 krw Exp $ */ /* $NetBSD: wds.c,v 1.13 1996/11/03 16:20:31 mycroft Exp $ */ #undef WDSDIAG @@ -160,7 +160,7 @@ int wds_find(struct isa_attach_args *, struct wds_softc *); void wds_init(struct wds_softc *); void wds_inquire_setup_information(struct wds_softc *); void wdsminphys(struct buf *, struct scsi_link *); -int wds_scsi_cmd(struct scsi_xfer *); +void wds_scsi_cmd(struct scsi_xfer *); void wds_sense(struct wds_softc *, struct wds_scb *); int wds_poll(struct wds_softc *, struct scsi_xfer *, int); int wds_ipoll(struct wds_softc *, struct wds_scb *, int); @@ -1036,7 +1036,7 @@ wdsminphys(struct buf *bp, struct scsi_link *sl) /* * Send a SCSI command. */ -int +void wds_scsi_cmd(xs) struct scsi_xfer *xs; { @@ -1061,7 +1061,7 @@ wds_scsi_cmd(xs) s = splbio(); scsi_done(xs); splx(s); - return COMPLETE; + return; } flags = xs->flags; @@ -1072,7 +1072,11 @@ wds_scsi_cmd(xs) mflags = ISADMA_MAP_BOUNCE | ISADMA_MAP_WAITOK; #endif if ((scb = wds_get_scb(sc, flags, NEEDBUFFER(sc))) == NULL) { - return (NO_CCB); + xs->error = XS_NO_CCB; + s = splbio(); + scsi_done(xs); + splx(s); + return; } scb->xs = xs; scb->timeout = xs->timeout; @@ -1239,25 +1243,24 @@ wds_scsi_cmd(xs) wds_free_scb(sc, scb); scsi_done(xs); splx(s); - return COMPLETE; + return; } #endif splx(s); if ((flags & SCSI_POLL) == 0) - return SUCCESSFULLY_QUEUED; + return; if (wds_poll(sc, xs, scb->timeout)) { wds_timeout(scb); if (wds_poll(sc, xs, scb->timeout)) wds_timeout(scb); } - return COMPLETE; + return; bad: xs->error = XS_DRIVER_STUFFUP; wds_free_scb(sc, scb); - return COMPLETE; } /* diff --git a/sys/dev/pci/arc.c b/sys/dev/pci/arc.c index 39e38a68081..f94389ba6d5 100644 --- a/sys/dev/pci/arc.c +++ b/sys/dev/pci/arc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: arc.c,v 1.80 2010/01/09 23:15:06 krw Exp $ */ +/* $OpenBSD: arc.c,v 1.81 2010/03/23 01:57:20 krw Exp $ */ /* * Copyright (c) 2006 David Gwynne <dlg@openbsd.org> @@ -399,7 +399,7 @@ struct cfdriver arc_cd = { }; /* interface for scsi midlayer to talk to */ -int arc_scsi_cmd(struct scsi_xfer *); +void arc_scsi_cmd(struct scsi_xfer *); void arc_minphys(struct buf *, struct scsi_link *); struct scsi_adapter arc_switch = { @@ -709,7 +709,7 @@ arc_intr(void *arg) return (1); } -int +void arc_scsi_cmd(struct scsi_xfer *xs) { struct scsi_link *link = xs->sc_link; @@ -717,7 +717,6 @@ arc_scsi_cmd(struct scsi_xfer *xs) struct arc_ccb *ccb; struct arc_msg_scsicmd *cmd; u_int32_t reg; - int rv = SUCCESSFULLY_QUEUED; int s; if (xs->cmdlen > ARC_MSG_CDBLEN) { @@ -729,7 +728,7 @@ arc_scsi_cmd(struct scsi_xfer *xs) s = splbio(); scsi_done(xs); splx(s); - return (COMPLETE); + return; } s = splbio(); @@ -740,7 +739,7 @@ arc_scsi_cmd(struct scsi_xfer *xs) s = splbio(); scsi_done(xs); splx(s); - return (COMPLETE); + return; } ccb->ccb_xs = xs; @@ -751,7 +750,7 @@ arc_scsi_cmd(struct scsi_xfer *xs) arc_put_ccb(sc, ccb); scsi_done(xs); splx(s); - return (COMPLETE); + return; } cmd = &ccb->ccb_cmd->cmd; @@ -784,15 +783,12 @@ arc_scsi_cmd(struct scsi_xfer *xs) s = splbio(); arc_push(sc, reg); if (xs->flags & SCSI_POLL) { - rv = COMPLETE; if (arc_complete(sc, ccb, xs->timeout) != 0) { xs->error = XS_DRIVER_STUFFUP; scsi_done(xs); } } splx(s); - - return (rv); } int diff --git a/sys/dev/pci/ips.c b/sys/dev/pci/ips.c index d65b61cc079..58936bdca31 100644 --- a/sys/dev/pci/ips.c +++ b/sys/dev/pci/ips.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ips.c,v 1.94 2010/01/09 23:15:07 krw Exp $ */ +/* $OpenBSD: ips.c,v 1.95 2010/03/23 01:57:20 krw Exp $ */ /* * Copyright (c) 2006, 2007, 2009 Alexander Yurchenko <grange@openbsd.org> @@ -428,8 +428,8 @@ struct ips_softc { int ips_match(struct device *, void *, void *); void ips_attach(struct device *, struct device *, void *); -int ips_scsi_cmd(struct scsi_xfer *); -int ips_scsi_pt_cmd(struct scsi_xfer *); +void ips_scsi_cmd(struct scsi_xfer *); +void ips_scsi_pt_cmd(struct scsi_xfer *); int ips_scsi_ioctl(struct scsi_link *, u_long, caddr_t, int, struct proc *); @@ -446,7 +446,7 @@ void ips_sensors(void *); #endif int ips_load_xs(struct ips_softc *, struct ips_ccb *, struct scsi_xfer *); -int ips_start_xs(struct ips_softc *, struct ips_ccb *, struct scsi_xfer *); +void ips_start_xs(struct ips_softc *, struct ips_ccb *, struct scsi_xfer *); int ips_cmd(struct ips_softc *, struct ips_ccb *); int ips_poll(struct ips_softc *, struct ips_ccb *); @@ -845,7 +845,7 @@ fail1: bus_space_unmap(sc->sc_iot, sc->sc_ioh, iosize); } -int +void ips_scsi_cmd(struct scsi_xfer *xs) { struct scsi_link *link = xs->sc_link; @@ -875,7 +875,7 @@ ips_scsi_cmd(struct scsi_xfer *xs) s = splbio(); scsi_done(xs); splx(s); - return (COMPLETE); + return; } drive = &di->drive[target]; @@ -918,7 +918,11 @@ ips_scsi_cmd(struct scsi_xfer *xs) if (ccb == NULL) { DPRINTF(IPS_D_ERR, ("%s: ips_scsi_cmd: no ccb\n", sc->sc_dev.dv_xname)); - return (NO_CCB); + xs->error = XS_NO_CCB; + s = splbio(); + scsi_done(xs); + splx(s); + return; } cmd = ccb->c_cmdbva; @@ -942,7 +946,8 @@ ips_scsi_cmd(struct scsi_xfer *xs) cmd->code |= IPS_CMD_SG; ccb->c_done = ips_done_xs; - return (ips_start_xs(sc, ccb, xs)); + ips_start_xs(sc, ccb, xs); + return; case INQUIRY: bzero(&inq, sizeof(inq)); inq.device = T_DIRECT; @@ -974,14 +979,19 @@ ips_scsi_cmd(struct scsi_xfer *xs) if (ccb == NULL) { DPRINTF(IPS_D_ERR, ("%s: ips_scsi_cmd: no ccb\n", sc->sc_dev.dv_xname)); - return (NO_CCB); + xs->error = XS_NO_CCB; + s = splbio(); + scsi_done(xs); + splx(s); + return; } cmd = ccb->c_cmdbva; cmd->code = IPS_CMD_FLUSH; ccb->c_done = ips_done_xs; - return (ips_start_xs(sc, ccb, xs)); + ips_start_xs(sc, ccb, xs); + return; case PREVENT_ALLOW: case START_STOP: case TEST_UNIT_READY: @@ -995,11 +1005,9 @@ ips_scsi_cmd(struct scsi_xfer *xs) s = splbio(); scsi_done(xs); splx(s); - - return (COMPLETE); } -int +void ips_scsi_pt_cmd(struct scsi_xfer *xs) { struct scsi_link *link = xs->sc_link; @@ -1032,7 +1040,7 @@ ips_scsi_pt_cmd(struct scsi_xfer *xs) s = splbio(); scsi_done(xs); splx(s); - return (COMPLETE); + return; } xs->error = XS_NOERROR; @@ -1043,7 +1051,11 @@ ips_scsi_pt_cmd(struct scsi_xfer *xs) if (ccb == NULL) { DPRINTF(IPS_D_ERR, ("%s: ips_scsi_pt_cmd: no ccb\n", sc->sc_dev.dv_xname)); - return (NO_CCB); + xs->error = XS_NO_CCB; + s = splbio(); + scsi_done(xs); + splx(s); + return; } cmdb = ccb->c_cmdbva; @@ -1090,7 +1102,7 @@ ips_scsi_pt_cmd(struct scsi_xfer *xs) s = splbio(); scsi_done(xs); splx(s); - return (COMPLETE); + return; } if (cmd->sgcnt > 0) cmd->code |= IPS_CMD_SG; @@ -1100,7 +1112,7 @@ ips_scsi_pt_cmd(struct scsi_xfer *xs) cmd->sgcnt = 0; ccb->c_done = ips_done_pt; - return (ips_start_xs(sc, ccb, xs)); + ips_start_xs(sc, ccb, xs); } int @@ -1421,7 +1433,7 @@ ips_load_xs(struct ips_softc *sc, struct ips_ccb *ccb, struct scsi_xfer *xs) return (0); } -int +void ips_start_xs(struct ips_softc *sc, struct ips_ccb *ccb, struct scsi_xfer *xs) { ccb->c_flags = xs->flags; @@ -1438,12 +1450,7 @@ ips_start_xs(struct ips_softc *sc, struct ips_ccb *ccb, struct scsi_xfer *xs) * scsi_xfer on any failure and SCSI layer will handle possible * errors. */ - (void)ips_cmd(sc, ccb); - - if (ispoll) - return (COMPLETE); - else - return (SUCCESSFULLY_QUEUED); + ips_cmd(sc, ccb); } int diff --git a/sys/dev/pci/mpii.c b/sys/dev/pci/mpii.c index 5cb60c4316c..fa8f9822a5e 100644 --- a/sys/dev/pci/mpii.c +++ b/sys/dev/pci/mpii.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mpii.c,v 1.11 2010/03/09 19:29:14 marco Exp $ */ +/* $OpenBSD: mpii.c,v 1.12 2010/03/23 01:57:20 krw Exp $ */ /* * Copyright (c) 2010 Mike Belopuhov <mkb@crypt.org.ru> * Copyright (c) 2009 James Giannoules @@ -2023,7 +2023,7 @@ struct cfdriver mpii_cd = { DV_DULL }; -int mpii_scsi_cmd(struct scsi_xfer *); +void mpii_scsi_cmd(struct scsi_xfer *); void mpii_scsi_cmd_done(struct mpii_ccb *); void mpii_minphys(struct buf *bp, struct scsi_link *sl); int mpii_scsi_probe(struct scsi_link *); @@ -4437,7 +4437,7 @@ mpii_poll(struct mpii_softc *sc, struct mpii_ccb *ccb, int timeout) return (error); } -int +void mpii_scsi_cmd(struct scsi_xfer *xs) { struct scsi_link *link = xs->sc_link; @@ -4460,14 +4460,19 @@ mpii_scsi_cmd(struct scsi_xfer *xs) s = splbio(); scsi_done(xs); splx(s); - return (COMPLETE); + return; } s = splbio(); ccb = mpii_get_ccb(sc); splx(s); - if (ccb == NULL) - return (NO_CCB); + if (ccb == NULL) { + xs->error = XS_NO_CCB; + s = splbio(); + scsi_done(xs); + splx(s); + return; + } DNPRINTF(MPII_D_CMD, "%s: ccb_smid: %d xs->flags: 0x%x\n", DEVNAME(sc), ccb->ccb_smid, xs->flags); @@ -4513,7 +4518,7 @@ mpii_scsi_cmd(struct scsi_xfer *xs) mpii_put_ccb(sc, ccb); scsi_done(xs); splx(s); - return (COMPLETE); + return; } DNPRINTF(MPII_D_CMD, "%s: sizeof(mpii_msg_scsi_io): %d " @@ -4536,7 +4541,7 @@ mpii_scsi_cmd(struct scsi_xfer *xs) scsi_done(xs); splx(s); } - return (COMPLETE); + return; } timeout_set(&xs->stimeout, mpii_timeout_xs, ccb); @@ -4549,7 +4554,6 @@ mpii_scsi_cmd(struct scsi_xfer *xs) s = splbio(); mpii_start(sc, ccb); splx(s); - return (SUCCESSFULLY_QUEUED); } void diff --git a/sys/dev/pci/qli_pci.c b/sys/dev/pci/qli_pci.c index 1630fa9d0a0..8f2baf4de6c 100644 --- a/sys/dev/pci/qli_pci.c +++ b/sys/dev/pci/qli_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: qli_pci.c,v 1.15 2010/01/09 23:15:07 krw Exp $ */ +/* $OpenBSD: qli_pci.c,v 1.16 2010/03/23 01:57:20 krw Exp $ */ /* * Copyright (c) 2007 Marco Peereboom <marco@peereboom.us> * Copyright (c) 2007 David Collins <dave@davec.name> @@ -134,7 +134,7 @@ struct qli_mem { struct qli_mem *qli_allocmem(struct qli_softc *, size_t); void qli_freemem(struct qli_softc *, struct qli_mem *); -int qli_scsi_cmd(struct scsi_xfer *); +void qli_scsi_cmd(struct scsi_xfer *); int qli_scsi_ioctl(struct scsi_link *, u_long, caddr_t, int, struct proc *); void qliminphys(struct buf *bp, struct scsi_link *sl); @@ -997,7 +997,7 @@ nofwcb: return (rv); } -int +void qli_scsi_cmd(struct scsi_xfer *xs) { int s; @@ -1010,15 +1010,13 @@ qli_scsi_cmd(struct scsi_xfer *xs) #endif goto stuffup; - - return (SUCCESSFULLY_QUEUED); + return; stuffup: xs->error = XS_DRIVER_STUFFUP; s = splbio(); scsi_done(xs); splx(s); - return (COMPLETE); } int diff --git a/sys/dev/sdmmc/sdmmc_scsi.c b/sys/dev/sdmmc/sdmmc_scsi.c index 8b45414a754..58030b0138a 100644 --- a/sys/dev/sdmmc/sdmmc_scsi.c +++ b/sys/dev/sdmmc/sdmmc_scsi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sdmmc_scsi.c,v 1.20 2010/01/09 23:15:07 krw Exp $ */ +/* $OpenBSD: sdmmc_scsi.c,v 1.21 2010/03/23 01:57:20 krw Exp $ */ /* * Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org> @@ -78,8 +78,8 @@ void sdmmc_free_ccbs(struct sdmmc_scsi_softc *); struct sdmmc_ccb *sdmmc_get_ccb(struct sdmmc_scsi_softc *, int); void sdmmc_put_ccb(struct sdmmc_ccb *); -int sdmmc_scsi_cmd(struct scsi_xfer *); -int sdmmc_start_xs(struct sdmmc_softc *, struct sdmmc_ccb *); +void sdmmc_scsi_cmd(struct scsi_xfer *); +void sdmmc_start_xs(struct sdmmc_softc *, struct sdmmc_ccb *); void sdmmc_complete_xs(void *); void sdmmc_done_xs(struct sdmmc_ccb *); void sdmmc_stimeout(void *); @@ -286,7 +286,7 @@ sdmmc_scsi_decode_rw(struct scsi_xfer *xs, u_int32_t *blocknop, } } -int +void sdmmc_scsi_cmd(struct scsi_xfer *xs) { struct scsi_link *link = xs->sc_link; @@ -309,7 +309,7 @@ sdmmc_scsi_cmd(struct scsi_xfer *xs) s = splbio(); scsi_done(xs); splx(s); - return COMPLETE; + return; } DPRINTF(("%s: scsi cmd target=%d opcode=%#x proc=\"%s\" (poll=%#x)\n", @@ -340,7 +340,7 @@ sdmmc_scsi_cmd(struct scsi_xfer *xs) s = splbio(); scsi_done(xs); splx(s); - return COMPLETE; + return; case TEST_UNIT_READY: case START_STOP: @@ -348,7 +348,7 @@ sdmmc_scsi_cmd(struct scsi_xfer *xs) s = splbio(); scsi_done(xs); splx(s); - return COMPLETE; + return; case READ_CAPACITY: bzero(&rcd, sizeof rcd); @@ -358,7 +358,7 @@ sdmmc_scsi_cmd(struct scsi_xfer *xs) s = splbio(); scsi_done(xs); splx(s); - return COMPLETE; + return; default: DPRINTF(("%s: unsupported scsi command %#x\n", @@ -367,7 +367,7 @@ sdmmc_scsi_cmd(struct scsi_xfer *xs) s = splbio(); scsi_done(xs); splx(s); - return COMPLETE; + return; } /* A read or write operation. */ @@ -381,7 +381,7 @@ sdmmc_scsi_cmd(struct scsi_xfer *xs) s = splbio(); scsi_done(xs); splx(s); - return COMPLETE; + return; } ccb = sdmmc_get_ccb(sc->sc_scsibus, xs->flags); @@ -391,7 +391,7 @@ sdmmc_scsi_cmd(struct scsi_xfer *xs) s = splbio(); scsi_done(xs); splx(s); - return COMPLETE; + return; } ccb->ccb_xs = xs; @@ -400,10 +400,10 @@ sdmmc_scsi_cmd(struct scsi_xfer *xs) ccb->ccb_blockcnt = blockcnt; ccb->ccb_blockno = blockno; - return sdmmc_start_xs(sc, ccb); + sdmmc_start_xs(sc, ccb); } -int +void sdmmc_start_xs(struct sdmmc_softc *sc, struct sdmmc_ccb *ccb) { struct sdmmc_scsi_softc *scbus = sc->sc_scsibus; @@ -420,12 +420,11 @@ sdmmc_start_xs(struct sdmmc_softc *sc, struct sdmmc_ccb *ccb) if (ISSET(xs->flags, SCSI_POLL)) { sdmmc_complete_xs(ccb); - return COMPLETE; + return; } timeout_add_msec(&xs->stimeout, xs->timeout); sdmmc_add_task(sc, &ccb->ccb_task); - return SUCCESSFULLY_QUEUED; } void diff --git a/sys/dev/softraid.c b/sys/dev/softraid.c index 48504172bce..e0a57d5e918 100644 --- a/sys/dev/softraid.c +++ b/sys/dev/softraid.c @@ -1,4 +1,4 @@ -/* $OpenBSD: softraid.c,v 1.194 2010/02/13 22:10:01 jsing Exp $ */ +/* $OpenBSD: softraid.c,v 1.195 2010/03/23 01:57:19 krw Exp $ */ /* * Copyright (c) 2007, 2008, 2009 Marco Peereboom <marco@peereboom.us> * Copyright (c) 2008 Chris Kuethe <ckuethe@openbsd.org> @@ -87,7 +87,7 @@ struct cfdriver softraid_cd = { }; /* scsi & discipline */ -int sr_scsi_cmd(struct scsi_xfer *); +void sr_scsi_cmd(struct scsi_xfer *); void sr_minphys(struct buf *bp, struct scsi_link *sl); void sr_copy_internal_data(struct scsi_xfer *, void *, size_t); @@ -1829,7 +1829,7 @@ sr_scsi_done(struct sr_discipline *sd, struct scsi_xfer *xs) splx(s); } -int +void sr_scsi_cmd(struct scsi_xfer *xs) { int s; @@ -1868,7 +1868,10 @@ sr_scsi_cmd(struct scsi_xfer *xs) */ if ((wu = sr_wu_get(sd, 0)) == NULL) { DNPRINTF(SR_D_CMD, "%s: sr_scsi_cmd no wu\n", DEVNAME(sc)); - return (NO_CCB); + xs->error = XS_NO_CCB; + s = splbio(); + scsi_done(xs); + return; } xs->error = XS_NOERROR; @@ -1950,7 +1953,7 @@ sr_scsi_cmd(struct scsi_xfer *xs) goto stuffup; } - return (SUCCESSFULLY_QUEUED); + return; stuffup: if (sd && sd->sd_scsi_sense.error_code) { xs->error = XS_SENSE; @@ -1963,7 +1966,6 @@ complete: if (wu) sr_wu_put(wu); sr_scsi_done(sd, xs); - return (COMPLETE); } int sr_scsi_ioctl(struct scsi_link *link, u_long cmd, caddr_t addr, int flag, diff --git a/sys/dev/usb/umass_scsi.c b/sys/dev/usb/umass_scsi.c index 32e19d38629..65827a820fb 100644 --- a/sys/dev/usb/umass_scsi.c +++ b/sys/dev/usb/umass_scsi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: umass_scsi.c,v 1.27 2010/01/13 11:46:33 krw Exp $ */ +/* $OpenBSD: umass_scsi.c,v 1.28 2010/03/23 01:57:20 krw Exp $ */ /* $NetBSD: umass_scsipi.c,v 1.9 2003/02/16 23:14:08 augustss Exp $ */ /* * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -68,7 +68,7 @@ struct umass_scsi_softc { #define UMASS_ATAPI_DRIVE 0 -int umass_scsi_cmd(struct scsi_xfer *); +void umass_scsi_cmd(struct scsi_xfer *); void umass_scsi_minphys(struct buf *, struct scsi_link *); void umass_scsi_cb(struct umass_softc *sc, void *priv, int residue, @@ -166,7 +166,7 @@ umass_scsi_setup(struct umass_softc *sc) return (scbus); } -int +void umass_scsi_cmd(struct scsi_xfer *xs) { struct scsi_link *sc_link = xs->sc_link; @@ -234,7 +234,7 @@ umass_scsi_cmd(struct scsi_xfer *xs) sc->polled_xfer_status)); usbd_set_polling(sc->sc_udev, 0); /* scsi_done() has already been called. */ - return (COMPLETE); + return; } else { DPRINTF(UDMASS_SCSI, ("umass_scsi_cmd: async dir=%d, cmdlen=%d" @@ -244,7 +244,7 @@ umass_scsi_cmd(struct scsi_xfer *xs) xs->data, xs->datalen, dir, xs->timeout, umass_scsi_cb, xs); /* scsi_done() has already been called. */ - return (SUCCESSFULLY_QUEUED); + return; } /* Return if command finishes early. */ @@ -252,8 +252,6 @@ umass_scsi_cmd(struct scsi_xfer *xs) s = splbio(); scsi_done(xs); splx(s); - - return (COMPLETE); } void diff --git a/sys/dev/usb/usscanner.c b/sys/dev/usb/usscanner.c index 2e1b136ad72..5562951320c 100644 --- a/sys/dev/usb/usscanner.c +++ b/sys/dev/usb/usscanner.c @@ -1,4 +1,4 @@ -/* $OpenBSD: usscanner.c,v 1.30 2010/01/09 23:15:07 krw Exp $ */ +/* $OpenBSD: usscanner.c,v 1.31 2010/03/23 01:57:20 krw Exp $ */ /* $NetBSD: usscanner.c,v 1.6 2001/01/23 14:04:14 augustss Exp $ */ /* @@ -150,7 +150,7 @@ struct usscanner_softc { void usscanner_cleanup(struct usscanner_softc *sc); -int usscanner_scsipi_cmd(struct scsipi_xfer *xs); +void usscanner_scsipi_cmd(struct scsipi_xfer *xs); void usscanner_scsipi_minphys(struct buf *bp, struct scsi_link *sl); void usscanner_done(struct usscanner_softc *sc); void usscanner_sense(struct usscanner_softc *sc); @@ -702,7 +702,7 @@ usscanner_cmd_cb(usbd_xfer_handle xfer, usbd_private_handle priv, usscanner_done(sc); } -int +void usscanner_scsipi_cmd(struct scsipi_xfer *xs) { struct scsipi_link *sc_link = xs->sc_link; @@ -759,13 +759,11 @@ usscanner_scsipi_cmd(struct scsipi_xfer *xs) goto done; } - return (SUCCESSFULLY_QUEUED); + return; done: sc->sc_state = UAS_IDLE; s = splbio(); scsipi_done(xs); splx(s); - - return (COMPLETE); } diff --git a/sys/dev/vscsi.c b/sys/dev/vscsi.c index 9cb2216526e..739bfc61b1e 100644 --- a/sys/dev/vscsi.c +++ b/sys/dev/vscsi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vscsi.c,v 1.7 2010/03/21 07:02:02 dlg Exp $ */ +/* $OpenBSD: vscsi.c,v 1.8 2010/03/23 01:57:19 krw Exp $ */ /* * Copyright (c) 2008 David Gwynne <dlg@openbsd.org> @@ -36,6 +36,19 @@ #include <dev/vscsivar.h> +#ifdef VSCSI_DEBUG +#define VSCSI_D_INIT (1<<0) + +int vscsidebug = 0; + +#define DPRINTF(_m, _p...) do { \ + if (ISSET(vscsidebug, (_m))) \ + printf(p); \ + } while (0) +#else +#define DPRINTF(_m, _p...) /* _m, _p */ +#endif + int vscsi_match(struct device *, void *, void *); void vscsi_attach(struct device *, struct device *, void *); void vscsi_shutdown(void *); @@ -83,7 +96,7 @@ struct cfdriver vscsi_cd = { DV_DULL }; -int vscsi_cmd(struct scsi_xfer *); +void vscsi_cmd(struct scsi_xfer *); int vscsi_probe(struct scsi_link *); struct scsi_adapter vscsi_switch = { @@ -149,7 +162,7 @@ vscsi_attach(struct device *parent, struct device *self, void *aux) &saa, scsiprint); } -int +void vscsi_cmd(struct scsi_xfer *xs) { struct scsi_link *link = xs->sc_link; @@ -159,20 +172,20 @@ vscsi_cmd(struct scsi_xfer *xs) if (sc->sc_opened == 0) { vscsi_xs_stuffup(xs); - return (COMPLETE); + return; } if (ISSET(xs->flags, SCSI_POLL) && ISSET(xs->flags, SCSI_NOSLEEP)) { printf("%s: POLL && NOSLEEP for 0x%02x\n", DEVNAME(sc), xs->cmd->opcode); vscsi_xs_stuffup(xs); - return (COMPLETE); + return; } ccb = vscsi_ccb_get(sc, ISSET(xs->flags, SCSI_NOSLEEP) ? 0 : 1); if (ccb == NULL) { vscsi_xs_stuffup(xs); - return (COMPLETE); + return; } ccb->ccb_xs = xs; @@ -188,10 +201,7 @@ vscsi_cmd(struct scsi_xfer *xs) tsleep(ccb, PRIBIO, "vscsipoll", 0); vscsi_ccb_put(sc, ccb); rw_exit_read(&sc->sc_ccb_polling); - return (COMPLETE); } - - return (SUCCESSFULLY_QUEUED); } void diff --git a/sys/scsi/mpath.c b/sys/scsi/mpath.c index 25b796760dd..98c058cbf8b 100644 --- a/sys/scsi/mpath.c +++ b/sys/scsi/mpath.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mpath.c,v 1.12 2010/01/03 01:36:40 dlg Exp $ */ +/* $OpenBSD: mpath.c,v 1.13 2010/03/23 01:57:20 krw Exp $ */ /* * Copyright (c) 2009 David Gwynne <dlg@openbsd.org> @@ -74,7 +74,7 @@ struct cfdriver mpath_cd = { DV_DULL }; -int mpath_cmd(struct scsi_xfer *); +void mpath_cmd(struct scsi_xfer *); void mpath_minphys(struct buf *, struct scsi_link *); int mpath_probe(struct scsi_link *); @@ -147,7 +147,7 @@ mpath_probe(struct scsi_link *link) return (0); } -int +void mpath_cmd(struct scsi_xfer *xs) { struct scsi_link *link = xs->sc_link; @@ -157,13 +157,13 @@ mpath_cmd(struct scsi_xfer *xs) if (n == NULL || p == NULL) { mpath_xs_stuffup(xs); - return (COMPLETE); + return; } mxs = scsi_xs_get(p->path_link, xs->flags); if (mxs == NULL) { mpath_xs_stuffup(xs); - return (COMPLETE); + return; } memcpy(mxs->cmd, xs->cmd, xs->cmdlen); @@ -178,8 +178,6 @@ mpath_cmd(struct scsi_xfer *xs) mxs->done = mpath_done; scsi_xs_exec(mxs); - - return (COMPLETE); /* doesnt matter anymore */ } void diff --git a/sys/scsi/scsi_base.c b/sys/scsi/scsi_base.c index 75a9a07ce00..b42febf6b21 100644 --- a/sys/scsi/scsi_base.c +++ b/sys/scsi/scsi_base.c @@ -1,4 +1,4 @@ -/* $OpenBSD: scsi_base.c,v 1.166 2010/01/15 06:27:12 krw Exp $ */ +/* $OpenBSD: scsi_base.c,v 1.167 2010/03/23 01:57:20 krw Exp $ */ /* $NetBSD: scsi_base.c,v 1.43 1997/04/02 02:29:36 mycroft Exp $ */ /* @@ -718,8 +718,6 @@ scsi_report_luns(struct scsi_link *sc_link, int selectreport, void scsi_xs_exec(struct scsi_xfer *xs) { - int s; - xs->error = XS_NOERROR; xs->resid = xs->datalen; xs->status = 0; @@ -730,25 +728,10 @@ scsi_xs_exec(struct scsi_xfer *xs) if (xs->datalen && (xs->flags & SCSI_DATA_OUT)) scsi_show_mem(xs->data, min(64, xs->datalen)); } -#endif /* SCSIDEBUG */ - - /* - * scsi_xs_exec() guarantees that scsi_done() will be called on the xs - * it was given. The adapter is responsible for calling scsi_done() - * except if its scsi_cmd() routine returns NO_CCB. - * In those cases we must call scsi_done() for it. - */ - - if (xs->sc_link->adapter->scsi_cmd(xs) == NO_CCB) { - /* - * Give the xs back to the device driver to retry on its own. - */ +#endif - xs->error = XS_NO_CCB; - s = splbio(); - scsi_done(xs); - splx(s); - } + /* The adapter's scsi_cmd() is responsible for callng scsi_done(). */ + xs->sc_link->adapter->scsi_cmd(xs); } /* diff --git a/sys/scsi/scsiconf.h b/sys/scsi/scsiconf.h index c53467c9818..7a9a9b05f1d 100644 --- a/sys/scsi/scsiconf.h +++ b/sys/scsi/scsiconf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: scsiconf.h,v 1.119 2010/01/15 05:50:31 krw Exp $ */ +/* $OpenBSD: scsiconf.h,v 1.120 2010/03/23 01:57:20 krw Exp $ */ /* $NetBSD: scsiconf.h,v 1.35 1997/04/02 02:29:38 mycroft Exp $ */ /* @@ -304,7 +304,7 @@ extern int scsi_autoconf; * of these statically allocated. */ struct scsi_adapter { - int (*scsi_cmd)(struct scsi_xfer *); + void (*scsi_cmd)(struct scsi_xfer *); void (*scsi_minphys)(struct buf *, struct scsi_link *); int (*dev_probe)(struct scsi_link *); void (*dev_free)(struct scsi_link *); @@ -313,13 +313,6 @@ struct scsi_adapter { }; /* - * return values for scsi_cmd() - */ -#define SUCCESSFULLY_QUEUED 0 -#define COMPLETE 2 -#define NO_CCB 4 - -/* * These entry points are called by the low-end drivers to get services from * whatever high-end drivers they are attached to. Each device type has one * of these statically allocated. |