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 Revert back to starting sync/wide negoti...



details:   https://anonhg.NetBSD.org/src/rev/97abb81b7b69
branches:  thorpej_scsipi
changeset: 477497:97abb81b7b69
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Wed Apr 25 11:49:47 2001 +0000

description:
Revert back to starting sync/wide negotiation at the first command,
instead of waiting for ADAPTER_REQ_XFER_MODE: as the BIOS may have
negotiated sync/wide, and we don't reset the channel, all async/narrow
xfers would fail until the channel is reset.

diffstat:

 sys/dev/ic/aic7xxx.c    |  98 ++++++++++++++++++++++--------------------------
 sys/dev/ic/aic7xxxvar.h |   3 +-
 2 files changed, 47 insertions(+), 54 deletions(-)

diffs (236 lines):

diff -r 61947d125778 -r 97abb81b7b69 sys/dev/ic/aic7xxx.c
--- a/sys/dev/ic/aic7xxx.c      Wed Apr 25 08:49:06 2001 +0000
+++ b/sys/dev/ic/aic7xxx.c      Wed Apr 25 11:49:47 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: aic7xxx.c,v 1.37.2.16 2001/04/21 17:48:23 bouyer Exp $ */
+/*     $NetBSD: aic7xxx.c,v 1.37.2.17 2001/04/25 11:49:47 bouyer Exp $ */
 
 /*
  * Generic driver for the aic7xxx based adaptec SCSI controllers
@@ -284,7 +284,6 @@
 static void    ahc_set_width(struct ahc_softc *, struct ahc_devinfo *,
                              u_int, u_int, int, int);
 static void    ahc_set_tags(struct ahc_softc *, struct ahc_devinfo *, int);
-static void    ahc_update_xfer_mode(struct ahc_softc *, struct ahc_devinfo *);
 static void    ahc_construct_sdtr(struct ahc_softc *, u_int, u_int);
 
 static void    ahc_construct_wdtr(struct ahc_softc *, u_int);
@@ -1272,6 +1271,22 @@
                ahc_update_pending_syncrates(ahc);
        }
 
+       /*
+        * Print messages if we're verbose and at the end of a negotiation
+        * cycle.
+        */
+       if (done) {
+               if (offset != 0) {
+                       printf("%s: target %d synchronous at %sMHz, "
+                           "offset = 0x%x\n", ahc_name(ahc),
+                           devinfo->target, syncrate->rate, offset);
+               } else {
+                       printf("%s: target %d using "
+                           "asynchronous transfers\n",
+                           ahc_name(ahc), devinfo->target);
+               }
+       }
+
        if ((type & AHC_TRANS_GOAL) != 0) {
                tinfo->goal.period = period;
                tinfo->goal.offset = offset;
@@ -1316,6 +1331,12 @@
                tinfo->current.width = width;
        }
 
+       if (done) {
+               printf("%s: target %d using %dbit transfers\n",
+                   ahc_name(ahc), devinfo->target,
+                   8 * (0x01 << width));
+       }
+
        if ((type & AHC_TRANS_GOAL) != 0)
                tinfo->goal.width = width;
        if ((type & AHC_TRANS_USER) != 0)
@@ -1342,31 +1363,6 @@
        }
 }
 
-static void
-ahc_update_xfer_mode(struct ahc_softc *ahc, struct ahc_devinfo *devinfo)
-{
-       struct scsipi_xfer_mode xm;
-       struct ahc_initiator_tinfo *tinfo;
-       struct tmode_tstate *tstate;
-
-       tinfo = ahc_fetch_transinfo(ahc, devinfo->channel, devinfo->our_scsiid,
-                                   devinfo->target, &tstate);
-
-       xm.xm_target = devinfo->target;
-       xm.xm_mode = 0;
-       xm.xm_period = tinfo->current.period;
-       xm.xm_offset = tinfo->current.offset;
-       if (tinfo->current.width == 1) 
-               xm.xm_mode |= PERIPH_CAP_WIDE16;
-       if (tinfo->current.period)
-               xm.xm_mode |= PERIPH_CAP_SYNC;
-       if (tstate->tagenable & devinfo->target_mask)
-               xm.xm_mode |= PERIPH_CAP_TQING;
-       scsipi_async_event(
-           devinfo->channel == 'B' ? &ahc->sc_channel_b : &ahc->sc_channel,
-           ASYNC_EVENT_XFER_MODE, &xm);
-}
-
 /*
  * Attach all the sub-devices we can find
  */
