Source-Changes-HG archive

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

[src/netbsd-1-5]: src/sys/dev/ic Pull up rev. 1.52:



details:   https://anonhg.NetBSD.org/src/rev/34a50b206be2
branches:  netbsd-1-5
changeset: 488425:34a50b206be2
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Tue Jul 04 01:18:53 2000 +0000

description:
Pull up rev. 1.52:
Fix negative timeout symptoms caused by integer multiply overflow,
which is revealed with larger HZ systems like NetBSD/pmax (256Hz)
and NetBSD/alpha (1024Hz) as reported by PR#8645.  Polled tape
drive access is done with maximum 6 hour timeout which ended up
with negative time and then confused SCSI bus severely.

diffstat:

 sys/dev/ic/ncr53c9x.c |  22 ++++++++++++++++++----
 1 files changed, 18 insertions(+), 4 deletions(-)

diffs (51 lines):

diff -r f7bde8a343b8 -r 34a50b206be2 sys/dev/ic/ncr53c9x.c
--- a/sys/dev/ic/ncr53c9x.c     Tue Jul 04 00:57:24 2000 +0000
+++ b/sys/dev/ic/ncr53c9x.c     Tue Jul 04 01:18:53 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ncr53c9x.c,v 1.51 2000/06/05 15:19:42 tsutsui Exp $    */
+/*     $NetBSD: ncr53c9x.c,v 1.51.2.1 2000/07/04 01:18:53 thorpej Exp $        */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -541,9 +541,16 @@
         * expecting to come back due to an interrupt, because it is
         * always possible that the interrupt may never happen.
         */
-       if ((ecb->xs->xs_control & XS_CTL_POLL) == 0)
-               callout_reset(&ecb->xs->xs_callout, (ecb->timeout * hz) / 1000,
+       if ((ecb->xs->xs_control & XS_CTL_POLL) == 0) {
+               int timeout = ecb->timeout;
+
+               if (hz > 100 && timeout > 1000)
+                       timeout = (timeout / 1000) * hz;
+               else
+                       timeout = (timeout * hz) / 1000;
+               callout_reset(&ecb->xs->xs_callout, timeout,
                    ncr53c9x_timeout, ecb);
+       }
 
        /*
         * The docs say the target register is never reset, and I
@@ -2179,6 +2186,8 @@
        ecb->flags |= ECB_ABORT;
 
        if (ecb == sc->sc_nexus) {
+               int timeout;
+
                /*
                 * If we're still selecting, the message will be scheduled
                 * after selection is complete.
@@ -2189,7 +2198,12 @@
                /*
                 * Reschedule timeout.
                 */
-               callout_reset(&ecb->xs->xs_callout, (ecb->timeout * hz) / 1000,
+               timeout = ecb->timeout;
+               if (hz > 100 && timeout > 1000)
+                       timeout = (timeout / 1000) * hz;
+               else
+                       timeout = (timeout * hz) / 1000;
+               callout_reset(&ecb->xs->xs_callout, timeout,
                    ncr53c9x_timeout, ecb);
        } else {
                /* The command should be on the nexus list */



Home | Main Index | Thread Index | Old Index