Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/thorpej_scsipi]: src/sys/dev/ic Pass CHECK CONDITION status and reset ev...



details:   https://anonhg.NetBSD.org/src/rev/86e51e4b2ea2
branches:  thorpej_scsipi
changeset: 477363:86e51e4b2ea2
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Mon Jan 15 09:26:26 2001 +0000

description:
Pass CHECK CONDITION status and reset events to the mid-layer.

diffstat:

 sys/dev/ic/siop.c           |  82 +++++---------------------------------------
 sys/dev/ic/siop_common.c    |  10 ++---
 sys/dev/ic/siopvar_common.h |   8 +---
 3 files changed, 16 insertions(+), 84 deletions(-)

diffs (228 lines):

diff -r 4a95890853bf -r 86e51e4b2ea2 sys/dev/ic/siop.c
--- a/sys/dev/ic/siop.c Mon Jan 15 09:25:36 2001 +0000
+++ b/sys/dev/ic/siop.c Mon Jan 15 09:26:26 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: siop.c,v 1.37.2.5 2000/12/15 07:48:32 bouyer Exp $     */
+/*     $NetBSD: siop.c,v 1.37.2.6 2001/01/15 09:26:26 bouyer Exp $     */
 
 /*
  * Copyright (c) 2000 Manuel Bouyer.
@@ -382,8 +382,7 @@
                tag = siop_cmd->tag;
                siop_lun = siop_target->siop_lun[lun];
 #ifdef DIAGNOSTIC
-               if (siop_cmd->status != CMDST_ACTIVE &&
-                   siop_cmd->status != CMDST_SENSE_ACTIVE) {
+               if (siop_cmd->status != CMDST_ACTIVE) {
                        printf("siop_cmd (lun %d) not active (%d)\n",
                                lun, siop_cmd->status);
                        xs = NULL;
@@ -630,8 +629,7 @@
                                    irqcode);
                                goto reset;
                        }
-                       if (siop_cmd->status != CMDST_ACTIVE &&
-                           siop_cmd->status != CMDST_SENSE_ACTIVE) {
+                       if (siop_cmd->status != CMDST_ACTIVE) {
                                printf("%s: command with invalid status "
                                    "(IRQ code 0x%x current status %d) !\n",
                                    sc->sc_dev.dv_xname,
@@ -915,10 +913,7 @@
                            le32toh(siop_cmd->siop_tables.status));
 #endif
                        INCSTAT(siop_stat_intr_done);
-                       if (siop_cmd->status == CMDST_SENSE_ACTIVE)
-                               siop_cmd->status = CMDST_SENSE_DONE;
-                       else
-                               siop_cmd->status = CMDST_DONE;
+                       siop_cmd->status = CMDST_DONE;
                        goto end;
                default:
                        printf("unknown irqcode %x\n", irqcode);
@@ -956,20 +951,13 @@
        xs->status = le32toh(siop_cmd->siop_tables.status);
        switch(xs->status) {
        case SCSI_OK:
-               xs->error = (siop_cmd->status == CMDST_DONE) ?
-                   XS_NOERROR : XS_SENSE;
+               xs->error = XS_NOERROR;
                break;
        case SCSI_BUSY:
                xs->error = XS_BUSY;
                break;
        case SCSI_CHECK:
-               if (siop_cmd->status == CMDST_SENSE_DONE) {
-                       /* request sense on a request sense ? */
-                       printf("request sense failed\n");
-                       xs->error = XS_DRIVER_STUFFUP;
-               } else {
-                       siop_cmd->status = CMDST_SENSE;
-               }
+               xs->error = XS_BUSY;
                break;
        case SCSI_QUEUE_FULL:
                INCSTAT(siop_stat_intr_qfull);
@@ -995,8 +983,7 @@
        default:
                xs->error = XS_DRIVER_STUFFUP;
        }
