From: Jim Babb <babb@sedhps01.mdc.com>
authorNate Willams <nate@FreeBSD.org>
Mon, 14 Feb 1994 22:24:28 +0000 (22:24 +0000)
committerNate Willams <nate@FreeBSD.org>
Mon, 14 Feb 1994 22:24:28 +0000 (22:24 +0000)
Date: Mon, 14 Feb 94 15:57:14 CST

This adds a copyright to the fdc.h file and fixes a bug in re-tries
during writes on a heavily loaded system.

sys/i386/isa/fd.c
sys/i386/isa/fdc.h
sys/i386/isa/ft.c

index 9fa0636..005a4dc 100644 (file)
@@ -35,7 +35,7 @@
  * SUCH DAMAGE.
  *
  *     from:   @(#)fd.c        7.4 (Berkeley) 5/25/91
  * SUCH DAMAGE.
  *
  *     from:   @(#)fd.c        7.4 (Berkeley) 5/25/91
- *     $from: fd.c,v 1.18 1993/12/21 05:09:21 ache Exp $
+ *     $Id:$
  *
  */
 
  *
  */
 
@@ -389,7 +389,7 @@ void fdstrategy(struct buf *bp)
                return; 
                }
 #endif
                return; 
                }
 #endif
-       if ((fdu >= (NFD+NFT)) || (bp->b_blkno < 0)) {
+       if ((fdu >= NFD) || (bp->b_blkno < 0)) {
                printf("fdstrat: fdu = %d, blkno = %d, bcount = %d\n",
                        fdu, bp->b_blkno, bp->b_bcount);
                pg("fd:error in fdstrategy");
                printf("fdstrat: fdu = %d, blkno = %d, bcount = %d\n",
                        fdu, bp->b_blkno, bp->b_bcount);
                pg("fd:error in fdstrategy");
@@ -1174,7 +1174,10 @@ fdioctl (dev, cmd, addr, flag, p)
        int error;
 
 #if NFT > 0
        int error;
 
 #if NFT > 0
-       if (fd_data[FDUNIT(minor(dev))].fdc->flags & FDC_TAPE_BUSY)
+       int type = FDTYPE(minor(dev));
+
+       /* check for a tape ioctl */
+       if (type & F_TAPE_TYPE)
                return ftioctl(dev, cmd, addr, flag, p);
 #endif
 
                return ftioctl(dev, cmd, addr, flag, p);
 #endif
 
index 3320de3..1542f0e 100644 (file)
@@ -1,3 +1,40 @@
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * 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.
+ *
+ *     from:   @(#)fd.c        7.4 (Berkeley) 5/25/91
+ *     $Id:$
+ *
+ */
+
 
 /***********************************************************************\
 * Per controller structure.                                            *
 
 /***********************************************************************\
 * Per controller structure.                                            *
index 326b5be..b85e14d 100644 (file)
@@ -17,6 +17,8 @@
  *  POSSIBILITY OF SUCH DAMAGE.
  *
  *  ft.c - QIC-40/80 floppy tape driver
  *  POSSIBILITY OF SUCH DAMAGE.
  *
  *  ft.c - QIC-40/80 floppy tape driver
+ *  $Id:$
+ *
  *
  *  01/26/94 v0.3b - Jim Babb
  *  Got rid of the hard coded device selection.  Moved (some of) the
  *
  *  01/26/94 v0.3b - Jim Babb
  *  Got rid of the hard coded device selection.  Moved (some of) the
@@ -910,7 +912,7 @@ restate:
 #endif
 
        /* Check for errors */
 #endif
 
        /* Check for errors */
-       if ((rddta[0] & 0xc0) == 0x40) {
+       if ((rddta[0] & 0xc0) != 0x00) {
                if (rddta[1] & 0x04) {
                        /* Probably wrong position */
                        ft->lastpos = ft->xblk;
                if (rddta[1] & 0x04) {
                        /* Probably wrong position */
                        ft->lastpos = ft->xblk;
@@ -1020,16 +1022,16 @@ restate:
 #endif
 
        /* Check for errors */
 #endif
 
        /* Check for errors */
-       if ((rddta[0] & 0xc0) == 0x40) {
+       if ((rddta[0] & 0xc0) != 0x00) {
                if (rddta[1] & 0x04) {
                        /* Probably wrong position */
                        ft->lastpos = ft->xblk;
                if (rddta[1] & 0x04) {
                        /* Probably wrong position */
                        ft->lastpos = ft->xblk;
-                       ard_state = 0;
+                       awr_state = 0;
                        goto restate;
                } else if (retries < 5) {
                        /* Something happened -- try again */
                        ft->lastpos = ft->xblk;
                        goto restate;
                } else if (retries < 5) {
                        /* Something happened -- try again */
                        ft->lastpos = ft->xblk;
-                       ard_state = 0;
+                       awr_state = 0;
                        retries++;
                        goto restate;
                } else {
                        retries++;
                        goto restate;
                } else {
@@ -1695,8 +1697,12 @@ int qic_status(ftu_t ftu, int cmd, int nbits)
 int ftopen(dev_t dev, int arg2) {
   ftu_t ftu = FDUNIT(minor(dev));
   int type = FDTYPE(minor(dev));
 int ftopen(dev_t dev, int arg2) {
   ftu_t ftu = FDUNIT(minor(dev));
   int type = FDTYPE(minor(dev));
-  fdc_p fdc = ft_data[ftu].fdc;
+  fdc_p fdc;
 
 
+  /* check bounds */
+  if (ftu >= NFT) 
+       return(ENXIO);
+  fdc = ft_data[ftu].fdc;
   /* check for controller already busy with tape */
   if (fdc->flags & FDC_TAPE_BUSY)
        return(EBUSY); 
   /* check for controller already busy with tape */
   if (fdc->flags & FDC_TAPE_BUSY)
        return(EBUSY);