summaryrefslogtreecommitdiff
path: root/sys/dev/ic/isp_openbsd.c
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2010-03-23 01:57:21 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2010-03-23 01:57:21 +0000
commitcd948c1fd3a45bb8ee18483b4f8df6ce849f8140 (patch)
tree2748525ad92550d0ad2b46b5619c24e5bcda0e13 /sys/dev/ic/isp_openbsd.c
parente88d321d148e115dbbf6fea61f7c0dcb67021421 (diff)
Change the scsi_cmd function member of scsi_adapter from int to
void. Use XS_NO_CCB error in the scsi command (xs) to report the NO_CCB condition. Eliminates all SUCCESSFULLY_QUEUED and COMPLETE confusion and untangles the midlayer from the adapter a bit more. Eyes and some fixes by miod@ There may be some compile issues on little used (i.e. I don't have any) drivers but the change is mechanical and thus easy to remedy. ok dlg@
Diffstat (limited to 'sys/dev/ic/isp_openbsd.c')
-rw-r--r--sys/dev/ic/isp_openbsd.c48
1 files changed, 18 insertions, 30 deletions
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