-       if (siop_cmd->status != CMDST_SENSE_DONE &&
-           xs->xs_control & (XS_CTL_DATA_IN | XS_CTL_DATA_OUT)) {
+       if (xs->xs_control & (XS_CTL_DATA_IN | XS_CTL_DATA_OUT)) {
                bus_dmamap_sync(sc->sc_dmat, siop_cmd->dmamap_data, 0,
                    siop_cmd->dmamap_data->dm_mapsize,
                    (xs->xs_control & XS_CTL_DATA_IN) ?
@@ -1004,49 +991,6 @@
                bus_dmamap_unload(sc->sc_dmat, siop_cmd->dmamap_data);
        }
        bus_dmamap_unload(sc->sc_dmat, siop_cmd->dmamap_cmd);
-       if (siop_cmd->status == CMDST_SENSE) {
-               /* issue a request sense for this target */
-               int error;
-               siop_cmd->rs_cmd.opcode = REQUEST_SENSE;
-               siop_cmd->rs_cmd.byte2 = xs->xs_periph->periph_lun << 5;
-               siop_cmd->rs_cmd.unused[0] = siop_cmd->rs_cmd.unused[1] = 0;
-               siop_cmd->rs_cmd.length = sizeof(struct scsipi_sense_data);
-               siop_cmd->rs_cmd.control = 0;
-               siop_cmd->flags &= ~CMDFL_TAG;
-               error = bus_dmamap_load(sc->sc_dmat, siop_cmd->dmamap_cmd,
-                   &siop_cmd->rs_cmd, sizeof(struct scsipi_sense),
-                   NULL, BUS_DMA_NOWAIT);
-               if (error) {
-                       printf("%s: unable to load cmd DMA map: %d",
-                           sc->sc_dev.dv_xname, error);
-                       xs->error = XS_DRIVER_STUFFUP;
-                       goto out;
-               }
-               error = bus_dmamap_load(sc->sc_dmat, siop_cmd->dmamap_data,
-                   &xs->sense.scsi_sense, sizeof(struct  scsipi_sense_data),
-                   NULL, BUS_DMA_NOWAIT);
-               if (error) {
-                       printf("%s: unable to load sense DMA map: %d",
-                           sc->sc_dev.dv_xname, error);
-                       xs->error = XS_DRIVER_STUFFUP;
-                       bus_dmamap_unload(sc->sc_dmat, siop_cmd->dmamap_cmd);
-                       goto out;
-               }
-               bus_dmamap_sync(sc->sc_dmat, siop_cmd->dmamap_data, 0,
-                   siop_cmd->dmamap_data->dm_mapsize, BUS_DMASYNC_PREREAD);
-               bus_dmamap_sync(sc->sc_dmat, siop_cmd->dmamap_cmd, 0,
-                   siop_cmd->dmamap_cmd->dm_mapsize, BUS_DMASYNC_PREWRITE);
-
-               siop_setuptables(siop_cmd);
-               /* arrange for the cmd to be handled now */
-               TAILQ_INSERT_HEAD(&sc->urgent_list, siop_cmd, next);
-               return;
-       } else if (siop_cmd->status == CMDST_SENSE_DONE) {
-               bus_dmamap_sync(sc->sc_dmat, siop_cmd->dmamap_data, 0,
-                   siop_cmd->dmamap_data->dm_mapsize, BUS_DMASYNC_POSTREAD);
-               bus_dmamap_unload(sc->sc_dmat, siop_cmd->dmamap_data);
-       }
-out:
        callout_stop(&siop_cmd->xs->xs_callout);
        siop_cmd->status = CMDST_FREE;
        xs->resid = 0;
@@ -1176,15 +1120,12 @@
                siop_cmd->siop_tables.status = htole32(SCSI_SIOP_NOCHECK);
                printf("cmd %p (status %d) about to be processed\n", siop_cmd,
                    siop_cmd->status);
-               if (siop_cmd->status == CMDST_SENSE ||
-                   siop_cmd->status == CMDST_SENSE_ACTIVE) 
-                       siop_cmd->status = CMDST_SENSE_DONE;
-               else
-                       siop_cmd->status = CMDST_DONE;
+               siop_cmd->status = CMDST_DONE;
                TAILQ_REMOVE(&reset_list, siop_cmd, next);
                siop_scsicmd_end(siop_cmd);
                TAILQ_INSERT_TAIL(&sc->free_list, siop_cmd, next);
        }
+       scsipi_async_event(&sc->sc_chan, ASYNC_EVENT_RESET, NULL);
 }
 
 void
