SCSI SUPPORT FOR ADAPTEC AHA-1542A BOARD AND TAPEDRIVE FIXES
authorJames da Silva <jds@cs.umd.edu>
Wed, 10 Mar 1993 00:00:00 +0000 (00:00 +0000)
committerJames da Silva <jds@cs.umd.edu>
Wed, 10 Mar 1993 00:00:00 +0000 (00:00 +0000)
Joerg Lohse:
The current aha1542 driver "as" supports only AHA-1542B controllers.
This patch extends the support to AHA-1542A controllers. The kernel's driver
"as.c" and the sources for "asboot" and "bootas" are patched. The makefile
in directory /sys/i386/stand is extended.

James da Silva:
The SCSI driver as.c assumed fixed-block-size tapedrives.
(Fix produced by Scott Burris)

as.c didn't write file marks.  The driver still doesn't write two filemarks
for end-of-medium, but that is less important.

as.c couldn't read multi-file tapes.  It didn't have any no-rewind devices.
The no-rewind devices have a minor number one greater than the
base number for the target (eg same as partition b for disks).

  Here's what I did with a tape at target 2:
# ln /dev/ras2a /dev/rst2
# mknod /dev/nrst2 c 13 17
  Now I refer to the tape as "/dev/rst2" and "/dev/nrst2".

The tape at SCSI target 4 doesn't work.  The solution is that the devices for
ras4[ad] in the distribution are wrong.  The major numbers should be 13,
 not 11.  Try:
# rm /dev/ras4[ad]
# mknod /dev/ras4a c 13 32
# mknod /dev/ras4d c 13 35
  (but you don't really need the d partition for tapes)
(this fix is from Bill Jolitz)

Rodney W. Grimes:
The target directory in the Makefile was wrong, it tried to install
this stuff in //stand.

AUTHOR: Joerg Lohse (lohse@tech7.informatik.uni-hamburg.de)
AUTHOR: James da Silva (jds@cs.umd.edu) et al
AUTHOR: Rodney W. Grimes (rgrimes@agora.rain.com)
386BSD-Patchkit: patch00088

usr/src/sys.386bsd/i386/isa/as.c
usr/src/sys.386bsd/i386/stand/Makefile
usr/src/sys.386bsd/i386/stand/as.c
usr/src/sys.386bsd/i386/stand/asbootblk.c

index 884854e..48240e2 100644 (file)
  * Please send patches and names other perpherials that work to
  * pace@blitz.com.  If you have trouble that you can't fix, please
  * wait for the next release before contacting me.
  * Please send patches and names other perpherials that work to
  * pace@blitz.com.  If you have trouble that you can't fix, please
  * wait for the next release before contacting me.
+ *
+ * PATCHES MAGIC                LEVEL   PATCH THAT GOT US HERE
+ * --------------------         -----   ----------------------
+ * CURRENT PATCH LEVEL:         1       00088
+ * --------------------         -----   ----------------------
+ *
+ * 23 Oct 92   Joerg Lohse             changed ccb opcode for compatibility
+ *                                     with Adaptec AHA-1542A
+ * 27 Feb 93   James da Silva          Tapedrive fixes. 
  */
 
 #include "as.h"
  */
 
 #include "as.h"
@@ -429,11 +438,6 @@ int flag;
                }
        }
        
                }
        }
        
-       if (as->tape &&  dev_part(dev)) {
-               error = EIO;
-               goto done;
-       }
-
        as->scsi_cdb_len = 10;
        bzero(cdb, 10);
        cdb[0] = 0x25;  /* SCSI_READCAPACITY */
        as->scsi_cdb_len = 10;
        bzero(cdb, 10);
        cdb[0] = 0x25;  /* SCSI_READCAPACITY */
@@ -554,7 +558,7 @@ dev_t dev;
                
                bp = geteblk (DEV_BSIZE);
 
                
                bp = geteblk (DEV_BSIZE);
 
