Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-8]: src/sys/dev/pci Pull up following revision(s) (requested by k...
details: https://anonhg.NetBSD.org/src/rev/b64deaa18c10
branches: netbsd-8
changeset: 449665:b64deaa18c10
user: martin <martin%NetBSD.org@localhost>
date: Fri Mar 15 14:50:36 2019 +0000
description:
Pull up following revision(s) (requested by kardel in ticket #1217):
sys/dev/pci/mpii.c: revision 1.22
PR/54045
fix mpii to adhere to physio diagnostic invariant that
fully processed data must not post an error:
1) verify expected scspi state via KASSERT() instead of just
setting the variables.
2) set xs->resid only in known good conditions
3) insure setting errors in all error paths and refrain
from clearing xs->resid in error paths.
While there do some cosmectic clean up:
1) extend and relocate some debug output
2) mpii HBAs can also manage non-disk devices like tapes etc,
so log that physical "devices" instead of physical "disks" are
attached or detached.
Tested with NEOSeries FlexStor II and luckily a broken tape drive 8-(
mpii0 at pci1 dev 0 function 0: vendor 1000 product 00ab (rev. 0x01)
mpii0: interrupting at irq 11
mpii0: HBA 9400-8i8e, firmware 3.0.4.0, MPI 2.6
mpii0: physical device inserted in slot 9
mpii0: physical device inserted in slot 13
mpii0: physical device inserted in slot 16
st0 at scsibus0 target 9 lun 0: <IBM, ULTRIUM-HH7, J4D1> tape removable
st0: density code 92, variable blocks, write-enabled
ch0 at scsibus0 target 9 lun 1: <BDT, FlexStor II, 5.50> changer removable
ch0: 23 slots, 2 drives, 1 picker, 1 portal
st0: tagged queueing
ch0: tagged queueing
st1 at scsibus0 target 13 lun 0: <IBM, ULTRIUM-HH7, J4D1> tape removable
st1: density code 92, variable blocks, write-enabled
st1: tagged queueing
ses0 at scsibus0 target 16 lun 0: <LSI, VirtualSES, 01> enclosure
services fixed
Note: pullup-8
diffstat:
sys/dev/pci/mpii.c | 35 ++++++++++++++++++++---------------
1 files changed, 20 insertions(+), 15 deletions(-)
diffs (98 lines):
diff -r c6ec8b5706cf -r b64deaa18c10 sys/dev/pci/mpii.c
--- a/sys/dev/pci/mpii.c Fri Mar 15 14:47:22 2019 +0000
+++ b/sys/dev/pci/mpii.c Fri Mar 15 14:50:36 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mpii.c,v 1.8.10.4 2019/01/07 13:49:39 martin Exp $ */
+/* $NetBSD: mpii.c,v 1.8.10.5 2019/03/15 14:50:36 martin Exp $ */
/* OpenBSD: mpii.c,v 1.115 2012/04/11 13:29:14 naddy Exp */
/*
* Copyright (c) 2010 Mike Belopuhov <mkb%crypt.org.ru@localhost>
@@ -20,7 +20,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mpii.c,v 1.8.10.4 2019/01/07 13:49:39 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mpii.c,v 1.8.10.5 2019/03/15 14:50:36 martin Exp $");
#include "bio.h"
@@ -1920,7 +1920,7 @@
free(dev, M_DEVBUF);
break;
}
- printf("%s: physical disk inserted in slot %d\n",
+ printf("%s: physical device inserted in slot %d\n",
DEVNAME(sc), dev->slot);
mutex_exit(&sc->sc_devs_mtx);
break;
@@ -1994,7 +1994,7 @@
}
printf(
- "%s: physical disk removed from slot %d\n",
+ "%s: physical device removed from slot %d\n",
DEVNAME(sc), dev->slot);
mpii_remove_dev(sc, dev);
mutex_exit(&sc->sc_devs_mtx);
@@ -3021,8 +3021,8 @@
scsipi_done(xs);
return;
}
- DNPRINTF(MPII_D_CMD, "%s: ccb_smid: %d xs->xs_control: 0x%x\n",
- DEVNAME(sc), ccb->ccb_smid, xs->xs_control);
+ DNPRINTF(MPII_D_CMD, "%s: ccb_smid: %d xs->cmd->opcode: 0x%02x xs->xs_control: 0x%x\n",
+ DEVNAME(sc), ccb->ccb_smid, xs->cmd->opcode, xs->xs_control);
ccb->ccb_cookie = xs;
ccb->ccb_done = mpii_scsi_cmd_done;
@@ -3220,13 +3220,14 @@
bus_dmamap_unload(sc->sc_dmat, dmap);
}
-
- xs->error = XS_NOERROR;
- xs->resid = 0;
-
+
+ KASSERT(xs->error == XS_NOERROR);
+ KASSERT(xs->resid == xs->datalen);
+ KASSERT(xs->status == SCSI_OK);
+
if (ccb->ccb_rcb == NULL) {
/* no scsi error, we're ok so drop out early */
- xs->status = SCSI_OK;
+ xs->resid = 0;
goto done;
}
@@ -3276,9 +3277,11 @@
case MPII_IOCSTATUS_SCSI_RECOVERED_ERROR:
switch (sie->scsi_status) {
case MPII_SCSIIO_STATUS_GOOD:
+ xs->resid = 0;
break;
case MPII_SCSIIO_STATUS_CHECK_COND:
+ xs->resid = 0;
xs->error = XS_SENSE;
break;
@@ -3317,12 +3320,14 @@
if (sie->scsi_state & MPII_SCSIIO_STATE_AUTOSENSE_VALID)
memcpy(&xs->sense, sense, sizeof(xs->sense));
- DNPRINTF(MPII_D_CMD, "%s: xs err: %d status: %#x\n", DEVNAME(sc),
- xs->error, xs->status);
-
mpii_push_reply(sc, ccb->ccb_rcb);
-done:
+
+ done:
mpii_put_ccb(sc, ccb);
+
+ DNPRINTF(MPII_D_CMD, "%s: xs err: %d status: %#x len: %d resid: %d\n",
+ DEVNAME(sc), xs->error, xs->status, xs->datalen, xs->resid);
+
scsipi_done(xs);
}
Home |
Main Index |
Thread Index |
Old Index