@@ -1411,8 +1352,7 @@
        for (; siop_cmd != NULL; siop_cmd = next_siop_cmd) {
                next_siop_cmd = TAILQ_NEXT(siop_cmd, next);
 #ifdef DIAGNOSTIC
-               if (siop_cmd->status != CMDST_READY &&
-                   siop_cmd->status != CMDST_SENSE)
+               if (siop_cmd->status != CMDST_READY)
                        panic("siop: non-ready cmd in ready list");
 #endif 
                target = siop_cmd->xs->xs_periph->periph_target;
@@ -1475,8 +1415,6 @@
                /* mark command as active */
                if (siop_cmd->status == CMDST_READY) {
                        siop_cmd->status = CMDST_ACTIVE;
-               } else if (siop_cmd->status == CMDST_SENSE) {
-                       siop_cmd->status = CMDST_SENSE_ACTIVE;
                } else
                        panic("siop_start: bad status");
                if (doingready)
diff -r 4a95890853bf -r 86e51e4b2ea2 sys/dev/ic/siop_common.c
--- a/sys/dev/ic/siop_common.c  Mon Jan 15 09:25:36 2001 +0000
+++ b/sys/dev/ic/siop_common.c  Mon Jan 15 09:26:26 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: siop_common.c,v 1.11.2.4 2000/12/15 07:48:33 bouyer Exp $      */
+/*     $NetBSD: siop_common.c,v 1.11.2.5 2001/01/15 09:26:26 bouyer Exp $      */
 
 /*
  * Copyright (c) 2000 Manuel Bouyer.
@@ -147,8 +147,7 @@
                        siop_update_xfer_mode(sc, target);
                }
        } else if (sc->targets[target]->status == TARST_OK &&
-           (sc->targets[target]->flags & TARF_TAG) &&
-           siop_cmd->status != CMDST_SENSE && xs->xs_tag_type != 0) {
+           (sc->targets[target]->flags & TARF_TAG) && xs->xs_tag_type != 0) {
                siop_cmd->flags |= CMDFL_TAG;
        }
        siop_cmd->siop_tables.status =
@@ -158,8 +157,7 @@
            htole32(siop_cmd->dmamap_cmd->dm_segs[0].ds_len);
        siop_cmd->siop_tables.cmd.addr =
            htole32(siop_cmd->dmamap_cmd->dm_segs[0].ds_addr);
-       if ((xs->xs_control & (XS_CTL_DATA_IN | XS_CTL_DATA_OUT)) ||
-           siop_cmd->status == CMDST_SENSE) {
+       if (xs->xs_control & (XS_CTL_DATA_IN | XS_CTL_DATA_OUT)) {
                for (i = 0; i < siop_cmd->dmamap_data->dm_nsegs; i++) {
                        siop_cmd->siop_tables.data[i].count =
                            htole32(siop_cmd->dmamap_data->dm_segs[i].ds_len);
@@ -531,7 +529,7 @@
        for (retry = 0; retry < 5; retry++) {
                /*
                 * datasheet says to wait 100ms and re-read SIST1,
-                * to check that DIFFSENSE is srable.
+                * to check that DIFFSENSE is stable.
                 * We may delay() 5 times for  100ms at interrupt time;
                 * hopefully this will not happen often.
                 */
diff -r 4a95890853bf -r 86e51e4b2ea2 sys/dev/ic/siopvar_common.h
--- a/sys/dev/ic/siopvar_common.h       Mon Jan 15 09:25:36 2001 +0000
+++ b/sys/dev/ic/siopvar_common.h       Mon Jan 15 09:26:26 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: siopvar_common.h,v 1.9.2.5 2000/12/15 07:48:33 bouyer Exp $    */
+/*     $NetBSD: siopvar_common.h,v 1.9.2.6 2001/01/15 09:26:26 bouyer Exp $    */
 
 /*
  * Copyright (c) 2000 Manuel Bouyer.
@@ -95,7 +95,6 @@
        bus_addr_t      dsa; /* DSA value to load */
        bus_dmamap_t    dmamap_cmd;
        bus_dmamap_t    dmamap_data;
-       struct scsipi_sense rs_cmd; /* request sense command buffer */
        int status;
        int flags;
        int reselslot; /* the reselect slot used */
@@ -115,10 +114,7 @@
 #define CMDST_FREE             0 /* cmd slot is free */
 #define CMDST_READY            1 /* cmd slot is waiting for processing */
 #define CMDST_ACTIVE           2 /* cmd slot is being processed */
-#define CMDST_SENSE            3 /* cmd slot is being requesting sense */
-#define CMDST_SENSE_ACTIVE     4 /* request sense active */
-#define CMDST_SENSE_DONE       5 /* request sense done */
-#define CMDST_DONE             6 /* cmd slot has been processed */
+#define CMDST_DONE             3 /* cmd slot has been processed */
 /* flags defs */
 #define CMDFL_TIMEOUT  0x0001 /* cmd timed out */
 #define CMDFL_TAG      0x0002 /* tagged cmd */



Home | Main Index | Thread Index | Old Index