@@ -2512,8 +2508,7 @@
                        ahc_construct_sdtr(ahc, period, tinfo->goal.offset);
                        ahc->msgout_index = 0;
                        response = 1;
-               } else 
-                       ahc_update_xfer_mode(ahc, devinfo);
+               }
        } else if (ahc_sent_msg(ahc, MSG_EXT_SDTR, /*full*/FALSE)) {
                /* note asynch xfers and clear flag */
                ahc_set_syncrate(ahc, devinfo, /*syncrate*/NULL, /*period*/0,
@@ -2525,14 +2520,12 @@
                       ahc_name(ahc),
                       devinfo->channel, devinfo->target);
 #endif
-               ahc_update_xfer_mode(ahc, devinfo);
        } else if ((scb->hscb->control & TAG_ENB) != 0) {
                printf("%s:%c:%d: refuses tagged commands.  Performing "
                       "non-tagged I/O\n", ahc_name(ahc),
                       devinfo->channel, devinfo->target);
 
                ahc_set_tags(ahc, devinfo, FALSE);
-               ahc_update_xfer_mode(ahc, devinfo);
 
                /*
                 * Resend the identify for this CCB as the target
@@ -2950,7 +2943,6 @@
                                         syncrate, period, offset,
                                         AHC_TRANS_ACTIVE|AHC_TRANS_GOAL,
                                         /*paused*/TRUE, /*done*/TRUE);
-                       ahc_update_xfer_mode(ahc, devinfo);
 
                        /*
                         * See if we initiated Sync Negotiation
@@ -3074,8 +3066,7 @@
                                        ahc_construct_sdtr(ahc, period, offset);
                                        ahc->msgout_index = 0;
                                        response = TRUE;
-                               } else 
-                                       ahc_update_xfer_mode(ahc, devinfo);
+                               }
                        }
                        done = MSGLOOP_MSGCOMPLETE;
                        break;
@@ -3260,7 +3251,6 @@
        ahc_set_syncrate(ahc, devinfo, /*syncrate*/NULL,
                         /*period*/0, /*offset*/0, AHC_TRANS_CUR,
                         /*paused*/TRUE, /*done*/FALSE);
-       ahc_update_xfer_mode(ahc, devinfo);
 
        if (message != NULL && (verbose_level <= 0))
                printf("%s: %s on %c:%d. %d SCBs aborted\n", ahc_name(ahc),
@@ -3685,6 +3675,7 @@
                         && (ahc->features & AHC_WIDE) != 0)
                                tinfo->user.width = MSG_EXT_WDTR_BUS_16_BIT;
                }
+               tinfo->goal = tinfo->user; /* force negotiation */
                tstate->ultraenb = ultraenb;
                tstate->discenable = discenable;
                tstate->tagenable = 0; /* Wait until the XPT says its okay */
@@ -3841,7 +3832,7 @@
                xs = arg;
                periph = xs->xs_periph;
 
-               SC_DEBUG(xs->xs_periph, SDEV_DB3, ("ahc_action\n"));
+               SC_DEBUG(periph, SDEV_DB3, ("ahc_action\n"));
 
                /* must protect the queue */
                s = splbio();
@@ -3890,7 +3881,7 @@
 
                splx(s);
 
