Additional fixes to make 16 targets work on FAS366.

This commit is contained in:
mycroft 2002-09-25 05:19:20 +00:00
parent d80101c91c
commit 04f09a4b0c
3 changed files with 37 additions and 34 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: ncr53c9x.c,v 1.99 2002/09/24 13:29:44 mycroft Exp $ */
/* $NetBSD: ncr53c9x.c,v 1.100 2002/09/25 05:19:20 mycroft Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -77,7 +77,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ncr53c9x.c,v 1.99 2002/09/24 13:29:44 mycroft Exp $");
__KERNEL_RCSID(0, "$NetBSD: ncr53c9x.c,v 1.100 2002/09/25 05:19:20 mycroft Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -200,7 +200,20 @@ ncr53c9x_attach(sc)
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 @@ ncr53c9x_attach(sc)
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,11 +283,7 @@ ncr53c9x_attach(sc)
chan->chan_adapter = adapt;
chan->chan_bustype = &scsi_bustype;
chan->chan_channel = 0;
#if 0 /* XXX */
chan->chan_ntargets = (sc->sc_rev == NCR_VARIANT_FAS366) ? 16 : 8;
#else
chan->chan_ntargets = 8;
#endif
chan->chan_ntargets = sc->sc_ntarg;
chan->chan_nluns = 8;
chan->chan_id = sc->sc_id;
@ -449,7 +451,7 @@ ncr53c9x_init(sc, doreset)
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 {
@ -461,7 +463,7 @@ ncr53c9x_init(sc, doreset)
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;
@ -492,13 +494,13 @@ ncr53c9x_init(sc, doreset)
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);
((sc->sc_cfflags & (1<<(r&7))) ? T_RSELECTOFF : 0);
#ifdef DEBUG
if (ncr53c9x_notag)
ti->flags &= ~T_TAG;
@ -905,7 +907,7 @@ ncr53c9x_scsipi_request(chan, req, arg)
ti->period = 0;
ti->offset = 0;
if ((sc->sc_cfflags & (1<<(xm->xm_target+16))) == 0 &&
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));
@ -2921,7 +2923,8 @@ ncr53c9x_timeout(arg)
/* XXX ASYNC CALLBACK! */
scsipi_printaddr(periph);
printf("sync negotiation disabled\n");
sc->sc_cfflags |= (1 << (periph->periph_target + 8));
sc->sc_cfflags |=
(1 << ((periph->periph_target & 7) + 8));
ncr53c9x_update_xfer_mode(sc, periph->periph_target);
}
}
@ -2941,7 +2944,7 @@ ncr53c9x_watch(arg)
time_t old = time.tv_sec - (10 * 60);
s = splbio();
for (t = 0; t < NCR_NTARG; t++) {
for (t = 0; t < sc->sc_ntarg; t++) {
ti = &sc->sc_tinfo[t];
li = LIST_FIRST(&ti->luns);
while (li) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: ncr53c9xvar.h,v 1.37 2002/08/26 06:23:32 petrov Exp $ */
/* $NetBSD: ncr53c9xvar.h,v 1.38 2002/09/25 05:19:22 mycroft Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@ -70,7 +70,6 @@
/* #define NCR53C9X_DEBUG 1 */
/* Wide or differential can have 16 targets */
#define NCR_NTARG 8
#define NCR_NLUN 8
#define NCR_ABORT_TIMEOUT 2000 /* time to wait for abort */
@ -299,7 +298,8 @@ struct ncr53c9x_softc {
ready_list;
struct ncr53c9x_ecb *sc_nexus; /* Current command */
struct ncr53c9x_tinfo sc_tinfo[NCR_NTARG];
int sc_ntarg;
struct ncr53c9x_tinfo *sc_tinfo;
/* Data about the current nexus (updated for every cmd switch) */
caddr_t sc_dp; /* Current data pointer */

View File

@ -1,4 +1,4 @@
/* $NetBSD: esp_sbus.c,v 1.21 2002/08/23 02:53:10 thorpej Exp $ */
/* $NetBSD: esp_sbus.c,v 1.22 2002/09/25 05:19:23 mycroft Exp $ */
/*-
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: esp_sbus.c,v 1.21 2002/08/23 02:53:10 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: esp_sbus.c,v 1.22 2002/09/25 05:19:23 mycroft Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -759,7 +759,7 @@ db_esp(addr, have_addr, count, modif)
}
db_printf("\n");
for (t=0; t<NCR_NTARG; t++) {
for (t=0; t<sc->sc_ntarg; t++) {
LIST_FOREACH(li, &sc->sc_tinfo[t].luns, link) {
db_printf("t%d lun %d untagged %p busy %d used %x\n",
t, (int)li->lun, li->untagged, li->busy,