Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 18 Jun 96 09:47:00 PDT
From:      Duncan Barclay <Duncan.Barclay@pa-consulting.com>
To:        send-pr <FreeBSD-gnats-submit@freebsd.org>
Subject:   i386/1331: changes and bug in ft driver
Message-ID:  <31C6E014@SMTPGATE.PA-CONSULTING.COM>
Resent-Message-ID: <199606180900.CAA11456@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         1331
>Category:       i386
>Synopsis:       changes and bug in ft driver
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jun 18 02:00:02 PDT 1996
>Last-Modified:
>Originator:     Duncan Barclay &
>Organization:
PA-Consulting
>Release:        FreeBSD 2.1-STABLE i386
>Environment:

486DX33, 8MB RAM UMC motherboard.
Connor TapeStor 800AT 800MB (Compressed) Travan Tapedrive

>Description:

From: Duncan Barclay
To: Poul-Henning Kamp
Subject: ft driver
Date: 11 June 1996 08:46

Hi Poul

I posted the below for -hackers a while back. You requested the
diffs but I forgot to send them to you. I remembered!

I have discovered some problems in the ft (floppy tape) driver code
when using my Connor Tapestore800 drive. I am running 2.0.5-R (but
am backing up prior to installing 2.1-R)

     1) The list of recognised tape formats is limited. ft doesnt
        like Travan cartridges. I have added the right
        numbers to the table
           but am not posting them as they changed when I
           reformatted my cart using Connor's DOS software. I
           dont want to start confusing people!
                Someone who has the right specs should
           update the entries.
     2) One I fixed the above, all things were going okay using
          the travan cart and cpio.
          After a while the machine appeared to hang (I was in
          single user mode at the
                        time, however later tests shows the process
          to be waiting on bdone).

          As I had hacked /sbin/ft to print
          the segment number I continued to play a little seeking
          the tape to that segment and kept
          getting the hangs. Eventually I discovered that the
          drive took a little longer than the code waits
                        for to respond when it moves the head a few tracks.

>How-To-Repeat:

          in sys/i386/isa/ft.c

          Specifics:

          ACMD_BLOCKIO (or similar) calls ACMD_READID to find out
          where the head is.

          ACMD_READID issues read id commands to the drive.
             If the first read id command returns garbage
          then ACMD_READID then calls ACMD_SEEKSTS to stop the tape moving.

             ACMD_SEEKSTS waits for the tape to stop and
          to become ready, timing out after 10seconds.
          If this timeout occurs then control goes back to
          ACMD_READID and ACMD_READID should do a
          further 4 retries.
             It does not. It hangs.  ***Important this is the bug***

          My fix for _my_ tape drive is to up the timeout
          specified by ACMD_READID in the call to ACMD_SEEKSTS
             to 90seconds. In fact by drive takes about
          12seconds to become ready. THIS IS NOT A REAL FIX. I think
          that the retry stuff in ACMD_READID is broken (a comment
          in the header of ft.c seems to indicate that
             hangs did occur and may have been fixed but not tested).

             I am willing to have ago at fixing this, but:
          I have never written a device driver.
          I have no time for 6months.
          I have no idea how QIC tapes work at the s/w level.
          The state machine in ft.c is big and it would take a
               long time to trace out what I need to know.
               I seem to remember someone saying they
               were going to maintain this code a while back.


>Fix:
    The code is the same in 2.0.5R and 2.1R so these are diffs between my 
fixes and the 2.1R live filesystem CDROM (keep the Live Filesystem, it is 
excellent)

*** ft.c  Thu Apr  4 16:34:51 1996
 --- /cdrom/usr/src/sys/i386/isa/ft.c   Mon May 29 18:01:41 1995
***************
*** 91,97 ****

  /* Enable or disable debugging messages. */
  #define FTDBGALL 0               /* 1 if you want everything */
! /*#define DPRT(a) printf a  */
  #define DPRT(a)

  /* Constants private to the driver */
 --- 91,97 ----

  /* Enable or disable debugging messages. */
  #define FTDBGALL 0               /* 1 if you want everything */
! /*#define DPRT(a) printf a       */
  #define DPRT(a)

  /* Constants private to the driver */
***************
*** 161,168 ****
     { 3, 2, "QIC-500", "307.5/550",     0,   0,     0,   0,     0 },
/* ??? */
     { 3, 3, "QIC-500", "295/900",  0,   0,     0,   0,     0 },
/* ??? */
     { 3, 4, "QIC-500", "1100/550",      0,   0,     0,   0,     0 },
