1997-11-28 01:43:44 +03:00
|
|
|
/* $NetBSD: siop.c,v 1.38 1997/11/27 22:43:44 mhitch Exp $ */
|
1994-10-26 05:01:24 +03:00
|
|
|
|
1994-01-27 00:05:34 +03:00
|
|
|
/*
|
1994-05-12 09:56:28 +04:00
|
|
|
* Copyright (c) 1994 Michael L. Hitch
|
1994-01-27 00:05:34 +03:00
|
|
|
* Copyright (c) 1990 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This code is derived from software contributed to Berkeley by
|
|
|
|
* Van Jacobson of Lawrence Berkeley Laboratory.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. All advertising materials mentioning features or use of this software
|
|
|
|
* must display the following acknowledgement:
|
|
|
|
* This product includes software developed by the University of
|
|
|
|
* California, Berkeley and its contributors.
|
|
|
|
* 4. Neither the name of the University nor the names of its contributors
|
|
|
|
* may be used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*
|
|
|
|
* @(#)siop.c 7.5 (Berkeley) 5/4/91
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* AMIGA 53C710 scsi adaptor driver
|
|
|
|
*/
|
1994-02-01 14:51:59 +03:00
|
|
|
|
1994-02-14 00:10:20 +03:00
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/systm.h>
|
1994-05-12 09:56:28 +04:00
|
|
|
#include <sys/device.h>
|
1995-02-12 22:18:33 +03:00
|
|
|
#include <sys/disklabel.h>
|
|
|
|
#include <sys/dkstat.h>
|
1994-02-14 00:10:20 +03:00
|
|
|
#include <sys/buf.h>
|
1996-02-03 21:47:07 +03:00
|
|
|
#include <sys/malloc.h>
|
1997-08-27 15:22:52 +04:00
|
|
|
#include <dev/scsipi/scsi_all.h>
|
|
|
|
#include <dev/scsipi/scsipi_all.h>
|
|
|
|
#include <dev/scsipi/scsiconf.h>
|
1994-02-14 00:10:20 +03:00
|
|
|
#include <machine/cpu.h>
|
1994-05-12 09:56:28 +04:00
|
|
|
#include <amiga/amiga/custom.h>
|
1995-02-12 22:18:33 +03:00
|
|
|
#include <amiga/amiga/isr.h>
|
1994-05-12 09:56:28 +04:00
|
|
|
#include <amiga/dev/siopreg.h>
|
|
|
|
#include <amiga/dev/siopvar.h>
|
1994-01-27 00:05:34 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* SCSI delays
|
|
|
|
* In u-seconds, primarily for state changes on the SPC.
|
|
|
|
*/
|
1994-06-13 12:12:30 +04:00
|
|
|
#define SCSI_CMD_WAIT 500000 /* wait per step of 'immediate' cmds */
|
|
|
|
#define SCSI_DATA_WAIT 500000 /* wait per data in/out step */
|
|
|
|
#define SCSI_INIT_WAIT 500000 /* wait per step (both) during init */
|
1994-01-27 00:05:34 +03:00
|
|
|
|
1995-08-18 19:27:29 +04:00
|
|
|
void siop_select __P((struct siop_softc *));
|
1994-05-12 09:56:28 +04:00
|
|
|
void siopabort __P((struct siop_softc *, siop_regmap_p, char *));
|
|
|
|
void sioperror __P((struct siop_softc *, siop_regmap_p, u_char));
|
|
|
|
void siopstart __P((struct siop_softc *));
|
1996-04-22 01:10:48 +04:00
|
|
|
int siop_checkintr __P((struct siop_softc *, u_char, u_char, u_char, int *));
|
1994-05-12 09:56:28 +04:00
|
|
|
void siopreset __P((struct siop_softc *));
|
|
|
|
void siopsetdelay __P((int));
|
1995-08-18 19:27:29 +04:00
|
|
|
void siop_scsidone __P((struct siop_acb *, int));
|
|
|
|
void siop_sched __P((struct siop_softc *));
|
|
|
|
int siop_poll __P((struct siop_softc *, struct siop_acb *));
|
1996-04-22 01:10:48 +04:00
|
|
|
void siopintr __P((struct siop_softc *));
|
|
|
|
void scsi_period_to_siop __P((struct siop_softc *, int));
|
|
|
|
void siop_start __P((struct siop_softc *, int, int, u_char *, int, u_char *, int));
|
|
|
|
void siop_dump_acb __P((struct siop_acb *));
|
1994-01-27 00:05:34 +03:00
|
|
|
|
|
|
|
/* 53C710 script */
|
1995-08-18 19:27:29 +04:00
|
|
|
const
|
1994-12-28 12:24:55 +03:00
|
|
|
#include <amiga/dev/siop_script.out>
|
1994-01-27 00:05:34 +03:00
|
|
|
|
1994-05-12 09:56:28 +04:00
|
|
|
/* default to not inhibit sync negotiation on any drive */
|
1994-06-22 20:20:48 +04:00
|
|
|
u_char siop_inhibit_sync[8] = { 0, 0, 0, 0, 0, 0, 0 }; /* initialize, so patchable */
|
1995-08-18 19:27:29 +04:00
|
|
|
u_char siop_allow_disc[8] = {3, 3, 3, 3, 3, 3, 3, 3};
|
1994-05-12 09:56:28 +04:00
|
|
|
int siop_no_dma = 0;
|
|
|
|
|
1994-12-28 12:24:55 +03:00
|
|
|
int siop_reset_delay = 250; /* delay after reset, in milleseconds */
|
1994-01-27 00:05:34 +03:00
|
|
|
|
|
|
|
int siop_cmd_wait = SCSI_CMD_WAIT;
|
|
|
|
int siop_data_wait = SCSI_DATA_WAIT;
|
|
|
|
int siop_init_wait = SCSI_INIT_WAIT;
|
|
|
|
|
1996-03-16 01:11:09 +03:00
|
|
|
#ifdef DEBUG_SYNC
|
1994-12-28 12:24:55 +03:00
|
|
|
/*
|
|
|
|
* sync period transfer lookup - only valid for 66Mhz clock
|
|
|
|
*/
|
1994-01-27 00:05:34 +03:00
|
|
|
static struct {
|
1995-09-16 20:11:03 +04:00
|
|
|
unsigned char p; /* period from sync request message */
|
|
|
|
unsigned char r; /* siop_period << 4 | sbcl */
|
|
|
|
} sync_tab[] = {
|
1994-12-28 12:24:55 +03:00
|
|
|
{ 60/4, 0<<4 | 1},
|
|
|
|
{ 76/4, 1<<4 | 1},
|
|
|
|
{ 92/4, 2<<4 | 1},
|
|
|
|
{ 92/4, 0<<4 | 2},
|
|
|
|
{108/4, 3<<4 | 1},
|
|
|
|
{116/4, 1<<4 | 2},
|
|
|
|
{120/4, 4<<4 | 1},
|
|
|
|
{120/4, 0<<4 | 3},
|
|
|
|
{136/4, 5<<4 | 1},
|
|
|
|
{140/4, 2<<4 | 2},
|
|
|
|
{152/4, 6<<4 | 1},
|
|
|
|
{152/4, 1<<4 | 3},
|
|
|
|
{164/4, 3<<4 | 2},
|
|
|
|
{168/4, 7<<4 | 1},
|
|
|
|
{180/4, 2<<4 | 3},
|
|
|
|
{184/4, 4<<4 | 2},
|
|
|
|
{208/4, 5<<4 | 2},
|
|
|
|
{212/4, 3<<4 | 3},
|
|
|
|
{232/4, 6<<4 | 2},
|
|
|
|
{240/4, 4<<4 | 3},
|
|
|
|
{256/4, 7<<4 | 2},
|
|
|
|
{272/4, 5<<4 | 3},
|
|
|
|
{300/4, 6<<4 | 3},
|
|
|
|
{332/4, 7<<4 | 3}
|
1994-01-27 00:05:34 +03:00
|
|
|
};
|
1995-09-16 20:11:03 +04:00
|
|
|
#endif
|
1994-01-27 00:05:34 +03:00
|
|
|
|
|
|
|
#ifdef DEBUG
|
1994-05-12 09:56:28 +04:00
|
|
|
/*
|
|
|
|
* 0x01 - full debug
|
|
|
|
* 0x02 - DMA chaining
|
|
|
|
* 0x04 - siopintr
|
|
|
|
* 0x08 - phase mismatch
|
1995-08-18 19:27:29 +04:00
|
|
|
* 0x10 - <not used>
|
1994-06-27 08:56:29 +04:00
|
|
|
* 0x20 - panic on unhandled exceptions
|
1995-08-18 19:27:29 +04:00
|
|
|
* 0x100 - disconnect/reselect
|
1994-05-12 09:56:28 +04:00
|
|
|
*/
|
|
|
|
int siop_debug = 0;
|
|
|
|
int siopsync_debug = 0;
|
|
|
|
int siopdma_hits = 0;
|
|
|
|
int siopdma_misses = 0;
|
1994-06-22 20:20:48 +04:00
|
|
|
int siopchain_ints = 0;
|
1994-12-28 12:24:55 +03:00
|
|
|
int siopstarts = 0;
|
|
|
|
int siopints = 0;
|
|
|
|
int siopphmm = 0;
|
1995-08-18 19:27:29 +04:00
|
|
|
#define SIOP_TRACE_SIZE 128
|
|
|
|
#define SIOP_TRACE(a,b,c,d) \
|
|
|
|
siop_trbuf[siop_trix] = (a); \
|
|
|
|
siop_trbuf[siop_trix+1] = (b); \
|
|
|
|
siop_trbuf[siop_trix+2] = (c); \
|
|
|
|
siop_trbuf[siop_trix+3] = (d); \
|
|
|
|
siop_trix = (siop_trix + 4) & (SIOP_TRACE_SIZE - 1);
|
|
|
|
u_char siop_trbuf[SIOP_TRACE_SIZE];
|
|
|
|
int siop_trix;
|
1995-09-16 20:11:03 +04:00
|
|
|
void siop_dump __P((struct siop_softc *));
|
|
|
|
void siop_dump_trace __P((void));
|
1994-07-18 12:06:40 +04:00
|
|
|
#else
|
1995-08-18 19:27:29 +04:00
|
|
|
#define SIOP_TRACE(a,b,c,d)
|
1994-01-27 00:05:34 +03:00
|
|
|
#endif
|
1994-05-12 09:56:28 +04:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* default minphys routine for siop based controllers
|
|
|
|
*/
|
1995-08-13 00:30:45 +04:00
|
|
|
void
|
1994-05-12 09:56:28 +04:00
|
|
|
siop_minphys(bp)
|
|
|
|
struct buf *bp;
|
|
|
|
{
|
1995-08-13 00:30:45 +04:00
|
|
|
|
1994-05-12 09:56:28 +04:00
|
|
|
/*
|
1995-08-13 00:30:45 +04:00
|
|
|
* No max transfer at this level.
|
1994-05-12 09:56:28 +04:00
|
|
|
*/
|
1995-08-13 00:30:45 +04:00
|
|
|
minphys(bp);
|
1994-01-27 00:05:34 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
1994-05-12 09:56:28 +04:00
|
|
|
* used by specific siop controller
|
1994-01-27 00:05:34 +03:00
|
|
|
*
|
1994-05-12 09:56:28 +04:00
|
|
|
*/
|
|
|
|
int
|
|
|
|
siop_scsicmd(xs)
|
1997-08-27 15:22:52 +04:00
|
|
|
struct scsipi_xfer *xs;
|
1994-05-12 09:56:28 +04:00
|
|
|
{
|
1995-08-18 19:27:29 +04:00
|
|
|
struct siop_acb *acb;
|
1995-02-12 22:18:33 +03:00
|
|
|
struct siop_softc *sc;
|
1997-08-27 15:22:52 +04:00
|
|
|
struct scsipi_link *slp;
|
1996-04-22 01:10:48 +04:00
|
|
|
int flags, s;
|
1994-05-12 09:56:28 +04:00
|
|
|
|
|
|
|
slp = xs->sc_link;
|
1995-02-12 22:18:33 +03:00
|
|
|
sc = slp->adapter_softc;
|
1994-05-12 09:56:28 +04:00
|
|
|
flags = xs->flags;
|
|
|
|
|
1995-08-18 19:27:29 +04:00
|
|
|
/* XXXX ?? */
|
1994-05-12 09:56:28 +04:00
|
|
|
if (flags & SCSI_DATA_UIO)
|
|
|
|
panic("siop: scsi data uio requested");
|
1995-08-13 00:30:45 +04:00
|
|
|
|
1995-08-18 19:27:29 +04:00
|
|
|
/* XXXX ?? */
|
|
|
|
if (sc->sc_nexus && flags & SCSI_POLL)
|
1995-09-16 20:11:03 +04:00
|
|
|
/* panic("siop_scsicmd: busy");*/
|
1996-10-13 07:05:43 +04:00
|
|
|
printf("siop_scsicmd: busy\n");
|
1994-05-12 09:56:28 +04:00
|
|
|
|
|
|
|
s = splbio();
|
1995-08-18 19:27:29 +04:00
|
|
|
acb = sc->free_list.tqh_first;
|
|
|
|
if (acb) {
|
|
|
|
TAILQ_REMOVE(&sc->free_list, acb, chain);
|
1994-05-12 09:56:28 +04:00
|
|
|
}
|
1995-08-18 19:27:29 +04:00
|
|
|
splx(s);
|
1994-05-12 09:56:28 +04:00
|
|
|
|
1995-08-18 19:27:29 +04:00
|
|
|
if (acb == NULL) {
|
|
|
|
xs->error = XS_DRIVER_STUFFUP;
|
|
|
|
return(TRY_AGAIN_LATER);
|
1994-05-12 09:56:28 +04:00
|
|
|
}
|
|
|
|
|
1995-08-18 19:27:29 +04:00
|
|
|
acb->flags = ACB_ACTIVE;
|
|
|
|
acb->xs = xs;
|
|
|
|
bcopy(xs->cmd, &acb->cmd, xs->cmdlen);
|
|
|
|
acb->clen = xs->cmdlen;
|
|
|
|
acb->daddr = xs->data;
|
|
|
|
acb->dleft = xs->datalen;
|
1994-05-12 09:56:28 +04:00
|
|
|
|
1995-08-18 19:27:29 +04:00
|
|
|
s = splbio();
|
|
|
|
TAILQ_INSERT_TAIL(&sc->ready_list, acb, chain);
|
|
|
|
|
|
|
|
if (sc->sc_nexus == NULL)
|
|
|
|
siop_sched(sc);
|
|
|
|
|
|
|
|
splx(s);
|
|
|
|
|
|
|
|
if (flags & SCSI_POLL || siop_no_dma)
|
|
|
|
return(siop_poll(sc, acb));
|
1994-05-12 09:56:28 +04:00
|
|
|
return(SUCCESSFULLY_QUEUED);
|
|
|
|
}
|
|
|
|
|
1995-08-18 19:27:29 +04:00
|
|
|
int
|
|
|
|
siop_poll(sc, acb)
|
|
|
|
struct siop_softc *sc;
|
|
|
|
struct siop_acb *acb;
|
|
|
|
{
|
|
|
|
siop_regmap_p rp = sc->sc_siopp;
|
1997-08-27 15:22:52 +04:00
|
|
|
struct scsipi_xfer *xs = acb->xs;
|
1995-08-18 19:27:29 +04:00
|
|
|
int i;
|
|
|
|
int status;
|
|
|
|
u_char istat;
|
|
|
|
u_char dstat;
|
|
|
|
u_char sstat0;
|
|
|
|
int s;
|
|
|
|
int to;
|
|
|
|
|
|
|
|
s = splbio();
|
|
|
|
to = xs->timeout / 1000;
|
|
|
|
if (sc->nexus_list.tqh_first)
|
1996-10-13 07:05:43 +04:00
|
|
|
printf("%s: siop_poll called with disconnected device\n",
|
1995-08-18 19:27:29 +04:00
|
|
|
sc->sc_dev.dv_xname);
|
|
|
|
for (;;) {
|
|
|
|
/* use cmd_wait values? */
|
|
|
|
i = 50000;
|
1997-07-27 02:07:54 +04:00
|
|
|
/* XXX spl0(); */
|
1995-08-18 19:27:29 +04:00
|
|
|
while (((istat = rp->siop_istat) &
|
|
|
|
(SIOP_ISTAT_SIP | SIOP_ISTAT_DIP)) == 0) {
|
|
|
|
if (--i <= 0) {
|
|
|
|
#ifdef DEBUG
|
1996-10-13 07:05:43 +04:00
|
|
|
printf ("waiting: tgt %d cmd %02x sbcl %02x dsp %lx (+%lx) dcmd %lx ds %p timeout %d\n",
|
1997-08-27 15:22:52 +04:00
|
|
|
xs->sc_link->scsipi_scsi.target, acb->cmd.opcode,
|
1995-08-18 19:27:29 +04:00
|
|
|
rp->siop_sbcl, rp->siop_dsp,
|
|
|
|
rp->siop_dsp - sc->sc_scriptspa,
|
|
|
|
*((long *)&rp->siop_dcmd), &acb->ds, acb->xs->timeout);
|
|
|
|
#endif
|
|
|
|
i = 50000;
|
|
|
|
--to;
|
|
|
|
if (to <= 0) {
|
|
|
|
siopreset(sc);
|
|
|
|
return(COMPLETE);
|
|
|
|
}
|
|
|
|
}
|
1997-11-28 01:43:44 +03:00
|
|
|
delay(20);
|
1995-08-18 19:27:29 +04:00
|
|
|
}
|
|
|
|
sstat0 = rp->siop_sstat0;
|
|
|
|
dstat = rp->siop_dstat;
|
|
|
|
if (siop_checkintr(sc, istat, dstat, sstat0, &status)) {
|
|
|
|
if (acb != sc->sc_nexus)
|
1996-10-13 07:05:43 +04:00
|
|
|
printf("%s: siop_poll disconnected device completed\n",
|
1995-08-18 19:27:29 +04:00
|
|
|
sc->sc_dev.dv_xname);
|
|
|
|
else if ((sc->sc_flags & SIOP_INTDEFER) == 0) {
|
|
|
|
sc->sc_flags &= ~SIOP_INTSOFF;
|
|
|
|
rp->siop_sien = sc->sc_sien;
|
|
|
|
rp->siop_dien = sc->sc_dien;
|
|
|
|
}
|
|
|
|
siop_scsidone(sc->sc_nexus, status);
|
|
|
|
}
|
|
|
|
if (xs->flags & ITSDONE)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
splx(s);
|
|
|
|
return (COMPLETE);
|
|
|
|
}
|
|
|
|
|
1994-05-12 09:56:28 +04:00
|
|
|
/*
|
1995-08-18 19:27:29 +04:00
|
|
|
* start next command that's ready
|
1994-01-27 00:05:34 +03:00
|
|
|
*/
|
|
|
|
void
|
1995-08-18 19:27:29 +04:00
|
|
|
siop_sched(sc)
|
1995-02-12 22:18:33 +03:00
|
|
|
struct siop_softc *sc;
|
1994-01-27 00:05:34 +03:00
|
|
|
{
|
1997-08-27 15:22:52 +04:00
|
|
|
struct scsipi_link *slp;
|
1995-08-18 19:27:29 +04:00
|
|
|
struct siop_acb *acb;
|
1996-04-22 01:10:48 +04:00
|
|
|
int i;
|
1994-05-12 09:56:28 +04:00
|
|
|
|
1995-08-18 19:27:29 +04:00
|
|
|
#ifdef DEBUG
|
|
|
|
if (sc->sc_nexus) {
|
1996-10-13 07:05:43 +04:00
|
|
|
printf("%s: siop_sched- nexus %p/%d ready %p/%d\n",
|
1995-08-18 19:27:29 +04:00
|
|
|
sc->sc_dev.dv_xname, sc->sc_nexus,
|
1997-08-27 15:22:52 +04:00
|
|
|
sc->sc_nexus->xs->sc_link->scsipi_scsi.target,
|
1995-08-18 19:27:29 +04:00
|
|
|
sc->ready_list.tqh_first,
|
1997-08-27 15:22:52 +04:00
|
|
|
sc->ready_list.tqh_first->xs->sc_link->scsipi_scsi.target);
|
1995-08-18 19:27:29 +04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
for (acb = sc->ready_list.tqh_first; acb; acb = acb->chain.tqe_next) {
|
|
|
|
slp = acb->xs->sc_link;
|
1997-08-27 15:22:52 +04:00
|
|
|
i = slp->scsipi_scsi.target;
|
|
|
|
if(!(sc->sc_tinfo[i].lubusy & (1 << slp->scsipi_scsi.lun))) {
|
1995-08-18 19:27:29 +04:00
|
|
|
struct siop_tinfo *ti = &sc->sc_tinfo[i];
|
|
|
|
|
|
|
|
TAILQ_REMOVE(&sc->ready_list, acb, chain);
|
|
|
|
sc->sc_nexus = acb;
|
|
|
|
slp = acb->xs->sc_link;
|
1997-08-27 15:22:52 +04:00
|
|
|
ti = &sc->sc_tinfo[slp->scsipi_scsi.target];
|
|
|
|
ti->lubusy |= (1 << slp->scsipi_scsi.lun);
|
1994-12-28 12:24:55 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
1995-08-18 19:27:29 +04:00
|
|
|
|
|
|
|
if (acb == NULL) {
|
|
|
|
#ifdef DEBUGXXX
|
1996-10-13 07:05:43 +04:00
|
|
|
printf("%s: siop_sched didn't find ready command\n",
|
1995-08-18 19:27:29 +04:00
|
|
|
sc->sc_dev.dv_xname);
|
1994-05-12 09:56:28 +04:00
|
|
|
#endif
|
|
|
|
return;
|
1995-08-18 19:27:29 +04:00
|
|
|
}
|
1995-08-13 00:30:45 +04:00
|
|
|
|
1995-08-18 19:27:29 +04:00
|
|
|
if (acb->xs->flags & SCSI_RESET)
|
|
|
|
siopreset(sc);
|
|
|
|
|
|
|
|
#if 0
|
1997-08-27 15:22:52 +04:00
|
|
|
acb->cmd.bytes[0] |= slp->scsipi_scsi.lun << 5; /* XXXX */
|
1995-08-18 19:27:29 +04:00
|
|
|
#endif
|
|
|
|
++sc->sc_active;
|
|
|
|
siop_select(sc);
|
1994-05-12 09:56:28 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
1995-08-18 19:27:29 +04:00
|
|
|
siop_scsidone(acb, stat)
|
|
|
|
struct siop_acb *acb;
|
1994-05-12 09:56:28 +04:00
|
|
|
int stat;
|
|
|
|
{
|
1997-08-27 15:22:52 +04:00
|
|
|
struct scsipi_xfer *xs;
|
|
|
|
struct scsipi_link *slp;
|
1996-03-16 01:11:09 +03:00
|
|
|
struct siop_softc *sc;
|
1996-04-22 01:10:48 +04:00
|
|
|
int dosched = 0;
|
1994-05-12 09:56:28 +04:00
|
|
|
|
1996-04-28 10:28:24 +04:00
|
|
|
if (acb == NULL || (xs = acb->xs) == NULL) {
|
1994-05-12 09:56:28 +04:00
|
|
|
#ifdef DIAGNOSTIC
|
1997-08-27 15:22:52 +04:00
|
|
|
printf("siop_scsidone: NULL acb or scsipi_xfer\n");
|
1996-04-28 10:28:24 +04:00
|
|
|
#if defined(DEBUG) && defined(DDB)
|
1996-03-16 01:11:09 +03:00
|
|
|
Debugger();
|
1996-04-28 10:28:24 +04:00
|
|
|
#endif
|
|
|
|
#endif
|
1996-03-16 01:11:09 +03:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
slp = xs->sc_link;
|
|
|
|
sc = slp->adapter_softc;
|
1994-05-12 09:56:28 +04:00
|
|
|
/*
|
|
|
|
* is this right?
|
|
|
|
*/
|
|
|
|
xs->status = stat;
|
|
|
|
|
1995-08-18 19:27:29 +04:00
|
|
|
if (xs->error == XS_NOERROR && !(acb->flags & ACB_CHKSENSE)) {
|
|
|
|
if (stat == SCSI_CHECK) {
|
1997-08-27 15:22:52 +04:00
|
|
|
struct scsipi_sense *ss = (void *)&acb->cmd;
|
1995-08-18 19:27:29 +04:00
|
|
|
bzero(ss, sizeof(*ss));
|
|
|
|
ss->opcode = REQUEST_SENSE;
|
1997-08-27 15:22:52 +04:00
|
|
|
ss->byte2 = slp->scsipi_scsi.lun << 5;
|
|
|
|
ss->length = sizeof(struct scsipi_sense_data);
|
1995-08-18 19:27:29 +04:00
|
|
|
acb->clen = sizeof(*ss);
|
1997-08-27 15:22:52 +04:00
|
|
|
acb->daddr = (char *)&xs->sense.scsi_sense;
|
|
|
|
acb->dleft = sizeof(struct scsipi_sense_data);
|
1995-08-18 19:27:29 +04:00
|
|
|
acb->flags = ACB_ACTIVE | ACB_CHKSENSE;
|
|
|
|
TAILQ_INSERT_HEAD(&sc->ready_list, acb, chain);
|
|
|
|
--sc->sc_active;
|
1997-08-27 15:22:52 +04:00
|
|
|
sc->sc_tinfo[slp->scsipi_scsi.target].lubusy &=
|
|
|
|
~(1 << slp->scsipi_scsi.lun);
|
|
|
|
sc->sc_tinfo[slp->scsipi_scsi.target].senses++;
|
1995-08-18 19:27:29 +04:00
|
|
|
if (sc->sc_nexus == acb) {
|
|
|
|
sc->sc_nexus = NULL;
|
|
|
|
siop_sched(sc);
|
|
|
|
}
|
|
|
|
SIOP_TRACE('d','s',0,0)
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (xs->error == XS_NOERROR && (acb->flags & ACB_CHKSENSE)) {
|
|
|
|
xs->error = XS_SENSE;
|
|
|
|
} else {
|
|
|
|
xs->resid = 0; /* XXXX */
|
|
|
|
}
|
|
|
|
#if whataboutthisone
|
1994-05-12 09:56:28 +04:00
|
|
|
case SCSI_BUSY:
|
|
|
|
xs->error = XS_BUSY;
|
|
|
|
break;
|
1995-08-18 19:27:29 +04:00
|
|
|
#endif
|
1994-05-12 09:56:28 +04:00
|
|
|
xs->flags |= ITSDONE;
|
|
|
|
|
1994-12-28 12:24:55 +03:00
|
|
|
/*
|
1995-08-18 19:27:29 +04:00
|
|
|
* Remove the ACB from whatever queue it's on. We have to do a bit of
|
|
|
|
* a hack to figure out which queue it's on. Note that it is *not*
|
|
|
|
* necessary to cdr down the ready queue, but we must cdr down the
|
|
|
|
* nexus queue and see if it's there, so we can mark the unit as no
|
|
|
|
* longer busy. This code is sickening, but it works.
|
1994-12-28 12:24:55 +03:00
|
|
|
*/
|
1995-08-18 19:27:29 +04:00
|
|
|
if (acb == sc->sc_nexus) {
|
|
|
|
sc->sc_nexus = NULL;
|
1997-08-27 15:22:52 +04:00
|
|
|
sc->sc_tinfo[slp->scsipi_scsi.target].lubusy &=
|
|
|
|
~(1<<slp->scsipi_scsi.lun);
|
1995-08-18 19:27:29 +04:00
|
|
|
if (sc->ready_list.tqh_first)
|
|
|
|
dosched = 1; /* start next command */
|
|
|
|
--sc->sc_active;
|
|
|
|
SIOP_TRACE('d','a',stat,0)
|
|
|
|
} else if (sc->ready_list.tqh_last == &acb->chain.tqe_next) {
|
|
|
|
TAILQ_REMOVE(&sc->ready_list, acb, chain);
|
|
|
|
SIOP_TRACE('d','r',stat,0)
|
1994-01-27 00:05:34 +03:00
|
|
|
} else {
|
1995-08-18 19:27:29 +04:00
|
|
|
register struct siop_acb *acb2;
|
|
|
|
for (acb2 = sc->nexus_list.tqh_first; acb2;
|
|
|
|
acb2 = acb2->chain.tqe_next)
|
|
|
|
if (acb2 == acb) {
|
|
|
|
TAILQ_REMOVE(&sc->nexus_list, acb, chain);
|
1997-08-27 15:22:52 +04:00
|
|
|
sc->sc_tinfo[slp->scsipi_scsi.target].lubusy
|
|
|
|
&= ~(1<<slp->scsipi_scsi.lun);
|
1995-08-18 19:27:29 +04:00
|
|
|
--sc->sc_active;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (acb2)
|
|
|
|
;
|
|
|
|
else if (acb->chain.tqe_next) {
|
|
|
|
TAILQ_REMOVE(&sc->ready_list, acb, chain);
|
|
|
|
--sc->sc_active;
|
|
|
|
} else {
|
1996-10-13 07:05:43 +04:00
|
|
|
printf("%s: can't find matching acb\n",
|
1995-08-18 19:27:29 +04:00
|
|
|
sc->sc_dev.dv_xname);
|
|
|
|
#ifdef DDB
|
|
|
|
/* Debugger(); */
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
SIOP_TRACE('d','n',stat,0);
|
1994-12-28 12:24:55 +03:00
|
|
|
}
|
1995-08-18 19:27:29 +04:00
|
|
|
/* Put it on the free list. */
|
|
|
|
acb->flags = ACB_FREE;
|
|
|
|
TAILQ_INSERT_HEAD(&sc->free_list, acb, chain);
|
1994-01-27 00:05:34 +03:00
|
|
|
|
1997-08-27 15:22:52 +04:00
|
|
|
sc->sc_tinfo[slp->scsipi_scsi.target].cmds++;
|
1995-08-13 00:30:45 +04:00
|
|
|
|
1997-08-27 15:22:52 +04:00
|
|
|
scsipi_done(xs);
|
1995-08-13 00:30:45 +04:00
|
|
|
|
1995-08-18 19:27:29 +04:00
|
|
|
if (dosched && sc->sc_nexus == NULL)
|
|
|
|
siop_sched(sc);
|
1994-05-12 09:56:28 +04:00
|
|
|
}
|
1994-01-27 00:05:34 +03:00
|
|
|
|
1994-05-12 09:56:28 +04:00
|
|
|
void
|
1995-02-12 22:18:33 +03:00
|
|
|
siopabort(sc, rp, where)
|
|
|
|
register struct siop_softc *sc;
|
|
|
|
siop_regmap_p rp;
|
1994-01-27 00:05:34 +03:00
|
|
|
char *where;
|
|
|
|
{
|
1996-04-22 01:10:48 +04:00
|
|
|
#ifdef fix_this
|
1994-12-28 12:24:55 +03:00
|
|
|
int i;
|
1996-04-22 01:10:48 +04:00
|
|
|
#endif
|
1994-01-27 00:05:34 +03:00
|
|
|
|
1996-10-13 07:05:43 +04:00
|
|
|
printf ("%s: abort %s: dstat %02x, sstat0 %02x sbcl %02x\n",
|
1995-02-12 22:18:33 +03:00
|
|
|
sc->sc_dev.dv_xname,
|
|
|
|
where, rp->siop_dstat, rp->siop_sstat0, rp->siop_sbcl);
|
1994-01-27 00:05:34 +03:00
|
|
|
|
1995-02-12 22:18:33 +03:00
|
|
|
if (sc->sc_active > 0) {
|
1994-01-27 00:05:34 +03:00
|
|
|
#ifdef TODO
|
1995-02-12 22:18:33 +03:00
|
|
|
SET_SBIC_cmd (rp, SBIC_CMD_ABORT);
|
|
|
|
WAIT_CIP (rp);
|
1994-01-27 00:05:34 +03:00
|
|
|
|
1995-02-12 22:18:33 +03:00
|
|
|
GET_SBIC_asr (rp, asr);
|
1994-01-27 00:05:34 +03:00
|
|
|
if (asr & (SBIC_ASR_BSY|SBIC_ASR_LCI))
|
|
|
|
{
|
|
|
|
/* ok, get more drastic.. */
|
1995-08-13 00:30:45 +04:00
|
|
|
|
1995-02-12 22:18:33 +03:00
|
|
|
SET_SBIC_cmd (rp, SBIC_CMD_RESET);
|
1994-06-13 12:12:30 +04:00
|
|
|
delay(25);
|
1995-02-12 22:18:33 +03:00
|
|
|
SBIC_WAIT(rp, SBIC_ASR_INT, 0);
|
|
|
|
GET_SBIC_csr (rp, csr); /* clears interrupt also */
|
1994-01-27 00:05:34 +03:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
do
|
|
|
|
{
|
1995-02-12 22:18:33 +03:00
|
|
|
SBIC_WAIT (rp, SBIC_ASR_INT, 0);
|
|
|
|
GET_SBIC_csr (rp, csr);
|
1994-01-27 00:05:34 +03:00
|
|
|
}
|
|
|
|
while ((csr != SBIC_CSR_DISC) && (csr != SBIC_CSR_DISC_1)
|
|
|
|
&& (csr != SBIC_CSR_CMD_INVALID));
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* lets just hope it worked.. */
|
1995-08-18 19:27:29 +04:00
|
|
|
#ifdef fix_this
|
1994-12-28 12:24:55 +03:00
|
|
|
for (i = 0; i < 2; ++i) {
|
1995-02-12 22:18:33 +03:00
|
|
|
if (sc->sc_iob[i].sc_xs && &sc->sc_iob[i] !=
|
|
|
|
sc->sc_cur) {
|
1996-10-13 07:05:43 +04:00
|
|
|
printf ("siopabort: cleanup!\n");
|
1995-02-12 22:18:33 +03:00
|
|
|
sc->sc_iob[i].sc_xs = NULL;
|
1994-12-28 12:24:55 +03:00
|
|
|
}
|
|
|
|
}
|
1995-08-18 19:27:29 +04:00
|
|
|
#endif /* fix_this */
|
|
|
|
/* sc->sc_active = 0; */
|
1994-05-12 09:56:28 +04:00
|
|
|
}
|
1994-01-27 00:05:34 +03:00
|
|
|
}
|
|
|
|
|
1994-06-14 04:58:05 +04:00
|
|
|
void
|
1995-02-12 22:18:33 +03:00
|
|
|
siopinitialize(sc)
|
|
|
|
struct siop_softc *sc;
|
1994-06-14 04:58:05 +04:00
|
|
|
{
|
1995-11-30 03:56:23 +03:00
|
|
|
int i;
|
|
|
|
u_int inhibit_sync;
|
|
|
|
extern u_long scsi_nosync;
|
|
|
|
extern int shift_nosync;
|
|
|
|
|
1994-06-14 04:58:05 +04:00
|
|
|
/*
|
1994-06-22 20:20:48 +04:00
|
|
|
* Need to check that scripts is on a long word boundary
|
1995-08-18 19:27:29 +04:00
|
|
|
* Also should verify that dev doesn't span non-contiguous
|
1994-06-22 20:20:48 +04:00
|
|
|
* physical pages.
|
1994-06-14 04:58:05 +04:00
|
|
|
*/
|
1996-04-22 01:10:48 +04:00
|
|
|
sc->sc_scriptspa = kvtop((caddr_t)scripts);
|
1996-02-03 21:47:07 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* malloc sc_acb to ensure that DS is on a long word boundary.
|
|
|
|
*/
|
|
|
|
|
|
|
|
MALLOC(sc->sc_acb, struct siop_acb *,
|
|
|
|
sizeof(struct siop_acb) * SIOP_NACB, M_DEVBUF, M_NOWAIT);
|
|
|
|
if (sc->sc_acb == NULL)
|
|
|
|
panic("siopinitialize: ACB malloc failed!");
|
|
|
|
|
1995-09-16 20:11:03 +04:00
|
|
|
sc->sc_tcp[1] = 1000 / sc->sc_clock_freq;
|
|
|
|
sc->sc_tcp[2] = 1500 / sc->sc_clock_freq;
|
|
|
|
sc->sc_tcp[3] = 2000 / sc->sc_clock_freq;
|
|
|
|
sc->sc_minsync = sc->sc_tcp[1]; /* in 4ns units */
|
|
|
|
if (sc->sc_minsync < 25)
|
|
|
|
sc->sc_minsync = 25;
|
|
|
|
if (sc->sc_clock_freq <= 25) {
|
1996-03-16 01:11:09 +03:00
|
|
|
sc->sc_dcntl |= 0x80; /* SCLK/1 */
|
1995-09-16 20:11:03 +04:00
|
|
|
sc->sc_tcp[0] = sc->sc_tcp[1];
|
|
|
|
} else if (sc->sc_clock_freq <= 37) {
|
1996-03-16 01:11:09 +03:00
|
|
|
sc->sc_dcntl |= 0x40; /* SCLK/1.5 */
|
1995-09-16 20:11:03 +04:00
|
|
|
sc->sc_tcp[0] = sc->sc_tcp[2];
|
|
|
|
} else if (sc->sc_clock_freq <= 50) {
|
1996-03-16 01:11:09 +03:00
|
|
|
sc->sc_dcntl |= 0x00; /* SCLK/2 */
|
1995-09-16 20:11:03 +04:00
|
|
|
sc->sc_tcp[0] = sc->sc_tcp[3];
|
|
|
|
} else {
|
1996-03-16 01:11:09 +03:00
|
|
|
sc->sc_dcntl |= 0xc0; /* SCLK/3 */
|
1995-09-16 20:11:03 +04:00
|
|
|
sc->sc_tcp[0] = 3000 / sc->sc_clock_freq;
|
|
|
|
}
|
1995-08-18 19:27:29 +04:00
|
|
|
|
1995-11-30 03:56:23 +03:00
|
|
|
if (scsi_nosync) {
|
|
|
|
inhibit_sync = (scsi_nosync >> shift_nosync) & 0xff;
|
|
|
|
shift_nosync += 8;
|
|
|
|
#ifdef DEBUG
|
|
|
|
if (inhibit_sync)
|
1996-10-13 07:05:43 +04:00
|
|
|
printf("%s: Inhibiting synchronous transfer %02x\n",
|
1995-11-30 03:56:23 +03:00
|
|
|
sc->sc_dev.dv_xname, inhibit_sync);
|
|
|
|
#endif
|
|
|
|
for (i = 0; i < 8; ++i)
|
|
|
|
if (inhibit_sync & (1 << i))
|
|
|
|
siop_inhibit_sync[i] = 1;
|
|
|
|
}
|
|
|
|
|
1995-02-12 22:18:33 +03:00
|
|
|
siopreset (sc);
|
1994-06-14 04:58:05 +04:00
|
|
|
}
|
|
|
|
|
1994-01-27 00:05:34 +03:00
|
|
|
void
|
1995-02-12 22:18:33 +03:00
|
|
|
siopreset(sc)
|
|
|
|
struct siop_softc *sc;
|
1994-01-27 00:05:34 +03:00
|
|
|
{
|
1995-02-12 22:18:33 +03:00
|
|
|
siop_regmap_p rp;
|
1994-01-27 00:05:34 +03:00
|
|
|
u_int i, s;
|
1995-08-18 19:27:29 +04:00
|
|
|
u_char dummy;
|
|
|
|
struct siop_acb *acb;
|
1994-01-27 00:05:34 +03:00
|
|
|
|
1995-02-12 22:18:33 +03:00
|
|
|
rp = sc->sc_siopp;
|
1994-05-12 09:56:28 +04:00
|
|
|
|
1995-02-12 22:18:33 +03:00
|
|
|
if (sc->sc_flags & SIOP_ALIVE)
|
|
|
|
siopabort(sc, rp, "reset");
|
1995-08-13 00:30:45 +04:00
|
|
|
|
1996-10-13 07:05:43 +04:00
|
|
|
printf("%s: ", sc->sc_dev.dv_xname); /* XXXX */
|
1994-01-27 00:05:34 +03:00
|
|
|
|
|
|
|
s = splbio();
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Reset the chip
|
|
|
|
* XXX - is this really needed?
|
|
|
|
*/
|
1995-02-12 22:18:33 +03:00
|
|
|
rp->siop_istat |= SIOP_ISTAT_ABRT; /* abort current script */
|
|
|
|
rp->siop_istat |= SIOP_ISTAT_RST; /* reset chip */
|
|
|
|
rp->siop_istat &= ~SIOP_ISTAT_RST;
|
1994-12-28 12:24:55 +03:00
|
|
|
/*
|
|
|
|
* Reset SCSI bus (do we really want this?)
|
|
|
|
*/
|
1995-08-18 19:27:29 +04:00
|
|
|
rp->siop_sien = 0;
|
1995-02-12 22:18:33 +03:00
|
|
|
rp->siop_scntl1 |= SIOP_SCNTL1_RST;
|
1994-12-28 12:24:55 +03:00
|
|
|
delay(1);
|
1995-02-12 22:18:33 +03:00
|
|
|
rp->siop_scntl1 &= ~SIOP_SCNTL1_RST;
|
1994-01-27 00:05:34 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Set up various chip parameters
|
|
|
|
*/
|
1995-02-12 22:18:33 +03:00
|
|
|
rp->siop_scntl0 = SIOP_ARB_FULL | SIOP_SCNTL0_EPC | SIOP_SCNTL0_EPG;
|
1995-08-18 19:27:29 +04:00
|
|
|
rp->siop_scntl1 = SIOP_SCNTL1_ESR;
|
1995-09-16 20:11:03 +04:00
|
|
|
rp->siop_dcntl = sc->sc_dcntl;
|
1995-02-12 22:18:33 +03:00
|
|
|
rp->siop_dmode = 0x80; /* burst length = 4 */
|
|
|
|
rp->siop_sien = 0x00; /* don't enable interrupts yet */
|
|
|
|
rp->siop_dien = 0x00; /* don't enable interrupts yet */
|
1997-08-27 15:22:52 +04:00
|
|
|
rp->siop_scid = 1 << sc->sc_link.scsipi_scsi.adapter_target;
|
1995-02-12 22:18:33 +03:00
|
|
|
rp->siop_dwt = 0x00;
|
|
|
|
rp->siop_ctest0 |= SIOP_CTEST0_BTD | SIOP_CTEST0_EAN;
|
1995-09-16 20:11:03 +04:00
|
|
|
rp->siop_ctest7 |= sc->sc_ctest7;
|
1994-01-27 00:05:34 +03:00
|
|
|
|
|
|
|
/* will need to re-negotiate sync xfers */
|
1995-02-12 22:18:33 +03:00
|
|
|
bzero(&sc->sc_sync, sizeof (sc->sc_sync));
|
1994-01-27 00:05:34 +03:00
|
|
|
|
1995-02-12 22:18:33 +03:00
|
|
|
i = rp->siop_istat;
|
1994-12-28 12:24:55 +03:00
|
|
|
if (i & SIOP_ISTAT_SIP)
|
1995-02-12 22:18:33 +03:00
|
|
|
dummy = rp->siop_sstat0;
|
1994-12-28 12:24:55 +03:00
|
|
|
if (i & SIOP_ISTAT_DIP)
|
1995-02-12 22:18:33 +03:00
|
|
|
dummy = rp->siop_dstat;
|
1994-12-28 12:24:55 +03:00
|
|
|
|
1994-01-27 00:05:34 +03:00
|
|
|
splx (s);
|
|
|
|
|
1995-08-18 19:27:29 +04:00
|
|
|
delay (siop_reset_delay * 1000);
|
1997-08-27 15:22:52 +04:00
|
|
|
printf("siop id %d reset V%d\n", sc->sc_link.scsipi_scsi.adapter_target,
|
1995-08-18 19:27:29 +04:00
|
|
|
rp->siop_ctest8 >> 4);
|
|
|
|
|
|
|
|
if ((sc->sc_flags & SIOP_ALIVE) == 0) {
|
|
|
|
TAILQ_INIT(&sc->ready_list);
|
|
|
|
TAILQ_INIT(&sc->nexus_list);
|
|
|
|
TAILQ_INIT(&sc->free_list);
|
|
|
|
sc->sc_nexus = NULL;
|
|
|
|
acb = sc->sc_acb;
|
1996-02-03 21:47:07 +03:00
|
|
|
bzero(acb, sizeof(struct siop_acb) * SIOP_NACB);
|
|
|
|
for (i = 0; i < SIOP_NACB; i++) {
|
1995-08-18 19:27:29 +04:00
|
|
|
TAILQ_INSERT_TAIL(&sc->free_list, acb, chain);
|
|
|
|
acb++;
|
|
|
|
}
|
|
|
|
bzero(sc->sc_tinfo, sizeof(sc->sc_tinfo));
|
|
|
|
} else {
|
|
|
|
if (sc->sc_nexus != NULL) {
|
|
|
|
sc->sc_nexus->xs->error = XS_DRIVER_STUFFUP;
|
|
|
|
siop_scsidone(sc->sc_nexus, sc->sc_nexus->stat[0]);
|
|
|
|
}
|
1996-04-22 01:10:48 +04:00
|
|
|
while ((acb = sc->nexus_list.tqh_first) > 0) {
|
1995-08-18 19:27:29 +04:00
|
|
|
acb->xs->error = XS_DRIVER_STUFFUP;
|
|
|
|
siop_scsidone(acb, acb->stat[0]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1995-02-12 22:18:33 +03:00
|
|
|
sc->sc_flags |= SIOP_ALIVE;
|
1995-08-18 19:27:29 +04:00
|
|
|
sc->sc_flags &= ~(SIOP_INTDEFER|SIOP_INTSOFF);
|
|
|
|
/* enable SCSI and DMA interrupts */
|
|
|
|
sc->sc_sien = SIOP_SIEN_M_A | SIOP_SIEN_STO | /*SIOP_SIEN_SEL |*/ SIOP_SIEN_SGE |
|
|
|
|
SIOP_SIEN_UDC | SIOP_SIEN_RST | SIOP_SIEN_PAR;
|
|
|
|
sc->sc_dien = SIOP_DIEN_BF | SIOP_DIEN_ABRT | SIOP_DIEN_SIR |
|
|
|
|
/*SIOP_DIEN_WTD |*/ SIOP_DIEN_IID;
|
|
|
|
rp->siop_sien = sc->sc_sien;
|
|
|
|
rp->siop_dien = sc->sc_dien;
|
1994-01-27 00:05:34 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Setup Data Storage for 53C710 and start SCRIPTS processing
|
|
|
|
*/
|
|
|
|
|
1994-05-12 09:56:28 +04:00
|
|
|
void
|
1995-08-18 19:27:29 +04:00
|
|
|
siop_start (sc, target, lun, cbuf, clen, buf, len)
|
1995-02-12 22:18:33 +03:00
|
|
|
struct siop_softc *sc;
|
1994-01-27 00:05:34 +03:00
|
|
|
int target;
|
1994-12-28 12:24:55 +03:00
|
|
|
int lun;
|
1994-01-27 00:05:34 +03:00
|
|
|
u_char *cbuf;
|
|
|
|
int clen;
|
|
|
|
u_char *buf;
|
|
|
|
int len;
|
|
|
|
{
|
1995-02-12 22:18:33 +03:00
|
|
|
siop_regmap_p rp = sc->sc_siopp;
|
1994-01-27 00:05:34 +03:00
|
|
|
int nchain;
|
|
|
|
int count, tcount;
|
|
|
|
char *addr, *dmaend;
|
1995-08-18 19:27:29 +04:00
|
|
|
struct siop_acb *acb = sc->sc_nexus;
|
1996-04-24 02:53:05 +04:00
|
|
|
#ifdef DEBUG
|
|
|
|
int i;
|
|
|
|
#endif
|
1994-01-27 00:05:34 +03:00
|
|
|
|
1994-12-28 12:24:55 +03:00
|
|
|
#ifdef DEBUG
|
1995-08-18 19:27:29 +04:00
|
|
|
if (siop_debug & 0x100 && rp->siop_sbcl & SIOP_BSY) {
|
1996-10-13 07:05:43 +04:00
|
|
|
printf ("ACK! siop was busy: rp %p script %p dsa %p active %ld\n",
|
1995-08-18 19:27:29 +04:00
|
|
|
rp, &scripts, &acb->ds, sc->sc_active);
|
1996-10-13 07:05:43 +04:00
|
|
|
printf ("istat %02x sfbr %02x lcrc %02x sien %02x dien %02x\n",
|
1995-08-18 19:27:29 +04:00
|
|
|
rp->siop_istat, rp->siop_sfbr, rp->siop_lcrc,
|
|
|
|
rp->siop_sien, rp->siop_dien);
|
|
|
|
#ifdef DDB
|
1994-12-28 12:24:55 +03:00
|
|
|
/*Debugger();*/
|
|
|
|
#endif
|
|
|
|
}
|
1995-08-18 19:27:29 +04:00
|
|
|
#endif
|
|
|
|
acb->msgout[0] = MSG_IDENTIFY | lun;
|
|
|
|
if (siop_allow_disc[target] & 2 ||
|
|
|
|
(siop_allow_disc[target] && len == 0))
|
|
|
|
acb->msgout[0] = MSG_IDENTIFY_DR | lun;
|
|
|
|
acb->status = 0;
|
|
|
|
acb->stat[0] = -1;
|
|
|
|
acb->msg[0] = -1;
|
1995-09-16 20:11:03 +04:00
|
|
|
acb->ds.scsi_addr = (0x10000 << target) | (sc->sc_sync[target].sxfer << 8);
|
1995-08-18 19:27:29 +04:00
|
|
|
acb->ds.idlen = 1;
|
|
|
|
acb->ds.idbuf = (char *) kvtop(&acb->msgout[0]);
|
|
|
|
acb->ds.cmdlen = clen;
|
|
|
|
acb->ds.cmdbuf = (char *) kvtop(cbuf);
|
|
|
|
acb->ds.stslen = 1;
|
|
|
|
acb->ds.stsbuf = (char *) kvtop(&acb->stat[0]);
|
|
|
|
acb->ds.msglen = 1;
|
|
|
|
acb->ds.msgbuf = (char *) kvtop(&acb->msg[0]);
|
|
|
|
acb->msg[1] = -1;
|
|
|
|
acb->ds.msginlen = 1;
|
|
|
|
acb->ds.extmsglen = 1;
|
|
|
|
acb->ds.synmsglen = 3;
|
|
|
|
acb->ds.msginbuf = (char *) kvtop(&acb->msg[1]);
|
|
|
|
acb->ds.extmsgbuf = (char *) kvtop(&acb->msg[2]);
|
|
|
|
acb->ds.synmsgbuf = (char *) kvtop(&acb->msg[3]);
|
|
|
|
bzero(&acb->ds.chain, sizeof (acb->ds.chain));
|
1994-01-27 00:05:34 +03:00
|
|
|
|
1995-02-12 22:18:33 +03:00
|
|
|
if (sc->sc_sync[target].state == SYNC_START) {
|
1994-05-12 09:56:28 +04:00
|
|
|
if (siop_inhibit_sync[target]) {
|
1995-02-12 22:18:33 +03:00
|
|
|
sc->sc_sync[target].state = SYNC_DONE;
|
1995-09-16 20:11:03 +04:00
|
|
|
sc->sc_sync[target].sbcl = 0;
|
|
|
|
sc->sc_sync[target].sxfer = 0;
|
1994-01-27 00:05:34 +03:00
|
|
|
#ifdef DEBUG
|
|
|
|
if (siopsync_debug)
|
1996-10-13 07:05:43 +04:00
|
|
|
printf ("Forcing target %d asynchronous\n", target);
|
1994-01-27 00:05:34 +03:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
else {
|
1995-08-18 19:27:29 +04:00
|
|
|
acb->msg[2] = -1;
|
|
|
|
acb->msgout[1] = MSG_EXT_MESSAGE;
|
|
|
|
acb->msgout[2] = 3;
|
|
|
|
acb->msgout[3] = MSG_SYNC_REQ;
|
|
|
|
#ifdef MAXTOR_SYNC_KLUDGE
|
|
|
|
acb->msgout[4] = 50 / 4; /* ask for ridiculous period */
|
|
|
|
#else
|
1995-09-16 20:11:03 +04:00
|
|
|
acb->msgout[4] = sc->sc_minsync;
|
1995-08-18 19:27:29 +04:00
|
|
|
#endif
|
|
|
|
acb->msgout[5] = SIOP_MAX_OFFSET;
|
|
|
|
acb->ds.idlen = 6;
|
1995-02-12 22:18:33 +03:00
|
|
|
sc->sc_sync[target].state = SYNC_SENT;
|
1994-01-27 00:05:34 +03:00
|
|
|
#ifdef DEBUG
|
|
|
|
if (siopsync_debug)
|
1996-10-13 07:05:43 +04:00
|
|
|
printf ("Sending sync request to target %d\n", target);
|
1994-01-27 00:05:34 +03:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
1995-08-18 19:27:29 +04:00
|
|
|
* Build physical DMA addresses for scatter/gather I/O
|
1994-01-27 00:05:34 +03:00
|
|
|
*/
|
1995-08-18 19:27:29 +04:00
|
|
|
acb->iob_buf = buf;
|
|
|
|
acb->iob_len = len;
|
|
|
|
acb->iob_curbuf = acb->iob_curlen = 0;
|
1994-01-27 00:05:34 +03:00
|
|
|
nchain = 0;
|
|
|
|
count = len;
|
|
|
|
addr = buf;
|
|
|
|
dmaend = NULL;
|
|
|
|
while (count > 0) {
|
1995-08-18 19:27:29 +04:00
|
|
|
acb->ds.chain[nchain].databuf = (char *) kvtop (addr);
|
1994-01-27 00:05:34 +03:00
|
|
|
if (count < (tcount = NBPG - ((int) addr & PGOFSET)))
|
|
|
|
tcount = count;
|
1995-08-18 19:27:29 +04:00
|
|
|
acb->ds.chain[nchain].datalen = tcount;
|
1994-01-27 00:05:34 +03:00
|
|
|
addr += tcount;
|
|
|
|
count -= tcount;
|
1995-08-18 19:27:29 +04:00
|
|
|
if (acb->ds.chain[nchain].databuf == dmaend) {
|
|
|
|
dmaend += acb->ds.chain[nchain].datalen;
|
|
|
|
acb->ds.chain[nchain].datalen = 0;
|
|
|
|
acb->ds.chain[--nchain].datalen += tcount;
|
1994-01-27 00:05:34 +03:00
|
|
|
#ifdef DEBUG
|
|
|
|
++siopdma_hits;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
else {
|
1995-08-18 19:27:29 +04:00
|
|
|
dmaend = acb->ds.chain[nchain].databuf +
|
|
|
|
acb->ds.chain[nchain].datalen;
|
|
|
|
acb->ds.chain[nchain].datalen = tcount;
|
1994-01-27 00:05:34 +03:00
|
|
|
#ifdef DEBUG
|
1994-06-22 20:20:48 +04:00
|
|
|
if (nchain) /* Don't count miss on first one */
|
|
|
|
++siopdma_misses;
|
1994-01-27 00:05:34 +03:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
++nchain;
|
|
|
|
}
|
|
|
|
#ifdef DEBUG
|
|
|
|
if (nchain != 1 && len != 0 && siop_debug & 3) {
|
1996-10-13 07:05:43 +04:00
|
|
|
printf ("DMA chaining set: %d\n", nchain);
|
1994-01-27 00:05:34 +03:00
|
|
|
for (i = 0; i < nchain; ++i) {
|
1996-10-13 07:05:43 +04:00
|
|
|
printf (" [%d] %8p %lx\n", i, acb->ds.chain[i].databuf,
|
1995-08-18 19:27:29 +04:00
|
|
|
acb->ds.chain[i].datalen);
|
1994-01-27 00:05:34 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
1995-08-18 19:27:29 +04:00
|
|
|
/* push data cache for all data the 53c710 needs to access */
|
1996-04-22 01:10:48 +04:00
|
|
|
dma_cachectl ((caddr_t)acb, sizeof (struct siop_acb));
|
1994-06-14 04:58:05 +04:00
|
|
|
dma_cachectl (cbuf, clen);
|
|
|
|
if (buf != NULL && len != 0)
|
|
|
|
dma_cachectl (buf, len);
|
1995-08-18 19:27:29 +04:00
|
|
|
#ifdef DEBUG
|
|
|
|
if (siop_debug & 0x100 && rp->siop_sbcl & SIOP_BSY) {
|
1996-10-13 07:05:43 +04:00
|
|
|
printf ("ACK! siop was busy at start: rp %p script %p dsa %p active %ld\n",
|
1995-08-18 19:27:29 +04:00
|
|
|
rp, &scripts, &acb->ds, sc->sc_active);
|
|
|
|
#ifdef DDB
|
|
|
|
/*Debugger();*/
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
if (sc->nexus_list.tqh_first == NULL) {
|
|
|
|
if (rp->siop_istat & SIOP_ISTAT_CON)
|
1996-10-13 07:05:43 +04:00
|
|
|
printf("%s: siop_select while connected?\n",
|
1995-08-18 19:27:29 +04:00
|
|
|
sc->sc_dev.dv_xname);
|
|
|
|
rp->siop_temp = 0;
|
1995-09-16 20:11:03 +04:00
|
|
|
rp->siop_sbcl = sc->sc_sync[target].sbcl;
|
1996-04-22 01:10:48 +04:00
|
|
|
rp->siop_dsa = kvtop((caddr_t)&acb->ds);
|
1995-02-12 22:18:33 +03:00
|
|
|
rp->siop_dsp = sc->sc_scriptspa;
|
1995-08-18 19:27:29 +04:00
|
|
|
SIOP_TRACE('s',1,0,0)
|
1994-12-28 12:24:55 +03:00
|
|
|
} else {
|
1995-08-18 19:27:29 +04:00
|
|
|
if ((rp->siop_istat & SIOP_ISTAT_CON) == 0) {
|
|
|
|
rp->siop_istat = SIOP_ISTAT_SIGP;
|
|
|
|
SIOP_TRACE('s',2,0,0);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
SIOP_TRACE('s',3,rp->siop_istat,0);
|
|
|
|
}
|
1994-12-28 12:24:55 +03:00
|
|
|
}
|
|
|
|
#ifdef DEBUG
|
|
|
|
++siopstarts;
|
|
|
|
#endif
|
1994-01-27 00:05:34 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Process a DMA or SCSI interrupt from the 53C710 SIOP
|
|
|
|
*/
|
|
|
|
|
1994-05-12 09:56:28 +04:00
|
|
|
int
|
1995-02-12 22:18:33 +03:00
|
|
|
siop_checkintr(sc, istat, dstat, sstat0, status)
|
|
|
|
struct siop_softc *sc;
|
1994-01-27 00:05:34 +03:00
|
|
|
u_char istat;
|
|
|
|
u_char dstat;
|
|
|
|
u_char sstat0;
|
|
|
|
int *status;
|
|
|
|
{
|
1995-02-12 22:18:33 +03:00
|
|
|
siop_regmap_p rp = sc->sc_siopp;
|
1995-08-18 19:27:29 +04:00
|
|
|
struct siop_acb *acb = sc->sc_nexus;
|
1996-04-22 01:10:48 +04:00
|
|
|
int target = 0;
|
1994-12-28 12:24:55 +03:00
|
|
|
int dfifo, dbc, sstat1;
|
1994-01-27 00:05:34 +03:00
|
|
|
|
1995-02-12 22:18:33 +03:00
|
|
|
dfifo = rp->siop_dfifo;
|
|
|
|
dbc = rp->siop_dbc0;
|
|
|
|
sstat1 = rp->siop_sstat1;
|
|
|
|
rp->siop_ctest8 |= SIOP_CTEST8_CLF;
|
1995-08-18 19:27:29 +04:00
|
|
|
while ((rp->siop_ctest1 & SIOP_CTEST1_FMT) != SIOP_CTEST1_FMT)
|
1994-01-27 00:05:34 +03:00
|
|
|
;
|
1995-02-12 22:18:33 +03:00
|
|
|
rp->siop_ctest8 &= ~SIOP_CTEST8_CLF;
|
1994-01-27 00:05:34 +03:00
|
|
|
#ifdef DEBUG
|
1994-12-28 12:24:55 +03:00
|
|
|
++siopints;
|
1995-08-18 19:27:29 +04:00
|
|
|
#if 0
|
1994-12-28 12:24:55 +03:00
|
|
|
if (siop_debug & 0x100) {
|
1995-08-18 19:27:29 +04:00
|
|
|
DCIAS(&acb->stat[0]); /* XXX */
|
1996-10-13 07:05:43 +04:00
|
|
|
printf ("siopchkintr: istat %x dstat %x sstat0 %x dsps %x sbcl %x sts %x msg %x\n",
|
1995-08-18 19:27:29 +04:00
|
|
|
istat, dstat, sstat0, rp->siop_dsps, rp->siop_sbcl, acb->stat[0], acb->msg[0]);
|
1996-10-13 07:05:43 +04:00
|
|
|
printf ("sync msg in: %02x %02x %02x %02x %02x %02x\n",
|
1995-08-18 19:27:29 +04:00
|
|
|
acb->msg[0], acb->msg[1], acb->msg[2],
|
|
|
|
acb->msg[3], acb->msg[4], acb->msg[5]);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
if (rp->siop_dsp && (rp->siop_dsp < sc->sc_scriptspa ||
|
|
|
|
rp->siop_dsp >= sc->sc_scriptspa + sizeof(scripts))) {
|
1996-10-13 07:05:43 +04:00
|
|
|
printf ("%s: dsp not within script dsp %lx scripts %lx:%lx",
|
1995-08-18 19:27:29 +04:00
|
|
|
sc->sc_dev.dv_xname, rp->siop_dsp, sc->sc_scriptspa,
|
|
|
|
sc->sc_scriptspa + sizeof(scripts));
|
1996-10-13 07:05:43 +04:00
|
|
|
printf(" istat %x dstat %x sstat0 %x\n",
|
1995-08-18 19:27:29 +04:00
|
|
|
istat, dstat, sstat0);
|
1996-04-28 10:28:24 +04:00
|
|
|
#ifdef DDB
|
1995-08-18 19:27:29 +04:00
|
|
|
Debugger();
|
1996-04-28 10:28:24 +04:00
|
|
|
#endif
|
1994-01-27 00:05:34 +03:00
|
|
|
}
|
|
|
|
#endif
|
1995-08-18 19:27:29 +04:00
|
|
|
SIOP_TRACE('i',dstat,istat,(istat&SIOP_ISTAT_DIP)?rp->siop_dsps&0xff:sstat0);
|
1995-02-12 22:18:33 +03:00
|
|
|
if (dstat & SIOP_DSTAT_SIR && rp->siop_dsps == 0xff00) {
|
1994-01-27 00:05:34 +03:00
|
|
|
/* Normal completion status, or check condition */
|
1995-08-18 19:27:29 +04:00
|
|
|
#ifdef DEBUG
|
1996-04-22 01:10:48 +04:00
|
|
|
if (rp->siop_dsa != kvtop((caddr_t)&acb->ds)) {
|
1996-10-13 07:05:43 +04:00
|
|
|
printf ("siop: invalid dsa: %lx %x\n", rp->siop_dsa,
|
1996-04-22 01:10:48 +04:00
|
|
|
kvtop((caddr_t)&acb->ds));
|
1994-01-27 00:05:34 +03:00
|
|
|
panic("*** siop DSA invalid ***");
|
|
|
|
}
|
1995-08-18 19:27:29 +04:00
|
|
|
#endif
|
1997-08-27 15:22:52 +04:00
|
|
|
target = acb->xs->sc_link->scsipi_scsi.target;
|
1995-02-12 22:18:33 +03:00
|
|
|
if (sc->sc_sync[target].state == SYNC_SENT) {
|
1994-01-27 00:05:34 +03:00
|
|
|
#ifdef DEBUG
|
|
|
|
if (siopsync_debug)
|
1996-10-13 07:05:43 +04:00
|
|
|
printf ("sync msg in: %02x %02x %02x %02x %02x %02x\n",
|
1995-08-18 19:27:29 +04:00
|
|
|
acb->msg[0], acb->msg[1], acb->msg[2],
|
|
|
|
acb->msg[3], acb->msg[4], acb->msg[5]);
|
1994-01-27 00:05:34 +03:00
|
|
|
#endif
|
1995-08-18 19:27:29 +04:00
|
|
|
if (acb->msg[1] == 0xff)
|
1996-10-13 07:05:43 +04:00
|
|
|
printf ("%s: target %d ignored sync request\n",
|
1995-02-12 22:18:33 +03:00
|
|
|
sc->sc_dev.dv_xname, target);
|
1995-08-18 19:27:29 +04:00
|
|
|
else if (acb->msg[1] == MSG_REJECT)
|
1996-10-13 07:05:43 +04:00
|
|
|
printf ("%s: target %d rejected sync request\n",
|
1995-02-12 22:18:33 +03:00
|
|
|
sc->sc_dev.dv_xname, target);
|
|
|
|
sc->sc_sync[target].state = SYNC_DONE;
|
1995-09-16 20:11:03 +04:00
|
|
|
sc->sc_sync[target].sxfer = 0;
|
|
|
|
sc->sc_sync[target].sbcl = 0;
|
1995-08-18 19:27:29 +04:00
|
|
|
if (acb->msg[2] == 3 &&
|
|
|
|
acb->msg[3] == MSG_SYNC_REQ &&
|
|
|
|
acb->msg[5] != 0) {
|
|
|
|
#ifdef MAXTOR_KLUDGE
|
|
|
|
/*
|
|
|
|
* Kludge for my Maxtor XT8580S
|
|
|
|
* It accepts whatever we request, even
|
|
|
|
* though it won't work. So we ask for
|
|
|
|
* a short period than we can handle. If
|
|
|
|
* the device says it can do it, use 208ns.
|
|
|
|
* If the device says it can do less than
|
|
|
|
* 100ns, then we limit it to 100ns.
|
|
|
|
*/
|
|
|
|
if (acb->msg[4] && acb->msg[4] < 100 / 4) {
|
1994-05-12 09:56:28 +04:00
|
|
|
#ifdef DEBUG
|
1996-10-13 07:05:43 +04:00
|
|
|
printf ("%d: target %d wanted %dns period\n",
|
1995-02-12 22:18:33 +03:00
|
|
|
sc->sc_dev.dv_xname, target,
|
1995-08-18 19:27:29 +04:00
|
|
|
acb->msg[4] * 4);
|
1994-05-12 09:56:28 +04:00
|
|
|
#endif
|
1995-08-18 19:27:29 +04:00
|
|
|
if (acb->msg[4] == 50 / 4)
|
|
|
|
acb->msg[4] = 208 / 4;
|
1994-05-12 09:56:28 +04:00
|
|
|
else
|
1995-08-18 19:27:29 +04:00
|
|
|
acb->msg[4] = 100 / 4;
|
1994-05-12 09:56:28 +04:00
|
|
|
}
|
1995-08-18 19:27:29 +04:00
|
|
|
#endif /* MAXTOR_KLUDGE */
|
1996-10-13 07:05:43 +04:00
|
|
|
printf ("%s: target %d now synchronous, period=%dns, offset=%d\n",
|
1995-02-12 22:18:33 +03:00
|
|
|
sc->sc_dev.dv_xname, target,
|
1995-08-18 19:27:29 +04:00
|
|
|
acb->msg[4] * 4, acb->msg[5]);
|
1995-02-12 22:18:33 +03:00
|
|
|
scsi_period_to_siop (sc, target);
|
1994-01-27 00:05:34 +03:00
|
|
|
}
|
|
|
|
}
|
1995-08-18 19:27:29 +04:00
|
|
|
dma_cachectl(&acb->stat[0], 1);
|
|
|
|
*status = acb->stat[0];
|
1994-12-28 12:24:55 +03:00
|
|
|
#ifdef DEBUG
|
1995-02-12 22:18:33 +03:00
|
|
|
if (rp->siop_sbcl & SIOP_BSY) {
|
1996-10-13 07:05:43 +04:00
|
|
|
/*printf ("ACK! siop was busy at end: rp %x script %x dsa %x\n",
|
1995-08-18 19:27:29 +04:00
|
|
|
rp, &scripts, &acb->ds);*/
|
|
|
|
#ifdef DDB
|
1994-12-28 12:24:55 +03:00
|
|
|
/*Debugger();*/
|
1995-08-18 19:27:29 +04:00
|
|
|
#endif
|
1994-12-28 12:24:55 +03:00
|
|
|
}
|
1995-08-18 19:27:29 +04:00
|
|
|
if (acb->msg[0] != 0x00)
|
1996-10-13 07:05:43 +04:00
|
|
|
printf("%s: message was not COMMAND COMPLETE: %x\n",
|
1995-08-18 19:27:29 +04:00
|
|
|
sc->sc_dev.dv_xname, acb->msg[0]);
|
1994-12-28 12:24:55 +03:00
|
|
|
#endif
|
1995-08-18 19:27:29 +04:00
|
|
|
if (sc->nexus_list.tqh_first)
|
1995-02-12 22:18:33 +03:00
|
|
|
rp->siop_dcntl |= SIOP_DCNTL_STD;
|
1994-01-27 00:05:34 +03:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
if (sstat0 & SIOP_SSTAT0_M_A) { /* Phase mismatch */
|
|
|
|
#ifdef DEBUG
|
1994-12-28 12:24:55 +03:00
|
|
|
++siopphmm;
|
1995-08-18 19:27:29 +04:00
|
|
|
if (acb == NULL)
|
1996-10-13 07:05:43 +04:00
|
|
|
printf("%s: Phase mismatch with no active command?\n",
|
1995-08-18 19:27:29 +04:00
|
|
|
sc->sc_dev.dv_xname);
|
|
|
|
#endif
|
|
|
|
if (acb->iob_len) {
|
1994-12-28 12:24:55 +03:00
|
|
|
int adjust;
|
|
|
|
adjust = ((dfifo - (dbc & 0x7f)) & 0x7f);
|
|
|
|
if (sstat1 & SIOP_SSTAT1_ORF)
|
|
|
|
++adjust;
|
|
|
|
if (sstat1 & SIOP_SSTAT1_OLF)
|
|
|
|
++adjust;
|
1995-08-18 19:27:29 +04:00
|
|
|
acb->iob_curlen = *((long *)&rp->siop_dcmd) & 0xffffff;
|
|
|
|
acb->iob_curlen += adjust;
|
|
|
|
acb->iob_curbuf = *((long *)&rp->siop_dnad) - adjust;
|
1994-12-28 12:24:55 +03:00
|
|
|
#ifdef DEBUG
|
1995-08-18 19:27:29 +04:00
|
|
|
if (siop_debug & 0x100) {
|
|
|
|
int i;
|
1996-10-13 07:05:43 +04:00
|
|
|
printf ("Phase mismatch: curbuf %lx curlen %lx dfifo %x dbc %x sstat1 %x adjust %x sbcl %x starts %d acb %p\n",
|
1995-08-18 19:27:29 +04:00
|
|
|
acb->iob_curbuf, acb->iob_curlen, dfifo,
|
|
|
|
dbc, sstat1, adjust, rp->siop_sbcl, siopstarts, acb);
|
|
|
|
if (acb->ds.chain[1].datalen) {
|
|
|
|
for (i = 0; acb->ds.chain[i].datalen; ++i)
|
1996-10-13 07:05:43 +04:00
|
|
|
printf("chain[%d] addr %p len %lx\n",
|
1995-08-18 19:27:29 +04:00
|
|
|
i, acb->ds.chain[i].databuf,
|
|
|
|
acb->ds.chain[i].datalen);
|
|
|
|
}
|
|
|
|
}
|
1994-12-28 12:24:55 +03:00
|
|
|
#endif
|
1996-04-22 01:10:48 +04:00
|
|
|
dma_cachectl ((caddr_t)acb, sizeof(*acb));
|
1994-12-28 12:24:55 +03:00
|
|
|
}
|
1995-08-18 19:27:29 +04:00
|
|
|
#ifdef DEBUG
|
|
|
|
SIOP_TRACE('m',rp->siop_sbcl,(rp->siop_dsp>>8),rp->siop_dsp);
|
1994-01-27 00:05:34 +03:00
|
|
|
if (siop_debug & 9)
|
1996-10-13 07:05:43 +04:00
|
|
|
printf ("Phase mismatch: %x dsp +%lx dcmd %lx\n",
|
1995-02-12 22:18:33 +03:00
|
|
|
rp->siop_sbcl,
|
|
|
|
rp->siop_dsp - sc->sc_scriptspa,
|
|
|
|
*((long *)&rp->siop_dcmd));
|
1994-01-27 00:05:34 +03:00
|
|
|
#endif
|
1995-08-18 19:27:29 +04:00
|
|
|
if ((rp->siop_sbcl & SIOP_REQ) == 0) {
|
1996-10-13 07:05:43 +04:00
|
|
|
printf ("Phase mismatch: REQ not asserted! %02x dsp %lx\n",
|
1995-08-18 19:27:29 +04:00
|
|
|
rp->siop_sbcl, rp->siop_dsp);
|
1996-04-28 10:28:24 +04:00
|
|
|
#if defined(DEBUG) && defined(DDB)
|
1995-08-18 19:27:29 +04:00
|
|
|
Debugger();
|
|
|
|
#endif
|
|
|
|
}
|
1995-02-12 22:18:33 +03:00
|
|
|
switch (rp->siop_sbcl & 7) {
|
1994-12-28 12:24:55 +03:00
|
|
|
case 0: /* data out */
|
|
|
|
case 1: /* data in */
|
|
|
|
case 2: /* status */
|
|
|
|
case 3: /* command */
|
|
|
|
case 6: /* message in */
|
|
|
|
case 7: /* message out */
|
1995-02-12 22:18:33 +03:00
|
|
|
rp->siop_dsp = sc->sc_scriptspa + Ent_switch;
|
1994-01-27 00:05:34 +03:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
goto bad_phase;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
if (sstat0 & SIOP_SSTAT0_STO) { /* Select timed out */
|
|
|
|
#ifdef DEBUG
|
1995-08-18 19:27:29 +04:00
|
|
|
if (acb == NULL)
|
1996-10-13 07:05:43 +04:00
|
|
|
printf("%s: Select timeout with no active command?\n",
|
1995-08-18 19:27:29 +04:00
|
|
|
sc->sc_dev.dv_xname);
|
1995-02-12 22:18:33 +03:00
|
|
|
if (rp->siop_sbcl & SIOP_BSY) {
|
1996-10-13 07:05:43 +04:00
|
|
|
printf ("ACK! siop was busy at timeout: rp %p script %p dsa %p\n",
|
1995-08-18 19:27:29 +04:00
|
|
|
rp, &scripts, &acb->ds);
|
1996-10-13 07:05:43 +04:00
|
|
|
printf(" sbcl %x sdid %x istat %x dstat %x sstat0 %x\n",
|
1995-02-12 22:18:33 +03:00
|
|
|
rp->siop_sbcl, rp->siop_sdid, istat, dstat, sstat0);
|
1995-08-18 19:27:29 +04:00
|
|
|
if (!(rp->siop_sbcl & SIOP_BSY)) {
|
1996-10-13 07:05:43 +04:00
|
|
|
printf ("Yikes, it's not busy now!\n");
|
1994-12-28 12:24:55 +03:00
|
|
|
#if 0
|
1995-08-18 19:27:29 +04:00
|
|
|
*status = -1;
|
|
|
|
if (sc->nexus_list.tqh_first)
|
|
|
|
rp->siop_dsp = sc->sc_scriptspa + Ent_wait_reselect;
|
|
|
|
return 1;
|
1994-01-27 00:05:34 +03:00
|
|
|
#endif
|
1995-08-18 19:27:29 +04:00
|
|
|
}
|
1995-02-12 22:18:33 +03:00
|
|
|
/* rp->siop_dcntl |= SIOP_DCNTL_STD;*/
|
1994-01-27 00:05:34 +03:00
|
|
|
return (0);
|
1995-08-18 19:27:29 +04:00
|
|
|
#ifdef DDB
|
1994-12-28 12:24:55 +03:00
|
|
|
Debugger();
|
1995-08-18 19:27:29 +04:00
|
|
|
#endif
|
1994-01-27 00:05:34 +03:00
|
|
|
}
|
1994-12-28 12:24:55 +03:00
|
|
|
#endif
|
|
|
|
*status = -1;
|
1995-08-18 19:27:29 +04:00
|
|
|
acb->xs->error = XS_SELTIMEOUT;
|
|
|
|
if (sc->nexus_list.tqh_first)
|
1995-02-12 22:18:33 +03:00
|
|
|
rp->siop_dsp = sc->sc_scriptspa + Ent_wait_reselect;
|
1994-12-28 12:24:55 +03:00
|
|
|
return 1;
|
1994-01-27 00:05:34 +03:00
|
|
|
}
|
1995-08-18 19:27:29 +04:00
|
|
|
if (acb)
|
1997-08-27 15:22:52 +04:00
|
|
|
target = acb->xs->sc_link->scsipi_scsi.target;
|
1995-08-18 19:27:29 +04:00
|
|
|
else
|
|
|
|
target = 7;
|
1994-12-28 12:24:55 +03:00
|
|
|
if (sstat0 & SIOP_SSTAT0_UDC) {
|
1994-05-12 09:56:28 +04:00
|
|
|
#ifdef DEBUG
|
1995-08-18 19:27:29 +04:00
|
|
|
if (acb == NULL)
|
1996-10-13 07:05:43 +04:00
|
|
|
printf("%s: Unexpected disconnect with no active command?\n",
|
1995-08-18 19:27:29 +04:00
|
|
|
sc->sc_dev.dv_xname);
|
1996-10-13 07:05:43 +04:00
|
|
|
printf ("%s: target %d disconnected unexpectedly\n",
|
1995-02-12 22:18:33 +03:00
|
|
|
sc->sc_dev.dv_xname, target);
|
1994-05-12 09:56:28 +04:00
|
|
|
#endif
|
|
|
|
#if 0
|
1995-02-12 22:18:33 +03:00
|
|
|
siopabort (sc, rp, "siopchkintr");
|
1994-05-12 09:56:28 +04:00
|
|
|
#endif
|
|
|
|
*status = STS_BUSY;
|
1995-08-18 19:27:29 +04:00
|
|
|
if (sc->nexus_list.tqh_first)
|
1995-02-12 22:18:33 +03:00
|
|
|
rp->siop_dsp = sc->sc_scriptspa + Ent_wait_reselect;
|
1996-03-16 01:11:09 +03:00
|
|
|
return (acb != NULL);
|
1994-05-12 09:56:28 +04:00
|
|
|
}
|
1995-08-18 19:27:29 +04:00
|
|
|
if (dstat & SIOP_DSTAT_SIR && (rp->siop_dsps == 0xff01 ||
|
|
|
|
rp->siop_dsps == 0xff02)) {
|
1994-12-28 12:24:55 +03:00
|
|
|
#ifdef DEBUG
|
|
|
|
if (siop_debug & 0x100)
|
1996-10-13 07:05:43 +04:00
|
|
|
printf ("%s: ID %02x disconnected TEMP %lx (+%lx) curbuf %lx curlen %lx buf %p len %lx dfifo %x dbc %x sstat1 %x starts %d acb %p\n",
|
1995-02-12 22:18:33 +03:00
|
|
|
sc->sc_dev.dv_xname, 1 << target, rp->siop_temp,
|
1995-08-18 19:27:29 +04:00
|
|
|
rp->siop_temp ? rp->siop_temp - sc->sc_scriptspa : 0,
|
|
|
|
acb->iob_curbuf, acb->iob_curlen,
|
|
|
|
acb->ds.chain[0].databuf, acb->ds.chain[0].datalen, dfifo, dbc, sstat1, siopstarts, acb);
|
1994-05-12 09:56:28 +04:00
|
|
|
#endif
|
1995-08-18 19:27:29 +04:00
|
|
|
if (acb == NULL) {
|
1996-10-13 07:05:43 +04:00
|
|
|
printf("%s: Disconnect with no active command?\n",
|
1995-08-18 19:27:29 +04:00
|
|
|
sc->sc_dev.dv_xname);
|
|
|
|
return (0);
|
|
|
|
}
|
1994-12-28 12:24:55 +03:00
|
|
|
/*
|
1995-08-18 19:27:29 +04:00
|
|
|
* XXXX need to update iob_curbuf/iob_curlen to reflect
|
|
|
|
* current data transferred. If device disconnected in
|
|
|
|
* the middle of a DMA block, they should already be set
|
|
|
|
* by the phase change interrupt. If the disconnect
|
|
|
|
* occurs on a DMA block boundary, we have to figure out
|
|
|
|
* which DMA block it was.
|
1994-12-28 12:24:55 +03:00
|
|
|
*/
|
1995-08-18 19:27:29 +04:00
|
|
|
if (acb->iob_len && rp->siop_temp) {
|
|
|
|
int n = rp->siop_temp - sc->sc_scriptspa;
|
|
|
|
|
|
|
|
if (acb->iob_curlen && acb->iob_curlen != acb->ds.chain[0].datalen)
|
1996-10-13 07:05:43 +04:00
|
|
|
printf("%s: iob_curbuf/len already set? n %x iob %lx/%lx chain[0] %p/%lx\n",
|
1995-08-18 19:27:29 +04:00
|
|
|
sc->sc_dev.dv_xname, n, acb->iob_curbuf, acb->iob_curlen,
|
|
|
|
acb->ds.chain[0].databuf, acb->ds.chain[0].datalen);
|
|
|
|
if (n < Ent_datain)
|
|
|
|
n = (n - Ent_dataout) / 16;
|
|
|
|
else
|
|
|
|
n = (n - Ent_datain) / 16;
|
|
|
|
if (n <= 0 && n > DMAMAXIO)
|
1996-10-13 07:05:43 +04:00
|
|
|
printf("TEMP invalid %d\n", n);
|
1995-08-18 19:27:29 +04:00
|
|
|
else {
|
|
|
|
acb->iob_curbuf = (u_long)acb->ds.chain[n].databuf;
|
|
|
|
acb->iob_curlen = acb->ds.chain[n].datalen;
|
|
|
|
}
|
|
|
|
#ifdef DEBUG
|
|
|
|
if (siop_debug & 0x100) {
|
1996-10-13 07:05:43 +04:00
|
|
|
printf("%s: TEMP offset %d", sc->sc_dev.dv_xname, n);
|
|
|
|
printf(" curbuf %lx curlen %lx\n", acb->iob_curbuf,
|
1995-08-18 19:27:29 +04:00
|
|
|
acb->iob_curlen);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
* If data transfer was interrupted by disconnect, iob_curbuf
|
|
|
|
* and iob_curlen should reflect the point of interruption.
|
|
|
|
* Adjust the DMA chain so that the data transfer begins
|
|
|
|
* at the appropriate place upon reselection.
|
|
|
|
* XXX This should only be done on save data pointer message?
|
|
|
|
*/
|
|
|
|
if (acb->iob_curlen) {
|
|
|
|
int i, j;
|
|
|
|
|
1994-12-28 12:24:55 +03:00
|
|
|
#ifdef DEBUG
|
1995-08-18 19:27:29 +04:00
|
|
|
if (siop_debug & 0x100)
|
1996-10-13 07:05:43 +04:00
|
|
|
printf ("%s: adjusting DMA chain\n",
|
1995-08-18 19:27:29 +04:00
|
|
|
sc->sc_dev.dv_xname);
|
|
|
|
if (rp->siop_dsps == 0xff02)
|
1996-10-13 07:05:43 +04:00
|
|
|
printf ("%s: ID %02x disconnected without Save Data Pointers\n",
|
1995-08-18 19:27:29 +04:00
|
|
|
sc->sc_dev.dv_xname, 1 << target);
|
1994-05-12 09:56:28 +04:00
|
|
|
#endif
|
1995-08-18 19:27:29 +04:00
|
|
|
for (i = 0; i < DMAMAXIO; ++i) {
|
|
|
|
if (acb->ds.chain[i].datalen == 0)
|
|
|
|
break;
|
|
|
|
if (acb->iob_curbuf >= (long)acb->ds.chain[i].databuf &&
|
|
|
|
acb->iob_curbuf < (long)(acb->ds.chain[i].databuf +
|
|
|
|
acb->ds.chain[i].datalen))
|
|
|
|
break;
|
1994-12-28 12:24:55 +03:00
|
|
|
}
|
1996-03-16 01:11:09 +03:00
|
|
|
if (i >= DMAMAXIO || acb->ds.chain[i].datalen == 0) {
|
1996-10-13 07:05:43 +04:00
|
|
|
printf("couldn't find saved data pointer: ");
|
|
|
|
printf("curbuf %lx curlen %lx i %d\n",
|
1996-03-16 01:11:09 +03:00
|
|
|
acb->iob_curbuf, acb->iob_curlen, i);
|
|
|
|
#ifdef DDB
|
|
|
|
Debugger();
|
|
|
|
#endif
|
|
|
|
}
|
1995-08-18 19:27:29 +04:00
|
|
|
#ifdef DEBUG
|
|
|
|
if (siop_debug & 0x100)
|
1996-10-13 07:05:43 +04:00
|
|
|
printf(" chain[0]: %p/%lx -> %lx/%lx\n",
|
1995-08-18 19:27:29 +04:00
|
|
|
acb->ds.chain[0].databuf,
|
|
|
|
acb->ds.chain[0].datalen,
|
|
|
|
acb->iob_curbuf,
|
|
|
|
acb->iob_curlen);
|
|
|
|
#endif
|
|
|
|
acb->ds.chain[0].databuf = (char *)acb->iob_curbuf;
|
|
|
|
acb->ds.chain[0].datalen = acb->iob_curlen;
|
|
|
|
for (j = 1, ++i; i < DMAMAXIO && acb->ds.chain[i].datalen; ++i, ++j) {
|
|
|
|
#ifdef DEBUG
|
|
|
|
if (siop_debug & 0x100)
|
1996-10-13 07:05:43 +04:00
|
|
|
printf(" chain[%d]: %p/%lx -> %p/%lx\n", j,
|
1995-08-18 19:27:29 +04:00
|
|
|
acb->ds.chain[j].databuf,
|
|
|
|
acb->ds.chain[j].datalen,
|
|
|
|
acb->ds.chain[i].databuf,
|
|
|
|
acb->ds.chain[i].datalen);
|
|
|
|
#endif
|
|
|
|
acb->ds.chain[j].databuf = acb->ds.chain[i].databuf;
|
|
|
|
acb->ds.chain[j].datalen = acb->ds.chain[i].datalen;
|
|
|
|
}
|
|
|
|
if (j < DMAMAXIO)
|
|
|
|
acb->ds.chain[j].datalen = 0;
|
1996-04-22 01:10:48 +04:00
|
|
|
DCIAS(kvtop((caddr_t)&acb->ds.chain));
|
1994-12-28 12:24:55 +03:00
|
|
|
}
|
1995-08-18 19:27:29 +04:00
|
|
|
++sc->sc_tinfo[target].dconns;
|
|
|
|
/*
|
|
|
|
* add nexus to waiting list
|
|
|
|
* clear nexus
|
|
|
|
* try to start another command for another target/lun
|
|
|
|
*/
|
|
|
|
acb->status = sc->sc_flags & SIOP_INTSOFF;
|
|
|
|
TAILQ_INSERT_HEAD(&sc->nexus_list, acb, chain);
|
|
|
|
sc->sc_nexus = NULL; /* no current device */
|
|
|
|
/* start script to wait for reselect */
|
|
|
|
if (sc->sc_nexus == NULL)
|
|
|
|
rp->siop_dsp = sc->sc_scriptspa + Ent_wait_reselect;
|
|
|
|
/* XXXX start another command ? */
|
|
|
|
if (sc->ready_list.tqh_first)
|
|
|
|
siop_sched(sc);
|
1994-12-28 12:24:55 +03:00
|
|
|
return (0);
|
|
|
|
}
|
1995-08-18 19:27:29 +04:00
|
|
|
if (dstat & SIOP_DSTAT_SIR && rp->siop_dsps == 0xff03) {
|
|
|
|
int reselid = rp->siop_scratch & 0x7f;
|
|
|
|
int reselun = rp->siop_sfbr & 0x07;
|
|
|
|
|
|
|
|
sc->sc_sstat1 = rp->siop_sbcl; /* XXXX save current SBCL */
|
1994-12-28 12:24:55 +03:00
|
|
|
#ifdef DEBUG
|
|
|
|
if (siop_debug & 0x100)
|
1996-10-13 07:05:43 +04:00
|
|
|
printf ("%s: target ID %02x reselected dsps %lx\n",
|
1995-08-18 19:27:29 +04:00
|
|
|
sc->sc_dev.dv_xname, reselid,
|
1995-02-12 22:18:33 +03:00
|
|
|
rp->siop_dsps);
|
1995-08-18 19:27:29 +04:00
|
|
|
if ((rp->siop_sfbr & 0x80) == 0)
|
1996-10-13 07:05:43 +04:00
|
|
|
printf("%s: Reselect message in was not identify: %x\n",
|
1995-08-18 19:27:29 +04:00
|
|
|
sc->sc_dev.dv_xname, rp->siop_sfbr);
|
1994-12-28 12:24:55 +03:00
|
|
|
#endif
|
1995-08-18 19:27:29 +04:00
|
|
|
if (sc->sc_nexus) {
|
|
|
|
#ifdef DEBUG
|
|
|
|
if (siop_debug & 0x100)
|
1996-10-13 07:05:43 +04:00
|
|
|
printf ("%s: reselect ID %02x w/active\n",
|
1995-08-18 19:27:29 +04:00
|
|
|
sc->sc_dev.dv_xname, reselid);
|
|
|
|
#endif
|
|
|
|
TAILQ_INSERT_HEAD(&sc->ready_list, sc->sc_nexus, chain);
|
1997-08-27 15:22:52 +04:00
|
|
|
sc->sc_tinfo[sc->sc_nexus->xs->sc_link->scsipi_scsi.target].lubusy
|
|
|
|
&= ~(1 << sc->sc_nexus->xs->sc_link->scsipi_scsi.lun);
|
1995-08-18 19:27:29 +04:00
|
|
|
--sc->sc_active;
|
1994-12-28 12:24:55 +03:00
|
|
|
}
|
|
|
|
/*
|
1995-08-18 19:27:29 +04:00
|
|
|
* locate acb of reselecting device
|
|
|
|
* set sc->sc_nexus to acb
|
1994-12-28 12:24:55 +03:00
|
|
|
*/
|
1995-08-18 19:27:29 +04:00
|
|
|
for (acb = sc->nexus_list.tqh_first; acb;
|
|
|
|
acb = acb->chain.tqe_next) {
|
|
|
|
if (reselid != (acb->ds.scsi_addr >> 16) ||
|
|
|
|
reselun != (acb->msgout[0] & 0x07))
|
1994-12-28 12:24:55 +03:00
|
|
|
continue;
|
1995-08-18 19:27:29 +04:00
|
|
|
TAILQ_REMOVE(&sc->nexus_list, acb, chain);
|
|
|
|
sc->sc_nexus = acb;
|
|
|
|
sc->sc_flags |= acb->status;
|
|
|
|
acb->status = 0;
|
|
|
|
DCIAS(kvtop(&acb->stat[0]));
|
1996-04-22 01:10:48 +04:00
|
|
|
rp->siop_dsa = kvtop((caddr_t)&acb->ds);
|
1997-08-27 15:22:52 +04:00
|
|
|
rp->siop_sxfer =
|
|
|
|
sc->sc_sync[acb->xs->sc_link->scsipi_scsi.target].sxfer;
|
|
|
|
rp->siop_sbcl =
|
|
|
|
sc->sc_sync[acb->xs->sc_link->scsipi_scsi.target].sbcl;
|
1995-08-18 19:27:29 +04:00
|
|
|
break;
|
1994-12-28 12:24:55 +03:00
|
|
|
}
|
1995-08-18 19:27:29 +04:00
|
|
|
if (acb == NULL) {
|
1996-10-13 07:05:43 +04:00
|
|
|
printf("%s: target ID %02x reselect nexus_list %p\n",
|
1995-08-18 19:27:29 +04:00
|
|
|
sc->sc_dev.dv_xname, reselid,
|
|
|
|
sc->nexus_list.tqh_first);
|
|
|
|
panic("unable to find reselecting device");
|
|
|
|
}
|
1996-04-22 01:10:48 +04:00
|
|
|
dma_cachectl ((caddr_t)acb, sizeof(*acb));
|
1995-08-18 19:27:29 +04:00
|
|
|
rp->siop_temp = 0;
|
1995-02-12 22:18:33 +03:00
|
|
|
rp->siop_dcntl |= SIOP_DCNTL_STD;
|
1994-12-28 12:24:55 +03:00
|
|
|
return (0);
|
|
|
|
}
|
1995-08-18 19:27:29 +04:00
|
|
|
if (dstat & SIOP_DSTAT_SIR && rp->siop_dsps == 0xff04) {
|
1996-04-24 02:53:05 +04:00
|
|
|
#ifdef DEBUG
|
1995-09-16 20:11:03 +04:00
|
|
|
u_short ctest2 = rp->siop_ctest2;
|
|
|
|
|
1995-08-18 19:27:29 +04:00
|
|
|
/* reselect was interrupted (by Sig_P or select) */
|
|
|
|
if (siop_debug & 0x100 ||
|
1995-09-16 20:11:03 +04:00
|
|
|
(ctest2 & SIOP_CTEST2_SIGP) == 0)
|
1996-10-13 07:05:43 +04:00
|
|
|
printf ("%s: reselect interrupted (Sig_P?) scntl1 %x ctest2 %x sfbr %x istat %x/%x\n",
|
1995-09-16 20:11:03 +04:00
|
|
|
sc->sc_dev.dv_xname, rp->siop_scntl1,
|
|
|
|
ctest2, rp->siop_sfbr, istat, rp->siop_istat);
|
|
|
|
#endif
|
|
|
|
/* XXX assumes it was not select */
|
|
|
|
if (sc->sc_nexus == NULL) {
|
1996-04-28 10:28:24 +04:00
|
|
|
#ifdef DEBUG
|
1996-10-13 07:05:43 +04:00
|
|
|
printf("%s: reselect interrupted, sc_nexus == NULL\n",
|
1995-09-16 20:11:03 +04:00
|
|
|
sc->sc_dev.dv_xname);
|
|
|
|
#if 0
|
|
|
|
siop_dump(sc);
|
|
|
|
#ifdef DDB
|
|
|
|
Debugger();
|
1994-12-28 12:24:55 +03:00
|
|
|
#endif
|
1996-04-28 10:28:24 +04:00
|
|
|
#endif
|
1995-09-16 20:11:03 +04:00
|
|
|
#endif
|
|
|
|
rp->siop_dcntl |= SIOP_DCNTL_STD;
|
|
|
|
return(0);
|
|
|
|
}
|
1997-08-27 15:22:52 +04:00
|
|
|
target = sc->sc_nexus->xs->sc_link->scsipi_scsi.target;
|
1995-08-18 19:27:29 +04:00
|
|
|
rp->siop_temp = 0;
|
1996-04-22 01:10:48 +04:00
|
|
|
rp->siop_dsa = kvtop((caddr_t)&sc->sc_nexus->ds);
|
1995-09-16 20:11:03 +04:00
|
|
|
rp->siop_sxfer = sc->sc_sync[target].sxfer;
|
|
|
|
rp->siop_sbcl = sc->sc_sync[target].sbcl;
|
1995-08-18 19:27:29 +04:00
|
|
|
rp->siop_dsp = sc->sc_scriptspa;
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
if (dstat & SIOP_DSTAT_SIR && rp->siop_dsps == 0xff06) {
|
|
|
|
if (acb == NULL)
|
1996-10-13 07:05:43 +04:00
|
|
|
printf("%s: Bad message-in with no active command?\n",
|
1995-08-18 19:27:29 +04:00
|
|
|
sc->sc_dev.dv_xname);
|
|
|
|
/* Unrecognized message in byte */
|
|
|
|
dma_cachectl (&acb->msg[1],1);
|
1996-10-13 07:05:43 +04:00
|
|
|
printf ("%s: Unrecognized message in data sfbr %x msg %x sbcl %x\n",
|
1995-08-18 19:27:29 +04:00
|
|
|
sc->sc_dev.dv_xname, rp->siop_sfbr, acb->msg[1], rp->siop_sbcl);
|
|
|
|
/* what should be done here? */
|
|
|
|
DCIAS(kvtop(&acb->msg[1]));
|
|
|
|
rp->siop_dsp = sc->sc_scriptspa + Ent_switch;
|
1994-12-28 12:24:55 +03:00
|
|
|
return (0);
|
1994-05-12 09:56:28 +04:00
|
|
|
}
|
1995-08-18 19:27:29 +04:00
|
|
|
if (dstat & SIOP_DSTAT_SIR && rp->siop_dsps == 0xff0a) {
|
|
|
|
/* Status phase wasn't followed by message in phase? */
|
1996-10-13 07:05:43 +04:00
|
|
|
printf ("%s: Status phase not followed by message in phase? sbcl %x sbdl %x\n",
|
1995-08-18 19:27:29 +04:00
|
|
|
sc->sc_dev.dv_xname, rp->siop_sbcl, rp->siop_sbdl);
|
|
|
|
if (rp->siop_sbcl == 0xa7) {
|
|
|
|
/* It is now, just continue the script? */
|
|
|
|
rp->siop_dcntl |= SIOP_DCNTL_STD;
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
}
|
1994-01-27 00:05:34 +03:00
|
|
|
if (sstat0 == 0 && dstat & SIOP_DSTAT_SIR) {
|
1995-08-18 19:27:29 +04:00
|
|
|
dma_cachectl (&acb->stat[0], 1);
|
|
|
|
dma_cachectl (&acb->msg[0], 1);
|
1996-10-13 07:05:43 +04:00
|
|
|
printf ("SIOP interrupt: %lx sts %x msg %x %x sbcl %x\n",
|
1995-08-18 19:27:29 +04:00
|
|
|
rp->siop_dsps, acb->stat[0], acb->msg[0], acb->msg[1],
|
1995-02-12 22:18:33 +03:00
|
|
|
rp->siop_sbcl);
|
|
|
|
siopreset (sc);
|
1994-01-27 00:05:34 +03:00
|
|
|
*status = -1;
|
1995-08-18 19:27:29 +04:00
|
|
|
return 0; /* siopreset has cleaned up */
|
1994-01-27 00:05:34 +03:00
|
|
|
}
|
1994-06-27 08:56:29 +04:00
|
|
|
if (sstat0 & SIOP_SSTAT0_SGE)
|
1996-10-13 07:05:43 +04:00
|
|
|
printf ("SIOP: SCSI Gross Error\n");
|
1994-06-27 08:56:29 +04:00
|
|
|
if (sstat0 & SIOP_SSTAT0_PAR)
|
1996-10-13 07:05:43 +04:00
|
|
|
printf ("SIOP: Parity Error\n");
|
1994-12-28 12:24:55 +03:00
|
|
|
if (dstat & SIOP_DSTAT_IID)
|
1996-10-13 07:05:43 +04:00
|
|
|
printf ("SIOP: Invalid instruction detected\n");
|
1994-01-27 00:05:34 +03:00
|
|
|
bad_phase:
|
1994-06-27 08:56:29 +04:00
|
|
|
/*
|
|
|
|
* temporary panic for unhandled conditions
|
|
|
|
* displays various things about the 53C710 status and registers
|
|
|
|
* then panics.
|
|
|
|
* XXXX need to clean this up to print out the info, reset, and continue
|
|
|
|
*/
|
1996-10-13 07:05:43 +04:00
|
|
|
printf ("siopchkintr: target %x ds %p\n", target, &acb->ds);
|
|
|
|
printf ("scripts %lx ds %x rp %x dsp %lx dcmd %lx\n", sc->sc_scriptspa,
|
1996-04-22 01:10:48 +04:00
|
|
|
kvtop((caddr_t)&acb->ds), kvtop((caddr_t)rp), rp->siop_dsp,
|
1995-02-12 22:18:33 +03:00
|
|
|
*((long *)&rp->siop_dcmd));
|
1996-10-13 07:05:43 +04:00
|
|
|
printf ("siopchkintr: istat %x dstat %x sstat0 %x dsps %lx dsa %lx sbcl %x sts %x msg %x %x sfbr %x\n",
|
1995-02-12 22:18:33 +03:00
|
|
|
istat, dstat, sstat0, rp->siop_dsps, rp->siop_dsa,
|
1995-08-18 19:27:29 +04:00
|
|
|
rp->siop_sbcl, acb->stat[0], acb->msg[0], acb->msg[1], rp->siop_sfbr);
|
1994-06-27 08:56:29 +04:00
|
|
|
#ifdef DEBUG
|
|
|
|
if (siop_debug & 0x20)
|
|
|
|
panic("siopchkintr: **** temp ****");
|
1995-08-18 19:27:29 +04:00
|
|
|
#endif
|
|
|
|
#ifdef DDB
|
|
|
|
Debugger ();
|
1994-06-27 08:56:29 +04:00
|
|
|
#endif
|
1995-02-12 22:18:33 +03:00
|
|
|
siopreset (sc); /* hard reset */
|
1994-06-27 08:56:29 +04:00
|
|
|
*status = -1;
|
1995-08-18 19:27:29 +04:00
|
|
|
return 0; /* siopreset cleaned up */
|
1994-01-27 00:05:34 +03:00
|
|
|
}
|
|
|
|
|
1995-08-18 19:27:29 +04:00
|
|
|
void
|
|
|
|
siop_select(sc)
|
1995-02-12 22:18:33 +03:00
|
|
|
struct siop_softc *sc;
|
1994-01-27 00:05:34 +03:00
|
|
|
{
|
1995-08-18 19:27:29 +04:00
|
|
|
siop_regmap_p rp;
|
|
|
|
struct siop_acb *acb = sc->sc_nexus;
|
1994-01-27 00:05:34 +03:00
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
if (siop_debug & 1)
|
1996-10-13 07:05:43 +04:00
|
|
|
printf ("%s: select ", sc->sc_dev.dv_xname);
|
1994-01-27 00:05:34 +03:00
|
|
|
#endif
|
|
|
|
|
1995-08-18 19:27:29 +04:00
|
|
|
rp = sc->sc_siopp;
|
|
|
|
if (acb->xs->flags & SCSI_POLL || siop_no_dma) {
|
|
|
|
sc->sc_flags |= SIOP_INTSOFF;
|
|
|
|
sc->sc_flags &= ~SIOP_INTDEFER;
|
|
|
|
if ((rp->siop_istat & 0x08) == 0) {
|
|
|
|
rp->siop_sien = 0;
|
|
|
|
rp->siop_dien = 0;
|
1994-01-27 00:05:34 +03:00
|
|
|
}
|
1994-05-12 09:56:28 +04:00
|
|
|
#if 0
|
1995-08-18 19:27:29 +04:00
|
|
|
} else if ((sc->sc_flags & SIOP_INTDEFER) == 0) {
|
|
|
|
sc->sc_flags &= ~SIOP_INTSOFF;
|
|
|
|
if ((rp->siop_istat & 0x08) == 0) {
|
|
|
|
rp->siop_sien = sc->sc_sien;
|
|
|
|
rp->siop_dien = sc->sc_dien;
|
|
|
|
}
|
1994-05-12 09:56:28 +04:00
|
|
|
#endif
|
1994-01-27 00:05:34 +03:00
|
|
|
}
|
|
|
|
#ifdef DEBUG
|
|
|
|
if (siop_debug & 1)
|
1996-10-13 07:05:43 +04:00
|
|
|
printf ("siop_select: target %x cmd %02x ds %p\n",
|
1997-08-27 15:22:52 +04:00
|
|
|
acb->xs->sc_link->scsipi_scsi.target, acb->cmd.opcode,
|
1995-08-18 19:27:29 +04:00
|
|
|
&sc->sc_nexus->ds);
|
1994-01-27 00:05:34 +03:00
|
|
|
#endif
|
|
|
|
|
1997-08-27 15:22:52 +04:00
|
|
|
siop_start(sc, acb->xs->sc_link->scsipi_scsi.target,
|
|
|
|
acb->xs->sc_link->scsipi_scsi.lun,
|
1996-04-22 01:10:48 +04:00
|
|
|
(u_char *)&acb->cmd, acb->clen, acb->daddr, acb->dleft);
|
1994-01-27 00:05:34 +03:00
|
|
|
|
1995-08-18 19:27:29 +04:00
|
|
|
return;
|
1994-01-27 00:05:34 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
1995-08-18 19:27:29 +04:00
|
|
|
* 53C710 interrupt handler
|
1994-01-27 00:05:34 +03:00
|
|
|
*/
|
|
|
|
|
1996-04-22 01:10:48 +04:00
|
|
|
void
|
1995-02-12 22:18:33 +03:00
|
|
|
siopintr (sc)
|
|
|
|
register struct siop_softc *sc;
|
1994-05-12 09:56:28 +04:00
|
|
|
{
|
1995-02-12 22:18:33 +03:00
|
|
|
siop_regmap_p rp;
|
1994-01-27 00:05:34 +03:00
|
|
|
register u_char istat, dstat, sstat0;
|
|
|
|
int status;
|
1995-08-18 19:27:29 +04:00
|
|
|
int s = splbio();
|
1994-01-27 00:05:34 +03:00
|
|
|
|
1995-02-12 22:18:33 +03:00
|
|
|
istat = sc->sc_istat;
|
1995-08-18 19:27:29 +04:00
|
|
|
if ((istat & (SIOP_ISTAT_SIP | SIOP_ISTAT_DIP)) == 0) {
|
|
|
|
splx(s);
|
1994-05-12 09:56:28 +04:00
|
|
|
return;
|
1995-08-18 19:27:29 +04:00
|
|
|
}
|
|
|
|
|
1994-12-28 12:24:55 +03:00
|
|
|
/* Got a valid interrupt on this device */
|
1995-08-18 19:27:29 +04:00
|
|
|
rp = sc->sc_siopp;
|
1995-02-12 22:18:33 +03:00
|
|
|
dstat = sc->sc_dstat;
|
|
|
|
sstat0 = sc->sc_sstat0;
|
1995-08-18 19:27:29 +04:00
|
|
|
if (dstat & SIOP_DSTAT_SIR)
|
|
|
|
sc->sc_intcode = rp->siop_dsps;
|
1995-02-12 22:18:33 +03:00
|
|
|
sc->sc_istat = 0;
|
1994-01-27 00:05:34 +03:00
|
|
|
#ifdef DEBUG
|
1994-05-12 09:56:28 +04:00
|
|
|
if (siop_debug & 1)
|
1996-10-13 07:05:43 +04:00
|
|
|
printf ("%s: intr istat %x dstat %x sstat0 %x\n",
|
1995-02-12 22:18:33 +03:00
|
|
|
sc->sc_dev.dv_xname, istat, dstat, sstat0);
|
|
|
|
if (!sc->sc_active) {
|
1996-10-13 07:05:43 +04:00
|
|
|
printf ("%s: spurious interrupt? istat %x dstat %x sstat0 %x nexus %p status %x\n",
|
1996-03-16 01:11:09 +03:00
|
|
|
sc->sc_dev.dv_xname, istat, dstat, sstat0,
|
|
|
|
sc->sc_nexus, sc->sc_nexus ? sc->sc_nexus->stat[0] : 0);
|
1994-05-12 09:56:28 +04:00
|
|
|
}
|
1994-01-27 00:05:34 +03:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
1994-05-12 09:56:28 +04:00
|
|
|
if (siop_debug & 5) {
|
1995-08-18 19:27:29 +04:00
|
|
|
DCIAS(kvtop(&sc->sc_nexus->stat[0]));
|
1996-10-13 07:05:43 +04:00
|
|
|
printf ("%s: intr istat %x dstat %x sstat0 %x dsps %lx sbcl %x sts %x msg %x\n",
|
1995-02-12 22:18:33 +03:00
|
|
|
sc->sc_dev.dv_xname, istat, dstat, sstat0,
|
|
|
|
rp->siop_dsps, rp->siop_sbcl,
|
1995-08-18 19:27:29 +04:00
|
|
|
sc->sc_nexus->stat[0], sc->sc_nexus->msg[0]);
|
1994-05-12 09:56:28 +04:00
|
|
|
}
|
1994-01-27 00:05:34 +03:00
|
|
|
#endif
|
1995-08-18 19:27:29 +04:00
|
|
|
if (sc->sc_flags & SIOP_INTDEFER) {
|
|
|
|
sc->sc_flags &= ~(SIOP_INTDEFER | SIOP_INTSOFF);
|
|
|
|
rp->siop_sien = sc->sc_sien;
|
|
|
|
rp->siop_dien = sc->sc_dien;
|
|
|
|
}
|
1995-02-12 22:18:33 +03:00
|
|
|
if (siop_checkintr (sc, istat, dstat, sstat0, &status)) {
|
1994-01-27 00:05:34 +03:00
|
|
|
#if 1
|
1994-05-12 09:56:28 +04:00
|
|
|
if (status == 0xff)
|
1996-10-13 07:05:43 +04:00
|
|
|
printf ("siopintr: status == 0xff\n");
|
1994-01-27 00:05:34 +03:00
|
|
|
#endif
|
1995-08-18 19:27:29 +04:00
|
|
|
if ((sc->sc_flags & (SIOP_INTSOFF | SIOP_INTDEFER)) != SIOP_INTSOFF) {
|
|
|
|
#if 0
|
|
|
|
if (rp->siop_sbcl & SIOP_BSY) {
|
1996-10-13 07:05:43 +04:00
|
|
|
printf ("%s: SCSI bus busy at completion",
|
1995-02-12 22:18:33 +03:00
|
|
|
sc->sc_dev.dv_xname);
|
1996-10-13 07:05:43 +04:00
|
|
|
printf(" targ %d sbcl %02x sfbr %x lcrc %02x dsp +%x\n",
|
1997-08-27 15:22:52 +04:00
|
|
|
sc->sc_nexus->xs->sc_link->scsipi_scsi.target,
|
1995-08-18 19:27:29 +04:00
|
|
|
rp->siop_sbcl, rp->siop_sfbr, rp->siop_lcrc,
|
|
|
|
rp->siop_dsp - sc->sc_scriptspa);
|
|
|
|
}
|
|
|
|
#endif
|
1996-03-16 01:11:09 +03:00
|
|
|
siop_scsidone(sc->sc_nexus, sc->sc_nexus ?
|
|
|
|
sc->sc_nexus->stat[0] : -1);
|
1994-12-28 12:24:55 +03:00
|
|
|
}
|
1994-01-27 00:05:34 +03:00
|
|
|
}
|
1995-08-18 19:27:29 +04:00
|
|
|
splx(s);
|
1994-01-27 00:05:34 +03:00
|
|
|
}
|
|
|
|
|
1994-12-28 12:24:55 +03:00
|
|
|
/*
|
1995-08-18 19:27:29 +04:00
|
|
|
* This is based on the Progressive Peripherals 33Mhz Zeus driver and will
|
1994-12-28 12:24:55 +03:00
|
|
|
* not be correct for other 53c710 boards.
|
|
|
|
*
|
|
|
|
*/
|
1996-04-22 01:10:48 +04:00
|
|
|
void
|
1995-02-12 22:18:33 +03:00
|
|
|
scsi_period_to_siop (sc, target)
|
|
|
|
struct siop_softc *sc;
|
1996-04-22 01:10:48 +04:00
|
|
|
int target;
|
1994-01-27 00:05:34 +03:00
|
|
|
{
|
1996-04-22 01:10:48 +04:00
|
|
|
int period, offset, sxfer, sbcl = 0;
|
|
|
|
#ifdef DEBUG_SYNC
|
|
|
|
int i;
|
|
|
|
#endif
|
1994-01-27 00:05:34 +03:00
|
|
|
|
1995-08-18 19:27:29 +04:00
|
|
|
period = sc->sc_nexus->msg[4];
|
|
|
|
offset = sc->sc_nexus->msg[5];
|
1996-03-16 01:11:09 +03:00
|
|
|
#ifdef DEBUG_SYNC
|
1994-05-12 09:56:28 +04:00
|
|
|
sxfer = 0;
|
|
|
|
if (offset <= SIOP_MAX_OFFSET)
|
|
|
|
sxfer = offset;
|
1995-09-16 20:11:03 +04:00
|
|
|
for (i = 0; i < sizeof (sync_tab) / 2; ++i) {
|
|
|
|
if (period <= sync_tab[i].p) {
|
|
|
|
sxfer |= sync_tab[i].r & 0x70;
|
|
|
|
sbcl = sync_tab[i].r & 0x03;
|
1994-05-12 09:56:28 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
1996-10-13 07:05:43 +04:00
|
|
|
printf ("siop sync old: siop_sxfr %02x, siop_sbcl %02x\n", sxfer, sbcl);
|
1995-09-16 20:11:03 +04:00
|
|
|
#endif
|
|
|
|
for (sbcl = 1; sbcl < 4; ++sbcl) {
|
|
|
|
sxfer = (period * 4 - 1) / sc->sc_tcp[sbcl] - 3;
|
|
|
|
if (sxfer >= 0 && sxfer <= 7)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (sbcl > 3) {
|
1996-10-13 07:05:43 +04:00
|
|
|
printf("siop sync: unable to compute sync params for period %dns\n",
|
1995-09-16 20:11:03 +04:00
|
|
|
period * 4);
|
|
|
|
/*
|
|
|
|
* XXX need to pick a value we can do and renegotiate
|
|
|
|
*/
|
|
|
|
sxfer = sbcl = 0;
|
|
|
|
} else {
|
|
|
|
sxfer = (sxfer << 4) | ((offset <= SIOP_MAX_OFFSET) ?
|
|
|
|
offset : SIOP_MAX_OFFSET);
|
1996-03-16 01:11:09 +03:00
|
|
|
#ifdef DEBUG_SYNC
|
1996-10-13 07:05:43 +04:00
|
|
|
printf("siop sync: params for period %dns: sxfer %x sbcl %x",
|
1995-09-16 20:11:03 +04:00
|
|
|
period * 4, sxfer, sbcl);
|
1996-10-13 07:05:43 +04:00
|
|
|
printf(" actual period %dns\n",
|
1995-09-16 20:11:03 +04:00
|
|
|
sc->sc_tcp[sbcl] * ((sxfer >> 4) + 4));
|
1996-03-16 01:11:09 +03:00
|
|
|
#endif
|
1995-09-16 20:11:03 +04:00
|
|
|
}
|
|
|
|
sc->sc_sync[target].sxfer = sxfer;
|
|
|
|
sc->sc_sync[target].sbcl = sbcl;
|
1996-03-16 01:11:09 +03:00
|
|
|
#ifdef DEBUG_SYNC
|
1996-10-13 07:05:43 +04:00
|
|
|
printf ("siop sync: siop_sxfr %02x, siop_sbcl %02x\n", sxfer, sbcl);
|
1994-01-27 00:05:34 +03:00
|
|
|
#endif
|
|
|
|
}
|
1995-09-16 20:11:03 +04:00
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
|
|
|
|
#if SIOP_TRACE_SIZE
|
|
|
|
void
|
|
|
|
siop_dump_trace()
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
1996-10-13 07:05:43 +04:00
|
|
|
printf("siop trace: next index %d\n", siop_trix);
|
1995-09-16 20:11:03 +04:00
|
|
|
i = siop_trix;
|
|
|
|
do {
|
1996-10-13 07:05:43 +04:00
|
|
|
printf("%3d: '%c' %02x %02x %02x\n", i, siop_trbuf[i],
|
1995-09-16 20:11:03 +04:00
|
|
|
siop_trbuf[i + 1], siop_trbuf[i + 2], siop_trbuf[i + 3]);
|
|
|
|
i = (i + 4) & (SIOP_TRACE_SIZE - 1);
|
|
|
|
} while (i != siop_trix);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
void
|
|
|
|
siop_dump_acb(acb)
|
|
|
|
struct siop_acb *acb;
|
|
|
|
{
|
|
|
|
u_char *b = (u_char *) &acb->cmd;
|
|
|
|
int i;
|
|
|
|
|
1996-10-13 07:05:43 +04:00
|
|
|
printf("acb@%p ", acb);
|
1995-09-16 20:11:03 +04:00
|
|
|
if (acb->xs == NULL) {
|
1996-10-13 07:05:43 +04:00
|
|
|
printf("<unused>\n");
|
1995-09-16 20:11:03 +04:00
|
|
|
return;
|
|
|
|
}
|
1997-08-27 15:22:52 +04:00
|
|
|
printf("(%d:%d) flags %2x clen %2d cmd ",
|
|
|
|
acb->xs->sc_link->scsipi_scsi.target,
|
|
|
|
acb->xs->sc_link->scsipi_scsi.lun, acb->flags, acb->clen);
|
1995-09-16 20:11:03 +04:00
|
|
|
for (i = acb->clen; i; --i)
|
1996-10-13 07:05:43 +04:00
|
|
|
printf(" %02x", *b++);
|
|
|
|
printf("\n");
|
|
|
|
printf(" xs: %p data %p:%04x ", acb->xs, acb->xs->data,
|
1995-09-16 20:11:03 +04:00
|
|
|
acb->xs->datalen);
|
1996-10-13 07:05:43 +04:00
|
|
|
printf("va %p:%lx ", acb->iob_buf, acb->iob_len);
|
|
|
|
printf("cur %lx:%lx\n", acb->iob_curbuf, acb->iob_curlen);
|
1995-09-16 20:11:03 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
siop_dump(sc)
|
|
|
|
struct siop_softc *sc;
|
|
|
|
{
|
|
|
|
struct siop_acb *acb;
|
|
|
|
siop_regmap_p rp = sc->sc_siopp;
|
|
|
|
int s;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
s = splbio();
|
|
|
|
#if SIOP_TRACE_SIZE
|
|
|
|
siop_dump_trace();
|
|
|
|
#endif
|
1996-10-13 07:05:43 +04:00
|
|
|
printf("%s@%p regs %p istat %x\n",
|
1995-09-16 20:11:03 +04:00
|
|
|
sc->sc_dev.dv_xname, sc, rp, rp->siop_istat);
|
1996-04-22 01:10:48 +04:00
|
|
|
if ((acb = sc->free_list.tqh_first) > 0) {
|
1996-10-13 07:05:43 +04:00
|
|
|
printf("Free list:\n");
|
1995-09-16 20:11:03 +04:00
|
|
|
while (acb) {
|
|
|
|
siop_dump_acb(acb);
|
|
|
|
acb = acb->chain.tqe_next;
|
|
|
|
}
|
|
|
|
}
|
1996-04-22 01:10:48 +04:00
|
|
|
if ((acb = sc->ready_list.tqh_first) > 0) {
|
1996-10-13 07:05:43 +04:00
|
|
|
printf("Ready list:\n");
|
1995-09-16 20:11:03 +04:00
|
|
|
while (acb) {
|
|
|
|
siop_dump_acb(acb);
|
|
|
|
acb = acb->chain.tqe_next;
|
|
|
|
}
|
|
|
|
}
|
1996-04-22 01:10:48 +04:00
|
|
|
if ((acb = sc->nexus_list.tqh_first) > 0) {
|
1996-10-13 07:05:43 +04:00
|
|
|
printf("Nexus list:\n");
|
1995-09-16 20:11:03 +04:00
|
|
|
while (acb) {
|
|
|
|
siop_dump_acb(acb);
|
|
|
|
acb = acb->chain.tqe_next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (sc->sc_nexus) {
|
1996-10-13 07:05:43 +04:00
|
|
|
printf("Nexus:\n");
|
1995-09-16 20:11:03 +04:00
|
|
|
siop_dump_acb(sc->sc_nexus);
|
|
|
|
}
|
|
|
|
for (i = 0; i < 8; ++i) {
|
|
|
|
if (sc->sc_tinfo[i].cmds > 2) {
|
1996-10-13 07:05:43 +04:00
|
|
|
printf("tgt %d: cmds %d disc %d senses %d lubusy %x\n",
|
1995-09-16 20:11:03 +04:00
|
|
|
i, sc->sc_tinfo[i].cmds,
|
|
|
|
sc->sc_tinfo[i].dconns,
|
|
|
|
sc->sc_tinfo[i].senses,
|
|
|
|
sc->sc_tinfo[i].lubusy);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
splx(s);
|
|
|
|
}
|
|
|
|
#endif
|