-             if (0 && (flag & FWRITE) != 0) {
+             if ((flag & FWRITE) != 0) {
                              /* presume user will use tape again */
                      as->scsi_cdb_len = 6;
                      cdb = as->scsi_cdb;
                              /* presume user will use tape again */
                      as->scsi_cdb_len = 6;
                      cdb = as->scsi_cdb;
@@ -889,6 +893,8 @@ printf("total %d nblocks %d ", total, nblocks);
        n = 0;
        sp = as->scatter_list;
        nscatter = 0;
        n = 0;
        sp = as->scatter_list;
        nscatter = 0;
+       if (as->tape && as->bs == 1)
+               total = bp->b_bcount;
        while (n < total && nscatter < NSCATTER) {
                thistime = page_size - ((vm_offset_t)p - trunc_page (p));
 
        while (n < total && nscatter < NSCATTER) {
                thistime = page_size - ((vm_offset_t)p - trunc_page (p));
 
@@ -925,9 +931,9 @@ printf("total %d nblocks %d ", total, nblocks);
        bzero ((caddr_t)ccb, sizeof *ccb); 
 
        if (nscatter)
        bzero ((caddr_t)ccb, sizeof *ccb); 
 
        if (nscatter)
-               ccb->ccb_opcode = 4; /* scatter cmd, return resid */
+               ccb->ccb_opcode = 2; /* scatter cmd, return resid */
        else
        else
-               ccb->ccb_opcode = 3;
+               ccb->ccb_opcode = 0;
        target = dev_target (bp->b_dev);
        ccb->ccb_addr_and_control = target << 5;
        if (bp->b_bcount != 0)
        target = dev_target (bp->b_dev);
        ccb->ccb_addr_and_control = target << 5;
        if (bp->b_bcount != 0)
@@ -1237,11 +1243,13 @@ int val;
                printf ("\n");
        }
 
                printf ("\n");
        }
 
-       bp->b_resid = (ccb->ccb_data_len_msb << 16)
-               | (ccb->ccb_data_len_mid << 8)
-                       | ccb->ccb_data_len_lsb;
-       if (bp != as->scsi_bp && bp->b_resid != 0)
-               printf ("scsi resid = %d\n", bp->b_resid);
+       /* this assignment mixed sizes of controller commands
+           and data to read/write.
+       bp->b_resid = (ccb->ccb_data_len_msb << 16)
+               | (ccb->ccb_data_len_mid << 8)
+                       | ccb->ccb_data_len_lsb;
+        */
+       bp->b_resid = 0;
 
  next:
        asdone (as, 1);
 
  next:
        asdone (as, 1);
index 67e6147..4a6f77d 100644 (file)
@@ -1,11 +1,22 @@
 #      from: @(#)Makefile      7.9 (Berkeley) 5/8/91
 #      from: @(#)Makefile      7.9 (Berkeley) 5/8/91
-
-DESTDIR=/
+#
+# PATCHES MAGIC                LEVEL   PATCH THAT GOT US HERE
+# --------------------         -----   ----------------------
+# CURRENT PATCH LEVEL:         1       00088
+# --------------------         -----   ----------------------
+#
+# 23 Oct 92    Joerg Lohse             added rule to compile 'trimhd'
+#                                      (trimhd = 'dd bs=1 skip=32')
+# 10 Mar 93    Rodney W. Grimes        Fixed DESTDIR and STANDIR so
+#                                      that make install works correctly
+#
+
+DESTDIR=/usr
 LD=/usr/bin/ld
 STAND= /sys/stand
 INCPATH=-I/sys/sys -I/sys -I/sys/ufs  -I${STAND}
 VPATH= ${STAND}
 LD=/usr/bin/ld
 STAND= /sys/stand
 INCPATH=-I/sys/sys -I/sys -I/sys/ufs  -I${STAND}
 VPATH= ${STAND}
-STANDDIR= ${DESTDIR}/stand
+STANDDIR= ${DESTDIR}/mdec
 
 CC=    cc -traditional
 CPP=   cpp -traditional ${INCPATH} -DSTANDALONE -DAT386
 
 CC=    cc -traditional
 CPP=   cpp -traditional ${INCPATH} -DSTANDALONE -DAT386
@@ -48,31 +59,31 @@ asbootblk.o: asbootblk.c
 
 # getting booted from disc
 
 
 # getting booted from disc
 
-wdboot: wdbootblk.o
+wdboot: wdbootblk.o trimhd
        ${LD} -N -T ${RELOC} wdbootblk.o
        rm -f $@; strip a.out; trimhd 32 <a.out >$@; rm -f a.out; ls -l $@
 
        ${LD} -N -T ${RELOC} wdbootblk.o
        rm -f $@; strip a.out; trimhd 32 <a.out >$@; rm -f a.out; ls -l $@
 
-bootwd:        wsrt0.o boot.o bmap.o cga.o fs.o kbd.o prf.o wd.o printf.o breadwd.o
+bootwd:        wsrt0.o boot.o bmap.o cga.o fs.o kbd.o prf.o wd.o printf.o breadwd.o trimhd
        ${LD} -N -T ${RELOC2} wsrt0.o boot.o bmap.o cga.o kbd.o prf.o printf.o \
                breadwd.o fs.o wd.o -lc
        size a.out
        rm -f $@; strip a.out; trimhd 32 <a.out >$@; rm -f a.out; ls -l $@
 
        ${LD} -N -T ${RELOC2} wsrt0.o boot.o bmap.o cga.o kbd.o prf.o printf.o \
                breadwd.o fs.o wd.o -lc
        size a.out
        rm -f $@; strip a.out; trimhd 32 <a.out >$@; rm -f a.out; ls -l $@
 
-fdboot: fdbootblk.o
+fdboot: fdbootblk.o trimhd
        ${LD} -N -T ${RELOC} fdbootblk.o
        rm -f $@; strip a.out; trimhd 32 <a.out >$@; rm -f a.out; ls -l $@
 
        ${LD} -N -T ${RELOC} fdbootblk.o
        rm -f $@; strip a.out; trimhd 32 <a.out >$@; rm -f a.out; ls -l $@
 
-bootfd:        wsrt0.o boot.o bmap.o cga.o fs.o kbd.o prf.o fd.o printf.o breadfd.o
+bootfd:        wsrt0.o boot.o bmap.o cga.o fs.o kbd.o prf.o fd.o printf.o breadfd.o trimhd
        ${LD} -N -T ${RELOC2} wsrt0.o boot.o bmap.o cga.o kbd.o prf.o printf.o \
                breadfd.o fs.o fd.o -lc
        size a.out
        rm -f $@; strip a.out; trimhd 32 <a.out >$@; rm -f a.out; ls -l $@
 
        ${LD} -N -T ${RELOC2} wsrt0.o boot.o bmap.o cga.o kbd.o prf.o printf.o \
                breadfd.o fs.o fd.o -lc
        size a.out
        rm -f $@; strip a.out; trimhd 32 <a.out >$@; rm -f a.out; ls -l $@
 
-asboot:        asbootblk.o
+asboot:        asbootblk.o trimhd
        ${LD} -N -T 7c00 asbootblk.o
        rm -f $@; strip a.out; trimhd 32 <a.out >$@; rm -f a.out; ls -l $@
 
        ${LD} -N -T 7c00 asbootblk.o
        rm -f $@; strip a.out; trimhd 32 <a.out >$@; rm -f a.out; ls -l $@
 
-bootas:        wsrt0.o boot.o bmap.o cga.o fs.o kbd.o prf.o as.o printf.o breadas.o
+bootas:        wsrt0.o boot.o bmap.o cga.o fs.o kbd.o prf.o as.o printf.o breadas.o trimhd
        ${LD} -N -T ${RELOC2} wsrt0.o boot.o bmap.o cga.o kbd.o prf.o printf.o \
                breadas.o fs.o as.o -lc
        size a.out
        ${LD} -N -T ${RELOC2} wsrt0.o boot.o bmap.o cga.o kbd.o prf.o printf.o \
                breadas.o fs.o as.o -lc
        size a.out
@@ -98,8 +109,11 @@ breadas.c: breadxx.c
        rm -f breadas.c
        sed -e 's/XX/as/' -e 's/xx/as/g'        < breadxx.c >> breadas.c
 
        rm -f breadas.c
        sed -e 's/XX/as/' -e 's/xx/as/g'        < breadxx.c >> breadas.c
 
+trimhd:        trimhd.c
+       ${CC} ${CFLAGS} -s -o trimhd trimhd.c
+
 clean:
 clean:
-       rm -f *.o *.exe *.i sm_*.c
+       rm -f *.o *.exe *.i sm_*.c trimhd
        rm -f a.out bfd bwd fdb wdb ${ALL}
        rm -f boot[a-wyz]? boot[a-wyz]?? boot[a-wyz]?.c boot[a-wyz]??.c \
                conf[a-wyz]?.c conf[a-wyz]??.c bread[a-wyz]?.c
        rm -f a.out bfd bwd fdb wdb ${ALL}
        rm -f boot[a-wyz]? boot[a-wyz]?? boot[a-wyz]?.c boot[a-wyz]??.c \
                conf[a-wyz]?.c conf[a-wyz]??.c bread[a-wyz]?.c
index aadc0c7..d731f5a 100644 (file)
@@ -4,6 +4,14 @@
  * Standalone driver for Adaptech 1542 SCSI
  * 
  * Pace Willisson        pace@blitz.com       April 8, 1992
  * Standalone driver for Adaptech 1542 SCSI
  * 
  * Pace Willisson        pace@blitz.com       April 8, 1992
+ *
+ * PATCHES MAGIC                LEVEL   PATCH THAT GOT US HERE
+ * --------------------         -----   ----------------------
+ * CURRENT PATCH LEVEL:         1       00088
+ * --------------------         -----   ----------------------
+ *
+ * 23 Oct 92   Joerg Lohse             changed ccb opcode for compatibility
+ *                                     with Adaptec AHA-1542A
  */
 
 #include "param.h"
  */
 
 #include "param.h"
@@ -185,7 +193,7 @@ int printerr;
 
        bzero (&ccb, sizeof ccb);
 
 
        bzero (&ccb, sizeof ccb);
 
-       ccb.ccb_opcode = 3;
+       ccb.ccb_opcode = 0;
        ccb.ccb_addr_and_control = target << 5;
        if (datalen != 0)
                ccb.ccb_addr_and_control |= readflag ? 8 : 0x10;
        ccb.ccb_addr_and_control = target << 5;
        if (datalen != 0)
                ccb.ccb_addr_and_control |= readflag ? 8 : 0x10;
index 1062a42..87b5436 100644 (file)
  *
  * This bootblock does not support fdisk partitions, and can only be used
  * as the master boot block.
  *
  * This bootblock does not support fdisk partitions, and can only be used
  * as the master boot block.
+ *
+ * PATCHES MAGIC                LEVEL   PATCH THAT GOT US HERE
+ * --------------------         -----   ----------------------
+ * CURRENT PATCH LEVEL:         1       00088
+ * --------------------         -----   ----------------------
+ *
+ * 23 Oct 92   Joerg Lohse             changed ccb opcode for compatibility
+ *                                     with Adaptec AHA-1542A
  */
 
 #include "param.h"
  */
 
 #include "param.h"
@@ -120,7 +128,7 @@ const struct {
 
 volatile struct mailbox_entry mailbox[2];
 const char ccb[] = {
 
 volatile struct mailbox_entry mailbox[2];
 const char ccb[] = {
-       3, /* opcode: normal read/write */
+       0, /* opcode: normal read/write */
        (target << 5) | 8, /* target num and read flag */
        10, /* scsi cmd len */
        1, /* no automatic request for sense */
        (target << 5) | 8, /* target num and read flag */
        10, /* scsi cmd len */
        1, /* no automatic request for sense */