tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: SCSI sense
On Fri, Dec 27, 2013 at 04:34:48PM +0100, Edgar Fuß wrote:
> If you did fill in scsireq.sense and .senselen, the SCIOCCOMMAND ioctl should
> already have done that for you when the target returns CHECK CONDITION.
> I guess you need to inspect the driver code under which conditions it sets
> retsts to SCCMD_UNKNOWN. For instance, I don't know what it does when the
> target returns CHECK CONDITION on the original request and the REQUEST SENSE
> command fails.
After reading the Linux driver, I came to the attached change to retreive
sense data, and I get it.
The patch also change the dmamap size so that 512k I/O is possible
(requires tls_maxphys for now)
--
Emmanuel Dreyfus
manu%netbsd.org@localhost
Index: sys/dev/pci/mpii.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/mpii.c,v
retrieving revision 1.1
diff -U4 -r1.1 mpii.c
--- sys/dev/pci/mpii.c 19 Apr 2012 17:50:51 -0000 1.1
+++ sys/dev/pci/mpii.c 27 Dec 2013 15:46:16 -0000
@@ -1754,8 +1754,15 @@
* sizeof(scsi_io) + sizeof(sense) + sizeof(sge) * 32 = MPII_REQUEST_SIZE
*/
#define MPII_MAX_SGL (32)
+/*
+ * MPII_MAX_SGL was supposed to be used to compute size for
+ * bus_dmamap_create, but the value is too short for big I/O.
+ * Use "big enough" value instead.
+ */
+#define MPII_MAX_DMASGL (256)
+
#define MPII_MAX_REQUEST_CREDIT (128)
#define MPII_MAXFER MAXPHYS /* XXX bogus */
@@ -4172,9 +4179,9 @@
for (i = 1; i < sc->sc_request_depth; i++) {
ccb = &sc->sc_ccbs[i - 1];
if (bus_dmamap_create(sc->sc_dmat, MAXPHYS,
- sc->sc_max_sgl_len, MAXPHYS, 0,
+ MPII_MAX_DMASGL, MAXPHYS, 0,
BUS_DMA_NOWAIT | BUS_DMA_ALLOCNOW,
&ccb->ccb_dmamap) != 0) {
printf("%s: unable to create dma map\n", DEVNAME(sc));
goto free_maps;
@@ -4751,8 +4758,22 @@
switch (xs->status) {
case SCSI_OK:
xs->resid = xs->datalen - le32toh(sie->transfer_count);
break;
+
+ case SCSI_CHECK:
+ if (sie->scsi_state &
+ MPII_SCSIIO_ERR_STATE_AUTOSENSE_VALID)
+ xs->error = XS_SENSE;
+ else
+ xs->error = XS_DRIVER_STUFFUP;
+ break;
+
+ case SCSI_BUSY:
+ case SCSI_QUEUE_FULL:
+ xs->error = XS_BUSY;
+ break;
+
default:
xs->error = XS_DRIVER_STUFFUP;
break;
}
Home |
Main Index |
Thread Index |
Old Index