summaryrefslogtreecommitdiff
path: root/sys/dev/ic/mfi.c
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2010-08-29 23:23:32 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2010-08-29 23:23:32 +0000
commit7bd58c7ee459ff6b01ed470686719e663b2e0a74 (patch)
treeebb3c25a2f1690a9f92dd2d0547156a7c1c4ff8c /sys/dev/ic/mfi.c
parentfe84cb6ad1b95f644e6340678132c597a27bbf22 (diff)
the scsi completion code thinks that if you dont get MFI_STAT_OK
back from the chip on a command then the command completely failed. MFI_STAT_SCSI_DONE_WITH_ERROR really means the command completed fine, but there's some sense data too. this tweaks the handling to be more appropriate, as per the linux and solaris drivers. timed out waiting for beck@ putting this in cos its obviously more correct than the current code.
Diffstat (limited to 'sys/dev/ic/mfi.c')
-rw-r--r--sys/dev/ic/mfi.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/sys/dev/ic/mfi.c b/sys/dev/ic/mfi.c
index 1235d9fe338..972d03c21cd 100644
--- a/sys/dev/ic/mfi.c
+++ b/sys/dev/ic/mfi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mfi.c,v 1.110 2010/07/22 04:40:41 matthew Exp $ */
+/* $OpenBSD: mfi.c,v 1.111 2010/08/29 23:23:31 dlg Exp $ */
/*
* Copyright (c) 2006 Marco Peereboom <marco@peereboom.us>
*
@@ -901,9 +901,21 @@ mfi_scsi_xs_done(struct mfi_ccb *ccb)
bus_dmamap_unload(sc->sc_dmat, ccb->ccb_dmamap);
}
- if (hdr->mfh_cmd_status != MFI_STAT_OK) {
+ switch (hdr->mfh_cmd_status) {
+ case MFI_STAT_OK:
+ xs->resid = 0;
+ break;
+
+ case MFI_STAT_SCSI_DONE_WITH_ERROR:
+ xs->error = XS_SENSE;
+ xs->resid = 0;
+ memset(&xs->sense, 0, sizeof(xs->sense));
+ memcpy(&xs->sense, ccb->ccb_sense, sizeof(xs->sense));
+ break;
+
+ default:
xs->error = XS_DRIVER_STUFFUP;
- DNPRINTF(MFI_D_INTR, "%s: mfi_scsi_xs_done stuffup %#x\n",
+ printf("%s: mfi_scsi_xs_done stuffup %#x\n",
DEVNAME(sc), hdr->mfh_cmd_status);
if (hdr->mfh_scsi_status != 0) {
@@ -916,10 +928,9 @@ mfi_scsi_xs_done(struct mfi_ccb *ccb)
sizeof(struct scsi_sense_data));
xs->error = XS_SENSE;
}
+ break;
}
- xs->resid = 0;
-
mfi_put_ccb(ccb);
scsi_done(xs);
}