Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/thorpej_scsipi]: src/sys/dev/scsipi Add channel freeze/thaw, and when a ...



details:   https://anonhg.NetBSD.org/src/rev/3bce337e60cd
branches:  thorpej_scsipi
changeset: 477289:3bce337e60cd
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Wed Oct 20 20:38:14 1999 +0000

description:
Add channel freeze/thaw, and when a timed thaw occurs on either a
channel or periph, make sure to kick the channel queue.

diffstat:

 sys/dev/scsipi/scsipi_base.c |  76 +++++++++++++++++++++++++++++++++++++++++--
 sys/dev/scsipi/scsipiconf.h  |   6 ++-
 2 files changed, 77 insertions(+), 5 deletions(-)

diffs (124 lines):

diff -r 95eecd7dbf0b -r 3bce337e60cd sys/dev/scsipi/scsipi_base.c
--- a/sys/dev/scsipi/scsipi_base.c      Wed Oct 20 11:54:56 1999 +0000
+++ b/sys/dev/scsipi/scsipi_base.c      Wed Oct 20 20:38:14 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: scsipi_base.c,v 1.26.2.2 1999/10/19 21:04:27 thorpej Exp $     */
+/*     $NetBSD: scsipi_base.c,v 1.26.2.3 1999/10/20 20:38:14 thorpej Exp $     */
 
 /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -440,6 +440,61 @@
 }
 
 /*
+ * scsipi_channel_freeze:
+ *
+ *     Freeze a channel's xfer queue.
+ */
+void
+scsipi_channel_freeze(chan, count)
+       struct scsipi_channel *chan;
+       int count;
+{
+       int s;
+
+       s = splbio();
+       chan->chan_qfreeze += count;
+       splx(s);
+}
+
+/*
+ * scsipi_channel_thaw:
+ *
+ *     Thaw a channel's xfer queue.
+ */
+void
+scsipi_channel_thaw(chan, count)
+       struct scsipi_channel *chan;
+       int count;
+{
+       int s;
+
+       s = splbio();
+       chan->chan_qfreeze -= count;
+       splx(s);
+}
+
+/*
+ * scsipi_channel_timed_thaw:
+ *
+ *     Thaw a channel after some time has expired.
+ */
+void
+scsipi_channel_timed_thaw(arg)
+       void *arg;
+{
+       struct scsipi_channel *chan = arg;
+
+       scsipi_channel_thaw(chan, 1);
+
+       /*
+        * Kick the channel's queue here.  Note, we're running in
+        * interrupt context (softclock), so the adapter driver
+        * had better not sleep.
+        */
+       scsipi_run_queue(chan);
+}
+
+/*
  * scsipi_periph_freeze:
  *
  *     Freeze a device's xfer queue.
@@ -489,9 +544,12 @@
 
        scsipi_periph_thaw(periph, 1);
 
-       /* XXX XXX XXX */
-       scsipi_printaddr(periph);
-       printf("timed thaw: should kick channel's queue here.\n");
+       /*
+        * Kick the channel's queue here.  Note, we're running in
+        * interrupt context (softclock), so the adapter driver
+        * had better not sleep.
+        */
+       scsipi_run_queue(periph->periph_channel);
 }
 
 /*
@@ -1260,6 +1318,16 @@
 
        for (;;) {
                s = splbio();
+
+               /*
+                * If the channel is frozen, we can't do any work right
+                * now.
+                */
+               if (chan->chan_qfreeze != 0) {
+                       splx(s);
+                       return;
+               }
+
                /*
                 * Look for work to do, and make sure we can do it.
                 */
diff -r 95eecd7dbf0b -r 3bce337e60cd sys/dev/scsipi/scsipiconf.h
--- a/sys/dev/scsipi/scsipiconf.h       Wed Oct 20 11:54:56 1999 +0000
+++ b/sys/dev/scsipi/scsipiconf.h       Wed Oct 20 20:38:14 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: scsipiconf.h,v 1.32.2.2 1999/10/19 21:04:27 thorpej Exp $      */
+/*     $NetBSD: scsipiconf.h,v 1.32.2.3 1999/10/20 20:38:15 thorpej Exp $      */
 
 /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -597,6 +597,10 @@
 int    scsipi_adapter_addref __P((struct scsipi_adapter *));
 void   scsipi_adapter_delref __P((struct scsipi_adapter *));
 
+void   scsipi_channel_freeze __P((struct scsipi_channel *, int));
+void   scsipi_channel_thaw __P((struct scsipi_channel *, int));
+void   scsipi_channel_timed_thaw __P((void *));
+
 void   scsipi_periph_freeze __P((struct scsipi_periph *, int));
 void   scsipi_periph_thaw __P((struct scsipi_periph *, int));
 void   scsipi_periph_timed_thaw __P((void *));



Home | Main Index | Thread Index | Old Index