/* ??? */
!    { 3, 5, "QIC-500", "1100/900",      0,   0,     0,   0,     0 },
/* ??? */
!    { 2,11, "TR-1",    "750/550", 36, 369, 11808, 128, 32640 }
/* dmlb */
  };
  #define NGEOM     (sizeof(ftgtbl) / sizeof(QIC_Geom))

 --- 161,167 ----
     { 3, 2, "QIC-500", "307.5/550",     0,   0,     0,   0,     0 },
/* ??? */
     { 3, 3, "QIC-500", "295/900",  0,   0,     0,   0,     0 },
/* ??? */
     { 3, 4, "QIC-500", "1100/550",      0,   0,     0,   0,     0 },
/* ??? */
!    { 3, 5, "QIC-500", "1100/900",      0,   0,     0,   0,     0 }
/* ??? */
  };
  #define NGEOM     (sizeof(ftgtbl) / sizeof(QIC_Geom))

***************
*** 766,772 ****
          CALL_ACMD(2, ACMD_STATUS, QC_STATUS, 8, 0);
         case 2:
          if ((async_ret & async_arg1) != 0) goto complete;
 -        DPRT (("seeksts retry, %d left\n", async_retries-1));
          if (--async_retries == 0) {
               DPRT(("ft%d: acmd_seeksts retries exceeded\n", ftu));
               goto complete;
 --- 765,770 ----
***************
*** 807,813 ****
                *        4 microstep head back to 0
                *        5 fail
                */
 -             DPRT (("readid retry number %d\n", errcnt+1));
               if (++errcnt >= 5) {
                    DPRT(("ft%d: acmd_readid errcnt
exceeded\n", fdcu));
                    async_ret = -2;
 --- 805,810 ----
***************
*** 816,825 ****
               }
               if (errcnt == 1) {
                    ft->moving = 0;
!                   CALL_ACMD(4, ACMD_SEEKSTS, QC_STOP,
QS_READY, 90);
               } else {
                    ft->moving = 0;
!                   CALL_ACMD(4, ACMD_SEEKSTS,
QC_STPAUSE, QS_READY, 90);
               }
               DPRT(("readid retry %d...\n", errcnt));
               async_state = 0;
 --- 813,822 ----
               }
               if (errcnt == 1) {
                    ft->moving = 0;
!                   CALL_ACMD(4, ACMD_SEEKSTS, QC_STOP,
QS_READY, 0);
               } else {
                    ft->moving = 0;
!                   CALL_ACMD(4, ACMD_SEEKSTS,
QC_STPAUSE, QS_READY, 0);
               }
               DPRT(("readid retry %d...\n", errcnt));
               async_state = 0;
***************
*** 842,848 ****
          async_ret = retpos+1;
          goto complete;
         case 4:
 -        DPRT (("readid state 4\n"));
          CALL_ACMD(5, ACMD_SEEK, QC_FORWARD, 0, 0);
         case 5:
          ft->moving = 1;
 --- 839,844 ----
***************
*** 1835,1844 ****
   *  XXX - This doesn't seem to work on my Colorado Jumbo 250...
   *  if it works on your drive, I'd sure like to hear about it.
   */
! /*
!  * dmlb - But it does work on my Connor Tapestore 800.
!  */
! #if 1
    /* Report drive status */
    for (sts = -1, tries = 0; sts < 0 && tries < 3; tries++)
     sts = qic_status(ftu, QC_TSTATUS, 8);
 --- 1831,1837 ----
   *  XXX - This doesn't seem to work on my Colorado Jumbo 250...
   *  if it works on your drive, I'd sure like to hear about it.
   */
! #if 0
    /* Report drive status */
    for (sts = -1, tries = 0; sts < 0 && tries < 3; tries++)
     sts = qic_status(ftu, QC_TSTATUS, 8);
*** ftape.h    Tue Apr  2 18:11:23 1996
 --- /cdrom/usr/src/sys/sys/ftape.h     Sat Aug 13 11:52:48 1994
***************
*** 39,45 ****
  #define QCV_ECCSIZE    3072      /* Bytes ecc eats */
  #define QCV_ECCBLKS    3         /* Blocks ecc eats */
  #define QCV_NFMT  3         /* Number of tape formats */
! #define QCV_NLEN  11        /* Number of tape lengths */
  #define QCV_HDRMAGIC   0xaa55aa55     /* Magic for header segment */
  #define QCV_FSMAGIC    0x33cc33cc     /* Magic for fileset */

 --- 39,45 ----
  #define QCV_ECCSIZE    3072      /* Bytes ecc eats */
  #define QCV_ECCBLKS    3         /* Blocks ecc eats */
  #define QCV_NFMT  3         /* Number of tape formats */
! #define QCV_NLEN  5         /* Number of tape lengths */
  #define QCV_HDRMAGIC   0xaa55aa55     /* Magic for header segment */
  #define QCV_FSMAGIC    0x33cc33cc     /* Magic for fileset */


>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?31C6E014>