Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-1-6]: src/sys/dev/ic Pull up revision 1.94-1.103 (requested by ma...
details: https://anonhg.NetBSD.org/src/rev/0cd4b099eeac
branches: netbsd-1-6
changeset: 529460:0cd4b099eeac
user: tron <tron%NetBSD.org@localhost>
date: Fri Nov 22 17:50:07 2002 +0000
description:
Pull up revision 1.94-1.103 (requested by martin in ticket #948):
Additional fixes to make 16 targets work on FAS366.
diffstat:
sys/dev/ic/ncr53c9x.c | 135 ++++++++++++++++++++++++++++---------------------
1 files changed, 76 insertions(+), 59 deletions(-)
diffs (truncated from 417 to 300 lines):
diff -r 382b9226badc -r 0cd4b099eeac sys/dev/ic/ncr53c9x.c
--- a/sys/dev/ic/ncr53c9x.c Fri Nov 22 17:40:05 2002 +0000
+++ b/sys/dev/ic/ncr53c9x.c Fri Nov 22 17:50:07 2002 +0000
@@ -1,7 +1,7 @@
-/* $NetBSD: ncr53c9x.c,v 1.93 2002/04/05 18:27:53 bouyer Exp $ */
+/* $NetBSD: ncr53c9x.c,v 1.93.4.1 2002/11/22 17:50:07 tron Exp $ */
/*-
- * Copyright (c) 1998 The NetBSD Foundation, Inc.
+ * Copyright (c) 1998, 2002 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
@@ -77,7 +77,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ncr53c9x.c,v 1.93 2002/04/05 18:27:53 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ncr53c9x.c,v 1.93.4.1 2002/11/22 17:50:07 tron Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -101,7 +101,7 @@
#include <dev/ic/ncr53c9xreg.h>
#include <dev/ic/ncr53c9xvar.h>
-int ncr53c9x_debug = 0; /*NCR_SHOWPHASE|NCR_SHOWMISC|NCR_SHOWTRAC|NCR_SHOWCMDS;*/
+int ncr53c9x_debug = NCR_SHOWMISC; /*NCR_SHOWPHASE|NCR_SHOWMISC|NCR_SHOWTRAC|NCR_SHOWCMDS;*/
#ifdef DEBUG
int ncr53c9x_notag = 0;
#endif
@@ -200,7 +200,20 @@
struct scsipi_adapter *adapt = &sc->sc_adapter;
struct scsipi_channel *chan = &sc->sc_channel;
- callout_init(&sc->sc_watchdog);
+ /*
+ * Note, the front-end has set us up to print the chip variation.
+ */
+ if (sc->sc_rev >= NCR_VARIANT_MAX) {
+ printf("\n%s: unknown variant %d, devices not attached\n",
+ sc->sc_dev.dv_xname, sc->sc_rev);
+ return;
+ }
+
+ printf(": %s, %dMHz, SCSI ID %d\n",
+ ncr53c9x_variant_names[sc->sc_rev], sc->sc_freq, sc->sc_id);
+
+ sc->sc_ntarg = (sc->sc_rev == NCR_VARIANT_FAS366) ? 16 : 8;
+
/*
* Allocate SCSI message buffers.
* Front-ends can override allocation to avoid alignment
@@ -213,22 +226,15 @@
if (sc->sc_imess == NULL)
sc->sc_imess = malloc(NCR_MAX_MSG_LEN + 1, M_DEVBUF, M_NOWAIT);
- if (sc->sc_omess == NULL || sc->sc_imess == NULL) {
+ sc->sc_tinfo = malloc(sc->sc_ntarg * sizeof(sc->sc_tinfo[0]),
+ M_DEVBUF, M_NOWAIT | M_ZERO);
+
+ if (!sc->sc_omess || !sc->sc_imess || !sc->sc_tinfo) {
printf("out of memory\n");
return;
}
- /*
- * Note, the front-end has set us up to print the chip variation.
- */
- if (sc->sc_rev >= NCR_VARIANT_MAX) {
- printf("\n%s: unknown variant %d, devices not attached\n",
- sc->sc_dev.dv_xname, sc->sc_rev);
- return;
- }
-
- printf(": %s, %dMHz, SCSI ID %d\n",
- ncr53c9x_variant_names[sc->sc_rev], sc->sc_freq, sc->sc_id);
+ callout_init(&sc->sc_watchdog);
/*
* Treat NCR53C90 with the 86C01 DMA chip exactly as ESP100
@@ -277,7 +283,7 @@
chan->chan_adapter = adapt;
chan->chan_bustype = &scsi_bustype;
chan->chan_channel = 0;
- chan->chan_ntargets = 8; /* XXX fas has 16(not supported) */
+ chan->chan_ntargets = sc->sc_ntarg;
chan->chan_nluns = 8;
chan->chan_id = sc->sc_id;
@@ -430,7 +436,7 @@
struct ncr53c9x_linfo *li;
int i, r;
- NCR_TRACE(("[NCR_INIT(%d) %d] ", doreset, sc->sc_state));
+ NCR_MISC(("[NCR_INIT(%d) %d] ", doreset, sc->sc_state));
if (!ecb_pool_initialized) {
/* All instances share this pool */
@@ -445,7 +451,7 @@
TAILQ_INIT(&sc->ready_list);
sc->sc_nexus = NULL;
memset(sc->sc_tinfo, 0, sizeof(sc->sc_tinfo));
- for (r = 0; r < NCR_NTARG; r++) {
+ for (r = 0; r < sc->sc_ntarg; r++) {
LIST_INIT(&sc->sc_tinfo[r].luns);
}
} else {
@@ -457,7 +463,7 @@
ncr53c9x_done(sc, ecb);
}
/* Cancel outstanding disconnected commands on each LUN */
- for (r = 0; r < 8; r++) {
+ for (r = 0; r < sc->sc_ntarg; r++) {
LIST_FOREACH(li, &sc->sc_tinfo[r].luns, link) {
if ((ecb = li->untagged) != NULL) {
li->untagged = NULL;
@@ -488,14 +494,13 @@
ncr53c9x_reset(sc);
sc->sc_phase = sc->sc_prevphase = INVALID_PHASE;
- for (r = 0; r < 8; r++) {
+ for (r = 0; r < sc->sc_ntarg; r++) {
struct ncr53c9x_tinfo *ti = &sc->sc_tinfo[r];
/* XXX - config flags per target: low bits: no reselect; high bits: no synch */
- ti->flags = ((sc->sc_minsync && !(sc->sc_cfflags & (1<<(r+8))))
+ ti->flags = ((sc->sc_minsync && !(sc->sc_cfflags & (1<<((r&7)+8))))
? 0 : T_SYNCHOFF) |
- ((sc->sc_cfflags & (1<<r)) ? T_RSELECTOFF : 0) |
- T_NEED_TO_RESET;
+ ((sc->sc_cfflags & (1<<(r&7))) ? T_RSELECTOFF : 0);
#ifdef DEBUG
if (ncr53c9x_notag)
ti->flags &= ~T_TAG;
@@ -503,6 +508,8 @@
ti->period = sc->sc_minsync;
ti->offset = 0;
ti->cfg3 = 0;
+
+ ncr53c9x_update_xfer_mode(sc, r);
}
if (doreset) {
@@ -548,7 +555,7 @@
sc->sc_phase = (sc->sc_espintr & NCRINTR_DIS) ?
/* Disconnected */ BUSFREE_PHASE : sc->sc_espstat & NCRSTAT_PHASE;
- NCR_MISC(("regs[intr=%02x,stat=%02x,step=%02x,stat2=%02x] ",
+ NCR_INTS(("regs[intr=%02x,stat=%02x,step=%02x,stat2=%02x] ",
sc->sc_espintr, sc->sc_espstat, sc->sc_espstep, sc->sc_espstat2));
}
@@ -760,7 +767,7 @@
/* And get the targets attention */
if (selatns) {
- NCR_MISC(("SELATNS \n"));
+ NCR_MSGS(("SELATNS \n"));
/* Arbitrate, select and stop after IDENTIFY message */
NCRCMD(sc, NCRCMD_SELATNS);
} else if (selatn3) {
@@ -900,10 +907,12 @@
ti->period = 0;
ti->offset = 0;
- if ((sc->sc_cfflags & (1<<(xm->xm_target+16))) == 0 &&
- (xm->xm_mode & PERIPH_CAP_TQING))
+ if ((sc->sc_cfflags & (1<<((xm->xm_target&7)+16))) == 0 &&
+ (xm->xm_mode & PERIPH_CAP_TQING)) {
+ NCR_MISC(("%s: target %d: tagged queuing\n",
+ sc->sc_dev.dv_xname, xm->xm_target));
ti->flags |= T_TAG;
- else
+ } else
ti->flags &= ~T_TAG;
if ((xm->xm_mode & PERIPH_CAP_WIDE16) != 0) {
@@ -999,17 +1008,19 @@
int flag;
struct proc *p;
{
- /* struct ncr53c9x_softc *sc = (void *)chan->chan_adapter->adapt_dev; */
+ struct ncr53c9x_softc *sc = (void *)chan->chan_adapter->adapt_dev;
int s, error = 0;
- s = splbio();
-
switch (cmd) {
+ case SCBUSIORESET:
+ s = splbio();
+ ncr53c9x_init(sc, 1);
+ splx(s);
+ break;
default:
error = ENOTTY;
break;
}
- splx(s);
return (error);
}
@@ -1119,7 +1130,7 @@
ncr53c9x_select(sc, ecb);
break;
} else
- NCR_MISC(("%d:%d busy\n",
+ NCR_TRACE(("%d:%d busy\n",
periph->periph_target,
periph->periph_lun));
}
@@ -1137,7 +1148,7 @@
struct ncr53c9x_linfo *li;
int lun = periph->periph_lun;
- NCR_MISC(("requesting sense "));
+ NCR_TRACE(("requesting sense "));
/* Next, setup a request sense command block */
memset(ss, 0, sizeof(*ss));
ss->opcode = REQUEST_SENSE;
@@ -1210,7 +1221,7 @@
}
#ifdef NCR53C9X_DEBUG
- if (ncr53c9x_debug & NCR_SHOWMISC) {
+ if (ncr53c9x_debug & NCR_SHOWTRAC) {
if (xs->resid != 0)
printf("resid=%d ", xs->resid);
if (xs->error == XS_SENSE)
@@ -1261,7 +1272,7 @@
li = TINFO_LUN(ti, lun);
#ifdef DIAGNOSTIC
if (li == NULL || li->lun != lun)
- panic("ncr53c9x_dequeue: lun %qx for ecb %p does not exist\n",
+ panic("ncr53c9x_dequeue: lun %qx for ecb %p does not exist",
(long long) lun, ecb);
#endif
if (li->untagged == ecb) {
@@ -1298,7 +1309,7 @@
*/
#define ncr53c9x_sched_msgout(m) \
do { \
- NCR_MISC(("ncr53c9x_sched_msgout %x %d", m, __LINE__)); \
+ NCR_MSGS(("ncr53c9x_sched_msgout %x %d", m, __LINE__)); \
NCRCMD(sc, NCRCMD_SETATN); \
sc->sc_flags |= NCR_ATN; \
sc->sc_msgpriq |= (m); \
@@ -1307,7 +1318,7 @@
static void
ncr53c9x_flushfifo(struct ncr53c9x_softc *sc)
{
- NCR_MISC(("[flushfifo] "));
+ NCR_TRACE(("[flushfifo] "));
NCRCMD(sc, NCRCMD_FLUSH);
@@ -1331,7 +1342,7 @@
buf = sc->sc_imess + sc->sc_imlen;
break;
default:
- panic("ncr53c9x_rdfifo: bad flag\n");
+ panic("ncr53c9x_rdfifo: bad flag");
break;
}
@@ -1363,6 +1374,7 @@
sc->sc_imlen += i;
+#if 0
#ifdef NCR53C9X_DEBUG
{
int j;
@@ -1377,6 +1389,7 @@
}
}
#endif
+#endif
return sc->sc_imlen;
}
@@ -1386,8 +1399,8 @@
int i;
#ifdef NCR53C9X_DEBUG
- NCR_MISC(("[wrfifo(%d):", len));
- if (ncr53c9x_debug & NCR_SHOWTRAC) {
+ NCR_MSGS(("[wrfifo(%d):", len));
+ if (ncr53c9x_debug & NCR_SHOWMSGS) {
for (i = 0; i < len; i++)
printf(" %02x", p[i]);
printf("]\n");
@@ -1669,7 +1682,7 @@
"target %d\n",
sc->sc_dev.dv_xname,
ecb->xs->xs_periph->periph_target);
- ti->flags &= ~T_WIDE;
+ ti->flags &= ~(T_WIDE | T_WDTRSENT);
ti->width = 0;
break;
Home |
Main Index |
Thread Index |
Old Index