-               channel = SIM_CHANNEL(ahc, xs->xs_periph);
+               channel = SIM_CHANNEL(ahc, periph);
                if (ahc->inited_channels[channel - 'A'] == 0) {
                        if ((channel == 'A' &&
                             (ahc->flags & AHC_RESET_BUS_A)) ||
@@ -3909,8 +3900,22 @@
 
                mask = SCB_TARGET_MASK(scb);
                tinfo = ahc_fetch_transinfo(ahc,
-                           SIM_CHANNEL(ahc, xs->xs_periph),
+                           SIM_CHANNEL(ahc, periph),
                            our_id, target_id, &tstate);
+               if (ahc->inited_targets[target_id] == 0) {
+                       struct ahc_devinfo devinfo;
+
+                       s = splbio();
+                       ahc_compile_devinfo(&devinfo, our_id, target_id,
+                           periph->periph_lun,
+                           SIM_CHANNEL(ahc, periph),
+                           ROLE_INITIATOR);
+                       ahc_update_target_msg_request(ahc, &devinfo, tinfo,
+                           TRUE, FALSE);
+                       ahc->inited_targets[target_id] = 1;
+                       splx(s);
+               }
+
                hscb->scsirate = tinfo->scsirate;
                hscb->scsioffset = tinfo->current.offset;
                if ((tstate->ultraenb & mask) != 0)
@@ -3949,22 +3954,10 @@
                if (xm->xm_mode & PERIPH_CAP_TQING &&
                    (tstate->tagdisable & devinfo.target_mask) == 0) {
                        ahc_set_tags(ahc, &devinfo, TRUE);
-               }
-               if (xm->xm_mode & PERIPH_CAP_SYNC) {
-                       tinfo->goal.period = tinfo->user.period;
-                       tinfo->goal.offset = tinfo->user.offset;
-                       ahc_update_target_msg_request(ahc, &devinfo, tinfo,
-                               FALSE, FALSE);
-               }
-               if ((xm->xm_mode & PERIPH_CAP_WIDE16) &&
-                   tinfo->user.width == 1) {
-                       tinfo->goal.width = 1;
-                       ahc_update_target_msg_request(ahc, &devinfo, tinfo,
-                               FALSE, FALSE);
+                       printf("%s: target %d using tagged queuing\n",
+                           ahc_name(ahc), target_id);
                }
                splx(s);
-               if ((xm->xm_mode & (PERIPH_CAP_SYNC | PERIPH_CAP_WIDE16)) == 0)
-                       ahc_update_xfer_mode(ahc, &devinfo);
        }
        }
 }
@@ -5233,7 +5226,6 @@
                                         /*syncrate*/NULL, /*period*/0,
                                         /*offset*/0, AHC_TRANS_CUR,
                                         /*paused*/TRUE, FALSE);
-                       ahc_update_xfer_mode(ahc, &devinfo);
                }
        }
 
diff -r 61947d125778 -r 97abb81b7b69 sys/dev/ic/aic7xxxvar.h
--- a/sys/dev/ic/aic7xxxvar.h   Wed Apr 25 08:49:06 2001 +0000
+++ b/sys/dev/ic/aic7xxxvar.h   Wed Apr 25 11:49:47 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: aic7xxxvar.h,v 1.19.10.5 2001/04/02 16:22:57 bouyer Exp $      */
+/*     $NetBSD: aic7xxxvar.h,v 1.19.10.6 2001/04/25 11:49:49 bouyer Exp $      */
 
 /*
  * Interface to the generic driver for the aic7xxx based adaptec
@@ -519,6 +519,7 @@
 #define AHC_NEG_PENDING                0x01
 #define AHC_NEG_SDTRDONE       0x02
 #define AHC_NEG_WDTRDONE       0x04
+       u_int8_t                inited_targets[16];
        u_int8_t                inited_channels[2];
 
        /*



Home | Main Index | Thread Index | Old Index