Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/ic Define ncr53c9x_ioctl() and use it to start sync ...
details: https://anonhg.NetBSD.org/src/rev/57e5878c5abb
branches: trunk
changeset: 499156:57e5878c5abb
user: pk <pk%NetBSD.org@localhost>
date: Mon Nov 13 15:24:22 2000 +0000
description:
Define ncr53c9x_ioctl() and use it to start sync negotiation.
diffstat:
sys/dev/ic/ncr53c9x.c | 62 ++++++++++++++++++++++++++++++++++++++++++++---
sys/dev/ic/ncr53c9xvar.h | 20 +++++++-------
2 files changed, 67 insertions(+), 15 deletions(-)
diffs (149 lines):
diff -r d5698d86836f -r 57e5878c5abb sys/dev/ic/ncr53c9x.c
--- a/sys/dev/ic/ncr53c9x.c Mon Nov 13 15:20:28 2000 +0000
+++ b/sys/dev/ic/ncr53c9x.c Mon Nov 13 15:24:22 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ncr53c9x.c,v 1.52 2000/07/04 01:10:18 nisimura Exp $ */
+/* $NetBSD: ncr53c9x.c,v 1.53 2000/11/13 15:24:22 pk Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -89,6 +89,7 @@
#include <sys/proc.h>
#include <sys/user.h>
#include <sys/queue.h>
+#include <sys/scsiio.h>
#include <dev/scsipi/scsi_all.h>
#include <dev/scsipi/scsipi_all.h>
@@ -119,6 +120,8 @@
struct ncr53c9x_ecb *));
/*static*/ void ncr53c9x_dequeue __P((struct ncr53c9x_softc *,
struct ncr53c9x_ecb *));
+/*static*/ int ncr53c9x_ioctl __P((struct scsipi_link *, u_long,
+ caddr_t, int, struct proc *));
void ncr53c9x_sense __P((struct ncr53c9x_softc *,
struct ncr53c9x_ecb *));
@@ -150,7 +153,7 @@
0, /* adapter refcnt */
ncr53c9x_scsi_cmd, /* cmd */
minphys, /* minphys */
- NULL, /* ioctl */
+ ncr53c9x_ioctl, /* ioctl */
NULL, /* enable */
NULL, /* getgeom */
};
@@ -396,8 +399,8 @@
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))))
- ? T_NEGOTIATE : 0) |
+ ti->flags = (((sc->sc_cfflags & (1<<(r+8))) != 0)
+ ? T_SYNCHOFF : 0) |
((sc->sc_cfflags & (1<<r)) ? T_RSELECTOFF : 0) |
T_NEED_TO_RESET;
ti->period = sc->sc_minsync;
@@ -784,6 +787,53 @@
return (1);
}
+int
+ncr53c9x_ioctl(link, cmd, arg, flag, p)
+ struct scsipi_link *link;
+ u_long cmd;
+ caddr_t arg;
+ int flag;
+ struct proc *p;
+{
+ struct ncr53c9x_softc *sc = link->adapter_softc;
+ int s, error;
+
+ s = splbio();
+
+ switch (cmd) {
+ case SCBUSACCEL: {
+ struct scbusaccel_args *sp = (struct scbusaccel_args *)arg;
+ struct ncr53c9x_tinfo *ti = &sc->sc_tinfo[sp->sa_target];
+
+ if (sp->sa_lun != 0)
+ break;
+
+ if ((sp->sa_flags & SC_ACCEL_SYNC) != 0) {
+ /* If this adapter can't do sync; drop it */
+ if (sc->sc_minsync == 0)
+ break;
+
+ /*
+ * Check whether target is already clamped at
+ * non-sync operation on user request.
+ */
+ if ((ti->flags & T_SYNCHOFF) != 0)
+ break;
+
+ printf("%s: target %d: sync negotiation\n",
+ sc->sc_dev.dv_xname, sp->sa_target);
+ ti->flags |= T_NEGOTIATE;
+ }
+ break;
+ }
+ default:
+ error = ENOTTY;
+ break;
+ }
+ splx(s);
+ return (error);
+}
+
/*
* LOW LEVEL SCSI UTILITIES
@@ -1395,7 +1445,9 @@
ecb = sc->sc_nexus;
ti = &sc->sc_tinfo[ecb->xs->sc_link->scsipi_scsi.target];
ti->flags &= ~T_SYNCMODE;
- ti->flags |= T_NEGOTIATE;
+ if ((ti->flags & T_SYNCHOFF) == 0)
+ /* We can re-start sync negotiation */
+ ti->flags |= T_NEGOTIATE;
break;
case SEND_PARITY_ERROR:
sc->sc_omess[0] = MSG_PARITY_ERROR;
diff -r d5698d86836f -r 57e5878c5abb sys/dev/ic/ncr53c9xvar.h
--- a/sys/dev/ic/ncr53c9xvar.h Mon Nov 13 15:20:28 2000 +0000
+++ b/sys/dev/ic/ncr53c9xvar.h Mon Nov 13 15:24:22 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ncr53c9xvar.h,v 1.24 2000/06/05 07:59:54 nisimura Exp $ */
+/* $NetBSD: ncr53c9xvar.h,v 1.25 2000/11/13 15:24:22 pk Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -140,19 +140,19 @@
* this for now. Is there a way to reliably hook it up to sc->fordriver??
*/
struct ncr53c9x_tinfo {
- int cmds; /* #commands processed */
- int dconns; /* #disconnects */
- int touts; /* #timeouts */
- int perrs; /* #parity errors */
- int senses; /* #request sense commands sent */
- ushort lubusy; /* What local units/subr. are busy? */
+ int cmds; /* # of commands processed */
+ int dconns; /* # of disconnects */
+ int touts; /* # of timeouts */
+ int perrs; /* # of parity errors */
+ int senses; /* # of request sense commands sent */
+ ushort lubusy; /* Which local units/subr. are busy? */
u_char flags;
#define T_NEED_TO_RESET 0x01 /* Should send a BUS_DEV_RESET */
#define T_NEGOTIATE 0x02 /* (Re)Negotiate synchronous options */
#define T_BUSY 0x04 /* Target is busy, i.e. cmd in progress */
-#define T_SYNCMODE 0x08 /* sync mode has been negotiated */
-#define T_SYNCHOFF 0x10 /* .. */
-#define T_RSELECTOFF 0x20 /* .. */
+#define T_SYNCMODE 0x08 /* SYNC mode has been negotiated */
+#define T_SYNCHOFF 0x10 /* SYNC mode for is permanently off */
+#define T_RSELECTOFF 0x20 /* RE-SELECT mode is off */
u_char period; /* Period suggestion */
u_char offset; /* Offset suggestion */
u_char pad[3];
Home |
Main Index |
Thread Index |
Old Index